[llvm] e9d298d - InstCombine: Perform simpler test of APFloat first

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 07:51:46 PST 2022


Author: Matt Arsenault
Date: 2022-12-13T10:51:41-05:00
New Revision: e9d298d7c6a8cef6e1de06414a000e395b379a18

URL: https://github.com/llvm/llvm-project/commit/e9d298d7c6a8cef6e1de06414a000e395b379a18
DIFF: https://github.com/llvm/llvm-project/commit/e9d298d7c6a8cef6e1de06414a000e395b379a18.diff

LOG: InstCombine: Perform simpler test of APFloat first

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 5b422b1564ff2..64492da2f52b2 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -7076,7 +7076,7 @@ Instruction *InstCombinerImpl::visitFCmpInst(FCmpInst &I) {
       APFloat Fabs = TruncC;
       Fabs.clearSign();
       if (!Lossy &&
-          (!(Fabs < APFloat::getSmallestNormalized(FPSem)) || Fabs.isZero())) {
+          (Fabs.isZero() || !(Fabs < APFloat::getSmallestNormalized(FPSem)))) {
         Constant *NewC = ConstantFP::get(X->getType(), TruncC);
         return new FCmpInst(Pred, X, NewC, "", &I);
       }


        


More information about the llvm-commits mailing list