[PATCH] D130374: [Passes] add a tail-call-elim pass near the end of the function simplification pipeline

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 22 11:21:34 PDT 2022


spatel created this revision.
spatel added reviewers: nikic, efriedma, hiraditya.
Herald added subscribers: ormris, wenlei, steven_wu, mcrosier.
Herald added a project: All.
spatel requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

We call tail-call-elim near the beginning of the pipeline, but that is too early to annotate calls that get added later.

In the motivating case from issue #47852 <https://github.com/llvm/llvm-project/issues/47852>, the missing 'tail' on memset leads to sub-optimal codegen.

I experimented with removing the early instance of tail-call-elim instead of just adding another pass, but that appears to be slightly worse for compile-time: +0.15% vs. +0.08% time.
"tailcall" shows adding the pass; "tailcall2" shows moving the pass to later, then adding the original early pass back (so 1596886802 is functionally equivalent to 180b0439dc ):
https://llvm-compile-time-tracker.com/index.php?config=NewPM-O3&stat=instructions&remote=rotateright


https://reviews.llvm.org/D130374

Files:
  llvm/lib/Passes/PassBuilderPipelines.cpp
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-postlink-samplepgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
  llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll
  llvm/test/Transforms/LoopVectorize/X86/float-induction-x86.ll
  llvm/test/Transforms/PhaseOrdering/X86/loop-idiom-vs-indvars.ll
  llvm/test/Transforms/PhaseOrdering/memset-tail.ll
  llvm/test/Transforms/PhaseOrdering/single-iteration-loop-sroa.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130374.446907.patch
Type: text/x-patch
Size: 7525 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220722/663d5dd8/attachment.bin>


More information about the llvm-commits mailing list