diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-10 18:26:57 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-10 18:26:57 +0000 |
commit | 9ae28b141f1c8f9f3007dcb90245efc550a7681c (patch) | |
tree | efb48f070af790626e83bcc207b20bc6d30022bd /llvm/lib/Transforms | |
parent | b9801ffcb530dc89c90e146a6c2aae4387e5e852 (diff) | |
download | bcm5719-llvm-9ae28b141f1c8f9f3007dcb90245efc550a7681c.tar.gz bcm5719-llvm-9ae28b141f1c8f9f3007dcb90245efc550a7681c.zip |
fix PR6743, a case where we'd delete an instruction before using it
in some cases.
llvm-svn: 100937
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/JumpThreading.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index a6489ecc2dc..df05b712dcb 100644 --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp @@ -670,8 +670,10 @@ bool JumpThreading::ProcessBranchOnDuplicateCond(BasicBlock *PredBB, Value *OldCond = DestBI->getCondition(); DestBI->setCondition(ConstantInt::get(Type::getInt1Ty(BB->getContext()), BranchDir)); - ConstantFoldTerminator(BB); + // Delete dead instructions before we fold the branch. Folding the branch + // can eliminate edges from the CFG which can end up deleting OldCond. RecursivelyDeleteTriviallyDeadInstructions(OldCond); + ConstantFoldTerminator(BB); return true; } |