[llvm] [llvm] Fix behavior of llvm.objectsize in presence of negative / large offset (PR #115504)

via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 12:10:23 PST 2024


================
@@ -580,6 +585,11 @@ bool llvm::getObjectSize(const Value *Ptr, uint64_t &Size, const DataLayout &DL,
   if (!Data.bothKnown())
     return false;
 
+  // We could compute an over-approximation in that situation, may be if
+  // Opts.EvalMode == Max, but let's bee conservative and bail out.
+  if (Data.Offset.isNegative())
+    return false;
----------------
serge-sans-paille wrote:

Fixed with current version!
I think it matches what we expect in all the above situation. And it is consistent \o/

https://github.com/llvm/llvm-project/pull/115504


More information about the llvm-commits mailing list