diff options
author | Chris Lattner <sabre@nondot.org> | 2009-10-11 18:39:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-10-11 18:39:58 +0000 |
commit | 5a06cf644f35b873686c8694968192ad3385e36a (patch) | |
tree | 9b50fc5a73451b253060db85f5e36bbe593a8cf1 /lib/Transforms/Scalar/JumpThreading.cpp | |
parent | f9f3cb18457d493b55bda504c9ab2a6dff239795 (diff) |
when folding duplicate conditions, delete the
now-probably-dead instruction tree feeding it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83778 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r-- | lib/Transforms/Scalar/JumpThreading.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp index 210d6ef5a2..8b11edd891 100644 --- a/lib/Transforms/Scalar/JumpThreading.cpp +++ b/lib/Transforms/Scalar/JumpThreading.cpp @@ -450,9 +450,11 @@ bool JumpThreading::ProcessBranchOnDuplicateCond(BasicBlock *PredBB, << "' folding condition to '" << BranchDir << "': " << *BB->getTerminator() << '\n'); ++NumFolds; + Value *OldCond = DestBI->getCondition(); DestBI->setCondition(ConstantInt::get(Type::getInt1Ty(BB->getContext()), BranchDir)); ConstantFoldTerminator(BB); + RecursivelyDeleteTriviallyDeadInstructions(OldCond); return true; } |