[MemCpyOpt] Add test for #67539 (NFC)
authorNikita Popov <npopov@redhat.com>
Thu, 28 Sep 2023 07:43:22 +0000 (09:43 +0200)
committerTobias Hieta <tobias@hieta.se>
Fri, 29 Sep 2023 06:24:42 +0000 (08:24 +0200)
(cherry picked from commit d5c8b23b1ee1dcb6922e8226143410840edabe50)

llvm/test/Transforms/MemCpyOpt/memcpy.ll

index 412ffd5..d7475e7 100644 (file)
@@ -694,3 +694,20 @@ define void @immut_valid_align_branched(i1 %c, ptr noalias align 4 %val) {
   call void @f(ptr nocapture noalias readonly %val3)
   ret void
 }
+
+; FIXME: This is a miscompile.
+define void @immut_param_noalias_metadata(ptr align 4 byval(i32) %ptr) {
+; CHECK-LABEL: @immut_param_noalias_metadata(
+; CHECK-NEXT:    call void @f(ptr noalias nocapture readonly [[PTR:%.*]]), !alias.scope !0
+; CHECK-NEXT:    ret void
+;
+  %tmp = alloca i32, align 4
+  store i32 1, ptr %ptr, !noalias !2
+  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %tmp, ptr align 4 %ptr, i64 4, i1 false)
+  call void @f(ptr nocapture noalias readonly %tmp), !alias.scope !2
+  ret void
+}
+
+!0 = !{!0}
+!1 = !{!1, !0}
+!2 = !{!1}