1 ; RUN: opt -O3 -S < %s | FileCheck %s
3 ; Confirm that we do not create assumes, clone them,
4 ; and then cause a compile-time explosion trying to
5 ; simplify them all. Ie, this can become nearly an
6 ; infinite-loop if things go bad.
7 ; https://llvm.org/PR49785
9 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
10 target triple = "x86_64-apple-macosx11.0.0"
12 @e = global i16 0, align 2
13 @a = global i32 0, align 4
14 @c = global i32 0, align 4
15 @b = global i32 0, align 4
16 @d = global i32 0, align 4
18 ; Not checking complete IR because it could be very
19 ; large with vectorization and unrolling (thousands
26 store i32 5, ptr @c, align 4, !tbaa !3
30 %0 = load i32, ptr @c, align 4, !tbaa !3
31 %cmp = icmp sle i32 %0, 63
32 br i1 %cmp, label %for.body, label %for.end34
35 store i16 9, ptr @e, align 2, !tbaa !7
39 %1 = load i16, ptr @e, align 2, !tbaa !7
40 %conv = zext i16 %1 to i32
41 %cmp2 = icmp sle i32 %conv, 60
42 br i1 %cmp2, label %for.body4, label %for.end32
45 %2 = load i16, ptr @e, align 2, !tbaa !7
46 %conv5 = zext i16 %2 to i32
47 %3 = load i32, ptr @b, align 4, !tbaa !3
48 %xor = xor i32 %conv5, %3
49 %4 = load i32, ptr @d, align 4, !tbaa !3
50 %cmp6 = icmp ne i32 %xor, %4
51 br i1 %cmp6, label %if.then, label %if.end27
54 %5 = load i32, ptr @a, align 4, !tbaa !3
55 %conv8 = sext i32 %5 to i64
56 %6 = inttoptr i64 %conv8 to ptr
57 store i8 3, ptr %6, align 1, !tbaa !9
61 %7 = load i8, ptr %6, align 1, !tbaa !9
62 %conv10 = sext i8 %7 to i32
63 %cmp11 = icmp sle i32 %conv10, 32
64 br i1 %cmp11, label %for.body13, label %for.end26
67 %8 = load i8, ptr %6, align 1, !tbaa !9
68 %tobool = icmp ne i8 %8, 0
69 br i1 %tobool, label %if.then14, label %if.end
72 store i8 1, ptr @a, align 1, !tbaa !9
76 %9 = load i8, ptr @a, align 1, !tbaa !9
77 %conv16 = sext i8 %9 to i32
78 %cmp17 = icmp sle i32 %conv16, 30
79 br i1 %cmp17, label %for.body19, label %for.end
82 %10 = load i32, ptr @c, align 4, !tbaa !3
83 %cmp20 = icmp eq i32 0, %10
84 %conv21 = zext i1 %cmp20 to i32
85 %11 = load i8, ptr @a, align 1, !tbaa !9
86 %conv22 = sext i8 %11 to i32
87 %and = and i32 %conv22, %conv21
88 %conv23 = trunc i32 %and to i8
89 store i8 %conv23, ptr @a, align 1, !tbaa !9
90 br label %for.cond15, !llvm.loop !10
99 %12 = load i8, ptr %6, align 1, !tbaa !9
100 %conv24 = sext i8 %12 to i32
101 %add = add nsw i32 %conv24, 1
102 %conv25 = trunc i32 %add to i8
103 store i8 %conv25, ptr %6, align 1, !tbaa !9
104 br label %for.cond9, !llvm.loop !12
113 %13 = load i16, ptr @e, align 2, !tbaa !7
114 %conv29 = zext i16 %13 to i32
115 %add30 = add nsw i32 %conv29, 1
116 %conv31 = trunc i32 %add30 to i16
117 store i16 %conv31, ptr @e, align 2, !tbaa !7
118 br label %for.cond1, !llvm.loop !13
124 %14 = load i32, ptr @c, align 4, !tbaa !3
125 %inc = add nsw i32 %14, 1
126 store i32 %inc, ptr @c, align 4, !tbaa !3
127 br label %for.cond, !llvm.loop !14
133 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1
134 declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1
136 attributes #0 = { nounwind ssp uwtable "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="penryn" "target-features"="+cx16,+cx8,+fxsr,+mmx,+sahf,+sse,+sse2,+sse3,+sse4.1,+ssse3,+x87" "tune-cpu"="generic" }
137 attributes #1 = { argmemonly nofree nosync nounwind willreturn }
139 !llvm.module.flags = !{!0, !1}
142 !0 = !{i32 1, !"wchar_size", i32 4}
143 !1 = !{i32 7, !"PIC Level", i32 2}
144 !2 = !{!"clang version 13.0.0 (https://github.com/llvm/llvm-project.git 7a4abc07dd8f1d8217e482ebbf438197c1aea7f0)"}
145 !3 = !{!4, !4, i64 0}
146 !4 = !{!"int", !5, i64 0}
147 !5 = !{!"omnipotent char", !6, i64 0}
148 !6 = !{!"Simple C/C++ TBAA"}
149 !7 = !{!8, !8, i64 0}
150 !8 = !{!"short", !5, i64 0}
151 !9 = !{!5, !5, i64 0}
152 !10 = distinct !{!10, !11}
153 !11 = !{!"llvm.loop.mustprogress"}
154 !12 = distinct !{!12, !11}
155 !13 = distinct !{!13, !11}
156 !14 = distinct !{!14, !11}