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

414 Commits

Author SHA1 Message Date
Dan Gohman
5e06a05a16 Fix the the ceiling-division used in computing the MaxBECount so that it doesn't
have trouble with an intermediate add overflowing. Also, be more conservative
about the case where the induction variable in an SLT loop exit can step past
the RHS of the SLT and overflow in a single step.

Make getSignedRange more aggressive, to recover for some common cases which
the above fixes pessimized.

This addresses rdar://7561161.

llvm-svn: 94512
2010-01-26 04:40:18 +00:00
Dan Gohman
be34c35f32 Re-implement the main strength-reduction portion of LoopStrengthReduction.
This new version is much more aggressive about doing "full" reduction in
cases where it reduces register pressure, and also more aggressive about
rewriting induction variables to count down (or up) to zero when doing so
reduces register pressure.

It currently uses fairly simplistic algorithms for finding reuse
opportunities, but it introduces a new framework allows it to combine
multiple strategies at once to form hybrid solutions, instead of doing
all full-reduction or all base+index.

llvm-svn: 94061
2010-01-21 02:09:26 +00:00
Dan Gohman
2c72837459 Add a comment and tidy up some whitespace.
llvm-svn: 93932
2010-01-19 22:27:22 +00:00
Dan Gohman
273322a12b Give ScalarEvolution access to the DominatorTree. It'll need this
to make more intellegent AddRec folding decisions.

llvm-svn: 93930
2010-01-19 22:21:27 +00:00
Dan Gohman
771144e807 Use WriteAsOperand instead of getName() to print loop header names,
so that unnamed blocks are handled.

llvm-svn: 93059
2010-01-09 18:17:45 +00:00
David Greene
1b160211dd Remove dump routine and the associated Debug.h from a header. Patch up
other files to compensate.

llvm-svn: 92075
2009-12-23 22:58:38 +00:00
David Greene
62d4863b56 Convert debug messages to use dbgs(). Generally this means
s/errs/dbgs/g except for certain special cases.

llvm-svn: 92067
2009-12-23 22:18:14 +00:00
Dan Gohman
a9cdf5b0d8 Fix a spello in a comment that Nick spotted.
llvm-svn: 91742
2009-12-19 01:46:34 +00:00
Dan Gohman
f4af7d049c Make this comment more precise.
llvm-svn: 91722
2009-12-18 23:18:03 +00:00
Dan Gohman
34f714b928 Revert this use of NUW/NSW also. Overflow-undefined multiplication isn't
associative either.

llvm-svn: 91701
2009-12-18 18:45:31 +00:00
Dan Gohman
2e46566444 Revert this use of NSW; this one isn't actually safe. NSW addition
is not reassociative.

llvm-svn: 91667
2009-12-18 03:57:04 +00:00
Dan Gohman
ec766ea441 Delete an unused variable.
llvm-svn: 91659
2009-12-18 02:14:37 +00:00
Dan Gohman
91b1161840 Preserve NSW information in more places.
llvm-svn: 91656
2009-12-18 02:09:29 +00:00
Dan Gohman
0f8f7f179d Add Loop contains utility methods for testing whether a loop
contains another loop, or an instruction. The loop form is
substantially more efficient on large loops than the typical
code it replaces.

llvm-svn: 91654
2009-12-18 01:24:09 +00:00
Dan Gohman
7c0f6a6c1b Whitespace cleanups.
llvm-svn: 91651
2009-12-18 01:14:11 +00:00
Nick Lewycky
1328a7b47f Remove dead LLVMContext argument.
llvm-svn: 89641
2009-11-23 03:26:09 +00:00
Dan Gohman
22719d2a1a Pass the (optional) TargetData object to ConstantFoldInstOperands
and ConstantFoldCompareInstOperands.

llvm-svn: 86626
2009-11-09 23:34:17 +00:00
Chris Lattner
131172dc76 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
903ae55e1c 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
16c6819959 Reverting 85714, 85715, 85716, which are breaking the build
llvm-svn: 85717
2009-11-01 16:42:53 +00:00
Dan Gohman
58714b62b6 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
0079f87732 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
2b8400628d 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
711c726c97 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
731afb3b6e Revert r83606 and add comments explaining why it isn't safe.
llvm-svn: 83649
2009-10-09 16:35:06 +00:00
Dan Gohman
e81a040ce7 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
4cdd530887 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
b84f5a3421 Add a properlyDominates member function to ScalarEvolution.
llvm-svn: 82898
2009-09-27 15:26:03 +00:00
Dan Gohman
723717853b 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
d32bdb4c58 Remove references to expression "handles", which are no longer used.
llvm-svn: 80918
2009-09-03 15:00:26 +00:00
Dan Gohman
8e6871aa01 Don't use an iterator which is potentially invalidated.
llvm-svn: 80632
2009-08-31 21:58:28 +00:00
Dan Gohman
297360e2b1 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
4010353fac 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
fdaeb17036 Teach ScalarEvolution about GlobalAliases.
llvm-svn: 80014
2009-08-25 17:49:57 +00:00
Chris Lattner
02d305910e remove a few dead insertion methods.
llvm-svn: 79882
2009-08-24 02:39:26 +00:00
Chris Lattner
1c0452caeb 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
6ec8176e22 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
d9766dcb85 Various comment and whitespace cleanups.
llvm-svn: 79533
2009-08-20 16:42:55 +00:00
Dan Gohman
ba656de4a4 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
b0cf049a1e 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
9df206d02d Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Andreas Bolka
5356a5f16b Fix copy-pasto.
llvm-svn: 78426
2009-08-07 22:55:26 +00:00
Owen Anderson
1dc40e205b 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
881d928f9b Move types back to the 2.5 API.
llvm-svn: 77516
2009-07-29 22:17:13 +00:00
Owen Anderson
0ce2151b36 Move ConstantExpr to 2.5 API.
llvm-svn: 77494
2009-07-29 18:55:55 +00:00
Dan Gohman
e999569f50 Fix wording in comments.
llvm-svn: 77193
2009-07-27 16:09:48 +00:00
Dan Gohman
0781059503 SCEV objects are no longer reference-counted.
llvm-svn: 77080
2009-07-25 16:18:07 +00:00
Dan Gohman
c126330ef1 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
13aabe2ba4 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
a823846bd1 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