1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -lowerswitch -fix-irreducible --verify-loop-info -S | FileCheck %s
3 ; RUN: opt < %s -passes='lower-switch,fix-irreducible,verify<loops>' -S | FileCheck %s
4 ; RUN: opt < %s -passes='lower-switch,verify<loops>,fix-irreducible,verify<loops>' -S | FileCheck %s
6 define void @loop_1(i32 %Value, i1 %PredEntry, i1 %PredD) {
7 ; CHECK-LABEL: @loop_1(
9 ; CHECK-NEXT: [[PREDENTRY_INV:%.*]] = xor i1 [[PREDENTRY:%.*]], true
10 ; CHECK-NEXT: br label [[IRR_GUARD:%.*]]
12 ; CHECK-NEXT: br label [[IRR_GUARD]]
14 ; CHECK-NEXT: br label [[NODEBLOCK:%.*]]
16 ; CHECK-NEXT: [[PIVOT:%.*]] = icmp slt i32 [[VALUE:%.*]], 1
17 ; CHECK-NEXT: br i1 [[PIVOT]], label [[LEAFBLOCK:%.*]], label [[LEAFBLOCK1:%.*]]
19 ; CHECK-NEXT: [[SWITCHLEAF2:%.*]] = icmp eq i32 [[VALUE]], 1
20 ; CHECK-NEXT: br i1 [[SWITCHLEAF2]], label [[IRR_GUARD]], label [[EXIT:%.*]]
22 ; CHECK-NEXT: [[SWITCHLEAF:%.*]] = icmp eq i32 [[VALUE]], 0
23 ; CHECK-NEXT: br i1 [[SWITCHLEAF]], label [[A:%.*]], label [[EXIT]]
25 ; CHECK-NEXT: ret void
27 ; CHECK-NEXT: [[GUARD_B:%.*]] = phi i1 [ true, [[LEAFBLOCK1]] ], [ true, [[A]] ], [ [[PREDENTRY_INV]], [[ENTRY:%.*]] ]
28 ; CHECK-NEXT: br i1 [[GUARD_B]], label [[B:%.*]], label [[A]]
31 br i1 %PredEntry, label %A, label %B
37 switch i32 %Value, label %exit [