1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
3 ; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -indvars -loop-simplifycfg -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
4 ; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -passes='require<domtree>,loop(indvars,simplify-cfg)' -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
5 ; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -indvars -loop-simplifycfg -enable-mssa-loop-dependency=true -verify-memoryssa -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
7 define void @test(i1 %c) {
10 ; CHECK-NEXT: switch i32 0, label [[ENTRY_SPLIT:%.*]] [
11 ; CHECK-NEXT: i32 1, label [[DEAD_EXIT:%.*]]
14 ; CHECK-NEXT: br label [[OUTER:%.*]]
16 ; CHECK-NEXT: br i1 [[C:%.*]], label [[TO_FOLD:%.*]], label [[LATCH:%.*]]
18 ; CHECK-NEXT: br i1 [[C]], label [[LATCH]], label [[INNER_PREHEADER:%.*]]
19 ; CHECK: inner.preheader:
20 ; CHECK-NEXT: br label [[INNER:%.*]]
22 ; CHECK-NEXT: br i1 false, label [[INNER_LATCH:%.*]], label [[UNDEAD:%.*]]
24 ; CHECK-NEXT: br i1 true, label [[INNER]], label [[LATCH_LOOPEXIT:%.*]]
26 ; CHECK-NEXT: br label [[LATCH]]
27 ; CHECK: latch.loopexit:
28 ; CHECK-NEXT: br label [[LATCH]]
30 ; CHECK-NEXT: br label [[OUTER]]
32 ; CHECK-NEXT: ret void
39 br i1 %c, label %to_fold, label %latch
42 br i1 %c, label %latch, label %inner
45 %iv = phi i32 [0, %to_fold], [%iv.next, %inner_latch]
46 %never = icmp sgt i32 %iv, 40
47 br i1 %never, label %inner_latch, label %undead
50 %iv.next = add i32 %iv, 1
51 %cmp = icmp slt i32 %iv.next, 10
52 br i1 %cmp, label %inner, label %latch
58 br i1 true, label %outer, label %dead_exit