Skip to content

Commit 2a80066

Browse files
authored
JIT: don't forward sub a volatile read tree via copy (#62224)
The copy may not get the same value as the original. Detect this by looking for `GTF_ORDER_SIDEEFF`. Closes #62048.
1 parent 7b0a6b5 commit 2a80066

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/coreclr/jit/redundantbranchopts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,13 +907,13 @@ bool Compiler::optRedundantRelop(BasicBlock* const block)
907907
continue;
908908
}
909909

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

0 commit comments

Comments
 (0)