[PATCH] D32373: [PartialInliner] Do not do partial inlining for functions with non-call references
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 21 14:28:44 PDT 2017
On Fri, Apr 21, 2017 at 2:19 PM, Davide Italiano via Phabricator <
reviews at reviews.llvm.org> wrote:
> davide accepted this revision.
> davide added a comment.
> This revision is now accepted and ready to land.
>
> Yes, I was reducing the same. Some comments, but I had the same fix.
> Are you running with `-O3` or LTO? Where are you putting the inliner?
>
>
O2, but with the following PM change.
Index: lib/Transforms/IPO/PassManagerBuilder.cpp
===================================================================
--- lib/Transforms/IPO/PassManagerBuilder.cpp (revision 300947)
+++ lib/Transforms/IPO/PassManagerBuilder.cpp (working copy)
@@ -465,6 +465,8 @@ void PassManagerBuilder::populateModuleP
MPM.add(createCFGSimplificationPass()); // Clean up after IPCP & DAE
}
+ if (OptLevel > 1)
+ MPM.add(createPartialInliningPass());
// For SamplePGO in ThinLTO compile phase, we do not want to do indirect
// call promotion as it will change the CFG too much to make the 2nd
// profile annotation in backend more difficult.
>
>
> ================
> Comment at: lib/Transforms/IPO/PartialInlining.cpp:89
> + auto canAllUsesBeReplaced = [](Function *F) {
> + std::vector<User *> Users(F->user_begin(), F->user_end());
> + for (User *User : Users) {
> ----------------
> `SmallVector<>` maybe? (up to you)
>
>
> ================
> Comment at: lib/Transforms/IPO/PartialInlining.cpp:96-97
> + Callee = CallSite(II).getCalledFunction();
> + else
> + return false;
> + if (Callee != F)
> ----------------
> Is this bit needed?
> I assume the invariant `F != nullptr` should always hold, at which point
> if we don't set Callee, so `Callee != F` is always true and we return false.
>
Right.
David
> Does it make sense to you?
>
>
> https://reviews.llvm.org/D32373
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170421/6c790bf8/attachment.html>
More information about the llvm-commits
mailing list