[PATCH] Detect deallocation calls even if the deallocation function has a definition

Richard Smith richard at metafoo.co.uk
Wed Jan 14 17:02:04 PST 2015

On Mon, Dec 15, 2014 at 5:01 PM, Philip Reames <listmail at philipreames.com>

> On 12/04/2014 04:11 PM, Richard Smith wrote:
> When Clang emits a call to a C++14 sized deallocation function, it emits a
> weak definition of that function in case the underlying C++ ABI library
> doesn't provide it:
>    call _ZdlPvm(i8* %p, i64 8) builtin
>  // ...
>    define linkonce void @_ZdlPvm(i8* %p, i64) nobuiltin {
>     call void @_ZdlPvm(i8* %p)
>     ret void
>   }
>  However, LLVM's detection of deallocation functions is broken by this:
> it assumes that if we have a definition of the deallocation function, then
> it's not really a deallocation function. I'm not sure why this is the case.
> The check was added in response to this review comment:
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091102/090282.html
>  The attached patch removes this condition (and thus avoids the
> optimization regression in C++14 mode), but I'm wary about removing a check
> that I don't understand, so I was wondering if anyone knew the
> justification for having this test?
> Reading over the review comment, the point of the comment in question was
> how to do the comparison of the call's target against the free function.  I
> suspect the declaration check was accidental.

Me too, thanks. Committed as r226069.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150114/5d8f4fcd/attachment.html>

More information about the llvm-commits mailing list