diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index 5a081d54d0726..202c5ffcc2d3c 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -25418,8 +25418,10 @@ bool RISCVTargetLowering::fallBackToDAGISel(const Instruction &Inst) const { if (auto *II = dyn_cast(&Inst)) { // Mark RVV intrinsic as supported. if (RISCVVIntrinsicsTable::getRISCVVIntrinsicInfo(II->getIntrinsicID())) { - // GISel doesn't support tuple types yet. - if (Inst.getType()->isRISCVVectorTupleTy()) + // GISel doesn't support tuple types yet. It also doesn't suport returning + // a struct containing a scalable vector like vleff. + if (Inst.getType()->isRISCVVectorTupleTy() || + Inst.getType()->isStructTy()) return true; for (unsigned i = 0; i < II->arg_size(); ++i) diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/irtranslator/vec-vleff.ll b/llvm/test/CodeGen/RISCV/GlobalISel/irtranslator/vec-vleff.ll new file mode 100644 index 0000000000000..e88e6953b80f4 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/GlobalISel/irtranslator/vec-vleff.ll @@ -0,0 +1,14 @@ +; RUN: not --crash llc -global-isel -mtriple=riscv64 -mattr=+v -filetype=null %s 2>&1 | FileCheck %s + +; Intrinsics returning structs and extractvalue of scalable vector are not +; supported yet. +define @intrinsic_vleff_v_nxv1i64_nxv1i64(ptr %0, i64 %1, ptr %2) nounwind { +entry: + %a = call { , i64 } @llvm.riscv.vleff.nxv1i64( poison, ptr %0, i64 %1) + %b = extractvalue { , i64 } %a, 0 + %c = extractvalue { , i64 } %a, 1 + store i64 %c, ptr %2 + ret %b +} + +; CHECK: LLVM ERROR: unable to translate instruction: call llvm.riscv.vleff.nxv1i64.i64.p0 (in function: intrinsic_vleff_v_nxv1i64_nxv1i64)