[llvm] 12ba065 - [test][MemCpyOpt] Precommit test
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 12 17:40:21 PST 2022
Author: Arthur Eubanks
Date: 2022-02-12T17:38:45-08:00
New Revision: 12ba0659b4abae114a2f00dda2b82db5508bfa69
URL: https://github.com/llvm/llvm-project/commit/12ba0659b4abae114a2f00dda2b82db5508bfa69
DIFF: https://github.com/llvm/llvm-project/commit/12ba0659b4abae114a2f00dda2b82db5508bfa69.diff
LOG: [test][MemCpyOpt] Precommit test
Added:
Modified:
llvm/test/Transforms/MemCpyOpt/opaque-ptr.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/MemCpyOpt/opaque-ptr.ll b/llvm/test/Transforms/MemCpyOpt/opaque-ptr.ll
index 9a56c8b4afb80..2e414f635dd95 100644
--- a/llvm/test/Transforms/MemCpyOpt/opaque-ptr.ll
+++ b/llvm/test/Transforms/MemCpyOpt/opaque-ptr.ll
@@ -16,5 +16,25 @@ define void @test_memset_memcpy(ptr %src, i64 %src_size, ptr noalias %dst, i64 %
ret void
}
+%a = type { i64, i64, i64 }
+%b = type { i32, i32, i32 }
+
+define void @test_non_const_gep(ptr %src, i64 %i) {
+; CHECK-LABEL: @test_non_const_gep(
+; CHECK-NEXT: [[PB:%.*]] = getelementptr [[B:%.*]], ptr [[SRC:%.*]], i64 0, i32 1
+; CHECK-NEXT: [[PA:%.*]] = getelementptr [[A:%.*]], ptr [[SRC]], i64 0, i32 1
+; CHECK-NEXT: [[PA2:%.*]] = getelementptr [[A]], ptr [[SRC]], i64 0, i32 2
+; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[PA]], i8 0, i64 16, i1 false)
+; CHECK-NEXT: ret void
+;
+ %pb = getelementptr %b, ptr %src, i64 0, i32 1
+ store i64 0, ptr %pb
+ %pa = getelementptr %a, ptr %src, i64 0, i32 1
+ store i64 0, ptr %pa
+ %pa2 = getelementptr %a, ptr %src, i64 0, i32 2
+ store i64 0, ptr %pa2
+ ret void
+}
+
declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i1)
declare void @llvm.memcpy.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1)
More information about the llvm-commits
mailing list