-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Generate non-null assertion for byrefs if we can't find corresponding refs #21944
Generate non-null assertion for byrefs if we can't find corresponding refs #21944
Conversation
Framework x64 diffs:
|
Regressions are caused either by exceeding the max number of assertions or by downstream register allocation differences. |
Example of a good dff:
|
@briansull @dotnet/jit-contrib PTAL |
Aside: Annotating the code block with G_M43163_IG01:
sub rsp, 40
nop
G_M43163_IG02:
mov rax, gword ptr [rcx+8]
mov rax, gword ptr [rax+104]
mov edx, dword ptr [rcx+32]
cmp edx, dword ptr [rax+8]
jae SHORT G_M43163_IG04
movsxd rdx, edx
shl rdx, 5
lea rax, bword ptr [rax+rdx+16]
- mov rdx, gword ptr [rax]
+ mov rax, gword ptr [rax]
- mov rcx, gword ptr [rax+8]
- mov rcx, gword ptr [rax+16]
- movzx rax, byte ptr [rax+24]
- mov rax, rdx
G_M43163_IG03:
add rsp, 40
ret
G_M43163_IG04:
call CORINFO_HELP_RNGCHKFAIL
int3
-; Total bytes of code 62, prolog size 5 for method AnonymousTypePropertyPublicSymbol:get_Name():ref:this
+; Total bytes of code 47, prolog size 5 for method AnonymousTypePropertyPublicSymbol:get_Name():ref:this |
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
@@ -957,7 +957,7 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1, | |||
} | |||
} | |||
|
|||
if (fgIsBigOffset(offset) || (vnStore->TypeOfVN(vn) != TYP_REF)) |
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.
You also should update the comment on line: 926:
// so only make non-null assertions about GC refs
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.
Done.
… refs. When we have a non-null fact about a byref, we try to find the corresponding ref and generate an assertion about the ref. Then it can be used on byrefs if the offset is not too big. We use both trees and value numbers to find the ref. When the ref wasn't found we bailed on generating the assertion. I found that we get a number of good diffs if we generate assertions for byrefs when refs can't be found so this change enables that.
293bca2
to
cb05aa8
Compare
When we have a non-null fact about a byref, we try to find the corresponding
ref and generate an assertion about the ref. Then it can be used on byrefs if the offset is not too big.
We use both trees and value numbers to find the ref. When the ref wasn't found we bailed on generating
the assertion.
I found that we get a number of good diffs if we generate assertions for byrefs when refs can't be found
so this change enables that.