[llvm] [VPlan] Make canonical IV part of the region (PR #156262)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 15 18:06:23 PDT 2026
================
@@ -429,6 +429,14 @@ static bool canonicalHeaderAndLatch(VPBlockBase *HeaderVPB,
/// Create a new VPRegionBlock for the loop starting at \p HeaderVPB.
static void createLoopRegion(VPlan &Plan, VPBlockBase *HeaderVPB) {
+ // Get type info and debug location from the scalar phi corresponding to the
+ // canonical IV of the outermost (to be vectorized) loop.
----------------
ayalz wrote:
There's a discrepancy here which can hopefully be fixed. Only the outermost region is introduced a VPPhi at the beginning of its header, carrying the type and debug info of it's widest induction according to Legal. But every loop including the outermost plus any loop nested inside it are assigned a loop region (here), which requires a canonical IV, which in turn requires some type and debug info. For all loops except the outermost this IV merely exists to indicate that the region is a loop region - it does not feed any users. Having nested loops inherit the type and debug info of the outermost loop seems awkward. An empty debug location could be used instead, but a null type might be problematic(?). Nested loops are very well formed, could the terminator of LatchVPBB provide a relevant Type?
Good to add to documentation above that the new VPRegionBlock created for the loop starting at HeaderVPB contains a canonical IV that is used only if the loop is outermost (or something along these lines).
https://github.com/llvm/llvm-project/pull/156262
More information about the llvm-commits
mailing list