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

    <tr>
        <th>Summary</th>
        <td>
            LLVM could avoid calling memcmp when the maximum lenght is 1
        </td>
    </tr>

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

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

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

<pre>
    ```
auto test1(const char* str, unsigned len) {
  auto cmp_len = len == 0 ? 0 : 1;
  return __builtin_memcmp("a", str, cmp_len);
}
```
results in a memcmp call, even though it's almost certainly faster to inline the `memcmp` call, especially when the place where the result is used is available.

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxMUs2OmzAQfprhMtrIDHEcDhyyjXLaXnuNDMyC28Eg_2S7b19BaLeSNWPL-n7m09gY3eCZG9CvoK-FzWmcQ7OMTrz7ZYwp2rn_bOCk9qMuNqcZE8dUAp272ceE3WgD0AVjCkDfMPuNtEdhD1QjmFdQF8QN2U3LXdgjVFfc-3pVCNVtqxcsoXoCAqccPN7vbXaSnL9PPHXTAnQGIgtEq9ouuvMC1U80mOta_zMeOGZJEZ1Hi08m7KzIiuYHe0zjnIcRXQIyEa1M8zobh2Sdl098tzFxwDSj8-I8YxoZ4aR2Uyf1xRYX7pwV-cSPcSNmXMR2vD7DE_h0gy5ijtyv3T6sE9sKH0Bdir6p-rqqbcFNabRRJ1OVVIyNOmvSijpV6XPdHc27NaTOrKv3tidbUeEaUqRVrXSpSl3SoTS6Nlofy5rZMhk4Kp6sk4PIYzrMYShcjJmbclU5FmJblrgtBJHnD9x-17D1tQjNCnpp8xDhqMTFFL9okkvCzdvbj-_YzVl6tI_Z9Vsqzg9_I_-XyGR_uylP6xYM45ZEWeQgzZjSEqG6AN2AboNLY24P3TwB3Vapvb0sYf7JXQK6bQYj0G2f4NHQnwAAAP__YT7lRg">