[PATCH] D92668: [SLP]Merge reorder and reuse shuffles.

Anton Afanasyev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 7 06:37:49 PST 2020


anton-afanasyev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3510
         }
       }
       int DeadCost = ReuseShuffleCost;
----------------
ABataev wrote:
> anton-afanasyev wrote:
> > 
> I don't get it. What do you want to see here?
I suggest to join code below (starting from `if (!NeedToShuffleReuses && !E->ReorderIndices.empty())`) to this if-block:
```
if (NeedToShuffleReuses) {
  ...
  DeadCost = ReuseShuffleCost;
} else if (!E->ReorderIndices.empty()) {
  DeadCost = TTI->getShuffleCost(TargetTransformInfo::SK_PermuteSingleSrc, VecTy);
}
```



================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3513
+      if (!NeedToShuffleReuses && !E->ReorderIndices.empty())
         DeadCost += TTI->getShuffleCost(
             TargetTransformInfo::SK_PermuteSingleSrc, VecTy);
----------------
ABataev wrote:
> anton-afanasyev wrote:
> > Here `+=` looks confusing, we can just set `DeadCost = ...`, since `DeadCost == 0`.
> No, `DeadCost` is not `0`, it is `ReuseShuffleCost`
If `NeedToShuffleReuses == false` then `ReuseShuffleCost == 0`, so `DeadCost == 0`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92668/new/

https://reviews.llvm.org/D92668



More information about the llvm-commits mailing list