Skip to content

Commit e3a2097

Browse files
authored
JIT: break loop canonicalization into two stages (#70809)
For a given loop, we need to separate out the true backedge, any non-loop backedges, and any inner loop backedges so that they all target distinct blocks. Otherwise, we may violate assumptions that the loop entry dominates all blocks in the loop and that all backedges that reach top come from within the loop. This seems simplest to do with two rounds of canonicalization, one that moves the non-loop edges, and another that moves the true backedge. Fixes #70802.
1 parent 48adb84 commit e3a2097

File tree

2 files changed

+248
-86
lines changed

2 files changed

+248
-86
lines changed

src/coreclr/jit/compiler.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6335,6 +6335,14 @@ class Compiler
63356335
// unshared with any other loop. Returns "true" iff the flowgraph has been modified
63366336
bool optCanonicalizeLoop(unsigned char loopInd);
63376337

6338+
enum class LoopCanonicalizationOption
6339+
{
6340+
Outer,
6341+
Current
6342+
};
6343+
6344+
bool optCanonicalizeLoopCore(unsigned char loopInd, LoopCanonicalizationOption option);
6345+
63386346
// Requires "l1" to be a valid loop table index, and not "BasicBlock::NOT_IN_LOOP".
63396347
// Requires "l2" to be a valid loop table index, or else "BasicBlock::NOT_IN_LOOP".
63406348
// Returns true iff "l2" is not NOT_IN_LOOP, and "l1" contains "l2".

0 commit comments

Comments
 (0)