[Mlir-commits] [mlir] [mlir][emitc] Add a structured for operation (PR #68206)
Gil Rapaport
llvmlistbot at llvm.org
Wed Oct 4 17:58:27 PDT 2023
aniragil wrote:
> While this enables for a rather direct mapping from SCF for to EmitC variant, I wonder if it isn't too exact.
So I was a bit concerned with overshooting by supporting a full-blown C for-loop at this stage (since AFAIK the only demand for for-loops in EmitC comes from SCF), thus potentially leaving verification/translation code not actually being used outside our tests. For example, if we model a proper initialization clause we'll need to be careful not to emit:
`for (int *m = a + 3, short k = 3; m != 0; ++m, ++k) { ... }`
for a loop that defines variables of different types, either by catching that at the verifier or emitting the variable declarations outside of the loop. So I thought we'd start from mapping the scf::for to emitc and then evolve emitc::for as needed. Does that make sense?
[Another way to go incrementally might be to indeed model an initialization, condition and iteration clauses at this stage (e.g. as basic blocks as suggested) but limit them by verification to SCF's needs]
https://github.com/llvm/llvm-project/pull/68206
More information about the Mlir-commits
mailing list