[PATCH] Enable unrolling of multi-exit loops

Mark Heffernan meheff at google.com
Tue Sep 30 14:35:26 PDT 2014


Hi atrick, jingyue,

This patch de-pessimizes the calculation of loop trip counts in ScalarEvolution in the presence of multiple exits.  Previously all loops exits had to have identical counts for a loop trip count to be considered computable.  This pessimization was implemented by calling getBackedgeTakenCount(L) rather than getExitCount(L, ExitingBlock) inside of ScalarEvolution::
getSmallConstantTripCount() (see the FIXME in the comments of that function).  The pessimization was added to fix a corner case involving undefined behavior (pr/16130).  This patch more precisely handles the undefined behavior case allowing the pessimization to be removed.

http://reviews.llvm.org/D5550

Files:
  include/llvm/Analysis/ScalarEvolution.h
  lib/Analysis/ScalarEvolution.cpp
  test/Analysis/ScalarEvolution/trip-count-pow2.ll
  test/Transforms/LoopUnroll/scevunroll.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5550.14248.patch
Type: text/x-patch
Size: 43454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140930/024b9e74/attachment.bin>


More information about the llvm-commits mailing list