JonChesterfield wrote: > 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.
Yes, you can and I do. That's patch 2 of the series, numbered 1. in the list > (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. And this is why it's a separate patch. The rewrite-call-instruction is the target dependent bit, in this patch for an initial target. The rewrite-function is (almost) target agnostic and involves a surprisingly large amount of book keeping. We have duplicated code in ArgumentPromotion, dead argument removal, the function cloning in attributor and probably elsewhere. https://github.com/llvm/llvm-project/pull/81058 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits