diff options
Diffstat (limited to 'test/Transforms/JumpThreading')
-rw-r--r-- | test/Transforms/JumpThreading/2011-04-02-SimplifyDeadBlock.ll | 32 | ||||
-rw-r--r-- | test/Transforms/JumpThreading/2011-04-14-InfLoop.ll | 31 | ||||
-rw-r--r-- | test/Transforms/JumpThreading/pr9331.ll | 50 |
3 files changed, 113 insertions, 0 deletions
diff --git a/test/Transforms/JumpThreading/2011-04-02-SimplifyDeadBlock.ll b/test/Transforms/JumpThreading/2011-04-02-SimplifyDeadBlock.ll new file mode 100644 index 0000000000000..76dd2d12bdecf --- /dev/null +++ b/test/Transforms/JumpThreading/2011-04-02-SimplifyDeadBlock.ll @@ -0,0 +1,32 @@ +; RUN: opt < %s -jump-threading +; PR9446 +; Just check that it doesn't crash + +define void @int327() nounwind { +entry: + unreachable + +for.cond: ; preds = %for.cond4 + %tobool3 = icmp eq i8 undef, 0 + br i1 %tobool3, label %for.cond23, label %for.cond4 + +for.cond4: ; preds = %for.cond + br label %for.cond + +for.cond23: ; preds = %for.body28, %for.cond23, %for.cond + %conv321 = phi i32 [ %conv32, %for.body28 ], [ 0, %for.cond ], [ %conv321, %for.cond23 ] + %l_266.0 = phi i32 [ %phitmp, %for.body28 ], [ 0, %for.cond ], [ 0, %for.cond23 ] + %cmp26 = icmp eq i32 %l_266.0, 0 + br i1 %cmp26, label %for.body28, label %for.cond23 + +for.body28: ; preds = %for.cond23 + %and = and i32 %conv321, 1 + %conv32 = zext i8 undef to i32 + %add = add nsw i32 %l_266.0, 1 + %phitmp = and i32 %add, 255 + br label %for.cond23 + +if.end43: ; No predecessors! + ret void +} + diff --git a/test/Transforms/JumpThreading/2011-04-14-InfLoop.ll b/test/Transforms/JumpThreading/2011-04-14-InfLoop.ll new file mode 100644 index 0000000000000..46aaa00380e33 --- /dev/null +++ b/test/Transforms/JumpThreading/2011-04-14-InfLoop.ll @@ -0,0 +1,31 @@ +; RUN: opt -jump-threading < %s +; <rdar://problem/9284786> + +%0 = type <{ i64, i16, i64, i8, i8 }> + +@g_338 = external global %0, align 8 + +define void @func_1() nounwind ssp { +entry: + ret void + +for.cond1177: + %inc1187 = add nsw i32 0, 1 + %cmp1179 = icmp slt i32 %inc1187, 5 + br i1 %cmp1179, label %for.cond1177, label %land.rhs1320 + +land.rhs1320: + %tmp1324 = volatile load i64* getelementptr inbounds (%0* @g_338, i64 0, i32 2), align 1, !tbaa !0 + br label %if.end.i + +if.end.i: + %tobool.pr.i = phi i1 [ false, %if.end.i ], [ false, %land.rhs1320 ] + br i1 %tobool.pr.i, label %return, label %if.end.i + +return: + ret void +} + +!0 = metadata !{metadata !"long long", metadata !1} +!1 = metadata !{metadata !"omnipotent char", metadata !2} +!2 = metadata !{metadata !"Simple C/C++ TBAA", null} diff --git a/test/Transforms/JumpThreading/pr9331.ll b/test/Transforms/JumpThreading/pr9331.ll new file mode 100644 index 0000000000000..4c06d526ca189 --- /dev/null +++ b/test/Transforms/JumpThreading/pr9331.ll @@ -0,0 +1,50 @@ +; RUN: opt -jump-threading -S < %s + +define void @func(i8 zeroext %p_44) nounwind { +entry: + br i1 false, label %for.cond2, label %if.end50 + +for.cond2: ; preds = %for.inc46, %lor.end, %entry + %p_44.addr.1 = phi i8 [ %p_44.addr.1, %lor.end ], [ %p_44, %entry ], [ %p_44.addr.1, %for.inc46 ] + br i1 undef, label %for.inc46, label %for.body5 + +for.body5: ; preds = %for.cond2 + br i1 undef, label %lbl_465, label %if.then9 + +if.then9: ; preds = %for.body5 + br label %return + +lbl_465: ; preds = %lbl_465, %for.body5 + %tobool19 = icmp eq i8 undef, 0 + br i1 %tobool19, label %if.end21, label %lbl_465 + +if.end21: ; preds = %lbl_465 + %conv23 = zext i8 %p_44.addr.1 to i64 + %xor = xor i64 %conv23, 1 + %tobool.i = icmp eq i64 %conv23, 0 + br i1 %tobool.i, label %cond.false.i, label %safe_mod_func_uint64_t_u_u.exit + +cond.false.i: ; preds = %if.end21 + %div.i = udiv i64 %xor, %conv23 + br label %safe_mod_func_uint64_t_u_u.exit + +safe_mod_func_uint64_t_u_u.exit: ; preds = %cond.false.i, %if.end21 + %cond.i = phi i64 [ %div.i, %cond.false.i ], [ %conv23, %if.end21 ] + %tobool28 = icmp eq i64 %cond.i, 0 + br i1 %tobool28, label %lor.rhs, label %lor.end + +lor.rhs: ; preds = %safe_mod_func_uint64_t_u_u.exit + br label %lor.end + +lor.end: ; preds = %lor.rhs, %safe_mod_func_uint64_t_u_u.exit + br label %for.cond2 + +for.inc46: ; preds = %for.cond2 + br label %for.cond2 + +if.end50: ; preds = %entry + br label %return + +return: ; preds = %if.end50, %if.then9 + ret void +} |