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

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Tue May 10 13:11:41 PDT 2016


mcrosier added a subscriber: mcrosier.

================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:1454
@@ +1453,3 @@
+
+  bool safe;
+
----------------
How about:

  bool Safe = ActualSize <= MantissaWidth;
  
  // Compute known bits to see if the integer value fits into the fp type.
  if (!Safe) {
    ...
  }
  
  if (Safe) {
    ...

Note: Local variables should be capitalized.

================
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:1476
@@ +1475,3 @@
+    if (!KnownNegative) {
+        // only necessary if it's not known negative (possibly positive)
+        for (unsigned i = 1, j; i < BitWidth + 1; ++i) {
----------------
Please capitalize Only and add a period.

http://llvm.org/docs/CodingStandards.html#commenting


http://reviews.llvm.org/D19178





More information about the llvm-commits mailing list