summaryrefslogtreecommitdiff
path: root/test/Transforms/JumpThreading
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-09-29 20:34:41 +0000
committerOwen Anderson <resistor@mac.com>2010-09-29 20:34:41 +0000
commit36c4debc94e7c68c769dfda781851a0c963dd746 (patch)
tree33eccf15a31f7d37f448c45f09fed1c3af23147f /test/Transforms/JumpThreading
parent18d52f2fb551c295bbce4c7d7357f4050b06e926 (diff)
downloadllvm-36c4debc94e7c68c769dfda781851a0c963dd746.tar.gz
llvm-36c4debc94e7c68c769dfda781851a0c963dd746.tar.bz2
llvm-36c4debc94e7c68c769dfda781851a0c963dd746.tar.xz
Fix PR8247: JumpThreading can cause a block to become unreachable while still having predecessor, if it is part of a self-loop.
Because of this, we cannot use the Simplify* APIs, as they can assert-fail on unreachable code. Since it's not easy to determine if a given threading will cause a block to become unreachable, simply defer simplifying simplification to later InstCombine and/or DCE passes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115082 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/JumpThreading')
-rw-r--r--test/Transforms/JumpThreading/crash.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Transforms/JumpThreading/crash.ll b/test/Transforms/JumpThreading/crash.ll
index 751bc6518a..aed51a1c9e 100644
--- a/test/Transforms/JumpThreading/crash.ll
+++ b/test/Transforms/JumpThreading/crash.ll
@@ -484,3 +484,30 @@ bb269.us.us:
bb288.bb289.loopexit_crit_edge:
unreachable
}
+
+; PR 8247
+%struct.S1 = type { i8, i8 }
+@func_89.l_245 = internal constant %struct.S1 { i8 33, i8 6 }, align 1
+define void @func_89(i16 zeroext %p_90, %struct.S1* nocapture %p_91, i32* nocapture %p_92) nounwind ssp {
+entry:
+ store i32 0, i32* %p_92, align 4
+ br i1 false, label %lbl_260, label %if.else
+
+if.else: ; preds = %entry
+ br label %for.cond
+
+for.cond: ; preds = %lbl_260, %if.else
+ %l_245.0 = phi i16 [ %l_245.1, %lbl_260 ], [ 33, %if.else ]
+ %l_261.0 = phi i32 [ %and, %lbl_260 ], [ 255, %if.else ]
+ %tobool21 = icmp ult i16 %l_245.0, 256
+ br i1 %tobool21, label %if.end, label %lbl_260
+
+lbl_260: ; preds = %for.cond, %entry
+ %l_245.1 = phi i16 [ 1569, %entry ], [ %l_245.0, %for.cond ]
+ %l_261.1 = phi i32 [ 255, %entry ], [ %l_261.0, %for.cond ]
+ %and = and i32 %l_261.1, 1
+ br label %for.cond
+
+if.end: ; preds = %for.cond
+ ret void
+}