[llvm] ValueTracking: modernize isKnownInversion (NFC) (PR #126234)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 03:49:53 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-analysis

Author: Ramkumar Ramachandra (artagnon)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/126234.diff


1 Files Affected:

- (modified) llvm/lib/Analysis/ValueTracking.cpp (+2-2) 


``````````diff
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 6eba6c0f08c3f40..94d5b877b7d43ec 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,7 +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() &&
+  if (Pred1.hasSameSign() &&
       RHSC1->isNonNegative() != RHSC2->isNonNegative())
     return false;
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/126234


More information about the llvm-commits mailing list