-
Notifications
You must be signed in to change notification settings - Fork 160
Open
Labels
IR designConsiderations around the design of ClangIRConsiderations around the design of ClangIRenhancementNew feature or requestNew feature or request
Description
Today, all control-flow operations are pretty lean - they would contain several regions with clear semantics on the "flow" between these regions.
Something that is missing in all loop-like operations is the ability to add initial-value region arguments. Adding support for that would allow multiple things:
- Generating CIR loops from non-control-flow is easier and does not require allocating temp variables (for example - generating the zero-initializer loop for arrays).
- Opening up the opportunity for mem2reg and other memory optimizations to be written on top of CIR. This is not possible otherwise as CIR currently relies on all loop-carried variables to be carried through the stack.
- Possibly lowering from AST / lifting in CIR some information to re-construct higher-level semantics the user intended (e.g. translating simple for loops into construct similar to
scf.for
:... = scf.for %iv = %lb to %ub step %step {...
). Without first having the loop-carried information described as region arguments it would be pretty difficult to reconstruct these constructs.
I would be happy to see this support come to life!
bcardosolopes
Metadata
Metadata
Assignees
Labels
IR designConsiderations around the design of ClangIRConsiderations around the design of ClangIRenhancementNew feature or requestNew feature or request