@@ -3275,7 +3275,11 @@ void CFGStructurizer::convertIf(ANodeHG *node, G4_BB *nextJoinBB)
3275
3275
3276
3276
G4_INST* endifInst = CFG->builder ->createInternalCFInst (
3277
3277
NULL , G4_endif, execSize, nextJoinLabel, NULL , InstOpt_NoOpt);
3278
-
3278
+ // Set CISA index link here explicitly since not doing so causes
3279
+ // endif to merge with immediately following line. This prevents
3280
+ // debugger from setting bp on src line immediately following
3281
+ // the endif.
3282
+ endifInst->inheritDIFrom (gotoInst);
3279
3283
insertAtBegin (exit , endifInst);
3280
3284
3281
3285
// jip = uip = endif
@@ -3284,6 +3288,7 @@ void CFGStructurizer::convertIf(ANodeHG *node, G4_BB *nextJoinBB)
3284
3288
pred->setState (pred->getState () == PredState_Plus ? PredState_Minus : PredState_Plus);
3285
3289
G4_INST* ifInst = CFG->builder ->createInternalCFInst (
3286
3290
pred, G4_if, execSize, endifLabel, endifLabel, InstOpt_NoOpt);
3291
+ ifInst->inheritDIFrom (endifInst);
3287
3292
begin->pop_back ();
3288
3293
begin->push_back (ifInst);
3289
3294
if (isUniform)
@@ -3380,7 +3385,7 @@ void CFGStructurizer::convertIf(ANodeHG *node, G4_BB *nextJoinBB)
3380
3385
// instruction.
3381
3386
auto endifInst = CFG->builder ->createInternalCFInst (
3382
3387
NULL , G4_endif, execSize, nextJoinLabel, NULL , InstOpt_NoOpt);
3383
-
3388
+ endifInst-> inheritDIFrom (gotoInst);
3384
3389
insertAtBegin (exit , endifInst);
3385
3390
3386
3391
G4_BB *elseFirstBB = elseNode->getBeginBB ();
@@ -3392,6 +3397,7 @@ void CFGStructurizer::convertIf(ANodeHG *node, G4_BB *nextJoinBB)
3392
3397
// if instruction : jip = else_label, uip = endif
3393
3398
G4_INST* ifInst = CFG->builder ->createInternalCFInst (
3394
3399
pred, G4_if, execSize, elseLabel, endifLabel, InstOpt_NoOpt);
3400
+ ifInst->inheritDIFrom (endifInst);
3395
3401
begin->pop_back ();
3396
3402
begin->push_back (ifInst);
3397
3403
@@ -3411,6 +3417,7 @@ void CFGStructurizer::convertIf(ANodeHG *node, G4_BB *nextJoinBB)
3411
3417
G4_INST *thenGoto = newThenLastBB->back ();
3412
3418
G4_INST* elseInst = CFG->builder ->createInternalCFInst (
3413
3419
NULL , G4_else, execSize, endifLabel, endifLabel, InstOpt_NoOpt);
3420
+ elseInst->inheritDIFrom (endifInst);
3414
3421
if (thenGoto->opcode () == G4_goto)
3415
3422
{
3416
3423
newThenLastBB->pop_back ();
@@ -3498,6 +3505,7 @@ void CFGStructurizer::convertDoWhile(ANodeHG *node, G4_BB *nextJoinBB)
3498
3505
// jip = uip = do
3499
3506
G4_INST *whileInst = CFG->builder ->createInternalCFInst (
3500
3507
gotoInst->getPredicate (), G4_while, execSize, doLabel, doLabel, InstOpt_NoOpt);
3508
+ whileInst->inheritDIFrom (end->back ());
3501
3509
end->pop_back ();
3502
3510
end->push_back (whileInst);
3503
3511
if (isUniform)
@@ -3649,6 +3657,7 @@ void CFGStructurizer::convertGoto(ANodeBB *node, G4_BB *nextJoinBB)
3649
3657
G4_INST* breakInst = CFG->builder ->createInternalCFInst (
3650
3658
gotoInst->getPredicate (), G4_break, execSize,
3651
3659
innerBlock->getLabel (), whilebb->getLabel (), InstOpt_NoOpt);
3660
+ breakInst->inheritDIFrom (gotoInst);
3652
3661
beginbb->pop_back ();
3653
3662
beginbb->push_back (breakInst);
3654
3663
if (isUniform)
0 commit comments