Skip to content

Commit 841036a

Browse files
committed
[MERGE #5465 @rajatd] Stricter check for not aggregating bytecode uses across blocks. OS #17449647
Merge pull request #5465 from rajatd:aggregate-bcu Stop bytecodeuses aggregation upon seeing an instruction that `StartsBasicBlock` instead of one that `EndsBasicBlock`. This is because the previous block may have been optimized away with all its instructions, including the branch at the end, converted to ByteCodeUses.
2 parents 4374e44 + 1285e1c commit 841036a

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

lib/Backend/IR.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,20 +1001,6 @@ void ByteCodeUsesInstr::AggregateFollowingByteCodeUses()
10011001
}
10021002
}
10031003

1004-
void ByteCodeUsesInstr::AggregatePrecedingByteCodeUses()
1005-
{
1006-
IR::Instr * instr = this->m_prev;
1007-
while(instr && CanAggregateByteCodeUsesAcrossInstr(instr))
1008-
{
1009-
if (instr->IsByteCodeUsesInstr() && instr->GetByteCodeOffset() == this->GetByteCodeOffset())
1010-
{
1011-
IR::ByteCodeUsesInstr* precedingByteCodeUsesInstr = instr->AsByteCodeUsesInstr();
1012-
this->Aggregate(precedingByteCodeUsesInstr);
1013-
}
1014-
instr = instr->m_prev;
1015-
}
1016-
}
1017-
10181004
void ByteCodeUsesInstr::Aggregate(ByteCodeUsesInstr * byteCodeUsesInstr)
10191005
{
10201006
Assert(this->m_func == byteCodeUsesInstr->m_func);
@@ -1037,7 +1023,7 @@ void ByteCodeUsesInstr::Aggregate(ByteCodeUsesInstr * byteCodeUsesInstr)
10371023

10381024
bool Instr::CanAggregateByteCodeUsesAcrossInstr(Instr * instr)
10391025
{
1040-
return !instr->EndsBasicBlock() &&
1026+
return !instr->StartsBasicBlock() &&
10411027
instr->m_func == this->m_func &&
10421028
((instr->GetByteCodeOffset() == Js::Constants::NoByteCodeOffset) ||
10431029
(instr->GetByteCodeOffset() == this->GetByteCodeOffset()));

lib/Backend/IR.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ class ByteCodeUsesInstr : public Instr
579579
// problems because we end up with an instruction losing atomicity in terms of its
580580
// bytecode use and generation lifetimes.
581581
void AggregateFollowingByteCodeUses();
582-
void AggregatePrecedingByteCodeUses();
583582

584583
private:
585584
void Aggregate(ByteCodeUsesInstr * byteCodeUsesInstr);

0 commit comments

Comments
 (0)