[PATCH] D79196: [SVE] Fix invalid usage of VectorType::getNumElements() in InstCombine

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 13:26:40 PDT 2020


ctetreau marked an inline comment as done.
ctetreau added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:1438
   Value *LHS = Inst.getOperand(0), *RHS = Inst.getOperand(1);
-  assert(cast<VectorType>(LHS->getType())->getNumElements() == NumElts);
-  assert(cast<VectorType>(RHS->getType())->getNumElements() == NumElts);
+  assert(cast<VectorType>(LHS->getType())->getElementCount() ==
+         cast<VectorType>(Inst.getType())->getElementCount());
----------------
the reasoning for the change to getElementCount is to ensure that the LHS and RHS are the same sort of vector as the Inst vector. (i.e., not scalable)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79196





More information about the llvm-commits mailing list