[PATCH] D22886: [llvm] Loop Vectorization fault in collectLoopUni

Wei Mi via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 15:59:59 PDT 2016


wmi added a comment.

Thanks for helping me fixing the bug. I think most of the cases worklist is not empty because loop condition is usually defined inside the loop, but it is possible that the loop condition is defined outside of loop. I think your fix is good.

Here is a testcase reproducing the problem:

~/workarea/llvm-r275818/dbuild/bin/opt -loop-vectorize -S < a.ll

a.ll:

  define void @foo() local_unnamed_addr {
  entry:
    %exitcond = icmp eq i64 3, 3
    br label %for.body
  
  for.body:                                         ; preds = %entry
    %i.05 = phi i64 [ %inc, %for.body ], [ 0, %entry ]
    %total1 = add nsw i64 %i.05, 3
    %inc = add nuw nsw i64 %i.05, 1
    br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
  
  for.end:                                          ; preds = %for.body
    ret void
  }
  
  !0 = distinct !{!0, !1}
  !1 = !{!"llvm.loop.vectorize.enable", i1 true}




https://reviews.llvm.org/D22886





More information about the llvm-commits mailing list