[PATCH] D77691: [SVE] Remove calls to isScalable from IR

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 22 08:06:21 PDT 2020


sdesmalen added inline comments.


================
Comment at: llvm/include/llvm/IR/PatternMatch.h:2176
       Type *PtrTy = cast<Operator>(V)->getOperand(0)->getType();
-      auto *DerefTy = dyn_cast<VectorType>(PtrTy->getPointerElementType());
-      if (DerefTy && DerefTy->isScalable() &&
-          DL.getTypeAllocSizeInBits(DerefTy).getKnownMinSize() == 8)
+      auto *DerefTy =
+          dyn_cast<ScalableVectorType>(PtrTy->getPointerElementType());
----------------
nit: now that we can use `isa<ScalableVectorType>`, it's probably better to write this as:

```
auto *DerefTy = PtrTy->getPointerElementType();
if (isa<ScalableVectorType>(DerefTy) &&
    DL.getTypeAllocSizeInBits(DerefTy).getKnownMinSize() == 8)```


================
Comment at: llvm/unittests/IR/VectorTypesTest.cpp:179
   EXPECT_EQ(V2I32Len.getKnownMinSize(), 64U);
-  EXPECT_FALSE(V2I32Len.isScalable());
+  EXPECT_TRUE(V2I32Len.isScalable());
 
----------------
Shouldn't this be `EXPECT_FALSE`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77691





More information about the llvm-commits mailing list