[all-commits] [llvm/llvm-project] cafaa3: [mlir] Make it possible to directly supply constan...

ftynse via All-commits all-commits at lists.llvm.org
Fri Jan 7 00:56:19 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cafaa3503643c047b670dcc387e22096930d2d6c
      https://github.com/llvm/llvm-project/commit/cafaa3503643c047b670dcc387e22096930d2d6c
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2022-01-07 (Fri, 07 Jan 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
    M mlir/lib/Conversion/LLVMCommon/Pattern.cpp
    M mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
    M mlir/test/Dialect/LLVMIR/roundtrip.mlir
    M mlir/test/Target/LLVMIR/llvmir.mlir

  Log Message:
  -----------
  [mlir] Make it possible to directly supply constant values to LLVM GEPOp

In LLVM IR, the GEP indices that correspond to structures are required to be
i32 constants. MLIR models constants as just values defined by special
operations, and there is no verification that it is the case for structure
indices in GEP. Furthermore, some common transformations such as control flow
simplification may lead to the operands becoming non-constant. Make it possible
to directly supply constant values to LLVM GEPOp to guarantee they remain
constant until the translation to LLVM IR. This is not yet a requirement and
the verifier is not modified, this will be introduced separately.

Reviewed By: wsmoses

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


  Commit: 43ff4a6d5562099d9a34ef6bb567912ef5ce923e
      https://github.com/llvm/llvm-project/commit/43ff4a6d5562099d9a34ef6bb567912ef5ce923e
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2022-01-07 (Fri, 07 Jan 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/test/Dialect/LLVMIR/canonicalize.mlir

  Log Message:
  -----------
  [mlir] Add ConstantLike trait to LLVM::ConstantOp

This make LLVM dialect constants to work with `m_constant` matches. Implement
the folding hook for this operation as required by the trait. This in turn
allows LLVM::ConstantOp to properly participate in constant-folding.

Depends On D116757

Reviewed By: wsmoses

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


  Commit: f50cfc44d60bb6b12a2ee801a69b35fe7d6dbcf3
      https://github.com/llvm/llvm-project/commit/f50cfc44d60bb6b12a2ee801a69b35fe7d6dbcf3
  Author: Alex Zinenko <zinenko at google.com>
  Date:   2022-01-07 (Fri, 07 Jan 2022)

  Changed paths:
    M mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
    M mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
    M mlir/test/Conversion/MemRefToLLVM/convert-dynamic-memref-ops.mlir
    M mlir/test/Conversion/MemRefToLLVM/memref-to-llvm.mlir
    M mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir
    M mlir/test/Dialect/LLVMIR/invalid.mlir
    M mlir/test/Target/LLVMIR/llvmir.mlir

  Log Message:
  -----------
  [mlir] Require struct indices in LLVM::GEPOp to be constant

Recent commits added a possibility for indices in LLVM dialect GEP operations
to be supplied directly as constant attributes to ensure they remain such until
translation to LLVM IR happens. Make this required for indexing into LLVM
struct types to match LLVM IR requirements, otherwise the translation would
assert on constructing such IR.

For better compatibility with MLIR-style operation construction interface,
allow GEP operations to be constructed programmatically using Values pointing
to known constant operations as struct indices.

Depends On D116758

Reviewed By: wsmoses

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


Compare: https://github.com/llvm/llvm-project/compare/348bc76e3548...f50cfc44d60b


More information about the All-commits mailing list