[llvm] [ADT] Remove an extraneous variable (NFC) (PR #144937)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 19 11:07:40 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

Without this patch, Int and IntWord have the same value and type.
This patch removes the extraneous copy.


---
Full diff: https://github.com/llvm/llvm-project/pull/144937.diff


1 Files Affected:

- (modified) llvm/include/llvm/ADT/PointerIntPair.h (+2-3) 


``````````diff
diff --git a/llvm/include/llvm/ADT/PointerIntPair.h b/llvm/include/llvm/ADT/PointerIntPair.h
index f73f5bcd6ce0c..9cfc65846d5bf 100644
--- a/llvm/include/llvm/ADT/PointerIntPair.h
+++ b/llvm/include/llvm/ADT/PointerIntPair.h
@@ -206,11 +206,10 @@ struct PointerIntPairInfo {
   }
 
   static intptr_t updateInt(intptr_t OrigValue, intptr_t Int) {
-    intptr_t IntWord = static_cast<intptr_t>(Int);
-    assert((IntWord & ~IntMask) == 0 && "Integer too large for field");
+    assert((Int & ~IntMask) == 0 && "Integer too large for field");
 
     // Preserve all bits other than the ones we are updating.
-    return (OrigValue & ~ShiftedIntMask) | IntWord << IntShift;
+    return (OrigValue & ~ShiftedIntMask) | Int << IntShift;
   }
 };
 

``````````

</details>


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


More information about the llvm-commits mailing list