[PATCH] D103180: [InstSimplify] Add constant fold for extractelement + splat for scalable vectors

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 3 01:46:38 PDT 2021


sdesmalen added inline comments.


================
Comment at: llvm/lib/IR/ConstantFold.cpp:913
   if (auto *ValSVTy = dyn_cast<ScalableVectorType>(Val->getType())) {
     if (!CIdx->uge(ValSVTy->getMinNumElements())) {
+      if (Constant *SplatVal = Val->getSplatValue())
----------------
CarolineConcatto wrote:
> sdesmalen wrote:
> > nit: `s/!CIdx->uge/CIdx->ult/`
> Hey @sdesmalen 
> I may be completely wrong, but I believe your suggestion is not possible
> https://llvm.org/doxygen/classllvm_1_1ConstantInt.html
> If I looked the documentation correctly llvm::constant only has UGE
Ah I hadn't realised that. In that case, could you write it more explicitly as
  CIdx->getZExtValue() < ValSVTy->getMinNumElements()


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103180



More information about the llvm-commits mailing list