The transform that tries to turn calls to bitcast functions into
[oota-llvm.git] / test / Transforms / InstCombine / 2004-09-20-BadLoadCombine2.llx
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -mem2reg -simplifycfg | \
2 ; RUN:   llvm-dis | grep -v store | not grep {int 1}
3
4 ; Test to make sure that instcombine does not accidentally propagate the load
5 ; into the PHI, which would break the program.
6
7 int %test(bool %C) {
8 entry:
9         %X = alloca int
10         %X2 = alloca int
11         store int 1, int* %X
12         store int 2, int* %X2
13         br bool %C, label %cond_true.i, label %cond_continue.i
14
15 cond_true.i:
16         br label %cond_continue.i
17
18 cond_continue.i:
19         %mem_tmp.i.0 = phi int* [ %X, %cond_true.i ], [ %X2, %entry ]
20         store int 3, int* %X
21         %tmp.3 = load int* %mem_tmp.i.0
22         ret int %tmp.3
23 }
24