[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

Rafael Espindola espindola at google.com
Sun Jun 27 08:25:13 PDT 2010


On 27 June 2010 08:58, Duncan Sands <baldrick at free.fr> wrote:
> 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...

This is an issue that Dan noticed: What happens for example with a
i128, we would split the va_arg twice and lose the alignment
information of the original one.

>> -  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.

This works on the assumption that what we are splitting is contiguous
in memory, so the alignment will be equal to the ABI alignment of that
type, no?

> Ciao,
>
> Duncan.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>


Cheers,
-- 
Rafael Ávila de Espíndola




More information about the llvm-commits mailing list