aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms/CorrelatedExprs/switch.ll
blob: 24b34b03a7a802f4e9358b0d62770074b83773cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
; RUN: llvm-upgrade < %s | llvm-as | opt -cee -constprop -instcombine -dce | \
; RUN:   llvm-dis | not grep REMOVE
; END.

int %test_case_values_should_propagate(int %A) {
    switch int %A, label %D [
        int 40, label %C1
        int 41, label %C2
        int 42, label %C3
    ]
C1:
    %REMOVE1 = add int %A, 2     ; Should be 42.
    ret int %REMOVE1
C2:
    %REMOVE2 = add int %A, 3     ; Should be 44.
    ret int %REMOVE2
C3:
    %REMOVE3 = add int %A, 4     ; Should be 46.
    ret int %REMOVE3
D:
    ret int 10
}