[llvm-commits] [llvm] r39967 - in /llvm/trunk: lib/Target/X86/X86MachineFunctionInfo.h lib/Target/X86/X86RegisterInfo.cpp lib/Target/X86/X86RegisterInfo.h test/CodeGen/X86/2006-05-02-InstrSched2.ll test/CodeGen/X86/2006-05-11-InstrSched.ll test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll test/CodeGen/X86/2007-05-07-InvokeSRet.ll

Dan Gohman djg at cray.com
Wed Jul 18 06:42:14 PDT 2007


>> It looks like this doesn't reset ESP/RSP in the case where a  
>> function calls
>> alloca but has no static-sized allocation, i.e. when NumBytes is zero
>> and MFI->hasVarSizedObjects() is true.
> 
> Right. Fixed. Somehow it didn't break anything on x86 / Mac OS X. Do  
> you have a failure case? If so, please reduce it and send it  to me  
> if possible?

This test case shows it:

declare void @bar(<2 x i64>* %n)

define void @foo(i64 %h) {
  %k = trunc i64 %h to i32
  %p = alloca <2 x i64>, i32 %k
  call void @bar(<2 x i64>* %p)
  ret void
}


It looks like your fix works. One nit though, using LEA instead of MOV
to do the restore is a little unusual. At a quick glance, it looks like
moving the MFI->hasVarSizedObjects() logic above the
"Skip the callee-saved pop instructions" logic would allow it to use MOV
instead of LEA.

That would also make it easier to make the code be able to use the LEAVE
instruction :).

Dan

-- 
Dan Gohman, Cray Inc.



More information about the llvm-commits mailing list