@@ -463,7 +463,7 @@ class VSETVLIInfo {
463
463
464
464
enum : uint8_t {
465
465
Uninitialized,
466
- AVLIsReg ,
466
+ AVLIsDefMI ,
467
467
AVLIsImm,
468
468
AVLIsVLMAX,
469
469
AVLIsIgnored,
@@ -492,10 +492,11 @@ class VSETVLIInfo {
492
492
void setUnknown () { State = Unknown; }
493
493
bool isUnknown () const { return State == Unknown; }
494
494
495
- void setAVLReg (Register Reg) {
495
+ void setAVLReg (Register Reg, const MachineInstr *DefMI ) {
496
496
assert (Reg.isVirtual ());
497
497
AVLReg = Reg;
498
- State = AVLIsReg;
498
+ AVLDefMI = DefMI;
499
+ State = AVLIsDefMI;
499
500
}
500
501
501
502
void setAVLImm (unsigned Imm) {
@@ -509,7 +510,7 @@ class VSETVLIInfo {
509
510
void setAVLDefMI (const MachineInstr *DefMI) { AVLDefMI = DefMI; }
510
511
511
512
bool hasAVLImm () const { return State == AVLIsImm; }
512
- bool hasAVLReg () const { return State == AVLIsReg ; }
513
+ bool hasAVLReg () const { return State == AVLIsDefMI ; }
513
514
bool hasAVLVLMAX () const { return State == AVLIsVLMAX; }
514
515
bool hasAVLIgnored () const { return State == AVLIsIgnored; }
515
516
Register getAVLReg () const {
@@ -527,10 +528,8 @@ class VSETVLIInfo {
527
528
assert (Info.isValid ());
528
529
if (Info.isUnknown ())
529
530
setUnknown ();
530
- else if (Info.hasAVLReg ()) {
531
- setAVLReg (Info.getAVLReg ());
532
- setAVLDefMI (Info.getAVLDefMI ());
533
- }
531
+ else if (Info.hasAVLReg ())
532
+ setAVLReg (Info.getAVLReg (), Info.getAVLDefMI ());
534
533
else if (Info.hasAVLVLMAX ())
535
534
setAVLVLMAX ();
536
535
else if (Info.hasAVLIgnored ())
@@ -890,7 +889,7 @@ static VSETVLIInfo getInfoForVSETVLI(const MachineInstr &MI,
890
889
if (AVLReg == RISCV::X0)
891
890
NewInfo.setAVLVLMAX ();
892
891
else
893
- NewInfo.setAVLDefMI ( MRI.getVRegDef (AVLReg));
892
+ NewInfo.setAVLReg (AVLReg, MRI.getVRegDef (AVLReg));
894
893
}
895
894
NewInfo.setVTYPE (MI.getOperand (2 ).getImm ());
896
895
@@ -962,9 +961,9 @@ static VSETVLIInfo computeInfoForInstr(const MachineInstr &MI, uint64_t TSFlags,
962
961
else
963
962
InstrInfo.setAVLImm (Imm);
964
963
} else {
965
- InstrInfo.setAVLReg (VLOp.getReg ());
966
- if (VLOp.getReg (). isVirtual ())
967
- InstrInfo. setAVLDefMI (MRI-> getVRegDef (VLOp. getReg ()) );
964
+ InstrInfo.setAVLReg (VLOp.getReg (), VLOp. getReg (). isVirtual ()
965
+ ? MRI-> getVRegDef (VLOp.getReg ())
966
+ : nullptr );
968
967
}
969
968
} else {
970
969
assert (isScalarExtractInstr (MI));
@@ -1239,9 +1238,10 @@ void RISCVInsertVSETVLI::transferAfter(VSETVLIInfo &Info,
1239
1238
1240
1239
if (RISCV::isFaultFirstLoad (MI)) {
1241
1240
// Update AVL to vl-output of the fault first load.
1242
- Info.setAVLReg (MI.getOperand (1 ).getReg ());
1243
- if (MI.getOperand (1 ).getReg ().isVirtual ())
1244
- Info.setAVLDefMI (MRI->getVRegDef (MI.getOperand (1 ).getReg ()));
1241
+ Info.setAVLReg (MI.getOperand (1 ).getReg (),
1242
+ MI.getOperand (1 ).getReg ().isVirtual ()
1243
+ ? MRI->getVRegDef (MI.getOperand (1 ).getReg ())
1244
+ : nullptr );
1245
1245
return ;
1246
1246
}
1247
1247
0 commit comments