[llvm-commits] [llvm] r125458 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp test/CodeGen/X86/crash.ll

Duncan Sands baldrick at free.fr
Sun Feb 13 03:28:51 PST 2011


Hi Chris,

> when legalizing extremely wide shifts, make sure that
> the shift amounts are in a suitably wide type so that
> we don't generate out of range constant shift amounts.
...
> --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Sun Feb 13 03:10:56 2011
> @@ -1167,13 +1167,19 @@
>     unsigned NVTBits = NVT.getSizeInBits();
>     EVT ShTy = N->getOperand(1).getValueType();
>
> +  // If this is a large integer being legalized (e.g. an i512) then plop the
> +  // shift amount down as a fixed i32.  The target shift amount may be something
> +  // like i8, but this isn't enough to represent the shift amount.
> +  if (NVTBits>  256)
> +    ShTy = MVT::i32;

I'm confused as to why this helps.  ShTy was defined (see above) to be
N->getOperand(1).getValueType()  How can that ever be too small?

Ciao, Duncan.



More information about the llvm-commits mailing list