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

[InstCombine] missed fold of icmp-of-casted-shift #51889

Closed
rotateright opened this issue Nov 18, 2021 · 2 comments
Closed

[InstCombine] missed fold of icmp-of-casted-shift #51889

rotateright opened this issue Nov 18, 2021 · 2 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla good first issue https://github.com/llvm/llvm-project/contribute llvm:instcombine

Comments

@rotateright
Copy link
Contributor

rotateright commented Nov 18, 2021

Bugzilla Link 52547
Version trunk
OS All
CC @RKSimon

Extended Description

Forking this off from bug 52543 - we may be able to generalize this further for other constant values, but here's a missed sub-pattern based on that test:

define i1 @src(i32 %a) {
  %shl = shl i32 1, %a
  %t = trunc i32 %shl to i8
  %r = icmp eq i8 %t, 0
  ret i1 %r
}

define i1 @tgt(i32 %a) {
  %r = icmp ugt i32 %a, 7
  ret i1 %r
}

https://alive2.llvm.org/ce/z/mmkPup

And the 'ne' sibling:
https://alive2.llvm.org/ce/z/ftWEQz

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
@hasyimibhar
Copy link
Contributor

Potential fix: https://reviews.llvm.org/D115480

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 25, 2022

@llvm/issue-subscribers-good-first-issue

@rotateright rotateright self-assigned this Sep 5, 2022
rotateright added a commit that referenced this issue Sep 8, 2022
(trunc (1 << Y) to iN) == 2**C --> Y == C
(trunc (1 << Y) to iN) != 2**C --> Y != C
https://alive2.llvm.org/ce/z/xnFPo5

Follow-up to d9e1f9d. This was a suggested
enhancement mentioned in issue #51889.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla good first issue https://github.com/llvm/llvm-project/contribute llvm:instcombine
Projects
None yet
Development

No branches or pull requests

5 participants