@@ -3114,10 +3114,9 @@ SpillManagerGRF::replaceSpilledRange (
31143114 G4_INST * spilledInst
31153115)
31163116{
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,
31213120 spilledRegion->getHorzStride (), spilledRegion->getType (), spilledRegion->getAccRegSel ());
31223121 spilledInst->setDest (tmpRangeDstRegion);
31233122}
@@ -3385,9 +3384,11 @@ SpillManagerGRF::insertSpillRangeCode(
33853384 // Replace the spilled range with the spill range and insert spill
33863385 // instructions.
33873386
3388- INST_LIST::iterator insertPos = std::next (spilledInstIter);
3387+ INST_LIST::iterator insertPos = spilledInstIter;
3388+ insertPos++;
33893389 replaceSpilledRange (replacementRangeDcl, spilledRegion, *spilledInstIter);
3390- INST_LIST::iterator nextIter = std::next (spilledInstIter);
3390+ INST_LIST::iterator nextIter = spilledInstIter;
3391+ ++nextIter;
33913392
33923393 splice (bb, insertPos, builder_->instList , curInst->getCISAOff ());
33933394
0 commit comments