-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove the ability for codegen to compute specialized call sites #16692
Conversation
3c1dfcd
to
e5c827e
Compare
This passed CI (with tests added), so is there any objection to merging it? |
This definitely seems like the right direction to go, but adding any new expression deserves a lot of thought, especially for something as important as function calls. For example, we could use Also I think I'm missing something --- why does calling get_specialization from the inlining pass not lead to the same recursion as calling it from codegen? |
The inlining pass prohibits itself from inferring anything new
I considered something like that, but as long as it's a special object, why not give it a name? The other option I considered was some wrapper thing like |
I thought a bit about using metadata for this. It kind of makes sense, since you're sort of adding a hint to a call site that says "by the way, I've already looked up the target for this and here it is". On the other hand a compiler bug fix shouldn't depend on metadata :)
I believe |
The current
It doesn't. Deleting the optimization from codegen fixes the bug. Adding metadata hints during inference simply makes sure that performance isn't affected. |
Could you split the change to |
Will also need devdocs update. |
@carnaval - would like your opinion on how to represent direct calls in the IR. |
Another thought: a mechanism like this can also be used for hoisting dispatch lookup (#12219 (comment)), so we might want to take that into account in the design. |
17dea77
to
85c7d0e
Compare
Expr(:invoke, LambdaInfo, call-args...) is a more primitive form of Expr(:call) for which the dispatch logic has been pre-determined this is not used by lowering, but is used by inference to allowing moving of this logic out of codegen also fix the tfunc for kwfunc, since it was all munged up and making the invoke inlining unhappy also fixes a number of bugs caused by deleting code not preserving various invariants or not testing correctly for them also fixes a number of bugs that have accumulated in --compile=all operation since that configuration stopped being tested on CI
Just a minor note - there's one exception to this in |
The new
Expr(:invoke)
has a similar structure toExpr(:call)
, but where the first entry in the args array is the exact LambdaInfo to callInference has already computed this direct-call information, so it's a net-code deletion to handle it there, so that codegen can be dumber.