This is an archive of the discontinued LLVM Phabricator instance.

Resolve a FIXME in MachineCopyPropagation by allowig propagation to subregister uses.
ClosedPublic

Authored by resistor on Jan 13 2023, 8:40 PM.

Diff Detail

Event Timeline

resistor created this revision.Jan 13 2023, 8:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 13 2023, 8:40 PM
resistor requested review of this revision.Jan 13 2023, 8:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 13 2023, 8:40 PM
arsenm added a subscriber: arsenm.Jan 14 2023, 4:01 PM
arsenm added inline comments.
llvm/lib/CodeGen/MachineCopyPropagation.cpp
605

This should bail as before rather than assert, the result class might not support the index

resistor added inline comments.Jan 14 2023, 6:21 PM
llvm/lib/CodeGen/MachineCopyPropagation.cpp
605

Can you explain how that scenario could arise? I'm unable to picture it, and I didn't hit any cases of it in the test suite.

barannikov88 added inline comments.
llvm/lib/CodeGen/MachineCopyPropagation.cpp
598–602

What does "subregister of the COPY" mean? Is it subregister of the source or the destination operand?

601

MCP ever works with physical registers.

605

I suppose it could be in the case of cross-class copy:

$a = COPY $b
use $sub_a

Here, $sub_a is a sub-register of $a and its index is sub_a_idx.
$b may not have sub_a_idx subregister index if $a and $b are in different register classes.

639–643

Should be in the else branch of the if below.

arsenm added inline comments.Jan 16 2023, 3:01 PM
llvm/lib/CodeGen/MachineCopyPropagation.cpp
605

I don't know, but the API says it can fail and you can skip it as before.

605

I was also thinking of the cross bank case (but the API says it can fail, so it should be handled, or the unreachable needs to be moved into getSubRegIndex). I'd kind of expect the rest of allocation to try to avoid the cases where this would happen, but I assume a handcrafted MIR test could break this

resistor updated this revision to Diff 489670.Jan 16 2023, 6:58 PM

Update for review feedback.

barannikov88 requested changes to this revision.Jan 25 2023, 9:07 PM
This revision now requires changes to proceed.Jan 25 2023, 9:07 PM
barannikov88 accepted this revision.Jan 25 2023, 9:08 PM

Missclick, LGTM

This revision is now accepted and ready to land.Jan 25 2023, 9:08 PM
This revision was landed with ongoing or failed builds.Jan 25 2023, 9:11 PM
This revision was automatically updated to reflect the committed changes.