[PATCH] D79053: [SVE] Fix invalid use of VectorType::getNumElements() in Value Tracking

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 13:28:09 PDT 2020


efriedma added a comment.

> So your proposal is that for scalable vectors, DemandedElts can have any value?

We'd ignore the value, yes.

Probably, for the sake of assertions etc., it would make sense to require it to be `APInt(1, 1)`, as opposed to actually making it unconstrained.  But that's not really important.



================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:1946
+  if (isa<ConstantVector>(V) && !EC->Scalable) {
+    const auto *CV = cast<ConstantVector>(V);
+    assert((CV->getNumOperands() == EC->Min) &&
----------------
ctetreau wrote:
> ctetreau wrote:
> > efriedma wrote:
> > > No reason to check Scalable; a ConstantVector is never scalable anyway.
> > ConstantVector::getSplat() can return a scalable ConstantVector
> I guess it actually returns a ConstantExpr?
Yes,  The fact that getSplat is an API on ConstantVector is a historical accident, I think.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79053





More information about the llvm-commits mailing list