[all-commits] [llvm/llvm-project] be717f: [mlir][llvm] Handle invoke op branching to block w...

vic via All-commits all-commits at lists.llvm.org
Tue Apr 18 02:54:25 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: be717f0a49d9591fec6574cb9b186be904a2d604
      https://github.com/llvm/llvm-project/commit/be717f0a49d9591fec6574cb9b186be904a2d604
  Author: Victor Perez <victor.perez at codeplay.com>
  Date:   2023-04-18 (Tue, 18 Apr 2023)

  Changed paths:
    M mlir/lib/Target/LLVMIR/ModuleImport.cpp
    M mlir/test/Target/LLVMIR/Import/basic.ll

  Log Message:
  -----------
  [mlir][llvm] Handle invoke op branching to block with its result as an argument

In LLVM, having an invoke instruction branching to a block with a phi
node receiving the invoke instruction result as an argument is
perfectly legal. However, the translation of this construct to MLIR
would result in an invoke with its result being used as a block
argument to a successor, i.e., the operation result would be used in
its definition.

In order to fix this issue due to different IR structures (phi nodes
vs block arguments), this construct is interpreted with an llvm.invoke
operation branching to a dummy block having a single llvm.br operation
passing the required block arguments (including the result of the
llvm.invoke operation) to the actual successor block.

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




More information about the All-commits mailing list