-
Notifications
You must be signed in to change notification settings - Fork 2.7k
JIT: avoid folding operations with relocatable immediates #21511
Conversation
Allow full range of compare ops, not just EQ and NE. Closes #21483.
@BruceForstall PTAL
Avoid folding except for EQ/NE. Still no diffs expected (as we'd assert before). |
src/jit/gentree.cpp
Outdated
@@ -15901,7 +15901,7 @@ bool GenTreeIntConCommon::ImmedValCanBeFolded(Compiler* comp, genTreeOps op) | |||
// In general, immediate values that need relocations can't be folded. | |||
// There are cases where we do want to allow folding of handle comparisons | |||
// (e.g., typeof(T) == typeof(int)). | |||
return !ImmedValNeedsReloc(comp) || (op == GT_EQ) || (op == GT_NE); |
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 guard is here because when relocs are involved you can not order the immediates
(i..e. you can't know at compile time if one reloc-ed value is greater or less than another)
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.
As a special case when both the left and right sides are exactly the same reloc then we could fold the other relops (GE, GT, LE and LT), since we know they are Equal
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.
Ah, good point.
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.
Perhaps then just we should bail out if we see non-foldable immediates instead of asserting, and not worry about the special cases.
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.
Looks Good
You should rename this PR from: JIT: broaden set of operators for foldable relocatable immediates |
Can't see the ubuntu failure logs, so will rerun... @dotnet-bot test Ubuntu x64 Checked Innerloop Build and Test adding some r2r legs: @dotnet-bot test Ubuntu x64 Checked r2r_no_tiered_compilation |
Looks like ci got rebooted, so need to request again: @dotnet-bot test Ubuntu x64 Checked Innerloop Build and Test @dotnet-bot test Ubuntu x64 Checked r2r_no_tiered_compilation |
More CI issues... OSX and the Ubuntu arm tests all have msbuild crashes while building tests:
|
Various R2R test legs passed. Am going to ignore the other failures. |
…eclr#21511) In general, don't fold operations on relocatable immediates. Only allow EQ/NE folding, since relocation should preserve identity but not bit values or relative comparisons. Closes dotnet/coreclr#21483. Commit migrated from dotnet/coreclr@6b9e1dc
In general, don't fold operations on relocatable immediates. Only allow EQ/NE as relocation should preserve identity but not bit values or relative comparisons.
Closes #21483.