Skip to content

Commit 12184ad

Browse files
committed
Fix incorrect failFast for Incr0
1 parent 418a27c commit 12184ad

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

lib/Backend/GlobOpt.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//-------------------------------------------------------------------------------------------------------
22
// Copyright (C) Microsoft Corporation and contributors. All rights reserved.
3+
// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
34
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
45
//-------------------------------------------------------------------------------------------------------
56
#include "Backend.h"
@@ -2364,7 +2365,10 @@ GlobOpt::CollectMemOpInfo(IR::Instr *instrBegin, IR::Instr *instr, Value *src1Va
23642365
// Line #2: s3(s1) = Ld_A s4(s2)
23652366
// do not consider line #2 as a violating instr
23662367
(instr->m_opcode == Js::OpCode::Ld_I4 &&
2367-
prevInstr && (prevInstr->m_opcode == Js::OpCode::Add_I4 || prevInstr->m_opcode == Js::OpCode::Sub_I4) &&
2368+
// note Ld_A is for the case where the add was 0
2369+
prevInstr && (prevInstr->m_opcode == Js::OpCode::Add_I4 ||
2370+
prevInstr->m_opcode == Js::OpCode::Sub_I4 ||
2371+
prevInstr->m_opcode == Js::OpCode::Ld_A ) &&
23682372
instr->GetSrc1()->IsRegOpnd() &&
23692373
instr->GetDst()->IsRegOpnd() &&
23702374
prevInstr->GetDst()->IsRegOpnd() &&

test/loop/MemOpIncr0.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//-------------------------------------------------------------------------------------------------------
2+
// Copyright (C) Microsoft. All rights reserved.
3+
// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
4+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
5+
//-------------------------------------------------------------------------------------------------------
6+
7+
for (let v3 = -65537; v3 < 3; v3 = v3 + 0) {
8+
const v4 = v3++;
9+
}
10+
11+
print("pass");

test/loop/rlexe.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,9 @@
6060
<baseline>MemOp.baseline</baseline>
6161
</default>
6262
</test>
63+
<test>
64+
<default>
65+
<files>MemOpIncr0.js</files>
66+
</default>
67+
</test>
6368
</regress-exe>

0 commit comments

Comments
 (0)