[PATCH] D140678: [RISCV][WIP] Use SmallVector::append to replace some for loops in intrinsic creation. NFC

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 27 09:57:36 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG6d323e7e51c6: [RISCV] Use SmallVector::append to replace some for loops in intrinsic creation. (authored by craig.topper).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D140678

Files:
  clang/include/clang/Basic/riscv_vector.td


Index: clang/include/clang/Basic/riscv_vector.td
===================================================================
--- clang/include/clang/Basic/riscv_vector.td
+++ clang/include/clang/Basic/riscv_vector.td
@@ -853,8 +853,7 @@
           Operands.push_back(Ops[NF]);
           Operands.push_back(Ops[NF + 2]);
         } else {
-          for (unsigned I = 0; I < NF; ++I)
-            Operands.push_back(Ops[NF + I + 1]);
+          Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
           Operands.push_back(Ops[2 * NF + 1]);
           Operands.push_back(Ops[NF]);
           Operands.push_back(Ops[2 * NF + 2]);
@@ -870,10 +869,7 @@
           Operands.push_back(Ops[NF]);
           Operands.push_back(Ops[NF + 1]);
         } else {
-          for (unsigned I = 0; I < NF; ++I)
-            Operands.push_back(Ops[NF + I]);
-          Operands.push_back(Ops[2 * NF]);
-          Operands.push_back(Ops[2 * NF + 1]);
+          Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF + 2);
         }
       }
       llvm::Function *F = CGM.getIntrinsic(ID, IntrinsicTypes);
@@ -931,8 +927,7 @@
           Operands.push_back(Ops[NF + 3]);
           NewVL = Ops[NF + 2];
         } else {
-          for (unsigned I = 0; I < NF; ++I)
-            Operands.push_back(Ops[NF + I + 1]);
+          Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
           Operands.push_back(Ops[2 * NF + 1]);
           Operands.push_back(Ops[NF]);
           Operands.push_back(Ops[2 * NF + 3]);
@@ -950,8 +945,7 @@
           Operands.push_back(Ops[NF + 2]);
           NewVL = Ops[NF + 1];
         } else {
-          for (unsigned I = 0; I < NF; ++I)
-            Operands.push_back(Ops[NF + I]);
+          Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
           Operands.push_back(Ops[2 * NF]);
           Operands.push_back(Ops[2 * NF + 2]);
           NewVL = Ops[2 * NF + 1];
@@ -1012,8 +1006,7 @@
           Operands.push_back(Ops[NF]);
           Operands.push_back(Ops[NF + 3]);
         } else {
-          for (unsigned I = 0; I < NF; ++I)
-            Operands.push_back(Ops[NF + I + 1]);
+          Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
           Operands.push_back(Ops[2 * NF + 1]);
           Operands.push_back(Ops[2 * NF + 2]);
           Operands.push_back(Ops[NF]);
@@ -1031,8 +1024,7 @@
           Operands.push_back(Ops[NF + 1]);
           Operands.push_back(Ops[NF + 2]);
         } else {
-          for (unsigned I = 0; I < NF; ++I)
-            Operands.push_back(Ops[NF + I]);
+          Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
           Operands.push_back(Ops[2 * NF]);
           Operands.push_back(Ops[2 * NF + 1]);
           Operands.push_back(Ops[2 * NF + 2]);
@@ -1087,8 +1079,7 @@
           Operands.push_back(Ops[NF + 3]);
           IntrinsicTypes = {ResultType, Ops[NF + 2]->getType(), Ops.back()->getType()};
         } else {
-          for (unsigned I = 0; I < NF; ++I)
-            Operands.push_back(Ops[NF + I + 1]);
+          Operands.append(Ops.begin() + NF + 1, Ops.begin() + 2 * NF + 1);
           Operands.push_back(Ops[2 * NF + 1]);
           Operands.push_back(Ops[2 * NF + 2]);
           Operands.push_back(Ops[NF]);
@@ -1108,8 +1099,7 @@
           Operands.push_back(Ops[NF + 2]);
           IntrinsicTypes = {ResultType, Ops[NF + 1]->getType(), Ops.back()->getType()};
         } else {
-          for (unsigned I = 0; I < NF; ++I)
-            Operands.push_back(Ops[NF + I]);
+          Operands.append(Ops.begin() + NF, Ops.begin() + 2 * NF);
           Operands.push_back(Ops[2 * NF]);
           Operands.push_back(Ops[2 * NF + 1]);
           Operands.push_back(Ops[2 * NF + 2]);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140678.485391.patch
Type: text/x-patch
Size: 3733 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221227/3effbb7b/attachment-0001.bin>


More information about the cfe-commits mailing list