Stop relying on MDNode::get() returning self-references
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sun, 7 Dec 2014 21:12:10 +0000 (21:12 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sun, 7 Dec 2014 21:12:10 +0000 (21:12 +0000)
Update for LLVM API change, wherein self-references are not uniqued (and
will never be returned by `MDNode::get()`).  We already have `Id`; just
return it.

This should fix the failing buildbot:

  http://lab.llvm.org:8011/builders/polly-amd64-linux/builds/25167
  http://lab.llvm.org:8011/builders/polly-amd64-linux/builds/25168

llvm-svn: 223620

polly/lib/CodeGen/IRBuilder.cpp

index 248f0cf..22532b5 100644 (file)
@@ -95,9 +95,10 @@ void ScopAnnotator::pushLoop(Loop *L, bool IsParallel) {
 
   BasicBlock *Header = L->getHeader();
   MDNode *Id = getID(Header->getContext());
-  Value *Args[] = {Id};
+  assert(Id->getOperand(0) == Id && "Expected Id to be a self-reference");
+  assert(Id->getNumOperands() == 1 && "Unexpected extra operands in Id");
   MDNode *Ids = ParallelLoops.empty()
-                    ? MDNode::get(Header->getContext(), Args)
+                    ? Id
                     : MDNode::concatenate(ParallelLoops.back(), Id);
   ParallelLoops.push_back(Ids);
 }