[llvm] [RISC-V][GISEL] Select G_BITCAST for scalable vectors (PR #101486)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 09:54:46 PDT 2024
================
@@ -757,13 +758,21 @@ bool RISCVInstructionSelector::replacePtrWithInt(MachineOperand &Op,
MachineIRBuilder &MIB,
MachineRegisterInfo &MRI) {
Register PtrReg = Op.getReg();
- assert(MRI.getType(PtrReg).isPointer() && "Operand is not a pointer!");
-
+ const LLT PtrTy = MRI.getType(PtrReg);
const LLT sXLen = LLT::scalar(STI.getXLen());
- auto PtrToInt = MIB.buildPtrToInt(sXLen, PtrReg);
- MRI.setRegBank(PtrToInt.getReg(0), RBI.getRegBank(RISCV::GPRBRegBankID));
- Op.setReg(PtrToInt.getReg(0));
- return select(*PtrToInt);
+ if (PtrTy.isPointer()) {
+ auto PtrToInt = MIB.buildPtrToInt(sXLen, PtrReg);
+ MRI.setRegBank(PtrToInt.getReg(0), RBI.getRegBank(RISCV::GPRBRegBankID));
+ Op.setReg(PtrToInt.getReg(0));
+ return select(*PtrToInt);
+ }
+ assert(PtrTy.isPointerVector() &&
+ "Operand must be a pointer of a vector of pointers");
+ assert(PtrTy.isScalableVector() &&
+ "Currently only working for scalable vector of pointers now");
+ MRI.setType(PtrReg, LLT::scalable_vector(
----------------
topperc wrote:
If the vector and non-vector code do something wildly different they should not be in the same function.
https://github.com/llvm/llvm-project/pull/101486
More information about the llvm-commits
mailing list