Skip to content

Commit 88c5b96

Browse files
committed
Add LLVMDialect as dependent for "llvm-legalize-for-export" pass
Fixes llvm#59462
1 parent a6924c6 commit 88c5b96

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

mlir/include/mlir/Dialect/LLVMIR/Transforms/Passes.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ include "mlir/Pass/PassBase.td"
1414
def LLVMLegalizeForExport : Pass<"llvm-legalize-for-export"> {
1515
let summary = "Legalize LLVM dialect to be convertible to LLVM IR";
1616
let constructor = "::mlir::LLVM::createLegalizeForExportPass()";
17+
let dependentDialects = ["LLVM::LLVMDialect"];
1718
}
1819

1920
def LLVMRequestCWrappers

mlir/test/Dialect/LLVMIR/legalize-for-export.mlir

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: mlir-opt -llvm-legalize-for-export %s | FileCheck %s
1+
// RUN: mlir-opt -llvm-legalize-for-export --split-input-file %s | FileCheck %s
22

33
// Verifies that duplicate successor with different arguments are deduplicated
44
// 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:
4343
}
4444
llvm.return
4545
}
46+
47+
// -----
48+
49+
// This module won't have any LLVM dialect entities as input.
50+
// Check that we don't crash when building LLVM entities.
51+
// CHECK-LABEL:func @func1
52+
func.func @func1(%arg0: i1, %arg1 : i1) {
53+
// CHECK: llvm.br
54+
cf.cond_br %arg0, ^bb40(%arg0 : i1), ^bb40(%arg1 : i1)
55+
^bb40(%47: i1):
56+
return
57+
}

0 commit comments

Comments
 (0)