Skip to content

Commit 9a99b66

Browse files
committed
[MERGE #1536 @rajatd] Bug fix to not remove GetNewScObject in the loop prepass
Merge pull request #1536 from rajatd:getNewScObject We should wait for the main pass of a loop to make changes to the IR based on value types of operands. In this case GetNewScObject instruction was being removed in the prepass and this led to functional differences from nonative runs.
2 parents 50b4e0e + 24c9ed6 commit 9a99b66

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Backend/GlobOpt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4954,7 +4954,7 @@ GlobOpt::OptInstr(IR::Instr *&instr, bool* isInstrRemoved)
49544954
this->currentBlock->RemoveInstr(instr);
49554955
return instrNext;
49564956
}
4957-
else if (instr->m_opcode == Js::OpCode::GetNewScObject && src1Val->GetValueInfo()->IsPrimitive())
4957+
else if (instr->m_opcode == Js::OpCode::GetNewScObject && !this->IsLoopPrePass() && src1Val->GetValueInfo()->IsPrimitive())
49584958
{
49594959
// Constructor returned (src1) a primitive value, so fold this into "dst = Ld_A src2", where src2 is the new object that
49604960
// was passed into the constructor as its 'this' parameter

0 commit comments

Comments
 (0)