[PATCH] D77263: Clean up usages of asserting vector getters in Type

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 09:44:46 PDT 2020


sdesmalen added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:683
   Type *ResTy = II.getType();
-  Type *ArgTy = Arg->getType();
+  auto *ArgTy = dyn_cast<VectorType>(Arg->getType());
 
----------------
Can you move this line to just above the check for `if (!ArgTy)`, just to make it clear that it can be `nullptr` and should not be used in between the definition and that check.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:1825
+    if (auto *CIVTy =
+            dyn_cast<VectorType>(CI.getType())) // Handle vectors of pointers.
+      Ty = VectorType::get(Ty, CIVTy->getElementCount());
----------------
nit: maybe put the comment above the if statement?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77263





More information about the llvm-commits mailing list