Issue 139041
Summary Wrong `select (fcmp ...) (fadd ...)` folding to llvm max intrinsic
Labels new issue
Assignees
Reporter bongjunj
    ```llvm
define float @test_fcmp_ogt_fadd_select_rewrite_and_fastmath.2(float %in) {
  %cmp1 = fcmp nnan ogt float %in, 0.000000e+00
  %2 = fadd float %in, 1.000000e+00
 %sel = select fast i1 %cmp1, float %2, float 1.000000e+00
  ret float %sel
}
```

```
define float @test_fcmp_ogt_fadd_select_rewrite_and_fastmath(float %in) {
#0:
  %cmp1 = fcmp nnan ogt float %in, 0.000000
  %add = fadd float %in, 1.000000
  %sel = select fast i1 %cmp1, float %add, float 1.000000
  ret float %sel
}
=>
define float @test_fcmp_ogt_fadd_select_rewrite_and_fastmath(float %in) {
#0:
  %sel = fmax nnan ninf nsz float %in, 0.000000
  %add = fadd nnan ninf nsz float %sel, 1.000000
  ret float %add
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
float %in = #xff800000 (-oo)

Source:
i1 %cmp1 = #x0 (0)
float %add = #xff800000 (-oo)
float %sel = #x00000000 (+0.0)

Target:
float %sel = poison
float %add = poison
Source value: #x00000000 (+0.0)
Target value: poison

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

While the alive2 site (https://alive2.llvm.org/ce/z/50KuQH) complains that it used approximation so it could not conclude,
I think it may have nothing to do with approximation.

Targeted Commit of Test: https://github.com/llvm/llvm-project/commit/a0c4876eede8e68de22dc5296b037556c7cca981
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to