Skip to content
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

inlining: Don't inline concrete-eval'ed calls whose result was too large #47371

Merged
merged 1 commit into from
Oct 28, 2022

Conversation

Keno
Copy link
Member

@Keno Keno commented Oct 28, 2022

This undoes some of the choices made in #47283 and #47305. As Shuhei correctly pointed out, even with the restriction to nothrow, adding the extra flags on the inlined statements results in incorrect IR. Also, my bigger motivating test case turns out to be insufficiently optimized without the effect_free flags (which I removed in the final revision of #47305). I think for the time being, the best course of action here is to just stop inlining concrete-eval'ed
calls entirely. The const result is available for inference, so in most cases the call will get deleted. If there's an important case we care about where this does not happen, we should take a look at that separately.

This undoes some of the choices made in #47283 and #47305.
As Shuhei correctly pointed out, even with the restriction to
`nothrow`, adding the extra flags on the inlined statements
results in incorrect IR. Also, my bigger motivating test case
turns out to be insufficiently optimized without the effect_free
flags (which I removed in the final revision of #47305).
I think for the time being, the best course of action here
is to just stop inlining concrete-eval'ed
calls entirely. The const result is available for inference,
so in most cases the call will get deleted. If there's an
important case we care about where this does not happen,
we should take a look at that separately.
@vtjnash
Copy link
Sponsor Member

vtjnash commented Oct 28, 2022

So this effectively reverts #47305? (just confirming understanding). This does seem to make more sense to me than the inlining we were doing.

@Keno
Copy link
Member Author

Keno commented Oct 28, 2022

It does, yes, but the testcase introduced by that PR still works, because now we just don't inline that call at all, so we can still delete it.

@Keno
Copy link
Member Author

Keno commented Oct 28, 2022

I'm gonna go ahead and merge this to fix #47374. We can continue discussing if there's better things to do here post-merge.

@Keno Keno merged commit bbdee0b into master Oct 28, 2022
@Keno Keno deleted the kf/concnoinline branch October 28, 2022 22:23
@vtjnash
Copy link
Sponsor Member

vtjnash commented Oct 28, 2022

It seems like this might even be better, because the non-inlined version might instead have a constant-return calling convention (assuming it was derived from the types, and not the values themselves), and thus avoid doing the computation? And usually not worse (since out-lined code should not take much longer than in-lined)

@Keno
Copy link
Member Author

Keno commented Oct 28, 2022

Yeah, I think it's ok. One of the big reasons for inlining is to do getfield folding, etc., but since we know the constant value, we can already do that. We should be on the lookout for any cases where this causes an issue though.

aviatesk added a commit that referenced this pull request Dec 1, 2022
This keyword argument was introduced by #47305, which was then reverted
by #47371. Now it's dead, so let's remove it.
aviatesk added a commit that referenced this pull request Dec 1, 2022
…arg (#47762)

This keyword argument was introduced by #47305, which was then reverted
by #47371. Now it's dead, so let's remove it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants