[Mlir-commits] [mlir] 88c5b96 - Add LLVMDialect as dependent for "llvm-legalize-for-export" pass

Mehdi Amini llvmlistbot at llvm.org
Tue Dec 13 00:49:23 PST 2022


Author: Mehdi Amini
Date: 2022-12-13T08:49:13Z
New Revision: 88c5b9640a0f6cd6f7b84952bf499e5313170727

URL: https://github.com/llvm/llvm-project/commit/88c5b9640a0f6cd6f7b84952bf499e5313170727
DIFF: https://github.com/llvm/llvm-project/commit/88c5b9640a0f6cd6f7b84952bf499e5313170727.diff

LOG: Add LLVMDialect as dependent for "llvm-legalize-for-export" pass

Fixes #59462

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
    mlir/test/Dialect/LLVMIR/legalize-for-export.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
index a22efd392d5e6..604865e59956e 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
@@ -14,6 +14,7 @@ include "mlir/Pass/PassBase.td"
 def LLVMLegalizeForExport : Pass<"llvm-legalize-for-export"> {
   let summary = "Legalize LLVM dialect to be convertible to LLVM IR";
   let constructor = "::mlir::LLVM::createLegalizeForExportPass()";
+  let dependentDialects = ["LLVM::LLVMDialect"];
 }
 
 def LLVMRequestCWrappers

diff  --git a/mlir/test/Dialect/LLVMIR/legalize-for-export.mlir b/mlir/test/Dialect/LLVMIR/legalize-for-export.mlir
index ac8ed6d0441a8..37720e98d92a9 100644
--- a/mlir/test/Dialect/LLVMIR/legalize-for-export.mlir
+++ b/mlir/test/Dialect/LLVMIR/legalize-for-export.mlir
@@ -1,4 +1,4 @@
-// RUN: mlir-opt -llvm-legalize-for-export %s | FileCheck %s
+// RUN: mlir-opt -llvm-legalize-for-export --split-input-file  %s | FileCheck %s
 
 // Verifies that duplicate successor with 
diff erent arguments are deduplicated
 // by introducing a new block that forwards its arguments to the original
@@ -43,3 +43,15 @@ llvm.func @repeated_successor_openmp(%arg0: i64, %arg1: i64, %arg2: i64, %arg3:
   }
   llvm.return
 }
+
+// -----
+
+// This module won't have any LLVM dialect entities as input.
+// Check that we don't crash when building LLVM entities.
+// CHECK-LABEL:func @func1
+func.func @func1(%arg0: i1, %arg1 : i1) {
+// CHECK: llvm.br
+  cf.cond_br %arg0, ^bb40(%arg0 : i1), ^bb40(%arg1 : i1)
+^bb40(%47: i1):
+  return
+}


        


More information about the Mlir-commits mailing list