46 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -S -passes='loop(loop-flatten),verify' -verify-loop-info -verify-dom-info -verify-scev | FileCheck %s3 4; Testcase of PR495715; Previously we had an assertion that the incoming value from the6; loop latch (%inc) is the same as the operator in the compare7; statement (%0). This does not necessarily hold as demonstrated8; in the following case.9 10define dso_local void @main() {11; CHECK-LABEL: @main(12; CHECK-NEXT: entry:13; CHECK-NEXT: br label [[FOR_COND:%.*]]14; CHECK: for.cond:15; CHECK-NEXT: br label [[FOR_BODY:%.*]]16; CHECK: for.body:17; CHECK-NEXT: [[A_03:%.*]] = phi i32 [ 0, [[FOR_COND]] ], [ [[INC:%.*]], [[FOR_INC:%.*]] ]18; CHECK-NEXT: br label [[FOR_INC]]19; CHECK: for.inc:20; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[A_03]], 121; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[TMP0]], 1022; CHECK-NEXT: [[INC]] = add nsw i32 [[A_03]], 123; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]]24; CHECK: for.end:25; CHECK-NEXT: br label [[FOR_COND]]26;27entry:28 br label %for.cond29 30for.cond: ; preds = %for.end, %entry31 br label %for.body32 33for.body: ; preds = %for.inc, %for.cond34 %a.03 = phi i32 [ 0, %for.cond ], [ %inc, %for.inc ]35 br label %for.inc36 37for.inc: ; preds = %for.body38 %0 = add i32 %a.03, 139 %cmp = icmp slt i32 %0, 1040 %inc = add nsw i32 %a.03, 141 br i1 %cmp, label %for.body, label %for.end42 43for.end: ; preds = %for.inc44 br label %for.cond45}46