Page MenuHomePhabricator

[GlobalISel] Do not crash on widening vector result
ClosedPublic

Authored by sepavloff on Jun 24 2022, 11:44 AM.

Details

Summary

Function buildCopyToRegs did not handle properly the case when it should
make wider vector result. It happened, for example, in a function that
returns value of type <2 x f32>, which should be widen to <4 x f32> to
fit XMM register on X86. The function eventually calls
MachineIRBuilder::buildUnmerge, which does not expect that only one
destination register is specified.

Now this case is treated specifically in buildCopyToRegs.

Diff Detail

Event Timeline

sepavloff created this revision.Jun 24 2022, 11:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 24 2022, 11:44 AM
sepavloff requested review of this revision.Jun 24 2022, 11:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 24 2022, 11:44 AM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm added inline comments.Jun 24 2022, 12:04 PM
llvm/test/CodeGen/X86/GlobalISel/x86_64-irtranslator.ll
368

Can you add a few additional cases with odd elements that also are widened

378

Missing space

Reverse ping

Rebased patch, added new tests

Small formatting fix

arsenm accepted this revision.Sep 29 2022, 10:12 AM

LGTM

This revision is now accepted and ready to land.Sep 29 2022, 10:12 AM
This revision was landed with ongoing or failed builds.Sep 30 2022, 7:32 AM
This revision was automatically updated to reflect the committed changes.