JIT: Remove questionable transformation#95249
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue Detailsnull
|
|
/azp run Fuzzlyn |
|
Azure Pipelines successfully started running 1 pipeline(s). |
src/coreclr/jit/optimizer.cpp
Outdated
There was a problem hiding this comment.
What IR does this create for the example case we were looking at?
There was a problem hiding this comment.
It used to be:
[000002] ----G+----- * CAST long <- int
[000001] n---G+----- \--* IND byte
[000000] H----+----- \--* CNS_INT(h) long 0x7ffa2213f21a static Fseq[s_13]
to
[000002] ----G+----- * NOP byte
[000001] n---G+----- \--* IND byte
[000000] H----+----- \--* CNS_INT(h) long 0x7ffa2213f21a static Fseq[s_13]
Now it's:
[000002] ----G+----- * CAST long <- int
[000001] n---G+----- \--* IND byte
[000000] H----+----- \--* CNS_INT(h) long 0x7ffa22c7f21a static Fseq[s_13]
to
[000002] ----G+----- * CAST int <- byte <- int
[000001] n---G+----- \--* IND byte
[000000] H----+----- \--* CNS_INT(h) long 0x7ffa22c7f21a static Fseq[s_13]
There was a problem hiding this comment.
That's still an illegal transformation in this case since the value was an argument. The new cast does not guarantee widening into the upper 32 bits like the original cast does.
There was a problem hiding this comment.
@jakobbotsch are you suggesting to remove the whole transformation?
There was a problem hiding this comment.
It seems there are two separate questions:
- Who is invoking
optNarrowTreein this way that changes semantics of the program? The transformation is questionable to me but it's because the end result is a change change in behavior -- and this PR still has that problem. - Can we get rid of the weird passthrough
GT_NOP? Yes, and this PR probably accomplishes that, but it seems a better way would be to refactoroptNarrowTreeto take aGenTree**so that it can just replace the use of the cast with the operand in this situation.
I'm more worried about (1) than (2), though it would also be nice to clean up (2).
|
If you are deleting this quirky runtime/src/coreclr/jit/valuenum.cpp Lines 11371 to 11375 in 721c445 and runtime/src/coreclr/jit/rationalize.cpp Lines 252 to 264 in 721c445 |
5ad1f2f to
bbd96d7
Compare
|
/azp run Fuzzlyn |
|
Azure Pipelines successfully started running 1 pipeline(s). |
No description provided.