aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/TypeBasedAliasAnalysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-12-13 22:50:24 +0000
committerDan Gohman <gohman@apple.com>2010-12-13 22:50:24 +0000
commit0f7f194416b9f139d4233b499a1f56b20bd84022 (patch)
tree9c2b4fb3674e21706f973eed3a938f57cb189d89 /test/Analysis/TypeBasedAliasAnalysis
parent2cd195291722ad0153125a6c032c96e361d8c48e (diff)
Reapply r121520, PartialAlias implementation for BasicAA, now that
memdep is updated to handle it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121725 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/TypeBasedAliasAnalysis')
-rw-r--r--test/Analysis/TypeBasedAliasAnalysis/precedence.ll29
1 files changed, 27 insertions, 2 deletions
diff --git a/test/Analysis/TypeBasedAliasAnalysis/precedence.ll b/test/Analysis/TypeBasedAliasAnalysis/precedence.ll
index 9fa859eaab..ade39f7c8e 100644
--- a/test/Analysis/TypeBasedAliasAnalysis/precedence.ll
+++ b/test/Analysis/TypeBasedAliasAnalysis/precedence.ll
@@ -1,5 +1,5 @@
-; RUN: opt -enable-tbaa -basicaa -tbaa -gvn -instcombine -S < %s | grep {ret i32 0}
-; RUN: opt -enable-tbaa -tbaa -basicaa -gvn -instcombine -S < %s | grep {ret i32 1075000115}
+; RUN: opt -enable-tbaa -basicaa -tbaa -gvn -instcombine -S < %s | FileCheck %s --check-prefix=TBAA
+; RUN: opt -enable-tbaa -tbaa -basicaa -gvn -instcombine -S < %s | FileCheck %s --check-prefix=BASICAA
; According to the TBAA metadata the load and store don't alias. However,
; according to the actual code, they do. The order of the alias analysis
@@ -7,6 +7,12 @@
target datalayout = "e-p:64:64:64"
+; Test for simple MustAlias aliasing.
+
+; TBAA: @trouble
+; TBAA: ret i32 0
+; BASICAA: @trouble
+; BASICAA: ret i32 1075000115
define i32 @trouble(i32* %x) nounwind {
entry:
store i32 0, i32* %x, !tbaa !0
@@ -16,6 +22,25 @@ entry:
ret i32 %tmp3
}
+; Test for PartialAlias aliasing. GVN doesn't yet eliminate the load
+; in the BasicAA case.
+
+; TBAA: @offset
+; TBAA: ret i64 0
+; BASICAA: @offset
+; BASICAA: ret i64 %tmp3
+define i64 @offset(i64* %x) nounwind {
+entry:
+ store i64 0, i64* %x, !tbaa !4
+ %0 = bitcast i64* %x to i8*
+ %1 = getelementptr i8* %0, i64 1
+ store i8 1, i8* %1, !tbaa !5
+ %tmp3 = load i64* %x, !tbaa !4
+ ret i64 %tmp3
+}
+
!0 = metadata !{metadata !"int", metadata !1}
!1 = metadata !{metadata !"simple"}
!3 = metadata !{metadata !"float", metadata !1}
+!4 = metadata !{metadata !"long", metadata !1}
+!5 = metadata !{metadata !"small", metadata !1}