19c5c06c6b698e790bc28deeb4657889e4b3c784
[oota-llvm.git] / test / Analysis / BasicAA / 2007-01-13-BasePointerBadNoAlias.ll
1 ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | grep 'sub i32' &&
2 ; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep 'ret i32 0'
3 ; PR1109
4
5 target datalayout = "e-p:32:32"
6 target endian = little
7 target pointersize = 32
8 target triple = "i686-apple-darwin8"
9         %struct.CONSTRAINT = type { i32, i32, i32, i32 }
10         %struct.FILE_POS = type { i8, i8, i16, i32 }
11         %struct.FIRST_UNION = type { %struct.FILE_POS }
12         %struct.FOURTH_UNION = type { %struct.CONSTRAINT }
13         %struct.GAP = type { i8, i8, i16 }
14         %struct.LIST = type { %struct.rec*, %struct.rec* }
15         %struct.SECOND_UNION = type { { i16, i8, i8 } }
16         %struct.STYLE = type { { %struct.GAP }, { %struct.GAP }, i16, i16, i16, i8, i8 }
17         %struct.THIRD_UNION = type { { [2 x i32], [2 x i32] } }
18         %struct.closure_type = type { [2 x %struct.LIST], %struct.FIRST_UNION, %struct.SECOND_UNION, %struct.THIRD_UNION, %struct.FOURTH_UNION, %struct.rec*, { %struct.rec* } }
19         %struct.head_type = type { [2 x %struct.LIST], %struct.FIRST_UNION, %struct.SECOND_UNION, %struct.THIRD_UNION, %struct.FOURTH_UNION, %struct.rec*, { %struct.rec* }, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, %struct.rec*, i32 }
20         %struct.rec = type { %struct.head_type }
21
22 implementation   ; Functions:
23
24 define i32 %test(%struct.closure_type* %tmp18169) {
25         %tmp18174 = getelementptr %struct.closure_type* %tmp18169, i32 0, i32 4, i32 0, i32 0           ; <i32*> [#uses=2]
26         %tmp18269 = bitcast i32* %tmp18174  to %struct.STYLE*           ; <%struct.STYLE*> [#uses=1]
27         %A = load i32* %tmp18174                ; <i32> [#uses=1]
28
29         %tmp18272 = getelementptr %struct.STYLE* %tmp18269, i32 0, i32 0, i32 0, i32 2          ; <i16*> [#uses=1]
30         store i16 123, i16* %tmp18272
31
32         %Q = load i32* %tmp18174                ; <i32> [#uses=1]
33         %Z = sub i32 %A, %Q             ; <i32> [#uses=1]
34         ret i32 %Z
35 }