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

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 8 08:22:14 PST 2022


david-arm marked an inline comment as done.
david-arm 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);
----------------
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 !


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

https://reviews.llvm.org/D119238



More information about the llvm-commits mailing list