[llvm] [RISCV] Ensure the valid vtype during copyPhysReg (PR #118252)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 1 22:03:02 PST 2024
================
@@ -421,6 +421,36 @@ void RISCVInstrInfo::copyPhysRegVector(
auto MIB = BuildMI(MBB, MBBI, DL, get(Opc), ActualDstReg);
bool UseVMV_V_I = RISCV::getRVVMCOpcode(Opc) == RISCV::VMV_V_I;
bool UseVMV = UseVMV_V_I || RISCV::getRVVMCOpcode(Opc) == RISCV::VMV_V_V;
+
+ // Address https://github.com/llvm/llvm-project/issues/114518
+ // Make sure each whole RVVReg move has valid vtype.
+ unsigned Opcode = MIB->getOpcode();
+ if (UseVMV || Opcode == RISCV::VMV1R_V || Opcode == RISCV::VMV2R_V ||
+ Opcode == RISCV::VMV4R_V || Opcode == RISCV::VMV8R_V) {
+
+ // TODO: Data-flow analysis for vtype status could help avoid the
+ // redundant one.
+ bool NeedVSETIVLI = true;
+
+ for (auto &CurrMI : MBB) {
+ unsigned CurrMIOpcode = CurrMI.getOpcode();
+ if (CurrMIOpcode == RISCV::PseudoVSETIVLI ||
+ CurrMIOpcode == RISCV::PseudoVSETVLI ||
+ CurrMIOpcode == RISCV::PseudoVSETVLIX0)
+ NeedVSETIVLI = false;
+ else if (CurrMI.isInlineAsm())
----------------
topperc wrote:
Why do we only check for inline assembly? Don't we need to handle calls?
https://github.com/llvm/llvm-project/pull/118252
More information about the llvm-commits
mailing list