[PATCH] D148065: InstCombine: Directly use computeKnownFPClass in is.fpclass combines

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 03:52:15 PDT 2023


foad added a comment.

> The various isKnownNever* calls can be merged into one.

That makes it sounds like an NFC change, but it is clearly improving some tests.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:934
 
+  // Clear test bits we know must be true from the source value.
+  // fp_class (nnan x), qnan|snan|other -> fp_class (nnan x), other
----------------
"must be false"?


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp:946
   // fp_class (ninf x), ~(ninf|pinf) -> true
-  if (Mask == (~fcInf & fcAllFlags) &&
-      isKnownNeverInfinity(Src0, DL, &getTargetLibraryInfo())) {
+  if ((~Mask & Known.KnownFPClasses) == fcNone)
     return replaceInstUsesWith(II, ConstantInt::get(II.getType(), true));
----------------
Given the other case we've handled already, I think this one can simplify to `if (Mask == Known.KnownFPClasses)`.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148065/new/

https://reviews.llvm.org/D148065



More information about the llvm-commits mailing list