Skip to content

Commit

Permalink
Merge pull request #6785 from rhuanjl/loopIncr0
Browse files Browse the repository at this point in the history
Fix incorrect failFast for Incr0
  • Loading branch information
ppenzin authored Jan 31, 2022
2 parents 418a27c + 12184ad commit 41ad58a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
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>

0 comments on commit 41ad58a

Please sign in to comment.