This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Fix ADJCALLSTACKDOWN/UP use/defs
ClosedPublic

Authored by dschuff on Dec 11 2015, 10:57 AM.

Details

Summary

ADJCALLSTACK{DOWN,UP} (aka CALLSEQ_{START,END}) MIs are supposed to use
and def the stack pointer. Since they do not, all the nodes are being
eliminated by DeadMachineInstructionElim, so they aren't in the IR when
PrologEpilogInserter/eliminateCallFramePseudo needs them.

This change fixes that, but since RegStackify will not stackify across
them (and it runs early, before PEI), change LowerCall to only emit them
when the call frame size is > 0. That makes the current code work the
same way and makes code handled by D15344 also work the same way. We can
expand the condition beyond NumBytes > 0 in the future if needed.

Diff Detail

Repository
rL LLVM

Event Timeline

dschuff updated this revision to Diff 42545.Dec 11 2015, 10:57 AM
dschuff retitled this revision from to [WebAssembly] Fix ADJCALLSTACKDOWN/UP use/defs.
dschuff updated this object.
dschuff added reviewers: sunfish, jfb.
dschuff added a subscriber: llvm-commits.

Going to go ahead and land this since @sunfish and I discussed the idea on IRC. We can make changes as needed.

This revision was automatically updated to reflect the committed changes.