From aedb1385c2c6dc52794fb2f9c82670263d1cee34 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 28 Nov 2008 22:50:08 +0000 Subject: [PATCH] don't revisit instructions off the beginning of the block. llvm-svn: 60221 --- lib/Transforms/Scalar/DeadStoreElimination.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index b48bbeae66b..e6a05b7e90b 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -132,7 +132,8 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) { // If we deleted a store, reinvestigate this instruction. if (deletedStore) { - --BBI; + if (!isa(BB.begin())) + --BBI; continue; } } @@ -160,7 +161,8 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) { DT.dominates(dep, L))) { DeleteDeadInstruction(S); - --BBI; + if (!isa(BB.begin())) + --BBI; NumFastStores++; MadeChange = true; } else