[PATCH] D155571: [MemCpyOpt] add terminator user test for D153453(NFC)
Kohei Asano via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 02:26:35 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbdc9a6b1e9ee: [MemCpyOpt] add terminator user test for D153453(NFC) (authored by khei4).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155571/new/
https://reviews.llvm.org/D155571
Files:
llvm/test/Transforms/MemCpyOpt/stack-move.ll
Index: llvm/test/Transforms/MemCpyOpt/stack-move.ll
===================================================================
--- llvm/test/Transforms/MemCpyOpt/stack-move.ll
+++ llvm/test/Transforms/MemCpyOpt/stack-move.ll
@@ -381,6 +381,46 @@
ret void
}
+; TODO: if the last user is terminator, we won't insert lifetime.end.
+; For multi-bb patch, we will insert it for next immediate post dominator block.
+define void @terminator_lastuse() personality i32 0 {
+; CHECK-LABEL: define void @terminator_lastuse() personality i32 0 {
+; CHECK-NEXT: [[SRC:%.*]] = alloca [[STRUCT_FOO:%.*]], align 4
+; CHECK-NEXT: [[DEST:%.*]] = alloca [[STRUCT_FOO]], align 4
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 12, ptr nocapture [[SRC]])
+; CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 12, ptr nocapture [[DEST]])
+; CHECK-NEXT: store [[STRUCT_FOO]] { i32 10, i32 20, i32 30 }, ptr [[SRC]], align 4
+; CHECK-NEXT: [[TMP1:%.*]] = call i32 @use_nocapture(ptr nocapture [[SRC]])
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[DEST]], ptr align 4 [[SRC]], i64 12, i1 false)
+; CHECK-NEXT: call void @llvm.lifetime.end.p0(i64 12, ptr [[SRC]])
+; CHECK-NEXT: [[RV:%.*]] = invoke i32 @use_nocapture(ptr [[DEST]])
+; CHECK-NEXT: to label [[SUC:%.*]] unwind label [[UNW:%.*]]
+; CHECK: unw:
+; CHECK-NEXT: [[LP:%.*]] = landingpad i32
+; CHECK-NEXT: cleanup
+; CHECK-NEXT: resume i32 0
+; CHECK: suc:
+; CHECK-NEXT: ret void
+;
+ %src = alloca %struct.Foo, align 4
+ %dest = alloca %struct.Foo, align 4
+ call void @llvm.lifetime.start.p0(i64 12, ptr nocapture %src)
+ call void @llvm.lifetime.start.p0(i64 12, ptr nocapture %dest)
+ store %struct.Foo { i32 10, i32 20, i32 30 }, ptr %src
+ %1 = call i32 @use_nocapture(ptr nocapture %src)
+
+ call void @llvm.memcpy.p0.p0.i64(ptr align 4 %dest, ptr align 4 %src, i64 12, i1 false)
+
+ call void @llvm.lifetime.end.p0(i64 12, ptr %src)
+ %rv = invoke i32 @use_nocapture(ptr %dest)
+ to label %suc unwind label %unw
+unw:
+ %lp = landingpad i32 cleanup
+ resume i32 0
+suc:
+ ret void
+}
+
; TODO: merge allocas for bb-separated, but logically straight
define void @multi_bb_memcpy(i1 %b) {
; CHECK-LABEL: define void @multi_bb_memcpy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155571.541910.patch
Type: text/x-patch
Size: 2265 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230719/e9c8211d/attachment.bin>
More information about the llvm-commits
mailing list