[cfe-dev] [LLVMdev] Clang devirtualization proposal

Piotr Padlewski prazek at google.com
Thu Jul 23 11:42:41 PDT 2015


HI,
Yep, our proposal doesn't cover it, because this load ; icmp ; assume; will
land global initilizer function, and main will not see it.
At least if foo would be called multiple times, then we would only have one
load from vtable, but unfortunatelly we will not be able to inline, or make
direct call to it with this approach.
I think that this case is rare enough to solve it right now.

Piotr

On Thu, Jul 23, 2015 at 10:30 AM, Geoff Berry <gberry at codeaurora.org> wrote:

> Hi Piotr,
>
>
>
> You may be interested in a recent patch I posted:
> http://reviews.llvm.org/D11043
>
> This patch addresses a de-virtualization case that I’m not sure would be
> handled by your current proposal, namely that of a virtual call where the
> ‘this’ object is a global variable.
>
> For example:
>
>
>
> struct A {
>
>   A();
>
>   virtual void foo();
>
> };
>
> void g(A * a) {
>
>   a->foo();
>
> }
>
>
>
> A a;
>
> int main() {
>
>   g(&a);
>
> }
>
>
>
> It might be worth considering if your approach could be extended to handle
> this case.
>
>
>
> --
>
> Geoff Berry
>
> Employee of Qualcomm Innovation Center, Inc.
>
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux
> Foundation Collaborative Project
>
>
>
> *From:* llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] *On
> Behalf Of *Piotr Padlewski
> *Sent:* Wednesday, July 22, 2015 5:56 PM
> *To:* cfe-dev at cs.uiuc.edu Developers; llvmdev at cs.uiuc.edu
> *Subject:* [LLVMdev] Clang devirtualization proposal
>
>
>
> Hi folks,
>
> this summer I will work with Richard Smith on clang devirtualization.
> Check out our proposal:
>
>
>
>
> https://docs.google.com/document/d/1f2SGa4TIPuBGm6y6YO768GrQsA8awNfGEJSBFukLhYA/edit?usp=sharing
> <https://urldefense.proofpoint.com/v2/url?u=https-3A__docs.google.com_document_d_1f2SGa4TIPuBGm6y6YO768GrQsA8awNfGEJSBFukLhYA_edit-3Fusp-3Dsharing&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=-sGvXxkjadRLtXcTi4kOVPumoH-0XOKmk_vgUTcYugY&s=hHoo6tgC-NooXdIwbBwT_D8sIw8fcYF4XvBRI8Lr9Eg&e=>
>
>
>
> And modified LangRef
>
> http://reviews.llvm.org/D11399
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D11399&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=-sGvXxkjadRLtXcTi4kOVPumoH-0XOKmk_vgUTcYugY&s=L6_vdinD06uAwgm4OJGL5QxKw8Tzfa_4DxPwf3Zj704&e=>
>
>
>
> You can also check out previous disscussion that was started before our
> proposal was ready -
> http://lists.cs.uiuc.edu/pipermail/cfe-dev/2015-July/044052.html
>
>
>
> Regards
>
> Piotr Padlewski
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150723/2a5bd832/attachment.html>


More information about the cfe-dev mailing list