Add a testcase which demonstrates alias analysis pass precedence.
[oota-llvm.git] / test / Analysis / TypeBasedAliasAnalysis / precedence.ll
1 ; RUN: opt -enable-tbaa -basicaa -tbaa -gvn -instcombine -S < %s | grep {ret i32 0}
2 ; RUN: opt -enable-tbaa -tbaa -basicaa -gvn -instcombine -S < %s | grep {ret i32 1075000115}
3
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.
7
8 target datalayout = "e-p:64:64:64"
9
10 define i32 @trouble(i32* %x) nounwind ssp {
11 entry:
12   store i32 0, i32* %x, !tbaa !0
13   %0 = bitcast i32* %x to float*
14   store float 0x4002666660000000, float* %0, !tbaa !3
15   %tmp3 = load i32* %x, !tbaa !0
16   ret i32 %tmp3
17 }
18
19 !0 = metadata !{metadata !"int", metadata !1}
20 !1 = metadata !{metadata !"simple"}
21 !3 = metadata !{metadata !"float", metadata !1}