]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/commit
This patch de-pessimizes the calculation of loop trip counts in
authorMark Heffernan <meheff@google.com>
Fri, 10 Oct 2014 17:39:11 +0000 (17:39 +0000)
committerMark Heffernan <meheff@google.com>
Fri, 10 Oct 2014 17:39:11 +0000 (17:39 +0000)
commited05e3703e07dfeae33acdd3cc5ad07b5f5b86c6
tree9156ed35137a829cf136575d7e510abc0ebb1170
parenta64ffb893bb7c5c51635475dc8adee210279262a
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.

ControlsExit replaces IsSubExpr to more precisely track the case where
undefined behavior is expected to occur. Because undefined behavior is
tracked more precisely we can remove MustExit from ExitLimit. MustExit
was used to track the case where the limit was computed potentially
assuming undefined behavior even if undefined behavior didn't necessarily
occur.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219517 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/ScalarEvolution.cpp
test/Analysis/ScalarEvolution/trip-count-pow2.ll
test/Transforms/LoopUnroll/scevunroll.ll