[Mlir-commits] [mlir] [MLIR][LLVM] Remove disallowlist from LLVM inliner (PR #75303)

Johannes de Fine Licht llvmlistbot at llvm.org
Wed Dec 13 00:53:58 PST 2023


https://github.com/definelicht created https://github.com/llvm/llvm-project/pull/75303

The disallowlist was used as a migration strategy while support was extended to more side effecting operations. We now (to the best of our knowledge) support all side effecting operations, so never fail `isLegalToInline` on any LLVM operation.

There is no test included, because that's exactly the reason for this change: there are no more unsupported operations in inlining; the existing tests for unsupported inlines have already been burninated.

>From fc0c0c3ae3a540636bb3429b5680e36d0b76e952 Mon Sep 17 00:00:00 2001
From: Johannes de Fine Licht <johannes.definelicht at nextsilicon.com>
Date: Wed, 13 Dec 2023 08:47:37 +0000
Subject: [PATCH] [MLIR][LLVM] Remove disallowlist from LLVM inliner.

The disallowlist was used as a migration strategy while support was
extended to more side effecting operations. We now (to the best of our
knowledge) support all side effecting operations, so never fail
`isLegalToInline` on any LLVM operation.

There is no test included, because that's exactly the reason for this
change: there are no more unsupported operations in inlining; the
existing tests for unsupported inlines have already been burninated.
---
 mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp | 37 ++-------------------
 1 file changed, 2 insertions(+), 35 deletions(-)

diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp
index d9f52d7692938f..6e9019f932aa8c 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMInlining.cpp
@@ -632,8 +632,7 @@ struct LLVMInlinerInterface : public DialectInlinerInterface {
                        bool wouldBeCloned) const final {
     if (!wouldBeCloned)
       return false;
-    auto callOp = dyn_cast<LLVM::CallOp>(call);
-    if (!callOp) {
+    if (!isa<LLVM::CallOp>(call)) {
       LLVM_DEBUG(llvm::dbgs()
                  << "Cannot inline: call is not an LLVM::CallOp\n");
       return false;
@@ -684,40 +683,8 @@ struct LLVMInlinerInterface : public DialectInlinerInterface {
     return true;
   }
 
-  /// Conservative allowlist of operations supported so far.
   bool isLegalToInline(Operation *op, Region *, bool, IRMapping &) const final {
-    if (isPure(op))
-      return true;
-    // clang-format off
-    if (isa<LLVM::AllocaOp,
-            LLVM::AssumeOp,
-            LLVM::AtomicRMWOp,
-            LLVM::AtomicCmpXchgOp,
-            LLVM::CallOp,
-            LLVM::CallIntrinsicOp,
-            LLVM::DbgDeclareOp,
-            LLVM::DbgLabelOp,
-            LLVM::DbgValueOp,
-            LLVM::FenceOp,
-            LLVM::InlineAsmOp,
-            LLVM::LifetimeEndOp,
-            LLVM::LifetimeStartOp,
-            LLVM::LoadOp,
-            LLVM::MemcpyOp,
-            LLVM::MemcpyInlineOp,
-            LLVM::MemmoveOp,
-            LLVM::MemsetOp,
-            LLVM::NoAliasScopeDeclOp,
-            LLVM::StackRestoreOp,
-            LLVM::StackSaveOp,
-            LLVM::StoreOp,
-            LLVM::UnreachableOp>(op))
-      return true;
-    // clang-format on
-    LLVM_DEBUG(llvm::dbgs()
-               << "Cannot inline: unhandled side effecting operation \""
-               << op->getName() << "\"\n");
-    return false;
+    return true;
   }
 
   /// Handle the given inlined return by replacing it with a branch. This



More information about the Mlir-commits mailing list