Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 73f1167

Browse files
Clarify uniqueness vs nesting rules
1 parent a9c20d2 commit 73f1167

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/jit/optimizer.cpp‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,8 +1428,7 @@ namespace
14281428
// We will use the following terminology:
14291429
// HEAD - the basic block that flows into the loop ENTRY block (Currently MUST be lexically before entry).
14301430
// Not part of the looping of the loop.
1431-
// FIRST - the lexically first basic block (in bbNext order) within this loop. (May be part of a nested loop,
1432-
// but not the outer loop. ???)
1431+
// FIRST - the lexically first basic block (in bbNext order) within this loop.
14331432
// TOP - the target of the backward edge from BOTTOM. In most cases FIRST and TOP are the same.
14341433
// BOTTOM - the lexically last block in the loop (i.e. the block from which we jump to the top)
14351434
// EXIT - the predecessor of loop's unique exit edge, if it has a unique exit edge; else nullptr
@@ -1439,12 +1438,16 @@ namespace
14391438
// When the loop is identified, blocks will be moved out to make it a compact contiguous region if possible,
14401439
// and in cases where compaction is not possible, we'll subsequently treat all blocks in the lexical range
14411440
// between TOP and BOTTOM as part of the loop even if they aren't part of the SCC.
1441+
// Regarding nesting: Since a given block can only have one back-edge (we only detect loops with back-edges
1442+
// from BBJ_COND or BBJ_ALWAYS blocks), no two loops will share the same BOTTOM. Two loops may share the
1443+
// same FIRST/TOP/ENTRY as reported by LoopSearch, and optCanonicalizeLoopNest will subsequently re-write
1444+
// the CFG so that no two loops share the same FIRST/TOP/ENTRY anymore.
14421445
//
14431446
// |
14441447
// v
14451448
// head
14461449
// |
1447-
// | top/beg <--+
1450+
// | top/first <--+
14481451
// | | |
14491452
// | ... |
14501453
// | | |

0 commit comments

Comments
 (0)