Skip to content

Commit 7d0082d

Browse files
pratikasharigcbot
authored andcommitted
Don't extend RET__loc to loop header in augmentation
Loop BBs may contain a subroutine call. But loop BB list doesn't include callee BBs. When extending live-interval to loop header, in augmentation to handle divergent CF we find loop exit BB by checking if each successor of current loop BB is still part of loop. Any successor BB not part of loop BB list is considered as loop exit. But this should treat INIT BB of callee as an exception because call BB's successor is not a loop exit at all. This change prevents unnecessary extension of live-ranges live-in to INIT BB.
1 parent adfd46c commit 7d0082d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

visa/GraphColor.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3833,7 +3833,15 @@ void Augmentation::buildLiveIntervals() {
38333833
for (auto block : loopBody) {
38343834
// FIXME: this may process a BB multiple times
38353835
for (auto succBB : block->Succs) {
3836-
if (loopBody.find(succBB) == loopBody.end()) {
3836+
// A subroutine call BB's successor is callee's INIT BB.
3837+
// Loop data structure doesn't include callee BB. So
3838+
// succBB not part of loop may still be INIT BB of callee.
3839+
// Such an INIT BB shouldn't be treated as a loop exit
3840+
// for live-range extension. If we don't check for INIT BB
3841+
// we end up extending RET__loc range to loop header
3842+
// which isn't correct.
3843+
if (loopBody.find(succBB) == loopBody.end() &&
3844+
(succBB->getBBType() & G4_BB_INIT_TYPE) == 0) {
38373845
G4_BB *exitBB = succBB;
38383846

38393847
unsigned latchBBId = (backEdge.first)->getId();

0 commit comments

Comments
 (0)