Skip to content

Conversation

@kunalspathak
Copy link
Contributor

@kunalspathak kunalspathak commented Feb 22, 2021

Sometimes, we have degenerate flow involving 2 blocks A and B such that A->jumpDst == B as well as A->bbNext == B. In such case we should merge the assertions of out edges from both flows into the B's in edge. Eventually we want to avoid generating such flows in redundant branch optimization. See #48609.

Thanks Andy for help identify the root cause.

Fixes: #47101

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Feb 22, 2021
@kunalspathak kunalspathak marked this pull request as ready for review February 23, 2021 01:16
@kunalspathak
Copy link
Contributor Author

@dotnet/jit-contrib , @AndyAyersMS

@kunalspathak
Copy link
Contributor Author

Copy link
Contributor

@briansull briansull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good

Copy link
Member

@AndyAyersMS AndyAyersMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you get a chance to look at other merges to see if any of them might be impacted by the same problem?

{
pAssertionOut = mJumpDestOut[predBlock->bbNum];

if (dupCount > 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This deserves a comment and some extra jit dump output, since it is an unusual case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Added.

@kunalspathak
Copy link
Contributor Author

Did you get a chance to look at other merges to see if any of them might be impacted by the same problem?

Are you asking about CSE? Apart from AssertionProp, that's the only one that uses DataFlow and perform Merge. For CSE, I didn't see logic where we chose which edge to merge so I think it should be fine.

If you meant something else, can you please clarify other phases that does similar thing and I will double check.

@AndyAyersMS
Copy link
Member

Did you get a chance to run diffs for this? Curious if it popped up anywhere else, and why we didn't notice it, if so.

@kunalspathak
Copy link
Contributor Author

Did you get a chance to run diffs for this? Curious if it popped up anywhere else, and why we didn't notice it, if so.

Yes, I ran libraries.pmi, tests and benchmarks superpmi collection and found no asmdiff. The original issue was in R2R with jitstress flag. While investigating, I tried to repro using JIT, reduce jitstress flags, etc. but none of them helped in reproing so I believe that it took a unique combination of things to get to this, so "no asm diff" don't surprise me.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failed: JIT\\Directed\\cmov\\Float_And_Op_cs_ro\\Float_And_Op_cs_ro.cmd

4 participants