@@ -9767,27 +9767,28 @@ int GlobalRA::coloringRegAlloc()
97679767 }
97689768
97699769
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 ())
97779771 {
9778- if (builder.hasFusedEUWA () && !euWADone)
9772+ G4_BB* entryBB = (*kernel.fg .begin ());
9773+ if (entryBB)
97799774 {
9780- G4_INST* euWAInst = builder.createEUWASpill (false );
9781- G4_BB* entryBB = (*kernel.fg .begin ());
97829775 INST_LIST_ITER inst_it = entryBB->begin ();
9783- while ((*inst_it)->isLabel ())
9776+ while (inst_it != entryBB-> end () && (*inst_it)->isLabel ())
97849777 {
97859778 inst_it++;
97869779 }
9780+ G4_INST* euWAInst = builder.createEUWASpill (false );
97879781 entryBB->insertBefore (inst_it, euWAInst);
9788- euWADone = true ;
97899782 }
9783+ }
97909784
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+ {
97919792 addCallerSavePseudoCode ();
97929793
97939794 // Only GENX sub-graphs require callee-save code.
@@ -10194,19 +10195,6 @@ int GlobalRA::coloringRegAlloc()
1019410195 bool success = spillGRF.insertSpillFillCode (&kernel, pointsToAnalysis);
1019510196 nextSpillOffset = spillGRF.getNextOffset ();
1019610197
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-
1021010198 if (builder.hasScratchSurface () && !hasStackCall &&
1021110199 (nextSpillOffset + globalScratchOffset) > SCRATCH_MSG_LIMIT)
1021210200 {
0 commit comments