[llvm] [VPlan] Connect (MemRuntime|SCEV)Check blocks as VPlan transform (NFC). (PR #143879)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 5 12:25:02 PDT 2025


================
@@ -7612,11 +7512,21 @@ EpilogueVectorizerEpilogueLoop::createEpilogueVectorizedLoopSkeleton() {
   EPI.EpilogueIterationCountCheck->getTerminator()->replaceUsesOfWith(
       VecEpilogueIterationCountCheck, LoopScalarPreHeader);
 
-  if (EPI.SCEVSafetyCheck)
-    EPI.SCEVSafetyCheck->getTerminator()->replaceUsesOfWith(
+  // Retrieve blocks with SCEV and memory runtime checks, if they have been
+  // connected to the CFG, otherwise they are unused and will be deleted. Their
+  // terminators and phis using them need adjusting below.
+  BasicBlock *SCEVCheckBlock = RTChecks.getSCEVCheckBlock();
+  if (SCEVCheckBlock && pred_empty(SCEVCheckBlock))
+    SCEVCheckBlock = nullptr;
----------------
ayalz wrote:

When can SCEVCheckBlock exist but remain disconnected from the CFG at this point? Same for MemCheckBlock.

https://github.com/llvm/llvm-project/pull/143879


More information about the llvm-commits mailing list