[PATCH] D119238: [InstCombine] Support load-store forwarding with scalable vector types

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 9 01:04:05 PST 2022


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ConstantFolding.cpp:602
   // If we're not accessing anything in this constant, the result is undefined.
-  if (Offset >= InitializerSize)
+  if (Offset >= static_cast<int64_t>(InitializerSize.getKnownMinValue()))
     return UndefValue::get(IntType);
----------------
david-arm wrote:
> nikic wrote:
> > This is saying that accessing a scalable vector past its *minimum* size is undefined behavior. This doesn't look right to me. You probably want to return nullptr in that case, not UndefValue.
> Well spotted, thanks @nikic !
I think the code in ReadDataFromGlobal suffers from a similar issue, where a read that starts before the min size but crossed over it will leave the remaining bytes as zero.


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

https://reviews.llvm.org/D119238



More information about the llvm-commits mailing list