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

    <tr>
        <th>Summary</th>
        <td>
            incorrect reassociation at low bitwidth
        </td>
    </tr>

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

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

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

<pre>
    here's a function:
```llvm
define i3 @f(i3 %0) {
  %2 = mul i3 %0, %0
  %3 = mul i3 %2, %0
  %4 = mul i3 %3, %0
  %5 = mul nsw i3 %4, %0
  ret i3 %5
}
```

reassociate seems to be getting it wrong:
```
Johns-MacBook-Pro:reduce regehr$ ~/alive2-regehr/build/alive-tv reduced.ll -passes=reassociate

----------------------------------------
define i3 @f(i3 %#0) {
#1:
  %#2 = mul i3 %#0, %#0
  %#3 = mul i3 %#2, %#0
  %#4 = mul i3 %#3, %#0
  %#5 = mul nsw i3 %#4, %#0
  ret i3 %#5
}
=>
define i3 @f(i3 %#0) {
#1:
  %#2 = mul i3 %#0, %#0
  %#3 = mul nsw i3 %#2, %#0
  ret i3 %#3
}
Transformation doesn't verify!

ERROR: Target is more poisonous than source

Example:
i3 %#0 = #x6 (6, -2)

Source:
i3 %#2 = #x4 (4, -4)
i3 %#3 = #x0 (0)
i3 %#4 = #x0 (0)
i3 %#5 = #x0 (0)

Target:
i3 %#2 = #x4 (4, -4)
i3 %#3 = poison
Source value: #x0 (0)
Target value: poison

Summary:
  0 correct transformations
  1 incorrect transformations
  0 failed-to-prove transformations
  0 Alive2 errors
Johns-MacBook-Pro:reduce regehr$ 
```

cc @nunoplopes 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzElc-SozYQxp9GXLpwCUn4z4GDZz0-pCqV1GRfQEAblAjJJQl755JnTwk82Gbs3aRyWJfLgPh9cnd_LUl6rxqDWJD8heS7RPahta5w2GDrktLW70WLDglbeZBw6E0VlDWEbwndEbolSzp-tT5141CNB2UQFAci6IGwdbxjOSVsA2T1MkIQhxgQvoOu1zAhX8brleEzhj1gxIzhD5h8Yow_Xzgx5xyGy6v8kt5qN8vz8jj8OpTe20rJgOAROw_BQonQYAjKNKACnJ01zedqjY-_2Nb49FdZvVj7V_q7s4RvHdZ9hTDWnzABfxO2l1qdkKUfg_uyV7r-GE_DCUZVvdAa0qP0Hj3hu5vwbqNO_-Xnu24Sxu8NJYxnU55wQeYGj6ov0-0dPHc66p_Cc8uj_in8yPs4xwPBtQOibt4EfEf468-ry130j2pzFz2fRf_VSeMP1nUyrmCoLXpD2CrACZ06vBOW3XbJ69vbb2-Eb-GrdE2c1kNnHcLRKm-N7T2EVhrwtnfVXXu9fpPdUeOU8zXDIQ_C-LclELZexvhTRtjmVv3HON8nMZvEIooH61Ixia9JTxyNHP1MiB8S-TPiUsehIP83xLGOt0nDSeo-pv7ory8uTMit_DJJ33XSvd_0GoXKOodVgHBnvf8AMlDmBwiFg1Qa6zTY9OjsCZ-D22GTAnTOOv8fNrjvbLBVFVeX6Y09antED0ld8HrDNzLBIltlecaZyLOkLap1XZXlhpZrzGuRlbgUGy74sq5LPFTVKlEFo0zQnK5pJmieLRjyNcuWmAlWi01FiaDYSaUX8SRbWNckyvsei00mslWiZYnaD4ckYwbPMLwkjMUz0xVRk5Z944mgWvngr7MEFTQW10Jfd-W4CmUAbc9QqnBWdWiT3umiDeHoo49sT9i-UaHty0VlO8L2wyk7XqIdf2IVCNsPsXjC9kOs_wQAAP__8zkRaQ">