[PATCH] D81856: [SVE] Fix bad FixedVectorType cast in simplifyDivRem

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 15 10:55:59 PDT 2020


ctetreau created this revision.
Herald added subscribers: llvm-commits, psnobl, rkruppe, hiraditya, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: LLVM.
ctetreau added a child revision: D81504: [SVE] Remove calls to VectorType::getNumElements from Analysis.

simplifyDivRem attempts to walk a VectorType elementwise. Ensure that it
only does so for FixedVectorType


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81856

Files:
  llvm/lib/Analysis/InstructionSimplify.cpp


Index: llvm/lib/Analysis/InstructionSimplify.cpp
===================================================================
--- llvm/lib/Analysis/InstructionSimplify.cpp
+++ llvm/lib/Analysis/InstructionSimplify.cpp
@@ -942,10 +942,10 @@
   if (match(Op1, m_Zero()))
     return UndefValue::get(Ty);
 
-  // If any element of a constant divisor vector is zero or undef, the whole op
-  // is undef.
+  // If any element of a constant divisor fixed width vector is zero or undef,
+  // the whole op is undef.
   auto *Op1C = dyn_cast<Constant>(Op1);
-  auto *VTy = dyn_cast<VectorType>(Ty);
+  auto *VTy = dyn_cast<FixedVectorType>(Ty);
   if (Op1C && VTy) {
     unsigned NumElts = VTy->getNumElements();
     for (unsigned i = 0; i != NumElts; ++i) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81856.270797.patch
Type: text/x-patch
Size: 745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200615/501d3b4a/attachment.bin>


More information about the llvm-commits mailing list