[PartialInliner] Inline vararg functions that forward varargs.
authorFlorian Hahn <florian.hahn@arm.com>
Mon, 13 Nov 2017 10:35:52 +0000 (10:35 +0000)
committerFlorian Hahn <florian.hahn@arm.com>
Mon, 13 Nov 2017 10:35:52 +0000 (10:35 +0000)
commit0e9dec672daa73640cc7f832da9a0dad3c448414
treee93f90807012efe9c8d7b2d4e54c0fb6c592c902
parent070a7ff1adbba5be10e33d0f1462ccc92ed59585
[PartialInliner] Inline vararg functions that forward varargs.

Summary:
This patch extends the partial inliner to support inlining parts of
vararg functions, if the vararg handling is done in the outlined part.

It adds a `ForwardVarArgsTo` argument to InlineFunction. If it is
non-null, all varargs passed to the inlined function will be added to
all calls to `ForwardVarArgsTo`.

The partial inliner takes care to only pass `ForwardVarArgsTo` if the
varargs handing is done in the outlined function. It checks that vastart
is not part of the function to be inlined.

`test/Transforms/CodeExtractor/PartialInlineNoInline.ll` (already part
of the repo) checks we do not do partial inlining if vastart is used in
a basic block that will be inlined.

Reviewers: davide, davidxl, grosser

Reviewed By: davide, davidxl, grosser

Subscribers: gyiu, grosser, eraman, llvm-commits

Differential Revision: https://reviews.llvm.org/D39607

llvm-svn: 318028
llvm/include/llvm/Transforms/Utils/Cloning.h
llvm/include/llvm/Transforms/Utils/CodeExtractor.h
llvm/lib/Transforms/IPO/PartialInlining.cpp
llvm/lib/Transforms/Utils/CodeExtractor.cpp
llvm/lib/Transforms/Utils/InlineFunction.cpp
llvm/test/Transforms/CodeExtractor/PartialInlineVarArg.ll [new file with mode: 0644]