[cfe-dev] Devirtualization of calls

Matthieu Monrocq matthieu.monrocq at gmail.com
Sun Sep 4 05:01:46 PDT 2011


Hello,

I have been trying to pinpoint the place where the direct/virtual call was
decided, however I must admit I failed.

I have tracked down the two following functions:
> canDevirtualizeMemberFunctionCalls  in  CodeGen/CGExprCXX.cpp:108
> canDevirtualizeMemberFunctionCall  in  CodeGen/CGClass.cpp:1625

which are nigh identical (and I do wonder why there are two of them, with
the exact same comments).

However, even though the first is used, it systematically returns "false"
(bottom of the function, after all checks have failed) whether or not the
call ends up devirtualized in my test cases.

I was wondering if this optimization, therefore, was realized at IR level
(LLVM realizing that the vptr is known statically and thus dereferencing it
automatically..., but it does not really looks so).

I would appreciate if anyone could direct me to the appropriate portion of
the code.

-- Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110904/e9d255e5/attachment.html>


More information about the cfe-dev mailing list