[PATCH] D65417: [SCCP] Update condition to avoid overflow.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 14:31:32 PDT 2019


lebedev.ri added inline comments.


================
Comment at: lib/Analysis/ConstantFolding.cpp:551
   // If we're not accessing anything in this constant, the result is undefined.
-  if (Offset >= InitializerSize)
+  if (Offset + BytesLoaded <= 0)
     return UndefValue::get(IntType);
----------------
This check looks suspicious to me.
I'd expect this to be `if (Offset + BytesLoaded >= InitializerSize)`,
this way we are checking that `BytesLoaded` bytes lies within the global.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D65417





More information about the llvm-commits mailing list