[X86] When optimizing for minsize, use POP for small post-call stack clean-up
authorMichael Kuperstein <michael.m.kuperstein@intel.com>
Tue, 11 Aug 2015 08:48:48 +0000 (08:48 +0000)
committerMichael Kuperstein <michael.m.kuperstein@intel.com>
Tue, 11 Aug 2015 08:48:48 +0000 (08:48 +0000)
commit18913db07a603b95b1459ec9112db794dad10fb8
treedba12657267f19233a15af9427b7e3da6e687eaa
parentfdc5012e06efa540dabcbaecf448a7baa338271f
[X86] When optimizing for minsize, use POP for small post-call stack clean-up

When optimizing for size, replace "addl $4, %esp" and "addl $8, %esp"
following a call by one or two pops, respectively. We don't try to do it in
general, but only when the stack adjustment immediately follows a call - which
is the most common case.

That allows taking a short-cut when trying to find a free register to pop into,
instead of a full-blown liveness check. If the adjustment immediately follows a
call, then every register the call clobbers but doesn't define should be dead at
that point, and can be used.

Differential Revision: http://reviews.llvm.org/D11749

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244578 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86FrameLowering.cpp
lib/Target/X86/X86FrameLowering.h
test/CodeGen/X86/fold-push.ll
test/CodeGen/X86/pop-stack-cleanup.ll [new file with mode: 0644]