<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64535>64535</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang: missed optimazation for an empty string
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
diamante0018
</td>
</tr>
</table>
<pre>
When initializing a std::string with "" (empty) clang misses the opportunity to optimize a lot of code away.
In a real example we came across when examing a function from libc++ with @philnik777 we found the loss can be quite substantial
God bolt demo:
https://godbolt.org/z/f8av3EYbn
I opened this issue as advised by philnik777
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcktGO2ywQhZ8G34w2wuPYIRe-yGp__9onqHo5wCSmxeAavGny9BX2Slv1BsQAR9_MOZSSuwXmXrSvon2raM1jXHrraKKQWcpaVTraR_9t5AAuuOzIu6cLNyBI2YrmIppLykup3F0eQSAKRBCoeJrzQ-AZjKdwg8mlxAnyyBDnOS55DS4_IEeIc3aTezIQ-JghXsFEy0B3ehyEfBPy8h6AYGHywL9pmj3DncHQxEBmiSnBveCVu53sugaTXQxwXeIE3mkj8FXg6yfiUc6j88H9PJ1OReka12A3Ml_EDAXQDL9WlxnSqlOmUPreWfb1_2hBR5_B8hTLFLbqmPOcygkHgcMt2vLkEJebwOEpcLgq-mj--67D31LvEGcOXABcApfSykAJyH64xBb0A75oK9s39tycqeK-7s51W0vVqGrsO23k8XxGg1Yh4sko2-mOa3VsNcq2rlyPEhuppKo7earV4diyUde2rtGy6ppOHCVP5PzB-4-pMFcbSt8d26atPGn2aYsJYuD7zlnMbt-qpS9_XvR6S-IovUs5falklz33WwZEc9ljYHfP6Um7S3EBCrAFBvYwVevi-3_G6fK46oOJk8ChyH9uL_MSf7DJAocNKgkcNug_AQAA__9eye9e">