@@ -9765,27 +9765,28 @@ int GlobalRA::coloringRegAlloc()
97659765 }
97669766
97679767
9768- //
9769- // If the graph has stack calls, then add the caller-save/callee-save pseudo
9770- // declares and code. This currently must be done after flag/addr RA due to
9771- // the assumption about the location of the pseudo save/restore instructions
9772- //
9773- bool euWADone = false ;
9774- if (hasStackCall)
9768+ if (builder.hasFusedEUWA ())
97759769 {
9776- if (builder.hasFusedEUWA () && !euWADone)
9770+ G4_BB* entryBB = (*kernel.fg .begin ());
9771+ if (entryBB->getInstList ().size () > 1 )
97779772 {
9778- G4_INST* euWAInst = builder.createEUWASpill (false );
9779- G4_BB* entryBB = (*kernel.fg .begin ());
97809773 INST_LIST_ITER inst_it = entryBB->begin ();
9781- while ((*inst_it)->isLabel ())
9774+ while ((*inst_it)->isLabel () && inst_it != entryBB-> end () )
97829775 {
97839776 inst_it++;
97849777 }
9778+ G4_INST* euWAInst = builder.createEUWASpill (false );
97859779 entryBB->insertBefore (inst_it, euWAInst);
9786- euWADone = true ;
97879780 }
9781+ }
97889782
9783+ //
9784+ // If the graph has stack calls, then add the caller-save/callee-save pseudo
9785+ // declares and code. This currently must be done after flag/addr RA due to
9786+ // the assumption about the location of the pseudo save/restore instructions
9787+ //
9788+ if (hasStackCall)
9789+ {
97899790 addCallerSavePseudoCode ();
97909791
97919792 // Only GENX sub-graphs require callee-save code.
@@ -10192,19 +10193,6 @@ int GlobalRA::coloringRegAlloc()
1019210193 bool success = spillGRF.insertSpillFillCode (&kernel, pointsToAnalysis);
1019310194 nextSpillOffset = spillGRF.getNextOffset ();
1019410195
10195- if (builder.hasFusedEUWA () && !euWADone)
10196- {
10197- G4_INST * euWAInst = builder.createEUWASpill (false );
10198- G4_BB* entryBB = (*kernel.fg .begin ());
10199- INST_LIST_ITER inst_it = entryBB->begin ();
10200- while ((*inst_it)->isLabel ())
10201- {
10202- inst_it++;
10203- }
10204- entryBB->insertBefore (inst_it, euWAInst);
10205- euWADone = true ;
10206- }
10207-
1020810196 if (builder.hasScratchSurface () && !hasStackCall &&
1020910197 (nextSpillOffset + globalScratchOffset) > SCRATCH_MSG_LIMIT)
1021010198 {
0 commit comments