Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Fold "cns"[cns] for ROS<char> #78593
Fold "cns"[cns] for ROS<char> #78593
Changes from 3 commits
c0abbd7
92a9e38
e12b055
f030653
093fd77
022e744
369179d
548fad8
37dadee
fc6f592
b406c17
8f7f144
0c8a8cc
53cbfe8
f7d9b29
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Why are we interested in
TYP_SHORT
(signed) trees, since I assume this is a TP heuristic?This shouldn't have to recompute
addrVN
+GetVNFunc
, since the caller already did that.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.
@SingleAccretion can you point me where exactly caller already did it? it seems like other paths also compute it
runtime/src/coreclr/jit/valuenum.cpp
Lines 8838 to 8853 in b406c17
Changed to TYP_SHORT (yes, it was a TP fast-out path)
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.
else if (vnStore->GetVNFunc(addrNvnp.GetLiberal(), &funcApp)
computes it. It would be good to change this to compute the thing once likeASG
numbering does.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.
do you mind if I leave it as is, I've just pushed a change to extract vnfunc only after TP-oriented checks. I tried to re-organize code to save these two existing lookups and didn't like the outcome, feel free to file a PR to clean it up
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.
Sure.
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.
It is not right to update side effects in VN like that. The problem this solves should be solved in some other way.
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.
@SingleAccretion Any recommendation and what's wrong with it? Unfortunately, I don't see a better option and this is required for this PR.
Alternative option I see is to define a new VN with "known-non-null" property and then fold it later e.g. at assertprop.
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.
From the discussion yesterday - did making VN-based constant propagation run in post-order not work?
It's not in VN's contract to modify IR like this. Certainly, if you allow this, all sorts of things become possible (for example, here we would just bash the node to a
CNS_INT
directly).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.
Thanks! Reverted the change, the suggestion about post-order works but I decided to postpone it to a separate PR so I can see if it worth the effort around TP and diffs (and planned a few experiments around that) so this PR does fold all the patterns I wanted it to, but might leave nullchecks in some cases.