llvm / clangir

A new (MLIR based) high-level IR for clang.
https://clangir.org
Other
327 stars 86 forks source link

Mark more operations as side-effectful to enable canonicalizer pass in CIR #542

Open gitoleg opened 4 months ago

gitoleg commented 4 months ago

The idea to use the canonicalizer pass that seems too aggressively removes unused instructions, but in general any DCE like pass may eliminate side-effect free instructions once they are not used.

Another problem with the canonicalizer pass that it extensively use such MLIR feature as basic blocks with arguments, which is awesome! But at the same time it leads to errors like branch has 0 operands for successor #0 but target block has 1. I believe the bug is on the llvm dialect / MLIR side, so one need to check CIR with some large code base before adding this pass into pipeline.