[all-commits] [llvm/llvm-project] db884d: [mlir] Explicitly track branch instructions in tra...
ftynse via All-commits
all-commits at lists.llvm.org
Thu Dec 10 02:13:25 PST 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: db884dafb7b5771e6ae01e8252f1520fac3e1c77
https://github.com/llvm/llvm-project/commit/db884dafb7b5771e6ae01e8252f1520fac3e1c77
Author: Alex Zinenko <zinenko at google.com>
Date: 2020-12-10 (Thu, 10 Dec 2020)
Changed paths:
M mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
M mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
Log Message:
-----------
[mlir] Explicitly track branch instructions in translation to LLVM IR
The current implementation of the translation to LLVM IR relies on the
existence of a one-to-one mapping between MLIR blocks and LLVM IR basic blocks
in order to configure PHI nodes with appropriate source blocks. The one-to-one
mapping model is broken in presence of OpenMP operations that use LLVM's
OpenMPIRBuilder, which produces multiple blocks under the hood. This can lead
to invalid LLVM IR being emitted if OpenMPIRBuilder moved the branch operation
into a basic block different from the one it was originally created in;
specifically, a block that is not a direct predecessor could be used in the PHI
node. Instead, keep track of the mapping between MLIR LLVM dialect branch
operations and their LLVM IR counterparts and take the parent basic block of
the LLVM IR instruction at the moment of connecting the PHI nodes to
predecessors.
This behavior cannot be triggered as of now, but will be once we introduce the
conversion of OpenMP workshare loops.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D92845
More information about the All-commits
mailing list