[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 22:21:50 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:

I tend to agree. Let's explore that in another PR though, this one already looks like a nice step forward and I'm not eager to see it grow beyond its state.

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


More information about the llvm-commits mailing list