Skip to content

Commit 3e65c30

Browse files
igcbotbcheng0127
andauthored
Fix bug on linear scan RA for stack call (#4)
Co-authored-by: Buqi Cheng <[email protected]>
1 parent 6834cbe commit 3e65c30

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

visa/LinearScanRA.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ int LinearScanRA::linearScanRA()
962962
PhyRegsLocalRA initPregs = (*pregs);
963963
calculateInputIntervalsGlobal(initPregs, (*regions.begin()).second);
964964
#ifdef DEBUG_VERBOSE_ON
965-
COUT_ERROR << "===== printInputLiveIntervalsGlobal============" << std::endl;
965+
COUT_ERROR << "===== printInputLiveIntervalsGlobal============" << kernel.getName() << std::endl;
966966
printInputLiveIntervalsGlobal();
967967
#endif
968968

@@ -1246,7 +1246,7 @@ void LinearScanRA::setDstReferences(G4_BB* bb, INST_LIST_ITER inst_it, G4_Declar
12461246
}
12471247

12481248
if (lr == nullptr ||
1249-
(dcl->getRegFile() == G4_INPUT && dcl != kernel.fg.builder->getStackCallArg())||
1249+
(dcl->getRegFile() == G4_INPUT && dcl != kernel.fg.builder->getStackCallArg() && dcl != kernel.fg.builder->getStackCallRet())||
12501250
(lr->isGRFRegAssigned() && (!dcl->getRegVar()->isGreg()))) //ARF
12511251
{
12521252
return;
@@ -1337,7 +1337,7 @@ void LinearScanRA::setSrcReferences(G4_BB* bb, INST_LIST_ITER inst_it, int srcId
13371337
}
13381338

13391339
if (lr == nullptr ||
1340-
(dcl->getRegFile() == G4_INPUT && dcl != kernel.fg.builder->getStackCallRet()) ||
1340+
(dcl->getRegFile() == G4_INPUT && dcl != kernel.fg.builder->getStackCallRet() && dcl != kernel.fg.builder->getStackCallArg()) ||
13411341
(lr->isGRFRegAssigned() && (!dcl->getRegVar()->isGreg()))) //ARF
13421342
{
13431343
return;
@@ -1654,9 +1654,8 @@ void LinearScanRA::calculateCurrentBBLiveIntervals(G4_BB* bb, std::vector<LSLive
16541654
if (curInst->isFReturn())
16551655
{
16561656
uint16_t retSize = kernel.fg.builder->getRetVarSize();
1657-
if (retSize)
1657+
if (retSize && stackCallRetLR)
16581658
{
1659-
assert(stackCallRetLR);
16601659
stackCallRetLR->setLastRef(curInst, curInst->getLexicalId() * 2);
16611660
stackCallRetLR = nullptr;
16621661
}

0 commit comments

Comments
 (0)