[PATCH] Enable SLP-vectorization of intrinsics.

Nadav Rotem nrotem at apple.com
Fri Jan 10 14:55:02 PST 2014


Hi Raul, 

Thanks for working on this! The code looks okay, but I have a few small comments below.  I was wondering if you ran some performance tests on it.  Does it catch anything in the LLVM test suite?

Thanks,
Nadav


> +
> +        unsigned i,e;
> +        for ( i = 1, e = VL.size(); i != e; ++i) {

I don’t think that it helps to recycle the I and E variables. You can easily place them in the for loop. 

> +          IntrinsicInst *II2 = dyn_cast<IntrinsicInst>(VL[i]);

What does II2 stand for ?  Intrinsic ?

> +          if (!II2 || II2->getIntrinsicID() != ID) {
> +            newTreeEntry(VL, false);
> +            DEBUG(dbgs() << "SLP: mismatched calls:" 
> +                  << *II << "!=" << *VL[i] << "\n");
> +            return;

Extra space below:

> +          for (unsigned j = 0; j < VL.size(); ++j) {
> +            IntrinsicInst *II2 = dyn_cast<IntrinsicInst>(VL[j]);
> +
> +            Operands.push_back(II2->getArgOperand(i));
> +          }

I don’t mind the added scope, but this style is not very common in LLVM. 

> +
> +      int ScalarCallCost, VectorCallCost;
> +      {
> +        // Calculate the cost of the scalar calls.
> +        SmallVector<Type*, 4> Tys;
> +        for (unsigned op = 0, opc = II->getNumArgOperands(); op!= opc; ++op)
> +          Tys.push_back(CI->getArgOperand(op)->getType());
> +        ScalarCallCost = TTI->getIntrinsicInstrCost(ID, ScalarTy, Tys) * 
> +            VecTy->getNumElements();
> +      }
> +
> +      {
> +        // Calculate the cost of the vectorized call.
> +        SmallVector<Type*, 4> Tys;
> +        for (unsigned op = 0, opc = II->getNumArgOperands(); op!= opc; ++op)
> +          Tys.push_back(VectorType::get(CI->getArgOperand(op)->getType(), 
> +                                        VecTy->getNumElements()));
> +        VectorCallCost = TTI->getIntrinsicInstrCost(ID, VecTy, Tys);
> +      }
> +
> 





More information about the llvm-commits mailing list