summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit9bbe849fc345e5bbb757faafa1d1da8a5a439c42 (patch)
tree2dba14bd5618eacad4771fbf150c10680c3eb2f4 /llvm/lib/Transforms
parent8d1ab6f6e1afb1d96246558d960b766df9d83ab4 (diff)
downloadbcm5719-llvm-9bbe849fc345e5bbb757faafa1d1da8a5a439c42.tar.gz
bcm5719-llvm-9bbe849fc345e5bbb757faafa1d1da8a5a439c42.zip
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. llvm-svn: 121966
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/JumpThreading.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index e59ae31e134..3d218a6585a 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/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;
OpenPOWER on IntegriCloud