This is an archive of the discontinued LLVM Phabricator instance.

Add UnitTest to test-suite to check correct handling of large stack alignments
ClosedPublic

Authored by kristof.beyls on Jan 5 2015, 8:40 AM.

Details

Reviewers
rengolin
Summary

As part of creating a fix for PR13007, "ARM CodeGen fails with
large stack alignment", I created a test-suite UnitTest to check
correct execution of functions with various stack alignment
constraints. I think it could be worthwhile to add it to the
test-suite, although it may be a bit too specific a test case
to add as a UnitTest?
Overall, I think it's worthwhile to add it, but I'm interested
in finding out what others think.

Thanks,

Kristof

PS. The review for the partial fix I've got for PR13007 is at
http://reviews.llvm.org/D6844.

Diff Detail

Event Timeline

kristof.beyls retitled this revision from to Add UnitTest to test-suite to check correct handling of large stack alignments.
kristof.beyls updated this object.
kristof.beyls edited the test plan for this revision. (Show Details)
kristof.beyls added a subscriber: Unknown Object (MLST).

Hi Kristof,

Is this test supposed to pass or fail on ARM? If pass, how can it test the big-stack issue?

I think that having an extra unit test is never a bad idea, if it tests something as serious as that, but we need to be careful to test platform-specific things right.

If the ranges and sizes vary with the architecture, the test should account for that. If the test is irrelevant in other architectures, it should be disabled on them.

cheers,
--renato

SingleSource/UnitTests/Makefile
141

TAB issue. TABs in Makefiles are magic, make sure not to insert spaces instead.

Thanks for noticing the tab vs spaces issue - I don't think it affected correctness in this case, it should be a tab just for consistency. Now corrected in updated patch.

The test is indeed failing on ARM targets, because of http://llvm.org/bugs/show_bug.cgi?id=13007.
http://reviews.llvm.org/D6844 is the review for a patch fixing 13007 (and making the test in this patch pass) for ARM and Thumb2 targets.

I didn't tune the sizes and alignments being tested for ARM specifically; the only function I added for ARM specifically is copy_and_check_aligned_stack_copy_scalar_spill, because ARMFrameLowering has a different code path emitting stack-aligning
instructions when floating point registers need to be spilled on a target with Neon instructions. I could eliminate that function if
it that seems to be too much "white box" instead of "black box" testing.

I don't know of LLVM having bugs for stack alignments for other architectures - but the test is valid for all architectures,
so if added, should be enabled for all architectures.

Thanks,

Kristof

rengolin accepted this revision.Jan 6 2015, 2:57 PM
rengolin added a reviewer: rengolin.

I see. Assuming you tested on at least x86_64 in addition to ARM and AArch64, LGTM, after the proper fix is in.

This revision is now accepted and ready to land.Jan 6 2015, 2:57 PM

Any progress in this? If not, can we close this review?

rengolin closed this revision.Mar 13 2015, 3:14 AM

Testing this on AArch64 showed that dynamic stack re-alignment hasn't been implemented in the AArch64 backend - i.e. this test fails on AArch64.
I'm implementing support for that in the AArch64 backend - I hope to have a patch up for review soon, after which this test can be committed without breaking the AArch64 bots.

I thought I saw some patches going in to fix the alignment... We should then wait until the fix has gone through. Thanks!