Skip to content

[InstCombine] Incorrect fabs + nsz fold #151303

@nikic

Description

@nikic

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

define float @src(float %a) {
  %i32 = bitcast float %a to i32
  %cmp = icmp slt i32 %i32, 0
  call void @llvm.assume(i1 %cmp)

  %b = fneg nsz float %a
  %c = call float @llvm.fabs(float %b)
  ret float %c
}

The fabs is optimized away here, even though fneg nsz can flip the sign bit of zero.

Metadata

Metadata

Assignees

No one assigned

    Labels

    llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmiscompilation

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions