| Chandler Carruth | 7b560d4 | 2015-09-09 17:55:00 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -tbaa -gvn < %s | FileCheck -check-prefix=BASICAA %s |
| 2 | ; RUN: opt -S -tbaa -disable-basicaa -gvn < %s | FileCheck %s |
| Dan Gohman | 4deda53 | 2011-01-24 17:54:01 +0000 | [diff] [blame] | 3 | ; rdar://8875631, rdar://8875069 |
| Dan Gohman | 44da55b | 2011-01-18 21:16:06 +0000 | [diff] [blame] | 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 { |
| Bill Wendling | cd6df16 | 2012-04-24 09:15:38 +0000 | [diff] [blame] | 17 | ; BASICAA: ret i32 %tmp5.lobit |
| 18 | ; CHECK: ret i32 0 |
| Dan Gohman | 44da55b | 2011-01-18 21:16:06 +0000 | [diff] [blame] | 19 | entry: |
| 20 | %u = alloca %union.anon, align 8 |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 21 | %tmp9 = getelementptr inbounds %union.anon, %union.anon* %u, i64 0, i32 0 |
| Dan Gohman | 44da55b | 2011-01-18 21:16:06 +0000 | [diff] [blame] | 22 | store double %x, double* %tmp9, align 8, !tbaa !0 |
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 23 | %tmp2 = load i32, i32* bitcast (i64* @endianness_test to i32*), align 8, !tbaa !3 |
| Dan Gohman | 44da55b | 2011-01-18 21:16:06 +0000 | [diff] [blame] | 24 | %idxprom = sext i32 %tmp2 to i64 |
| 25 | %tmp4 = bitcast %union.anon* %u to [2 x i32]* |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 26 | %arrayidx = getelementptr inbounds [2 x i32], [2 x i32]* %tmp4, i64 0, i64 %idxprom |
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 27 | %tmp5 = load i32, i32* %arrayidx, align 4, !tbaa !3 |
| Dan Gohman | 44da55b | 2011-01-18 21:16:06 +0000 | [diff] [blame] | 28 | %tmp5.lobit = lshr i32 %tmp5, 31 |
| 29 | ret i32 %tmp5.lobit |
| 30 | } |
| 31 | |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 32 | !0 = !{!4, !4, i64 0} |
| 33 | !1 = !{!"omnipotent char", !2} |
| 34 | !2 = !{!"Simple C/C++ TBAA", null} |
| 35 | !3 = !{!5, !5, i64 0} |
| 36 | !4 = !{!"double", !1} |
| 37 | !5 = !{!"int", !1} |