Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueTracking: modernize isKnownInversion (NFC) #126234

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

artagnon
Copy link
Contributor

@artagnon artagnon commented Feb 7, 2025

No description provided.

@artagnon artagnon requested a review from dtcxzyw February 7, 2025 11:49
@artagnon artagnon requested a review from nikic as a code owner February 7, 2025 11:49
@llvmbot
Copy link
Member

llvmbot commented Feb 7, 2025

@llvm/pr-subscribers-llvm-analysis

Author: Ramkumar Ramachandra (artagnon)

Changes

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

1 Files Affected:

  • (modified) llvm/lib/Analysis/ValueTracking.cpp (+2-2)
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;
 

Copy link

github-actions bot commented Feb 7, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@artagnon artagnon merged commit 7f21c77 into llvm:main Feb 7, 2025
6 of 8 checks passed
@artagnon artagnon deleted the vt-inversion-nfc branch February 7, 2025 13:28
Icohedron pushed a commit to Icohedron/llvm-project that referenced this pull request Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants