[PATCH] D39607: [PartialInliner] Inline vararg functions that forward varargs.
Tobias Grosser via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 7 05:24:42 PST 2017
grosser added a comment.
In https://reviews.llvm.org/D39607#917705, @fhahn wrote:
> In https://reviews.llvm.org/D39607#917548, @grosser wrote:
>
> > Also, AFAIKS the outliner will (temporarily) generate invalid IR as the calls to the outlined function won't forward the vararg parameters. This is only "fixed" after inlining, when the va_start() and va_end() intrinsics again refer to the right function. While I don't feel we should "fix" this (e.g., by obtaining and forwarding the necessary parameters to the outlined function), we should certainly document this behavior.
>
>
> Correct. I've added a comment to `doFunctionOutlining`, not sure if that is the right place.
That looks good to me.
> I think we would also have to ensure that `vaend` is also in the outlined function?
Right. Both va_start and va_end need to be in the outlined function -- or more correct -- they cannot be in the part that is not outlined.
================
Comment at: lib/Transforms/IPO/PartialInlining.cpp:835
+ if (const Function *F = CI->getCalledFunction())
+ if (F->getIntrinsicID() == Intrinsic::vastart) {
+ ClonedFunc->replaceAllUsesWith(OrigFunc);
----------------
As suggested by yourself, also check for va_end here.
https://reviews.llvm.org/D39607
More information about the llvm-commits
mailing list