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

Harald van Dijk via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 12 14:50:08 PST 2024


================
@@ -255,7 +259,7 @@ class ObjectSizeOffsetVisitor
   SmallDenseMap<Instruction *, OffsetSpan, 8> SeenInsts;
   unsigned InstructionsVisited;
 
-  APInt align(APInt Size, MaybeAlign Align);
+  APInt alignAndCap(APInt Size, MaybeAlign Align);
----------------
hvdijk wrote:

I think the original name, `align`, is actually better: "cap" suggests to me some sort of saturation. That isn't what happens, when the size exceeds the representable values, you don't return the highest representable value, you return a special value indicating "unknown".

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


More information about the llvm-commits mailing list