Add a comment at the use of RewriteTopLevelComma.
authorPat Gavlin <pagavlin@microsoft.com>
Wed, 13 Jul 2016 00:09:58 +0000 (17:09 -0700)
committerPat Gavlin <pagavlin@microsoft.com>
Wed, 13 Jul 2016 00:09:58 +0000 (17:09 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/969f1cd722d776d83ca3a7db4f0441892ce7a703

src/coreclr/src/jit/rationalize.cpp

index bd9b2893d3ba9456d0005e6207747e213fc0a37f..ba81b876336e4f99bd7256ea9eaf3e0653fe26b0 100644 (file)
@@ -832,12 +832,17 @@ Location Rationalizer::TreeTransformRationalization(Location loc)
 
         while (tree->OperGet() == GT_COMMA)
         {
+            // RewriteTopLevelComma may create a new preceding statement for the LHS of a
+            // top-level comma. If it does, we need to process that statement now.
             Location newLoc = RewriteTopLevelComma(loc);
             if (newLoc.tree != statement)
             {
                 (void)TreeTransformRationalization(newLoc);
             }
 
+            // RewriteTopLevelComma also replaces the tree for this statement with the RHS
+            // of the comma (or the LHS, if the RHS is a NOP), so we must reload it for
+            // correctness.
             tree = statement->gtStmt.gtStmtExpr;
         }