[PATCH] D147668: [RFC][X86 isel] Remove lane requirement from lowerShuffleAsUNPCKAndPermute

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 11 06:36:39 PDT 2023


RKSimon added a comment.

one minor



================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:13559
+  size_t NumUndefs = 0;
+  SmallSet<int, 32> UniqueMask;
+  for (int Elt : Mask) {
----------------
We can probably avoid the SmallSet by using std::optional?
``` 
std::optional<int> UniqueElt;
for (int Elt : Mask) {
  if (Elt == SM_SentinelUndef) {
      NumUndefs++;
      continue;
  }
  if (UniqueElt.has_value() && UniqueElt.value() != Elt)
    return false;
  UniqueElt = Elt;
}
return NumUndefs <= Mask.size() / 2 && UniqueElt.has_value();
```
(untested)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147668



More information about the llvm-commits mailing list