| Issue |
177467
|
| Summary |
[ConstantFolding] Miscompilation of constrained fsub
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
sairam2661
|
**Fuzzer Generated Test**
**Reproducer**
https://alive2.llvm.org/ce/z/ti9u9X
**Description**
`fsub double 0.0, 0.0` with `rounding=dynamic, exceptions=strict` is incorrectly folded to `+0.0` instead of `-0.0`
**Steps to reproduce**
- Minimized test case, `input.ll`
```
define double @test() {
%res = call double @llvm.experimental.constrained.fsub.f64(double 0.000000e+00, double 0.000000e+00, metadata !"round.dynamic", metadata !"fpexcept.strict")
ret double %res
}
; Function Attrs: nocallback nofree nosync nounwind strictfp willreturn memory(inaccessiblemem: readwrite)
declare double @llvm.experimental.constrained.fsub.f64(double, double, metadata, metadata) #0
attributes #0 = { nocallback nofree nosync nounwind strictfp willreturn memory(inaccessiblemem: readwrite) }
```
**Output**
```
----------------------------------------
define double @test() {
#0:
%res = fsub double 0.000000, 0.000000, rounding=dynamic, exceptions=strict
ret double %res
}
=>
define double @test() nofree noundef willreturn memory(none) {
#0:
ret double 0.000000
}
Transformation doesn't verify!
ERROR: Value mismatch
Example:
Source:
double %res = #x8000000000000000 (-0.0)
Target:
Source value: #x8000000000000000 (-0.0)
Target value: #x0000000000000000 (+0.0)
Summary:
0 correct transformations
1 incorrect transformations
0 failed-to-prove transformations
0 Alive2 errors
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs