[PATCH] D29854: WholeProgramDevirt: Implement importing for uniform ret val opt.

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


pcc added a subscriber: krasin.
pcc added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:1078
+    auto &ResByArg = I->second;
+    // FIXME: We should figure out what to do about the "function name" argument
+    // to the apply* functions, as the function names are unavailable during the
----------------
tejohnson wrote:
> pcc wrote:
> > tejohnson wrote:
> > > The function name should be available for each CallSite in each VirtualCallSite on the CSInfo.CallSites. But would the call sites be from more than one function?
> > These are not the names of the functions containing the call sites but rather the names of the virtual functions being called.
> > 
> > I think we'll probably want to somehow move these remarks into the exporting phase as well.
> Actually, looking at the code I don't understand why we wouldn't be emitting a remark during the exporting phase. DevirtModule::tryUniformRetValOpt will set WasDevirt to true for each Target. That in turn is invoked from tryVirtualConstProp in run() in the part executed on the Export & regular LTO paths, which should cause the function to be added to DevirtTargets for which remarks are emitted.
> 
> What's the difference between the remarks emitted for this case in run(), and the ones issued from within applyUniformRetValOpt?
I believe that there are two separate kinds of remarks.
1. http://llvm-cs.pcc.me.uk/lib/Transforms/IPO/WholeProgramDevirt.cpp#280
2. http://llvm-cs.pcc.me.uk/lib/Transforms/IPO/WholeProgramDevirt.cpp#1221
The first is per call site and mentions the name of one possible target of the virtual call (arbitrarily chosen), and the other is per virtual function and mentions whether any calls to that function have been devirtualized. With this code we will emit the second type of remark during the exporting phase, and the first (with the arbitrary target name missing) during the importing phase.

(@krasin was the original author of the remark code.)


https://reviews.llvm.org/D29854





More information about the llvm-commits mailing list