[PATCH] D137029: [test][InstCombine] Add a test case for volatile memcpy forwarding in InstCombine, which is currently optimized incorrectly.

Patrick Walton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 29 17:15:55 PDT 2022


pcwalton created this revision.
Herald added a project: All.
pcwalton requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

D136822 <https://reviews.llvm.org/D136822> demonstrated that we currently delete volatile memcpys in InstCombine,
which we shouldn't do. This commit adds a test for this. A forthcoming commit
will fix it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137029

Files:
  llvm/test/Transforms/InstCombine/memcpy-from-global.ll


Index: llvm/test/Transforms/InstCombine/memcpy-from-global.ll
===================================================================
--- llvm/test/Transforms/InstCombine/memcpy-from-global.ll
+++ llvm/test/Transforms/InstCombine/memcpy-from-global.ll
@@ -366,4 +366,16 @@
   ret void
 }
 
+; FIXME: Test that we incorrectly elide a volatile memcpy.
+define void @volatile_memcpy() {
+; CHECK-LABEL: @volatile_memcpy(
+; CHECK-NEXT:    call void @bar(ptr nonnull @H) #[[ATTR3]]
+; CHECK-NEXT:    ret void
+;
+  %A = alloca %U, align 16
+  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %A, ptr align 4 @H, i64 20, i1 true)
+  call void @bar(ptr %A) readonly
+  ret void
+}
+
 attributes #0 = { null_pointer_is_valid }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137029.471795.patch
Type: text/x-patch
Size: 712 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221030/ec4f72bf/attachment.bin>


More information about the llvm-commits mailing list