[llvm] 7f21c77 - ValueTracking: modernize isKnownInversion (NFC) (#126234)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 05:28:28 PST 2025


Author: Ramkumar Ramachandra
Date: 2025-02-07T13:28:23Z
New Revision: 7f21c77024e562f55f7de0d36a9c9e747a5e9ff5

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

LOG: ValueTracking: modernize isKnownInversion (NFC) (#126234)

Added: 
    

Modified: 
    llvm/lib/Analysis/ValueTracking.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 6eba6c0f08c3f40..8a9ad55366ee703 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -8599,7 +8599,7 @@ bool llvm::isKnownInversion(const Value *X, const Value *Y) {
     return false;
 
   // They must both have samesign flag or not.
-  if (cast<ICmpInst>(X)->hasSameSign() != cast<ICmpInst>(Y)->hasSameSign())
+  if (Pred1.hasSameSign() != Pred2.hasSameSign())
     return false;
 
   if (B == C)
@@ -8611,8 +8611,7 @@ bool llvm::isKnownInversion(const Value *X, const Value *Y) {
     return false;
 
   // Sign bits of two RHSCs should match.
-  if (cast<ICmpInst>(X)->hasSameSign() &&
-      RHSC1->isNonNegative() != RHSC2->isNonNegative())
+  if (Pred1.hasSameSign() && RHSC1->isNonNegative() != RHSC2->isNonNegative())
     return false;
 
   const auto CR1 = ConstantRange::makeExactICmpRegion(Pred1, *RHSC1);


        


More information about the llvm-commits mailing list