[PATCH] D82218: [SVE] Remove calls to VectorType::getNumElements from AggressiveInstCombine

Francesco Petrogalli via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 12:54:42 PDT 2020


fpetrogalli added inline comments.


================
Comment at: llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp:294
     // FIXME: should this handle scalable vectors?
-    return FixedVectorType::get(Ty, VTy->getNumElements());
+    return FixedVectorType::get(Ty,
+                                cast<FixedVectorType>(VTy)->getNumElements());
----------------
Hi @ctetreau ,

why casting into `FixedVectorType` when `FixedVectorType::get` is already enforcing fixed vector types? I guess enforcing fixed vectors once is enough.

My preference would be to use: `return FixedVectorType::get(Ty, VTy->getElementCount());` If runtime errors have to be raised, I'd rather have it raised in a "standard" place, by invoking `FixedVectorType::get` on a scalable `ElementCount`, rather than by an explicit cast that will have no message associated.

Francesco




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82218





More information about the llvm-commits mailing list