Skip to content

Commit 9833e07

Browse files
scottp101igcbot
authored andcommitted
Ensure dominance when moving spill
Ensure dominance when moving spill
1 parent 2ac3a0b commit 9833e07

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

IGC/AdaptorCommon/RayTracing/SplitAsyncPass.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,12 @@ void SplitAsyncPass::compactifySpills(
625625
auto* M = Info.begin()->first->getParent();
626626
auto& C = M->getContext();
627627

628+
auto getDT = [](FuncInfo& FI, Function* F) {
629+
if (!FI.DT)
630+
FI.DT = std::make_unique<DominatorTree>(*F);
631+
return FI.DT.get();
632+
};
633+
628634
RTBuilder RTB(C, *m_CGCtx);
629635

630636
// 1. add an entry block to place the fills
@@ -693,11 +699,7 @@ void SplitAsyncPass::compactifySpills(
693699
}
694700

695701
if (NeedsUpdate)
696-
{
697-
if (!FI.DT)
698-
FI.DT = std::make_unique<DominatorTree>(*F);
699-
Updater.RewriteAllUses(FI.DT.get());
700-
}
702+
Updater.RewriteAllUses(getDT(FI, F));
701703

702704
for (auto& [Idx, Fills] : FI.Fills)
703705
{
@@ -725,8 +727,18 @@ void SplitAsyncPass::compactifySpills(
725727
auto& ChildFI = Info.find(CurChild)->second;
726728
for (auto& [Idx, Fills] : ChildFI.Fills)
727729
{
728-
if (FI.Spills.count(Idx) != 0)
729-
continue;
730+
auto SpillI = FI.Spills.find(Idx);
731+
if (SpillI != FI.Spills.end())
732+
{
733+
auto& Spills = SpillI->second;
734+
auto* DT = getDT(FI, F);
735+
if (llvm::all_of(Spills, [=](SpillValueIntrinsic* SI) {
736+
return DT->dominates(SI, CHLI);
737+
}))
738+
{
739+
continue;
740+
}
741+
}
730742

731743
if (FI.Fills.count(Idx) == 0)
732744
{
@@ -800,11 +812,7 @@ void SplitAsyncPass::compactifySpills(
800812
}
801813

802814
if (NeedsUpdate)
803-
{
804-
if (!FI.DT)
805-
FI.DT = std::make_unique<DominatorTree>(*F);
806-
Updater.RewriteAllUses(FI.DT.get());
807-
}
815+
Updater.RewriteAllUses(getDT(FI, F));
808816

809817
for (auto* CHLI : FI.ContinuationPoints)
810818
updateOffsets(RTB, *CHLI->getParent());

0 commit comments

Comments
 (0)