mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
Resurrect the assertion removed by r227717
Summary: MSVC can compile "LoopID->getOperand(0) == LoopID" when LoopID is MDNode*. Test Plan: no regression Reviewers: mkuper Subscribers: jholewinski, llvm-commits Differential Revision: http://reviews.llvm.org/D7327 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227853 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -553,16 +553,17 @@ bool llvm::UnrollLoop(Loop *L, unsigned Count, unsigned TripCount,
|
||||
/// Given an llvm.loop loop id metadata node, returns the loop hint metadata
|
||||
/// node with the given name (for example, "llvm.loop.unroll.count"). If no
|
||||
/// such metadata node exists, then nullptr is returned.
|
||||
const MDNode *llvm::GetUnrollMetadata(const MDNode *LoopID, StringRef Name) {
|
||||
MDNode *llvm::GetUnrollMetadata(MDNode *LoopID, StringRef Name) {
|
||||
// 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");
|
||||
|
||||
for (unsigned i = 1, e = LoopID->getNumOperands(); i < e; ++i) {
|
||||
const MDNode *MD = dyn_cast<MDNode>(LoopID->getOperand(i));
|
||||
MDNode *MD = dyn_cast<MDNode>(LoopID->getOperand(i));
|
||||
if (!MD)
|
||||
continue;
|
||||
|
||||
const MDString *S = dyn_cast<MDString>(MD->getOperand(0));
|
||||
MDString *S = dyn_cast<MDString>(MD->getOperand(0));
|
||||
if (!S)
|
||||
continue;
|
||||
|
||||
|
Reference in New Issue
Block a user