1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00
Commit Graph

492 Commits

Author SHA1 Message Date
Dan Gohman
a3bc6b13f7 Allow "exhaustive" trip count evaluation on phi nodes with all
constant operands.

llvm-svn: 106537
2010-06-22 13:15:46 +00:00
Dan Gohman
6a3c46ad49 Use A.append(...) instead of A.insert(A.end(), ...) when A is a
SmallVector, and other SmallVector simplifications.

llvm-svn: 106452
2010-06-21 19:47:52 +00:00
Dan Gohman
cec5b682b6 Fix ScalarEvolution's "exhaustive" trip count evaluation code to avoid
assuming that loops are in canonical form, as ScalarEvolution doesn't
depend on LoopSimplify itself. Also, with indirectbr not all loops can
be simplified. This fixes PR7416.

llvm-svn: 106389
2010-06-19 14:17:24 +00:00
Dan Gohman
b5ec637e57 Revert r106304 (105548 and friends), which are the SCEVComplexityCompare
optimizations. There is still some nondeterminism remaining.

llvm-svn: 106306
2010-06-18 19:54:20 +00:00
Dan Gohman
527b570925 Reapply 105540, 105542, and 105548, and revert r105732.
llvm-svn: 106304
2010-06-18 19:26:04 +00:00
Dan Gohman
75f6f94c48 Reapply 105546.
llvm-svn: 106302
2010-06-18 19:12:32 +00:00
Dan Gohman
ab895769a7 Reapply 105544.
llvm-svn: 106301
2010-06-18 19:09:27 +00:00
Dan Gohman
e20e668c7e Remove getIntegerSCEV; it's redundant with getConstant, and getConstant
is more consistent with the ConstantInt API.

llvm-svn: 106281
2010-06-18 14:33:50 +00:00
Dan Gohman
1d9d93381a Simplify this code.
llvm-svn: 106254
2010-06-17 23:34:09 +00:00
Evan Cheng
28c151ae52 Revert 105540, 105542, 105544, 105546, and 105548 to unbreak bootstrapping.
llvm-svn: 105740
2010-06-09 18:59:43 +00:00
Dan Gohman
490f4d7020 The FoldingSet hash data includes pointer values, so it isn't
determinstic. Instead, give SCEV objects an arbitrary sequence
number.

llvm-svn: 105548
2010-06-07 19:36:14 +00:00
Dan Gohman
ee75f6f4dd Optimize this code somewhat by taking advantage of the fact
that the operands are sorted.

llvm-svn: 105546
2010-06-07 19:20:57 +00:00
Dan Gohman
e4676a62de Micro-optimize this, to speed up this hotspot in debug builds a little.
llvm-svn: 105544
2010-06-07 19:16:37 +00:00
Dan Gohman
044a968609 Micro-optimize this.
llvm-svn: 105542
2010-06-07 19:12:54 +00:00
Dan Gohman
65954b2eb4 Optimize ScalarEvolution's SCEVComplexityCompare predicate: don't go
scrounging through SCEVUnknown contents and SCEVNAryExpr operands;
instead just do a simple deterministic comparison of the precomputed
hash data.

Also, since this is more precise, it eliminates the need for the slow
N^2 duplicate detection code.

llvm-svn: 105540
2010-06-07 19:06:13 +00:00
Dan Gohman
5ba21692e6 ConstantFoldConstantExpression can theoretically return null.
llvm-svn: 104948
2010-05-28 16:12:08 +00:00
Dan Gohman
5c61a913b2 Use the SCEVAddRecExpr::getPostIncExpr utility function instead
of doing the same thing manually.

llvm-svn: 102997
2010-05-04 01:12:27 +00:00
Dan Gohman
4e1dbacdf8 Fix a copy+pasto.
llvm-svn: 102996
2010-05-04 01:11:15 +00:00
Dan Gohman
2f27d59870 Use getConstant instead of getIntegerSCEV. The two are basically the
same, now that getConstant has overloads consistent with ConstantInt::get.

llvm-svn: 102965
2010-05-03 22:09:21 +00:00
Dan Gohman
66c6519877 Silence warnings about -1 being converted to an unsigned value.
Also, pass true for isSigned even when creating constants for unsigned
comparisons, because the point is to create an all-ones constant,
rather than UINT64_MAX, even for integers wider than 64 bits.

llvm-svn: 102946
2010-05-03 20:23:47 +00:00
Dan Gohman
51faf74c7d Use isTrueWhenEqual and isFalseWhenEqual instead of assuming that
SimplifyICmpOperands will simplify such cases to EQ or NE. This makes
the correcntess of the code independent on SimplifyICmpOperands doing
certain simplifications.

llvm-svn: 102927
2010-05-03 18:00:24 +00:00
Dan Gohman
b4fdc7ea81 In ScalarEvolution::print, don't bother printing out the SCEVs for
comparison instructions, since they aren't interesting, despite having
integer result types.

llvm-svn: 102925
2010-05-03 17:03:23 +00:00
Dan Gohman
043875bc90 In SimplifyICmpOperands, avoid needlessly swapping the operands in the
case where both are addrecs in unrelated loops.

llvm-svn: 102924
2010-05-03 17:00:11 +00:00
Dan Gohman
02c26ed601 Factor out the new <= and >= analysis code into SimplifyICmpOperands.
llvm-svn: 102922
2010-05-03 16:35:17 +00:00
Dan Gohman
116829ede7 Set isSigned to true when creating an all-ones integer constant, even
for unsigned purposes, so >64-bit integer values get a full all-ones
value.

llvm-svn: 102739
2010-04-30 19:22:39 +00:00
Dan Gohman
3c454a3df0 Silence compiler warnings.
llvm-svn: 102734
2010-04-30 19:21:13 +00:00
Dan Gohman
231fe284cd ScalarEvolution support for <= and >= loops.
Also, generalize ScalarEvolutions's min and max recognition to handle
some new forms of min and max that this change makes more common.

llvm-svn: 102234
2010-04-24 03:09:42 +00:00
Dan Gohman
bae847c4c6 Use SimplifyICmpOperands in isKnownPredicate too.
llvm-svn: 102233
2010-04-24 01:38:36 +00:00
Dan Gohman
815586b78c Update isImpliedCond to use the new SimplifyICmpOperands utility.
llvm-svn: 102232
2010-04-24 01:34:53 +00:00
Dan Gohman
0fbfae5efe Add a new utility function SimplifyICmpOperands. Much of this code is
refactored out of ScalarEvolution::isImpliedCond, which will be updated
to use this new utility routine soon.

llvm-svn: 102229
2010-04-24 01:28:42 +00:00
Dan Gohman
4196c77b3b When it doesn't matter whether zero or sign extension is used,
use ScalarEvolutions "any" extend function.

llvm-svn: 102156
2010-04-23 01:51:29 +00:00
Dan Gohman
31d6b29bae Don't attempt to analyze values which are obviously undef. This fixes some
assertion failures in extreme cases.

llvm-svn: 102042
2010-04-22 01:35:11 +00:00
Dan Gohman
4ca879bebb Make ScalarEvolution::getConstant support pointer types, for consistency
with ScalarEvolution's overall approach to pointer types.

llvm-svn: 102003
2010-04-21 16:04:04 +00:00
Dan Gohman
2d575a91e0 Fix SCEVCommutativeExpr::print to be robust in the case of improper
expression canonicalization. Its job is to print what's there, not to
make judgements about it.

llvm-svn: 101461
2010-04-16 15:03:25 +00:00
Dan Gohman
034c0f7354 Make getPredecessorWithUniqueSuccessorForBB return the unique successor
in addition to the predecessor.

llvm-svn: 101374
2010-04-15 16:19:08 +00:00
Dan Gohman
a71d62f6e4 Add a comment.
llvm-svn: 101248
2010-04-14 16:08:56 +00:00
Dan Gohman
1521831bff Teach ScalarEvolution to simplify smax and umax when it can prove
that one operand is always greater than another.

llvm-svn: 101142
2010-04-13 16:51:03 +00:00
Dan Gohman
298e7410d6 Minor code micro-optimizations.
llvm-svn: 101141
2010-04-13 16:49:23 +00:00
Dan Gohman
2b5e134433 Micro-optimize a few hot spots.
llvm-svn: 101086
2010-04-12 23:08:18 +00:00
Dan Gohman
ece51fc413 Add fast paths to ScalarEvolution::getSizeOf and getOffsetOf, as
they're used a lot by getNodeForGEP, which can be called a lot.
This speeds up -iv-users by around 15% on several testcases.

llvm-svn: 101083
2010-04-12 23:03:26 +00:00
Dan Gohman
e87da8a25d Generalize ScalarEvolution's PHI analysis to handle loops that don't
have preheaders or dedicated exit blocks, as clients may not otherwise
need to run LoopSimplify.

llvm-svn: 101030
2010-04-12 07:49:36 +00:00
Dan Gohman
eee8b53fdb Rewrite the overflow checking in the get{Signed,Unsigned}Range code for
AddRecs so that it checks for overflow in the computation that it is
performing, rather than just checking hasNo{Signed,Unsigned}Wrap, since
those flags are for a different computation. This fixes a bug that
impacts an upcoming change.

llvm-svn: 101028
2010-04-12 07:39:33 +00:00
Dan Gohman
3bf0040d05 Fix indentation.
llvm-svn: 101001
2010-04-11 23:44:58 +00:00
Dan Gohman
ff456e3f4d Enhance ScalarEvolution::isKnownPredicate with support for
loop conditions which are invariants.

llvm-svn: 100995
2010-04-11 22:16:48 +00:00
Dan Gohman
f73ed98d56 Minor code simplification.
llvm-svn: 100994
2010-04-11 22:13:11 +00:00
Dan Gohman
07d134b751 When creating a ConstantRange for [n,UINT_MAX], special case n == 0, because
ConstantRange(0, 0) creates an empty range rather than a full one.

llvm-svn: 100993
2010-04-11 22:12:18 +00:00
Dan Gohman
9ca5efece4 Rename isLoopGuardedByCond to isLoopEntryGuardedByCond, to emphasise
that it's only testing for the entry condition, not full loop-invariant
conditions.

llvm-svn: 100979
2010-04-11 19:27:13 +00:00
Dan Gohman
127f5c53e1 Add variants of ult, ule, etc. which take a uint64_t RHS, for convenience.
llvm-svn: 100824
2010-04-08 23:03:40 +00:00
Dan Gohman
bd878ac80b Revert this change from a while ago; ScalarEvolution shouldn't analyze
undef as 0, since it can't force other analyses to intepret the undef
in the same way.

llvm-svn: 100749
2010-04-08 05:58:24 +00:00
Dan Gohman
ff37afdc4b Define placement new wrappers for BumpPtrAllocator and
RecyclingAllocator to allow client code to be simpler, and
simplify several clients.

llvm-svn: 98847
2010-03-18 18:49:47 +00:00