[PATCH] D24315: [CGP] Be less conservative about tail-duplicating a ret to allow tail calls

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 7 14:23:34 PDT 2016


mkuper created this revision.
mkuper added reviewers: hansw, rnk, iteratee.
mkuper added a subscriber: llvm-commits.

CGP tail-duplicates rets into blocks that end with a call that feed the ret. This puts the call in tail position, potentially allowing the DAG builder to lower it as a tail call. To avoid the tail-duplication in cases where we won't form the tail call, CGP tries to predict whether this is going to be possible, and avoid doing it when lowering as a tail call will definitely fail. However, it was being too conservative by always throwing away calls to functions with a signext/zeroext attribute on the return type.

Instead, we can use the exact same logic the builder itself uses to determine whether the attributes work out.

https://reviews.llvm.org/D24315

Files:
  include/llvm/CodeGen/Analysis.h
  lib/CodeGen/Analysis.cpp
  lib/CodeGen/CodeGenPrepare.cpp
  test/CodeGen/X86/tailcall-cgp-dup.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24315.70595.patch
Type: text/x-patch
Size: 7317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160907/955d4f9c/attachment.bin>


More information about the llvm-commits mailing list