[PATCH] D52685: [LoopVectorizer] Adjust heuristics for a truncated load

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 2 03:24:13 PDT 2018


Ayal added a subscriber: dorit.
Ayal added a comment.

We were wondering why not simply consider the scalar type of all not-to-be-ignored instructions in the loop instead. We're traversing them all anyway here.

(PR39497 provides a vectorizable loop having no loads nor stores, but it's quite odd.)



================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:4698
+         (isa<TruncInst>(*I.user_begin()) || isa<FPTruncInst>(*I.user_begin())))
+        T = (*I.user_begin())->getType();
+
----------------
Call `*I.user_begin()`, or rather `user_back()`, once instead of thrice?
Checking `isa<LoadInst>` is somewhat redundant.
Taking the smaller `T` helps reduce `MinWidth`, but may also reduce `MaxWidth`.


================
Comment at: test/Transforms/LoopVectorize/SystemZ/maxVF_truncload.ll:5
+;
+; CHECK: LV: The Smallest and Widest types: 32 / 32 bits.
+; CHECK: LV: Selecting VF: 4.
----------------
`Smallest` type should indeed be 32 bits, but `Widest` should (remain) 64 bits; unless the type of the original load should be ignored?


https://reviews.llvm.org/D52685





More information about the llvm-commits mailing list