[PATCH] [X86] Use single add/sub for large stack offsets
anton at korobeynikov.info
Wed Jan 28 09:57:52 PST 2015
Comment at: lib/Target/X86/X86FrameLowering.cpp:202
@@ +201,3 @@
+ unsigned Reg = isSub
+ ? (unsigned)(Is64BitTarget ? X86::RAX : X86::EAX)
+ : findDeadCallerSavedReg(MBB, MBBI, TRI, Is64BitTarget);
> asl wrote:
> > This clobbers rax/eax w/o checking whether it's a livein or not. This may be a problem for functions with inreg attributes. I believe the code should always use findDeadCallerSavedReg().
> I copied that from the code that generates a push/pop (lines 223-225), so the existing code always uses rax/eax in the prologue for a push. If this is a problem for inreg attributes, this code will also need to be fixed.
It's not a problem for push below, because we just need to put something on stack (we can use any register for this). For pop'ing stuff we need to find free register, since we're going to clobber it.
Situation here is completely different, because the code in the patch materializes a constant in the register thus clobbering it always.
More information about the llvm-commits