Extend ScalarEvolution's multiple-exit support to compute exact
authorDan Gohman <gohman@apple.com>
Wed, 24 Jun 2009 01:18:18 +0000 (01:18 +0000)
committerDan Gohman <gohman@apple.com>
Wed, 24 Jun 2009 01:18:18 +0000 (01:18 +0000)
commit40a5a1b39ee1cd40ff9d04740386b667fb27b340
tree0e7c7275525d07b2805e5da9b929fb820a2fd24b
parentb825aaa0289206a63f7e6ce7b5ca7c2d6a2c063e
Extend ScalarEvolution's multiple-exit support to compute exact
trip counts in more cases.

Generalize ScalarEvolution's isLoopGuardedByCond code to recognize
And and Or conditions, splitting the code out into an
isNecessaryCond helper function so that it can evaluate Ands and Ors
recursively, and make SCEVExpander be much more aggressive about
hoisting instructions out of loops.

test/CodeGen/X86/pr3495.ll has an additional instruction now, but
it appears to be due to an arbitrary register allocation difference.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74048 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/ScalarEvolution.cpp
lib/Analysis/ScalarEvolutionExpander.cpp
lib/Transforms/Scalar/IndVarSimplify.cpp
lib/Transforms/Scalar/LoopStrengthReduce.cpp
test/CodeGen/X86/pr3495.ll