[llvm-commits] [llvm] r106952 - in /llvm/trunk: include/llvm/CodeGen/ISDOpcodes.h include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp test/CodeGen/ARM/va_arg.ll

Duncan Sands baldrick at free.fr
Sun Jun 27 05:58:14 PDT 2010


Hi Rafael,

>   void DAGTypeLegalizer::ExpandRes_VAARG(SDNode *N, SDValue&Lo, SDValue&Hi) {
> -  EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
> +  EVT OVT = N->getValueType(0);
> +  EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), OVT);
>     SDValue Chain = N->getOperand(0);
>     SDValue Ptr = N->getOperand(1);
>     DebugLoc dl = N->getDebugLoc();
> +  const unsigned OldAlign = N->getConstantOperandVal(3);
> +  const Type *Type = OVT.getTypeForEVT(*DAG.getContext());
> +  const unsigned TypeAlign = TLI.getTargetData()->getABITypeAlignment(Type);
> +  const unsigned Align = std::max(OldAlign, TypeAlign);

I don't see the point of taking the maximum here: the alignment of the memory
address did not change...

> -  Lo = DAG.getVAArg(NVT, dl, Chain, Ptr, N->getOperand(2));
> +  Lo = DAG.getVAArg(NVT, dl, Chain, Ptr, N->getOperand(2), Align);
>     Hi = DAG.getVAArg(NVT, dl, Lo.getValue(1), Ptr, N->getOperand(2));

Shouldn't you also set the alignment of the Hi part?  For this you can take
use MinAlign(Align, amount offset).  It is true that in general to know how
much it was offset you need to know details of how VAArg works on the target,
which I guess you don't really know here.

Ciao,

Duncan.



More information about the llvm-commits mailing list