1 ; RUN: opt -S -tbaa -basicaa -gvn < %s | grep {ret i32 %} 2 ; RUN: opt -S -tbaa -gvn < %s | grep {ret i32 0} 3 ; rdar://8875631, rdar://8875069 4 5 ; BasicAA should notice that the store stores to the entire %u object, 6 ; so the %tmp5 load is PartialAlias with the store and suppress TBAA. 7 ; Without BasicAA, TBAA should say that %tmp5 is NoAlias with the store. 8 9 target datalayout = "e-p:64:64:64" 10 11 %union.anon = type { double } 12 13 @u = global %union.anon { double -2.500000e-01 }, align 8 14 @endianness_test = global i64 1, align 8 15 16 define i32 @signbit(double %x) nounwind { 17 entry: 18 %u = alloca %union.anon, align 8 19 %tmp9 = getelementptr inbounds %union.anon* %u, i64 0, i32 0 20 store double %x, double* %tmp9, align 8, !tbaa !0 21 %tmp2 = load i32* bitcast (i64* @endianness_test to i32*), align 8, !tbaa !3 22 %idxprom = sext i32 %tmp2 to i64 23 %tmp4 = bitcast %union.anon* %u to [2 x i32]* 24 %arrayidx = getelementptr inbounds [2 x i32]* %tmp4, i64 0, i64 %idxprom 25 %tmp5 = load i32* %arrayidx, align 4, !tbaa !3 26 %tmp5.lobit = lshr i32 %tmp5, 31 27 ret i32 %tmp5.lobit 28 } 29 30 !0 = metadata !{metadata !"double", metadata !1} 31 !1 = metadata !{metadata !"omnipotent char", metadata !2} 32 !2 = metadata !{metadata !"Simple C/C++ TBAA", null} 33 !3 = metadata !{metadata !"int", metadata !1} 34