-
Notifications
You must be signed in to change notification settings - Fork 5.3k
JIT: have jit tail call stress avoid creating loops in some cases #73114
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
Conversation
Set `lvHasILStoreOp` on `this` right when the local is created, so that subsequent logic in the JIT sees a consistent value. Fixes dotnet#73090.
|
cc @dotnet/jit-contrib |
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsSet Fixes #73090.
|
|
/azp run runtime-coreclr libraries-jitstress |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This reverts commit f16b045.
|
Bug was different than I thought -- jit stress was creating modifiable Fix is to disallow tail call stress from creating the loop. |
|
/azp run runtime-coreclr jitstress |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| // Avoid setting compHasBackwardsJump = true via tail call stress if the method cannot have | ||
| // patchpoints. | ||
| // | ||
| const bool mayHavePatchpoints = opts.jitFlags->IsSet(JitFlags::JIT_FLAG_TIER0) && | ||
| (JitConfig.TC_OnStackReplacement() > 0) && | ||
| compCanHavePatchpoints(); | ||
| if (passedConstraintCheck && (mayHavePatchpoints || compHasBackwardJump)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks fine to me but I am a bit confused we are marking a backward jump in the first place. We should not do the loop optimization in tier-0 (and, since #41059, never under tailcall stress).
I can clean this up in the future if you don't want to do this as part of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But clearly you had to add special support for OSR due to the tailcall-to-loop optimization, so maybe I am missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you're on to something.
We are probably too aggressive in marking explicit tail calls as backwards branches in Tier0—and more importantly in this case, changing the value of compHasBackwardJump. We do this regardless of optimization flags. If we are never going to do the optimization, then we don't need to change compHasBackwardJump either.
Another possible fix would be that when tail call stress changes an implicit tail call to an explicit one, it should also set compTailPrefixSeen. But it's not as clean of a fix; we might already have added some patchpoints.
|
I'll merge this to fix jitstress. Not sure if I'll have time today to do anything more. |
Don't create a loop via tail call stress if the method didn't already have a loop and could have patchpoints.
Fixes #73090.