[PATCH] D149174: [RISCV] Disable combineBinOpToReduce if the reduction AVL might be 0.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 18:47:28 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe80da0f8409a: [RISCV] Disable combineBinOpToReduce if the reduction AVL might be 0. (authored by craig.topper).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149174/new/

https://reviews.llvm.org/D149174

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp


Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -9170,6 +9170,11 @@
   if (!ScalarV.hasOneUse())
     return SDValue();
 
+  // If the AVL is zero, operand 0 will be returned. So it's not safe to fold.
+  // FIXME: We might be able to improve this if operand 0 is undef.
+  if (!isNonZeroAVL(Reduce.getOperand(5)))
+    return SDValue();
+
   SDValue NewStart = N->getOperand(1 - ReduceIdx);
 
   SDLoc DL(N);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149174.517015.patch
Type: text/x-patch
Size: 580 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230426/2f59b6f6/attachment.bin>


More information about the llvm-commits mailing list