@@ -452,7 +452,7 @@ class VSETVLIInfo {
452
452
453
453
enum : uint8_t {
454
454
Uninitialized,
455
- AVLIsReg ,
455
+ AVLIsDefMI ,
456
456
AVLIsImm,
457
457
AVLIsVLMAX,
458
458
AVLIsIgnored,
@@ -481,10 +481,11 @@ class VSETVLIInfo {
481
481
void setUnknown () { State = Unknown; }
482
482
bool isUnknown () const { return State == Unknown; }
483
483
484
- void setAVLReg (Register Reg) {
484
+ void setAVLReg (Register Reg, const MachineInstr *DefMI ) {
485
485
assert (Reg.isVirtual ());
486
486
AVLReg = Reg;
487
- State = AVLIsReg;
487
+ AVLDefMI = DefMI;
488
+ State = AVLIsDefMI;
488
489
}
489
490
490
491
void setAVLImm (unsigned Imm) {
@@ -498,7 +499,7 @@ class VSETVLIInfo {
498
499
void setAVLDefMI (const MachineInstr *DefMI) { AVLDefMI = DefMI; }
499
500
500
501
bool hasAVLImm () const { return State == AVLIsImm; }
501
- bool hasAVLReg () const { return State == AVLIsReg ; }
502
+ bool hasAVLReg () const { return State == AVLIsDefMI ; }
502
503
bool hasAVLVLMAX () const { return State == AVLIsVLMAX; }
503
504
bool hasAVLIgnored () const { return State == AVLIsIgnored; }
504
505
Register getAVLReg () const {
@@ -516,10 +517,8 @@ class VSETVLIInfo {
516
517
assert (Info.isValid ());
517
518
if (Info.isUnknown ())
518
519
setUnknown ();
519
- else if (Info.hasAVLReg ()) {
520
- setAVLReg (Info.getAVLReg ());
521
- setAVLDefMI (Info.getAVLDefMI ());
522
- }
520
+ else if (Info.hasAVLReg ())
521
+ setAVLReg (Info.getAVLReg (), Info.getAVLDefMI ());
523
522
else if (Info.hasAVLVLMAX ())
524
523
setAVLVLMAX ();
525
524
else if (Info.hasAVLIgnored ())
@@ -879,7 +878,7 @@ static VSETVLIInfo getInfoForVSETVLI(const MachineInstr &MI,
879
878
if (AVLReg == RISCV::X0)
880
879
NewInfo.setAVLVLMAX ();
881
880
else
882
- NewInfo.setAVLDefMI ( MRI.getVRegDef (AVLReg));
881
+ NewInfo.setAVLReg (AVLReg, MRI.getVRegDef (AVLReg));
883
882
}
884
883
NewInfo.setVTYPE (MI.getOperand (2 ).getImm ());
885
884
@@ -951,9 +950,9 @@ static VSETVLIInfo computeInfoForInstr(const MachineInstr &MI, uint64_t TSFlags,
951
950
else
952
951
InstrInfo.setAVLImm (Imm);
953
952
} else {
954
- InstrInfo.setAVLReg (VLOp.getReg ());
955
- if (VLOp.getReg (). isVirtual ())
956
- InstrInfo. setAVLDefMI (MRI-> getVRegDef (VLOp. getReg ()) );
953
+ InstrInfo.setAVLReg (VLOp.getReg (), VLOp. getReg (). isVirtual ()
954
+ ? MRI-> getVRegDef (VLOp.getReg ())
955
+ : nullptr );
957
956
}
958
957
} else {
959
958
assert (isScalarExtractInstr (MI));
@@ -1228,9 +1227,10 @@ void RISCVInsertVSETVLI::transferAfter(VSETVLIInfo &Info,
1228
1227
1229
1228
if (RISCV::isFaultFirstLoad (MI)) {
1230
1229
// Update AVL to vl-output of the fault first load.
1231
- Info.setAVLReg (MI.getOperand (1 ).getReg ());
1232
- if (MI.getOperand (1 ).getReg ().isVirtual ())
1233
- Info.setAVLDefMI (MRI->getVRegDef (MI.getOperand (1 ).getReg ()));
1230
+ Info.setAVLReg (MI.getOperand (1 ).getReg (),
1231
+ MI.getOperand (1 ).getReg ().isVirtual ()
1232
+ ? MRI->getVRegDef (MI.getOperand (1 ).getReg ())
1233
+ : nullptr );
1234
1234
return ;
1235
1235
}
1236
1236
0 commit comments