[llvm] [RISCV][GlobalISel] Legalize Scalable Vector Loads and Stores (PR #84965)
Michael Maitland via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 28 09:09:13 PDT 2024
================
@@ -649,6 +680,61 @@ bool RISCVLegalizerInfo::legalizeExt(MachineInstr &MI,
return true;
}
+bool RISCVLegalizerInfo::legalizeLoadStore(MachineInstr &MI,
+ MachineIRBuilder &MIB) const {
+ MachineRegisterInfo &MRI = *MIB.getMRI();
+ MachineFunction *MF = MI.getParent()->getParent();
+ const DataLayout &DL = MIB.getDataLayout();
+ LLVMContext &Ctx = MF->getFunction().getContext();
+
+ Register DstReg = MI.getOperand(0).getReg();
+ Register PtrReg = MI.getOperand(1).getReg();
+ LLT DataTy = MRI.getType(DstReg);
+ assert(DataTy.isVector() && "Expect vector load.");
----------------
michaelmaitland wrote:
I think you want to `return false` in any of these cases instead of `assert`. Since you call `custom()` it is totally possible that there was a non-vector type that was not marked as legal that makes it in here. `assert` should only be used to check preconditions.
https://github.com/llvm/llvm-project/pull/84965
More information about the llvm-commits
mailing list