[llvm] [SLP] De-duplicate costing of perfect-diamond gather spills (PR #220569)
Ryan Buchner via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 3 07:52:23 PDT 2026
================
@@ -19040,6 +19048,63 @@ InstructionCost BoUpSLP::getSpillCost() {
}
return nullptr;
};
+ auto IsCoveredByMatchingVectorEntry = [&](const TreeEntry *Gather,
+ const Loop *SpillLoop) -> bool {
+ assert(Gather->isGather());
+ if (!Gather->hasState())
+ return false;
+
+ // Find the real vector entry reused by this perfect-diamond gather.
+ const TreeEntry *SameTE = getSameValuesTreeEntry(
+ Gather->getMainOp(), Gather->Scalars, /*SameVF=*/true);
+ if (!SameTE || SameTE == Gather || SameTE->State != TreeEntry::Vectorize ||
+ ScalarOrPseudoEntries.contains(SameTE) || !SameTE->UserTreeIndex)
+ return false;
----------------
bababuck wrote:
I see. Better to use `MainOp` here then?
https://github.com/llvm/llvm-project/pull/220569
More information about the llvm-commits
mailing list