This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Add a test case to show the bug in RISCVFrameLowering.
ClosedPublic

Authored by HsiangKai on Nov 19 2021, 7:15 AM.

Details

Summary

If the number of arguments is too large to use register passing, it
needs to occupy stack space to pass the arguments to the callee. There
are two scenarios. One is to reserve the space in prologue and the other
is to reserve the space before the function calls. When we need to
reserve the stack space before function calls, the stack pointer is
adjusted. Under the scenario, we should not use stack pointer to access
the stack objects. It looks like,

callseq_start -> sp = sp - reserved_space

We should not use SP to access stack objects in this area.
//
call @foo
callseq_end -> sp = sp + reserved_space

Diff Detail

Event Timeline

HsiangKai created this revision.Nov 19 2021, 7:15 AM
HsiangKai requested review of this revision.Nov 19 2021, 7:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 19 2021, 7:15 AM
frasercrmck accepted this revision.Nov 29 2021, 2:27 AM

LGTM. Craig's comment in D114246 has helped pinpoint the problem for me. I dunno if it's worth commenting that in the test file or not.

This revision is now accepted and ready to land.Nov 29 2021, 2:27 AM
HsiangKai updated this revision to Diff 390524.Nov 29 2021, 4:57 PM

Add comments.

Don't put comments in the middle of generated CHECK lines, they will be moved on the next regenerate. Though I guess if this is going to be immediately fixed in a subsequent commit maybe it's about the only time it's ok...

Don't put comments in the middle of generated CHECK lines, they will be moved on the next regenerate. Though I guess if this is going to be immediately fixed in a subsequent commit maybe it's about the only time it's ok...

Thanks.
I will commit this one and D114246 together. In D114246, the comments will be removed.