[llvm] 3632bf8 - [VPlan] Add test for VPAllSuccessorIterator directly. (NFC)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 04:12:35 PST 2023


Author: Florian Hahn
Date: 2023-01-17T12:12:11Z
New Revision: 3632bf85079bc497993def427223e9d74389a659

URL: https://github.com/llvm/llvm-project/commit/3632bf85079bc497993def427223e9d74389a659
DIFF: https://github.com/llvm/llvm-project/commit/3632bf85079bc497993def427223e9d74389a659.diff

LOG: [VPlan] Add test for VPAllSuccessorIterator directly. (NFC)

Additional test coverage for D140511.

Added: 
    

Modified: 
    llvm/unittests/Transforms/Vectorize/VPlanTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
index a1c1a058dc571..0effff9b745da 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
@@ -394,10 +394,18 @@ TEST(VPBasicBlockTest, TraversingIteratorTest) {
     VPBlockUtils::connectBlocks(R2BB1, R2BB2);
     VPBlockUtils::connectBlocks(R1, R2);
 
+    // Successors of R1.
+    SmallVector<const VPBlockBase *> FromIterator(
+        VPAllSuccessorsIterator<VPBlockBase *>(R1),
+        VPAllSuccessorsIterator<VPBlockBase *>::end(R1));
+    EXPECT_EQ(2u, FromIterator.size());
+    EXPECT_EQ(R1BB1, FromIterator[0]);
+    EXPECT_EQ(R2, FromIterator[1]);
+
     // Depth-first.
     VPBlockRecursiveTraversalWrapper<VPBlockBase *> Start(R1);
-    SmallVector<const VPBlockBase *> FromIterator(df_begin(Start),
-                                                  df_end(Start));
+    FromIterator.clear();
+    copy(df_begin(Start), df_end(Start), std::back_inserter(FromIterator));
     EXPECT_EQ(8u, FromIterator.size());
     EXPECT_EQ(R1, FromIterator[0]);
     EXPECT_EQ(R1BB1, FromIterator[1]);


        


More information about the llvm-commits mailing list