[all-commits] [llvm/llvm-project] 00fcf9: [mlir][LLVMIR] Add support for importing struct-ty...

Min-Yih Hsu via All-commits all-commits at lists.llvm.org
Wed Apr 27 09:46:28 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 00fcf9e95a4ab4ee5846b55bd09bb8a4257dfb67
      https://github.com/llvm/llvm-project/commit/00fcf9e95a4ab4ee5846b55bd09bb8a4257dfb67
  Author: Min-Yih Hsu <minyihh at uci.edu>
  Date:   2022-04-27 (Wed, 27 Apr 2022)

  Changed paths:
    M mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
    A mlir/test/Target/LLVMIR/Import/basic.ll
    A mlir/test/Target/LLVMIR/Import/constant-aggregate.ll
    A mlir/test/Target/LLVMIR/Import/data-layout.ll
    A mlir/test/Target/LLVMIR/Import/opaque.ll
    A mlir/test/Target/LLVMIR/Import/zeroinitializer.ll
    R mlir/test/Target/LLVMIR/data-layout.ll
    R mlir/test/Target/LLVMIR/import-opaque.ll
    R mlir/test/Target/LLVMIR/import.ll

  Log Message:
  -----------
  [mlir][LLVMIR] Add support for importing struct-type ConstantAggregate(Zero)

And move importer test files from `test/Target/LLVMIR` into
`test/Target/LLVMIR/Import`.

We simply translate struct-type ConstantAggregate(Zero) into a
serious of `llvm.insertvalue` operations against a `llvm.undef` root.
Note that this doesn't affect the original logics on translating
vector/array-type ConstantAggregate values.

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


  Commit: ea9bcb8b274ae6ef2fd5cbf8c8c9f42a8aa3c096
      https://github.com/llvm/llvm-project/commit/ea9bcb8b274ae6ef2fd5cbf8c8c9f42a8aa3c096
  Author: Min-Yih Hsu <minyihh at uci.edu>
  Date:   2022-04-27 (Wed, 27 Apr 2022)

  Changed paths:
    M mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
    A mlir/test/Target/LLVMIR/Import/incorrect-constexpr-inst-caching.ll

  Log Message:
  -----------
  [mlir][LLVMIR] Do not cache Instruction generated on-the-fly

More specifically, the llvm::Instruction generated by
llvm::ConstantExpr::getAsInstruction. Such Instruction will be deleted
right away, but it's possible that when getAsInstruction is called
again, it will create a new Instruction that has the same address with
the one we just deleted. Thus, we shouldn't keep it in the `instMap` to
avoid a conflicting index that triggers an assertion in
processInstruction.

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


  Commit: a75657d66a1245f78d58c8cb5ded042a13a58299
      https://github.com/llvm/llvm-project/commit/a75657d66a1245f78d58c8cb5ded042a13a58299
  Author: Min-Yih Hsu <minyihh at uci.edu>
  Date:   2022-04-27 (Wed, 27 Apr 2022)

  Changed paths:
    M mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
    A mlir/test/Target/LLVMIR/Import/incorrect-constant-caching.ll

  Log Message:
  -----------
  [mlir][LLVMIR] Do not cache llvm::Constant into instMap

Constants in MLIR are not globally unique, unlike that in LLVM IR.
Therefore, reusing previous-translated constants might cause the user
operations not being dominated by the constant (because the
previous-translated ones can be placed in arbitrary place)

This indeed misses some opportunities where we actually can reuse a
previous-translated constants, but verbosity is not our first priority
here.

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


Compare: https://github.com/llvm/llvm-project/compare/d8b4ea486a5c...a75657d66a12


More information about the All-commits mailing list