This is an archive of the discontinued LLVM Phabricator instance.

[Sparc] Account for bias in stack readjustment
ClosedPublic

Authored by jrtc27 on Oct 30 2017, 10:45 AM.

Details

Summary

This was broken long ago in D12208, which failed to account for the fact that 64-bit SPARC uses a stack bias of 2047, and it is the *unbiased* value which should be aligned, not the biased one. This was seen to be an issue with Rust.

Diff Detail

Repository
rL LLVM

Event Timeline

jrtc27 created this revision.Oct 30 2017, 10:45 AM
fhahn added a subscriber: fhahn.Dec 9 2017, 7:08 AM

Can you please add a test for this? There is already a test in stack-align.ll that covers 32bit stack realignment, you can probably modify that testcase to cover 64bit also.

Hopefully someone with more SPARC V9 knowledge can chip in to verify the correctness of the patch.

jrtc27 updated this revision to Diff 126692.Dec 13 2017, 2:13 AM

I've added a 64-bit test to CodeGen/SPARC/stack-align.ll, and fixed the comment in SparcFrameLowering.cpp for the final instruction (%g1 and %o6 were round the wrong way in the comment).

jyknight accepted this revision.Dec 19 2017, 2:45 PM

Looks good.

This revision is now accepted and ready to land.Dec 19 2017, 2:45 PM
This revision was automatically updated to reflect the committed changes.