@@ -1043,6 +1043,8 @@ SBFootprint *G4_BB_SB::getFootprintForGRF(G4_Operand *opnd,
10431043 GenPrecision precision = GenPrecision::INVALID;
10441044 bool isFcvtByteType = false ;
10451045 bool isPrecision = false ;
1046+ bool isCmpUseOnly = inst->opcode () == G4_cmp && opnd_num == Opnd_src0 &&
1047+ opnd->getTopDcl ()->getIsCmpUseOnly ();
10461048
10471049 if (inst->opcode () == G4_fcvt &&
10481050 (IS_BTYPE (type) ||
@@ -1175,7 +1177,7 @@ SBFootprint *G4_BB_SB::getFootprintForGRF(G4_Operand *opnd,
11751177 SBFootprint (GRF_T, precision, LB, RB, inst, isFcvtByteType)
11761178 : new (allocedMem)
11771179 SBFootprint (GRF_T, type, LB, RB, inst, isFcvtByteType);
1178-
1180+ footprint-> isCmpUseOnly = isCmpUseOnly;
11791181 return footprint;
11801182}
11811183
@@ -5600,6 +5602,9 @@ void G4_BB_SB::setSendOpndMayKilled(SBNODE_VECT &SBNodes, PointsToAnalysis &p,
56005602 send_may_kill.src .set (globalID);
56015603 } else if (dep == RAW) {
56025604 send_may_kill.dst .set (globalID);
5605+ if (curFootprint->isCmpUseOnly ) {
5606+ send_WAW_may_kill.set (globalID);
5607+ }
56035608 // Exclusive WAW has no overlap
56045609 } else if (dep == WAW && (isSend || !isDclExclusiveLoad (
56055610 nodeInfo.topDeclare , topDcl))) {
@@ -8001,9 +8006,20 @@ void SWSB::addGlobalDependence(unsigned globalSendNum,
80018006 unsigned short internalOffset = 0 ;
80028007 bool hasOverlap =
80038008 curFootprint->hasOverlap (liveFootprint, internalOffset);
8009+ DepType dep = getDepForOpnd (liveOpnd, curOpnd);
80048010
8011+ // Following special dependence checking is to handle following case
8012+ // in SIMD control follow:
8013+ // cmp.eq v5444, v5444
8014+ // where v5444 is undefined and can be assigned with any register. As
8015+ // a result there may be RAW dependence in the SIMD control follow.
8016+ // For this special case, we treat it as a WAW dependence by checking
8017+ // if it's uninitialized declare used in cmp
8018+ if (!afterWrite && liveOpnd == Opnd_dst &&
8019+ curFootprint->isCmpUseOnly ) {
8020+ dep = getDepForOpnd (liveOpnd, Opnd_dst);
8021+ }
80058022 // Find DEP type
8006- DepType dep = getDepForOpnd (liveOpnd, curOpnd);
80078023 if (!hasOverlap && dep == RAW) {
80088024 hasOverlap =
80098025 sb_bb->hasExtraOverlap (liveInst, curInst, liveFootprint,
0 commit comments