Skip to content

[InstCombine] fold multiply and equality compare with constant #51744

@rotateright

Description

@rotateright
Bugzilla Link 52402
Version trunk
OS All
CC @anton-afanasyev,@RKSimon

Extended Description

Forking this off from bug 52289 - I don't know what the generalization is, but we're missing some kind of overflowing/shifting/multiplying magic:

define i1 @src(i32 %x) {
  %m = mul i32 %x, 1355350016 ; 0x50c90000
  %r = icmp eq i32 %m, 65536  ; 0x00010000
  ret i1 %r
}

define i1 @tgt(i32 %x) {
  %t = trunc i32 %x to i16
  %r = icmp eq i16 %t, 51577 ; 0xc979
  ret i1 %r
}

https://alive2.llvm.org/ce/z/7Ft6jA

Metadata

Metadata

Labels

bugzillaIssues migrated from bugzillaconfirmedVerified by a second partyllvm: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