Skip to content

Commit 0cabf8d

Browse files
mnaczkigcbot
authored andcommitted
Fix GenXLowering::lowerBoolScalarSelect
Making sure that the newly created branches maintain the appropriate control flow.
1 parent 8b49f42 commit 0cabf8d

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

IGC/VectorCompiler/lib/GenXCodeGen/GenXLowering.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3953,8 +3953,22 @@ bool GenXLowering::lowerBoolScalarSelect(SelectInst *SI) {
39533953
// BB4
39543954
//
39553955
auto BB1 = SI->getParent();
3956-
auto BB2 = SplitBlock(BB1, SI, DT);
3957-
auto BB4 = SplitEdge(BB1, BB2, DT);
3956+
auto BB_ReturnedBySpitBlock = SplitBlock(BB1, SI, DT);
3957+
auto BB_ReturnedBySplitEdge = SplitEdge(BB1, BB_ReturnedBySpitBlock, DT);
3958+
3959+
BasicBlock *BB2;
3960+
BasicBlock *BB4;
3961+
// Make sure that BB2 is predecessor of BB4
3962+
if (BB_ReturnedBySpitBlock->getSinglePredecessor() == BB_ReturnedBySplitEdge)
3963+
{
3964+
BB2 = BB_ReturnedBySplitEdge;
3965+
BB4 = BB_ReturnedBySpitBlock;
3966+
}
3967+
else
3968+
{
3969+
BB4 = BB_ReturnedBySplitEdge;
3970+
BB2 = BB_ReturnedBySpitBlock;
3971+
}
39583972
BB2->setName("select.false");
39593973
BB4->setName("select.true");
39603974

0 commit comments

Comments
 (0)