@@ -3099,8 +3099,9 @@ void CFGStructurizer::convertIf(ANodeHG *node, G4_BB *nextJoinBB)
30993099 MUST_BE_TRUE (end->getPhysicalSucc () == exit,
31003100 " Landing BB should have been inserted during construction of hammock graph" );
31013101
3102+ bool isUniform = isGotoScalarJmp (gotoInst);
31023103 ANodeKind kind = ANKIND_GOTOJOIN;
3103- if (doScalarJmp && isGotoScalarJmp (gotoInst) )
3104+ if (doScalarJmp && isUniform )
31043105 {
31053106 kind = ANKIND_JMPI;
31063107 }
@@ -3201,6 +3202,10 @@ void CFGStructurizer::convertIf(ANodeHG *node, G4_BB *nextJoinBB)
32013202 gotoInst->getLineNo (), gotoInst->getCISAOff (), gotoInst->getSrcFilename ());
32023203 begin->pop_back ();
32033204 begin->push_back (ifInst);
3205+ if (isUniform)
3206+ {
3207+ ifInst->asCFInst ()->setUniform (true );
3208+ }
32043209
32053210 if (thenNode->isHammock ())
32063211 {
@@ -3339,6 +3344,10 @@ void CFGStructurizer::convertIf(ANodeHG *node, G4_BB *nextJoinBB)
33393344 newThenLastBB->pop_back ();
33403345 }
33413346 newThenLastBB->push_back (elseInst);
3347+ if (isUniform)
3348+ {
3349+ ifInst->asCFInst ()->setUniform (true );
3350+ }
33423351
33433352 (void )convertPST (thenNode, node->getHasBreak () ? newThenLastBB : nullptr );
33443353
@@ -3383,8 +3392,9 @@ void CFGStructurizer::convertDoWhile(ANodeHG *node, G4_BB *nextJoinBB)
33833392 // need to check it out to avoid generating them.
33843393 //
33853394
3395+ bool isUniform = isGotoScalarJmp (gotoInst);
33863396 ANodeKind ndkind = ANKIND_GOTOJOIN;
3387- if (doScalarJmp && isGotoScalarJmp (gotoInst) &&
3397+ if (doScalarJmp && isUniform &&
33883398 (!doStructCF || !node->getHasBreak ()))
33893399 {
33903400 // If loop has break, favor structured CF, not jmpi
@@ -3419,6 +3429,10 @@ void CFGStructurizer::convertDoWhile(ANodeHG *node, G4_BB *nextJoinBB)
34193429 gotoInst->getLineNo (), gotoInst->getCISAOff (), gotoInst->getSrcFilename ());
34203430 end->pop_back ();
34213431 end->push_back (whileInst);
3432+ if (isUniform)
3433+ {
3434+ whileInst->asCFInst ()->setUniform (true );
3435+ }
34223436
34233437 convertChildren (node, node->getHasBreak () ? end : nullptr );
34243438 }
@@ -3451,7 +3465,6 @@ void CFGStructurizer::generateGotoJoin(G4_BB *gotoBB, G4_BB *jibBB, G4_BB *joinB
34513465 uint8_t execSize = gotoInst->getExecSize ();
34523466 execSize = execSize > 1 ? execSize : kernelExecSize;
34533467
3454-
34553468 if (gotoInst->getExecSize () == 1 )
34563469 { // For simd1 goto, convert it to a goto with the right execSize.
34573470 gotoInst->setExecSize (execSize);
@@ -3505,6 +3518,7 @@ void CFGStructurizer::convertGoto(ANodeBB *node, G4_BB *nextJoinBB)
35053518 }
35063519 node->setVisited (true );
35073520
3521+ bool isUniform = isGotoScalarJmp (gotoInst);
35083522 G4_BB *exitbb = node->getExitBB ();
35093523 ANodeHG *innermostWhile = getInnerMostWhile (node);
35103524 ANodeKind kind = ANKIND_GOTOJOIN;
@@ -3520,7 +3534,7 @@ void CFGStructurizer::convertGoto(ANodeBB *node, G4_BB *nextJoinBB)
35203534 // nextJoinBB, if any, must be after getBeginBB(). So, if nextJoinBB
35213535 // is before exitbb, nextJoinBB is in the middle of [beginbb, exitbb]
35223536 bool hasJoinInMiddle = nextJoinBB && isBefore (nextJoinBB, exitbb);
3523- if (doScalarJmp && isGotoScalarJmp (gotoInst) &&
3537+ if (doScalarJmp && isUniform &&
35243538 (gotoInst->asCFInst ()->isBackward () || !hasJoinInMiddle))
35253539 {
35263540 kind = ANKIND_JMPI;
@@ -3599,6 +3613,10 @@ void CFGStructurizer::convertGoto(ANodeBB *node, G4_BB *nextJoinBB)
35993613 gotoInst->getSrcFilename ());
36003614 beginbb->pop_back ();
36013615 beginbb->push_back (breakInst);
3616+ if (isUniform)
3617+ {
3618+ breakInst->asCFInst ()->setUniform (true );
3619+ }
36023620 return ;
36033621 }
36043622
0 commit comments