@@ -9765,27 +9765,28 @@ int GlobalRA::coloringRegAlloc()
9765
9765
}
9766
9766
9767
9767
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())
9775
9769
{
9776
- if (builder.hasFusedEUWA() && !euWADone)
9770
+ G4_BB* entryBB = (*kernel.fg.begin());
9771
+ if (entryBB->getInstList().size() > 1)
9777
9772
{
9778
- G4_INST* euWAInst = builder.createEUWASpill(false);
9779
- G4_BB* entryBB = (*kernel.fg.begin());
9780
9773
INST_LIST_ITER inst_it = entryBB->begin();
9781
- while ((*inst_it)->isLabel())
9774
+ while ((*inst_it)->isLabel() && inst_it != entryBB->end() )
9782
9775
{
9783
9776
inst_it++;
9784
9777
}
9778
+ G4_INST* euWAInst = builder.createEUWASpill(false);
9785
9779
entryBB->insertBefore(inst_it, euWAInst);
9786
- euWADone = true;
9787
9780
}
9781
+ }
9788
9782
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
+ {
9789
9790
addCallerSavePseudoCode();
9790
9791
9791
9792
// Only GENX sub-graphs require callee-save code.
@@ -10192,19 +10193,6 @@ int GlobalRA::coloringRegAlloc()
10192
10193
bool success = spillGRF.insertSpillFillCode(&kernel, pointsToAnalysis);
10193
10194
nextSpillOffset = spillGRF.getNextOffset();
10194
10195
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
-
10208
10196
if (builder.hasScratchSurface() && !hasStackCall &&
10209
10197
(nextSpillOffset + globalScratchOffset) > SCRATCH_MSG_LIMIT)
10210
10198
{
0 commit comments