Preserve assumption cache in loop-rotate.
authorEli Friedman <efriedma@codeaurora.org>
Wed, 9 Nov 2016 23:05:01 +0000 (23:05 +0000)
committerEli Friedman <efriedma@codeaurora.org>
Wed, 9 Nov 2016 23:05:01 +0000 (23:05 +0000)
No testcase included because I can't figure out how to reduce it.
(It's easy to write a testcase where rotation clones an assume,
but that doesn't actually seem to trigger the crash in opt on
its own; maybe an issue with the laziness?)

Differential Revision: https://reviews.llvm.org/D26434

llvm-svn: 286410

llvm/lib/Transforms/Scalar/LoopRotation.cpp

index 4498e1d..32d2caa 100644 (file)
@@ -326,6 +326,10 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
       // Otherwise, stick the new instruction into the new block!
       C->setName(Inst->getName());
       C->insertBefore(LoopEntryBranch);
+
+      if (auto *II = dyn_cast<IntrinsicInst>(C))
+        if (II->getIntrinsicID() == Intrinsic::assume)
+          AC->registerAssumption(II);
     }
   }