-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Enable constant folding in Tier0 #82412
Conversation
/azp run runtime-coreclr outerloop, runtime-coreclr pgo, runtime-coreclr libraries-pgo |
Azure Pipelines successfully started running 3 pipeline(s). |
@AndyAyersMS @jakobbotsch PTAL |
@@ -12853,6 +12850,14 @@ GenTree* Compiler::gtFoldExpr(GenTree* tree) | |||
return tree; | |||
} | |||
|
|||
// NOTE: MinOpts() is always true for Tier0 so we have to check explicit flags instead. | |||
// To be fixed in https://github.com/dotnet/runtime/pull/77465 | |||
const bool tier0opts = !opts.compDbgCode && !opts.jitFlags->IsSet(JitFlags::JIT_FLAG_MIN_OPT); |
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.
We have an explicit Tier0 flag, why not check this?
tree = gtFoldExpr(tree); | ||
if (opts.OptimizationEnabled()) | ||
{ | ||
tree = gtFoldExpr(tree); |
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.
For the gtFold...
seems like we should have a consistent pattern we use -- either the caller or the callee should check if optimizations are enabled, but not both?
Maybe this is covered in your opt levels PR?
Linking to #9120. |
@AndyAyersMS thanks! Merging to make it to Preview2. I'll indeed clean up the checks in #77465 |
Failure is #82397 |
From what I see so far that we should mainly focus on two things in Tier0 (except for debug-friendly code):
(purple for methods with CEEInfo:: - VM stuff)
Example of a code this PR improves in Tier0:
was:
now:
Two notes:
SplitCriticalEdges
used to assume edges couldn't be folded away unless we optimize and instrumentCLFLG_CONSTANTFOLD
is removed as not useful - there are tons of places where it's not checked anyway