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

311 Commits

Author SHA1 Message Date
Andrew Trick
f80318e090 indvars -disable-iv-rewrite: ExprToMap lives in Pass data, so be more
careful about referencing values.

llvm-svn: 134537
2011-07-06 21:07:10 +00:00
Andrew Trick
641b6e4222 indvars -disable-iv-rewrite: Added SimplifyCongruentIVs.
llvm-svn: 134530
2011-07-06 20:50:43 +00:00
Devang Patel
bfd474b954 Preserve debug loc.
llvm-svn: 134441
2011-07-05 21:48:22 +00:00
Andrew Trick
8823fc0040 indvars -disable-iv-rewrite: avoid multiple IVs in weird cases.
Putting back the helper that I removed on 7/1 to do this right.

llvm-svn: 134423
2011-07-05 18:19:39 +00:00
Andrew Trick
ac38d56661 indvars -disable-iv-rewrite: bug fix involving weird geps and related cleanup.
llvm-svn: 134306
2011-07-02 02:34:25 +00:00
Andrew Trick
bcaaa0ae73 indvars -disable-iv-rewrite: handle cloning binary operators that cannot overflow.
llvm-svn: 134177
2011-06-30 19:02:17 +00:00
Andrew Trick
b074aa9e26 indvars -disable-iv-rewrite: handle an edge case involving identity phis.
llvm-svn: 134124
2011-06-30 01:27:23 +00:00
Andrew Trick
a79ebc3dbd indvars -disable-iv-rewrite: insert new trunc instructions carefully.
llvm-svn: 134112
2011-06-29 23:03:57 +00:00
Andrew Trick
bc666880ad indvars -disable-iv-rewrite: just because SCEV ignores casts doesn't
mean they can be removed.

llvm-svn: 134054
2011-06-29 03:13:40 +00:00
Andrew Trick
db3349cc0b cleanup: misleading comment.
llvm-svn: 134010
2011-06-28 16:45:04 +00:00
Andrew Trick
4ac5dd5154 SCEVExpander: give new insts a name that identifies the reponsible pass.
llvm-svn: 133992
2011-06-28 05:07:32 +00:00
Andrew Trick
eb9ed2c82e indvars --disable-iv-rewrite: sever ties with IVUsers.
llvm-svn: 133988
2011-06-28 03:01:46 +00:00
Andrew Trick
9f6946c3a1 indvars --disable-iv-rewrite: Defer evaluating s/zext until SCEV
evaluates all other IV exprs.

llvm-svn: 133982
2011-06-28 02:49:20 +00:00
Andrew Trick
a2083f5887 indvars -disable-iv-rewrite: run RLEV after SimplifyIVUsers for
a bit more control over the order SCEVs are evaluated.

llvm-svn: 133959
2011-06-27 23:17:44 +00:00
Devang Patel
6e79e59260 Set debug loc.
llvm-svn: 133636
2011-06-22 19:52:36 +00:00
Andrew Trick
04c3bb47ce IVUsers no longer needs to record the phis.
llvm-svn: 133518
2011-06-21 15:43:52 +00:00
Andrew Trick
0f76c6afe8 indvars -disable-iv-rewrite: Adds support for eliminating identity
ops.

This is a rewrite of the IV simplification algorithm used by
-disable-iv-rewrite. To avoid perturbing the default mode, I
temporarily split the driver and created SimplifyIVUsersNoRewrite. The
idea is to avoid doing opcode/pattern matching inside
IndVarSimplify. SCEV already does it. We want to optimize with the
full generality of SCEV, but optimize def-use chains top down on-demand rather
than rewriting the entire expression bottom-up. This was easy to do
for operations that SCEV can prove are identity function. So we're now
eliminating bitmasks and zero extends this way.

A result of this rewrite is that indvars -disable-iv-rewrite no longer
requires IVUsers.

llvm-svn: 133502
2011-06-21 03:22:38 +00:00
Andrew Trick
0577c5768b indvars: incremental fixes for -disable-iv-rewrite and testcases.
Use a proper worklist for use-def traversal without holding onto an
iterator. Now that we process all IV uses, we need complete logic for
resusing existing derived IV defs. See HoistStep.

llvm-svn: 132103
2011-05-26 00:46:11 +00:00
Andrew Trick
0aa40b2f8f indvars: fixed IV cloning in -disable-iv-rewrite mode with associated
cleanup and overdue test cases.

llvm-svn: 132038
2011-05-25 04:42:22 +00:00
Andrew Trick
3352db291f indvars: Prototyping Sign/ZeroExtend elimination without canonical IVs.
No functionality enabled by default. Use -disable-iv-rewrite.
Extended IVUsers to keep track of the phi that represents the users' IV.
Added the WidenIV transform to replace a narrow IV with a wide IV
by doing a one-for-one replacement of IV users instead of expanding the
SCEV expressions. [sz]exts are removed and truncs are inserted.

llvm-svn: 131744
2011-05-20 18:25:42 +00:00
Andrew Trick
650ac8d64f indvars: minor cleanup in preparation for sign/zero extend elimination.
llvm-svn: 131716
2011-05-20 03:37:48 +00:00
Andrew Trick
9bf6279f98 Convert SimplifyIVUsers into a worklist instead of a single pass over
the users.

llvm-svn: 131277
2011-05-13 01:12:21 +00:00
Andrew Trick
3e6beb9889 indvars: Added SimplifyIVUsers.
Interleave IV simplifications. Currently involves EliminateComparison
and EliminateRemainder. Next I'll add EliminateExtend.

llvm-svn: 131210
2011-05-12 00:04:28 +00:00
Andrew Trick
db8b89e46b indvars: Added DisableIVRewrite and WidenIVs.
This adds functionality to remove size/zero extension during indvars
without generating a canonical IV and rewriting all IV users. It's
disabled by default so should have no effect on codegen. Work in progress.

llvm-svn: 130829
2011-05-04 02:10:13 +00:00
Andrew Trick
6196cc1640 indvars: Added canExpandBackEdgeTakenCount.
Only create a canonical IV for backedge taken count if it will
actually be used by LinearFunctionTestReplace. And some related
cleanup, preparing to reduce dependence on canonical IVs.
No significant effect on x86 or arm in the test-suite.

llvm-svn: 130799
2011-05-03 22:24:10 +00:00
Andrew Trick
db3db0337f Reapply r130340: Fix for PR9730.
llvm-svn: 130408
2011-04-28 17:30:04 +00:00
Andrew Trick
ad00466e83 Reverting r130340 in the unlikely event that it's responsible for a llvm-gcc stage2 compiler error.
llvm-svn: 130350
2011-04-28 00:13:59 +00:00
Andrew Trick
652ca6a95a Fixes PR9730: indvars: An asserting value handle still pointed to this value
Modified LinearFunctionTestReplace to push the condition on the dead
list instead of eagerly deleting it. This can cause unnecessary
IV rewrites, which should have no effect on codegen and will not be an
issue once we stop generating canonical IVs.

llvm-svn: 130340
2011-04-27 23:00:03 +00:00
Jay Foad
53632b7c03 Remove PHINode::reserveOperandSpace(). Instead, add a parameter to
PHINode::Create() giving the (known or expected) number of operands.

llvm-svn: 128537
2011-03-30 11:28:46 +00:00
Jay Foad
dc5a008237 (Almost) always call reserveOperandSpace() on newly created PHINodes.
llvm-svn: 128535
2011-03-30 11:19:20 +00:00
Andrew Trick
a4b86e96b1 Remove TargetData and ValueTracking includes. I didn't mean for them to sneak in my last checkin.
llvm-svn: 127842
2011-03-18 00:36:39 +00:00
Andrew Trick
07887af00c Added isValidRewrite() to check the result of ScalarEvolutionExpander.
SCEV may generate expressions composed of multiple pointers, which can
lead to invalid GEP expansion. Until we can teach SCEV to follow strict
pointer rules, make sure no bad GEPs creep into IR.
Fixes rdar://problem/9038671.

llvm-svn: 127839
2011-03-17 23:51:11 +00:00
Andrew Trick
17df72f60b whitespace
llvm-svn: 127837
2011-03-17 23:46:48 +00:00
Chris Lattner
fa37cac39c reduce indentation. Print <nuw> and <nsw> when dumping SCEV AddRec's
that have the bit set.

llvm-svn: 123104
2011-01-09 02:16:18 +00:00
Dan Gohman
04df5af12b Move SCEV::isLoopInvariant and hasComputableLoopEvolution to be member
functions of ScalarEvolution, in preparation for memoization and
other optimizations.

llvm-svn: 119562
2010-11-17 21:23:15 +00:00
Owen Anderson
46990c17f7 Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which
must be called in the pass's constructor.  This function uses static dependency declarations to recursively initialize
the pass's dependencies.

Clients that only create passes through the createFooPass() APIs will require no changes.  Clients that want to use the
CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h
before parsing commandline arguments.

I have tested this with all standard configurations of clang and llvm-gcc on Darwin.  It is possible that there are problems
with the static dependencies that will only be visible with non-standard options.  If you encounter any crash in pass
registration/creation, please send the testcase to me directly.

llvm-svn: 116820
2010-10-19 17:21:58 +00:00
Owen Anderson
63f757463c Begin adding static dependence information to passes, which will allow us to
perform initialization without static constructors AND without explicit initialization
by the client.  For the moment, passes are required to initialize both their
(potential) dependencies and any passes they preserve.  I hope to be able to relax
the latter requirement in the future.

llvm-svn: 116334
2010-10-12 19:48:12 +00:00
Owen Anderson
69cbf2e8b7 Now with fewer extraneous semicolons!
llvm-svn: 115996
2010-10-07 22:25:06 +00:00
Gabor Greif
5348c51fbe do not rely on the implicit-dereference semantics of dyn_cast_or_null
llvm-svn: 114277
2010-09-18 11:53:39 +00:00
Owen Anderson
f2fea95f2f Reapply r110396, with fixes to appease the Linux buildbot gods.
llvm-svn: 110460
2010-08-06 18:33:48 +00:00
Owen Anderson
aadd8a89ca Revert r110396 to fix buildbots.
llvm-svn: 110410
2010-08-06 00:23:35 +00:00
Owen Anderson
b9762c07cb Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static
ID member as the sole unique type identifier.  Clean up APIs related to this change.

llvm-svn: 110396
2010-08-05 23:42:04 +00:00
Gabor Greif
96a9f8c7c6 mass elimination of reliance on automatic iterator dereferencing
llvm-svn: 109103
2010-07-22 13:36:47 +00:00
Owen Anderson
f8addbb0a1 Fix batch of converting RegisterPass<> to INTIALIZE_PASS().
llvm-svn: 109045
2010-07-21 22:09:45 +00:00
Dan Gohman
e36ed050b8 Remember that the induction variable is always a PHINode and
use getIncomingValueForBlock instead of
LoopInfo::getCanonicalInductionVariableIncrement.

llvm-svn: 108865
2010-07-20 17:18:52 +00:00
Gabor Greif
6184b1a2fa cache result of operator*
llvm-svn: 107976
2010-07-09 15:40:10 +00:00
Dan Gohman
e375e96f0d Disable indvars on loops when LoopSimplify form is not available.
This fixes PR7333.

llvm-svn: 106267
2010-06-18 01:35:11 +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
a83b45d7b5 Teach IndVarSimplify how to eliminate remainder operators where the
numerator is an induction variable. For example, with code like this:

  for (i=0;i<n;++i)
    x[i%n] = 0;

IndVarSimplify will now recognize that i is always less than n inside
the loop, and eliminate the remainder.

llvm-svn: 101113
2010-04-13 01:46:36 +00:00
Dan Gohman
ba53e85cc3 Suppress LinearFunctionTestReplace when the computed backedge-taken
expression is a UDiv and it doesn't appear that the UDiv came from
the user's source.

ScalarEvolution has recently figured out how to compute a tripcount
expression for the inner loop in
SingleSource/Benchmarks/Shootout/sieve.c, using a udiv. Emitting a
udiv instruction dramatically slows down the enclosing loop.

llvm-svn: 101068
2010-04-12 21:13:43 +00:00