Better way to check for vararg.
authorEvan Cheng <evan.cheng@apple.com>
Tue, 23 May 2006 21:08:24 +0000 (21:08 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 23 May 2006 21:08:24 +0000 (21:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28440 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index 2d404ab8d293249981cc1cd93a606fbf15f45a5c..2344d011d178ba523d21249b06e7a6e61cbc8339 100644 (file)
@@ -497,7 +497,8 @@ SDOperand X86TargetLowering::LowerCCCArguments(SDOperand Op, SelectionDAG &DAG)
 
   // If the function takes variable number of arguments, make a frame index for
   // the start of the first vararg value... for expansion of llvm.va_start.
-  if (MF.getFunction()->isVarArg())
+  bool isVarArg = cast<ConstantSDNode>(Op.getOperand(2))->getValue() != 0;
+  if (isVarArg)
     VarArgsFrameIndex = MFI->CreateFixedObject(1, ArgOffset);
   ReturnAddrIndex = 0;     // No return address slot generated yet.
   BytesToPopOnReturn = 0;  // Callee pops nothing.