Files
clang-p2996/mlir/lib/Conversion/FuncToLLVM
Nicolas Vasilache 5d2bbe9c92 [mlir][Func] Extract datalayout string attribute setting as a separate module pass
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
2023-09-04 17:03:19 +02:00
..