Skip to content

Commit

Permalink
Add LLVMDialect as dependent for "llvm-legalize-for-export" pass
Browse files Browse the repository at this point in the history
Fixes #59462
  • Loading branch information
joker-eph committed Dec 13, 2022
1 parent a6924c6 commit 88c5b96
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion 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 different arguments are deduplicated
// by introducing a new block that forwards its arguments to the original
Expand Down Expand Up @@ -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
}

0 comments on commit 88c5b96

Please sign in to comment.