diff options
author | Cameron Zwarich <zwarich@apple.com> | 2011-03-24 04:52:04 +0000 |
---|---|---|
committer | Cameron Zwarich <zwarich@apple.com> | 2011-03-24 04:52:04 +0000 |
commit | 680c962ebddca67195463d9c5ff40d3cf888b5b4 (patch) | |
tree | 8ad220f5994246bbb7e00e56ce44cd257a7694f0 /lib/Transforms/Scalar/CodeGenPrepare.cpp | |
parent | 661a390b830fcdea13ed9daeaf4e6dbd1adcdca6 (diff) | |
download | llvm-680c962ebddca67195463d9c5ff40d3cf888b5b4.tar.gz llvm-680c962ebddca67195463d9c5ff40d3cf888b5b4.tar.bz2 llvm-680c962ebddca67195463d9c5ff40d3cf888b5b4.tar.xz |
When UpdateDT is set, DT is invalid, which could cause problems when trying to
use it later. I couldn't make a test that hits this with the current code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128195 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/CodeGenPrepare.cpp')
-rw-r--r-- | lib/Transforms/Scalar/CodeGenPrepare.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp index 604e791e27..75ac4d81af 100644 --- a/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/lib/Transforms/Scalar/CodeGenPrepare.cpp @@ -331,7 +331,7 @@ void CodeGenPrepare::EliminateMostlyEmptyBlock(BasicBlock *BB) { // The PHIs are now updated, change everything that refers to BB to use // DestBB and remove BB. BB->replaceAllUsesWith(DestBB); - if (DT) { + if (DT && !UpdateDT) { BasicBlock *BBIDom = DT->getNode(BB)->getIDom()->getBlock(); BasicBlock *DestBBIDom = DT->getNode(DestBB)->getIDom()->getBlock(); BasicBlock *NewIDom = DT->findNearestCommonDominator(BBIDom, DestBBIDom); @@ -534,7 +534,8 @@ bool CodeGenPrepare::OptimizeCallInst(CallInst *CI) { // happens. WeakVH IterHandle(CurInstIterator); - ReplaceAndSimplifyAllUses(CI, RetVal, TLI ? TLI->getTargetData() : 0, DT); + ReplaceAndSimplifyAllUses(CI, RetVal, TLI ? TLI->getTargetData() : 0, + UpdateDT ? 0 : DT); // If the iterator instruction was recursively deleted, start over at the // start of the block. |