[llvm] 47616c8 - [BasicAA] Add tests for memset_pattern{4,8,16}.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 2 03:50:46 PST 2021
Author: Florian Hahn
Date: 2021-12-02T11:50:32Z
New Revision: 47616c8855fd44abcbd7cad3f7d8153d28db347b
URL: https://github.com/llvm/llvm-project/commit/47616c8855fd44abcbd7cad3f7d8153d28db347b
DIFF: https://github.com/llvm/llvm-project/commit/47616c8855fd44abcbd7cad3f7d8153d28db347b.diff
LOG: [BasicAA] Add tests for memset_pattern{4,8,16}.
This also removes the existing memset_pattern.ll test, which was relying
on GVN. It is also covered by the new test directly.
Added:
llvm/test/Analysis/BasicAA/libfuncs-darwin.ll
Modified:
Removed:
llvm/test/Analysis/BasicAA/memset_pattern.ll
################################################################################
diff --git a/llvm/test/Analysis/BasicAA/libfuncs-darwin.ll b/llvm/test/Analysis/BasicAA/libfuncs-darwin.ll
new file mode 100644
index 000000000000..0ae358eb2f50
--- /dev/null
+++ b/llvm/test/Analysis/BasicAA/libfuncs-darwin.ll
@@ -0,0 +1,122 @@
+; RUN: opt -mtriple=x86_64-apple-macosx10.7 -inferattrs -basic-aa -aa-eval -print-all-alias-modref-info -disable-output 2>&1 %s | FileCheck %s
+
+declare void @memset_pattern4(i8*, i8*, i64)
+declare void @memset_pattern8(i8*, i8*, i64)
+declare void @memset_pattern16(i8*, i8*, i64)
+
+define void @test_memset_pattern4_const_size(i8* noalias %a, i8* noalias %pattern) {
+; CHECK-LABEL: Function: test_memset_pattern4_const_size
+; CHECK: Just Mod: Ptr: i8* %a <-> call void @memset_pattern4(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: Just Ref: Ptr: i8* %pattern <-> call void @memset_pattern4(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> call void @memset_pattern4(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.17 <-> call void @memset_pattern4(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: Just Ref: Ptr: i8* %pattern.gep.3 <-> call void @memset_pattern4(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: Just Ref: Ptr: i8* %pattern.gep.4 <-> call void @memset_pattern4(i8* %a, i8* %pattern, i64 17)
+;
+entry:
+ call void @memset_pattern4(i8* %a, i8* %pattern, i64 17)
+ %a.gep.1 = getelementptr i8, i8* %a, i32 1
+ store i8 0, i8* %a.gep.1
+ %a.gep.17 = getelementptr i8, i8* %a, i32 17
+ store i8 1, i8* %a.gep.17
+
+ %pattern.gep.3 = getelementptr i8, i8* %pattern, i32 3
+ store i8 1, i8* %pattern.gep.3
+ %pattern.gep.4 = getelementptr i8, i8* %pattern, i32 4
+ store i8 1, i8* %pattern.gep.4
+ ret void
+}
+
+define void @test_memset_pattern4_variable_size(i8* noalias %a, i8* noalias %pattern, i64 %n) {
+; CHECK-LABEL: Function: test_memset_pattern4_variable_size
+; CHECK: Just Mod: Ptr: i8* %a <-> call void @memset_pattern4(i8* %a, i8* %pattern, i64 %n)
+; CHECK-NEXT: Just Ref: Ptr: i8* %pattern <-> call void @memset_pattern4(i8* %a, i8* %pattern, i64 %n)
+; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> call void @memset_pattern4(i8* %a, i8* %pattern, i64 %n)
+; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.17 <-> call void @memset_pattern4(i8* %a, i8* %pattern, i64 %n)
+;
+entry:
+ call void @memset_pattern4(i8* %a, i8* %pattern, i64 %n)
+ %a.gep.1 = getelementptr i8, i8* %a, i32 1
+ store i8 0, i8* %a.gep.1
+ %a.gep.17 = getelementptr i8, i8* %a, i32 17
+ store i8 1, i8* %a.gep.17
+ ret void
+}
+
+define void @test_memset_pattern8_const_size(i8* noalias %a, i8* noalias %pattern) {
+; CHECK-LABEL: Function: test_memset_pattern8_const_size
+; CHECK: Just Mod: Ptr: i8* %a <-> call void @memset_pattern8(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: Just Ref: Ptr: i8* %pattern <-> call void @memset_pattern8(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> call void @memset_pattern8(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.17 <-> call void @memset_pattern8(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: Just Ref: Ptr: i8* %pattern.gep.7 <-> call void @memset_pattern8(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: Just Ref: Ptr: i8* %pattern.gep.8 <-> call void @memset_pattern8(i8* %a, i8* %pattern, i64 17)
+;
+entry:
+ call void @memset_pattern8(i8* %a, i8* %pattern, i64 17)
+ %a.gep.1 = getelementptr i8, i8* %a, i32 1
+ store i8 0, i8* %a.gep.1
+ %a.gep.17 = getelementptr i8, i8* %a, i32 17
+ store i8 1, i8* %a.gep.17
+
+ %pattern.gep.7 = getelementptr i8, i8* %pattern, i32 7
+ store i8 1, i8* %pattern.gep.7
+ %pattern.gep.8 = getelementptr i8, i8* %pattern, i32 8
+ store i8 1, i8* %pattern.gep.8
+ ret void
+}
+
+define void @test_memset_pattern8_variable_size(i8* noalias %a, i8* noalias %pattern, i64 %n) {
+; CHECK-LABEL: Function: test_memset_pattern8_variable_size
+; CHECK: Just Mod: Ptr: i8* %a <-> call void @memset_pattern8(i8* %a, i8* %pattern, i64 %n)
+; CHECK-NEXT: Just Ref: Ptr: i8* %pattern <-> call void @memset_pattern8(i8* %a, i8* %pattern, i64 %n)
+; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> call void @memset_pattern8(i8* %a, i8* %pattern, i64 %n)
+; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.17 <-> call void @memset_pattern8(i8* %a, i8* %pattern, i64 %n)
+;
+entry:
+ call void @memset_pattern8(i8* %a, i8* %pattern, i64 %n)
+ %a.gep.1 = getelementptr i8, i8* %a, i32 1
+ store i8 0, i8* %a.gep.1
+ %a.gep.17 = getelementptr i8, i8* %a, i32 17
+ store i8 1, i8* %a.gep.17
+ ret void
+}
+
+define void @test_memset_pattern16_const_size(i8* noalias %a, i8* noalias %pattern) {
+; CHECK-LABEL: Function: test_memset_pattern16_const_size
+; CHECK: Just Mod: Ptr: i8* %a <-> call void @memset_pattern16(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: Just Ref: Ptr: i8* %pattern <-> call void @memset_pattern16(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> call void @memset_pattern16(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: NoModRef: Ptr: i8* %a.gep.17 <-> call void @memset_pattern16(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: Just Ref: Ptr: i8* %pattern.gep.15 <-> call void @memset_pattern16(i8* %a, i8* %pattern, i64 17)
+; CHECK-NEXT: NoModRef: Ptr: i8* %pattern.gep.16 <-> call void @memset_pattern16(i8* %a, i8* %pattern, i64 17)
+;
+entry:
+ call void @memset_pattern16(i8* %a, i8* %pattern, i64 17)
+ %a.gep.1 = getelementptr i8, i8* %a, i32 1
+ store i8 0, i8* %a.gep.1
+ %a.gep.17 = getelementptr i8, i8* %a, i32 17
+ store i8 1, i8* %a.gep.17
+
+ %pattern.gep.15 = getelementptr i8, i8* %pattern, i32 15
+ store i8 1, i8* %pattern.gep.15
+ %pattern.gep.16 = getelementptr i8, i8* %pattern, i32 16
+ store i8 1, i8* %pattern.gep.16
+ ret void
+}
+
+define void @test_memset_pattern16_variable_size(i8* noalias %a, i8* noalias %pattern, i64 %n) {
+; CHECK-LABEL: Function: test_memset_pattern16_variable_size
+; CHECK: Just Mod: Ptr: i8* %a <-> call void @memset_pattern16(i8* %a, i8* %pattern, i64 %n)
+; CHECK-NEXT: Just Ref: Ptr: i8* %pattern <-> call void @memset_pattern16(i8* %a, i8* %pattern, i64 %n)
+; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.1 <-> call void @memset_pattern16(i8* %a, i8* %pattern, i64 %n)
+; CHECK-NEXT: Just Mod: Ptr: i8* %a.gep.17 <-> call void @memset_pattern16(i8* %a, i8* %pattern, i64 %n)
+;
+entry:
+ call void @memset_pattern16(i8* %a, i8* %pattern, i64 %n)
+ %a.gep.1 = getelementptr i8, i8* %a, i32 1
+ store i8 0, i8* %a.gep.1
+ %a.gep.17 = getelementptr i8, i8* %a, i32 17
+ store i8 1, i8* %a.gep.17
+ ret void
+}
diff --git a/llvm/test/Analysis/BasicAA/memset_pattern.ll b/llvm/test/Analysis/BasicAA/memset_pattern.ll
deleted file mode 100644
index 1096d3896fda..000000000000
--- a/llvm/test/Analysis/BasicAA/memset_pattern.ll
+++ /dev/null
@@ -1,21 +0,0 @@
-; RUN: opt -S -basic-aa -gvn < %s | FileCheck %s
-; PR10872
-target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
-target triple = "x86_64-apple-macosx10.7"
-
- at z = internal global i32 0, align 4
- at y = internal global i32 0, align 4
- at x = internal constant i32 0, align 4
-
-; CHECK: @test
-define i32 @test() nounwind uwtable ssp {
-entry:
- store i32 1, i32* @z
- tail call void @memset_pattern16(i8* bitcast (i32* @y to i8*), i8* bitcast (i32* @x to i8*), i64 4) nounwind
-; CHECK-NOT: load
- %l = load i32, i32* @z
-; CHECK: ret i32 1
- ret i32 %l
-}
-
-declare void @memset_pattern16(i8*, i8* readonly, i64) argmemonly
More information about the llvm-commits
mailing list