Ignore cleared debug instructions#6154
Conversation
Debug instructions can be cleared during debug or non-semantic stripping passes. Check for this before attempting to access their operands.
|
|
|
I've noticed a similar issue has been filed for this bug previously, which I believe should be fixed by this PR: #5912 |
s-perron
left a comment
There was a problem hiding this comment.
How hard would it be to clear the cached value when the instruction was deleted? It seems like this is a special case that could cause problems in other places too.
|
I'm not familiar enough with the code to be able to say how easy that would be. Do you know where the cached value is set/cleared? |
|
For reference, I believe the clearing is done in strip_debug_info_pass.cpp at: // clear OpLine information |
I would expect in a debug build for this check to fail after the pass that removes the instruciton because the feature manager is no longer correct: I would simply call IRContext::ResetFeatureManager() in that pass. This is a guess without looking at any specific examples. |
|
A little more context. After every pass, there is an expectations that all analysies that the context thinks are valid, actually are. This is checked by calling SPIRV-Tools/source/opt/ir_context.cpp Lines 374 to 378 in 0102146 Based on what is happening, I would expect SPIRV-Tools/source/opt/pass.cpp Lines 43 to 45 in 0102146 |
|
Ahh thanks, I was not aware of that. I'll give that a try and add the call to IRContext::ResetFeatureManager() if needed. |
|
Sorry I have not had a chance to come back to this one as we ended up going in a slightly different direction that no longer needed this PR. I'm not sure if I'll have time to finish it. Should I close this so that it doesn't clog up the backlog of open PRs? |
|
Thanks for letting us know. Can you open an issue for this, and then we can close the PR? |
|
FWIW:
That is what I'm attempting here: #6416 |
Debug instructions can be cleared during debug or non-semantic stripping passes. Check for this before attempting to access their operands.