@@ -3114,10 +3114,9 @@ SpillManagerGRF::replaceSpilledRange (
3114
3114
G4_INST * spilledInst
3115
3115
)
3116
3116
{
3117
- // the spilled dst's reg offset is already adjusted by the spill intrinsic so it's always 0
3118
- // we have to keep the dst's subreg offset, however, as our spill intrinsic uses GRF-aligned offset
3119
- auto tmpRangeDstRegion = builder_->createDst (
3120
- spillRangeDcl->getRegVar (), 0 , spilledRegion->getSubRegOff (),
3117
+ // we need to preserve accRegSel if it's set
3118
+ G4_DstRegRegion * tmpRangeDstRegion = builder_->createDst (
3119
+ spillRangeDcl->getRegVar (), REG_ORIGIN, SUBREG_ORIGIN,
3121
3120
spilledRegion->getHorzStride (), spilledRegion->getType (), spilledRegion->getAccRegSel ());
3122
3121
spilledInst->setDest (tmpRangeDstRegion);
3123
3122
}
@@ -3385,9 +3384,11 @@ SpillManagerGRF::insertSpillRangeCode(
3385
3384
// Replace the spilled range with the spill range and insert spill
3386
3385
// instructions.
3387
3386
3388
- INST_LIST::iterator insertPos = std::next (spilledInstIter);
3387
+ INST_LIST::iterator insertPos = spilledInstIter;
3388
+ insertPos++;
3389
3389
replaceSpilledRange (replacementRangeDcl, spilledRegion, *spilledInstIter);
3390
- INST_LIST::iterator nextIter = std::next (spilledInstIter);
3390
+ INST_LIST::iterator nextIter = spilledInstIter;
3391
+ ++nextIter;
3391
3392
3392
3393
splice (bb, insertPos, builder_->instList , curInst->getCISAOff ());
3393
3394
0 commit comments