Skip to content

[InstCombine] icmp eq/ne (and (lshr C, X), Y), 0 fold missed #41815

@LebedevRI

Description

@LebedevRI
Bugzilla Link 42470
Version trunk
OS Linux
CC @davidbolvansky,@ecnelises,@RKSimon,@nikic,@rotateright

Extended Description

https://rise4fun.com/Alive/Aq6

Name:
Pre: isPowerOf2(-C)
%o0 = lshr i8 C, %y
%o1 = and i8 %o0, %x
%r = icmp eq i8 %o1, 0
=>
%n1 = shl i8 %x, %y
%r = icmp ult i8 %n1, -C

Name:
Pre: isPowerOf2(-C)
%o0 = lshr i8 C, %y
%o1 = and i8 %o0, %x
%r = icmp ne i8 %o1, 0
=>
%n1 = shl i8 %x, %y
%r = icmp uge i8 %n1, -C

  • Transforms/InstCombine/shl-and-negC-icmpeq-zero.ll
  • Transforms/InstCombine/shl-and-signbit-icmpeq-zero.ll
    regress in #​42466 because of lack of the fold

Metadata

Metadata

Assignees

Labels

bugzillaIssues migrated from bugzillallvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passes

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions