[PATCH] D12337: [Codegen] Ensure stack is properly aligned for call argument initialization

Jeroen Ketema via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 15 13:35:25 PDT 2015


jketema added inline comments.

================
Comment at: include/llvm/CodeGen/CallingConvLower.h:274-279
@@ -272,4 +273,8 @@
 
-  unsigned getNextStackOffset() const { return StackOffset; }
+  /// getNextStackOffset - Return the stack offset needed to be able to store
+  /// all stack slots according to their alignment requirements.
+  unsigned getNextStackOffset() const {
+    return RoundUpToAlignment(StackOffset, MaxStackArgAlign);
+  }
 
   /// isAllocated - Return true if the specified register (or an alias) is
----------------
rnk wrote:
> Yes, but here's the 32-bit test case I'm imagining:
>   void f(__m128 v, const char *f, ...) {
>     va_list ap;
>     va_start(ap, f);
>     int d = va_arg(ap, int);
>   }
> Do we have padding between 'f' and the variadic int parameter? I think the answer should be know, because if they were not variadic, they would not have padding between them.
> 
> 
Sorry, I missed this before I bumped. Somehow the system didn't sent me a notification email.

I don't see why this is a problem, my patch only changes the alignment of the whole frame, not the padding between the individual members; the computation for that stays unchanged. Hence, there will only be additional padding after the very last of the variadic parameters supplied.


http://reviews.llvm.org/D12337





More information about the llvm-commits mailing list