[llvm] [RISCV] Fixed redundant add instructions generated during the fold of vscale add in rvv. (PR #225266)

Kamlesh Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 07:54:06 PDT 2026


================
@@ -2153,6 +2153,15 @@ MVT RISCVTargetLowering::getVPExplicitVectorLengthTy() const {
   return Subtarget.getXLenVT();
 }
 
+// In RISCV architecture, if N0.hasOneUse() is true, returns true. Otherwise,
+// returns false. When the return value is true, the fold of vscale add can be
+// performed.
+bool RISCVTargetLowering::isProfitableToFoldVScaleAdd(const SDValue N) const {
+  if (N.hasOneUse())
----------------
kamleshbhalui wrote:

just return N.hasOneUse() ?

https://github.com/llvm/llvm-project/pull/225266


More information about the llvm-commits mailing list