Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DebugInfo][InstrRef] Treat ORRWrr as a copy instr (#123102) #9886

Merged

Conversation

rastogishubham
Copy link

The insturction selector uses the MachineFunction::copySalvageSSA function to insert DBG_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)

The insturction selector uses the `MachineFunction::copySalvageSSA`
function to insert `DBG_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)
@rastogishubham rastogishubham requested a review from a team as a code owner January 25, 2025 00:33
@rastogishubham
Copy link
Author

@swift please test linux

@rastogishubham
Copy link
Author

@swift-ci please test macOS

@rastogishubham
Copy link
Author

@swift-ci please test Linux

@adrian-prantl adrian-prantl merged commit 73b685a into swiftlang:stable/20240723 Jan 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants