[PATCH] D18627: [X86] Merge adjacent stack adjustments in eliminateCallFramePseudoInstr (PR27140)
Hans Wennborg via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 30 14:58:01 PDT 2016
hans created this revision.
hans added a reviewer: rnk.
hans added a subscriber: llvm-commits.
Herald added subscribers: dsanders, jyknight, dschuff, jfb, jholewinski.
For code such as:
void f(int, int);
void g() {
f(1, 2);
}
compiled for 32-bit X86 Linux at -Os, Clang would previously generate:
subl $12, %esp
subl $8, %esp
pushl $2
pushl $1
calll f
addl $16, %esp
addl $12, %esp
retl
This patch fixes that by merging adjacent stack adjustments in eliminateCallFramePseudoInstr().
Unfortunately, this means that eliminateCallFramePseudoInstr() doesn't just replace a single machine instruction, but potentially erases the previous and/or next instruction as well. To allow the caller of eliminateCallFramePseudoInstr() to continue iterating, this patch makes the function return an iterator to the next instruction. This makes the code in PEI::replaceFrameIndices() much simpler.
Note that previously, replaceFrameIndices() would try to re-visit the instruction created by eliminateCallFramePseudoInstr(). That code was added in r36625, but I can't see any reason for it: the new instructions will obviously not be pseudo instructions, they will not have FrameIndex operands, and we have already accounted for the stack adjustment.
I would probably commit the change to replaceFrameIndices() and return type of eliminateCallFramePseudoInstr() separately.
http://reviews.llvm.org/D18627
Files:
include/llvm/Target/TargetFrameLowering.h
lib/CodeGen/PrologEpilogInserter.cpp
lib/Target/AArch64/AArch64FrameLowering.cpp
lib/Target/AArch64/AArch64FrameLowering.h
lib/Target/ARM/ARMFrameLowering.cpp
lib/Target/ARM/ARMFrameLowering.h
lib/Target/ARM/Thumb1FrameLowering.cpp
lib/Target/ARM/Thumb1FrameLowering.h
lib/Target/BPF/BPFFrameLowering.h
lib/Target/Hexagon/HexagonFrameLowering.cpp
lib/Target/Hexagon/HexagonFrameLowering.h
lib/Target/Lanai/LanaiFrameLowering.cpp
lib/Target/Lanai/LanaiFrameLowering.h
lib/Target/MSP430/MSP430FrameLowering.cpp
lib/Target/MSP430/MSP430FrameLowering.h
lib/Target/Mips/MipsFrameLowering.cpp
lib/Target/Mips/MipsFrameLowering.h
lib/Target/NVPTX/NVPTXFrameLowering.cpp
lib/Target/NVPTX/NVPTXFrameLowering.h
lib/Target/PowerPC/PPCFrameLowering.cpp
lib/Target/PowerPC/PPCFrameLowering.h
lib/Target/Sparc/SparcFrameLowering.cpp
lib/Target/Sparc/SparcFrameLowering.h
lib/Target/SystemZ/SystemZFrameLowering.cpp
lib/Target/SystemZ/SystemZFrameLowering.h
lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp
lib/Target/WebAssembly/WebAssemblyFrameLowering.h
lib/Target/WebAssembly/WebAssemblyPEI.cpp
lib/Target/X86/X86FrameLowering.cpp
lib/Target/X86/X86FrameLowering.h
lib/Target/XCore/XCoreFrameLowering.cpp
lib/Target/XCore/XCoreFrameLowering.h
test/CodeGen/X86/fold-push.ll
test/CodeGen/X86/force-align-stack-alloca.ll
test/CodeGen/X86/movtopush.ll
test/CodeGen/X86/push-cfi-debug.ll
test/CodeGen/X86/push-cfi.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18627.52127.patch
Type: text/x-patch
Size: 31161 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160330/21799027/attachment.bin>
More information about the llvm-commits
mailing list