[llvm-branch-commits] [llvm] d0dbb04 - [Support] Remove redundant sign bit tests from KnownBits::getSignedMinValue/getSignedMaxValue

Simon Pilgrim via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jan 14 07:51:11 PST 2021


Author: Simon Pilgrim
Date: 2021-01-14T15:46:26Z
New Revision: d0dbb0468c26bafa88e7340781fb3a0a79379470

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

LOG: [Support] Remove redundant sign bit tests from KnownBits::getSignedMinValue/getSignedMaxValue

As noted by @foad on rG6895581fd2c1

Added: 
    

Modified: 
    llvm/include/llvm/Support/KnownBits.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/KnownBits.h b/llvm/include/llvm/Support/KnownBits.h
index edb771d659e2..d854aadbd430 100644
--- a/llvm/include/llvm/Support/KnownBits.h
+++ b/llvm/include/llvm/Support/KnownBits.h
@@ -125,7 +125,7 @@ struct KnownBits {
     // Assume that all bits that aren't known-ones are zeros.
     APInt Min = One;
     // Sign bit is unknown.
-    if (Zero.isSignBitClear() && One.isSignBitClear())
+    if (Zero.isSignBitClear())
       Min.setSignBit();
     return Min;
   }
@@ -141,7 +141,7 @@ struct KnownBits {
     // Assume that all bits that aren't known-zeros are ones.
     APInt Max = ~Zero;
     // Sign bit is unknown.
-    if (Zero.isSignBitClear() && One.isSignBitClear())
+    if (One.isSignBitClear())
       Max.clearSignBit();
     return Max;
   }


        


More information about the llvm-branch-commits mailing list