[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
Thu Oct 1 01:22:29 PDT 2026


================
@@ -4771,6 +4771,14 @@ class LLVM_ABI TargetLowering : public TargetLoweringBase {
     return true;
   }
 
+  /// fold (A + vscale(C1)) + vscale(C2) -> A + vscale(C1+C2)
+  /// If (A + vscale(C1)) is used multiple times, the fold results in a
+  /// redundant addition instruction on the RISC-V architecture, whereas it
+  /// does not have this effect on other architectures (e.g. AArch64).
+  /// By default, it returns true. In RISC-V architecture, returns
----------------
kamleshbhalui wrote:

Last sentence can be removed.

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


More information about the llvm-commits mailing list