@@ -12,7 +12,8 @@ BackwardPass::BackwardPass(Func * func, GlobOpt * globOpt, Js::Phase tag)
12
12
preOpBailOutInstrToProcess(nullptr ),
13
13
considerSymAsRealUseInNoImplicitCallUses(nullptr ),
14
14
isCollectionPass(false ), currentRegion(nullptr ),
15
- collectionPassSubPhase(CollectionPassSubPhase::None)
15
+ collectionPassSubPhase(CollectionPassSubPhase::None),
16
+ isLoopPrepass(false )
16
17
{
17
18
// Those are the only two phase dead store will be used currently
18
19
Assert (tag == Js::BackwardPhase || tag == Js::DeadStorePhase);
@@ -1577,6 +1578,9 @@ BackwardPass::ProcessLoop(BasicBlock * lastBlock)
1577
1578
1578
1579
Loop *loop = lastBlock->loop ;
1579
1580
1581
+ bool prevIsLoopPrepass = this ->isLoopPrepass ;
1582
+ this ->isLoopPrepass = true ;
1583
+
1580
1584
// This code doesn't work quite as intended. It is meant to capture fields that are live out of a loop to limit the
1581
1585
// number of implicit call bailouts the forward pass must create (only compiler throughput optimization, no impact
1582
1586
// on emitted code), but because it looks only at the lexically last block in the loop, it does the right thing only
@@ -1643,6 +1647,8 @@ BackwardPass::ProcessLoop(BasicBlock * lastBlock)
1643
1647
__analysis_assume (lastBlock);
1644
1648
lastBlock->loop ->hasDeadStorePrepass = true ;
1645
1649
1650
+ this ->isLoopPrepass = prevIsLoopPrepass;
1651
+
1646
1652
#if DBG_DUMP
1647
1653
if (this ->IsTraceEnabled ())
1648
1654
{
@@ -3189,7 +3195,7 @@ BackwardPass::ProcessBlock(BasicBlock * block)
3189
3195
if (this ->tag == Js::DeadStorePhase)
3190
3196
{
3191
3197
#ifndef _M_ARM
3192
- if (block->loop )
3198
+ if (block->loop && ! this -> isLoopPrepass )
3193
3199
{
3194
3200
// In the second pass, we mark instructions that we go by as being safe or unsafe.
3195
3201
//
@@ -3273,7 +3279,7 @@ BackwardPass::ProcessBlock(BasicBlock * block)
3273
3279
#if DBG_DUMP
3274
3280
if (PHASE_TRACE (Js::SpeculationPropagationAnalysisPhase, loop->topFunc ))
3275
3281
{
3276
- Output::Print (_u (" Adding symbols to out-edge masking:\n " ));
3282
+ Output::Print (_u (" Adding symbols to out-edge masking for loop %u outward block %u :\n " ), loop-> GetLoopNumber (), maskingBlock-> GetBlockNum ( ));
3277
3283
symsToMask->Dump ();
3278
3284
}
3279
3285
#endif
0 commit comments