@@ -504,7 +504,7 @@ DemandedFields getDemanded(const MachineInstr &MI, const RISCVSubtarget *ST) {
504
504
class VSETVLIInfo {
505
505
struct AVLDef {
506
506
// Every AVLDef should have a VNInfo.
507
- const VNInfo * ValNo;
507
+ unsigned ValNo;
508
508
Register DefReg;
509
509
};
510
510
union {
@@ -543,9 +543,9 @@ class VSETVLIInfo {
543
543
void setUnknown () { State = Unknown; }
544
544
bool isUnknown () const { return State == Unknown; }
545
545
546
- void setAVLRegDef (const VNInfo *VNInfo , Register AVLReg) {
547
- assert (VNInfo && AVLReg.isVirtual ());
548
- AVLRegDef.ValNo = VNInfo ;
546
+ void setAVLRegDef (unsigned ValNo , Register AVLReg) {
547
+ assert (AVLReg.isVirtual ());
548
+ AVLRegDef.ValNo = ValNo ;
549
549
AVLRegDef.DefReg = AVLReg;
550
550
State = AVLIsReg;
551
551
}
@@ -571,7 +571,7 @@ class VSETVLIInfo {
571
571
assert (hasAVLImm ());
572
572
return AVLImm;
573
573
}
574
- const VNInfo * getAVLVNInfo () const {
574
+ unsigned getAVLValNo () const {
575
575
assert (hasAVLReg ());
576
576
return AVLRegDef.ValNo ;
577
577
}
@@ -580,8 +580,10 @@ class VSETVLIInfo {
580
580
// boundary slot.
581
581
const MachineInstr *getAVLDefMI (const LiveIntervals *LIS) const {
582
582
assert (hasAVLReg ());
583
- auto *MI = LIS->getInstructionFromIndex (getAVLVNInfo ()->def );
584
- assert (!(getAVLVNInfo ()->isPHIDef () && MI));
583
+ const VNInfo *VNI =
584
+ LIS->getInterval (getAVLReg ()).getValNumInfo (getAVLValNo ());
585
+ auto *MI = LIS->getInstructionFromIndex (VNI->def );
586
+ assert (!(VNI->isPHIDef () && MI));
585
587
return MI;
586
588
}
587
589
@@ -590,7 +592,7 @@ class VSETVLIInfo {
590
592
if (Info.isUnknown ())
591
593
setUnknown ();
592
594
else if (Info.hasAVLReg ())
593
- setAVLRegDef (Info.getAVLVNInfo (), Info.getAVLReg ());
595
+ setAVLRegDef (Info.getAVLValNo (), Info.getAVLReg ());
594
596
else if (Info.hasAVLVLMAX ())
595
597
setAVLVLMAX ();
596
598
else if (Info.hasAVLIgnored ())
@@ -629,7 +631,7 @@ class VSETVLIInfo {
629
631
630
632
bool hasSameAVL (const VSETVLIInfo &Other) const {
631
633
if (hasAVLReg () && Other.hasAVLReg ())
632
- return getAVLVNInfo ()-> id == Other.getAVLVNInfo ()-> id &&
634
+ return getAVLValNo () == Other.getAVLValNo () &&
633
635
getAVLReg () == Other.getAVLReg ();
634
636
635
637
if (hasAVLImm () && Other.hasAVLImm ())
@@ -927,7 +929,7 @@ static VSETVLIInfo getInfoForVSETVLI(const MachineInstr &MI,
927
929
if (AVLReg == RISCV::X0)
928
930
NewInfo.setAVLVLMAX ();
929
931
else if (VNInfo *VNI = getVNInfoFromReg (AVLReg, MI, LIS))
930
- NewInfo.setAVLRegDef (VNI, AVLReg);
932
+ NewInfo.setAVLRegDef (VNI-> id , AVLReg);
931
933
else {
932
934
assert (MI.getOperand (1 ).isUndef ());
933
935
NewInfo.setAVLIgnored ();
@@ -1003,7 +1005,7 @@ static VSETVLIInfo computeInfoForInstr(const MachineInstr &MI, uint64_t TSFlags,
1003
1005
else
1004
1006
InstrInfo.setAVLImm (Imm);
1005
1007
} else if (VNInfo *VNI = getVNInfoFromReg (VLOp.getReg (), MI, LIS)) {
1006
- InstrInfo.setAVLRegDef (VNI, VLOp.getReg ());
1008
+ InstrInfo.setAVLRegDef (VNI-> id , VLOp.getReg ());
1007
1009
} else {
1008
1010
assert (VLOp.isUndef ());
1009
1011
InstrInfo.setAVLIgnored ();
@@ -1255,7 +1257,7 @@ void RISCVInsertVSETVLI::transferAfter(VSETVLIInfo &Info,
1255
1257
auto &LI = LIS->getInterval (MI.getOperand (1 ).getReg ());
1256
1258
SlotIndex SI = LIS->getSlotIndexes ()->getInstructionIndex (MI).getRegSlot ();
1257
1259
VNInfo *VNI = LI.getVNInfoAt (SI);
1258
- Info.setAVLRegDef (VNI, MI.getOperand (1 ).getReg ());
1260
+ Info.setAVLRegDef (VNI-> id , MI.getOperand (1 ).getReg ());
1259
1261
return ;
1260
1262
}
1261
1263
@@ -1350,7 +1352,8 @@ bool RISCVInsertVSETVLI::needVSETVLIPHI(const VSETVLIInfo &Require,
1350
1352
return true ;
1351
1353
1352
1354
// We need the AVL to have been produced by a PHI node in this basic block.
1353
- const VNInfo *Valno = Require.getAVLVNInfo ();
1355
+ const VNInfo *Valno = LIS->getInterval (Require.getAVLReg ())
1356
+ .getValNumInfo (Require.getAVLValNo ());
1354
1357
if (!Valno->isPHIDef () || LIS->getMBBFromIndex (Valno->def ) != &MBB)
1355
1358
return true ;
1356
1359
@@ -1514,7 +1517,8 @@ void RISCVInsertVSETVLI::doPRE(MachineBasicBlock &MBB) {
1514
1517
// we need to prove the value is available at the point we're going
1515
1518
// to insert the vsetvli at.
1516
1519
if (AvailableInfo.hasAVLReg ()) {
1517
- SlotIndex SI = AvailableInfo.getAVLVNInfo ()->def ;
1520
+ const LiveInterval &LI = LIS->getInterval (AvailableInfo.getAVLReg ());
1521
+ SlotIndex SI = LI.getValNumInfo (AvailableInfo.getAVLValNo ())->def ;
1518
1522
// This is an inline dominance check which covers the case of
1519
1523
// UnavailablePred being the preheader of a loop.
1520
1524
if (LIS->getMBBFromIndex (SI) != UnavailablePred)
0 commit comments