[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
Loading
Please register or sign in to comment