brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · 4e381b0 Raw
83 lines · plain
1; RUN: opt -disable-output "-passes=print<scalar-evolution>" < %s 2>&1 | FileCheck %s2 3; An example run where SCEV(%postinc)->getStart() may overflow:4;5; %start = INT_SMAX6; %low.limit = INT_SMIN7; %high.limit = < not used >8;9; >> entry:10;  %postinc.start = INT_SMIN11;12; >> loop:13;  %idx = %start 14;  %postinc = INT_SMIN15;  %postinc.inc = INT_SMIN + 116;  %postinc.sext = sext(INT_SMIN) = i64 INT32_SMIN17;  %break.early = INT_SMIN `slt` INT_SMIN = false18;  br i1 false, ___,  %early.exit19;20; >> early.exit:21;  ret i64 INT32_SMIN22 23 24define i64 @bad.0(i32 %start, i32 %low.limit, i32 %high.limit) {25; CHECK-LABEL: Classifying expressions for: @bad.026 entry:27  %postinc.start = add i32 %start, 128  br label %loop29 30 loop:31  %idx = phi i32 [ %start, %entry ], [ %idx.inc, %continue ]32  %postinc = phi i32 [ %postinc.start, %entry ], [ %postinc.inc, %continue ]33  %postinc.inc = add nsw i32 %postinc, 134  %postinc.sext = sext i32 %postinc to i6435; CHECK:  %postinc.sext = sext i32 %postinc to i6436; CHECK-NEXT:  -->  {(sext i32 (1 + %start) to i64),+,1}<nsw><%loop>37  %break.early = icmp slt i32 %postinc, %low.limit38  br i1 %break.early, label %continue, label %early.exit39 40 continue:41  %idx.inc = add nsw i32 %idx, 142  %cmp = icmp slt i32 %idx.inc, %high.limit43  br i1 %cmp, label %loop, label %exit44 45 exit:46  ret i64 047 48 early.exit:49  ret i64 %postinc.sext50}51 52define i64 @bad.1(i32 %start, i32 %low.limit, i32 %high.limit, ptr %unknown) {53; CHECK-LABEL: Classifying expressions for: @bad.154 entry:55  %postinc.start = add i32 %start, 156  br label %loop57 58 loop:59  %idx = phi i32 [ %start, %entry ], [ %idx.inc, %continue ], [ %idx.inc, %continue.1 ]60  %postinc = phi i32 [ %postinc.start, %entry ], [ %postinc.inc, %continue ], [ %postinc.inc, %continue.1 ]61  %postinc.inc = add nsw i32 %postinc, 162  %postinc.sext = sext i32 %postinc to i6463; CHECK:  %postinc.sext = sext i32 %postinc to i6464; CHECK-NEXT:  -->  {(sext i32 (1 + %start) to i64),+,1}<nsw><%loop>65  %break.early = icmp slt i32 %postinc, %low.limit66  br i1 %break.early, label %continue.1, label %early.exit67 68 continue.1:69  %cond = load volatile i1, ptr %unknown70  %idx.inc = add nsw i32 %idx, 171  br i1 %cond, label %loop, label %continue72 73 continue:74  %cmp = icmp slt i32 %idx.inc, %high.limit75  br i1 %cmp, label %loop, label %exit76 77 exit:78  ret i64 079 80 early.exit:81  ret i64 %postinc.sext82}83