[llvm] [VPlan] Replace VPRegionBlock with explicit CFG before execute (NFCI). (PR #117506)

via llvm-commits llvm-commits at lists.llvm.org
Sun May 11 05:02:07 PDT 2025


================
@@ -2845,11 +2837,15 @@ void InnerLoopVectorizer::fixVectorizedLoop(VPTransformState &State) {
 
   // Don't apply optimizations below when no vector region remains, as they all
   // require a vector loop at the moment.
-  if (!State.Plan->getVectorLoopRegion())
+  VPBasicBlock *HeaderVPBB = find_singleton<VPBasicBlock>(
+      vp_depth_first_shallow(State.Plan->getEntry()),
+      [&State](VPBlockBase *VPB, bool) {
+        auto *VPBB = dyn_cast<VPBasicBlock>(VPB);
+        return VPBB && VPBB->isHeader(State.VPDT) ? VPBB : nullptr;
----------------
ayalz wrote:

At this point when IRBB's have been created for VPBB's and LI is maintained for the former, can lookup VPBB2IRBB for each VPBB and then check if LI->isLoopHeader(), before retrieving LI->getLoopFor().

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


More information about the llvm-commits mailing list