[PATCH] D21773: [clang] Update an optimization remark test for change D18777

Li Huang via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 28 20:02:03 PDT 2016

lihuang added a comment.

Hi Adam,

The change in http://reviews.llvm.org/D18777 breaks this test becasue it converts some sexts to zexts, which cannot be eliminated by indvar-simplification after widening IV.

The IR after indvar-simplification and before loop-vectorization is like:

  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
  add nuw nsw i64 %indvars.iv, 2                  // i + 2
  %12 = trunc i64 %11 to i32                
  %idxprom2047 = zext i32 %12 to i64
  %arrayidx21 = getelementptr inbounds i32, i32* %C, i64 %idxprom2047
  %14 = add nuw nsw i64 %indvars.iv, 3            // i + 3
  %15 = trunc i64 %14 to i32
  %idxprom2448 = zext i32 %15 to i64

IV is promoted to 64-bit but the trunc/zext cannot be eliminated (at least cannot be eliminated with the -O1 pass pipeline). Then optimzation remark becomes:

  optimization-remark-options.c:17:3: remark: loop not vectorized: cannot identify array bounds
  for (int i = 0; i < N; i++) {


More information about the cfe-commits mailing list