Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/Backend/GlobOpt.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft Corporation and contributors. All rights reserved.
// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#include "Backend.h"
Expand Down Expand Up @@ -2364,7 +2365,10 @@ GlobOpt::CollectMemOpInfo(IR::Instr *instrBegin, IR::Instr *instr, Value *src1Va
// Line #2: s3(s1) = Ld_A s4(s2)
// do not consider line #2 as a violating instr
(instr->m_opcode == Js::OpCode::Ld_I4 &&
prevInstr && (prevInstr->m_opcode == Js::OpCode::Add_I4 || prevInstr->m_opcode == Js::OpCode::Sub_I4) &&
// note Ld_A is for the case where the add was 0
prevInstr && (prevInstr->m_opcode == Js::OpCode::Add_I4 ||
prevInstr->m_opcode == Js::OpCode::Sub_I4 ||
prevInstr->m_opcode == Js::OpCode::Ld_A ) &&
instr->GetSrc1()->IsRegOpnd() &&
instr->GetDst()->IsRegOpnd() &&
prevInstr->GetDst()->IsRegOpnd() &&
Expand Down
11 changes: 11 additions & 0 deletions test/loop/MemOpIncr0.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Copyright (c) 2021 ChakraCore Project Contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

for (let v3 = -65537; v3 < 3; v3 = v3 + 0) {
const v4 = v3++;
}

print("pass");
5 changes: 5 additions & 0 deletions test/loop/rlexe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@
<baseline>MemOp.baseline</baseline>
</default>
</test>
<test>
<default>
<files>MemOpIncr0.js</files>
</default>
</test>
</regress-exe>