[llvm-commits] [llvm] r151626 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp test/CodeGen/X86/vector-gep.ll

Duncan Sands baldrick at free.fr
Tue Feb 28 05:55:00 PST 2012


Hi Nadav,

> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Feb 28 05:54:05 2012
> @@ -3078,6 +3078,10 @@
>   void SelectionDAGBuilder::visitGetElementPtr(const User&I) {
>     SDValue N = getValue(I.getOperand(0));
>     Type *Ty = I.getOperand(0)->getType();
> +  // If this is a vector of pointers, use the size of the
> +  // vector element and not the size of the pointer.
> +  if (VectorType *VTy = dyn_cast<VectorType>(Ty))
> +    Ty = VTy->getElementType();

why not instead:

   Type *Ty = I.getOperand(0)->getType()->getScalarType();

Ciao, Duncan.



More information about the llvm-commits mailing list