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

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


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

None

>From e311a9557acbd5cc10a342fdd0253518f7c16f7e Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Fri, 7 Feb 2025 11:47:10 +0000
Subject: [PATCH] ValueTracking: modernize isKnownInversion (NFC)

---
 llvm/lib/Analysis/ValueTracking.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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;
 



More information about the llvm-commits mailing list