[llvm] [ValueTracking] Handle idx widths > 64 bit in GetPointerBaseWithConst. (PR #221692)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 03:53:50 PDT 2026


================
@@ -376,7 +377,13 @@ inline Value *GetPointerBaseWithConstantOffset(Value *Ptr, int64_t &Offset,
   Value *Base =
       Ptr->stripAndAccumulateConstantOffsets(DL, OffsetAPInt, AllowNonInbounds);
 
-  Offset = OffsetAPInt.getSExtValue();
+  std::optional<int64_t> OffsetInt64 = OffsetAPInt.trySExtValue();
+  if (!OffsetInt64) {
+    Offset = 0;
+    return Ptr;
----------------
nikic wrote:

Uh yeah, I misread the code. For some reason I thought Ptr was reassigned.

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


More information about the llvm-commits mailing list