[PATCH] D80262: [SVE] Eliminate bad VectorType::getNumElements() calls from ConstantFold

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 15 15:30:05 PDT 2020


ctetreau marked 3 inline comments as done.
ctetreau added inline comments.


================
Comment at: llvm/lib/IR/ConstantFold.cpp:812
 
+  auto *ValVTy = cast<FixedVectorType>(Val->getType());
+
----------------
ctetreau wrote:
> sdesmalen wrote:
> > How about `extractelement <vscale x 16 x i8> zeroinitializer, i64 0` ?
> > 
> > (This probably cannot be a Constant anymore when the index > 16)
> I don't quite remember what (if anything) we decided to do about this case last thursday. I believe I was on the "it might be out of bounds, but we can't know so we shouldn't do anything" side of the argument, but I don't remember which side won.
> 
> Regardless, it would probably be more appropriate to just skip this particular transformation rather than letting it explode. I think it makes sense to just do that for now and revisit when we have all the correctness issues sorted out. I suppose this represents a behavior change, and needs a test...
I went ahead and explicitly added support for this case when the index is less than the minNumElements. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80262





More information about the llvm-commits mailing list