1; RUN: opt -S -disable-basicaa -tbaa -cfl-aa -gvn < %s | FileCheck -check-prefix=CFLAA %s
2; RUN: opt -S -disable-basicaa -tbaa -gvn < %s | FileCheck %s
3; Adapted from the BasicAA full-store-partial-alias.ll test.
4
5; CFL AA could notice that the store stores to the entire %u object,
6; so the %tmp5 load is PartialAlias with the store and suppress TBAA.
7; FIXME: However, right now, CFLAA cannot prove PartialAlias here
8; Without CFL AA, TBAA should say that %tmp5 is NoAlias with the store.
9
10target datalayout = "e-p:64:64:64"
11
12%union.anon = type { double }
13
14@u = global %union.anon { double -2.500000e-01 }, align 8
15@endianness_test = global i64 1, align 8
16
17define i32 @signbit(double %x) nounwind {
18; FIXME: This would be ret i32 %tmp5.lobit if CFLAA could prove PartialAlias
19; CFLAA: ret i32 0
20; CHECK: ret i32 0
21entry:
22  %u = alloca %union.anon, align 8
23  %tmp9 = getelementptr inbounds %union.anon, %union.anon* %u, i64 0, i32 0
24  store double %x, double* %tmp9, align 8, !tbaa !0
25  %tmp2 = load i32, i32* bitcast (i64* @endianness_test to i32*), align 8, !tbaa !3
26  %idxprom = sext i32 %tmp2 to i64
27  %tmp4 = bitcast %union.anon* %u to [2 x i32]*
28  %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %tmp4, i64 0, i64 %idxprom
29  %tmp5 = load i32, i32* %arrayidx, align 4, !tbaa !3
30  %tmp5.lobit = lshr i32 %tmp5, 31
31  ret i32 %tmp5.lobit
32}
33
34!0 = !{!4, !4, i64 0}
35!1 = !{!"omnipotent char", !2}
36!2 = !{!"Simple C/C++ TBAA", null}
37!3 = !{!5, !5, i64 0}
38!4 = !{!"double", !1}
39!5 = !{!"int", !1}
40