[llvm-branch-commits] [llvm] ae5e013 - [BasicAA] Add more tests for non-equal index (NFC)

Nikita Popov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Dec 5 12:27:42 PST 2020


Author: Nikita Popov
Date: 2020-12-05T21:22:57+01:00
New Revision: ae5e013f6e3a1391fd44e292857e359b83806c2f

URL: https://github.com/llvm/llvm-project/commit/ae5e013f6e3a1391fd44e292857e359b83806c2f
DIFF: https://github.com/llvm/llvm-project/commit/ae5e013f6e3a1391fd44e292857e359b83806c2f.diff

LOG: [BasicAA] Add more tests for non-equal index (NFC)

Added: 
    

Modified: 
    llvm/test/Analysis/BasicAA/sequential-gep.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/BasicAA/sequential-gep.ll b/llvm/test/Analysis/BasicAA/sequential-gep.ll
index ab97c6492d36..0b53958d6f68 100644
--- a/llvm/test/Analysis/BasicAA/sequential-gep.ll
+++ b/llvm/test/Analysis/BasicAA/sequential-gep.ll
@@ -51,4 +51,65 @@ define void @t5([8 x i32]* %p, i32 %addend, i32* %q) {
   ret void
 }
 
+; CHECK-LABEL: Function: add_non_zero_simple
+; CHECK: MayAlias: i32* %gep1, i32* %gep2
+; TODO: This could be NoAlias.
+define void @add_non_zero_simple(i32* %p, i32 %addend, i32* %q) {
+  %knownnonzero = load i32, i32* %q, !range !0
+  %add = add i32 %addend, %knownnonzero
+  %gep1 = getelementptr i32, i32* %p, i32 %addend
+  %gep2 = getelementptr i32, i32* %p, i32 %add
+  ret void
+}
+
+; CHECK-LABEL: Function: add_non_zero_
diff erent_scales
+; CHECK: MayAlias: i16* %gep2, i32* %gep1
+define void @add_non_zero_
diff erent_scales(i32* %p, i32 %addend, i32* %q) {
+  %knownnonzero = load i32, i32* %q, !range !0
+  %add = add i32 %addend, %knownnonzero
+  %p16 = bitcast i32* %p to i16*
+  %gep1 = getelementptr i32, i32* %p, i32 %addend
+  %gep2 = getelementptr i16, i16* %p16, i32 %add
+  ret void
+}
+
+; CHECK-LABEL: Function: add_non_zero_
diff erent_sizes
+; CHECK: MayAlias: i16* %gep1.16, i32* %gep2
+; CHECK: MayAlias: i16* %gep2.16, i32* %gep1
+; CHECK: MayAlias: i16* %gep1.16, i16* %gep2.16
+; CHECK: MayAlias: i32* %gep2, i64* %gep1.64
+; CHECK: MayAlias: i16* %gep2.16, i64* %gep1.64
+; CHECK: MayAlias: i32* %gep1, i64* %gep2.64
+; CHECK: MayAlias: i16* %gep1.16, i64* %gep2.64
+; CHECK: MayAlias: i64* %gep1.64, i64* %gep2.64
+; TODO: The first three could be NoAlias.
+define void @add_non_zero_
diff erent_sizes(i32* %p, i32 %addend, i32* %q) {
+  %knownnonzero = load i32, i32* %q, !range !0
+  %add = add i32 %addend, %knownnonzero
+  %gep1 = getelementptr i32, i32* %p, i32 %addend
+  %gep2 = getelementptr i32, i32* %p, i32 %add
+  %gep1.16 = bitcast i32* %gep1 to i16*
+  %gep2.16 = bitcast i32* %gep2 to i16*
+  %gep1.64 = bitcast i32* %gep1 to i64*
+  %gep2.64 = bitcast i32* %gep2 to i64*
+  ret void
+}
+
+
+; CHECK-LABEL: add_non_zero_with_offset
+; MayAlias: i32* %gep1, i32* %gep2
+; NoAlias: i16* %gep1.16, i16* %gep2.16
+define void @add_non_zero_with_offset(i32* %p, i32 %addend, i32* %q) {
+  %knownnonzero = load i32, i32* %q, !range !0
+  %add = add i32 %addend, %knownnonzero
+  %p.8 = bitcast i32* %p to i8*
+  %p.off.8 = getelementptr i8, i8* %p.8, i32 2
+  %p.off = bitcast i8* %p.off.8 to i32*
+  %gep1 = getelementptr i32, i32* %p.off, i32 %addend
+  %gep2 = getelementptr i32, i32* %p, i32 %add
+  %gep1.16 = bitcast i32* %gep1 to i16*
+  %gep2.16 = bitcast i32* %gep2 to i16*
+  ret void
+}
+
 !0 = !{ i32 1, i32 5 }


        


More information about the llvm-branch-commits mailing list