@@ -9767,27 +9767,28 @@ int GlobalRA::coloringRegAlloc()
9767
9767
}
9768
9768
9769
9769
9770
- //
9771
- // If the graph has stack calls, then add the caller-save/callee-save pseudo
9772
- // declares and code. This currently must be done after flag/addr RA due to
9773
- // the assumption about the location of the pseudo save/restore instructions
9774
- //
9775
- bool euWADone = false ;
9776
- if (hasStackCall)
9770
+ if (builder.hasFusedEUWA () && !builder.getIsPayload ())
9777
9771
{
9778
- if (builder.hasFusedEUWA () && !euWADone)
9772
+ G4_BB* entryBB = (*kernel.fg .begin ());
9773
+ if (entryBB)
9779
9774
{
9780
- G4_INST* euWAInst = builder.createEUWASpill (false );
9781
- G4_BB* entryBB = (*kernel.fg .begin ());
9782
9775
INST_LIST_ITER inst_it = entryBB->begin ();
9783
- while ((*inst_it)->isLabel ())
9776
+ while (inst_it != entryBB-> end () && (*inst_it)->isLabel ())
9784
9777
{
9785
9778
inst_it++;
9786
9779
}
9780
+ G4_INST* euWAInst = builder.createEUWASpill (false );
9787
9781
entryBB->insertBefore (inst_it, euWAInst);
9788
- euWADone = true ;
9789
9782
}
9783
+ }
9790
9784
9785
+ //
9786
+ // If the graph has stack calls, then add the caller-save/callee-save pseudo
9787
+ // declares and code. This currently must be done after flag/addr RA due to
9788
+ // the assumption about the location of the pseudo save/restore instructions
9789
+ //
9790
+ if (hasStackCall)
9791
+ {
9791
9792
addCallerSavePseudoCode ();
9792
9793
9793
9794
// Only GENX sub-graphs require callee-save code.
@@ -10194,19 +10195,6 @@ int GlobalRA::coloringRegAlloc()
10194
10195
bool success = spillGRF.insertSpillFillCode (&kernel, pointsToAnalysis);
10195
10196
nextSpillOffset = spillGRF.getNextOffset ();
10196
10197
10197
- if (builder.hasFusedEUWA () && !euWADone)
10198
- {
10199
- G4_INST * euWAInst = builder.createEUWASpill (false );
10200
- G4_BB* entryBB = (*kernel.fg .begin ());
10201
- INST_LIST_ITER inst_it = entryBB->begin ();
10202
- while ((*inst_it)->isLabel ())
10203
- {
10204
- inst_it++;
10205
- }
10206
- entryBB->insertBefore (inst_it, euWAInst);
10207
- euWADone = true ;
10208
- }
10209
-
10210
10198
if (builder.hasScratchSurface () && !hasStackCall &&
10211
10199
(nextSpillOffset + globalScratchOffset) > SCRATCH_MSG_LIMIT)
10212
10200
{
0 commit comments