<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - [InstCombine] Instcombine deletes call of 'new' function that has side effects after r325630"
href="https://bugs.llvm.org/show_bug.cgi?id=36476">bug 36476</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - [InstCombine] Instcombine deletes call of 'new' function that has side effects after r325630"
href="https://bugs.llvm.org/show_bug.cgi?id=36476#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - [InstCombine] Instcombine deletes call of 'new' function that has side effects after r325630"
href="https://bugs.llvm.org/show_bug.cgi?id=36476">bug 36476</a>
from <span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span></b>
<pre>C++ [expr.new]p10 (<a href="http://eel.is/c++draft/expr.new#10">http://eel.is/c++draft/expr.new#10</a>) explicitly permits this
optimization:
"An implementation is allowed to omit a call to a replaceable global allocation
function ([new.delete.single], [new.delete.array]). When it does so, the
storage is instead provided by the implementation"
If you want to observe side-effects of your '::operator new(size_t)'
implementation (eg, when writing tests for your allocator), you need to make a
regular function call, rather than using a new-expression. LLVM will not delete
the 'operator new' call here:
S *s = new (::operator new(sizeof(S))) S;</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>