diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-07-15 06:06:04 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-07-15 06:06:04 +0000 |
| commit | 110321d3c438eb3fad318784bea2a3b4ea64b20f (patch) | |
| tree | ed560bc6c98ac07fc048c24e8e025f92e92f13f4 /lib/Transforms/Utils/Local.cpp | |
| parent | 6c0464208ba23b7481949cb1ca09b4b690fb837d (diff) | |
| download | external_llvm-110321d3c438eb3fad318784bea2a3b4ea64b20f.zip external_llvm-110321d3c438eb3fad318784bea2a3b4ea64b20f.tar.gz external_llvm-110321d3c438eb3fad318784bea2a3b4ea64b20f.tar.bz2 | |
make various clients of ReplaceAndSimplifyAllUses tolerate
it *changing* the things it replaces, not just causing them
to drop to null. There is no functionality change yet, but
this is required for a subsequent patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108414 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/Local.cpp')
| -rw-r--r-- | lib/Transforms/Utils/Local.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/Utils/Local.cpp b/lib/Transforms/Utils/Local.cpp index 0b48a8f..8e91138 100644 --- a/lib/Transforms/Utils/Local.cpp +++ b/lib/Transforms/Utils/Local.cpp @@ -306,7 +306,7 @@ bool llvm::SimplifyInstructionsInBlock(BasicBlock *BB, const TargetData *TD) { WeakVH BIHandle(BI); ReplaceAndSimplifyAllUses(Inst, V, TD); MadeChange = true; - if (BIHandle == 0) + if (BIHandle != BI) BI = BB->begin(); continue; } @@ -354,12 +354,13 @@ void llvm::RemovePredecessorAndSimplify(BasicBlock *BB, BasicBlock *Pred, // value into all of its uses. assert(PNV != PN && "hasConstantValue broken"); + Value *OldPhiIt = PhiIt; ReplaceAndSimplifyAllUses(PN, PNV, TD); // If recursive simplification ended up deleting the next PHI node we would // iterate to, then our iterator is invalid, restart scanning from the top // of the block. - if (PhiIt == 0) PhiIt = &BB->front(); + if (PhiIt != OldPhiIt) PhiIt = &BB->front(); } } |
