diff --git a/visa/DebugInfo.cpp b/visa/DebugInfo.cpp index f5728abeff24..959b7e7a3d33 100644 --- a/visa/DebugInfo.cpp +++ b/visa/DebugInfo.cpp @@ -1926,7 +1926,7 @@ void KernelDebugInfo::updateCallStackLiveIntervals() { } void KernelDebugInfo::updateExpandedIntrinsic(G4_InstIntrinsic *spillOrFill, - G4_INST *inst) { + INST_LIST &insts) { // This function looks up all caller/callee save code added. // Once it finds "spillOrFill", it adds inst to it. This is // because VISA now uses spill/fill intrinsics to model @@ -1936,14 +1936,14 @@ void KernelDebugInfo::updateExpandedIntrinsic(G4_InstIntrinsic *spillOrFill, for (auto &k : callerSaveRestore) { for (auto it = k.second.first.begin(); it != k.second.first.end(); ++it) { if ((*it) == spillOrFill) { - k.second.first.insert(it, inst); + k.second.first.insert(it, insts.begin(), insts.end()); return; } } for (auto it = k.second.second.begin(); it != k.second.second.end(); ++it) { if ((*it) == spillOrFill) { - k.second.second.insert(it, inst); + k.second.second.insert(it, insts.begin(), insts.end()); return; } } @@ -1952,7 +1952,7 @@ void KernelDebugInfo::updateExpandedIntrinsic(G4_InstIntrinsic *spillOrFill, for (auto it = calleeSaveRestore.first.begin(); it != calleeSaveRestore.first.end(); ++it) { if ((*it) == spillOrFill) { - calleeSaveRestore.first.insert(it, inst); + calleeSaveRestore.first.insert(it, insts.begin(), insts.end()); return; } } @@ -1960,7 +1960,7 @@ void KernelDebugInfo::updateExpandedIntrinsic(G4_InstIntrinsic *spillOrFill, for (auto it = calleeSaveRestore.second.begin(); it != calleeSaveRestore.second.end(); ++it) { if ((*it) == spillOrFill) { - calleeSaveRestore.second.insert(it, inst); + calleeSaveRestore.second.insert(it, insts.begin(), insts.end()); return; } } @@ -1969,20 +1969,23 @@ void KernelDebugInfo::updateExpandedIntrinsic(G4_InstIntrinsic *spillOrFill, // caller be fp restore is a fill intrinsic that reads from FDE. it is // expanded to a regular fill instruction. so update the pointer to new // instruction. - setCallerBEFPRestoreInst(inst); + setCallerBEFPRestoreInst(insts.back()); } if (spillOrFill == getCallerSPRestoreInst()) { - setCallerSPRestoreInst(inst); + setCallerSPRestoreInst(insts.back()); } if (spillOrFill == getCallerBEFPSaveInst()) { - setCallerBEFPSaveInst(inst); + setCallerBEFPSaveInst(insts.back()); } - if (spillOrFill == getCESaveInst() && - inst->isSend()) { - setSaveCEInst(inst); + if (spillOrFill == getCESaveInst()) { + for (auto *inst: insts) { + if (inst->isSend()){ + setSaveCEInst(inst); + } + } } } diff --git a/visa/DebugInfo.h b/visa/DebugInfo.h index 37a68643f413..2f41fe3587f5 100644 --- a/visa/DebugInfo.h +++ b/visa/DebugInfo.h @@ -314,7 +314,7 @@ class KernelDebugInfo { void setCESaveOffset(uint16_t Off) { CEStoreOffset = Off; } uint16_t getCESaveOffset() const { return CEStoreOffset; } - void updateExpandedIntrinsic(G4_InstIntrinsic *spillOrFill, G4_INST *inst); + void updateExpandedIntrinsic(G4_InstIntrinsic *spillOrFill, INST_LIST &insts); void addCallerSaveInst(G4_BB *fcallBB, G4_INST *inst); void addCallerRestoreInst(G4_BB *fcallBB, G4_INST *inst); void addCalleeSaveInst(G4_INST *inst); diff --git a/visa/SpillManagerGMRF.cpp b/visa/SpillManagerGMRF.cpp index a5db7793b19a..d8a693ad5b35 100644 --- a/visa/SpillManagerGMRF.cpp +++ b/visa/SpillManagerGMRF.cpp @@ -4840,10 +4840,8 @@ void GlobalRA::expandSpillLSC(G4_BB *bb, INST_LIST_ITER &instIt) { } if (inst->getFP() && kernel.getOption(vISA_GenerateDebugInfo)) { - for (auto newInst : builder->instList) { - kernel.getKernelDebugInfo()->updateExpandedIntrinsic( - inst->asSpillIntrinsic(), newInst); - } + kernel.getKernelDebugInfo()->updateExpandedIntrinsic( + inst->asSpillIntrinsic(), builder->instList); } // Call WA and NoMask WA are mutual exclusive. @@ -4950,10 +4948,8 @@ void GlobalRA::expandScatterSpillLSC(G4_BB *bb, INST_LIST_ITER &instIt) { payload->getTopDcl()->getName(), builder->getGRFSize())); if (inst->getFP() && kernel.getOption(vISA_GenerateDebugInfo)) { - for (auto newInst : builder->instList) { - kernel.getKernelDebugInfo()->updateExpandedIntrinsic( - inst->asSpillIntrinsic(), newInst); - } + kernel.getKernelDebugInfo()->updateExpandedIntrinsic( + inst->asSpillIntrinsic(), builder->instList); } splice(bb, instIt, builder->instList, inst->getVISAId()); @@ -5046,10 +5042,8 @@ void GlobalRA::expandFillLSC(G4_BB *bb, INST_LIST_ITER &instIt) { } if (inst->getFP() && kernel.getOption(vISA_GenerateDebugInfo)) { - for (auto newInst : builder->instList) { - kernel.getKernelDebugInfo()->updateExpandedIntrinsic( - inst->asFillIntrinsic(), newInst); - } + kernel.getKernelDebugInfo()->updateExpandedIntrinsic( + inst->asFillIntrinsic(), builder->instList); } // Call WA and NoMask WA are mutual exclusive. @@ -5323,10 +5317,9 @@ void GlobalRA::expandSpillStackcall(uint32_t numRows, uint32_t offset, } if (kernel.getOption(vISA_GenerateDebugInfo)) { + INST_LIST expandedInsts = {hdrSetInst, spillSends}; kernel.getKernelDebugInfo()->updateExpandedIntrinsic( - inst->asSpillIntrinsic(), hdrSetInst); - kernel.getKernelDebugInfo()->updateExpandedIntrinsic( - inst->asSpillIntrinsic(), spillSends); + inst->asSpillIntrinsic(), expandedInsts); } numRowsOword -= payloadSizeInOwords; @@ -5583,10 +5576,9 @@ void GlobalRA::expandFillStackcall(uint32_t numRows, uint32_t offset, bb->insertBefore(fillIt, fillSends); if (kernel.getOption(vISA_GenerateDebugInfo)) { + INST_LIST expandedInsts = {hdrSetInst, fillSends}; kernel.getKernelDebugInfo()->updateExpandedIntrinsic( - inst->asFillIntrinsic(), hdrSetInst); - kernel.getKernelDebugInfo()->updateExpandedIntrinsic( - inst->asFillIntrinsic(), fillSends); + inst->asFillIntrinsic(), expandedInsts); } numRowsOword -= respSizeInOwords;