[PATCH] D19178: Broaden FoldItoFPtoI to try and establish whether the integer value fits into the float type
Carlos Liam via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 31 14:35:45 PDT 2016
aarzee added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:1507
@@ +1506,3 @@
+ // then the conversion is undefined behavior.
+
+ Safe = BitRange <= SignificandWidth;
----------------
eli.friedman wrote:
> Are you sure subtracting one actually makes the most significant bit zero-indexed? Normally, finding the distance between two array indexes is just simple subtraction; the extra "+1" looks weird. It's also kind of suspicious that your "zero-based" indexing can return a negative number (as an extreme case, if a 16-bit integer is all ones, your code says the most significant possibly set bit has index -1).
I'm going to take a look at the actual behavior, I think the least significant possibly set bit might be one-indexed; in any case something is behaving differently than I intended.
WRT the all-ones case, if a number has no unknown bits then it is by nature a constant, and would be handled by ConstProp, right?
https://reviews.llvm.org/D19178
More information about the llvm-commits
mailing list