From 11da66fc103687beeb785eee224ede91669d9013 Mon Sep 17 00:00:00 2001 From: Daniel Berlin Date: Fri, 19 Aug 2016 22:18:38 +0000 Subject: [PATCH] Partially revert 279331, as we modify this instruction in the loop llvm-svn: 279335 --- llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp b/llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp index 961a3c1..62c9f46 100644 --- a/llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp +++ b/llvm/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp @@ -1150,9 +1150,13 @@ bool SeparateConstOffsetFromGEP::reuniteExts(Instruction *I) { 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; } -- 2.7.4