Skip to content

[InstCombine] Missed optimization for add + and + icmp pattern #141753

Open
@nikic

Description

@nikic

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

define i1 @src(i8 range(i8 0, 4) %arg) {
  %add = add nsw i8 %arg, -1
  %and = and i8 %add, -3
  %cmp = icmp eq i8 %and, 0
  ret i1 %cmp
}

define i1 @tgt(i8 range(i8 0, 4) %arg) {
  %and = and i8 %arg, 1
  %cmp = icmp ne i8 %and, 0
  ret i1 %cmp
}

Not sure how to generalize this best.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions