[llvm] [SLP] Reject 2-element vectorization when vector inst count exceeds scalar (PR #190414)
Ryan Buchner via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 5 23:32:36 PDT 2026
================
@@ -12817,6 +12829,112 @@ bool BoUpSLP::areAllUsersVectorized(
});
}
+unsigned BoUpSLP::getNumScalarInsts() const {
+ unsigned Count = 0;
+ for (const std::unique_ptr<TreeEntry> &Ptr : VectorizableTree) {
+ const TreeEntry &TE = *Ptr;
+ if (DeletedNodes.contains(&TE))
+ continue;
+ if (TE.isGather() || TransformedToGatherNodes.contains(&TE)) {
+ // Count instruction scalars in gathers — they exist in the scalar
+ // code regardless of vectorization. ExtractElement instructions
+ // become free when the vector input is used directly.
----------------
bababuck wrote:
If they exist regardless why count them?
https://github.com/llvm/llvm-project/pull/190414
More information about the llvm-commits
mailing list