llvm / clangir

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

[CIR][CodeGen] Flattening for ScopeOp and LoopOpInterface #546

Closed gitoleg closed 4 months ago

gitoleg commented 4 months ago

This PR is the next step towards goto support and adds flattening for ScopeOp and LoopOpInterface.

Looks like I can't separate this operations and create two PRs, since some errors occur if I do so, e.g. reference to block defined in another region. Seems we need to flatten both operations in the same time. Given it's a copy-pasta, I think there is no need to try to make several PRs.

I added several tests - just copied them from the lowering part just to demonstrate how it looks like.

Note, that changes in dot.cir caused by BrCondOp updates in the previous PR, when we removed the following casts:

    %20 = llvm.zext %19 : i1 to i8
    %21 = llvm.trunc %20 : i8 to i1
    llvm.cond_br %21 ...
gitoleg commented 4 months ago

@bcardosolopes rebased!