diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-11-12 05:24:05 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-11-12 05:24:05 +0000 |
| commit | 5f6b8b2bcb32d6da3d6d7a1c6daf2af8ad0de62b (patch) | |
| tree | 38f1107f361d55feb485f47443a1ad35ac5198aa /llvm/lib/Transforms | |
| parent | 22db4b5e0ce40255127e97ec2605f539d254755a (diff) | |
| download | bcm5719-llvm-5f6b8b2bcb32d6da3d6d7a1c6daf2af8ad0de62b.tar.gz bcm5719-llvm-5f6b8b2bcb32d6da3d6d7a1c6daf2af8ad0de62b.zip | |
use getPredicateOnEdge to fold comparisons through PHI nodes,
which implements GCC PR18046. This also gets us 360 more
jump threads on 176.gcc.
llvm-svn: 86953
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/JumpThreading.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index 1bfad2d5d7e..d5ce86aca0c 100644 --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp @@ -368,7 +368,17 @@ ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB,PredValueInfo &Result){ Value *RHS = Cmp->getOperand(1)->DoPHITranslation(BB, PredBB); Value *Res = SimplifyCmpInst(Cmp->getPredicate(), LHS, RHS, TD); - if (Res == 0) continue; + if (Res == 0) { + if (!LVI || !isa<Constant>(RHS)) + continue; + + LazyValueInfo::Tristate + ResT = LVI->getPredicateOnEdge(Cmp->getPredicate(), LHS, + cast<Constant>(RHS), PredBB, BB); + if (ResT == LazyValueInfo::Unknown) + continue; + Res = ConstantInt::get(Type::getInt1Ty(LHS->getContext()), ResT); + } if (isa<UndefValue>(Res)) Result.push_back(std::make_pair((ConstantInt*)0, PredBB)); |

