<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/115301>115301</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [GVN] mishandle of `phi`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          bongjunj
      </td>
    </tr>
</table>

<pre>
    Alive2 report: https://alive2.llvm.org/ce/z/yDrndK

```llvm
----------------------------------------
define double @fcmp_une_not_zero.2(double %x, double %y) {
entry:
  %cmp = fcmp une double %y, 2.000000
  br i1 %cmp, label %return, label %else

else:
  br label %return

return:
  %retval = phi double [ undef, %else ], [ %x, %entry ]
  ret double %retval
}
=>
define double @fcmp_une_not_zero.2(double %x, double %y) {
entry:
  %cmp = fcmp une double %y, 2.000000
  br i1 %cmp, label %return, label %else

else:
  br label %return

return:
  ret double %x
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
double %x = poison
double %y = #x4000000000000000 (2)

Source:
i1 %cmp = #x0 (0)
  >> Jump to %else
  >> Jump to %return
double %retval = #x0000000000000000 (+0.0)      [based on undef value]

Target:
i1 %cmp = #x0 (0)
  >> Jump to %else
  >> Jump to %return
Source value: #x0000000000000000 (+0.0)
Target value: poison

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsVU2v6jYQ_TXDZnSRYxMgiyzgcanUSq10-9TtlZNMwFeJHfmDXt6vr-IESOir-lZd1UIgez7OmeMxI51TJ02UQ7qH9LCQwZ-NzQujTx9BfywKU13zXaMuxNFSZ6wHscOz950DsQN-BH6U0bxsmku7NPYE_FgS8OM34MfrwerqF2AHYLvxe82GT-8-HL384Bq8K6qVJqxMKBpCWLG6bLv3oOldG__-jaxZcuDbm52nn8C_4GN7BZ4hbPZDNtLeXvtK4g57h7LtEMQB-7wYJlAx9gvyJYvrFlJYVMkY2NsbWVDT7y35YPXsiBpHUzXi_oFe2L9FT5zHkxlZS_4im8i3O6s71XSPQVdU9-AjLEJ6iNt0f1elN_UCRNuY1JKfVDzkH1lsRicQBxCv_1_H03XMlft8Eu2rldrVxrbSK6OxMuQ08I3HC1lVX4En0-Svb2-_vfVP7au0J_KoHLbGEnZGOaNNcOjPUqMzwZazEl4_Zds1jyomhIYuiQmebddoAy4-V2y-EPiWA8-mGL8PqDeIu9z3JDGK3aMQ-3YRr_hzaDv0Zi7996xTtZ-b8YHyHarA92w5IGeQ7gvpqEKjh9eAF9kEuvf6eC9R4P-qmEG6kYjY_UgdD5KPsOktjolD28rZ22FYGmup9OhnreduDgkq_S8uDGupGqpevHnprLnQPzuOQ4KsNdY9_dcvqlxUmcjkgvJkI1i2ydI0W5zzWmxEsS2kpHTN2JqXVGZbliYb2lbFStQLlXPGV0nCNkkisiRbrrNytU0FZ2uWlOu0hhWjVqrmPn4WyrlAeZKkgiWL-H5dnG6ca_oToxU474edzfuglyKcHKxYo5x3jzRe-SaOxZ_--BXSA7bKnaWuGkJTI6xZd1Z9ZcE2-XwcnpQ_h2JZmhb4MU654acX8INKD_wYSTjgx5HlJed_BQAA__8CbiR8">