[llvm] 9862491 - [BasicAA] Add tests for #76789 (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 3 05:24:39 PST 2024
Author: Nikita Popov
Date: 2024-01-03T14:24:31+01:00
New Revision: 98624914367bf9091919de330cf322fb6d5e468f
URL: https://github.com/llvm/llvm-project/commit/98624914367bf9091919de330cf322fb6d5e468f
DIFF: https://github.com/llvm/llvm-project/commit/98624914367bf9091919de330cf322fb6d5e468f.diff
LOG: [BasicAA] Add tests for #76789 (NFC)
Added:
llvm/test/Analysis/BasicAA/inttoptr_constexpr.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Analysis/BasicAA/inttoptr_constexpr.ll b/llvm/test/Analysis/BasicAA/inttoptr_constexpr.ll
new file mode 100644
index 00000000000000..afe3602d1c7e5e
--- /dev/null
+++ b/llvm/test/Analysis/BasicAA/inttoptr_constexpr.ll
@@ -0,0 +1,49 @@
+; RUN: opt -passes=aa-eval -print-all-alias-modref-info -disable-output < %s 2>&1 | FileCheck %s
+
+; CHECK: NoAlias: i8* %a, i8* %gep
+define void @inttoptr_alloca() {
+ %a = alloca i8
+ %a.int = ptrtoint ptr %a to i64
+ %a.int.1 = add i64 %a.int, 1
+ %gep = getelementptr i8, ptr inttoptr (i64 -1 to ptr), i64 %a.int.1
+ %load = load i8, ptr %gep
+ store i8 1, ptr %a
+ ret void
+}
+
+; CHECK: NoAlias: i8* %a, i8* %gep
+define void @inttoptr_alloca_unknown_relation(i64 %offset) {
+ %a = alloca i8
+ %a.int = ptrtoint ptr %a to i64
+ %gep = getelementptr i8, ptr inttoptr (i64 -1 to ptr), i64 %offset
+ %load = load i8, ptr %gep
+ store i8 1, ptr %a
+ ret void
+}
+
+; CHECK: NoAlias: i8* %a, i8* %gep
+define void @inttoptr_alloca_noescape(i64 %offset) {
+ %a = alloca i8
+ %gep = getelementptr i8, ptr inttoptr (i64 -1 to ptr), i64 %offset
+ %load = load i8, ptr %gep
+ store i8 1, ptr %a
+ ret void
+}
+
+; CHECK: NoAlias: i8* %a, i8* %gep
+define void @inttoptr_noalias(ptr noalias %a) {
+ %a.int = ptrtoint ptr %a to i64
+ %a.int.1 = add i64 %a.int, 1
+ %gep = getelementptr i8, ptr inttoptr (i64 -1 to ptr), i64 %a.int.1
+ %load = load i8, ptr %gep
+ store i8 1, ptr %a
+ ret void
+}
+
+; CHECK: NoAlias: i8* %a, i8* %gep
+define void @inttoptr_noalias_noescape(ptr noalias %a, i64 %offset) {
+ %gep = getelementptr i8, ptr inttoptr (i64 -1 to ptr), i64 %offset
+ %load = load i8, ptr %gep
+ store i8 1, ptr %a
+ ret void
+}
More information about the llvm-commits
mailing list