[DebugInfo][InstrRef] Treat ORRWrr as a copy instr (#123102) #9886
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The insturction selector uses the
MachineFunction::copySalvageSSA
function to insertDBG_PHIs
or identify a defining instruction for a copy-like instruction when finalizing Instruction References.AArch64 has the ORR instruction which is a logical OR with the variants ORRWrr which refers to a register to register variant, and ORRWrs which is a register to a shifted register variant.
An ORRWrs where the shift amount is 0, and the zero register ($wzr) is used is considered a copy, for example:
$w0 = ORRWrs $wzr, killed $w3, 0
However an ORRWrr with a zero register is not considered a copy
$w0 = ORRWrr $wzr, killed $w3
This causes an issue in the livedebugvalues pass because in aarch64-isel the instruction is the ORRWrr variant, but is then changed to the ORRWrs variant before the livedebugvalues pass.
This causes a mismatch between the two passes which leads to a crash in the livedebugvalues pass.
This patch fixes the issue.
(cherry picked from commit ee1c852)