Commit Graph

23 Commits

Author SHA1 Message Date
Dan Gohman 2a07fd94f1 Clear the Processed set when it is no longer used, and clear the
IVUses list in releaseMemory().

llvm-svn: 91296
2009-12-14 17:35:17 +00:00
Dan Gohman fbeec7270c Fix a thinko; isNotAlreadyContainedIn had a built-in negative, so the
condition was inverted when the code was converted to contains().

llvm-svn: 91295
2009-12-14 17:31:01 +00:00
Dan Gohman 57eb6cda7a Drop Loop::isNotAlreadyContainedIn in favor of Loop::contains. The
former was just exposing a LoopInfoBase implementation detail.

llvm-svn: 91286
2009-12-14 17:06:50 +00:00
Jim Grosbach bf2956a88b enable iv-users simplification by default
llvm-svn: 89713
2009-11-23 23:25:54 +00:00
Jim Grosbach 50d67e791b Teach IVUsers to keep things simpler and track loop-invariant strides only
for uses inside the loop. This works better with LSR. Disabled behind
-simplify-iv-users while benchmarking.

llvm-svn: 89299
2009-11-19 02:05:44 +00:00
Evan Cheng 85a9f430e9 - Teach LSR to avoid changing cmp iv stride if it will create an immediate that
cannot be folded into target cmp instruction.
- Avoid a phase ordering issue where early cmp optimization would prevent the
  later count-to-zero optimization.
- Add missing checks which could cause LSR to reuse stride that does not have
  users.
- Fix a bug in count-to-zero optimization code which failed to find the pre-inc
  iv's phi node.
- Remove, tighten, loosen some incorrect checks disable valid transformations.
- Quite a bit of code clean up.

llvm-svn: 86969
2009-11-12 07:35:05 +00:00
Dan Gohman 2267f8aa72 Fix IVUsers to avoid assuming that the loop has a unique backedge.
llvm-svn: 86161
2009-11-05 19:41:37 +00:00
Dan Gohman 6daa565cf9 Instead of testing whether an instruction dominates the loop preheader,
test whether it properly dominates the loop header. This is equivalent
when the loop has a preheader, and has the advantage of working when
the loop doesn't have a preheader. Since IVUsers doesn't Require
LoopSimplify, the loop isn't guaranteed to have a preheader.

llvm-svn: 82899
2009-09-27 15:30:00 +00:00
Dan Gohman 0523507a2f Remove a redundant #include.
llvm-svn: 82897
2009-09-27 15:21:52 +00:00
Chris Lattner 13d62b60bd remove a few dead insertion methods.
llvm-svn: 79882
2009-08-24 02:39:26 +00:00
Chris Lattner 4dc3edde9f remove a few DOUTs here and there.
llvm-svn: 79832
2009-08-23 06:35:02 +00:00
Chris Lattner b25de3ff60 eliminate the "Value" printing methods that print to a std::ostream.
This required converting a bunch of stuff off DOUT and other cleanups.

llvm-svn: 79819
2009-08-23 04:37:46 +00:00
Dan Gohman 74cb168a9e Fix more missing newlines.
llvm-svn: 79244
2009-08-17 15:29:31 +00:00
Daniel Dunbar 0dd5e1ed39 More migration to raw_ostream, the water has dried up around the iostream hole.
- Some clients which used DOUT have moved to DEBUG. We are deprecating the
   "magic" DOUT behavior which avoided calling printing functions when the
   statement was disabled. In addition to being unnecessary magic, it had the
   downside of leaving code in -Asserts builds, and of hiding potentially
   unnecessary computations.

llvm-svn: 77019
2009-07-25 00:23:56 +00:00
Dan Gohman f2c9922f50 Add a newline, now that Value's operator<< doesn't print one.
llvm-svn: 75568
2009-07-14 00:32:49 +00:00
Dan Gohman cc85ae132c Make Loop and MachineLoop be subclasses of LoopBase, rather than typedefs,
using the Curiously Recurring Template Pattern with LoopBase.

This will help further refactoring, and future functionality for
Loop. Also, Headers can now foward-declare Loop, instead of pulling
in LoopInfo.h or doing tricks.

llvm-svn: 75519
2009-07-13 21:51:15 +00:00
Dan Gohman af75234955 Change all SCEV* to SCEV *.
llvm-svn: 74918
2009-07-07 17:06:11 +00:00
Owen Anderson 65b6056e37 SCEVHandle is no more!
llvm-svn: 73906
2009-06-22 21:39:50 +00:00
Dan Gohman 2199dbc5ff Don't (unconditionally) use getSCEVAtScope to simplify the step
expression in IVUsers, because in the case of a use of a non-linear
addrec outside of a loop, this causes the addrec to be evaluated as
a linear addrec.

llvm-svn: 73774
2009-06-19 17:33:15 +00:00
Dan Gohman a0348809b6 Remove the code from IVUsers that attempted to handle
casted induction variables in cases where the cast
isn't foldable. It ended up being a pessimization in
many cases. This could be fixed, but it would require
a bunch of complicated code in IVUsers' clients. The
advantages of this approach aren't visible enough to
justify it at this time.

llvm-svn: 73706
2009-06-18 16:54:06 +00:00
Dan Gohman 19f8b0c3e0 Code cleanups. getSCEVAtScope no longer uses SCEVCouldNotCompute.
llvm-svn: 73401
2009-06-15 18:38:59 +00:00
Duncan Sands 7e3c9e1bd9 Avoid getting a compiler warning
IVUsers.cpp: In member function ‘bool llvm::IVUsers::AddUsersIfInteresting(llvm::Instruction*)’:
 IVUsers.cpp:221: warning: ‘isSigned’ may be used uninitialized in this function
with gcc-4.3.

llvm-svn: 71654
2009-05-13 12:52:44 +00:00
Dan Gohman d76d71a291 Factor the code for collecting IV users out of LSR into an IVUsers class,
and generalize it so that it can be used by IndVarSimplify. Implement the
base IndVarSimplify transformation code using IVUsers. This removes
TestOrigIVForWrap and associated code, as ScalarEvolution now has enough
builtin overflow detection and folding logic to handle all the same cases,
and more. Run "opt -iv-users -analyze -disable-output" on your favorite
loop for an example of what IVUsers does.

This lets IndVarSimplify eliminate IV casts and compute trip counts in
more cases. Also, this happens to finally fix the remaining testcases
in PR1301.

Now that IndVarSimplify is being more aggressive, it occasionally runs
into the problem where ScalarEvolutionExpander's code for avoiding
duplicate expansions makes it difficult to ensure that all expanded
instructions dominate all the instructions that will use them. As a
temporary measure, IndVarSimplify now uses a FixUsesBeforeDefs function
to fix up instructions inserted by SCEVExpander. Fortunately, this code
is contained, and can be easily removed once a more comprehensive
solution is available.

llvm-svn: 71535
2009-05-12 02:17:14 +00:00