Dan Gohman
2ac504729b
Pass the (optional) TargetData object to ConstantFoldInstOperands
...
and ConstantFoldCompareInstOperands.
llvm-svn: 86626
2009-11-09 23:34:17 +00:00
Chris Lattner
cdfb80de16
fix ConstantFoldCompareInstOperands to take the LHS/RHS as
...
individual operands instead of taking a temporary array
llvm-svn: 86619
2009-11-09 23:06:58 +00:00
Chris Lattner
46b5c642b9
remove a bunch of extraneous LLVMContext arguments
...
from various APIs, addressing PR5325.
llvm-svn: 86231
2009-11-06 04:27:31 +00:00
Douglas Gregor
291f6145b8
Reverting 85714, 85715, 85716, which are breaking the build
...
llvm-svn: 85717
2009-11-01 16:42:53 +00:00
Dan Gohman
2b12b95d5d
Add a function to Passes.h to allow clients to create instances
...
of the ScalarEvolution pass without needing to #include ScalarEvolution.h.
llvm-svn: 85716
2009-11-01 15:28:36 +00:00
Dan Gohman
880c92ac1c
Rename forgetLoopBackedgeTakenCount to forgetLoop, because it
...
clears out more information than just the stored backedge taken count.
llvm-svn: 85664
2009-10-31 15:04:55 +00:00
Nick Lewycky
974e12b2d3
Remove includes of Support/Compiler.h that are no longer needed after the
...
VISIBILITY_HIDDEN removal.
llvm-svn: 85043
2009-10-25 06:57:41 +00:00
Nick Lewycky
02d5f77d26
Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
...
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.
llvm-svn: 85042
2009-10-25 06:33:48 +00:00
Dan Gohman
dc4893abfe
Revert r83606 and add comments explaining why it isn't safe.
...
llvm-svn: 83649
2009-10-09 16:35:06 +00:00
Dan Gohman
d65387a49f
Preserve HasNSW and HasNUW when constructing SCEVs for Add and Mul
...
instructions.
llvm-svn: 83606
2009-10-09 00:41:22 +00:00
Dan Gohman
816fe0a4aa
Add the ability to track HasNSW and HasNUW on more kinds of SCEV expressions.
...
llvm-svn: 83601
2009-10-09 00:10:36 +00:00
Dan Gohman
f39a3a9288
Add a properlyDominates member function to ScalarEvolution.
...
llvm-svn: 82898
2009-09-27 15:26:03 +00:00
Dan Gohman
36bad00bef
Teach ScalarEvolution how to reason about no-wrap flags on loops
...
where the induction variable has a non-unit stride, such as {0,+,2}, and
there are expressions such as {1,+,2} inside the loop formed with
or or add nsw operators.
llvm-svn: 82151
2009-09-17 18:05:20 +00:00
Dan Gohman
237d9e5213
Remove references to expression "handles", which are no longer used.
...
llvm-svn: 80918
2009-09-03 15:00:26 +00:00
Dan Gohman
dba696afc0
Don't use an iterator which is potentially invalidated.
...
llvm-svn: 80632
2009-08-31 21:58:28 +00:00
Dan Gohman
cc2f1eb7fe
Extend the ValuesAtScope cache to cover all expressions, not just
...
SCEVUnknowns, as the non-SCEVUnknown cases in the getSCEVAtScope code
can also end up repeatedly climing through the same expression trees,
which can be unusably slow when the trees are very tall.
Also, add a quick check for SCEV pointer equality to the main
SCEV comparison routine, as the full comparison code can be expensive
in the case of large expression trees.
These fix compile-time problems in some pathlogical cases.
llvm-svn: 80623
2009-08-31 21:15:23 +00:00
Dan Gohman
2d0855605a
Don't assume that two identical instructions that read from memory
...
will always return the same value. This isn't currently necessary,
since this code doesn't currently ever get called under circumstances
where it would matter, but it may some day.
llvm-svn: 80017
2009-08-25 17:56:57 +00:00
Dan Gohman
f161e06e78
Teach ScalarEvolution about GlobalAliases.
...
llvm-svn: 80014
2009-08-25 17:49:57 +00:00
Chris Lattner
13d62b60bd
remove a few dead insertion methods.
...
llvm-svn: 79882
2009-08-24 02:39:26 +00:00
Chris Lattner
1362602eb2
Change Pass::print to take a raw ostream instead of std::ostream,
...
update all code that this affects.
llvm-svn: 79830
2009-08-23 06:03:38 +00:00
Dan Gohman
16f5415f5b
Rename hasNoUnsignedOverflow and hasNoSignedOverflow to hasNoUnsignedWrap
...
and hasNoSignedWrap, for consistency with the nuw and nsw properties.
llvm-svn: 79539
2009-08-20 17:11:38 +00:00
Dan Gohman
8a8ad7d8e8
Various comment and whitespace cleanups.
...
llvm-svn: 79533
2009-08-20 16:42:55 +00:00
Dan Gohman
5d5bc6d000
Use hasDefinitiveInitializer() instead of testing the same thing
...
by hand, and fix a few places that were using hasInitializer() that
appear to depend on the initializer value.
llvm-svn: 79441
2009-08-19 18:20:44 +00:00
Dan Gohman
bf2a9aedca
Generalize ScalarEvolution to be able to analyze GEPs when
...
TargetData is not present. It still uses TargetData when available.
This generalization also fixed some limitations in the TargetData
case; the attached testcase covers this.
llvm-svn: 79344
2009-08-18 16:46:41 +00:00
Owen Anderson
55f1c09e31
Push LLVMContexts through the IntegerType APIs.
...
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Andreas Bolka
7a5c8db6b5
Fix copy-pasto.
...
llvm-svn: 78426
2009-08-07 22:55:26 +00:00
Owen Anderson
5a1acd9912
Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
...
metadata related, which I'm waiting on to avoid conflicting with Devang.
llvm-svn: 77721
2009-07-31 20:28:14 +00:00
Owen Anderson
4056ca9568
Move types back to the 2.5 API.
...
llvm-svn: 77516
2009-07-29 22:17:13 +00:00
Owen Anderson
487375e9a2
Move ConstantExpr to 2.5 API.
...
llvm-svn: 77494
2009-07-29 18:55:55 +00:00
Dan Gohman
169ef138e8
Fix wording in comments.
...
llvm-svn: 77193
2009-07-27 16:09:48 +00:00
Dan Gohman
ef2ae2c8ee
SCEV objects are no longer reference-counted.
...
llvm-svn: 77080
2009-07-25 16:18:07 +00:00
Dan Gohman
534d66a426
When attempting to sign-extend an addrec by interpreting
...
the step value as unsigned, the start value and the addrec
itself still need to be treated as signed.
llvm-svn: 77078
2009-07-25 16:03:30 +00:00
Dan Gohman
62ef6a7f1c
Teach ScalarEvolution to make use of no-overflow flags when
...
analyzing add recurrences.
llvm-svn: 77034
2009-07-25 01:22:26 +00:00
Dan Gohman
0b89dff37d
Instead of eagerly creating new SCEVs to replace all SCEVs that are
...
affected after a PHI node has been analyzed, just remove affected
SCEVs from the Scalars map, so that they'll be (lazily) recreated as
needed. This avoids creating SCEV objects that aren't actually needed.
Also, rewrite the associated def-use walking code to be non-recursive
and to continue traversing past Instructions that don't have an
entry in the Scalars map.
llvm-svn: 77032
2009-07-25 01:13:03 +00:00
Owen Anderson
edb4a70325
Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
...
llvm-svn: 77011
2009-07-24 23:12:02 +00:00
Dan Gohman
5ece69a47c
Fix whitespace.
...
llvm-svn: 76929
2009-07-24 01:03:59 +00:00
Owen Anderson
47db941fd3
Get rid of the Pass+Context magic.
...
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Dan Gohman
430f0cc544
Replace the original ad-hoc code for determining whether (v pred w) implies
...
(x pred y) with more thorough code that does more complete canonicalization
before resorting to range checks. This helps it find more cases where
the canonicalized expressions match.
llvm-svn: 76671
2009-07-21 23:03:19 +00:00
Dan Gohman
75dced058a
Make the range calculations for addrecs to be more conservative,
...
as they aren't currently prepared to handle complicated overflow
cases.
llvm-svn: 76524
2009-07-21 00:42:47 +00:00
Dan Gohman
32291b1afc
Whitespace cleanups.
...
llvm-svn: 76523
2009-07-21 00:38:55 +00:00
Dan Gohman
d571c37b54
Minor code simplification.
...
llvm-svn: 76521
2009-07-21 00:37:45 +00:00
Dan Gohman
3439262586
Add a comment to clarify why there isn't any code in this spot.
...
llvm-svn: 76505
2009-07-20 23:54:43 +00:00
Dan Gohman
00c1aaec5a
Remove the code that tried to evaluate whether (A pred B) is known
...
by determining if (B pred (B-A)) is known, as it doesn't handle
overflow correctly.
llvm-svn: 76504
2009-07-20 23:53:35 +00:00
Dan Gohman
d231d78f3f
Minor code simplification.
...
llvm-svn: 76496
2009-07-20 22:41:51 +00:00
Dan Gohman
1a7ab9473f
The upper argument of ConstantRange is exclusive, not inclusive.
...
llvm-svn: 76492
2009-07-20 22:34:18 +00:00
Dan Gohman
33a3fd0b9c
Revert the addition of hasNoPointerOverflow to GEPOperator.
...
Getelementptrs that are defined to wrap are virtually useless to
optimization, and getelementptrs that are undefined on any kind
of overflow are too restrictive -- it's difficult to ensure that
all intermediate addresses are within bounds. I'm going to take
a different approach.
Remove a few optimizations that depended on this flag.
llvm-svn: 76437
2009-07-20 17:43:30 +00:00
Dan Gohman
80ca01c466
Add a new Operator class, for handling Instructions and ConstantExprs
...
in a convenient manner, factoring out some common code from
InstructionCombining and ValueTracking. Move the contents of
BinaryOperators.h into Operator.h and use Operator to generalize them
to support ConstantExprs as well as Instructions.
llvm-svn: 76232
2009-07-17 20:47:02 +00:00
Owen Anderson
20b34ac794
Move the ConstantInt uniquing table into LLVMContextImpl. This exposed a number of issues in
...
our current context-passing stuff, which is also fixed here
llvm-svn: 76089
2009-07-16 18:04:31 +00:00
Dan Gohman
8c129d7687
Fill in some holes in ScalarEvolution's loop iteration condition
...
analysis. This allows indvars to emit a simpler loop trip count
expression.
llvm-svn: 76085
2009-07-16 17:34:36 +00:00
Owen Anderson
b6b2530000
Move EVER MORE stuff over to LLVMContext.
...
llvm-svn: 75703
2009-07-14 23:09:55 +00:00