[PATCH] D43752: [RISCV] Preserve stack space for outgoing arguments when the function contain variable size objects

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 06:07:14 PST 2018


asb added a comment.

The extra sp adjustments introduced in calling-conv.ll and vararg.ll seem unnecessary - are they?

I think the test case you add could be simplified substantially, which makes the problem fixed by this patch somewhat more clear:

  declare void @func(i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)       
                                                                                       
  ; Check that outgoing arguments passed on the stack do not corrupt a                 
  ; variable-sized stack object.                                                       
  define void @alloca_callframe(i32 %n) nounwind {                                     
    %1 = alloca i8, i32 %n                                                             
    call void @func(i8* %1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8,           
                    i32 9, i32 10, i32 11, i32 12)                                     
    ret void                                                                           
  } 


Repository:
  rL LLVM

https://reviews.llvm.org/D43752





More information about the llvm-commits mailing list