forked from OSchip/llvm-project
[LoopUtils] Add asserts to findStringMetadataForLoop. NFC
These ensure that operand array has at least one element and it is the self-reference. llvm-svn: 267015
This commit is contained in:
parent
963341c872
commit
293be666eb
|
@ -830,6 +830,11 @@ bool llvm::findStringMetadataForLoop(Loop *TheLoop, StringRef Name) {
|
|||
// Return false if LoopID is false.
|
||||
if (!LoopID)
|
||||
return false;
|
||||
|
||||
// First operand should refer to the loop id itself.
|
||||
assert(LoopID->getNumOperands() > 0 && "requires at least one operand");
|
||||
assert(LoopID->getOperand(0) == LoopID && "invalid loop id");
|
||||
|
||||
// Iterate over LoopID operands and look for MDString Metadata
|
||||
for (unsigned i = 1, e = LoopID->getNumOperands(); i < e; ++i) {
|
||||
MDNode *MD = dyn_cast<MDNode>(LoopID->getOperand(i));
|
||||
|
|
Loading…
Reference in New Issue