Fix InstCombine/2007-10-31-StringCrash.ll by removing an obvious
[oota-llvm.git] / test / Transforms / InstCombine / CPP_min_max.llx
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
2 ; RUN:   grep select | not grep {i32\\*}
3 ; END.
4
5 ; This testcase corresponds to PR362, which notices that this horrible code
6 ; is generated by the C++ front-end and LLVM optimizers, which has lots of
7 ; loads and other stuff that are unneeded.
8 ;
9 ; Instcombine should propagate the load through the select instructions to
10 ; allow elimination of the extra stuff by the mem2reg pass.
11
12 implementation   ; Functions:
13
14 void %_Z5test1RiS_(int* %x, int* %y) {
15 entry:
16         %tmp.1.i = load int* %y         ; <int> [#uses=1]
17         %tmp.3.i = load int* %x         ; <int> [#uses=1]
18         %tmp.4.i = setlt int %tmp.1.i, %tmp.3.i         ; <bool> [#uses=1]
19         %retval.i = select bool %tmp.4.i, int* %y, int* %x              ; <int*> [#uses=1]
20         %tmp.4 = load int* %retval.i            ; <int> [#uses=1]
21         store int %tmp.4, int* %x
22         ret void
23 }
24
25 void %_Z5test2RiS_(int* %x, int* %y) {
26 entry:
27         %tmp.0 = alloca int             ; <int*> [#uses=2]
28         %tmp.2 = load int* %x           ; <int> [#uses=2]
29         store int %tmp.2, int* %tmp.0
30         %tmp.3.i = load int* %y         ; <int> [#uses=1]
31         %tmp.4.i = setlt int %tmp.2, %tmp.3.i           ; <bool> [#uses=1]
32         %retval.i = select bool %tmp.4.i, int* %y, int* %tmp.0          ; <int*> [#uses=1]
33         %tmp.6 = load int* %retval.i            ; <int> [#uses=1]
34         store int %tmp.6, int* %y
35         ret void
36 }