[llvm] Revert "[ADT] Fix signed integer overflow" (PR #155875)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 28 09:07:09 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-adt

Author: Vitaly Buka (vitalybuka)

<details>
<summary>Changes</summary>

Reverts llvm/llvm-project#<!-- -->155826

To simplify revert of https://github.com/llvm/llvm-project/pull/155549 which introduces UBs.

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


1 Files Affected:

- (modified) llvm/include/llvm/ADT/DenseMapInfo.h (+1-2) 


``````````diff
diff --git a/llvm/include/llvm/ADT/DenseMapInfo.h b/llvm/include/llvm/ADT/DenseMapInfo.h
index ec7a116856bb4..930bd4baca31d 100644
--- a/llvm/include/llvm/ADT/DenseMapInfo.h
+++ b/llvm/include/llvm/ADT/DenseMapInfo.h
@@ -124,8 +124,7 @@ struct DenseMapInfo<
     if constexpr (std::is_unsigned_v<T> && sizeof(T) > sizeof(unsigned))
       return densemap::detail::mix(Val);
     else
-      return static_cast<unsigned>(Val *
-                                   static_cast<std::make_unsigned_t<T>>(37U));
+      return static_cast<unsigned>(Val * 37U);
   }
 
   static bool isEqual(const T &LHS, const T &RHS) { return LHS == RHS; }

``````````

</details>


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


More information about the llvm-commits mailing list