@@ -87,7 +87,12 @@ Compiler::CSEdsc * Compiler::optCSEfindDsc(unsigned index)
87
87
88
88
void Compiler::optUnmarkCSE (GenTreePtr tree)
89
89
{
90
- noway_assert (IS_CSE_INDEX (tree->gtCSEnum ));
90
+ if (!IS_CSE_INDEX (tree->gtCSEnum ))
91
+ {
92
+ // This tree is not a CSE candidate, so there is nothing
93
+ // to do.
94
+ return ;
95
+ }
91
96
92
97
unsigned CSEnum = GET_CSE_INDEX (tree->gtCSEnum );
93
98
CSEdsc * desc;
@@ -230,7 +235,6 @@ Compiler::fgWalkResult Compiler::optUnmarkCSEs(GenTreePtr *pTree, fgWalkDat
230
235
if (tree == op1)
231
236
{
232
237
// This tree and all of its sub trees are being kept
233
- // so we skip marking with GTF_DEAD, etc...
234
238
return WALK_SKIP_SUBTREES;
235
239
}
236
240
@@ -242,20 +246,14 @@ Compiler::fgWalkResult Compiler::optUnmarkCSEs(GenTreePtr *pTree, fgWalkDat
242
246
if (tree == keptTree)
243
247
{
244
248
// This tree and all of its sub trees are being kept
245
- // so we skip marking with GTF_DEAD, etc...
246
249
return WALK_SKIP_SUBTREES;
247
250
}
248
251
}
249
252
250
253
// This node is being removed from the graph of GenTreePtr
251
- // Mark with GTF_DEAD, call optUnmarkCSE and
252
- // decrement the LclVar ref counts.
253
- //
254
- assert ((tree->gtFlags & GTF_DEAD) == 0 );
255
- tree->gtFlags |= GTF_DEAD;
256
-
257
- if (IS_CSE_INDEX (tree->gtCSEnum ))
258
- comp->optUnmarkCSE (tree);
254
+ // Call optUnmarkCSE and decrement the LclVar ref counts.
255
+ comp->optUnmarkCSE (tree);
256
+ assert (!IS_CSE_INDEX (tree->gtCSEnum ));
259
257
260
258
/* Look for any local variable references */
261
259
@@ -1713,13 +1711,8 @@ class CSE_Heuristic
1713
1711
// Assert if we used DEBUG_DESTROY_NODE on this CSE exp
1714
1712
assert (exp->gtOper != GT_COUNT);
1715
1713
1716
- /* Ignore the node if it's part of a removed CSE */
1717
- if (exp->gtFlags & GTF_DEAD)
1718
- continue ;
1719
-
1720
1714
/* Ignore the node if it's not been marked as a CSE */
1721
-
1722
- if (!IS_CSE_INDEX (exp->gtCSEnum ))
1715
+ if (!IS_CSE_INDEX (exp->gtCSEnum ))
1723
1716
continue ;
1724
1717
1725
1718
/* Make sure we update the weighted ref count correctly */
0 commit comments