MLIR supports terminators that have the same successor block with different
block operands, which cannot be expressed in the LLVM's phi-notation as the
block identifier is used to tell apart the predecessors. This limitation can be
worked around by branching to a new block instead, with this new block
unconditionally branching to the original successor and forwarding the
argument. Until now, this transformation was performed during the conversion
from the Standard to the LLVM dialect. This does not scale well to multiple
dialects targeting the LLVM dialect as all of them would have to be aware of
this limitation and perform the preparatory transformation. Instead, do it as a
separate pass and run it immediately before the translation.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/include/mlir/Dialect/LLVMIR/Transforms/Legalize.h | ||
---|---|---|
29 | Can we give this a better name? Legalize seems general, and doesn't really hint that this is just for exporting to LLVMIR. LegalizeForExport seems slightly better, but I'm sure there is a better suggestion. |
Can we give this a better name? Legalize seems general, and doesn't really hint that this is just for exporting to LLVMIR. LegalizeForExport seems slightly better, but I'm sure there is a better suggestion.