[PATCH] D38948: [LV] Support efficient vectorization of an induction with redundant casts

Dorit Nuzman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 01:29:04 PST 2017


dorit marked 12 inline comments as done.
dorit added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:6999
+        continue;
+
       VectorizationCostTy C = getInstructionCost(&I, VF);
----------------
Ayal wrote:
> VecValuesToIgnore holds Instructions whose cost should be ignored only if widened, and for VF's where they are actually widened, IIUC their use in calculateRegisterUsage(). Should the redundant IV casts be added to ValuesToIgnore instead, being redundant in either scalar and vector types?
> 
> In any case, having expectedCost() neglect the cost of VecValuesToIgnore may affect cases unrelated to this patch's casted Inductions (related to Reductions), so probably better done in a separate patch.
> VecValuesToIgnore holds Instructions whose cost should be ignored only if widened, and for VF's where they are actually widened, IIUC their use in calculateRegisterUsage(). Should the redundant IV casts be added to ValuesToIgnore instead, being redundant in either scalar and vector types?

No, because then we would also ignore the cost of the casts when we calculate the baseline cost (of the scalar loop), and we don't want to do that (that loop will not be guarded by the predicate, and the casts will remain there).

> In any case, having expectedCost() neglect the cost of VecValuesToIgnore may affect cases unrelated to this patch's casted Inductions (related to Reductions), so probably better done in a separate patch.

Yes. I thought it's a small enough fix to be included in this patch. I can submit a separate patch for this. 



https://reviews.llvm.org/D38948





More information about the llvm-commits mailing list