[all-commits] [llvm/llvm-project] b6ebec: [mlir][llvm] Fastmath flags import from LLVM IR.

Tobias Gysi via All-commits all-commits at lists.llvm.org
Thu Dec 15 23:28:44 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b6ebeccf00c00484aedf5119bb2fc1a58f58e633
      https://github.com/llvm/llvm-project/commit/b6ebeccf00c00484aedf5119bb2fc1a58f58e633
  Author: Tobias Gysi <tobias.gysi at nextsilicon.com>
  Date:   2022-12-16 (Fri, 16 Dec 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOpBase.td
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
    A mlir/test/Target/LLVMIR/Import/fastmath.ll

  Log Message:
  -----------
  [mlir][llvm] Fastmath flags import from LLVM IR.

This revision adds support to import fastmath flags from LLVMIR. It
implement the import using a listener attached to the builder. The
listener gets notified if an operation is created and then checks if
there are fastmath flags to import from LLVM IR to the MLIR. The
listener based approach allows us to perform the import without changing
the mlirBuilders used to create the imported operations.

An alternative solution, could be to update the builders so that they
return the created operation using FailureOr<Operation*> instead of
LogicalResult. However, this solution implies an LLVM IR instruction
always maps to exatly one MLIR operation. While mostly true, there are
already exceptions to this such as the PHI instruciton. Additionally, an
mlirBuilder based solution also further complicates the builder
implementations, which led to the listener based solution.

Depends on D139405

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D139620




More information about the All-commits mailing list