The prototypes need to match exactly in order to preserve ABI
guarantees. Hypothetically, if we can promote both the callee and the
caller all together, we can do argument promotion, but that is a
separable issue.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Isn't this overly conservative?
define internal void @aaa() { %X = ... %Y = ... call void @bbb(i8 %X, i8 %Y) ret void } define internal void @bbb(i8 %X, i8 %Y) { musttail call void @ccc(i8 %X, i8 %Y) ret void } define internal void @ccc(i8 %X, i8 %Y) { call @use(i8 %X) ret void }
You can totally knock out %Y, right?
Comment Actions
That would be deadargelim, not argument promotion, but that's besides the point.
Yes, if we could teach argument promotion to promote the entire call stack of musttail callers and callees at once, then we could do that transformation.
It might be worth it if we expect functional languages to use this construct widely. For C++, musttail is used with thunks that will either be a) virtual, and therefore not promotable, or b) devirtualized, and more profitable to inline at the call site.
test/Transforms/ArgumentPromotion/tail.ll | ||
---|---|---|
22 | This comment was the reason for my question about it being overly conservative. Could you reword this to be more specific about what we can't do? |
This comment was the reason for my question about it being overly conservative. Could you reword this to be more specific about what we can't do?