honggyu.kim added a comment.

In https://reviews.llvm.org/D22666#493109, @rjmccall wrote:

> In https://reviews.llvm.org/D22666#493026, @hfinkel wrote:
>
> > What's the actual desired behavior here? Should the inliner strip out calls 
> > to mcount() as it inlines?
>
>
> I think they basically just want a late pass (as in immediately prior to 
> codegen) to insert the mcount calls.


You're right. I wanted to move mcount insertion phase myself but it seems not 
that simple as I expected because mcount call is inserted in bitcode anyway, 
then can be optimized using `opt` tool to do function inlining later on. In 
this case, function inliner must strip mcount calls at the entry of each 
function.

Otherwise, we shouldn't generate mcount calls inside bitcode so that `opt` can 
simply do function inlining as it does, then code generator, `llc`, has to 
insert mcount just before code generation is done.  I think this is not that 
simple as well.

To sum up, we have two approaches.

1. inliner must strip mcount calls when it does function inlining.
2. `llc` has to insert mcount calls just before code generation.

We have to choose one of these approaches. But I think this patch fixes the 
problem in a simpler way as of now.


https://reviews.llvm.org/D22666



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to