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

    <tr>
        <th>Summary</th>
        <td>
            [InstCombine] Missing fold for (a << k) ? 2^k * a : 0 --> 2^k * a
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          k-arrows
      </td>
    </tr>
</table>

<pre>
    For convenience, assume k is equal to 1.
https://alive2.llvm.org/ce/z/ADLNfA
```llvm
define i32 @src(i32 noundef %0) {
%1:
  %2 = and i32 noundef %0, 2147483647
  %3 = icmp eq i32 %2, 0
  %4 = shl i32 noundef %0, 1
  %5 = select i1 %3, i32 0, i32 %4
  ret i32 %5
}
=>
define i32 @tgt(i32 noundef %0) {
%1:
  %2 = shl i32 noundef %0, 1
  ret i32 %2
}
Transformation seems to be correct!
```

Original source code:
https://godbolt.org/z/sG973EjvT
```c
unsigned int foo(unsigned int a)
{
  return (a << 1) ? 2 * a : 0;
}

unsigned int bar(unsigned int a)
{
  return 2 * a;
}
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVMuO6jgQ_ZrKpgRyynESFlnwymikeWz6B5zEATeJ3W07tGa-fuQAPUC3dHWvhMBVrlOP40NJ7_XBKFWB2IDYJXIKR-uq00I6Zz980tjun6q2DltrzspoZVoFtEXp_TQqPKH2qN4nOWCwmC6B7YCtjyG8eeBroBqoloM-K1oOw3lcWncAqmOK-l-ger37469-fQFBzi6fGHhxdarXRqHmhJAx71qgMhrGTqZTPQIJBrRCKDbXHCTSWHc2MN4TAt-hNB1-BW6R0qzISp5nxR2EzxDdjm-o3i_FSVAMZ3dR2Rzlj8O3idO7SHGJVINqA-p0LhFjIo7dDjHjDeNUuPnEda5idz3wHfD9d-yEQ_hVdn44xF1D9NTQi5PG99aNMmhr0Cs1-iiFRmFrnVNtAEqfHvhqzt9_O33QRg7o7eTaCOrUZ4-POjrYrrFDuGooysf_tir4_vX88lSgvdiTmbXdoTYBe2uBygeXBFrdxtnczTo5g0ClROBb4JGHyCKvMTKwxuhfIwO-eX6cr1Ub6X6m6rXAN6kfuUu6incrvpKJqtK8TAVPc5Ynx0rlHStK3neNyAQveMGzVdpTlnOV5n3RJboiRpxlqWAZyzO-LJWUTIm-p65clVkLGVOj1MPn_zXR3k-qyikVIhlkowY_Lwsioz5wvgSiuDtcFTGLZjp4yNigffD_Zwk6DPOW-d34sLVjo40CscM_tffaHLC3Q4e9dQ_Mnz6ZB7E_3bOPiwXw_b0_mdxQPSlGh-PULFs7AtXzWrn8LN6cfZ2lWc_9e6B6nu-_AAAA__-J3mEb">