Skip to content

Clang fails when building LLVM for RISCV #81088

Closed
@kongy

Description

@kongy

fatal error: error in backend: Do not know how to split the result of this operator!

Reduced reproducer attached.

reduce.zip

Activity

added
clangClang issues not falling into any other category
on Feb 8, 2024
added and removed
clangClang issues not falling into any other category
on Feb 8, 2024
llvmbot

llvmbot commented on Feb 8, 2024

@llvmbot
Member

@llvm/issue-subscribers-backend-risc-v

Author: Yi Kong (kongy)

`fatal error: error in backend: Do not know how to split the result of this operator!`

Reduced reproducer attached.

reduce.zip

topperc

topperc commented on Feb 8, 2024

@topperc
Collaborator

Looks like #66800 is missing a check for legal type.

assigned and unassigned on Feb 8, 2024
topperc

topperc commented on Feb 8, 2024

@topperc
Collaborator

Possible fix

diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 27037f4d5c5c..405d99f14d8f 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -15812,7 +15812,8 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
           MGN->getMemOperand(), IndexType, MGN->getExtensionType());
 
     if (Index.getOpcode() == ISD::BUILD_VECTOR &&
-        MGN->getExtensionType() == ISD::NON_EXTLOAD) {
+        MGN->getExtensionType() == ISD::NON_EXTLOAD &&
+        isTypeLegal(VT)) {
       if (std::optional<VIDSequence> SimpleVID = isSimpleVIDSequence(Index);
           SimpleVID && SimpleVID->StepDenominator == 1) {
         const int64_t StepNumerator = SimpleVID->StepNumerator;
lukel97

lukel97 commented on Feb 8, 2024

@lukel97
Contributor

Possible fix

diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 27037f4d5c5c..405d99f14d8f 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -15812,7 +15812,8 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
           MGN->getMemOperand(), IndexType, MGN->getExtensionType());
 
     if (Index.getOpcode() == ISD::BUILD_VECTOR &&
-        MGN->getExtensionType() == ISD::NON_EXTLOAD) {
+        MGN->getExtensionType() == ISD::NON_EXTLOAD &&
+        isTypeLegal(VT)) {
       if (std::optional<VIDSequence> SimpleVID = isSimpleVIDSequence(Index);
           SimpleVID && SimpleVID->StepDenominator == 1) {
         const int64_t StepNumerator = SimpleVID->StepNumerator;

This fixes it on my end. And the combine kicks in again once the MGATHER has been split, so we end up with 2 v16i64 vlse64s from the one v32i64 it was crashing on.

topperc

topperc commented on Feb 8, 2024

@topperc
Collaborator

@lukel97 can you make a PR?

added a commit that references this issue on Feb 8, 2024
06c89bd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @preames@kongy@hiraditya@lukel97@EugeneZelenko

    Issue actions

      Clang fails when building LLVM for RISCV · Issue #81088 · llvm/llvm-project