1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -indvars -verify -loop-rotate -loop-idiom < %s | FileCheck %s
3 ; RUN: opt -S -indvars -verify -loop-rotate -loop-idiom -enable-mssa-loop-dependency=true -verify-memoryssa < %s | FileCheck %s
4 target triple = "x86_64-unknown-linux-gnu"
6 ; Verify that we invalidate SCEV properly.
8 define void @test_01() {
9 ; CHECK-LABEL: @test_01(
11 ; CHECK-NEXT: br label [[LBL1:%.*]]
13 ; CHECK-NEXT: br label [[FOR_COND:%.*]]
15 ; CHECK-NEXT: br i1 false, label [[FOR_BODY3_LR_PH:%.*]], label [[FOR_COND_FOR_END5_CRIT_EDGE:%.*]]
16 ; CHECK: for.body3.lr.ph:
17 ; CHECK-NEXT: br label [[FOR_BODY3:%.*]]
19 ; CHECK-NEXT: br i1 false, label [[FOR_BODY3]], label [[FOR_COND1_FOR_END5_CRIT_EDGE:%.*]]
21 ; CHECK-NEXT: br i1 false, label [[IF_THEN:%.*]], label [[FOR_COND1:%.*]]
23 ; CHECK-NEXT: br label [[LBL1]]
24 ; CHECK: for.cond.for.end5_crit_edge:
25 ; CHECK-NEXT: br label [[FOR_END5:%.*]]
26 ; CHECK: for.cond1.for.end5_crit_edge:
27 ; CHECK-NEXT: br label [[FOR_END5]]
29 ; CHECK-NEXT: ret void
34 lbl1: ; preds = %if.then, %entry
37 for.cond: ; preds = %lbl1
40 for.cond1: ; preds = %if.end, %for.cond
41 br i1 false, label %for.body3, label %for.end5
43 for.body3: ; preds = %for.cond1
44 br i1 false, label %if.then, label %if.end
46 if.then: ; preds = %for.body3
49 if.end: ; preds = %for.body3
52 for.end5: ; preds = %for.cond1
56 define void @test_02() {
57 ; CHECK-LABEL: @test_02(
59 ; CHECK-NEXT: br label [[LBL1:%.*]]
61 ; CHECK-NEXT: br label [[FOR_COND:%.*]]
63 ; CHECK-NEXT: br i1 false, label [[IF_THEN:%.*]], label [[IF_END7:%.*]]
65 ; CHECK-NEXT: br i1 false, label [[FOR_BODY_LR_PH:%.*]], label [[IF_THEN_FOR_END6_CRIT_EDGE:%.*]]
66 ; CHECK: for.body.lr.ph:
67 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
69 ; CHECK-NEXT: br i1 false, label [[IF_THEN3:%.*]], label [[IF_END:%.*]]
71 ; CHECK-NEXT: br label [[LBL1]]
73 ; CHECK-NEXT: br label [[FOR_COND4:%.*]]
75 ; CHECK-NEXT: br i1 false, label [[FOR_BODY]], label [[FOR_COND1_FOR_END6_CRIT_EDGE:%.*]]
76 ; CHECK: if.then.for.end6_crit_edge:
77 ; CHECK-NEXT: br label [[FOR_END6:%.*]]
78 ; CHECK: for.cond1.for.end6_crit_edge:
79 ; CHECK-NEXT: br label [[FOR_END6]]
81 ; CHECK-NEXT: ret void
83 ; CHECK-NEXT: unreachable
88 lbl1: ; preds = %if.then3, %entry
91 for.cond: ; preds = %lbl1
92 br i1 false, label %if.then, label %if.end7
94 if.then: ; preds = %for.cond
97 for.cond1: ; preds = %for.cond4, %if.then
98 br i1 undef, label %for.body, label %for.end6
100 for.body: ; preds = %for.cond1
101 br i1 false, label %if.then3, label %if.end
103 if.then3: ; preds = %for.body
106 if.end: ; preds = %for.body
109 for.cond4: ; preds = %if.end
112 for.end6: ; preds = %for.cond1
115 if.end7: ; preds = %for.cond