<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/137582>137582</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[CVP] Miscompilation at -O3
</td>
</tr>
<tr>
<th>Labels</th>
<td>
miscompilation,
llvm:optimizations,
generated by fuzzer
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
dtcxzyw
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dtcxzyw
</td>
</tr>
</table>
<pre>
Reproducer: https://alive2.llvm.org/ce/z/x4KrLX
```
----------------------------------------
define i8 @func_124(i16 %.promoted) {
entry:
%inc20.i = or i16 %.promoted, 1
%conv.i.i = trunc i16 %inc20.i to i8
%narrow.i.i.i = smin i8 %conv.i.i, 0
assume_welldefined i8 %narrow.i.i.i
%tobool.not.i46 = icmp eq i16 %.promoted, 0
br i1 %tobool.not.i46, label %func_127.exit, label %land.rhs.i47
land.rhs.i47:
br label %func_127.exit
func_127.exit:
%conv5.i.i.pn.in = phi i8 [ %narrow.i.i.i, %entry ], [ 0, %land.rhs.i47 ]
ret i8 %conv5.i.i.pn.in
}
=>
define i8 @func_124(i16 %.promoted) {
entry:
%inc20.i = or i16 %.promoted, 1
%conv.i.i = trunc nsw nuw i16 %inc20.i to i8
%narrow.i.i.i = smin i8 %conv.i.i, 0
assume_welldefined i8 %narrow.i.i.i
%tobool.not.i46 = icmp eq i16 %.promoted, 0
br i1 %tobool.not.i46, label %func_127.exit, label %land.rhs.i47
land.rhs.i47:
br label %func_127.exit
func_127.exit:
%conv5.i.i.pn.in = phi i8 [ %narrow.i.i.i, %entry ], [ 0, %land.rhs.i47 ]
%#range_0_%conv5.i.i.pn.in = !range i8 %conv5.i.i.pn.in, i8 128, i8 1
ret i8 %#range_0_%conv5.i.i.pn.in
}
Transformation doesn't verify!
ERROR: Source is more defined than target
Example:
i16 %.promoted = #x0080 (128)
Source:
i16 %inc20.i = #x0081 (129)
i8 %conv.i.i = #x81 (129, -127)
i8 %narrow.i.i.i = #x81 (129, -127)
i1 %tobool.not.i46 = #x0 (0)
>> Jump to %land.rhs.i47
>> Jump to %func_127.exit
i8 %conv5.i.i.pn.in = #x00 (0)
Target:
i16 %inc20.i = #x0081 (129)
i8 %conv.i.i = poison
i8 %narrow.i.i.i = poison
void = UB triggered!
Summary:
0 correct transformations
1 incorrect transformations
0 failed-to-prove transformations
0 Alive2 errors
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsVl2P8jYT_TXDjUXkTBISLnIRYLl431ZPtf1Q71YmccBVYqe2w9evr-yEBZZlVbXSc9XVSoDnnPHM8bE1zBixlZznkCwAsbLl8Xw6ACIkqwnr7U7pfFycbFR1yl95p1XVl1xDVJCdtZ2BqABcA65ZI_Ycg6bZt4HSW8B1yQHXZ8D1Mf6__uF3oAXM6PhPC6DF9G_-AS0qXgvJicgIxLTuZfkWYgyYiXBGAJOg06pVlleAcwLpAmjBpdUnVx0tiIMIWSINBIFoRZQmj8QlCR0WMCmV3AdixFrdy_ICvySxiojsklkyrdXBEUaKaYX0pV5TufTUE5gxfcvfDrxphqaqEXqb5pLaqo1STSCVDUQ888lF2XaE__lpA8MOG9fdI9sBGrbhjQuNEqYBPwp7F2mYrAK9M4GI0-GY7lZGQTf6WS5PuV8aOKMaie-wk4GQvp9uJ7wAyeJBBFy6JX-QBJKV_50sCB0Dt3X5OC2I5vZG-Zu9XF2pg0C0gujlu1rqiaekORDZH_7z1r23_oG1vo-33DpgpJnc8jf69mRPwNAjntgQly4QYnb55jNfbfvlBu8m_kUzaWqlW2aFkqRS3EjA1JI916I-AYaDWC-vr99e3Vv9s-p1yYkwpFWak4s77I5JYpne8lHdlyNru4YPun60wdhfdKQ0owQw823MB-awwx3x9n6MtHCgzQfavY_fcTeoJZmGmN6iH27EV4xPrHqtxlHoACTuSYheyP_6tnMX8NGr5BPIR3d-euI33d9s6M5wkP3fCtYpYZR8Ls97fK_EcIK_LojVYrvl2t3s0SnuBPu2Zd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