[PATCH] D39356: [ThinLTO] Fix missing call graph edges for calls with bitcasts.

Volodymyr Sapsai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 27 10:31:07 PDT 2017


vsapsai added inline comments.


================
Comment at: llvm/lib/Analysis/ModuleSummaryAnalysis.cpp:251
+          CalledFunction = dyn_cast<Function>(CalledValue);
+      }
       // Check if this is an alias to a function. If so, get the
----------------
mehdi_amini wrote:
> Isn't it enough to just replace ` auto *CalledValue = CS.getCalledValue();` with ` auto *CalledValue = CS.getCalledValue()->stripPointerCastsNoFollowAliases();` ?
Not enough. `CalledValue` will be what we want (and hopefully it won't be NULL) but `ImmutableCallSite CS` will still use callee with pointer cast and `CalledFunction` will be NULL.

Another approach can be adding `stripPointerCastsNoFollowAliases` to `ImmutableCallSite` or `CallSiteBase`. Or we can introduce another type of call site and add it there. I don't know if stripping casts will be useful or harmful in other places, for this I rely on people who are more familiar with this code.


https://reviews.llvm.org/D39356





More information about the llvm-commits mailing list