[all-commits] [llvm/llvm-project] 5d2bbe: [mlir][Func] Extract datalayout string attribute s...

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Mon Sep 4 08:04:48 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5d2bbe9c920275e9b2f6439b8a048bf278224b64
      https://github.com/llvm/llvm-project/commit/5d2bbe9c920275e9b2f6439b8a048bf278224b64
  Author: Nicolas Vasilache <nicolasvasilache at users.noreply.github.com>
  Date:   2023-09-04 (Mon, 04 Sep 2023)

  Changed paths:
    M mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVMPass.h
    M mlir/include/mlir/Conversion/Passes.td
    M mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
    M mlir/test/Conversion/FuncToLLVM/convert-data-layout.mlir

  Log Message:
  -----------
  [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




More information about the All-commits mailing list