157 lines · plain
1; RUN: opt -O3 -S < %s | FileCheck %s2 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/PR497858 9target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"10target triple = "x86_64-apple-macosx11.0.0"11 12@e = global i16 0, align 213@a = global i32 0, align 414@c = global i32 0, align 415@b = global i32 0, align 416@d = global i32 0, align 417 18; Not checking complete IR because it could be very 19; large with vectorization and unrolling (thousands 20; of lines of IR).21 22define void @f() #0 {23; CHECK-LABEL: @f(24;25entry:26 store i32 5, ptr @c, align 4, !tbaa !327 br label %for.cond28 29for.cond:30 %0 = load i32, ptr @c, align 4, !tbaa !331 %cmp = icmp sle i32 %0, 6332 br i1 %cmp, label %for.body, label %for.end3433 34for.body:35 store i16 9, ptr @e, align 2, !tbaa !736 br label %for.cond137 38for.cond1:39 %1 = load i16, ptr @e, align 2, !tbaa !740 %conv = zext i16 %1 to i3241 %cmp2 = icmp sle i32 %conv, 6042 br i1 %cmp2, label %for.body4, label %for.end3243 44for.body4:45 %2 = load i16, ptr @e, align 2, !tbaa !746 %conv5 = zext i16 %2 to i3247 %3 = load i32, ptr @b, align 4, !tbaa !348 %xor = xor i32 %conv5, %349 %4 = load i32, ptr @d, align 4, !tbaa !350 %cmp6 = icmp ne i32 %xor, %451 br i1 %cmp6, label %if.then, label %if.end2752 53if.then:54 %5 = load i32, ptr @a, align 4, !tbaa !355 %conv8 = sext i32 %5 to i6456 %6 = inttoptr i64 %conv8 to ptr57 store i8 3, ptr %6, align 1, !tbaa !958 br label %for.cond959 60for.cond9:61 %7 = load i8, ptr %6, align 1, !tbaa !962 %conv10 = sext i8 %7 to i3263 %cmp11 = icmp sle i32 %conv10, 3264 br i1 %cmp11, label %for.body13, label %for.end2665 66for.body13:67 %8 = load i8, ptr %6, align 1, !tbaa !968 %tobool = icmp ne i8 %8, 069 br i1 %tobool, label %if.then14, label %if.end70 71if.then14:72 store i8 1, ptr @a, align 1, !tbaa !973 br label %for.cond1574 75for.cond15:76 %9 = load i8, ptr @a, align 1, !tbaa !977 %conv16 = sext i8 %9 to i3278 %cmp17 = icmp sle i32 %conv16, 3079 br i1 %cmp17, label %for.body19, label %for.end80 81for.body19:82 %10 = load i32, ptr @c, align 4, !tbaa !383 %cmp20 = icmp eq i32 0, %1084 %conv21 = zext i1 %cmp20 to i3285 %11 = load i8, ptr @a, align 1, !tbaa !986 %conv22 = sext i8 %11 to i3287 %and = and i32 %conv22, %conv2188 %conv23 = trunc i32 %and to i889 store i8 %conv23, ptr @a, align 1, !tbaa !990 br label %for.cond15, !llvm.loop !1091 92for.end:93 br label %if.end94 95if.end:96 br label %for.inc97 98for.inc:99 %12 = load i8, ptr %6, align 1, !tbaa !9100 %conv24 = sext i8 %12 to i32101 %add = add nsw i32 %conv24, 1102 %conv25 = trunc i32 %add to i8103 store i8 %conv25, ptr %6, align 1, !tbaa !9104 br label %for.cond9, !llvm.loop !12105 106for.end26:107 br label %if.end27108 109if.end27:110 br label %for.inc28111 112for.inc28:113 %13 = load i16, ptr @e, align 2, !tbaa !7114 %conv29 = zext i16 %13 to i32115 %add30 = add nsw i32 %conv29, 1116 %conv31 = trunc i32 %add30 to i16117 store i16 %conv31, ptr @e, align 2, !tbaa !7118 br label %for.cond1, !llvm.loop !13119 120for.end32:121 br label %for.inc33122 123for.inc33:124 %14 = load i32, ptr @c, align 4, !tbaa !3125 %inc = add nsw i32 %14, 1126 store i32 %inc, ptr @c, align 4, !tbaa !3127 br label %for.cond, !llvm.loop !14128 129for.end34:130 ret void131}132 133declare void @llvm.lifetime.start.p0(ptr nocapture) #1134declare void @llvm.lifetime.end.p0(ptr nocapture) #1135 136attributes #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" }137attributes #1 = { argmemonly nofree nosync nounwind willreturn }138 139!llvm.module.flags = !{!0, !1}140!llvm.ident = !{!2}141 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}157