Page MenuHomePhabricator

[RISCV] Fix ILP32D lowering for double+double/double+int return types
ClosedPublic

Authored by jrtc27 on Oct 29 2019, 3:36 PM.

Details

Summary

Previously, since these aggregates are > 2*XLen, Clang would think they
were being returned indirectly and thus would decrease the number of
available GPRs available by 1. For long argument lists this could lead
to a struct argument incorrectly being passed indirectly.

Diff Detail

Event Timeline

jrtc27 created this revision.Oct 29 2019, 3:36 PM
asb added a comment.Oct 31 2019, 6:55 AM

Thanks James - won't this still leave problems for structs that need flattening?

lenary added a comment.Nov 7 2019, 9:19 AM
In D69590#1728628, @asb wrote:

Thanks James - won't this still leave problems for structs that need flattening?

The tests in clang/test/CodeGen/riscv32-ilp32d-abi.c already include lots of cases that include flattening.

I suppose the one place they lack tests is probably a complex type passed within a struct, which would be good to add @jrtc27. Though, we should probably greatly expand the testing of _Complex within ABIs.

asb accepted this revision.Jan 13 2020, 5:38 AM

This looks good to me, thanks James. I had a closer step through of the logic here to convince myself.

This revision is now accepted and ready to land.Jan 13 2020, 5:38 AM
lenary accepted this revision.Jan 13 2020, 6:00 AM

@jrtc27 It would be good to get this in for LLVM 10.0.

Having gone through the logic with @asb, we are both confident this is the right fix, and this patch does not require any additions at the moment.

This revision was automatically updated to reflect the committed changes.