Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Intrinsics][PreISelInstrinsicLowering] llvm.memcpy.inline length no longer needs to be constant #98281

Merged
merged 3 commits into from
Jul 16, 2024

Conversation

asb
Copy link
Contributor

@asb asb commented Jul 10, 2024

Following on from the discussion in
https://discourse.llvm.org/t/rfc-introducing-an-llvm-memset-pattern-inline-intrinsic/79496 and the equivalent change for llvm.memset.inline (#95397), this removes the requirement that the length of llvm.memcpy.inline is constant. PreISelInstrinsicLowering will expand llvm.memcpy.inline with non-constant lengths, while the codegen path for constant lengths is left unaltered.

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 10, 2024

@llvm/pr-subscribers-llvm-transforms
@llvm/pr-subscribers-llvm-ir

@llvm/pr-subscribers-llvm-analysis

Author: Alex Bradbury (asb)

Changes

Following on from the discussion in
https://discourse.llvm.org/t/rfc-introducing-an-llvm-memset-pattern-inline-intrinsic/79496 and the equivalent change for llvm.memset.inline (#95397), this removes the requirement that the length of llvm.memcpy.inline is constant. PreISelInstrinsicLowering will expand llvm.memcpy.inline with non-constant lengths, while the codegen path for constant lengths is left unaltered.


Full diff: https://github.com/llvm/llvm-project/pull/98281.diff

7 Files Affected:

  • (modified) llvm/docs/LangRef.rst (+1-1)
  • (modified) llvm/include/llvm/IR/IntrinsicInst.h (-3)
  • (modified) llvm/include/llvm/IR/Intrinsics.td (+1-2)
  • (modified) llvm/lib/Analysis/Lint.cpp (+2-18)
  • (modified) llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp (+16)
  • (added) llvm/test/Transforms/PreISelIntrinsicLowering/X86/memcpy-inline-non-constant-len.ll (+34)
  • (modified) llvm/test/Verifier/intrinsic-immarg.ll (-8)
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index ae39217dc8ff8..21ded802ebdf0 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -15026,7 +15026,7 @@ Arguments:
 """"""""""
 
 The first argument is a pointer to the destination, the second is a
-pointer to the source. The third argument is a constant integer argument
+pointer to the source. The third argument is an integer argument
 specifying the number of bytes to copy, and the fourth is a
 boolean indicating a volatile access.
 
diff --git a/llvm/include/llvm/IR/IntrinsicInst.h b/llvm/include/llvm/IR/IntrinsicInst.h
index a2ecf625ff61a..fe3f92da400f8 100644
--- a/llvm/include/llvm/IR/IntrinsicInst.h
+++ b/llvm/include/llvm/IR/IntrinsicInst.h
@@ -1296,9 +1296,6 @@ class MemMoveInst : public MemTransferInst {
 /// This class wraps the llvm.memcpy.inline intrinsic.
 class MemCpyInlineInst : public MemCpyInst {
 public:
-  ConstantInt *getLength() const {
-    return cast<ConstantInt>(MemCpyInst::getLength());
-  }
   // Methods for support type inquiry through isa, cast, and dyn_cast:
   static bool classof(const IntrinsicInst *I) {
     return I->getIntrinsicID() == Intrinsic::memcpy_inline;
diff --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index 65a9b68b5229d..615ece332a1d6 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -966,7 +966,6 @@ def int_memcpy  : Intrinsic<[],
 // Memcpy semantic that is guaranteed to be inlined.
 // In particular this means that the generated code is not allowed to call any
 // external function.
-// The third argument (specifying the size) must be a constant.
 def int_memcpy_inline
     : Intrinsic<[],
       [llvm_anyptr_ty, llvm_anyptr_ty, llvm_anyint_ty, llvm_i1_ty],
@@ -974,7 +973,7 @@ def int_memcpy_inline
        NoCapture<ArgIndex<0>>, NoCapture<ArgIndex<1>>,
        NoAlias<ArgIndex<0>>, NoAlias<ArgIndex<1>>,
        WriteOnly<ArgIndex<0>>, ReadOnly<ArgIndex<1>>,
-       ImmArg<ArgIndex<2>>, ImmArg<ArgIndex<3>>]>;
+       ImmArg<ArgIndex<3>>]>;
 
 def int_memmove : Intrinsic<[],
                             [llvm_anyptr_ty, llvm_anyptr_ty, llvm_anyint_ty,
diff --git a/llvm/lib/Analysis/Lint.cpp b/llvm/lib/Analysis/Lint.cpp
index 496308a0c247a..a44d5a3bbe462 100644
--- a/llvm/lib/Analysis/Lint.cpp
+++ b/llvm/lib/Analysis/Lint.cpp
@@ -290,7 +290,8 @@ void Lint::visitCallBase(CallBase &I) {
 
       // TODO: Check more intrinsics
 
-    case Intrinsic::memcpy: {
+    case Intrinsic::memcpy:
+    case Intrinsic::memcpy_inline: {
       MemCpyInst *MCI = cast<MemCpyInst>(&I);
       visitMemoryReference(I, MemoryLocation::getForDest(MCI),
                            MCI->getDestAlign(), nullptr, MemRef::Write);
@@ -311,23 +312,6 @@ void Lint::visitCallBase(CallBase &I) {
             "Undefined behavior: memcpy source and destination overlap", &I);
       break;
     }
-    case Intrinsic::memcpy_inline: {
-      MemCpyInlineInst *MCII = cast<MemCpyInlineInst>(&I);
-      const uint64_t Size = MCII->getLength()->getValue().getLimitedValue();
-      visitMemoryReference(I, MemoryLocation::getForDest(MCII),
-                           MCII->getDestAlign(), nullptr, MemRef::Write);
-      visitMemoryReference(I, MemoryLocation::getForSource(MCII),
-                           MCII->getSourceAlign(), nullptr, MemRef::Read);
-
-      // Check that the memcpy arguments don't overlap. The AliasAnalysis API
-      // isn't expressive enough for what we really want to do. Known partial
-      // overlap is not distinguished from the case where nothing is known.
-      const LocationSize LS = LocationSize::precise(Size);
-      Check(AA->alias(MCII->getSource(), LS, MCII->getDest(), LS) !=
-                AliasResult::MustAlias,
-            "Undefined behavior: memcpy source and destination overlap", &I);
-      break;
-    }
     case Intrinsic::memmove: {
       MemMoveInst *MMI = cast<MemMoveInst>(&I);
       visitMemoryReference(I, MemoryLocation::getForDest(MMI),
diff --git a/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp b/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp
index 8572cdc160456..19950f3eb67ba 100644
--- a/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp
+++ b/llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp
@@ -230,6 +230,21 @@ bool PreISelIntrinsicLowering::expandMemIntrinsicUses(Function &F) const {
 
       break;
     }
+    case Intrinsic::memcpy_inline: {
+      // Only expand llvm.memcpy.inline with non-constant length in this
+      // codepath, leaving the current SelectionDAG expansion for constant
+      // length memcpy intrinsics undisturbed.
+      auto *Memcpy = cast<MemCpyInlineInst>(Inst);
+      if (isa<ConstantInt>(Memcpy->getLength()))
+        break;
+
+      Function *ParentFunc = Memcpy->getFunction();
+      const TargetTransformInfo &TTI = LookupTTI(*ParentFunc);
+      expandMemCpyAsLoop(Memcpy, TTI);
+      Changed = true;
+      Memcpy->eraseFromParent();
+      break;
+    }
     case Intrinsic::memmove: {
       auto *Memmove = cast<MemMoveInst>(Inst);
       Function *ParentFunc = Memmove->getFunction();
@@ -291,6 +306,7 @@ bool PreISelIntrinsicLowering::lowerIntrinsics(Module &M) const {
     default:
       break;
     case Intrinsic::memcpy:
+    case Intrinsic::memcpy_inline:
     case Intrinsic::memmove:
     case Intrinsic::memset:
     case Intrinsic::memset_inline:
diff --git a/llvm/test/Transforms/PreISelIntrinsicLowering/X86/memcpy-inline-non-constant-len.ll b/llvm/test/Transforms/PreISelIntrinsicLowering/X86/memcpy-inline-non-constant-len.ll
new file mode 100644
index 0000000000000..5fe1f55ec272b
--- /dev/null
+++ b/llvm/test/Transforms/PreISelIntrinsicLowering/X86/memcpy-inline-non-constant-len.ll
@@ -0,0 +1,34 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -mtriple=x86_64-pc-linux-gnu -passes=pre-isel-intrinsic-lowering -S -o - %s | FileCheck %s
+
+; Constant length memcpy.inline should be left unmodified.
+define void @memcpy_32(ptr %dst, ptr %src) nounwind {
+; CHECK-LABEL: define void @memcpy_32(
+; CHECK-SAME: ptr [[DST:%.*]], ptr [[SRC:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT:    tail call void @llvm.memcpy.inline.p0.p0.i64(ptr [[DST]], ptr [[SRC]], i64 32, i1 false)
+; CHECK-NEXT:    ret void
+;
+  tail call void @llvm.memcpy.inline.p0.p0.i64(ptr %dst, ptr %src, i64 32, i1 0)
+  ret void
+}
+
+define void @memcpy_x(ptr %dst, ptr %src, i64 %x) nounwind {
+; CHECK-LABEL: define void @memcpy_x(
+; CHECK-SAME: ptr [[DST:%.*]], ptr [[SRC:%.*]], i64 [[X:%.*]]) #[[ATTR0]] {
+; CHECK-NEXT:    [[TMP1:%.*]] = icmp ne i64 [[X]], 0
+; CHECK-NEXT:    br i1 [[TMP1]], label %[[LOOP_MEMCPY_EXPANSION:.*]], label %[[POST_LOOP_MEMCPY_EXPANSION:.*]]
+; CHECK:       [[LOOP_MEMCPY_EXPANSION]]:
+; CHECK-NEXT:    [[LOOP_INDEX:%.*]] = phi i64 [ 0, [[TMP0:%.*]] ], [ [[TMP5:%.*]], %[[LOOP_MEMCPY_EXPANSION]] ]
+; CHECK-NEXT:    [[TMP2:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i64 [[LOOP_INDEX]]
+; CHECK-NEXT:    [[TMP3:%.*]] = load i8, ptr [[TMP2]], align 1
+; CHECK-NEXT:    [[TMP4:%.*]] = getelementptr inbounds i8, ptr [[DST]], i64 [[LOOP_INDEX]]
+; CHECK-NEXT:    store i8 [[TMP3]], ptr [[TMP4]], align 1
+; CHECK-NEXT:    [[TMP5]] = add i64 [[LOOP_INDEX]], 1
+; CHECK-NEXT:    [[TMP6:%.*]] = icmp ult i64 [[TMP5]], [[X]]
+; CHECK-NEXT:    br i1 [[TMP6]], label %[[LOOP_MEMCPY_EXPANSION]], label %[[POST_LOOP_MEMCPY_EXPANSION]]
+; CHECK:       [[POST_LOOP_MEMCPY_EXPANSION]]:
+; CHECK-NEXT:    ret void
+;
+  tail call void @llvm.memcpy.inline.p0.p0.i64(ptr %dst, ptr %src, i64 %x, i1 0)
+  ret void
+}
diff --git a/llvm/test/Verifier/intrinsic-immarg.ll b/llvm/test/Verifier/intrinsic-immarg.ll
index b1b9f7ee4be11..ad70b17e5fb72 100644
--- a/llvm/test/Verifier/intrinsic-immarg.ll
+++ b/llvm/test/Verifier/intrinsic-immarg.ll
@@ -36,14 +36,6 @@ define void @memcpy_inline_is_volatile(ptr %dest, ptr %src, i1 %is.volatile) {
   ret void
 }
 
-define void @memcpy_inline_variable_size(ptr %dest, ptr %src, i32 %size) {
-  ; CHECK: immarg operand has non-immediate parameter
-  ; CHECK-NEXT: i32 %size
-  ; CHECK-NEXT: call void @llvm.memcpy.inline.p0.p0.i32(ptr %dest, ptr %src, i32 %size, i1 true)
-  call void @llvm.memcpy.inline.p0.p0.i32(ptr %dest, ptr %src, i32 %size, i1 true)
-  ret void
-}
-
 declare void @llvm.memmove.p0.p0.i32(ptr nocapture, ptr nocapture, i32, i1)
 define void @memmove(ptr %dest, ptr %src, i1 %is.volatile) {
   ; CHECK: immarg operand has non-immediate parameter

asb added a commit that referenced this pull request Jul 10, 2024
….inline is preserved

Equivalent change ot the one requested in the review for #98281.
asb added a commit that referenced this pull request Jul 10, 2024
… doesn't drop volatile flag

As suggested in the discussion for #98281.
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
….inline is preserved

Equivalent change ot the one requested in the review for llvm#98281.
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
… doesn't drop volatile flag

As suggested in the discussion for llvm#98281.
asb added 3 commits July 16, 2024 13:56
…longer needs to be constant

Following on from the discussion in
https://discourse.llvm.org/t/rfc-introducing-an-llvm-memset-pattern-inline-intrinsic/79496
and the equivalent change for llvm.memset.inline (llvm#95397), this removes
the requirement that the length of llvm.memcpy.inline is constant.
PreISelInstrinsicLowering will expand llvm.memcpy.inline with
non-constant lengths, while the codegen path for constant lengths is
left unaltered.
@asb asb force-pushed the 2024q3-memcpy-inline-with-variable-size branch from f3717bd to c715fd3 Compare July 16, 2024 13:11
@asb asb merged commit 522fd53 into llvm:main Jul 16, 2024
4 of 6 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 16, 2024

LLVM Buildbot has detected a new failure on builder mlir-rocm-mi200 running on mi200-buildbot while building llvm at step 6 "test-build-check-mlir-build-only-check-mlir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/177/builds/1673

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-check-mlir-build-only-check-mlir) failure: test (failure)
******************** TEST 'MLIR :: Target/LLVMIR/llvmir-intrinsics.mlir' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/vol/worker/mi200-buildbot/mlir-rocm-mi200/build/bin/mlir-translate -mlir-to-llvmir /vol/worker/mi200-buildbot/mlir-rocm-mi200/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir | /vol/worker/mi200-buildbot/mlir-rocm-mi200/build/bin/FileCheck /vol/worker/mi200-buildbot/mlir-rocm-mi200/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# executed command: /vol/worker/mi200-buildbot/mlir-rocm-mi200/build/bin/mlir-translate -mlir-to-llvmir /vol/worker/mi200-buildbot/mlir-rocm-mi200/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# executed command: /vol/worker/mi200-buildbot/mlir-rocm-mi200/build/bin/FileCheck /vol/worker/mi200-buildbot/mlir-rocm-mi200/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# .---command stderr------------
# | /vol/worker/mi200-buildbot/mlir-rocm-mi200/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir:1072:15: error: CHECK-DAG: expected string not found in input
# | // CHECK-DAG: declare void @llvm.memcpy.inline.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32 immarg, i1 immarg)
# |               ^
# | <stdin>:574:143: note: scanning from here
# |  %8 = call <4 x half> @llvm.experimental.constrained.fptrunc.v4f16.v4f32(<4 x float> %1, metadata !"round.upward", metadata !"fpexcept.strict") #20
# |                                                                                                                                               ^
# | 
# | Input file: <stdin>
# | Check file: /vol/worker/mi200-buildbot/mlir-rocm-mi200/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |           .
# |           .
# |           .
# |         569:  %3 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.towardzero", metadata !"fpexcept.ignore") #20 
# |         570:  %4 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #20 
# |         571:  %5 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.upward", metadata !"fpexcept.strict") #20 
# |         572:  %6 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.downward", metadata !"fpexcept.ignore") #20 
# |         573:  %7 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.tonearestaway", metadata !"fpexcept.ignore") #20 
# |         574:  %8 = call <4 x half> @llvm.experimental.constrained.fptrunc.v4f16.v4f32(<4 x float> %1, metadata !"round.upward", metadata !"fpexcept.strict") #20 
# | dag:1072                                                                                                                                                   X~~~~~ error: no match found
# |         575:  ret void 
# | dag:1072     ~~~~~~~~~~
# |         576: } 
# | dag:1072     ~~
# |         577:  
# | dag:1072     ~
# |         578: ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 
# | dag:1072     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |         579: declare float @llvm.fmuladd.f32(float, float, float) #0 
# | dag:1072     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           .
# |           .
# |           .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 16, 2024

LLVM Buildbot has detected a new failure on builder ppc64le-mlir-rhel-clang running on ppc64le-mlir-rhel-test while building llvm at step 6 "test-build-check-mlir-build-only-check-mlir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/129/builds/1966

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-check-mlir-build-only-check-mlir) failure: test (failure)
******************** TEST 'MLIR :: Target/LLVMIR/llvmir-intrinsics.mlir' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/buildbots/llvm-external-buildbots/workers/ppc64le-mlir-rhel-test/ppc64le-mlir-rhel-clang-build/build/bin/mlir-translate -mlir-to-llvmir /home/buildbots/llvm-external-buildbots/workers/ppc64le-mlir-rhel-test/ppc64le-mlir-rhel-clang-build/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir | /home/buildbots/llvm-external-buildbots/workers/ppc64le-mlir-rhel-test/ppc64le-mlir-rhel-clang-build/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-mlir-rhel-test/ppc64le-mlir-rhel-clang-build/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# executed command: /home/buildbots/llvm-external-buildbots/workers/ppc64le-mlir-rhel-test/ppc64le-mlir-rhel-clang-build/build/bin/mlir-translate -mlir-to-llvmir /home/buildbots/llvm-external-buildbots/workers/ppc64le-mlir-rhel-test/ppc64le-mlir-rhel-clang-build/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# executed command: /home/buildbots/llvm-external-buildbots/workers/ppc64le-mlir-rhel-test/ppc64le-mlir-rhel-clang-build/build/bin/FileCheck /home/buildbots/llvm-external-buildbots/workers/ppc64le-mlir-rhel-test/ppc64le-mlir-rhel-clang-build/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# .---command stderr------------
# | /home/buildbots/llvm-external-buildbots/workers/ppc64le-mlir-rhel-test/ppc64le-mlir-rhel-clang-build/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir:1072:15: error: CHECK-DAG: expected string not found in input
# | // CHECK-DAG: declare void @llvm.memcpy.inline.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32 immarg, i1 immarg)
# |               ^
# | <stdin>:574:143: note: scanning from here
# |  %8 = call <4 x half> @llvm.experimental.constrained.fptrunc.v4f16.v4f32(<4 x float> %1, metadata !"round.upward", metadata !"fpexcept.strict") #20
# |                                                                                                                                               ^
# | 
# | Input file: <stdin>
# | Check file: /home/buildbots/llvm-external-buildbots/workers/ppc64le-mlir-rhel-test/ppc64le-mlir-rhel-clang-build/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |           .
# |           .
# |           .
# |         569:  %3 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.towardzero", metadata !"fpexcept.ignore") #20 
# |         570:  %4 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #20 
# |         571:  %5 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.upward", metadata !"fpexcept.strict") #20 
# |         572:  %6 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.downward", metadata !"fpexcept.ignore") #20 
# |         573:  %7 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.tonearestaway", metadata !"fpexcept.ignore") #20 
# |         574:  %8 = call <4 x half> @llvm.experimental.constrained.fptrunc.v4f16.v4f32(<4 x float> %1, metadata !"round.upward", metadata !"fpexcept.strict") #20 
# | dag:1072                                                                                                                                                   X~~~~~ error: no match found
# |         575:  ret void 
# | dag:1072     ~~~~~~~~~~
# |         576: } 
# | dag:1072     ~~
# |         577:  
# | dag:1072     ~
# |         578: ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 
# | dag:1072     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |         579: declare float @llvm.fmuladd.f32(float, float, float) #0 
# | dag:1072     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           .
# |           .
# |           .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 16, 2024

LLVM Buildbot has detected a new failure on builder mlir-nvidia-gcc7 running on mlir-nvidia while building llvm at step 6 "test-build-check-mlir-build-only-check-mlir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/116/builds/1316

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-check-mlir-build-only-check-mlir) failure: test (failure)
******************** TEST 'MLIR :: Target/LLVMIR/llvmir-intrinsics.mlir' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/bin/mlir-translate -mlir-to-llvmir /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir | /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/bin/FileCheck /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# executed command: /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/bin/mlir-translate -mlir-to-llvmir /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# executed command: /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/bin/FileCheck /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# .---command stderr------------
# | /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir:1072:15: error: CHECK-DAG: expected string not found in input
# | // CHECK-DAG: declare void @llvm.memcpy.inline.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32 immarg, i1 immarg)
# |               ^
# | <stdin>:574:143: note: scanning from here
# |  %8 = call <4 x half> @llvm.experimental.constrained.fptrunc.v4f16.v4f32(<4 x float> %1, metadata !"round.upward", metadata !"fpexcept.strict") #20
# |                                                                                                                                               ^
# | 
# | Input file: <stdin>
# | Check file: /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |           .
# |           .
# |           .
# |         569:  %3 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.towardzero", metadata !"fpexcept.ignore") #20 
# |         570:  %4 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #20 
# |         571:  %5 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.upward", metadata !"fpexcept.strict") #20 
# |         572:  %6 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.downward", metadata !"fpexcept.ignore") #20 
# |         573:  %7 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.tonearestaway", metadata !"fpexcept.ignore") #20 
# |         574:  %8 = call <4 x half> @llvm.experimental.constrained.fptrunc.v4f16.v4f32(<4 x float> %1, metadata !"round.upward", metadata !"fpexcept.strict") #20 
# | dag:1072                                                                                                                                                   X~~~~~ error: no match found
# |         575:  ret void 
# | dag:1072     ~~~~~~~~~~
# |         576: } 
# | dag:1072     ~~
# |         577:  
# | dag:1072     ~
# |         578: ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 
# | dag:1072     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |         579: declare float @llvm.fmuladd.f32(float, float, float) #0 
# | dag:1072     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           .
# |           .
# |           .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
...

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 16, 2024

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building llvm at step 10 "Add check check-mlir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/2215

Here is the relevant piece of the build log for the reference:

Step 10 (Add check check-mlir) failure: test (failure)
******************** TEST 'MLIR :: Target/LLVMIR/llvmir-intrinsics.mlir' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/mlir-translate -mlir-to-llvmir /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir | /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# executed command: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/mlir-translate -mlir-to-llvmir /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# executed command: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# .---command stderr------------
# | /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir:1072:15: error: CHECK-DAG: expected string not found in input
# | // CHECK-DAG: declare void @llvm.memcpy.inline.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32 immarg, i1 immarg)
# |               ^
# | <stdin>:574:143: note: scanning from here
# |  %8 = call <4 x half> @llvm.experimental.constrained.fptrunc.v4f16.v4f32(<4 x float> %1, metadata !"round.upward", metadata !"fpexcept.strict") #20
# |                                                                                                                                               ^
# | 
# | Input file: <stdin>
# | Check file: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |           .
# |           .
# |           .
# |         569:  %3 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.towardzero", metadata !"fpexcept.ignore") #20 
# |         570:  %4 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #20 
# |         571:  %5 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.upward", metadata !"fpexcept.strict") #20 
# |         572:  %6 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.downward", metadata !"fpexcept.ignore") #20 
# |         573:  %7 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.tonearestaway", metadata !"fpexcept.ignore") #20 
# |         574:  %8 = call <4 x half> @llvm.experimental.constrained.fptrunc.v4f16.v4f32(<4 x float> %1, metadata !"round.upward", metadata !"fpexcept.strict") #20 
# | dag:1072                                                                                                                                                   X~~~~~ error: no match found
# |         575:  ret void 
# | dag:1072     ~~~~~~~~~~
# |         576: } 
# | dag:1072     ~~
# |         577:  
# | dag:1072     ~
# |         578: ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 
# | dag:1072     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |         579: declare float @llvm.fmuladd.f32(float, float, float) #0 
# | dag:1072     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           .
# |           .
# |           .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
...

asb added a commit that referenced this pull request Jul 16, 2024
…ngth no longer needs to be constant (#98281)"

This reverts commit 522fd53 while
unexpected mlir failures are investigated and resolved.
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 16, 2024

LLVM Buildbot has detected a new failure on builder mlir-nvidia running on mlir-nvidia while building llvm at step 6 "test-build-check-mlir-build-only-check-mlir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/138/builds/1314

Here is the relevant piece of the build log for the reference:

Step 6 (test-build-check-mlir-build-only-check-mlir) failure: test (failure)
******************** TEST 'MLIR :: Target/LLVMIR/llvmir-intrinsics.mlir' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/bin/mlir-translate -mlir-to-llvmir /vol/worker/mlir-nvidia/mlir-nvidia/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir | /vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/bin/FileCheck /vol/worker/mlir-nvidia/mlir-nvidia/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# executed command: /vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/bin/mlir-translate -mlir-to-llvmir /vol/worker/mlir-nvidia/mlir-nvidia/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# executed command: /vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/bin/FileCheck /vol/worker/mlir-nvidia/mlir-nvidia/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# .---command stderr------------
# | /vol/worker/mlir-nvidia/mlir-nvidia/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir:1072:15: error: CHECK-DAG: expected string not found in input
# | // CHECK-DAG: declare void @llvm.memcpy.inline.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32 immarg, i1 immarg)
# |               ^
# | <stdin>:574:143: note: scanning from here
# |  %8 = call <4 x half> @llvm.experimental.constrained.fptrunc.v4f16.v4f32(<4 x float> %1, metadata !"round.upward", metadata !"fpexcept.strict") #20
# |                                                                                                                                               ^
# | 
# | Input file: <stdin>
# | Check file: /vol/worker/mlir-nvidia/mlir-nvidia/llvm.src/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |           .
# |           .
# |           .
# |         569:  %3 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.towardzero", metadata !"fpexcept.ignore") #20 
# |         570:  %4 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #20 
# |         571:  %5 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.upward", metadata !"fpexcept.strict") #20 
# |         572:  %6 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.downward", metadata !"fpexcept.ignore") #20 
# |         573:  %7 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.tonearestaway", metadata !"fpexcept.ignore") #20 
# |         574:  %8 = call <4 x half> @llvm.experimental.constrained.fptrunc.v4f16.v4f32(<4 x float> %1, metadata !"round.upward", metadata !"fpexcept.strict") #20 
# | dag:1072                                                                                                                                                   X~~~~~ error: no match found
# |         575:  ret void 
# | dag:1072     ~~~~~~~~~~
# |         576: } 
# | dag:1072     ~~
# |         577:  
# | dag:1072     ~
# |         578: ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 
# | dag:1072     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |         579: declare float @llvm.fmuladd.f32(float, float, float) #0 
# | dag:1072     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           .
# |           .
# |           .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1
...

asb added a commit that referenced this pull request Jul 16, 2024
…ength no longer needs to be constant (#98281)"

This reverts commit ac4b6b6.

A test change was missing for
mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir in the initial commit.
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 16, 2024

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/3111

Here is the relevant piece of the build log for the reference:

Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'MLIR :: Target/LLVMIR/llvmir-intrinsics.mlir' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/build/buildbot/premerge-monolithic-linux/build/bin/mlir-translate -mlir-to-llvmir /build/buildbot/premerge-monolithic-linux/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir | /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck /build/buildbot/premerge-monolithic-linux/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# executed command: /build/buildbot/premerge-monolithic-linux/build/bin/mlir-translate -mlir-to-llvmir /build/buildbot/premerge-monolithic-linux/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# note: command had no output on stdout or stderr
# executed command: /build/buildbot/premerge-monolithic-linux/build/bin/FileCheck /build/buildbot/premerge-monolithic-linux/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# .---command stderr------------
# | /build/buildbot/premerge-monolithic-linux/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir:1072:15: error: CHECK-DAG: expected string not found in input
# | // CHECK-DAG: declare void @llvm.memcpy.inline.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32 immarg, i1 immarg)
# |               ^
# | <stdin>:574:143: note: scanning from here
# |  %8 = call <4 x half> @llvm.experimental.constrained.fptrunc.v4f16.v4f32(<4 x float> %1, metadata !"round.upward", metadata !"fpexcept.strict") #20
# |                                                                                                                                               ^
# | 
# | Input file: <stdin>
# | Check file: /build/buildbot/premerge-monolithic-linux/llvm-project/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |           .
# |           .
# |           .
# |         569:  %3 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.towardzero", metadata !"fpexcept.ignore") #20 
# |         570:  %4 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #20 
# |         571:  %5 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.upward", metadata !"fpexcept.strict") #20 
# |         572:  %6 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.downward", metadata !"fpexcept.ignore") #20 
# |         573:  %7 = call float @llvm.experimental.constrained.fptrunc.f32.f64(double %0, metadata !"round.tonearestaway", metadata !"fpexcept.ignore") #20 
# |         574:  %8 = call <4 x half> @llvm.experimental.constrained.fptrunc.v4f16.v4f32(<4 x float> %1, metadata !"round.upward", metadata !"fpexcept.strict") #20 
# | dag:1072                                                                                                                                                   X~~~~~ error: no match found
# |         575:  ret void 
# | dag:1072     ~~~~~~~~~~
# |         576: } 
# | dag:1072     ~~
# |         577:  
# | dag:1072     ~
# |         578: ; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) 
# | dag:1072     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |         579: declare float @llvm.fmuladd.f32(float, float, float) #0 
# | dag:1072     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           .
# |           .
# |           .
# | >>>>>>
# `-----------------------------
...

sayhaan pushed a commit to sayhaan/llvm-project that referenced this pull request Jul 16, 2024
…longer needs to be constant (llvm#98281)

Summary:
Following on from the discussion in

https://discourse.llvm.org/t/rfc-introducing-an-llvm-memset-pattern-inline-intrinsic/79496
and the equivalent change for llvm.memset.inline (llvm#95397), this removes
the requirement that the length of llvm.memcpy.inline is constant.
PreISelInstrinsicLowering will expand llvm.memcpy.inline with
non-constant lengths, while the codegen path for constant lengths is
left unaltered.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D59822399
sayhaan pushed a commit to sayhaan/llvm-project that referenced this pull request Jul 16, 2024
…ngth no longer needs to be constant (llvm#98281)"

Summary:
This reverts commit 522fd53 while
unexpected mlir failures are investigated and resolved.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D59822387
sayhaan pushed a commit to sayhaan/llvm-project that referenced this pull request Jul 16, 2024
…ength no longer needs to be constant (llvm#98281)"

Summary:
This reverts commit ac4b6b6.

A test change was missing for
mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir in the initial commit.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D59822437
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
…longer needs to be constant (#98281)

Summary:
Following on from the discussion in

https://discourse.llvm.org/t/rfc-introducing-an-llvm-memset-pattern-inline-intrinsic/79496
and the equivalent change for llvm.memset.inline (#95397), this removes
the requirement that the length of llvm.memcpy.inline is constant.
PreISelInstrinsicLowering will expand llvm.memcpy.inline with
non-constant lengths, while the codegen path for constant lengths is
left unaltered.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60251735
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
…ngth no longer needs to be constant (#98281)"

This reverts commit 522fd53 while
unexpected mlir failures are investigated and resolved.
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
…ength no longer needs to be constant (#98281)"

Summary:
This reverts commit ac4b6b6.

A test change was missing for
mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir in the initial commit.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60251743
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants