[llvm] bd2b4ae - [VPlan] Add unittest for printing plans with VFs and UFs (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 22 10:30:16 PST 2022


Author: Florian Hahn
Date: 2022-12-22T18:29:39Z
New Revision: bd2b4aeeaf0cf2cefae9efddef81c770bf20c5e0

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

LOG: [VPlan] Add unittest for printing plans with VFs and UFs (NFC).

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 d4c12eb3fab57..23ac6600c768c 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
@@ -764,6 +764,48 @@ No successors
     EXPECT_EQ("EMIT vp<%4> = mul vp<%2> vp<%1>", I4Dump);
   }
 }
+
+TEST(VPBasicBlockTest, printPlanWithVFsAndUFs) {
+  VPInstruction *I1 = new VPInstruction(Instruction::Add, {});
+
+  VPBasicBlock *VPBB1 = new VPBasicBlock();
+  VPBB1->appendRecipe(I1);
+  VPBB1->setName("bb1");
+
+  VPlan Plan;
+  Plan.setName("TestPlan");
+  Plan.addVF(ElementCount::getFixed(4));
+  Plan.setEntry(VPBB1);
+
+  {
+    std::string FullDump;
+    raw_string_ostream OS(FullDump);
+    Plan.print(OS);
+
+    const char *ExpectedStr = R"(VPlan 'TestPlan for VF={4},UF>=1' {
+bb1:
+  EMIT vp<%1> = add
+No successors
+}
+)";
+    EXPECT_EQ(ExpectedStr, FullDump);
+  }
+
+  {
+    Plan.addVF(ElementCount::getScalable(8));
+    std::string FullDump;
+    raw_string_ostream OS(FullDump);
+    Plan.print(OS);
+
+    const char *ExpectedStr = R"(VPlan 'TestPlan for VF={4,vscale x 8},UF>=1' {
+bb1:
+  EMIT vp<%1> = add
+No successors
+}
+)";
+    EXPECT_EQ(ExpectedStr, FullDump);
+  }
+}
 #endif
 
 TEST(VPRecipeTest, CastVPInstructionToVPUser) {


        


More information about the llvm-commits mailing list