There isn’t a loop peeling utility for affine.for
and a contribution here is welcome. Similar functionality exists for unrolling and unroll-and-jam where a cleanup loop is generated when needed. lib/Dialect/Affine/Utils/LoopUtils.cpp
is where the loop peeling utility can go.
A peeling utility could be useful regardless of misalignment (for e.g. when the trip count doesn’t divide the vector width, peel and vectorize is one of the several ways to vectorize).