Two testcases for invalid transformations that instcombine is doing
[oota-llvm.git] / test / Transforms / InstCombine / 2004-09-20-BadLoadCombine.llx
1 ; RUN: llvm-as < %s | opt -instcombine -mem2reg | llvm-dis | not grep 'int 1'
2
3 ; When propagating the load through the select, make sure that the load is
4 ; inserted where the original load was, not where the select is.  Not doing
5 ; so could produce incorrect results!
6
7 implementation
8
9 int %test(bool %C) {
10         %X = alloca int
11         %X2 = alloca int
12         store int 1, int* %X
13         store int 2, int* %X2
14
15         %Y = select bool %C, int* %X, int* %X2
16         store int 3, int* %X
17         %Z = load int* %Y
18         ret int %Z
19 }
20