[PATCH] D36504: [CodeGenPrepare][WIP] Convert uncond. branch to return into a return to help with shrink-wrapping

Sean Fertile via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 11:37:52 PDT 2017


sfertile added a comment.

In https://reviews.llvm.org/D36504#914216, @kparzysz wrote:

> In https://reviews.llvm.org/D36504#914201, @sfertile wrote:
>
> > Thanks for the feedback. Can you elaborate a bit more on why we wouldn't want to do this in CodeGenPrepare?
>
>
> Generally speaking, CGP is kind of a hack.  We should work to take away from it, not to add to it.  From what I know, the main motivation for CGP was to address some deficiencies of the instruction selection via the selection DAG, so we should at least try to limit it to doing that.


Thanks, I didn't realize that was CGP main motivation.

In https://reviews.llvm.org/D36504#914216, @kparzysz wrote:

> In https://reviews.llvm.org/D36504#914201, @sfertile wrote:
>
> > Thanks for the feedback. Can you elaborate a bit more on why we wouldn't want to do this in CodeGenPrepare?
>
>
> Opportunistically adding simple transformations to where it's convenient, not to where they belong logically is a suboptimal long-term strategy, although it looks appealing in the short term.  Writing an optimization that can create shrink-wrapping opportunities on optimized code is certainly more involved, but will likely provide better results.


Yes, I can appreciate that. Abandoning this patch to address it properly makes sense.

What is people opinion on duplicating the return for the very specific case of enabling a tail-call? I don't think that can be cleaned up inside the selection-dag, and after the selection-dag is too late. Is cgp the best place to address that or is there somewhere better to consider?


Repository:
  rL LLVM

https://reviews.llvm.org/D36504





More information about the llvm-commits mailing list