Skip to content

Conversation

@AZero13
Copy link
Contributor

@AZero13 AZero13 commented May 22, 2025

icmp ne X, (sext (icmp ne X, 0)) --> X != 0 && X != -1, not X != 0 && X == -1, which would go to X == -1 anyway.

@AZero13 AZero13 requested a review from nikic as a code owner May 22, 2025 17:19
@AZero13 AZero13 changed the title [InstCombine] Fix comment typo [InstCombine] Fix comment typo (NFC) May 22, 2025
@llvmbot llvmbot added llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:transforms labels May 22, 2025
@llvmbot
Copy link
Member

llvmbot commented May 22, 2025

@llvm/pr-subscribers-llvm-transforms

Author: AZero13 (AZero13)

Changes

icmp ne X, (sext (icmp ne X, 0)) --> X != 0 && X != -1, not X != 0 && X == -1, which would go to X == -1 anyway.


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

1 Files Affected:

  • (modified) llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp (+1-1)
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 00b0f05f18f03..bdc7a49700cfc 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -7078,7 +7078,7 @@ Instruction *InstCombinerImpl::foldICmpUsingBoolRange(ICmpInst &I) {
         // icmp eq X, (zext (icmp ne X, 0)) --> X == 0 || X == 1
         // icmp ne X, (zext (icmp ne X, 0)) --> X != 0 && X != 1
         // icmp eq X, (sext (icmp ne X, 0)) --> X == 0 || X == -1
-        // icmp ne X, (sext (icmp ne X, 0)) --> X != 0 && X == -1
+        // icmp ne X, (sext (icmp ne X, 0)) --> X != 0 && X != -1
         return CreateRangeCheck();
       }
     } else if (IsSExt ? C->isAllOnes() : C->isOne()) {

@AZero13 AZero13 changed the title [InstCombine] Fix comment typo (NFC) [InstCombine] Fix comment typo that incorrectly described fold (NFC) May 22, 2025
icmp ne X, (sext (icmp ne X, 0)) --> X != 0 && X != -1, not X != 0 && X == -1, which would go to X == -1 anyway.
@AZero13
Copy link
Contributor Author

AZero13 commented May 22, 2025

@arsenm I cannot merge. Can you please do this?

@arsenm arsenm merged commit eaf911b into llvm:main May 22, 2025
7 of 9 checks passed
@AZero13 AZero13 deleted the typo branch May 22, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llvm:instcombine Covers the InstCombine, InstSimplify and AggressiveInstCombine passes llvm:transforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants