[PATCH] D19178: Broaden FoldItoFPtoI to try and establish whether the integer value fits into the float type

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 24 15:16:17 PDT 2016


eli.friedman added inline comments.

================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:1496
@@ +1495,3 @@
+                MostSignificantPossiblySetBit = std::max(HighestNotKnownZero,
+                                                         LowestNotKnownOne);
+            }
----------------
If a value has unknown sign, isn't KnownZero.countLeadingOnes() always going to zero?

================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:1507
@@ +1506,3 @@
+    Safe = BitRange <= SignificandWidth && MostSignificantPossiblySetBit <
+      APFloat::semanticsMaxExponent(OpITy->getFltSemantics());
+  }
----------------
Thinking about it a bit more, we don't actually care if the exponent overflows; the end result would be undef, so it doesn't matter.


https://reviews.llvm.org/D19178





More information about the llvm-commits mailing list