[llvm] b7ff048 - [BasicAA] Add additional truncation tests (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 1 13:57:10 PDT 2021
Author: Nikita Popov
Date: 2021-10-01T22:57:01+02:00
New Revision: b7ff0489158cc842ab70a6744815180be37e29a2
URL: https://github.com/llvm/llvm-project/commit/b7ff0489158cc842ab70a6744815180be37e29a2
DIFF: https://github.com/llvm/llvm-project/commit/b7ff0489158cc842ab70a6744815180be37e29a2.diff
LOG: [BasicAA] Add additional truncation tests (NFC)
These show that the known bits and non-zero heuristics are incorrect
when truncation is involved.
Added:
Modified:
llvm/test/Analysis/BasicAA/gep-implicit-trunc-32-bit-pointers.ll
Removed:
################################################################################
diff --git a/llvm/test/Analysis/BasicAA/gep-implicit-trunc-32-bit-pointers.ll b/llvm/test/Analysis/BasicAA/gep-implicit-trunc-32-bit-pointers.ll
index 5e02fbda317a..4b55986b91e9 100644
--- a/llvm/test/Analysis/BasicAA/gep-implicit-trunc-32-bit-pointers.ll
+++ b/llvm/test/Analysis/BasicAA/gep-implicit-trunc-32-bit-pointers.ll
@@ -66,3 +66,32 @@ define void @mustalias_overflow_in_32_bit_add_mul_gep(i8* %ptr, i64 %i) {
store i8 1, i8* %gep.2
ret void
}
+
+; FIXME: While %n is non-zero, its low 32 bits may not be.
+define void @mayalias_overflow_in_32_bit_non_zero(i8* %ptr, i64 %n) {
+; CHECK-LABEL: Function: mayalias_overflow_in_32_bit_non_zero
+; CHECK: NoAlias: i8* %gep, i8* %ptr
+;
+ %c = icmp ne i64 %n, 0
+ call void @llvm.assume(i1 %c)
+ store i8 0, i8* %ptr
+ %gep = getelementptr i8, i8* %ptr, i64 %n
+ store i8 1, i8* %gep
+ ret void
+}
+
+; FIXME: While %n is positive, its low 32 bits may not be.
+define void @mayalias_overflow_in_32_bit_positive(i8* %ptr, i64 %n) {
+; CHECK-LABEL: Function: mayalias_overflow_in_32_bit_positive
+; CHECK: NoAlias: i8* %gep.1, i8* %ptr
+; CHECK: NoAlias: i8* %gep.2, i8* %ptr
+; CHECK: NoAlias: i8* %gep.1, i8* %gep.2
+;
+ %c = icmp sgt i64 %n, 0
+ call void @llvm.assume(i1 %c)
+ %gep.1 = getelementptr i8, i8* %ptr, i64 -1
+ store i8 0, i8* %gep.1
+ %gep.2 = getelementptr i8, i8* %ptr, i64 %n
+ store i8 1, i8* %gep.2
+ ret void
+}
More information about the llvm-commits
mailing list