This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add support for call returns to RISCVSExtWRemoval.
ClosedPublic

Authored by craig.topper on Dec 11 2022, 10:12 PM.

Details

Summary

The implementation is inspired by code from PPCInstrInfo.

We look for a copy from X10(A0) preceded by an ADJCALLSTACKUP and
a PseudoCall. We use the PseudoCall to look up the IR function being
called to find it's return attributes.

Diff Detail

Event Timeline

craig.topper created this revision.Dec 11 2022, 10:12 PM
craig.topper requested review of this revision.Dec 11 2022, 10:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 11 2022, 10:12 PM
asb added a comment.Dec 12 2022, 1:45 AM

Left a few comments based on an initial shallow review.

Is it possible to test the zext case, or is it too fiddly to construct a reasonable test case?

llvm/lib/Target/RISCV/RISCVSExtWRemoval.cpp
370

I think the note in your commit message "We use the PseudoCall to look up the IR function being called to find it's return attributes." is helpful to comprehension.

How about "For a method return value, we check the ZExt/SExt attributes, using the PseudoCALL instruction to retrieve the IR function."?

376

auto?

388

Maybe auto? We're not overly consistent on this in LLVM and it's short anyway. But it would match the use of auto a few lines down.

Address review comments. Add zext test.

asb accepted this revision.Dec 13 2022, 7:01 AM

LGTM.

This revision is now accepted and ready to land.Dec 13 2022, 7:01 AM
This revision was landed with ongoing or failed builds.Dec 13 2022, 9:09 AM
This revision was automatically updated to reflect the committed changes.