Skip to content

[RISCV][NFC] Remove duplicate setTargetDAGCombine registrations#186928

Merged
tclin914 merged 2 commits intollvm:mainfrom
tclin914:riscv-nfc-dedup-dagcombine
Mar 17, 2026
Merged

[RISCV][NFC] Remove duplicate setTargetDAGCombine registrations#186928
tclin914 merged 2 commits intollvm:mainfrom
tclin914:riscv-nfc-dedup-dagcombine

Conversation

@tclin914
Copy link
Copy Markdown
Contributor

ISD::SRA and ISD::MUL are already registered unconditionally in the constructor, so remove the redundant registrations from the hasVInstructions() block. Fold the standalone SRA call into the existing brace-initializer list.

tclin914 and others added 2 commits March 17, 2026 08:38
ISD::SRA and ISD::MUL are already registered unconditionally in the
constructor, so remove the redundant registrations from the
hasVInstructions() block. Fold the standalone SRA call into the
existing brace-initializer list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@llvmbot
Copy link
Copy Markdown
Member

llvmbot commented Mar 17, 2026

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

Author: Jim Lin (tclin914)

Changes

ISD::SRA and ISD::MUL are already registered unconditionally in the constructor, so remove the redundant registrations from the hasVInstructions() block. Fold the standalone SRA call into the existing brace-initializer list.


Full diff: https://github.com/llvm/llvm-project/pull/186928.diff

1 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVISelLowering.cpp (+7-7)
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 7e0c6a6aedfcc..d76a251248f2e 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -1885,8 +1885,8 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
 
   setTargetDAGCombine({ISD::INTRINSIC_VOID, ISD::INTRINSIC_W_CHAIN,
                        ISD::INTRINSIC_WO_CHAIN, ISD::ADD, ISD::SUB, ISD::MUL,
-                       ISD::AND, ISD::OR, ISD::XOR, ISD::SETCC, ISD::SELECT});
-  setTargetDAGCombine(ISD::SRA);
+                       ISD::AND, ISD::OR, ISD::XOR, ISD::SETCC, ISD::SELECT,
+                       ISD::SRA});
   setTargetDAGCombine(ISD::SIGN_EXTEND_INREG);
 
   if (Subtarget.hasStdExtFOrZfinx())
@@ -1908,12 +1908,12 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
   if (Subtarget.hasVInstructions())
     setTargetDAGCombine(
         {ISD::FCOPYSIGN,    ISD::MGATHER,      ISD::MSCATTER,
-         ISD::VP_GATHER,    ISD::VP_SCATTER,   ISD::SRA,
-         ISD::SRL,          ISD::SHL,          ISD::STORE,
-         ISD::SPLAT_VECTOR, ISD::BUILD_VECTOR, ISD::CONCAT_VECTORS,
+         ISD::VP_GATHER,    ISD::VP_SCATTER,   ISD::SRL,
+         ISD::SHL,          ISD::STORE,        ISD::SPLAT_VECTOR,
+         ISD::BUILD_VECTOR, ISD::CONCAT_VECTORS,
          ISD::VP_STORE,     ISD::VP_TRUNCATE,  ISD::EXPERIMENTAL_VP_REVERSE,
-         ISD::MUL,          ISD::SDIV,         ISD::UDIV,
-         ISD::SREM,         ISD::UREM,         ISD::INSERT_VECTOR_ELT,
+         ISD::SDIV,         ISD::UDIV,         ISD::SREM,
+         ISD::UREM,         ISD::INSERT_VECTOR_ELT,
          ISD::ABS,          ISD::CTPOP,        ISD::VECTOR_SHUFFLE,
          ISD::FMA,          ISD::VSELECT,      ISD::VECREDUCE_ADD});
 

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 17, 2026

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Copy Markdown
Collaborator

@topperc topperc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tclin914 tclin914 merged commit b7843a2 into llvm:main Mar 17, 2026
10 checks passed
@tclin914 tclin914 deleted the riscv-nfc-dedup-dagcombine branch March 17, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants