summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDinesh Dwivedi <dinesh.d@samsung.com>2014-06-19 14:11:53 +0000
committerDinesh Dwivedi <dinesh.d@samsung.com>2014-06-19 14:11:53 +0000
commitdc9bdcc2cbd027e38d0abfdf36ff3fa59453d8be (patch)
tree703c9b0a707b97e1bffdeb32f22b56487ca26c56 /lib
parent85386a3de9ebcbf688c0cb864fc26c62fa5220f3 (diff)
downloadllvm-dc9bdcc2cbd027e38d0abfdf36ff3fa59453d8be.tar.gz
llvm-dc9bdcc2cbd027e38d0abfdf36ff3fa59453d8be.tar.bz2
llvm-dc9bdcc2cbd027e38d0abfdf36ff3fa59453d8be.tar.xz
Updated comments as suggested by Rafael. Thanks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211268 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/JumpThreading.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp
index e501ff29d0..6e50d3331d 100644
--- a/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/lib/Transforms/Scalar/JumpThreading.cpp
@@ -158,7 +158,13 @@ bool JumpThreading::runOnFunction(Function &F) {
TLI = &getAnalysis<TargetLibraryInfo>();
LVI = &getAnalysis<LazyValueInfo>();
- // Remove unreachable blocks from function as they may result in infinite loop.
+ // Remove unreachable blocks from function as they may result in infinite
+ // loop. We do threading if we found something profitable. Jump threading a
+ // branch can create other opportunities. If these opportunities form a cycle
+ // i.e. if any jump treading is undoing previous threading in the path, then
+ // we will loop forever. We take care of this issue by not jump threading for
+ // back edges. This works for normal cases but not for unreachable blocks as
+ // they may have cycle with no back edge.
removeUnreachableBlocks(F);
FindLoopHeaders(F);