Skip to content

Commit ec6b918

Browse files
bcheng0127igcbot
authored andcommitted
Fix the bug in removeRedundantLabels
Fix the bug in removeRedundantLabels
1 parent bec1a34 commit ec6b918

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

visa/FlowGraph.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,6 +1896,27 @@ void FlowGraph::removeRedundantLabels() {
18961896
}
18971897
}
18981898

1899+
// For the code like following, in which the first none-label
1900+
// instruction is join, and the JIP label of the join is the label of
1901+
// successor BB, we cannot just remove the label in successor.
1902+
//
1903+
// BB17 Preds: ... Succs: BB18
1904+
// _entry_020_id196_Labe:
1905+
// join(32) _entry_k0_5_cf
1906+
// add(16) id265_(0, 0)<1> : d id63_(0, 0) < 1;
1907+
//
1908+
// BB18 Preds: BB17 Succs: ...
1909+
//_entry_k0_5_cf:
1910+
// ....
1911+
G4_INST *firstNoneLableInst = singlePred->getFirstInst();
1912+
if (firstNoneLableInst && firstNoneLableInst->isFlowControl()) {
1913+
G4_Label *jip = firstNoneLableInst->asCFInst()->getJip();
1914+
G4_Label *uip = firstNoneLableInst->asCFInst()->getUip();
1915+
if (jip == labelInst->getLabel() || uip == labelInst->getLabel()) {
1916+
doMerging = false;
1917+
}
1918+
}
1919+
18991920
if (doMerging) {
19001921
removePredSuccEdges(singlePred, bb);
19011922
vASSERT(singlePred->Succs.size() == 0);

0 commit comments

Comments
 (0)