Index: flang/lib/Optimizer/CodeGen/TypeConverter.h =================================================================== --- flang/lib/Optimizer/CodeGen/TypeConverter.h +++ flang/lib/Optimizer/CodeGen/TypeConverter.h @@ -47,7 +47,13 @@ class LLVMTypeConverter : public mlir::LLVMTypeConverter { public: LLVMTypeConverter(mlir::ModuleOp module, bool applyTBAA) - : mlir::LLVMTypeConverter(module.getContext()), + : mlir::LLVMTypeConverter(module.getContext(), + [&] { + mlir::LowerToLLVMOptions options( + module.getContext()); + options.useOpaquePointers = false; + return options; + }()), kindMapping(getKindMapping(module)), specifics(CodeGenSpecifics::get(module.getContext(), getTargetTriple(module), Index: mlir/include/mlir/Conversion/LLVMCommon/LoweringOptions.h =================================================================== --- mlir/include/mlir/Conversion/LLVMCommon/LoweringOptions.h +++ mlir/include/mlir/Conversion/LLVMCommon/LoweringOptions.h @@ -33,7 +33,7 @@ LowerToLLVMOptions(MLIRContext *ctx, const DataLayout &dl); bool useBarePtrCallConv = false; - bool useOpaquePointers = false; + bool useOpaquePointers = true; enum class AllocLowering { /// Use malloc for for heap allocations. Index: mlir/include/mlir/Conversion/Passes.td =================================================================== --- mlir/include/mlir/Conversion/Passes.td +++ mlir/include/mlir/Conversion/Passes.td @@ -158,7 +158,7 @@ ]; let options = [ Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers">, ]; } @@ -251,7 +251,7 @@ /*default=kDeriveIndexBitwidthFromDataLayout*/"0", "Bitwidth of the index type, 0 to use size of machine word">, Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers">, ]; } @@ -314,7 +314,7 @@ "String description (LLVM format) of the data layout that is " "expected on the produced module">, Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers">, ]; } @@ -362,7 +362,7 @@ "Annotation attribute string for GPU binary" >, Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers">, ]; @@ -388,7 +388,7 @@ let options = [ Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers"> ]; @@ -414,7 +414,7 @@ Option<"hasRedux", "has-redux", "bool", /*default=*/"false", "Target gpu supports redux">, Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers">, ]; } @@ -451,7 +451,7 @@ clEnumValN(::mlir::gpu::amd::Runtime::OpenCL, "OpenCL", "OpenCL") )}]>, Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers">, ]; } @@ -507,7 +507,7 @@ let options = [ Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers"> ]; @@ -545,11 +545,10 @@ 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"> + /*default=*/"true", "Generate LLVM IR using opaque pointers " + "instead of typed pointers"> ]; } @@ -657,7 +656,7 @@ "Use generic allocation and deallocation functions instead of the " "classic 'malloc', 'aligned_alloc' and 'free' functions">, Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers"> ]; } @@ -702,7 +701,7 @@ ]; let options = [ Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers"> ]; } @@ -727,7 +726,7 @@ let dependentDialects = ["LLVM::LLVMDialect"]; let options = [ Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers">, ]; } @@ -798,7 +797,7 @@ let options = [ Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers"> ]; @@ -888,7 +887,7 @@ let options = [ Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers"> ]; } @@ -1098,7 +1097,7 @@ "Enables the use of X86Vector dialect while lowering the vector " "dialect.">, Option<"useOpaquePointers", "use-opaque-pointers", "bool", - /*default=*/"false", "Generate LLVM IR using opaque pointers " + /*default=*/"true", "Generate LLVM IR using opaque pointers " "instead of typed pointers"> ]; } Index: mlir/test/mlir-cpu-runner/bare-ptr-call-conv.mlir =================================================================== --- mlir/test/mlir-cpu-runner/bare-ptr-call-conv.mlir +++ mlir/test/mlir-cpu-runner/bare-ptr-call-conv.mlir @@ -26,8 +26,6 @@ } // External declarations. -llvm.func @malloc(i64) -> !llvm.ptr -llvm.func @free(!llvm.ptr) func.func private @printF32(%arg0: f32) func.func private @printComma() func.func private @printNewline()