This is an archive of the discontinued LLVM Phabricator instance.

correcting X86OutgoingValueHandler typo (NFC)
ClosedPublic

Authored by CSears on Dec 3 2020, 9:25 PM.

Details

Summary

The X86OutgoingValueHandler declaration has a typo. It subclasses IncomingValueHandler rather than OutgoingValueHandler. This isn't actually a 'bug' because both IncomingValueHandler and OutgoingValueHandler have the same 'shape'. It's just a typo. This typo is only in the X86 backend.

Diff Detail

Event Timeline

CSears created this revision.Dec 3 2020, 9:25 PM
CSears requested review of this revision.Dec 3 2020, 9:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 3 2020, 9:25 PM
Herald added a subscriber: wdng. · View Herald Transcript

Doesn't the bug cause isIncomingArgumentHandler() to return the wrong value? Does that not create an issue for CallLowering::handleAssignments?

I don't think it does but it could because IncomingValueHandler passes true
to the ValueHandler constructor and OutgoingValueHandler passes false. That
boolean then gets stored in IsIncoming. However, the only code which uses
IsIncoming is AMDGPU.

arsenm added a comment.Dec 4 2020, 9:50 AM

I don't think it does but it could because IncomingValueHandler passes true
to the ValueHandler constructor and OutgoingValueHandler passes false. That
boolean then gets stored in IsIncoming. However, the only code which uses
IsIncoming is AMDGPU.

The generic code also checks it

Yes. CallLowering::handleAssignments() calls the isIncomingArgumentHandler() getter.

Arm and AArch64 subclass from CallLowering::OutgoingValueHandler and CallLowering::IncomingValueHandler. No problem there. X86 has the typo.

PPC and RISCV don't create value handlers. No problem there.
AMDGPU subclasses from its own ValueHandler and sets isComing accordingly. No problem there.

Mips creates its own MipsHandler (which doesn't subclass from ValueHandler) and subclasses from that. It doesn't set isIncoming at all (defaults to false) and doesn't use it. It also doesn't call handleAssignments() and instead has its own handle(). There doesn't seem to be a problem.

arsenm accepted this revision.Dec 4 2020, 11:35 AM
This revision is now accepted and ready to land.Dec 4 2020, 11:35 AM

Yes. CallLowering::handleAssignments() calls the isIncomingArgumentHandler() getter.

Arm and AArch64 subclass from CallLowering::OutgoingValueHandler and CallLowering::IncomingValueHandler. No problem there. X86 has the typo.

PPC and RISCV don't create value handlers. No problem there.
AMDGPU subclasses from its own ValueHandler and sets isComing accordingly. No problem there.

Mips creates its own MipsHandler (which doesn't subclass from ValueHandler) and subclasses from that. It doesn't set isIncoming at all (defaults to false) and doesn't use it. It also doesn't call handleAssignments() and instead has its own handle(). There doesn't seem to be a problem.

X86 has a typo and calls handleAssignments() which uses isIncomingArgumentHandler(). So why is this patch NFC? Is X86 not using a code path in handleAssignments() cares about isIncomingArgumentHandler()?

The NFC was my estimation given that I thought it was a typo. I didn't see that handleAssignments() used the flag. (I searched for the flag rather than for the getter.) Given that handleAssignments() uses it, it isn't an NFC typo. It is a bug.

CSears added a comment.Dec 4 2020, 4:45 PM

Matt, I do not have commit privileges. If you can commit on my behalf (I think that's how it works) I'd appreciate it.

arsenm closed this revision.Dec 12 2020, 5:52 PM