[PATCH] D40883: [LV] Ignore the cost of values that will not appear in the vectorized loop

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 9 13:57:58 PST 2017


Ayal accepted this revision.
Ayal added a comment.
This revision is now accepted and ready to land.

LGTM, thanks for taking this out of https://reviews.llvm.org/D38948 and into a separate commit.



================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:6867
+      if (ValuesToIgnore.count(&I) ||
+          (VF > 1 && VecValuesToIgnore.count(&I)))
         continue;
----------------
Can add a comment that VecValuesToIgnore should also be skipped for VF == 1 and UF > 1, but expectedCost() provides only VF, where VF == 1 stands for the baseline version (with UF == 1 too).

Can add a comment to also have getSmallestAndWidestTypes() skip over VecValuesToIgnore, as it too only skips over ValuesToIgnore; although it only deals with loads/stores/phi's anyhow. 


================
Comment at: test/Transforms/LoopVectorize/X86/reduction-small-size.ll:23
+; CHECK: LV: Found an estimated cost of {{[0-9]+}} for VF 2 For instruction:   %{{.*}} = load
+; CHECK-NOT: LV: Found an estimated cost of {{[0-9]+}} for VF 2 For instruction:   %{{.*}} = zext i8 %{{.*}} to i32
+; CHECK-NOT: LV: Found an estimated cost of {{[0-9]+}} for VF 2 For instruction:   %{{.*}} = and i32 %{{.*}}, 255
----------------
Add a CHECK that such estimates are found for VF 1?


https://reviews.llvm.org/D40883





More information about the llvm-commits mailing list