[llvm] [Float2Int] Fix pessimization in the MinBW calculation. (PR #86051)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 21 02:04:52 PDT 2024


================
@@ -359,8 +359,8 @@ bool Float2IntPass::validateAndTransform() {
 
     // The number of bits required is the maximum of the upper and
     // lower limits, plus one so it can be signed.
-    unsigned MinBW = std::max(R.getLower().getSignificantBits(),
-                              R.getUpper().getSignificantBits()) +
+    unsigned MinBW = std::max(R.getSignedMin().getSignificantBits(),
+                              R.getSignedMax().getSignificantBits()) +
----------------
nikic wrote:

Use `R.getMinSignedBits()` instead?

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


More information about the llvm-commits mailing list