[PATCH] D12477: [LV] Don't bail to MiddleBlock if a runtime check fails, bail to ScalarPH instead

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 10:06:11 PDT 2015


jmolloy added a comment.

Hi Michael,

> Won't we execute one iteration of scalar loop when trip-count is 0? IIUC, before the change we checked (0%VF==0) and went to MiddleBlock, where we checked it against 0, and then skipped the scalar loop. After the change we check (0%VF==0) and go straight to scalar pre-header. Thus we'll execute one iteration for this loop, which is incorrect. Do I miss something?


You're right, but I think this behavior is correct. The trip count can never be zero, because the original loop is in LoopSimplify form. That means it has a trip count of at least one (because the loop test is in the latch). Therefore we never need to check if the trip count is 0 before the vector loop - just after the vector loop (because N - (N % VF) could be zero).

James


Repository:
  rL LLVM

http://reviews.llvm.org/D12477





More information about the llvm-commits mailing list