-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[GlobalISel][AArch64] Combine unmerge(G_EXT v, undef) to unmerge(v). #65263
Conversation
2fe29e8
to
8e44ad1
Compare
Should be a generic combine. Can you generalize to N unused defs? |
G_EXT is an opcode for AArch64's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs some MIR tests.
if (!DstTy.isVector()) | ||
return false; | ||
|
||
MachineInstr *Ext = getDefIgnoringCopies( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getOpcodeDef() with the GUnmerge source reg helper here?
if (!LowestVal || LowestVal->Value.getZExtValue() != DstTy.getSizeInBytes()) | ||
return false; | ||
|
||
MachineInstr *Undef = getDefIgnoringCopies(ExtSrc2, MRI); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getOpcodeDef()
G_EXT should be G_AARCH64_EXT then. I assumed this was shorthand for all 3 extends |
8e44ad1
to
b8e671f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with minor changes. We can actually rename the G_EXT and friends to specify AArch64 as well in another change.
return false; | ||
if (!MRI.use_nodbg_empty(MI.getOperand(1).getReg())) | ||
if (!MRI.use_nodbg_empty(Unmerge.getOperand(1).getReg())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GenericMachineInstr
also gives you getReg(N)
@@ -1071,18 +1071,18 @@ void applyVectorSextInReg(MachineInstr &MI, MachineRegisterInfo &MRI, | |||
bool matchUnmergeExtToUnmerge(MachineInstr &MI, MachineRegisterInfo &MRI, | |||
Register &MatchInfo) { | |||
assert(MI.getOpcode() == TargetOpcode::G_UNMERGE_VALUES); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assert becomes unnecessary once you have the cast<GUnmerge>
below.
When having <N x t> d1, unused = unmerge(G_EXT <2*N x t> v1, undef, N), it is possible to express it just as unused, d1 = unmerge v1. It is useful for tackling regressions in arm64-vcvt_f.ll, introduced in https://reviews.llvm.org/D144670.
a3cd7f7
to
bb1a03d
Compare
When having
<N x t> d1, unused = unmerge(G_EXT <2*N x t> v1, undef, N)
, it is possible to express it just asunused, d1 = unmerge v1
.It is useful for tackling regressions in arm64-vcvt_f.ll, introduced in https://reviews.llvm.org/D144670.