summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-18 03:14:36 +0000
committerChris Lattner <sabre@nondot.org>2010-08-18 03:14:36 +0000
commit3c603024bbaaeb41c105aa0aa922e5b08208533c (patch)
tree583fa84a8a2ff03de6248d820c26375d0dd0c67f /llvm/lib
parentf0b5b67ba5e4ea270f89f7a3a655af18798a7610 (diff)
downloadbcm5719-llvm-3c603024bbaaeb41c105aa0aa922e5b08208533c.tar.gz
bcm5719-llvm-3c603024bbaaeb41c105aa0aa922e5b08208533c.zip
Fix PR7755: knowing something about an inval for a pred
from the LHS should disable reconsidering that pred on the RHS. However, knowing something about the pred on the RHS shouldn't disable subsequent additions on the RHS from happening. llvm-svn: 111349
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/JumpThreading.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index c2caf48b761..b17f80d39c0 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -341,25 +341,21 @@ ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB,PredValueInfo &Result){
else
InterestingVal = ConstantInt::getFalse(I->getContext());
+ SmallPtrSet<BasicBlock*, 4> LHSKnownBBs;
+
// Scan for the sentinel. If we find an undef, force it to the
// interesting value: x|undef -> true and x&undef -> false.
for (unsigned i = 0, e = LHSVals.size(); i != e; ++i)
if (LHSVals[i].first == InterestingVal || LHSVals[i].first == 0) {
Result.push_back(LHSVals[i]);
Result.back().first = InterestingVal;
+ LHSKnownBBs.insert(LHSVals[i].second);
}
for (unsigned i = 0, e = RHSVals.size(); i != e; ++i)
if (RHSVals[i].first == InterestingVal || RHSVals[i].first == 0) {
// If we already inferred a value for this block on the LHS, don't
// re-add it.
- bool HasValue = false;
- for (unsigned r = 0, e = Result.size(); r != e; ++r)
- if (Result[r].second == RHSVals[i].second) {
- HasValue = true;
- break;
- }
-
- if (!HasValue) {
+ if (!LHSKnownBBs.count(RHSVals[i].second)) {
Result.push_back(RHSVals[i]);
Result.back().first = InterestingVal;
}
OpenPOWER on IntegriCloud