1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -switch-range-to-icmp -S | FileCheck %s
4 ; Check that simplifycfg deletes a dead 'seteq' instruction when it
5 ; folds a conditional branch into a switch instruction.
11 define void @testcfg(i32 %V) {
12 ; CHECK-LABEL: @testcfg(
13 ; CHECK-NEXT: [[V_OFF:%.*]] = add i32 [[V:%.*]], -15
14 ; CHECK-NEXT: [[SWITCH:%.*]] = icmp ult i32 [[V_OFF]], 2
15 ; CHECK-NEXT: br i1 [[SWITCH]], label [[L2:%.*]], label [[L1:%.*]]
17 ; CHECK-NEXT: ret void
19 ; CHECK-NEXT: call void @foo()
20 ; CHECK-NEXT: br label [[COMMON_RET:%.*]]
22 ; CHECK-NEXT: call void @bar()
23 ; CHECK-NEXT: br label [[COMMON_RET]]
25 %C = icmp eq i32 %V, 18
26 %D = icmp eq i32 %V, 180
28 br i1 %E, label %L1, label %Sw
30 switch i32 %V, label %L1 [
37 L2: ; preds = %Sw, %Sw