Improve Debug instruction support in SIFrameLowering
Summary
This PR improves debug information (DI) handling in SIFrameLowering to ensure proper metadata preservation during register spilling operations.
Changes
- Enhanced debug info tracking for spill operations
- Common code moved from SILowerSGPRSpills.cpp to SISpillUtils.cpp and SISpillUtils.h
- Existing test case improved
PSDB Build Link: http://mlse-bdc-20dd129:8065/#/builders/6/builds/189
@slinder1 @mariusz-sikora-at-amd Could you please review this PR when you have a chance?
PSDB Build Link: http://mlse-bdc-20dd129:8065/#/builders/6/builds/192
PSDB Build Link: http://mlse-bdc-20dd129:8065/#/builders/6/builds/193
PSDB Build Link: http://mlse-bdc-20dd129:8065/#/builders/6/builds/204
PSDB Build Link: http://mlse-bdc-20dd129:8065/#/builders/6/builds/207
Hi @VladimirMedic, thank you for looking into this! I'm sorry, but I actually ended up doing something really similar here: #3423 (I didn't see this PR before now). My version also handles dwarf ops for the vpgr->agpr spill case, so I think it makes more sense to move forward with that one. Maybe you could review it if you have the time?
Hi @VladimirMedic, thank you for looking into this! I'm sorry, but I actually ended up doing something really similar here: #3423 (I didn't see this PR before now). My version also handles dwarf ops for the vpgr->agpr spill case, so I think it makes more sense to move forward with that one. Maybe you could review it if you have the time?
Hi @epilk , My change was basically just moving the code from SILowerSGPRSpills to SISpillUtils, plus one change which fixes assertion when Lane * 8 exceeds int8 value, while your goes further and actually fixes the problems in implementation. So, it does make more sense to continue with your change. I am looking into it and will comment if I find anything during review. Also, I made changes in dead-frame-index-dbg-value.ll as the initial test was actually never hitting the breakpoint in clearDebugInfoForSpillFIs(and updateDbgValueInstsForSpillFIs consequently) and it was introduced as a test case for that implementation in a first place. In my PR it was extended to actually make a spill and enter it. I see that it was also changed in the amd-debug branch, so it may be worth checking if it actually reaches the desired function.
Sorry for the delay in reviewing here, I had intended to compare with Emma's work and give a recommendation on how to merge the two, but didn't get to it in a timely fashion (I'm still trying to get a workflow with GitHub that actually works, I feel like I'm perpetually unorganized since GH doesn't let you control the "viewed" status)
I think I agree that anything covered here which is not in Emma's change should be adapted to work there.
There is nothing that this patch does more in functional sense than Emma's, only the dead-frame-index-dbg-value.ll test might be considered for merging there. Everything else can be stated as a review comment in #3423 since we started from the same code.
There is nothing that this patch does more in functional sense than Emma's, only the dead-frame-index-dbg-value.ll test might be considered for merging there. Everything else can be stated as a review comment in #3423 since we started from the same code.
I think the changes to dead-frame-index-dbg-value.ll should go to llvm-project main, since the test is there too. Agree that it isn't actually testing anything without your updates though.
I think the changes to dead-frame-index-dbg-value.ll should go to llvm-project main, since the test is there too. Agree that >it isn't actually testing anything without your updates though. Not sure it can go there, these changes rely on SIFrameLowering calling updateDbgValueInstsForSpillFIs instead of clearDebugInfoForSpillFIs, so if move test only it would probably fail.
@slinder1 @epilk I would like to close this PR, so would it make sense to merge dead-frame-index-dbg-value.ll in another one? Would be easier than rebasing this.
Closing this PR as the code is committed in https://github.com/ROCm/llvm-project/pull/3423. Still need to decide what happens with test and how will that be merged.