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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 03:49:17 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;
----------------
fhahn wrote:

I might be missing something, but `Ptr` should still be the incoming argument and `Base` would be the stripped pointer?

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


More information about the llvm-commits mailing list