@@ -1578,7 +1578,7 @@ void resetGenOffsets(G4_Kernel &kernel) {
1578
1578
void updateDebugInfo (G4_Kernel &kernel, G4_INST *inst,
1579
1579
const LivenessAnalysis &liveAnalysis,
1580
1580
const LiveRangeVec& lrs,
1581
- SparseBitSet &live, DebugInfoState *state,
1581
+ llvm_SBitVector &live, DebugInfoState *state,
1582
1582
bool closeAllOpenIntervals) {
1583
1583
if (closeAllOpenIntervals && !state->getPrevInst ())
1584
1584
return ;
@@ -1588,79 +1588,59 @@ void updateDebugInfo(G4_Kernel &kernel, G4_INST *inst,
1588
1588
// Update live-intervals only when bits change in bit-vector.
1589
1589
// state parameter contains previous instruction and bit-vector.
1590
1590
for (unsigned int i = 0 ; i < liveAnalysis.getNumSelectedVar ();
1591
- i += NUM_BITS_PER_ELT) {
1592
- auto elt = live.getElt (i / NUM_BITS_PER_ELT);
1593
- auto prevElt = state->getPrevBitset ()
1594
- ? state->getPrevBitset ()->getElt (i / NUM_BITS_PER_ELT)
1595
- : 0 ;
1591
+ i++) {
1592
+ bool eltI = live.test (i);
1593
+ bool prevEltI = state->getPrevBitset () ? state->getPrevBitset ()->test (i) : false ;
1596
1594
1597
- if (elt != prevElt ) {
1595
+ if (eltI && !prevEltI ) {
1598
1596
// Some variables have changed state in bit-vector, so update their states
1599
1597
// accordingly.
1600
1598
//
1601
1599
// If elt is set and prevElt is reset, it means the variable became live
1602
1600
// at current inst, If elt is reset and prevElt is set, it means the
1603
1601
// variable was killed at current inst
1604
1602
//
1605
- for (unsigned int j = 0 ; j < NUM_BITS_PER_ELT; j++) {
1606
- unsigned char eltJ = (elt >> j) & 0x1 ;
1607
- unsigned char prevEltJ = (prevElt >> j) & 0x1 ;
1608
-
1609
- if (eltJ == 1 && prevEltJ == 0 ) {
1610
- if (inst->getVISAId () != UNMAPPABLE_VISA_INDEX) {
1611
- // This check guarantees that for an open
1612
- // interval, at least the same CISA offset
1613
- // can be used to close it. If there is no
1614
- // instruction with valid CISA offset
1615
- // between open/close IR instruction, then
1616
- // the interval will not be recorded.
1617
- auto idx = (i + j);
1618
- G4_Declare *dcl = lrs[idx]->getVar ()->getDeclare ();
1619
- auto lr = krnlDbgInfo->getLiveIntervalInfo (dcl);
1620
-
1621
- lr->setStateOpen (inst->getVISAId ());
1622
- }
1623
- } else if (eltJ == 0 && prevEltJ == 1 ) {
1624
- auto idx = (i + j);
1625
- G4_Declare *dcl = lrs[idx]->getVar ()->getDeclare ();
1626
-
1627
- auto lr = krnlDbgInfo->getLiveIntervalInfo (dcl);
1628
-
1629
- if (lr->getState () ==
1630
- LiveIntervalInfo::DebugLiveIntervalState::Open) {
1631
- auto closeAt = state->getPrevInst ()->getVISAId ();
1632
- while (closeAt >= 1 && krnlDbgInfo->isMissingVISAId (closeAt - 1 )) {
1633
- closeAt--;
1634
- }
1635
- lr->setStateClosed (closeAt);
1636
- }
1637
- }
1603
+ if (inst->getVISAId () != UNMAPPABLE_VISA_INDEX) {
1604
+ // This check guarantees that for an open
1605
+ // interval, at least the same CISA offset
1606
+ // can be used to close it. If there is no
1607
+ // instruction with valid CISA offset
1608
+ // between open/close IR instruction, then
1609
+ // the interval will not be recorded.
1610
+ G4_Declare *dcl = lrs[i]->getVar ()->getDeclare ();
1611
+ auto lr = krnlDbgInfo->getLiveIntervalInfo (dcl);
1612
+
1613
+ lr->setStateOpen (inst->getVISAId ());
1638
1614
}
1639
- }
1615
+ } else if (!eltI && prevEltI) {
1616
+ G4_Declare *dcl = lrs[i]->getVar ()->getDeclare ();
1640
1617
1641
- if (closeAllOpenIntervals) {
1642
- for (unsigned int j = 0 ; j < NUM_BITS_PER_ELT; j++) {
1643
- unsigned char eltJ = (elt >> j) & 0x1 ;
1618
+ auto lr = krnlDbgInfo->getLiveIntervalInfo (dcl);
1644
1619
1645
- if (eltJ) {
1646
- auto idx = (i + j);
1647
- G4_Declare *dcl = lrs[idx]->getVar ()->getDeclare ();
1648
- auto lr = krnlDbgInfo->getLiveIntervalInfo (dcl);
1620
+ if (lr->getState () == LiveIntervalInfo::DebugLiveIntervalState::Open) {
1621
+ auto closeAt = state->getPrevInst ()->getVISAId ();
1622
+ while (closeAt >= 1 && krnlDbgInfo->isMissingVISAId (closeAt - 1 )) {
1623
+ closeAt--;
1624
+ }
1625
+ lr->setStateClosed (closeAt);
1626
+ }
1627
+ }
1649
1628
1650
- if (lr->getState () ==
1651
- LiveIntervalInfo::DebugLiveIntervalState::Open) {
1652
- uint32_t lastCISAOff = (inst->getVISAId () != UNMAPPABLE_VISA_INDEX)
1653
- ? inst->getVISAId ()
1654
- : state->getPrevInst ()->getVISAId ();
1629
+ if (closeAllOpenIntervals && eltI) {
1630
+ G4_Declare *dcl = lrs[i]->getVar ()->getDeclare ();
1631
+ auto lr = krnlDbgInfo->getLiveIntervalInfo (dcl);
1655
1632
1656
- while (lastCISAOff >= 1 &&
1657
- krnlDbgInfo-> isMissingVISAId (lastCISAOff - 1 )) {
1658
- lastCISAOff--;
1659
- }
1633
+ if (lr-> getState () == LiveIntervalInfo::DebugLiveIntervalState::Open) {
1634
+ uint32_t lastCISAOff = (inst-> getVISAId () != UNMAPPABLE_VISA_INDEX)
1635
+ ? inst-> getVISAId ()
1636
+ : state-> getPrevInst ()-> getVISAId ();
1660
1637
1661
- lr->setStateClosed (lastCISAOff);
1662
- }
1638
+ while (lastCISAOff >= 1 &&
1639
+ krnlDbgInfo->isMissingVISAId (lastCISAOff - 1 )) {
1640
+ lastCISAOff--;
1663
1641
}
1642
+
1643
+ lr->setStateClosed (lastCISAOff);
1664
1644
}
1665
1645
}
1666
1646
}
0 commit comments