FuncToLLVM uses the data layout string attribute in 3 different ways: 1. LowerToLLVMOptions options(&getContext(), getAnalysis<DataLayoutAnalysis>().getAtOrAbove(m)); 2. options.dataLayout = llvm::DataLayout(this->dataLayout); 3. m->setAttr(..., this->dataLayout)); The 3rd way is unrelated to the other 2 and occurs after conversion, making it confusing. This revision separates this post-hoc module annotation functionality into its own pass. The convert-func-to-llvm pass loses its `data-layout` option and instead recovers it from the `llvm.data_layout` attribute attached to the module, when present. In the future, `LowerToLLVMOptions options(&getContext(), getAnalysis<DataLayoutAnalysis>().getAtOrAbove(m))` and `options.dataLayout = llvm::DataLayout(dataLayout);` should be unified. Reviewed By: ftynse, mehdi_amini Differential Revision: https://reviews.llvm.org/D157604
9 lines
387 B
MLIR
9 lines
387 B
MLIR
// RUN: mlir-opt -set-llvm-module-datalayout -convert-func-to-llvm='use-opaque-pointers=1' %s | FileCheck %s
|
|
|
|
// RUN-32: mlir-opt -set-llvm-module-datalayout='data-layout=p:32:32:32' -convert-func-to-llvm='use-opaque-pointers=1' %s \
|
|
// RUN-32: | FileCheck %s
|
|
|
|
// CHECK: module attributes {llvm.data_layout = ""}
|
|
// CHECK-32: module attributes {llvm.data_layout ="p:32:32:32"}
|
|
module {}
|