diff options
author | Chris Lattner <sabre@nondot.org> | 2010-12-13 08:12:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-12-13 08:12:19 +0000 |
commit | a9f6bbea62f42ab052eca423588e309ab67c3fa3 (patch) | |
tree | ca5029804d84346e8cefccbdd9f1c04f9780ab78 /lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 92407e589524d98080f4db943a0e2a3bf18ec8a2 (diff) |
reinstate my patch: the miscompile was caused by an inverted branch in the
'and' case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121695 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index d7a6ea4655..71d9ef8483 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1909,13 +1909,15 @@ static bool SimplifyBranchOnICmpChain(BranchInst *BI, const TargetData *TD) { // then we evaluate them with an explicit branch first. Split the block // right before the condbr to handle it. if (ExtraCase) { - return false; - BasicBlock *NewBB = BB->splitBasicBlock(BI, "switch.early.test"); // Remove the uncond branch added to the old block. TerminatorInst *OldTI = BB->getTerminator(); - BranchInst::Create(EdgeBB, NewBB, ExtraCase, OldTI); + if (TrueWhenEqual) + BranchInst::Create(EdgeBB, NewBB, ExtraCase, OldTI); + else + BranchInst::Create(NewBB, EdgeBB, ExtraCase, OldTI); + OldTI->eraseFromParent(); // If there are PHI nodes in EdgeBB, then we need to add a new entry to them @@ -1955,6 +1957,7 @@ static bool SimplifyBranchOnICmpChain(BranchInst *BI, const TargetData *TD) { // Erase the old branch instruction. EraseTerminatorInstAndDCECond(BI); + return true; } |