[vectorization ] Equivalent source conversion is used to reduce optimization difficulty

For test s1113( Compiler Explorer ), now both llvm and gcc can’t vectorize

void s1113(void)
   for (int i = 0; i < LEN_1D; ++i) {
      a[i] = a[LEN_1D/2] + b[i];

While its equivalent function source s1113_1, both llvm and gcc can vectorize

void s1113_1(void) {
   const real_t c1 = a[LEN_1D/2];
   const real_t c2 = b[LEN_1D/2];
   for (int i = 0; i < LEN_1D; ++i) {
      a[i] = c1 + b[i];
      if (i > LEN_1D/2)
        a[i] += c2;

so is there a suitable pass for such conversions?

“LLVM Opt Pipeline” viewer should give you insight on which passes are run and their effect: Compiler Explorer

Thank you very much @Endill .
The changed pass is marked in different colors, which is very convenience to view.

I’d like to know if there’s a pass that’s worth enhancing to transform the loop structure so that it can be further vectorized later.