The vector induction variable (IV) is created quite early in the pipeline, but may end not being used, and this change avoids emitting the vector IV if that is the case. The scalar IV is splatted into a vector with a code sequence like this:
[[BROADCAST_SPLATINSERT:%.*]] = insertelement <4 x i32> undef, i32 [[INDEX]], i32 0 [[BROADCAST_SPLAT:%.*]] = shufflevector <4 x i32> [[BROADCAST_SPLATINSERT]], <4 x i32> undef, <4 x i32> zeroinitializer
We save these instructions to a list where they are being created, and remove them at the end in fixVectorizedLoop where similar fixes and clean ups are performed.
The obvious benefit of this simple admin job is that it makes the LV's output more compact and readable, this unused code can be confusing to look at, and other cleanup passes have to work a little bit less hard.
This doesn't really broadcast when VF<=1 so should be fine?