[llvm] 7f33242 - [MemCpyOpt] Add stack move test with ret-only capture (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 26 07:03:15 PST 2025
Author: Nikita Popov
Date: 2025-02-26T16:03:08+01:00
New Revision: 7f332423b090abb396adb078000e0fa4958306ea
URL: https://github.com/llvm/llvm-project/commit/7f332423b090abb396adb078000e0fa4958306ea
DIFF: https://github.com/llvm/llvm-project/commit/7f332423b090abb396adb078000e0fa4958306ea.diff
LOG: [MemCpyOpt] Add stack move test with ret-only capture (NFC)
From:
https://github.com/llvm/llvm-project/pull/125880#issuecomment-2685231008
Added:
Modified:
llvm/test/Transforms/MemCpyOpt/stack-move.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/MemCpyOpt/stack-move.ll b/llvm/test/Transforms/MemCpyOpt/stack-move.ll
index 28412d875be11..9d5a2f0a4c6be 100644
--- a/llvm/test/Transforms/MemCpyOpt/stack-move.ll
+++ b/llvm/test/Transforms/MemCpyOpt/stack-move.ll
@@ -1715,3 +1715,24 @@ else: ; preds = %then, %entry
uselistorder ptr %dest, { 1, 2, 0 }
}
+
+declare ptr @captures_ret_only(ptr captures(ret: address, provenance))
+
+define i32 @test_ret_only_capture() {
+; CHECK-LABEL: define i32 @test_ret_only_capture() {
+; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
+; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
+; CHECK-NEXT: store i32 0, ptr [[A]], align 4
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr [[B]], ptr [[A]], i64 4, i1 false)
+; CHECK-NEXT: call void @captures_ret_only(ptr [[B]])
+; CHECK-NEXT: [[V:%.*]] = load i32, ptr [[A]], align 4
+; CHECK-NEXT: ret i32 [[V]]
+;
+ %a = alloca i32
+ %b = alloca i32
+ store i32 0, ptr %a
+ call void @llvm.memcpy(ptr %b, ptr %a, i64 4, i1 false)
+ call void @captures_ret_only(ptr %b)
+ %v = load i32, ptr %a
+ ret i32 %v
+}
More information about the llvm-commits
mailing list