[llvm] 8357ff6 - [test][InstCombine] Add a test case for volatile memcpy forwarding in InstCombine, which is currently optimized incorrectly.

Patrick Walton via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 30 02:38:58 PDT 2022


Author: Patrick Walton
Date: 2022-10-30T02:38:43-07:00
New Revision: 8357ff6f3d6d0582279d7cc4ee3db04ce2b46318

URL: https://github.com/llvm/llvm-project/commit/8357ff6f3d6d0582279d7cc4ee3db04ce2b46318
DIFF: https://github.com/llvm/llvm-project/commit/8357ff6f3d6d0582279d7cc4ee3db04ce2b46318.diff

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

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.

Differential Revision: https://reviews.llvm.org/D137029

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/memcpy-from-global.ll b/llvm/test/Transforms/InstCombine/memcpy-from-global.ll
index 4790139eea0d..67fb0596e1a9 100644
--- a/llvm/test/Transforms/InstCombine/memcpy-from-global.ll
+++ b/llvm/test/Transforms/InstCombine/memcpy-from-global.ll
@@ -366,4 +366,16 @@ define void @memcpy_from_just_readonly(ptr readonly align 8 dereferenceable(124)
   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 }


        


More information about the llvm-commits mailing list