[PATCH] D29844: WholeProgramDevirt: Implement importing for single-impl devirtualization.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 8 16:27:25 PST 2017


pcc added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:1057
+    auto *SingleImpl = M.getOrInsertFunction(
+        Res.SingleImplName, Type::getVoidTy(M.getContext()), nullptr);
+    bool IsExported;
----------------
tejohnson wrote:
> pcc wrote:
> > tejohnson wrote:
> > > I forget - is there a constraint that the single implementation function return void and not take any args?
> > The type of the function in the declaration is irrelevant because every call site will cast it to the correct type. Added comment.
> I suppose you could get the correct type then from the IR? Not sure if there is any benefit though...
Not really. The FunctionType of a declaration is completely unused (or at least it ought to be).

There's also not necessarily one "correct" type because there may be multiple call sites and each call site may use a different type for "this".

This is one of the reasons why I would like to see FunctionType removed.


https://reviews.llvm.org/D29844





More information about the llvm-commits mailing list