[PATCH] D105994: [SVE] Add folds for sign and zero extends of vscale

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 21 12:34:49 PDT 2021


efriedma added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:1371
+      unsigned TypeWidth = Src->getType()->getScalarSizeInBits();
+      if (MaxVScale < ((unsigned long)1) << TypeWidth) {
+        Value *VScale = Builder.CreateVScale(ConstantInt::get(DestTy, 1));
----------------
This shift can overflow.

I'd suggest using `Log2_32(MaxVScale)` instead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105994



More information about the llvm-commits mailing list