1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
3 ; We run -passes=indvars before -passes=simple-loop-unswitch to compute SCEV exit counts before
4 ; running -simple-loop-unswitch.
5 ; RUN: opt -passes=indvars,simple-loop-unswitch -S %s -verify-scev | FileCheck %s
9 ; We have a 3 nested loops (l1 <- l2 <- l3). %for.cond.5 is the exit block of
10 ; l3 and the loop for it is l2. But it is also the exiting block of l1. That
11 ; means we have to invalidate l1 to preserve SCEV.
16 ; CHECK-NEXT: [[LNOT:%.*]] = xor i1 undef, true
17 ; CHECK-NEXT: br label [[FOR_COND:%.*]]
18 ; CHECK: for.cond.loopexit:
19 ; CHECK-NEXT: br label [[FOR_COND]]
21 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
23 ; CHECK-NEXT: br i1 true, label [[FOR_BODY]], label [[FOR_COND_LOOPEXIT:%.*]]
25 ; CHECK-NEXT: br i1 [[LNOT]], label [[FOR_BODY_SPLIT:%.*]], label [[FOR_COND5_SPLIT:%.*]]
26 ; CHECK: for.body.split:
27 ; CHECK-NEXT: br label [[LAND_RHS:%.*]]
29 ; CHECK-NEXT: br i1 true, label [[LAND_RHS]], label [[FOR_COND5:%.*]]
31 ; CHECK-NEXT: br label [[FOR_COND2:%.*]]
33 ; CHECK-NEXT: br label [[FOR_COND5_SPLIT]]
34 ; CHECK: for.cond5.split:
35 ; CHECK-NEXT: br i1 true, label [[FOR_BODY7:%.*]], label [[FOR_COND1:%.*]]
37 ; CHECK-NEXT: ret void
40 %lnot = xor i1 undef, true
43 for.cond: ; preds = %for.cond1, %entry
46 for.cond1: ; preds = %for.cond5
47 br i1 true, label %for.body, label %for.cond
49 for.body: ; preds = %for.cond1, %for.cond
52 for.cond2: ; preds = %land.rhs
53 br i1 true, label %land.rhs, label %for.cond5
55 land.rhs: ; preds = %for.cond2, %for.body
56 br i1 %lnot, label %for.cond2, label %for.cond5
58 for.cond5: ; preds = %land.rhs, %for.cond2
59 br i1 true, label %for.body7, label %for.cond1
61 for.body7: ; preds = %for.cond5