[llvm] 8833a44 - [VPlan] Connect scalar header to CFG in VPlan unit test.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 9 03:01:22 PST 2024


Author: Florian Hahn
Date: 2024-11-09T10:54:50Z
New Revision: 8833a4474654f7413ae3c53a15e350e06bce2d2e

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

LOG: [VPlan] Connect scalar header to CFG in VPlan unit test.

This makes sure the VPIRBasicBlock is deleted when the VPlan is
destroyed.

Fixes https://github.com/llvm/llvm-project/issues/114623.

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 4a8615cc086b08..3179cfc676ab67 100644
--- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
+++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp
@@ -731,10 +731,10 @@ TEST(VPBasicBlockTest, print) {
   }
 
   LLVMContext C;
-  auto *ScalarHeader = BasicBlock::Create(C, "");
-  // FIXME: This looks wrong.
-  auto ScalarHeaderVPBB = std::make_unique<VPIRBasicBlock>(ScalarHeader);
-  VPlan Plan(VPBB0, TC, VPBB1, ScalarHeaderVPBB.get());
+  auto *ScalarHeader = BasicBlock::Create(C, "scalar.header");
+  auto * ScalarHeaderVPBB = new VPIRBasicBlock(ScalarHeader);
+  VPBlockUtils::connectBlocks(VPBB2, ScalarHeaderVPBB);
+  VPlan Plan(VPBB0, TC, VPBB1, ScalarHeaderVPBB);
   std::string FullDump;
   raw_string_ostream OS(FullDump);
   Plan.printDOT(OS);
@@ -761,6 +761,11 @@ compound=true
     "bb2:\l" +
     "  EMIT vp\<%5\> = mul vp\<%3\>, vp\<%2\>\l" +
     "  EMIT ret vp\<%5\>\l" +
+    "Successor(s): ir-bb\<scalar.header\>\l"
+  ]
+  N2 -> N3 [ label=""]
+  N3 [label =
+    "ir-bb\<scalar.header\>:\l" +
     "No successors\l"
   ]
 }
@@ -782,7 +787,7 @@ Successor(s): bb2
   const char *ExpectedBlock2Str = R"(bb2:
   EMIT vp<%5> = mul vp<%3>, vp<%2>
   EMIT ret vp<%5>
-No successors
+Successor(s): ir-bb<scalar.header>
 )";
   std::string Block2Dump;
   raw_string_ostream OS2(Block2Dump);


        


More information about the llvm-commits mailing list