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

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 02:24:38 PDT 2026


================
@@ -3327,7 +3327,7 @@ SDValue DAGCombiner::visitADD(SDNode *N) {
   }
 
   // fold a+vscale(c1)+vscale(c2) -> a+vscale(c1+c2)
-  if (N0.getOpcode() == ISD::ADD &&
+  if (TLI.isDesirableToFoldVScaleAdd(N) && N0.getOpcode() == ISD::ADD &&
----------------
lukel97 wrote:

Is this definitely worth a new TTI hook? Did you explore any other ways of avoiding the AArch64 regression?

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


More information about the llvm-commits mailing list