• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -S -loop-simplifycfg -verify-scev < %s | FileCheck %s
3; RUN: opt -S -loop-simplifycfg -verify-scev -enable-mssa-loop-dependency=true -verify-memoryssa < %s | FileCheck %s
4
5; Verify that the scev information is still valid. Verification should not fail
6
7define void @t_run_test() {
8; CHECK-LABEL: @t_run_test(
9; CHECK-NEXT:  entry:
10; CHECK-NEXT:    br label %[[LOOP_PH:.*]]
11; CHECK:       [[LOOP_PH]]:
12; CHECK-NEXT:    br label %[[LOOP_BODY:.*]]
13; CHECK:       [[LOOP_BODY]]:
14; CHECK-NEXT:    [[IV:%.*]] = phi i32 [ 0, %[[LOOP_PH]] ], [ [[INC:%.*]], %[[LOOP_BODY]] ]
15; CHECK-NEXT:    [[INC]] = add i32 [[IV]], 1
16; CHECK-NEXT:    [[CMP:%.*]] = icmp ult i32 [[INC]], 10
17; CHECK-NEXT:    br i1 [[CMP]], label %[[LOOP_BODY]], label %[[EXIT:.*]]
18; CHECK:       [[EXIT]]:
19; CHECK-NEXT:    br label %[[LOOP_BODY2:.*]]
20; CHECK:       [[LOOP_BODY2]]:
21; CHECK-NEXT:    [[IV2:%.*]] = phi i32 [ 0, %[[EXIT]] ], [ [[INC2:%.*]], %[[LOOP_BODY2]] ]
22; CHECK-NEXT:    [[INC2]] = add i32 [[IV2]], 1
23; CHECK-NEXT:    [[CMP2:%.*]] = icmp ult i32 [[INC2]], 10
24; CHECK-NEXT:    br i1 [[CMP2]], label %[[LOOP_BODY2]], label %[[EXIT2:.*]]
25; CHECK:       [[EXIT2]]:
26; CHECK-NEXT:    ret void
27;
28entry:
29  br label %loop.ph
30
31loop.ph:
32  br label %loop.header
33
34loop.header:
35  %iv = phi i32 [0, %loop.ph], [%inc, %loop.body]
36  br label %loop.body1
37
38loop.body1:
39  br label %loop.body
40
41loop.body:
42  %inc = add i32 %iv, 1
43  %cmp = icmp ult i32 %inc, 10
44  br i1 %cmp, label %loop.header, label %exit
45
46exit:
47  br label %loop.body2
48
49loop.body2:
50  %iv2 = phi i32 [0, %exit], [%inc2, %loop.body2]
51  %inc2 = add i32 %iv2, 1
52  %cmp2 = icmp ult i32 %inc2, 10
53  br i1 %cmp2, label %loop.body2, label %exit2
54
55exit2:
56  ret void
57}
58
59