Dan Gohman
a0a8a7fe40
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
1c07852e17
Silence compiler warnings.
...
llvm-svn: 102734
2010-04-30 19:21:13 +00:00
Dan Gohman
f33bac3afe
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
36cce7e0dd
Use SimplifyICmpOperands in isKnownPredicate too.
...
llvm-svn: 102233
2010-04-24 01:38:36 +00:00
Dan Gohman
3673aa1a51
Update isImpliedCond to use the new SimplifyICmpOperands utility.
...
llvm-svn: 102232
2010-04-24 01:34:53 +00:00
Dan Gohman
48ff3cf63b
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
ff3174e97f
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
acd700a24b
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
a029cbe93f
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
12293815de
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
4e3c1139a2
Make getPredecessorWithUniqueSuccessorForBB return the unique successor
...
in addition to the predecessor.
llvm-svn: 101374
2010-04-15 16:19:08 +00:00
Dan Gohman
65de3d140d
Add a comment.
...
llvm-svn: 101248
2010-04-14 16:08:56 +00:00
Dan Gohman
7ef0dc2163
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
fe4b29180b
Minor code micro-optimizations.
...
llvm-svn: 101141
2010-04-13 16:49:23 +00:00
Dan Gohman
ebbd05f8ce
Micro-optimize a few hot spots.
...
llvm-svn: 101086
2010-04-12 23:08:18 +00:00
Dan Gohman
11862a6ed3
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
6635bb26a6
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
f76210ead8
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
068b793614
Fix indentation.
...
llvm-svn: 101001
2010-04-11 23:44:58 +00:00
Dan Gohman
07591698ce
Enhance ScalarEvolution::isKnownPredicate with support for
...
loop conditions which are invariants.
llvm-svn: 100995
2010-04-11 22:16:48 +00:00
Dan Gohman
f7f28511a9
Minor code simplification.
...
llvm-svn: 100994
2010-04-11 22:13:11 +00:00
Dan Gohman
ae4a4148ba
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
b50349a979
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
4ce1fb1448
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
883105485b
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
01c65a2622
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
Dan Gohman
6556c8962c
Add the ability to "intern" FoldingSetNodeID data into a
...
BumpPtrAllocator-allocated region to allow it to be stored in a more
compact form and to avoid the need for a non-trivial destructor call.
Use this new mechanism in ScalarEvolution instead of
FastFoldingSetNode to avoid leaking memory in the case where a
FoldingSetNodeID uses heap storage, and to reduce overall memory
usage.
llvm-svn: 98829
2010-03-18 16:16:38 +00:00
Dan Gohman
0052449e1a
Reapply r98755 with a thinko which miscompiled gengtype fixed.
...
llvm-svn: 98793
2010-03-18 01:17:13 +00:00
Dan Gohman
d2abecaeea
Revert 98755, which may be causing trouble.
...
llvm-svn: 98762
2010-03-17 19:54:53 +00:00
Dan Gohman
5c9b0e1a6e
Change SCEVNAryExpr's operand array from a SmallVector to a plain
...
pointer and length, and allocate the arrays in ScalarEvolution's
BumpPtrAllocator, so that they get released when their owning
SCEV gets released. SCEVs are immutable, so they don't need to worry
about operand array resizing. This fixes a memory leak reported
in PR6637.
llvm-svn: 98755
2010-03-17 18:51:01 +00:00
Dan Gohman
69451a0950
Avoid analyzing instructions in blocks not reachable from the entry block.
...
They are lots of trouble, and they don't matter. This fixes PR6559.
llvm-svn: 98103
2010-03-09 23:46:50 +00:00
Dan Gohman
8b0a419eb1
Spelling fixes.
...
llvm-svn: 97453
2010-03-01 17:49:51 +00:00
Dan Gohman
a9c205cc88
Make LoopSimplify change conditional branches in loop exiting blocks
...
which branch on undef to branch on a boolean constant for the edge
exiting the loop. This helps ScalarEvolution compute trip counts for
loops.
Teach ScalarEvolution to recognize single-value PHIs, when safe, and
ForgetSymbolicName to forget such single-value PHI nodes as apprpriate
in ForgetSymbolicName.
llvm-svn: 97126
2010-02-25 06:57:05 +00:00
Dan Gohman
4aad750333
ConstantFoldInstOperands can theoretically return null if it
...
didn't fold anything.
llvm-svn: 97049
2010-02-24 19:31:47 +00:00
Dan Gohman
007f5041a2
Simplify this code; these casts aren't necessary.
...
llvm-svn: 97048
2010-02-24 19:31:06 +00:00
Dan Gohman
ba820344e3
Convert a few more backedge-taken count functions to use BackedgeTakenInfo.
...
llvm-svn: 97042
2010-02-24 17:31:30 +00:00
Dan Gohman
8c16b38262
Remove unused variables and parameters.
...
llvm-svn: 96780
2010-02-22 04:11:59 +00:00
Dan Gohman
cf9c64e6e3
Add a comment.
...
llvm-svn: 96688
2010-02-19 18:49:22 +00:00
Dan Gohman
6b1e2a829d
Teach ScalarEvolution how to compute a tripcount for a loop with
...
true or false as its exit condition. These are usually eliminated by
SimplifyCFG, but the may be left around during a pass which wishes
to preserve the CFG.
llvm-svn: 96683
2010-02-19 18:12:07 +00:00
Dale Johannesen
1d6827adef
recommit 96626, evidence that it broke things appears
...
to be spurious
llvm-svn: 96662
2010-02-19 07:14:22 +00:00
Dale Johannesen
1f790c28d0
Revert 96626, which causes build failure on ppc Darwin.
...
llvm-svn: 96653
2010-02-19 01:54:37 +00:00
Dan Gohman
60b3326435
Indvars needs to explicitly notify ScalarEvolution when it is replacing
...
a loop exit value, so that if a loop gets deleted, ScalarEvolution
isn't stick holding on to dangling SCEVAddRecExprs for that loop. This
fixes PR6339.
llvm-svn: 96626
2010-02-18 23:26:33 +00:00
Duncan Sands
19d0b47b1f
There are two ways of checking for a given type, for example isa<PointerType>(T)
...
and T->isPointerTy(). Convert most instances of the first form to the second form.
Requested by Chris.
llvm-svn: 96344
2010-02-16 11:11:14 +00:00
Duncan Sands
9dff9bec31
Uniformize the names of type predicates: rather than having isFloatTy and
...
isInteger, we now have isFloatTy and isIntegerTy. Requested by Chris!
llvm-svn: 96223
2010-02-15 16:12:20 +00:00
Dan Gohman
fefbff9cd8
When testing whether a given SCEV depends on a temporary symbolic
...
name, test whether the SCEV itself is that temporary symbolic name,
in addition to checking whether the symbolic name appears as a
possibly-indirect operand.
llvm-svn: 96216
2010-02-15 10:28:37 +00:00
Dan Gohman
fe873e7c10
Override dominates and properlyDominates for SCEVAddRecExpr, as a
...
SCEVAddRecExpr doesn't necessarily dominate blocks merely dominated
by all of its operands. This fixes an abort compiling 403.gcc.
llvm-svn: 96056
2010-02-13 00:19:39 +00:00
Dan Gohman
4a618827de
Fix "the the" and similar typos.
...
llvm-svn: 95781
2010-02-10 16:03:48 +00:00
Dan Gohman
9946b5109c
Change the argument to getIntegerSCEV to be an int64_t, rather
...
than int. This will make it more convenient for LSR, which does
a lot of things with int64_t offsets.
llvm-svn: 95281
2010-02-04 02:43:51 +00:00
Dan Gohman
7e5f1b2773
Various code simplifications.
...
llvm-svn: 95044
2010-02-02 01:38:49 +00:00
Dan Gohman
e5e1b7b05a
Generalize target-independent folding rules for sizeof to handle more
...
cases, and implement target-independent folding rules for alignof and
offsetof. Also, reassociate reassociative operators when it leads to
more folding.
Generalize ScalarEvolution's isOffsetOf to recognize offsetof on
arrays. Rename getAllocSizeExpr to getSizeOfExpr, and getFieldOffsetExpr
to getOffsetOfExpr, for consistency with analagous ConstantExpr routines.
Make the target-dependent folder promote GEP array indices to
pointer-sized integers, to make implicit casting explicit and exposed
to subsequent folding.
And add a bunch of testcases for this new functionality, and a bunch
of related existing functionality.
llvm-svn: 94987
2010-02-01 18:27:38 +00:00