[PATCH] D150526: [X86] Add X86FixupVectorConstantsPass to re-fold AVX512 vector load folds as broadcast folds

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 10:45:48 PDT 2023


RKSimon added inline comments.


================
Comment at: llvm/lib/Target/X86/X86FixupVectorConstants.cpp:129
+                                                unsigned SplatBitWidth) {
+  if (std::optional<APInt> Bits = extractConstantBits(C))
+    if (Bits->isSplat(SplatBitWidth))
----------------
goldstein.w.n wrote:
> Do we need a check that Bits->getBitWidth() >= SplatBitWidth?
Adding an assert at the top would probably be enough, checking C->getPrimitiveSizeInBits % SplatBitWidth == 0.


================
Comment at: llvm/lib/Target/X86/X86FixupVectorConstants.cpp:231
+  // Currently only AVX512 instructions are handled.
+  if (!ST->hasAVX512())
+    return false;
----------------
goldstein.w.n wrote:
> Is there a way to check that MI is VEC type? If so maybe check that too before going to the foldingtable lookup?
Yes, we can probably do a check using the MCInstrDesc flags


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150526



More information about the llvm-commits mailing list