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

Vasileios Porpodas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 12:55:47 PDT 2022


vporpo added inline comments.


================
Comment at: llvm/lib/Target/X86/X86TargetTransformInfo.cpp:1558
+                   BaseTp->getElementType(),
+                   cast<FixedVectorType>(BaseTp)->getNumElements()) &&
+               "Table entry missing from isLegalBroadcastLoad()");
----------------
RKSimon wrote:
> Won't this fail on pre-SSSEe targets?
Good catch, I added a check for SSE3.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1130
+          // A broadcast of a load can be cheaper on some targets.
+          if (TTI->isLegalBroadcastLoad(V1->getType(), NumLanes))
+            return VLOperands::ScoreSplatLoads;
----------------
ABataev wrote:
> Probably, need to check also for number of uses + external uses.
Good point, I added a check which should only allow this if we don't have any internal/external uses. I will add checks for internal uses in a follow up patch, because it requires more changes + tests.


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