File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -4035,16 +4035,10 @@ PhaseStatus Compiler::optUnrollLoops()
4035
4035
}
4036
4036
#endif
4037
4037
4038
- #ifdef DEBUG
4039
- if (verbose)
4040
- {
4041
- printf (" *************** In optUnrollLoops()\n " );
4042
- }
4043
- #endif
4044
-
4045
4038
/* Look for loop unrolling candidates */
4046
4039
4047
4040
bool change = false ;
4041
+ bool anyIRchange = false ;
4048
4042
bool anyNestedLoopsUnrolled = false ;
4049
4043
INDEBUG (int unrollCount = 0 ); // count of loops unrolled
4050
4044
INDEBUG (int unrollFailures = 0 ); // count of loops attempted to be unrolled, but failed
@@ -4273,6 +4267,11 @@ PhaseStatus Compiler::optUnrollLoops()
4273
4267
}
4274
4268
// clang-format on
4275
4269
4270
+ // After this point, assume we've changed the IR. In particular, we call gtSetStmtInfo() which
4271
+ // can modify the IR. We may still fail to unroll if the EH region conditions don't hold, if
4272
+ // the size heuristics don't succeed, or if cloning any individual block fails.
4273
+ anyIRchange = true ;
4274
+
4276
4275
// Heuristic: Estimated cost in code size of the unrolled loop.
4277
4276
4278
4277
{
@@ -4544,6 +4543,8 @@ PhaseStatus Compiler::optUnrollLoops()
4544
4543
4545
4544
if (change)
4546
4545
{
4546
+ assert (anyIRchange);
4547
+
4547
4548
#ifdef DEBUG
4548
4549
if (verbose)
4549
4550
{
@@ -4588,7 +4589,7 @@ PhaseStatus Compiler::optUnrollLoops()
4588
4589
fgDebugCheckBBlist (true );
4589
4590
#endif // DEBUG
4590
4591
4591
- return PhaseStatus::MODIFIED_EVERYTHING;
4592
+ return anyIRchange ? PhaseStatus::MODIFIED_EVERYTHING : PhaseStatus::MODIFIED_NOTHING ;
4592
4593
}
4593
4594
#ifdef _PREFAST_
4594
4595
#pragma warning(pop)
You can’t perform that action at this time.
0 commit comments