The executeregionop is used to allow multiple blocks within SCF constructs. If the container allows multiple blocks, inline the region
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
The execution region op can be inlined even if its parent can only hold a single block (like scf.for, scf.if) when the execute_region only contains a single block. I think the rewrite pattern you added can be transparently generalized for that case without really any addition in code?
The more generic single block simplification you're suggesting was added here: https://reviews.llvm.org/D104865 .
mlir/lib/Dialect/SCF/SCF.cpp | ||
---|---|---|
214 | Is there an assumption here that the yield terminator will be the terminator of the last block? Is it possible that there are multiple terminators? I don't see anything in the verifier of the scf.execute_region op that prevents it. |
mlir/lib/Dialect/SCF/SCF.cpp | ||
---|---|---|
214 | scf.execute_region can have multiple blocks terminated with yield - it's no different from a function's region in that respect. |
mlir/include/mlir/Dialect/SCF/SCFOps.td | ||
---|---|---|
112–113 | I'm not sure it's feasible. Folders are not supposed to create new operations, and inlining most likely will (the inlined operations will be "new" in the block). | |
mlir/lib/Dialect/SCF/SCF.cpp | ||
223 | Nit: just use SmallVector<Value> with the default number of stack elements | |
227 | Not: drop trivial braces | |
mlir/test/Dialect/SCF/canonicalize.mlir | ||
973 | Could we relax this test a little? In particular,
On the contrary, we do care about execute-region being removed, so I would add CHECK-NOT: execute_region. | |
990 | Nit: could you change the name of this function to be able to tell the "test cases" apart? |
This revision was not accepted when it landed; it landed in state Needs Review.
Was this committed unintentionally? I don't see an approval from @ftynse post comments nor from anyone else.
I'm not sure it's feasible. Folders are not supposed to create new operations, and inlining most likely will (the inlined operations will be "new" in the block).