Index: mlir/include/mlir/Conversion/Passes.td =================================================================== --- mlir/include/mlir/Conversion/Passes.td +++ mlir/include/mlir/Conversion/Passes.td @@ -540,6 +540,12 @@ let summary = "Convert the operations from the linalg dialect into the LLVM " "dialect"; let dependentDialects = ["scf::SCFDialect", "LLVM::LLVMDialect"]; + + let options = [ + Option<"useOpaquePointers", "use-opaque-pointers", "bool", + /*default=*/"false", "Generate LLVM IR using opaque pointers " + "instead of typed pointers"> + ]; } //===----------------------------------------------------------------------===// Index: mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp =================================================================== --- mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp +++ mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp @@ -79,6 +79,9 @@ namespace { struct ConvertLinalgToLLVMPass : public impl::ConvertLinalgToLLVMPassBase { + + using Base::Base; + void runOnOperation() override; }; } // namespace @@ -88,7 +91,9 @@ // Convert to the LLVM IR dialect using the converter defined above. RewritePatternSet patterns(&getContext()); - LLVMTypeConverter converter(&getContext()); + LowerToLLVMOptions options(&getContext()); + options.useOpaquePointers = useOpaquePointers; + LLVMTypeConverter converter(&getContext(), options); populateLinalgToLLVMConversionPatterns(converter, patterns); populateFinalizeMemRefToLLVMConversionPatterns(converter, patterns); Index: mlir/test/Dialect/Linalg/affine.mlir =================================================================== --- mlir/test/Dialect/Linalg/affine.mlir +++ mlir/test/Dialect/Linalg/affine.mlir @@ -1,7 +1,7 @@ // RUN: mlir-opt %s -convert-linalg-to-affine-loops | FileCheck %s // Test that we can lower all the way to LLVM without crashing, don't check results here. -// RUN: mlir-opt %s -convert-linalg-to-affine-loops -convert-linalg-to-llvm -o=/dev/null 2>&1 +// RUN: mlir-opt %s -convert-linalg-to-affine-loops -convert-linalg-to-llvm='use-opaque-pointers=1' -o=/dev/null 2>&1 func.func @matmul(%arg0: memref, %M: index, %N: index, %K: index) { %c0 = arith.constant 0 : index Index: mlir/test/Dialect/Linalg/loops.mlir =================================================================== --- mlir/test/Dialect/Linalg/loops.mlir +++ mlir/test/Dialect/Linalg/loops.mlir @@ -2,7 +2,7 @@ // RUN: mlir-opt %s -convert-linalg-to-parallel-loops | FileCheck --check-prefix=CHECKPARALLEL %s // Test that we can lower all the way to LLVM without crashing, don't check results here. -// RUN: mlir-opt %s -convert-linalg-to-loops -convert-linalg-to-llvm -o=/dev/null 2>&1 +// RUN: mlir-opt %s -convert-linalg-to-loops -convert-linalg-to-llvm='use-opaque-pointers=1' -o=/dev/null 2>&1 // CHECK: #[[$stride1Dilation1:.*]] = affine_map<(d0, d1) -> (d0 + d1)> Index: mlir/test/Dialect/Linalg/roundtrip.mlir =================================================================== --- mlir/test/Dialect/Linalg/roundtrip.mlir +++ mlir/test/Dialect/Linalg/roundtrip.mlir @@ -4,7 +4,7 @@ // TODO: Re-enable LLVM lowering test. // // Test that we can lower all the way to LLVM without crashing, don't check results here. -// DISABLED: mlir-opt %s --convert-linalg-to-llvm -o=/dev/null 2>&1 +// DISABLED: mlir-opt %s --convert-linalg-to-llvm='use-opaque-pointers=1' -o=/dev/null 2>&1 func.func @views(%arg0: index) { %c0 = arith.constant 0 : index