@@ -49,7 +49,7 @@ struct MemoryOpGroup {
4949 bool isLoadGroup () const { return type == Type::Load; }
5050 bool isStoreGroup () const { return type == Type::Store; }
5151
52- size_t size () const { return ops.size (); }
52+ size_t opsCount () const { return ops.size (); }
5353};
5454
5555static bool maybeReadOp (Operation *op) {
@@ -305,7 +305,7 @@ extractContiguousGroups(const MemoryOpGroup &group) {
305305 }
306306
307307 LLVM_DEBUG (llvm::dbgs () << " Extracted contiguous group with "
308- << currentGroup.size () << " operations\n " );
308+ << currentGroup.opsCount () << " operations\n " );
309309 }
310310 return result;
311311}
@@ -353,7 +353,7 @@ struct SLPGraphNode {
353353 SLPGraphNode (ArrayRef<Operation *> operations)
354354 : ops(operations.begin(), operations.end()) {}
355355
356- size_t size () const { return ops.size (); }
356+ size_t opsCount () const { return ops.size (); }
357357
358358 Operation *op () const {
359359 assert (!ops.empty () && " empty ops" );
@@ -507,13 +507,14 @@ class SLPGraph {
507507 if (!node->isRoot )
508508 continue ;
509509 llvm::dbgs () << " " << (maybeReadOp (node->op ()) ? " LOAD" : " STORE" )
510- << " group with " << node->size () << " operations:\n " ;
510+ << " group with " << node->opsCount () << " operations:\n " ;
511511 for (auto *op : node->ops ) {
512512 llvm::dbgs () << " " << *op << " \n " ;
513513 }
514514 llvm::dbgs () << " Users: " ;
515515 for (auto *user : node->users ) {
516- llvm::dbgs () << " \n Group with " << user->size () << " operations:" ;
516+ llvm::dbgs () << " \n Group with " << user->opsCount ()
517+ << " operations:" ;
517518 for (auto *op : user->ops ) {
518519 llvm::dbgs () << " \n " << *op;
519520 }
@@ -526,21 +527,22 @@ class SLPGraph {
526527 for (const auto &node : nodes) {
527528 if (node->isRoot )
528529 continue ;
529- llvm::dbgs () << " Group with " << node->size () << " operations:\n " ;
530+ llvm::dbgs () << " Group with " << node->opsCount () << " operations:\n " ;
530531 for (auto *op : node->ops ) {
531532 llvm::dbgs () << " " << *op << " \n " ;
532533 }
533534 llvm::dbgs () << " Operands: " ;
534535 for (auto *operand : node->operands ) {
535- llvm::dbgs () << " \n Group with " << operand->size ()
536+ llvm::dbgs () << " \n Group with " << operand->opsCount ()
536537 << " operations:" ;
537538 for (auto *op : operand->ops ) {
538539 llvm::dbgs () << " \n " << *op;
539540 }
540541 }
541542 llvm::dbgs () << " \n Users: " ;
542543 for (auto *user : node->users ) {
543- llvm::dbgs () << " \n Group with " << user->size () << " operations:" ;
544+ llvm::dbgs () << " \n Group with " << user->opsCount ()
545+ << " operations:" ;
544546 for (auto *op : user->ops ) {
545547 llvm::dbgs () << " \n " << *op;
546548 }
@@ -697,7 +699,7 @@ static bool
697699checkOpVecType (SLPGraphNode *node,
698700 llvm::function_ref<bool (Type, size_t )> isValidVecType) {
699701 Operation *op = node->op ();
700- size_t size = node->size ();
702+ size_t size = node->opsCount ();
701703 auto checkRes = [](bool res) -> bool {
702704 LLVM_DEBUG (llvm::dbgs () << (res ? " true" : " false" ) << " \n " );
703705 return res;
@@ -779,7 +781,7 @@ static SLPGraph buildSLPGraph(ArrayRef<MemoryOpGroup> rootGroups) {
779781 worklist.push_back (node);
780782
781783 LLVM_DEBUG ({
782- llvm::dbgs () << " Created root group node with " << node->size ()
784+ llvm::dbgs () << " Created root group node with " << node->opsCount ()
783785 << " operations of type "
784786 << (group.isLoadGroup () ? " Load" : " Store" ) << " \n " ;
785787 });
@@ -907,7 +909,7 @@ static SLPGraph buildSLPGraph(ArrayRef<MemoryOpGroup> rootGroups) {
907909 while (!worklist.empty ()) {
908910 SLPGraphNode *node = worklist.pop_back_val ();
909911 LLVM_DEBUG (llvm::dbgs ()
910- << " Processing node with " << node->size ()
912+ << " Processing node with " << node->opsCount ()
911913 << " operations, first op: " << node->op ()->getName () << " \n " );
912914
913915 Operation *op = node->op ();
@@ -940,34 +942,35 @@ SLPGraph::vectorize(IRRewriter &rewriter,
940942 LLVM_DEBUG ({
941943 llvm::dbgs () << " Topologically sorted nodes:\n " ;
942944 for (auto *node : sortedNodes) {
943- llvm::dbgs () << " Node with " << node->size ()
945+ llvm::dbgs () << " Node with " << node->opsCount ()
944946 << " operations: " << node->op ()->getName () << " \n " ;
945947 }
946948 });
947949
948950 auto isBadNode = [&](SLPGraphNode *node) {
949951 // Do not vectorize stray nodes which are not connected to any other
950952 // nodes.
951- return (node->users .empty () && node->operands .empty ()) || node->size () <= 1 ;
953+ return (node->users .empty () && node->operands .empty ()) ||
954+ node->opsCount () <= 1 ;
952955 };
953956
954957 // Update node vec sizes if its inputs vec sizes are smaller.
955958 // This is nedeed to handle situations when we have 3->3->4 sizes in tree.
956959 // TODO: It maybe possible to reconstruct the larger vec size combining src
957960 // smaller vector and scalar arg.
958961 for (auto *node : sortedNodes) {
959- size_t size = node->size ();
962+ size_t size = node->opsCount ();
960963 for (auto *operand : node->operands )
961- size = std::min (size, operand->size ());
964+ size = std::min (size, operand->opsCount ());
962965
963- if (size < node->size ()) {
966+ if (size < node->opsCount ()) {
964967 LLVM_DEBUG (llvm::dbgs ()
965- << " Size mismatch, resizing node with " << node->size ()
968+ << " Size mismatch, resizing node with " << node->opsCount ()
966969 << " operations to " << size << " \n " );
967970 node->ops .resize (size);
968971 }
969972
970- while (node->size () > 1 ) {
973+ while (node->opsCount () > 1 ) {
971974 if (checkOpVecType (node, isValidVecType))
972975 break ;
973976
@@ -982,7 +985,7 @@ SLPGraph::vectorize(IRRewriter &rewriter,
982985 IRMapping mapping;
983986 for (auto *node : sortedNodes) {
984987 LLVM_DEBUG ({
985- llvm::dbgs () << " Processing node with " << node->size ()
988+ llvm::dbgs () << " Processing node with " << node->opsCount ()
986989 << " operations\n " ;
987990 llvm::dbgs () << " First op: " << *node->op () << " \n " ;
988991 });
@@ -997,7 +1000,7 @@ SLPGraph::vectorize(IRRewriter &rewriter,
9971000 LLVM_DEBUG (llvm::dbgs () << " Insertion point: " << *ip << " \n " );
9981001
9991002 rewriter.setInsertionPoint (ip);
1000- int64_t numElements = node->size ();
1003+ int64_t numElements = node->opsCount ();
10011004 Location loc = op->getLoc ();
10021005
10031006 auto handleNonVectorInputs = [&](ValueRange operands) {
@@ -1115,7 +1118,7 @@ tryToVectorizeInBlock(Block &block,
11151118 << " contiguous groups in "
11161119 << (group.isLoadGroup () ? " load" : " store" ) << " group\n " ;
11171120 for (const auto &contigGroup : contiguousGroups) {
1118- llvm::dbgs () << " Contiguous group with " << contigGroup.size ()
1121+ llvm::dbgs () << " Contiguous group with " << contigGroup.opsCount ()
11191122 << " operations\n " ;
11201123 }
11211124 });
0 commit comments