Skip to content

JIT: Consider canonicalizing loops whose header is the beginning of a try #96887

@jakobbotsch

Description

@jakobbotsch

If the header is the beginning of a try it leads to some potentially confusing behavior:

  • The preheader ends up in a separate EH region from the header, so clients must take care to handle this appropriately. Also, preheader creation needs special logic to handle this case.
  • It means the header does not necessarily fully dominate all blocks of the loop, if the loop includes blocks from the handler. That means there's a difference between the normal dominance relation (which guarantees that a dominator was fully executed before a dominated block) and the loop dominance relation (which guarantees just that the header was entered before a block)

We should be able to canonicalize these loops by inserting a new header block before the try begin and redirecting all edges to it (both entry and backedges).

I don't know of any issues or severe complications because of this, but if we end up with more places that need to handle the situation specially then we should consider doing this canonicalization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIin-prThere is an active PR which will close this issue when it is merged

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions