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

    <tr>
        <th>Summary</th>
        <td>
            Wrong substitution of a PHI node
        </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/89TX9n

```llvm
----------------------------------------
define i32 @sub_const_incoming0.2(i1 %b, i32 %x, i32 %y) {
entry:
  br i1 %b, label %if, label %then

if:
  br label %then

then:
  %p0 = phi i32 [ 42, %if ], [ %x, %entry ]
  %p1 = phi i32 [ undef, %if ], [ %y, %entry ]
  %r = sub i32 %p1, %p0
  ret i32 %r
}
=>
define i32 @sub_const_incoming0.2(i1 %b, i32 %x, i32 %y) {
entry:
  br i1 %b, label %if, label %then

if:
  br label %then

then:
  %p0 = phi i32 [ 42, %if ], [ %x, %entry ]
  %r = sub i32 %y, %p0
  ret i32 %r
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
i1 %b = #x1 (1)
i32 %x = poison
i32 %y = poison

Source:
  >> Jump to %if
  >> Jump to %then
i32 %p0 = #x0000002a (42)
i32 %p1 = #x00000000 (0)        [based on undef value]
i32 %r = #xffffffd6 (4294967254, -42)

Target:
  >> Jump to %if
  >> Jump to %then
i32 %p0 = #x0000002a (42)
i32 %r = poison
Source value: #xffffffd6 (4294967254, -42)
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/eJzsVU2P8jYQ_jXDxQI543yQQw5QFrW9tNqu1N5eOckEvErsyHbo0l9fxQks6Xbf9j310ggFhnn8zMdje6Rz6qSJCkj2kBxWcvBnY4vS6NProF9Xpamvxa5VF0JmqTfWg9ixs_e9A7EDPAIeZXBv2vbSbYw9AR4rAjz-AXjc5i-_5Rr4Afhufqd8-ozw6a_1v3wmdE2N0sSUQAYxd0P5pTLa-S9KV6ZT-sQ3CLhVEQNMSsDvJiQmbw-_r4A5g2w_MZL29jpWEyzGSsselreypHa0VLMw_ZkWhalmSfEpMNjvUMCk5wzEgfVnNSWY7FmMY7AQlUFyCEayv9cBmISsg--BKPpANOiams-4rl_hsoHKDeWtaX00o3t-g1nyN6-dS8xmDhAHEE__S_ZPkn1o8_VbuvxipXaNsZ30ymhWG3IaMPPsQlY1V8DosYyn5-efnsfz-yLtaSR1rDOWWG-UM9oMjvmz1MyZwVa0WPgmu76lewvmXofUAcXbaG4jwHx2z_JNLQrkC8f1g2N6_zIFfmi0eALxxH4cup55Myv6qe9dtduO5fcMeXhQjomOQi0znc_NO5DzEcgDLodkX0pHNTN6Ok7sItuB7jretLlzNOGp0ylYHudphkk86rp-iD0rGKT4D2q2H0SY2j8XJ3bfUMq8n-4r_0baoevk4shyVhlrqfLMLzaxuwEiNt4PX4Vw1kjVUr32Zt1bc6HPgfMMI2uNdX8ZRau6EHUucrmiIsoEj9I4z3B1LvhWikqgrCiO0m2EMea8kqmoMMrSVJQrVSDHOOKY8wgxwU0TZU1CJaZYlllJJcScOqna-3RcKecGKqJI5Dmuwo3jwvBF1PQ7C15AHGexLcZF63I4OYh5q5x37zRe-ZaKX63Rp_H2cF75IdwBpmGS_fz9D0ybmlaDbYvltD4pfx7KTWU6wGMYwtPX2MBXqjzgMSThAI9zlpcC_wwAAP__4-01vg">