Issue 138819
Summary InstSimplify: incorrect frexp(frexp(x)) -> frexp(x) fold
Labels new issue
Assignees
Reporter nunoplopes
    It's not ok to fold `frexp(frexp(x))` to `frexp(x)`:

```llvm
; Transforms/InstSimplify/frexp.ll

define {float, i32} @frexp_frexp(float %x) {
  %frexp0 = frexp float %x
  %frexp0.0 = extractvalue {float, i32} %frexp0, 0
  %frexp1 = frexp float %frexp0.0
 ret {float, i32} %frexp1
}
=>
define {float, i32} @frexp_frexp(float %x) {
  %frexp0 = frexp float %x
  ret {float, i32} %frexp0
}
Transformation doesn't verify!

ERROR: Value mismatch

Example:
float %x = #x0000000a (0.000000000000?)

Source:
{float, i32} %frexp0 = { #x3f200000 (0.625), #xffffff6f (4294967151, -145) }
float %frexp0.0 = #x3f200000 (0.625)
{float, i32} %frexp1 = { #x3f200000 (0.625), #x00000000 (0) }

Target:
{float, i32} %frexp0 = { #x3f200000 (0.625), #xffffff6f (4294967151, -145) }
Source value: { #x3f200000 (0.625), #x00000000 (0) }
Target value: { #x3f200000 (0.625), #xffffff6f (4294967151, -145) }
```

cc @arsenm
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to