Skip to content
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

Move removal of exception edges to before collecting fixable predecessors #6576

Merged

Conversation

a7ehuo
Copy link
Contributor

@a7ehuo a7ehuo commented Jun 17, 2022

Blocks could have been removed when the exception edges
of an empty goto block are removed. The removal should
take place before the IN edges are saved in fixablePreds.

Fixes: eclipse-openj9/openj9#15305

Signed-off-by: Annabelle Huo Annabelle.Huo@ibm.com

@a7ehuo
Copy link
Contributor Author

a7ehuo commented Jun 17, 2022

@jdmpapin May I ask you to review this change? Thanks!

compiler/optimizer/LocalOpts.cpp Outdated Show resolved Hide resolved
compiler/optimizer/LocalOpts.cpp Outdated Show resolved Hide resolved
compiler/optimizer/LocalOpts.cpp Outdated Show resolved Hide resolved
@jdmpapin
Copy link
Contributor

Come to think of it, while block will remain reachable and will still have predecessors, we have no guarantee that there will be any remaining fixablePreds. It might be more straightforward to just remove the exception successors before collecting the fixablePreds, e.g. right after determining the value of containsTreesOtherThanGoto:

if (!containsTreesOtherThanGoto && !block->getExceptionSuccessors().empty())
   {
   // Structure repair doesn't deal well with exception successors in this case.
   if (!performTransformation("...", ...))
      continue; // the exception successors remain, so skip this block

   TR::CFGEdgeList &excSuccs = block->getExceptionSuccessors();
   while (!excSuccs.empty())
      cfg->removeEdge(excSuccs.front());
   }

That way, fixablePreds would never get out of date

@a7ehuo
Copy link
Contributor Author

a7ehuo commented Jun 20, 2022

e.g. right after determining the value of containsTreesOtherThanGoto

If the removal of exception edges is put right after determining the value of containsTreesOtherThanGoto, the exception edges could be removed from a block that doesn't proceed to be removed later on, because of the code like below could skip this block after the removal:

if (block->getPredecessors().empty())
continue;
if (block->isLoopInvariantBlock())
continue;
TR::Block *destBlock = block->getSuccessors().front()->getTo()->asBlock();
if (destBlock == block)
continue; // No point trying to "update" predecessors

@jdmpapin Would it be an issue to remove the exception edges if the block contains only goto and the block is not removed? just double checking, although I don't think it's gonna be an issue.

If there is no issue, I plan to move the removal of exception edges right before updating fixablePreds so that if the block is not removed for any reason before updating fixablePreds, we don't need to remove its exception edge.

…sors

Blocks could have been removed when the exception edges
of an empty goto block are removed. The removal should
take place before the IN edges are saved in `fixablePreds`.

Fixes: eclipse-openj9/openj9#15305

Signed-off-by: Annabelle Huo <Annabelle.Huo@ibm.com>
@a7ehuo a7ehuo force-pushed the redundantGotoElimination-fix-removedBlock branch from 0afd655 to 4cf26fa Compare June 21, 2022 00:55
@a7ehuo
Copy link
Contributor Author

a7ehuo commented Jun 22, 2022

@jdmpapin Updated the implementation to move the removal of exception edges right before updating fixablePreds in 4cf26fa. Ready for another review. Thanks!

@jdmpapin
Copy link
Contributor

@jdmpapin Would it be an issue to remove the exception edges if the block contains only goto and the block is not removed? just double checking, although I don't think it's gonna be an issue.

No, there's no issue. A block consisting only of goto (and possibly asynccheck) will not throw, so all of its outgoing exception edges are dead, and those edges can be removed regardless of anything else

@jdmpapin
Copy link
Contributor

Jenkins build all

@a7ehuo a7ehuo changed the title Remove the edges that have removed blocks from the list Move removal of exception edges to before collecting fixable predecessors Jun 22, 2022
@a7ehuo
Copy link
Contributor Author

a7ehuo commented Jun 22, 2022

Updated the PR title and description to reflect the final change that moves the removal of exception edges right before updating fixablePreds

@jdmpapin
Copy link
Contributor

The zos build hit an infrastructure failure:

ERROR: Error cloning remote repo 'origin'

Jenkins build zos

@jdmpapin
Copy link
Contributor

The PPC Linux failure is #6556. That bug is supposed to be intermittent, so I'm restarting the job in the hope that it will pass and allow the other tests to run

Jenkins build plinux

@jdmpapin
Copy link
Contributor

Jenkins build plinux

1 similar comment
@jdmpapin
Copy link
Contributor

Jenkins build plinux

@jdmpapin
Copy link
Contributor

jdmpapin commented Jun 22, 2022

The failure is still just #6556. It keeps happening here, but it's unrelated (known prior) to this PR. Merging

@jdmpapin jdmpapin merged commit 9d1a0dd into eclipse:master Jun 22, 2022
@jdmpapin
Copy link
Contributor

Forgot to approve before merging and can't add my approval now. Please take this comment as my approval ✔️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JDK8 Segmentation error with vmState=vmState=0x000522ff
2 participants