This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel][IRTranslator] Fix <1 x Ty> handling in ConstantExprs
ClosedPublic

Authored by foad on Apr 17 2020, 8:52 AM.

Details

Summary

ConstantExprs involving operations on <1 x Ty> could translate into MIR
that failed to verify with:

  • Bad machine code: Reading virtual register without a def ***

The problem was that translate(const Constant &C, Register Reg) had
recursive calls that passed the same Reg in for the translation of a
subexpression, but without updating VMap for the subexpression first as
translate(const Constant &C, Register Reg) expects.

Fix this by using the same translateCopy helper function that we use for
translating Instructions. In some cases this causes extra G_COPY
MIR instructions to be generated.

Fixes https://bugs.llvm.org/show_bug.cgi?id=45576

Diff Detail

Event Timeline

foad created this revision.Apr 17 2020, 8:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2020, 8:52 AM
arsenm accepted this revision.May 12 2020, 8:21 AM

LGTM

This revision is now accepted and ready to land.May 12 2020, 8:21 AM
This revision was automatically updated to reflect the committed changes.