[PATCH] D103153: [InstCombine] Add fold for extracting known elements from a stepvector

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 3 00:50:02 PDT 2021


sdesmalen added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:355
+        break;
+      case Intrinsic::experimental_stepvector:
+        // Early break when Index is greater than the scalable vector minimum
----------------
It seems a bit silly to have a switch statement to handle a single case, if you can write:
  if (IID == Intrinsic::experimental_stepvector && IndexC->getValue().ult(NumElts)) {
    ...
  }


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:359
+        // be created at run-time.
+        if (!IndexC->getValue().ult(NumElts))
+          break;
----------------
nit: `s/!IndexC->getValue().ult/IndexC->getValue().uge/`


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp:362
+        Type *Ty = EI.getType();
+        unsigned BitWidth = Ty->getIntegerBitWidth();
+        auto *Idx =
----------------
nit: this only has a single use and the RHS expression is trivial, so the variable seems redundant.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103153



More information about the llvm-commits mailing list