blob: 6a7ff1a6adb4d560022538745b07750aa39f41aa [file] [log] [blame]
Chris Lattnerfd747f82004-03-12 06:01:00 +00001; This test makes sure that these instructions are properly eliminated.
2;
3
4; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep select
5
6implementation
7
8int %test1(int %A, int %B) {
9 %C = select bool false, int %A, int %B
10 ret int %C
11}
12
13int %test2(int %A, int %B) {
14 %C = select bool true, int %A, int %B
15 ret int %C
16}
17
Chris Lattnerb785d282004-03-30 19:36:54 +000018int %test3(bool %C, int %I) {
19 %V = select bool %C, int %I, int %I ; V = I
20 ret int %V
21}
22
23bool %test4(bool %C) {
24 %V = select bool %C, bool true, bool false ; V = C
25 ret bool %V
26}
27
28bool %test5(bool %C) {
29 %V = select bool %C, bool false, bool true ; V = !C
30 ret bool %V
31}
32
33int %test6(bool %C) {
34 %V = select bool %C, int 1, int 0 ; V = cast C to int
35 ret int %V
36}
Chris Lattnerfd747f82004-03-12 06:01:00 +000037