Skip to content

Commit 9d9fcf6

Browse files
committed
Try to reduce code diff
1 parent b227978 commit 9d9fcf6

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,26 +1032,24 @@ void RISCVInsertVSETVLI::transferBefore(VSETVLIInfo &Info,
10321032
if (Info.hasSEWLMULRatioOnly() || !Info.isValid() || Info.isUnknown())
10331033
Info = NewInfo;
10341034

1035-
DemandedFields Demanded = getDemanded(MI, MRI, ST);
1036-
10371035
// If we don't use LMUL or the SEW/LMUL ratio, then adjust LMUL so that we
10381036
// maintain the SEW/LMUL ratio. This allows us to eliminate VL toggles in more
10391037
// places.
1038+
DemandedFields Demanded = getDemanded(MI, MRI, ST);
10401039
if (!Demanded.LMUL && !Demanded.SEWLMULRatio && Info.isValid() &&
10411040
!Info.isUnknown()) {
1042-
if (auto SameRatioLMUL = RISCVVType::getSameRatioLMUL(
1041+
if (auto NewVLMul = RISCVVType::getSameRatioLMUL(
10431042
Info.getSEW(), Info.getVLMUL(), NewInfo.getSEW())) {
1044-
NewInfo.setVLMul(*SameRatioLMUL);
1043+
NewInfo.setVLMul(*NewVLMul);
10451044
Demanded.LMUL = true;
10461045
}
10471046
}
10481047

1049-
// If AVL is defined by a vsetvli with the same VLMAX, we can replace the AVL
1050-
// operand with the AVL of the defining vsetvli. We avoid general register
1051-
// AVLs to avoid extending live ranges without being sure we can kill the
1052-
// original source reg entirely.
1053-
if (RISCVII::hasVLOp(TSFlags) && NewInfo.hasAVLReg() &&
1054-
NewInfo.getAVLReg().isVirtual()) {
1048+
// If AVL is defined by a vsetvli with the same VLMAX, we can
1049+
// replace the AVL operand with the AVL of the defining vsetvli.
1050+
// We avoid general register AVLs to avoid extending live ranges
1051+
// without being sure we can kill the original source reg entirely.
1052+
if (NewInfo.hasAVLReg() && NewInfo.getAVLReg().isVirtual()) {
10551053
MachineInstr *DefMI = MRI->getVRegDef(NewInfo.getAVLReg());
10561054
if (DefMI && isVectorConfigInstr(*DefMI)) {
10571055
VSETVLIInfo DefInfo = getInfoForVSETVLI(*DefMI);

0 commit comments

Comments
 (0)