Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion mlir/lib/Conversion/ConvertToLLVM/ConvertToLLVMPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ struct DynamicConvertToLLVM : public ConvertToLLVMPassInterface {
target.addLegalDialect<LLVM::LLVMDialect>();
// Get the data layout analysis.
const auto &dlAnalysis = manager.getAnalysis<DataLayoutAnalysis>();
LLVMTypeConverter typeConverter(context, &dlAnalysis);
const DataLayout &dl = dlAnalysis.getAtOrAbove(op);
LowerToLLVMOptions options(context, dl);
LLVMTypeConverter typeConverter(context, options, &dlAnalysis);

// Configure the conversion with dialect level interfaces.
for (ConvertToLLVMPatternInterface *iface : *interfaces)
Expand Down
39 changes: 39 additions & 0 deletions mlir/test/Conversion/FuncToLLVM/func-to-llvm-datalayout.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// RUN: mlir-opt --convert-to-llvm="filter-dialects=func dynamic=true" --split-input-file %s


// CHECK-LABEL: llvm.func @test_default_index
// CHECK-SAME: (%{{.*}}: i64) -> i64
func.func private @test_default_index(%arg0: index) -> index

// -----

// CHECK-LABEL: module attributes {dlti.dl_spec = #dlti.dl_spec<
// CHECK-SAME: #dlti.dl_entry<index, 32>
// CHECK-SAME: >}
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<index, 32>>} {
// CHECK-LABEL: llvm.func @test_32bit_index
// CHECK-SAME: (%{{.*}}: i32) -> i32
func.func private @test_32bit_index(%arg0: index) -> index
}

// -----

// CHECK-LABEL: module attributes {dlti.dl_spec = #dlti.dl_spec<
// CHECK-SAME: #dlti.dl_entry<index, 64>
// CHECK-SAME: >}
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<index, 64>>} {
// CHECK-LABEL: llvm.func @test_64bit_index
// CHECK-SAME: (%{{.*}}: i64) -> i64
func.func private @test_64bit_index(%arg0: index) -> index
}

// -----

// CHECK-LABEL: module attributes {dlti.dl_spec = #dlti.dl_spec<
// CHECK-SAME: #dlti.dl_entry<index, 16>
// CHECK-SAME: >}
module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<index, 16>>} {
// CHECK-LABEL: llvm.func @test_16bit_index
// CHECK-SAME: (%{{.*}}: i16) -> i16
func.func private @test_16bit_index(%arg0: index) -> index
}
Loading