[PATCH] D40012: [InstSimplify] More fcmp cases when comparing against negative constants.

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 29 07:40:48 PST 2017


spatel added inline comments.


================
Comment at: lib/Analysis/InstructionSimplify.cpp:3382
+    } else if (C->isNegative()) {
+      assert(!C->isNaN() && "Unexpected -NaN!");
+      // TODO: We can catch more cases by using a range check rather than
----------------
Nit: The assert string would confuse me if we ever hit that because -NaN actually is a (set of) FP value(s).

"Unexpected NaN constant" ?


================
Comment at: test/Transforms/InstCombine/cast-int-fcmp-eq-0.ll:342-349
+; unsigned integer cannot possibly round to a negative
 ; CHECK-LABEL: @i32_cast_cmp_oeq_int_i32imin_uitofp(
-; CHECK: uitofp
-; CHECK: fcmp oeq
-; CHECK-NEXT: ret
+; CHECK-NEXT: ret i1 false
 define i1 @i32_cast_cmp_oeq_int_i32imin_uitofp(i32 %i) {
   %f = uitofp i32 %i to float
   %cmp = fcmp oeq float %f, 0xC1E0000000000000
   ret i1 %cmp
----------------
Can you move this and the related tests over to the instsimplify file?

Nit: I'd prefer to change these constants to '-1.0' or whatever they are rather than trying to decode hex values. :)


https://reviews.llvm.org/D40012





More information about the llvm-commits mailing list