[PATCH] D121354: [SLP] Fix lookahead operand reordering for splat loads.

Vasileios Porpodas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 11:09:39 PST 2022


vporpo added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1121
+      if (V1 == V2) {
+        if (isa<LoadInst>(V1) && NumLanes == 2)
+          return VLOperands::ScoreSplatLoads;
----------------
RKSimon wrote:
> vporpo wrote:
> > lebedev.ri wrote:
> > > This should be a lot more principled than this (i.e, query the actual costmodel).
> > > E.g., `movddup` is only for `double`, but i think this will also trigger for `float`?
> > > Also, what about broadcasting loads that are available in AVX/AVX2/AVX512?
> > I agree, this needs to be target specific. I could add a new `ShuffleKind`, something like `SK_BroadcastLoad`. But this is not strictly a shuffle pattern, it is a combined Load + Shuffle. So this might need its own function, like `TargetTransformInfo::getBroadcastLoadCost(VectorType *VecTy)`. What do you think?
> > 
> What about adding a IsLoad bool flag to the TTI::getShuffleCost? Or a TTI::IsLegalBroadcastLoad (similar to the existing IsLegal*Load ops)?
Yeah, something like `TTI::IsLegalBroadcastLoad` may be more suitable for this since the score that we are using in the reordering is not an actual TTI cost. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121354



More information about the llvm-commits mailing list