Make VAARG work with x86 long double (which is
10 bytes long, but is passed in 12/16 bytes).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58608 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index e1a8096..8b607b4 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -3438,9 +3438,9 @@
       const Value *V = cast<SrcValueSDNode>(Node->getOperand(2))->getValue();
       SDValue VAList = DAG.getLoad(TLI.getPointerTy(), Tmp1, Tmp2, V, 0);
       // Increment the pointer, VAList, to the next vaarg
-      Tmp3 = DAG.getNode(ISD::ADD, TLI.getPointerTy(), VAList, 
-                         DAG.getConstant(VT.getSizeInBits()/8,
-                                         TLI.getPointerTy()));
+      Tmp3 = DAG.getNode(ISD::ADD, TLI.getPointerTy(), VAList,
+        DAG.getConstant(TLI.getTargetData()->getABITypeSize(VT.getTypeForMVT()),
+                        TLI.getPointerTy()));
       // Store the incremented VAList to the legalized pointer
       Tmp3 = DAG.getStore(VAList.getValue(1), Tmp3, Tmp2, V, 0);
       // Load the actual argument out of the pointer VAList