[llvm] [SLP]Fix graph traversal in getSpillCost (PR #124984)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 29 14:07:03 PST 2025


================
@@ -12255,17 +12257,18 @@ InstructionCost BoUpSLP::getSpillCost() const {
     }
 
     if (NumCalls) {
-      SmallVector<Type *, 4> V;
-      for (auto *II : LiveValues) {
-        auto *ScalarTy = II->getType();
-        if (auto *VectorTy = dyn_cast<FixedVectorType>(ScalarTy))
-          ScalarTy = VectorTy->getElementType();
-        V.push_back(getWidenedType(ScalarTy, BundleWidth));
+      SmallVector<Type *, 4> EntriesTypes;
+      for (const TreeEntry *TE : LiveEntries) {
+        auto *ScalarTy = TE->getMainOp()->getType();
+        auto It = MinBWs.find(TE);
----------------
preames wrote:

You dropped the 

if (auto *VectorTy = dyn_cast<FixedVectorType>(ScalarTy))
          ScalarTy = VectorTy->getElementType()

Which I think was added for revectorization.  Is that needed, do does the MainOp->getType() call normalize?

https://github.com/llvm/llvm-project/pull/124984


More information about the llvm-commits mailing list