Skip to content

Commit

Permalink
JIT: don't forward sub a volatile read tree via copy (#62224)
Browse files Browse the repository at this point in the history
The copy may not get the same value as the original.
Detect this by looking for `GTF_ORDER_SIDEEFF`.

Closes #62048.
  • Loading branch information
AndyAyersMS committed Dec 2, 2021
1 parent 7b0a6b5 commit 2a80066
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/coreclr/jit/redundantbranchopts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,13 +907,13 @@ bool Compiler::optRedundantRelop(BasicBlock* const block)
continue;
}

// If prevTree has side effects other than GTF_EXCEPT or GTF_ASG, bail,
// If prevTree has side effects, bail,
// unless it is in the immediately preceeding statement.
//
// (we'll later show that any exception must come from the RHS as the LHS
// will be a simple local).
//
if ((prevTree->gtFlags & GTF_SIDE_EFFECT) != (prevTree->gtFlags & (GTF_EXCEPT | GTF_ASG)))
if ((prevTree->gtFlags & (GTF_CALL | GTF_ORDER_SIDEEFF)) != 0)
{
if (prevStmt->GetNextStmt() != stmt)
{
Expand Down

0 comments on commit 2a80066

Please sign in to comment.