[clang] [llvm] [transforms] Inline simple variadic functions (PR #81058)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 12 12:02:02 PST 2024


https://github.com/efriedma-quic commented:

I don't really like the whole "sufficiently simple function" thing.  It seems fragile.  You should be able to just take a arbitrary internal varargs function, rewrite its signature to take a va_list argument, rewrite calls to va_start to make a copy of that va_list, and rewrite the callers to construct that va_list.  If that function turns out to be inlinable, great; if not, you haven't really lost anything.

(Rewriting the signature of a function is complicated in its own way because you need to allocate a new Function, then transplant the original function's body into it.  But it's not uncharted territory: we should be able to refactor code out of llvm/lib/Transforms/IPO/ArgumentPromotion.cpp .)

-----

Do we have a testing plan for this?  Messing up calling convention stuff tends to lead to extremely subtle bugs.

https://github.com/llvm/llvm-project/pull/81058


More information about the cfe-commits mailing list