Skip to content
Permalink
Browse files

[MERGE #6115 @nhat-nguyen] Allow empty airlock blocks to be reached t…

…hrough 2 helper blocks

Merge pull request #6115 from nhat-nguyen:airlock

Ignore assertion error for cases where we insert an "airlock" helper block
for a Branch instruction's helper path that:

1) ends up being empty
2) comes after a helper block from another instruction
3) is followed by a non-helper block

Currently we would mark this block as a non-helper, but that makes
this block only reachable through helper blocks, thus failing the assert.
  • Loading branch information...
nhat-nguyen committed May 15, 2019
2 parents 16fc8ac + b10d55f commit 6f0989551bb80e9d8106b393aee18c942db209a7
Showing with 29 additions and 0 deletions.
  1. +14 −0 lib/Backend/LinearScan.cpp
  2. +15 −0 lib/Backend/Peeps.cpp
@@ -4059,6 +4059,20 @@ LinearScan::InsertSecondChanceCompensation(Lifetime ** branchRegContent, Lifetim
{
if (insertionInstr->m_prev->AsLabelInstr()->isOpHelper && !insertionInstr->AsLabelInstr()->isOpHelper)
{
// Ignore assertion error for cases where we insert an "airlock" helper block
// for a Branch instruction's helper path that:
// 1) ends up being empty
// 2) comes after a helper block from another instruction
// 3) is followed by a non-helper block
//
// Currently we would mark this block as a non-helper, but that makes
// this block only reachable through helper blocks, thus failing the assert
#if DBG
if (insertionInstr->m_prev->AsLabelInstr()->isOpHelper)
{
insertionInstr->m_prev->AsLabelInstr()->m_noHelperAssert = true;
}
#endif
insertionInstr->m_prev->AsLabelInstr()->isOpHelper = false;
}
}
@@ -453,6 +453,21 @@ Peeps::PeepBranch(IR::BranchInstr *branchInstr, bool *const peepedRef)
else
{
IR::Instr *instrTmp = instrSkip;

// Ignore assertion error for cases where we insert an "airlock" helper block
// for a Branch instruction's helper path that:
// 1) ends up being empty
// 2) comes after a helper block from another instruction
// 3) is followed by a non-helper block
//
// Propagating the "isOpHelper" flag can potentially make this block a non-helper,
// and that makes this block only reachable through helper blocks, thus failing the assert
#if DBG
if (instrNext->AsLabelInstr()->isOpHelper != instrSkip->AsLabelInstr()->isOpHelper)
{
instrNext->AsLabelInstr()->m_noHelperAssert = true;
}
#endif
instrNext->AsLabelInstr()->isOpHelper = instrSkip->AsLabelInstr()->isOpHelper;
instrSkip = instrNext;
instrNext = instrTmp;

0 comments on commit 6f09895

Please sign in to comment.
You can’t perform that action at this time.