Issue 240091
Summary [InstCombine] FoldOpIntoSelect drop fast math flags
Labels new issue
Assignees
Reporter mustartt
    InstCombine's `FoldOpIntoSelect` missed the folded op's fast math flags.

```
define float @src(i1 %c, float %x) {
 %s = select ninf nsz i1 %c, float %x, float 0.000000e+00
  %r = call ninf nsz float @llvm.copysign.f32(float 0.000000e+00, float %s)
  ret float %r
}

// opt -S -passes=instcombine 

define float @src(i1 %c, float %x) local_unnamed_addr #0 {
  %1 = tail call ninf nsz float @llvm.copysign.f32(float 0.000000e+00, float %x)
  %r = select i1 %c, float %1, float 0.000000e+00
  ret float %r
}
```

where `ninf` is valid on `%r`.

https://godbolt.org/z/4dbxrsr73
https://alive2.llvm.org/ce/z/cKjdgK
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to