[PATCH] D74794: [X86][ISelLowering] refactor Varargs handling in X86ISelLowering.cpp

Alexey Lapshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 11 10:45:33 PDT 2020


avl marked an inline comment as done.
avl added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:3523-3524
+                                                   unsigned StackSize) {
+  FuncInfo->setVarArgsFrameIndex(0xAAAAAAA);
+  FuncInfo->setRegSaveFrameIndex(0xAAAAAAA);
+
----------------
aeubanks wrote:
> This isn't the exact same logic as before, is that intended?
Yes. I moved it intentionally. 
To make it clear if *FrameIndex is not set. 
i.e., previously it was set in the very end under some conditions:


```
if (!Is64Bit) {
  // RegSaveFrameIndex is X86-64 only.
  FuncInfo->setRegSaveFrameIndex(0xAAAAAAA);
  if (CallConv == CallingConv::X86_FastCall ||
      CallConv == CallingConv::X86_ThisCall)
  // fastcc functions can't have varargs.
  FuncInfo->setVarArgsFrameIndex(0xAAAAAAA);
}
```

Instead, I always set FrameIndex to an invalid value in the start.
And update it if it really should be set.

Thus if we forget to set that value, we will immediately see 0xAAAAAAA index.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74794/new/

https://reviews.llvm.org/D74794





More information about the llvm-commits mailing list