diff options
| author | Owen Anderson <resistor@mac.com> | 2010-08-18 18:39:01 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2010-08-18 18:39:01 +0000 |
| commit | 208636fa3368570a34447053162fc4218c560c03 (patch) | |
| tree | c68142d55f7efac4de32c44866c5358a6c67f132 /llvm/lib/Transforms/Scalar | |
| parent | d1f57fc6a3c91cc1eb39a4fdb28265660a3c3cb1 (diff) | |
| download | bcm5719-llvm-208636fa3368570a34447053162fc4218c560c03.tar.gz bcm5719-llvm-208636fa3368570a34447053162fc4218c560c03.zip | |
Inform LazyValueInfo whenever a block is deleted, to avoid dangling pointer issues.
llvm-svn: 111382
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/JumpThreading.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index b17f80d39c0..2c3c39b06b4 100644 --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp @@ -147,6 +147,7 @@ bool JumpThreading::runOnFunction(Function &F) { DEBUG(dbgs() << " JT: Deleting dead block '" << BB->getName() << "' with terminator: " << *BB->getTerminator() << '\n'); LoopHeaders.erase(BB); + if (LVI) LVI->eraseBlock(BB); DeleteDeadBlock(BB); Changed = true; } else if (BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator())) { @@ -167,6 +168,11 @@ bool JumpThreading::runOnFunction(Function &F) { bool ErasedFromLoopHeaders = LoopHeaders.erase(BB); BasicBlock *Succ = BI->getSuccessor(0); + // FIXME: It is always conservatively correct to drop the info + // for a block even if it doesn't get erased. This isn't totally + // awesome, but it allows us to use AssertingVH to prevent nasty + // dangling pointer issues within LazyValueInfo. + if (LVI) LVI->eraseBlock(BB); if (TryToSimplifyUncondBranchFromEmptyBlock(BB)) { Changed = true; // If we deleted BB and BB was the header of a loop, then the @@ -489,6 +495,7 @@ bool JumpThreading::ProcessBlock(BasicBlock *BB) { // Remember if SinglePred was the entry block of the function. If so, we // will need to move BB back to the entry position. bool isEntry = SinglePred == &SinglePred->getParent()->getEntryBlock(); + if (LVI) LVI->eraseBlock(SinglePred); MergeBasicBlockIntoOnlyPred(BB); if (isEntry && BB != &BB->getParent()->getEntryBlock()) |

