Skip to content

Commit 1f63e32

Browse files
aparshin-inteligcbot
authored andcommitted
remove pseudo optimization from Segment definition
in addition, allow printing of empty LR
1 parent 826616c commit 1f63e32

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

IGC/VectorCompiler/lib/GenXCodeGen/GenXLiveness.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,14 +1767,20 @@ unsigned LiveRange::getLength(bool WithWeak) const {
17671767
*/
17681768
void LiveRange::print(raw_ostream &OS) const
17691769
{
1770+
if (Values.empty()) {
1771+
OS << "Empty LR";
1772+
return;
1773+
}
1774+
17701775
auto vi = Values.begin(), ve = Values.end();
1771-
IGC_ASSERT(vi != ve);
1772-
for (;;) {
1776+
bool AllNamesPrinted = false;
1777+
do {
17731778
vi->printName(OS);
1774-
if (++vi == ve)
1775-
break;
1776-
OS << ",";
1777-
}
1779+
AllNamesPrinted = (++vi == ve);
1780+
if (!AllNamesPrinted)
1781+
OS << ",";
1782+
} while (!AllNamesPrinted);
1783+
17781784
OS << ":";
17791785
printSegments(OS);
17801786
const char *Cat = "???";
@@ -1805,6 +1811,7 @@ void LiveRange::printSegments(raw_ostream &OS) const
18051811
switch (ri->Strength) {
18061812
case Segment::WEAK: OS << "w"; break;
18071813
case Segment::PHICPY: OS << "ph"; break;
1814+
case Segment::STRONG: /* do nothing */ break;
18081815
}
18091816
OS << ri->getStart() << "," << ri->getEnd() << ")";
18101817
}

IGC/VectorCompiler/lib/GenXCodeGen/GenXLiveness.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,15 +295,15 @@ class AssertingSV {
295295
// Segment : a single range of instruction numbers in which a value is
296296
// live
297297
struct Segment {
298-
enum { WEAK, PHICPY, STRONG };
299-
unsigned Strength : 2; // whether it is a weak or phicpy or strong segment
298+
enum SegmentType : unsigned char { WEAK, PHICPY, STRONG };
299+
SegmentType Strength;
300300

301301
private:
302-
unsigned Start : 30; // inclusive start of range
303-
unsigned End : 30; // exclusive end of range
302+
unsigned Start;
303+
unsigned End;
304304
public:
305305
Segment() : Strength(STRONG), Start(0), End(0) {}
306-
Segment(unsigned S, unsigned E, unsigned Strength = STRONG)
306+
Segment(unsigned S, unsigned E, SegmentType Strength = STRONG)
307307
: Strength(Strength) {
308308
IGC_ASSERT(E >= S);
309309
Start = S;

0 commit comments

Comments
 (0)