Skip to content

Commit

Permalink
Do not swing down volatile nodes
Browse files Browse the repository at this point in the history
Volatile nodes should always be anchored under a treetop
to avoid any interference with other optimization passes
(e.g. PRE).

Fixes eclipse-openj9/openj9#18777

Signed-off-by: Annabelle Huo <Annabelle.Huo@ibm.com>
  • Loading branch information
a7ehuo committed Mar 6, 2024
1 parent ed9d073 commit 704da43
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions compiler/optimizer/DeadTreesElimination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ static bool isSafeToReplaceNode(TR::Node *currentNode, TR::TreeTop *curTreeTop,
return false;

bool mayBeVolatileReference = currentNode->mightHaveVolatileSymbolReference();
// Do not swing down volatile nodes
if (mayBeVolatileReference)
return false;

// Now scan forwards through the trees looking for the next use and checking
// to see if any symbols in the subtree are getting modified; if so it is not
Expand Down Expand Up @@ -303,8 +306,8 @@ static bool isSafeToReplaceNode(TR::Node *currentNode, TR::TreeTop *curTreeTop,
* => xload/xloadi a.volatileField
* ...
*/
if (mayBeVolatileReference && !canMoveIfVolatile)
return false;
//if (mayBeVolatileReference && !canMoveIfVolatile)
// return false;

if (nodeInSubTree)
{
Expand Down

0 comments on commit 704da43

Please sign in to comment.