Skip to content

Commit e0ce3f0

Browse files
wyrichtepleath
authored andcommitted
1 parent 66ab97c commit e0ce3f0

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

lib/Backend/BackwardPass.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4318,7 +4318,10 @@ BackwardPass::ProcessNoImplicitCallDef(IR::Instr *const instr)
43184318
const bool transferArrayLengthSymUse = !!currentBlock->noImplicitCallArrayLengthSymUses->TestAndClear(dstSym->m_id);
43194319

43204320
IR::Opnd *const src = instr->GetSrc1();
4321-
if(!src || instr->GetSrc2())
4321+
4322+
// Stop attempting to transfer noImplicitCallUses symbol if the instr is not a transfer instr (based on the opcode's
4323+
// flags) or does not have the attributes to be a transfer instr (based on the existance of src and src2).
4324+
if(!src || (instr->GetSrc2() && !OpCodeAttr::NonIntTransfer(instr->m_opcode)))
43224325
{
43234326
return;
43244327
}

lib/Backend/IR.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3307,7 +3307,14 @@ bool Instr::TransfersSrcValue()
33073307

33083308
// Consider: Add opcode attribute to indicate whether the opcode would use the value or not
33093309

3310-
return this->GetDst() != nullptr && this->GetSrc2() == nullptr && !OpCodeAttr::DoNotTransfer(this->m_opcode) && !this->CallsAccessor();
3310+
return
3311+
this->GetDst() != nullptr &&
3312+
3313+
// The lack of a Src2 does not always indicate that the instr is not a transfer instr (ex: StSlotChkUndecl).
3314+
(this->GetSrc2() == nullptr || OpCodeAttr::NonIntTransfer(this->m_opcode)) &&
3315+
3316+
!OpCodeAttr::DoNotTransfer(this->m_opcode) &&
3317+
!this->CallsAccessor();
33113318
}
33123319

33133320

lib/Runtime/ByteCode/OpCodes.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -464,21 +464,21 @@ MACRO_WMS( StEnvSlot, ElementSlotI2, None)
464464
MACRO_WMS( StInnerSlot, ElementSlotI2, None)
465465
MACRO_WMS( StLocalSlot, ElementSlotI1, None)
466466
MACRO_EXTEND_WMS( StParamSlot, ElementSlotI1, None)
467-
MACRO_BACKEND_ONLY( StSlotChkUndecl, ElementSlot, OpSideEffect)
468-
MACRO_EXTEND_WMS( StEnvSlotChkUndecl, ElementSlotI2, OpSideEffect)
469-
MACRO_EXTEND_WMS( StInnerSlotChkUndecl, ElementSlotI2, OpSideEffect)
470-
MACRO_EXTEND_WMS( StLocalSlotChkUndecl, ElementSlotI1, OpSideEffect)
471-
MACRO_EXTEND_WMS( StParamSlotChkUndecl, ElementSlotI1, OpSideEffect)
467+
MACRO_BACKEND_ONLY( StSlotChkUndecl, ElementSlot, OpSideEffect|OpNonIntTransfer) // Src1 is transferred to Dst, Src2 holds the same value as Dst to communicate Dst's liveness.
468+
MACRO_EXTEND_WMS( StEnvSlotChkUndecl, ElementSlotI2, OpSideEffect|OpNonIntTransfer)
469+
MACRO_EXTEND_WMS( StInnerSlotChkUndecl, ElementSlotI2, OpSideEffect|OpNonIntTransfer)
470+
MACRO_EXTEND_WMS( StLocalSlotChkUndecl, ElementSlotI1, OpSideEffect|OpNonIntTransfer)
471+
MACRO_EXTEND_WMS( StParamSlotChkUndecl, ElementSlotI1, OpSideEffect|OpNonIntTransfer)
472472
MACRO_EXTEND_WMS( StObjSlot, ElementSlot, OpSideEffect)
473473
MACRO_EXTEND_WMS( StInnerObjSlot, ElementSlotI2, OpSideEffect)
474474
MACRO_EXTEND_WMS( StLocalObjSlot, ElementSlotI1, OpSideEffect)
475475
MACRO_EXTEND_WMS( StParamObjSlot, ElementSlotI1, OpSideEffect)
476-
MACRO_EXTEND_WMS( StLocalObjSlotChkUndecl, ElementSlotI1, OpSideEffect)
477-
MACRO_EXTEND_WMS( StParamObjSlotChkUndecl, ElementSlotI1, OpSideEffect)
476+
MACRO_EXTEND_WMS( StLocalObjSlotChkUndecl, ElementSlotI1, OpSideEffect|OpNonIntTransfer)
477+
MACRO_EXTEND_WMS( StParamObjSlotChkUndecl, ElementSlotI1, OpSideEffect|OpNonIntTransfer)
478478
MACRO_EXTEND_WMS( StEnvObjSlot, ElementSlotI2, OpSideEffect)
479-
MACRO_EXTEND_WMS( StObjSlotChkUndecl, ElementSlot, OpSideEffect)
480-
MACRO_EXTEND_WMS( StInnerObjSlotChkUndecl, ElementSlotI2, OpSideEffect)
481-
MACRO_EXTEND_WMS( StEnvObjSlotChkUndecl, ElementSlotI2, OpSideEffect)
479+
MACRO_EXTEND_WMS( StObjSlotChkUndecl, ElementSlot, OpSideEffect|OpNonIntTransfer)
480+
MACRO_EXTEND_WMS( StInnerObjSlotChkUndecl, ElementSlotI2, OpSideEffect|OpNonIntTransfer)
481+
MACRO_EXTEND_WMS( StEnvObjSlotChkUndecl, ElementSlotI2, OpSideEffect|OpNonIntTransfer)
482482
MACRO_EXTEND_WMS( StModuleSlot, ElementSlotI2, OpSideEffect)
483483
MACRO_BACKEND_ONLY( LdAsmJsFunc, ElementSlot, OpTempNumberSources|OpCanCSE)
484484
MACRO_BACKEND_ONLY( LdWasmFunc, ElementSlot, OpSideEffect)

0 commit comments

Comments
 (0)