Skip to content

InstCombine misses freeze of i1 select fold which appears in X86ISelLowering #131824

@arsenm

Description

@arsenm

define i1 @src(i8 range(i8 0, 2) noundef %i, i8 range(i8 0, 2) noundef %i1) {
bb:
  %loadedv.i.i2.i = trunc nuw i8 %i to i1
  %loadedv.i1.i.i = trunc nuw i8 %i1 to i1
  %i2 = select i1 %loadedv.i.i2.i, i1 %loadedv.i1.i.i, i1 false
  %cond.fr13 = freeze i1 %i2
  ret i1 %cond.fr13
}

define i1 @tgt(i8 range(i8 0, 2) noundef %i, i8 range(i8 0, 2) noundef %i1) {
bb:
  %i21 = and i8 %i1, %i
  %i2 = trunc nuw i8 %i21 to i1
  ret i1 %i2
}

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

I noticed this while looking at random IR samples in X86ISelLowering.cpp's output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions