1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck %s
6 define i32 @lex(i1 %c0, i1 %c1, i32 %r0, i32 %r1, i32 %v) {
9 ; CHECK-NEXT: [[C0_NOT:%.*]] = xor i1 [[C0:%.*]], true
10 ; CHECK-NEXT: [[C1_NOT:%.*]] = xor i1 [[C1:%.*]], true
11 ; CHECK-NEXT: [[BRMERGE:%.*]] = select i1 [[C0_NOT]], i1 true, i1 [[C1_NOT]]
12 ; CHECK-NEXT: [[R0_MUX:%.*]] = select i1 [[C0_NOT]], i32 [[R0:%.*]], i32 [[R1:%.*]]
13 ; CHECK-NEXT: br i1 [[BRMERGE]], label [[COMMON_RET:%.*]], label [[DO_BODY:%.*]]
15 ; CHECK-NEXT: [[COMMON_RET_OP:%.*]] = phi i32 [ [[R0_MUX]], [[ENTRY:%.*]] ], [ [[R1]], [[DO_BODY]] ]
16 ; CHECK-NEXT: ret i32 [[COMMON_RET_OP]]
18 ; CHECK-NEXT: call void @zzz()
19 ; CHECK-NEXT: switch i32 [[V:%.*]], label [[COMMON_RET]] [
20 ; CHECK-NEXT: i32 10, label [[DO_BODY]]
21 ; CHECK-NEXT: i32 32, label [[DO_BODY]]
22 ; CHECK-NEXT: i32 9, label [[DO_BODY]]
26 br i1 %c0, label %if.end, label %if.then
28 if.then: ; preds = %entry
31 if.end: ; preds = %entry
32 br i1 %c1, label %do.body, label %do.end
34 do.body: ; preds = %if.then193, %if.then193, %if.then193, %do.body, %do.body, %if.end
36 switch i32 %v, label %do.end [
37 i32 10, label %if.then193
38 i32 32, label %do.body
42 if.then193: ; preds = %do.body
43 switch i32 %v, label %do.end [
44 i32 32, label %do.body
45 i32 10, label %do.body
49 do.end: ; preds = %if.then193, %do.body, %if.end