This is an archive of the discontinued LLVM Phabricator instance.

[MachineOutliner] Don't outline instructions that modify SP.
ClosedPublic

Authored by efriedma on May 15 2018, 5:22 PM.

Details

Summary

This breaks the code which saves and restores LR, so we can't outline without doing something more complicated for stack adjustment.

Found by inspection; we get lucky in most cases because getMemOpInfo only handles STRWpost, not any other pre/post-increment forms. But it hits a couple of artificial testcases in the tree.

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma created this revision.May 15 2018, 5:22 PM
efriedma edited reviewers, added: paquette; removed: jpaquette.May 15 2018, 5:22 PM
paquette accepted this revision.May 16 2018, 9:11 AM

Thanks for finding this! LGTM.

(Since instructions like add x0, sp, #8 are extremely common it would probably be good to catch them somehow. Could probably be done for MBBs without calls by just checking to see if a scratch register is available for the save/restore.)

This revision is now accepted and ready to land.May 16 2018, 9:11 AM
This revision was automatically updated to reflect the committed changes.