>> 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.
_______________________________________________
llvm-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to