[llvm-commits] [llvm] r126684 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Duncan Sands baldrick at free.fr
Tue Mar 1 00:59:43 PST 2011


Hi Owen,

> Use the correct shift amount type.

it's only the correct type after type legalization.  The problem is that
getShiftAmountTy can return a small type (eg: i8 on x86) that is not big
enough to hold the shift value.  This matters if the bwap is of i345678
integers or something like that.  Using the pointer type here is a trick
to reduce the amount of work type legalization does (because the pointer
type is always legal).  So please revert this patch.

Thanks, Duncan.

>
> Modified:
>      llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=126684&r1=126683&r2=126684&view=diff
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Mon Feb 28 15:10:10 2011
> @@ -226,7 +226,7 @@
>
>     unsigned DiffBits = NVT.getSizeInBits() - OVT.getSizeInBits();
>     return DAG.getNode(ISD::SRL, dl, NVT, DAG.getNode(ISD::BSWAP, dl, NVT, Op),
> -                     DAG.getConstant(DiffBits, TLI.getPointerTy()));
> +                     DAG.getConstant(DiffBits, TLI.getShiftAmountTy(NVT)));
>   }
>
>   SDValue DAGTypeLegalizer::PromoteIntRes_BUILD_PAIR(SDNode *N) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list