[PATCH] D31182: [InstCombine] fadd double (sitofp x), y check that the promotion is valid

Steve Canon via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 09:38:59 PDT 2017


scanon added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1429
+        // single use (so we don't increase the number of int->fp conversions),
+        // and if the integer add will not overflow.
+        if (LHSIntVal->getType() == RHSIntVal->getType() &&
----------------
Aren't we missing a check that RHSIntVal can be exactly in the floating-point type here?  I.e. `if (RHSIntVal->getType()->getIntegerBitWidth() <= MaxRepresentableBits)`, mirroring the check for LHS above?


https://reviews.llvm.org/D31182





More information about the llvm-commits mailing list