[RISCV][GISel] Fallback to SelectionDAG for vleff intrinsics.#167776
[RISCV][GISel] Fallback to SelectionDAG for vleff intrinsics.#167776
Conversation
Fixes llvm#167618 Supporting this in GISel requires multiple changes to IRTranslator to support aggregate returns containing scalable vectors and non-scalable types. Falling back is the quickest way to fix the crash.
|
@llvm/pr-subscribers-llvm-globalisel @llvm/pr-subscribers-backend-risc-v Author: Craig Topper (topperc) ChangesFixes #167618 Supporting this in GISel requires multiple changes to IRTranslator to support aggregate returns containing scalable vectors and non-scalable types. Falling back is the quickest way to fix the crash. Full diff: https://github.com/llvm/llvm-project/pull/167776.diff 2 Files Affected:
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<IntrinsicInst>(&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..4e018d332edae
--- /dev/null
+++ b/llvm/test/CodeGen/RISCV/GlobalISel/irtranslator/vec-vleff.ll
@@ -0,0 +1,15 @@
+; RUN: not --crash llc -mtriple=riscv64 -mattr=+v -global-isel -stop-after=irtranslator \
+; RUN: -verify-machineinstrs < %s 2>&1 | FileCheck %s
+
+; Intrinsics returning structs and extractvalue of scalable vector are not
+; supported yet.
+define <vscale x 1 x i64> @intrinsic_vleff_v_nxv1i64_nxv1i64(ptr %0, i64 %1, ptr %2) nounwind {
+entry:
+ %a = call { <vscale x 1 x i64>, i64 } @llvm.riscv.vleff.nxv1i64(<vscale x 1 x i64> poison, ptr %0, i64 %1)
+ %b = extractvalue { <vscale x 1 x i64>, i64 } %a, 0
+ %c = extractvalue { <vscale x 1 x i64>, i64 } %a, 1
+ store i64 %c, ptr %2
+ ret <vscale x 1 x i64> %b
+}
+
+; CHECK: LLVM ERROR: unable to translate instruction: call llvm.riscv.vleff.nxv1i64.i64.p0 (in function: intrinsic_vleff_v_nxv1i64_nxv1i64)
|
Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/138/builds/21738 Here is the relevant piece of the build log for the reference |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/186/builds/13929 Here is the relevant piece of the build log for the reference |
Fixes #167618
Supporting this in GISel requires multiple changes to IRTranslator to support aggregate returns containing scalable vectors and non-scalable types. Falling back is the quickest way to fix the crash.