Skip to content

[InstCombine] ninf should not be propagated #143122

@dtcxzyw

Description

@dtcxzyw

Reproducer: https://alive2.llvm.org/ce/z/GnztNF

; bin/opt -passes=instcombine test.ll -S
define half @src(float %x) {
  %abs = call ninf float @llvm.fabs(float %x)
  %trunc = fptrunc float %abs to half
  ret half %trunc
}

----------------------------------------
define half @src(float %x) {
#0:
  %abs = fabs ninf float %x
  %trunc = fptrunc float %abs to half
  ret half %trunc
}
=>
define half @src(float %x) nofree willreturn memory(none) {
#0:
  %#1 = fptrunc float %x to half
  %trunc = fabs ninf half %#1
  ret half %trunc
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
float %x = #x50802003 (17196652544)

Source:
float %abs = #x50802003 (17196652544)
half %trunc = #x7c00 (+oo)

Target:
half %#1 = #x7c00 (+oo)
half %trunc = poison
Source value: #x7c00 (+oo)
Target value: poison

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions