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

    <tr>
        <th>Summary</th>
        <td>
            Failure to fold shift amount offset into shift of a constant
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            llvm:optimizations
      </td>
    </tr>

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

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

<pre>
    This was noticed in an internal test:
```
define i32 @src(i32 %0) {
%1:
  %2 = sub i32 %0, 1
  %3 = shl nsw i32 2, %2
  ret i32 %3
}
=>
define i32 @tgt(i32 %0) {
%1:
  %2 = shl nsw i32 1, %0
  ret i32 %2
}
Transformation seems to be correct!
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVUcFunDAQ_RpzsboyNoTlwGFTupfe2vyADWNwZOyVZ2jUfn0NYZsoyqWSZc9o3nvzHpg4_u6eZof8RSMPkdwAI3eB65BvghS05wRITF2Y6Jm4sAdxnL0dwboA3CnJWSUwDUye90bWgsmWs-bx4Mm6_CfCt3kGqZ7javgb4Ssv3yHUK2L2PODLjpIbZOPeUQnoTlfHoqY_CtUz9e0zmzTRf9t8Z6I8TIhPTMgPJp6SDmhjWjS5GDgCLMgpcgN8iCnBkJ2UH75sMXZqbFWrC3Lkobtq59cEG81GP2YvzhLXS1wD8WgtbutDnr4OouU6iwckHahYk-9mohtuqeQ1n8nRvJrTEJfceP_r_ny5pfi8G7o6xBUwF3V1bkUxdxIqU2spTGlUbU19LlsNYwva5rIyTeG1AY8dqx-ZlLuousQbucX92ZNnMcnqvnCdFFKKqlRlmV91ahoJRjzUpRVqHITIvweWHPi0iZximorU7e7MOmEeeoeEb0ON6KYAsG_O-nqlOabux_efbomh2IN0e4q_ilzVzw">