[llvm] [AArch64] Convert UADDV(add(zext, zext)) into UADDLV(concat). (PR #78301)

Rin Dobrescu via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 02:08:10 PST 2024


================
@@ -16539,14 +16570,20 @@ static SDValue performUADDVAddCombine(SDValue A, SelectionDAG &DAG) {
     if (SDValue R = performUADDVAddCombine(A.getOperand(1), DAG))
       return DAG.getNode(ISD::ADD, SDLoc(A), A.getValueType(), R,
                          A.getOperand(0));
+
+  if (SDValue R = DetectZextConcat(A, DAG))
+    return R;
+
   return SDValue();
 }
 
 static SDValue performUADDVCombine(SDNode *N, SelectionDAG &DAG) {
   SDValue A = N->getOperand(0);
   if (A.getOpcode() == ISD::ADD)
     if (SDValue R = performUADDVAddCombine(A, DAG))
-      return DAG.getNode(N->getOpcode(), SDLoc(N), N->getValueType(0), R);
+      return R.getOpcode() == AArch64ISD::UADDLV
----------------
Rin18 wrote:

> Would it be simpler if DetectZextConcat was in this function too, after this if nest?

I tried to follow the structure of the other functions. It looked to me like the functions of type perform<pattern>Combine() only call the functions that actually contain the functionality to do the combine. So it seemed neater to keep DetectZextConcat in performUADDVAddCombine rather than performUADDVCombine.

I could create another function for DetectZextConcat to call in performUADDVCombine if performUADDVAddCombine doesn't look like the right place for it, or it complicates the code.

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


More information about the llvm-commits mailing list