Skip to content

Commit 06f03b8

Browse files
committed
[RISCV][InsertVSETVLI] Check for undef register operand directly [nfc]
getVNInfoFromReg is expected to return a nullptr if-and-only-if the operand is undef. (This was asserted for.) Reverse the order of the checks to simplify an upcoming set of patches.
1 parent 9e209a4 commit 06f03b8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -932,11 +932,11 @@ RISCVInsertVSETVLI::getInfoForVSETVLI(const MachineInstr &MI) const {
932932
"Can't handle X0, X0 vsetvli yet");
933933
if (AVLReg == RISCV::X0)
934934
NewInfo.setAVLVLMAX();
935-
else if (VNInfo *VNI = getVNInfoFromReg(AVLReg, MI, LIS))
936-
NewInfo.setAVLRegDef(VNI, AVLReg);
937-
else {
938-
assert(MI.getOperand(1).isUndef());
935+
else if (MI.getOperand(1).isUndef())
939936
NewInfo.setAVLIgnored();
937+
else {
938+
VNInfo *VNI = getVNInfoFromReg(AVLReg, MI, LIS);
939+
NewInfo.setAVLRegDef(VNI, AVLReg);
940940
}
941941
}
942942
NewInfo.setVTYPE(MI.getOperand(2).getImm());
@@ -1008,11 +1008,11 @@ RISCVInsertVSETVLI::computeInfoForInstr(const MachineInstr &MI) const {
10081008
}
10091009
else
10101010
InstrInfo.setAVLImm(Imm);
1011-
} else if (VNInfo *VNI = getVNInfoFromReg(VLOp.getReg(), MI, LIS)) {
1012-
InstrInfo.setAVLRegDef(VNI, VLOp.getReg());
1013-
} else {
1014-
assert(VLOp.isUndef());
1011+
} else if (VLOp.isUndef()) {
10151012
InstrInfo.setAVLIgnored();
1013+
} else {
1014+
VNInfo *VNI = getVNInfoFromReg(VLOp.getReg(), MI, LIS);
1015+
InstrInfo.setAVLRegDef(VNI, VLOp.getReg());
10161016
}
10171017
} else {
10181018
assert(isScalarExtractInstr(MI));

0 commit comments

Comments
 (0)