1 ; RUN: opt -basicaa -tbaa -gvn -instcombine -S < %s | FileCheck %s --check-prefix=TBAA
2 ; RUN: opt -tbaa -basicaa -gvn -instcombine -S < %s | FileCheck %s --check-prefix=BASICAA
4 ; According to the TBAA metadata the load and store don't alias. However,
5 ; according to the actual code, they do. The order of the alias analysis
6 ; passes should determine which of these takes precedence.
8 target datalayout = "e-p:64:64:64"
10 ; Test for simple MustAlias aliasing.
15 ; BASICAA: ret i32 1075000115
16 define i32 @trouble(i32* %x) nounwind {
18 store i32 0, i32* %x, !tbaa !0
19 %0 = bitcast i32* %x to float*
20 store float 0x4002666660000000, float* %0, !tbaa !3
21 %tmp3 = load i32* %x, !tbaa !0
25 ; Test for PartialAlias aliasing. GVN doesn't yet eliminate the load
26 ; in the BasicAA case.
31 ; BASICAA: ret i64 %tmp3
32 define i64 @offset(i64* %x) nounwind {
34 store i64 0, i64* %x, !tbaa !4
35 %0 = bitcast i64* %x to i8*
36 %1 = getelementptr i8* %0, i64 1
37 store i8 1, i8* %1, !tbaa !5
38 %tmp3 = load i64* %x, !tbaa !4
42 !0 = metadata !{metadata !"int", metadata !1}
43 !1 = metadata !{metadata !"simple"}
44 !3 = metadata !{metadata !"float", metadata !1}
45 !4 = metadata !{metadata !"long", metadata !1}
46 !5 = metadata !{metadata !"small", metadata !1}