This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Fix Scavenger assert due to underestimated stack size
ClosedPublic

Authored by weimingz on May 3 2016, 6:23 PM.

Diff Detail

Event Timeline

weimingz updated this revision to Diff 56083.May 3 2016, 6:23 PM
weimingz retitled this revision from to [ARM] Fix Scavenger assert due to underestimated stack size.
weimingz updated this object.
weimingz set the repository for this revision to rL LLVM.
weimingz added a subscriber: llvm-commits.

Hi Weiming,

This looks ok to me, but I have a couple of comments.

Also, the test is a bit brittle. I understand it has to be big, but it could have a comment on it of what's it trying to test, so that if it breaks on an unrelated patch, people can follow up easier.

cheers,
--renato

lib/Target/ARM/ARMFrameLowering.cpp
1637

Why does ArgStackSize depends on hasFP()?

Also, what's the expected value for the stack limit here? I hope 16 is not a big fraction of it, or we'll be pessimising it on some corner cases.

Thanks Renato. I will add comments to the test case. The test case has already been reduced by bugpoint and manual cleanup. It's still large because we need to stress the reg allocation to expose the issue.

lib/Target/ARM/ARMFrameLowering.cpp
1637

estimateRSStackSizeLimit() will return 4096.

When FP(r7) is used, it can use FP as a base reg to address parameters. So accessing parameters should be fine.

weimingz updated this revision to Diff 56177.May 4 2016, 11:09 AM
weimingz added a reviewer: rengolin.
weimingz removed rL LLVM as the repository for this revision.
rengolin accepted this revision.May 4 2016, 11:11 AM
rengolin edited edge metadata.

I guess any kind of CHECK line will be very sensitive to the behaviour of middle and back end, so just passing the test should be ok, with the new comment.

LGTM, thanks!

This revision is now accepted and ready to land.May 4 2016, 11:11 AM
This revision was automatically updated to reflect the committed changes.
weimingz updated this revision to Diff 56458.May 6 2016, 2:03 PM
weimingz edited edge metadata.
weimingz removed rL LLVM as the repository for this revision.

refactor the stack size estimation

rengolin added inline comments.May 6 2016, 2:18 PM
lib/Target/ARM/ARMFrameLowering.cpp
1620

RS is not used here, this assert is not really meaningful and should be moved to where it's actually used.

1629

please add { } around this block, too.

weimingz updated this revision to Diff 56466.May 6 2016, 2:40 PM

LGTM. Thanks!