[llvm] r279335 - Partially revert 279331, as we modify this instruction in the loop

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 15:18:38 PDT 2016


Author: dannyb
Date: Fri Aug 19 17:18:38 2016
New Revision: 279335

URL: http://llvm.org/viewvc/llvm-project?rev=279335&view=rev
Log:
Partially revert 279331, as we modify this instruction in the loop

Modified:
    llvm/trunk/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp?rev=279335&r1=279334&r2=279335&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp Fri Aug 19 17:18:38 2016
@@ -1150,9 +1150,13 @@ bool SeparateConstOffsetFromGEP::reunite
 bool SeparateConstOffsetFromGEP::reuniteExts(Function &F) {
   bool Changed = false;
   DominatingExprs.clear();
-  for (const auto Node : depth_first(DT))
-    for (auto &I : *(Node->getBlock()))
-      Changed |= reuniteExts(&I);
+  for (const auto Node : depth_first(DT)) {
+    BasicBlock *BB = Node->getBlock();
+    for (auto I = BB->begin(); I != BB->end(); ) {
+      Instruction *Cur = &*I++;
+      Changed |= reuniteExts(Cur);
+    }
+  }
   return Changed;
 }
 




More information about the llvm-commits mailing list