xref: /aosp_15_r20/external/llvm/test/Transforms/SimplifyCFG/DeadSetCC.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -simplifycfg -S | \
2*9880d681SAndroid Build Coastguard Worker; RUN:   not grep "icmp eq"
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Check that simplifycfg deletes a dead 'seteq' instruction when it
5*9880d681SAndroid Build Coastguard Worker; folds a conditional branch into a switch instruction.
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdeclare void @foo()
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerdeclare void @bar()
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerdefine void @testcfg(i32 %V) {
12*9880d681SAndroid Build Coastguard Worker        %C = icmp eq i32 %V, 18         ; <i1> [#uses=1]
13*9880d681SAndroid Build Coastguard Worker        %D = icmp eq i32 %V, 180                ; <i1> [#uses=1]
14*9880d681SAndroid Build Coastguard Worker        %E = or i1 %C, %D               ; <i1> [#uses=1]
15*9880d681SAndroid Build Coastguard Worker        br i1 %E, label %L1, label %Sw
16*9880d681SAndroid Build Coastguard WorkerSw:             ; preds = %0
17*9880d681SAndroid Build Coastguard Worker        switch i32 %V, label %L1 [
18*9880d681SAndroid Build Coastguard Worker                 i32 15, label %L2
19*9880d681SAndroid Build Coastguard Worker                 i32 16, label %L2
20*9880d681SAndroid Build Coastguard Worker        ]
21*9880d681SAndroid Build Coastguard WorkerL1:             ; preds = %Sw, %0
22*9880d681SAndroid Build Coastguard Worker        call void @foo( )
23*9880d681SAndroid Build Coastguard Worker        ret void
24*9880d681SAndroid Build Coastguard WorkerL2:             ; preds = %Sw, %Sw
25*9880d681SAndroid Build Coastguard Worker        call void @bar( )
26*9880d681SAndroid Build Coastguard Worker        ret void
27*9880d681SAndroid Build Coastguard Worker}
28*9880d681SAndroid Build Coastguard Worker
29