This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Don't try to create "push {r12, lr}" in Thumb1 at -Oz.
ClosedPublic

Authored by efriedma on Mar 14 2019, 1:15 PM.

Details

Summary

It's a little tricky to make this issue show up because prologue/epilogue emission normally likes to push at least two registers... but it doesn't when lr is force-spilled due to function length. Not sure if that really makes sense, but I decided not to touch it for now.

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma created this revision.Mar 14 2019, 1:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 14 2019, 1:15 PM

I don't pretend to know a huge amount about the frame lowering code, but this looks fine to me.

When I tried your example it was pushing r7 and popping r3. I presume this is OK, providing r7 isn't modified?

There are now machine verifier checks for these illegal push/pops, right? Please add -verify-machineinstrs to the tests.

When I tried your example it was pushing r7 and popping r3. I presume this is OK, providing r7 isn't modified?

Yes; the entire point of tryFoldSPUpdateIntoPushPop is to fold a stack adjustment into a preceding push, possibly using the "wrong" register, to save an instruction.

I'll post a new version with the test fixed.

efriedma updated this revision to Diff 192719.Mar 28 2019, 2:46 PM

Update test to use -verify-machineinstrs, and to use CHECK-LABEL in a way that's less likely to cause confusion.

dmgreen accepted this revision.Mar 28 2019, 3:06 PM

LGTM

This revision is now accepted and ready to land.Mar 28 2019, 3:06 PM
This revision was automatically updated to reflect the committed changes.