summaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorFrits van Bommel <fvbommel@gmail.com>2010-12-16 12:16:00 +0000
committerFrits van Bommel <fvbommel@gmail.com>2010-12-16 12:16:00 +0000
commit01abcf339f8d42921c680fefb2ff988cfeee1198 (patch)
tree0a8e8fbaf45d830d85421152c850f748350f6782 /lib/Transforms
parentebef48ea4b0d838d2e4f05024a517bf18b1cc110 (diff)
downloadexternal_llvm-01abcf339f8d42921c680fefb2ff988cfeee1198.zip
external_llvm-01abcf339f8d42921c680fefb2ff988cfeee1198.tar.gz
external_llvm-01abcf339f8d42921c680fefb2ff988cfeee1198.tar.bz2
Fix a bug in the loop in JumpThreading::ProcessThreadableEdges() where it could falsely produce a MultipleDestSentinel value if the first predecessor ended with an 'indirectbr'. If that happened, it caused an unnecessary FindMostPopularDest() call.
This wasn't a correctness problem, but it broke the fast path for single-predecessor blocks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121966 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/JumpThreading.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp
index e59ae31..3d218a6 100644
--- a/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/lib/Transforms/Scalar/JumpThreading.cpp
@@ -984,7 +984,7 @@ FindMostPopularDest(BasicBlock *BB,
}
}
- // Okay, now we know the most popular destination. If there is more than
+ // Okay, now we know the most popular destination. If there is more than one
// destination, we need to determine one. This is arbitrary, but we need
// to make a deterministic decision. Pick the first one that appears in the
// successor list.
@@ -1064,7 +1064,7 @@ bool JumpThreading::ProcessThreadableEdges(Value *Cond, BasicBlock *BB,
}
// If we have exactly one destination, remember it for efficiency below.
- if (i == 0)
+ if (PredToDestList.empty())
OnlyDest = DestBB;
else if (OnlyDest != DestBB)
OnlyDest = MultipleDestSentinel;