Commit Graph

26501 Commits

Author SHA1 Message Date
Chris Lattner
2dae65d13b move an entry, add some notes, remove a completed item (IMPLICIT_DEF)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60821 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 01:30:48 +00:00
Chris Lattner
b957bda0bc Allow basicaa to walk through geps with identical indices in
parallel, allowing it to decide that P/Q must alias if A/B
must alias in things like:
 P = gep A, 0, i, 1
 Q = gep B, 0, i, 1

This allows GVN to delete 62 more instructions out of 403.gcc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60820 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 01:04:47 +00:00
Bill Wendling
2ce4e5cadd Whitespace fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60818 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 00:28:22 +00:00
Dan Gohman
f55a2101e3 Update CalcLatency to work in terms of edge latencies, rather than
node latencies. Use CalcLatency instead of manual code in
CalculatePriorities to keep it consistent. Previously it
computed slightly different results.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60817 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 00:24:36 +00:00
Evan Cheng
94ea5be39f Fix a couple of Dwarf bugs.
- Emit DW_AT_byte_size for struct and union of size zero.
- Emit DW_AT_declaration for forward type declaration.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60812 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 00:15:44 +00:00
Scott Michel
aedc637c96 CellSPU:
- Fix bug 3185, with misc other cleanups.
- Needed to implement SPUInstrInfo::InsertBranch(). CAUTION: Not sure what
  gets or needs to get passed to InsertBranch() to insert a conditional
  branch. This will abort for now until a good test case shows up.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60811 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-10 00:15:19 +00:00
Bill Wendling
30a64a7649 Implement fast-isel conversion of a branch instruction that's branching on an
overflow/carry from the "arithmetic with overflow" intrinsics. It searches the
machine basic block from bottom to top to find the SETO/SETC instruction that is
its conditional. If an instruction modifies EFLAGS before it reaches the
SETO/SETC instruction, then it defaults to the normal instruction emission.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60807 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 23:19:12 +00:00
Dan Gohman
54e4c36a73 Rewrite the SDep class, and simplify some of the related code.
The Cost field is removed. It was only being used in a very limited way,
to indicate when the scheduler should attempt to protect a live register,
and it isn't really needed to do that. If we ever want the scheduler to
start inserting copies in non-prohibitive situations, we'll have to
rethink some things anyway.

A Latency field is added. Instead of giving each node a single
fixed latency, each edge can have its own latency. This will eventually
be used to model various micro-architecture properties more accurately.

The PointerIntPair class and an internal union are now used, which
reduce the overall size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60806 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 22:54:47 +00:00
Chris Lattner
5a45bf1b48 loosen up an assertion that isn't valid when called from
invalidateCachedPointerInfo.  Thanks to Bill for sending me
a testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60805 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 22:45:32 +00:00
Dan Gohman
bcf28c08b3 Minor code simplification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60804 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 22:45:08 +00:00
Bill Wendling
74c3765291 Add sub/mul overflow intrinsics. This currently doesn't have a
target-independent way of determining overflow on multiplication. It's very
tricky. Patch by Zoltan Varga!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60800 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 22:08:41 +00:00
Chris Lattner
bc99be10b8 Teach GVN to invalidate some memdep information when it does an RAUW
of a pointer.  This allows is to catch more equivalencies.  For example,
the type_lists_compatible_p function used to require two iterations of
the gvn pass (!) to delete its 18 redundant loads because the first pass
would CSE all the addressing computation cruft, which would unblock the
second memdep/gvn passes from recognizing them.  This change allows
memdep/gvn to catch all 18 when run just once on the function (as is 
typical :) instead of just 3.

On all of 403.gcc, this bumps up the # reundandancies found from:

     63 gvn    - Number of instructions PRE'd
 153991 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted
to:
     63 gvn    - Number of instructions PRE'd
 154137 gvn    - Number of instructions deleted
  50185 gvn    - Number of loads deleted

+120 loads deleted isn't bad.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60799 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 22:06:23 +00:00
Duncan Sands
47d9dcc584 Fix PR3117: not all nodes being legalized. The
essential problem was that the DAG can contain
random unused nodes which were never analyzed.
When remapping a value of a node being processed,
such a node may become used and need to be analyzed;
however due to operands being transformed during
analysis the node may morph into a different one.
Users of the morphing node need to be updated, and
this wasn't happening.  While there I added a bunch
of documentation and sanity checks, so I (or some
other poor soul) won't have to scratch their head
over this stuff so long trying to remember how it
was all supposed to work next time some obscure
problem pops up!  The extra sanity checking exposed
a few places where invariants weren't being preserved,
so those are fixed too.  Since some of the sanity
checking is expensive, I added a flag to turn it
on.  It is also turned on when building with
ENABLE_EXPENSIVE_CHECKS=1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60797 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 21:33:20 +00:00
Chris Lattner
20d6f0982a Teach BasicAA::getModRefInfo(CallSite, CallSite) some
tricks based on readnone/readonly functions.

Teach memdep to look past readonly calls when analyzing
deps for a readonly call.  This allows elimination of a
few more calls from 403.gcc:

before:
     63 gvn    - Number of instructions PRE'd
 153986 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted

after:
     63 gvn    - Number of instructions PRE'd
 153991 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted

5 calls isn't much, but this adds plumbing for the next change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60794 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 21:19:42 +00:00
Chris Lattner
3579e44bf3 Fix a fixme: allow memdep to see past read-only calls when doing
load dependence queries.  This allows GVN to eliminate a few more
instructions on 403.gcc:

 152598 gvn    - Number of instructions deleted
  49240 gvn    - Number of loads deleted
after:
 153986 gvn    - Number of instructions deleted
  50069 gvn    - Number of loads deleted



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60786 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 19:47:40 +00:00
Chris Lattner
1559b3625b rename getNonLocalDependency -> getNonLocalCallDependency, and remove
pointer stuff from it, simplifying the code a bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60783 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 19:38:05 +00:00
Chris Lattner
91bcf6450a Switch GVN::processNonLocalLoad to using the new
MemDep::getNonLocalPointerDependency method.  There are
some open issues with this (missed optimizations) and
plenty of future work, but this does allow GVN to eliminate
*slightly* more loads (49246 vs 49033).

Switching over now allows simplification of the other code
path in memdep.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60780 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 19:25:07 +00:00
Chris Lattner
ae1993114f random cleanups, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 19:21:47 +00:00
Evan Cheng
a9d50c00f1 Back out 60748 for now. It's breaking SPASS, 254.gap, and 464.h264ref.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60776 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 18:21:49 +00:00
Evan Cheng
f84802880c Cosmetic changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60771 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 17:56:30 +00:00
Nuno Lopes
34283c8303 remove unused var
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60770 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 17:04:06 +00:00
Dan Gohman
e3a49cd944 Whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60769 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 16:37:48 +00:00
Duncan Sands
677a7ec489 Handle a compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60755 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 09:58:11 +00:00
Chris Lattner
9f1e12a2f2 fix typos gabor noticed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60754 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 08:38:36 +00:00
Bill Wendling
c065b3f5ec Correct my English.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60753 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:55:31 +00:00
Chris Lattner
6563371bad restructure the top level non-local ptr dep query to handle
the first block of a query specially.  This makes the "complete query
caching" subsystem more effective, avoiding predecessor queries.  This
speeds up GVN another 4%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60752 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:52:59 +00:00
Chris Lattner
9863c3f507 rename getNonLocalPointerDepInternal -> getNonLocalPointerDepFromBB
and split its inner loop out into a new GetNonLocalInfoForBlock
function.  No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60751 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:47:11 +00:00
Evan Cheng
77f86ad087 DisableGVCompilation should not abort on internal GlobalValue's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60750 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:31:49 +00:00
Mon P Wang
1cd46bbb1c In LegalizeOp, don't change the result type of CONVERT_RNDSAT when promoting
one of its operand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60749 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:27:39 +00:00
Nick Lewycky
0bed364307 It's easy to handle SLE/SGE when the loop has a unit stride.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60748 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:25:04 +00:00
Chris Lattner
ba4dacc875 if we have two elements, insert both, don't use std::sort.
This speeds up the new GVN by another 3%


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60747 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 07:05:45 +00:00
Chris Lattner
1aeadacdad If we're only adding one new element to 'Cache', insert it into its known
position instead of using a full sort. This speeds up GVN by ~4% with the
new memdep stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60746 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 06:58:04 +00:00
Chris Lattner
511b36c00f convert a couple other places that use pred_iterator to use the caching
pred iterator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60745 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 06:44:17 +00:00
Chris Lattner
4012fdda13 use hte new pred cache to speed up the new non-local memdep
queries.  This speeds up GVN using the new queries (not yet
checked in) by just over 10%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60743 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 06:28:49 +00:00
Mon P Wang
e9f1015d1f Fix getNode to allow a vector for the shift amount for shifts of vectors.
Fix the shift amount when unrolling a vector shift into scalar shifts.
Fix problem in getShuffleScalarElt where it assumes that the input of
a bit convert must be a vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60740 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 05:46:39 +00:00
Chris Lattner
46a879ebd3 Fix a really subtle off-by-one bug that Duncan noticed with valgrind
on test/CodeGen/Generic/2007-06-06-CriticalEdgeLandingPad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60739 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 04:47:21 +00:00
Scott Michel
e07d3dead1 CellSPU:
- Change default scheduling preference to list-burr, which produces somewhat
  better code than the default. Could also use list-tdrr, but need to ask
  dev list about the appropriate handy mnemonic before commiting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60738 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 03:37:19 +00:00
Bill Wendling
52370a1089 Add initial support for fast-isel of the [SU]ADDO intrinsics. It isn't
complete. For instance, it lowers the common case into this less-than-optimal
code:

        addl    %ecx, %eax
        seto    %cl
        testb   %cl, %cl
        jne     LBB1_2  ## overflow

instead of:

        addl    %ecx, %eax
        jo      LBB1_2  ## overflow

That will come in a future commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60737 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 02:42:50 +00:00
Dan Gohman
aeac8f9cb4 Don't charge full latency for an anti-dependence, in this simplistic
pipeline model.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60733 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-09 00:26:46 +00:00
Dan Gohman
55fdaec36a Fix a couple of mistaken switch case fall-throughs. Thanks to Bill
for spotting these!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60728 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 23:50:06 +00:00
Chris Lattner
20fa76ef6f remove DebugIterations option. Despite the accusations,
jump threading has been shown to only expose problems not
have bugs itself.  I'm sure it's completely bug free! ;-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60725 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 22:44:07 +00:00
Evan Cheng
e4d1082b2c Re-apply 60689 now my head is screwed on right.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60711 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 19:29:03 +00:00
Dan Gohman
a629b48a66 Fix the top-level comments, and fix some 80-column violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60707 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 17:50:35 +00:00
Dan Gohman
2d4e9bc922 Revert 60689. It caused many regressions on Darwin targets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60705 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 17:38:02 +00:00
Devang Patel
042b877e84 Fix spelling.
Thanks Duncan!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60702 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 17:07:24 +00:00
Devang Patel
6d9896f153 Undo previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60701 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 17:02:37 +00:00
Duncan Sands
1832705b06 Fix comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60697 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 14:01:59 +00:00
Dan Gohman
c8a1a3c426 Factor out the code for sign-extending/truncating gep indices
and use it in x86 address mode folding. Also, make
getRegForValue return 0 for illegal types even if it has a
ValueMap for them, because Argument values are put in the
ValueMap. This fixes PR3181.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60696 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 07:57:47 +00:00
Chris Lattner
11dcd8d38d add another level of caching for non-local pointer queries, keeping
track of whether the CachedNonLocalPointerInfo for a block is specific
to a block.  If so, just return it without any pred scanning.  This is
good for a 6% speedup on GVN (when it uses this lookup method, which
it doesn't right now).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 07:31:50 +00:00
Chris Lattner
59779c5605 consistency
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60694 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 07:21:39 +00:00
Chris Lattner
bedb8c1d35 introduce a new RoundUpAlignment helper function, use it to
remove some more 64-bit divs and rems from the StructLayout 
ctor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 07:11:56 +00:00
Dan Gohman
149cfc3519 Make ConstantAggregateZero::get return a ConstantAggregateZero*,
as suggested in PR3182.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60691 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 07:10:54 +00:00
Dan Gohman
f923129fc3 Update CPP backend for PrintModulePass API changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60690 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 07:07:24 +00:00
Evan Cheng
dda346aa71 Perform cheap checks first.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60689 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 06:52:43 +00:00
Chris Lattner
295d4e953a Some minor optimizations for isObjectSmallerThan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 06:28:54 +00:00
Dan Gohman
2e3e5bf427 Move createVirtualRegister out-of-line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 04:54:11 +00:00
Dan Gohman
c93ced5b34 Clarify some comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60683 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 04:53:23 +00:00
Nick Lewycky
28ea4f6c07 Fixes for Visual Studio users. Patch by OvermindDL1 on llvm-dev!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60679 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-08 00:45:02 +00:00
Chris Lattner
3f7eb5b795 add an assert. the cast<> below would catch this but a message is more
useful.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60674 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 18:45:15 +00:00
Chris Lattner
0655f73ef7 factor some code better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60673 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 18:42:51 +00:00
Chris Lattner
d44745d241 factor some code, fixing some fixme's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60672 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 18:39:13 +00:00
Chris Lattner
6290f5cac2 add support for caching pointer dependence queries. Nothing uses this yet
so it "can't" break anything.  That said, it does appear to work.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60654 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 08:50:20 +00:00
Chris Lattner
a16ead8b10 fix a bug I introduced in simplifycfg handling single entry phi
nodes. FoldSingleEntryPHINodes deletes the PHI, so there is no
need to delete it afterward.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60653 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 07:22:45 +00:00
Owen Anderson
75c99c5aa8 Switch to top-down mode and fix a crasher this exposed caused by an error in the
live interval updating.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60652 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 05:33:18 +00:00
Nick Lewycky
6ecf5ce3e3 Fix typo, psuedo -> pseudo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60651 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 03:49:52 +00:00
Chris Lattner
9a193fd8ae Some internal refactoring to make it easier to cache results.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60650 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 02:56:57 +00:00
Chris Lattner
7ebcf03246 Introduce a new MemDep::getNonLocalPointerDependency
method.  This will eventually take over load/store dep
queries from getNonLocalDependency.  For now it works
fine, but is incredibly slow because it does no caching.
Lets not switch GVN to use it until that is fixed :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60649 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 02:15:47 +00:00
Chris Lattner
e79be944c8 push the "pointer case" up the analysis stack a bit. This causes
duplication of logic (in 2 places) to determine what pointer a 
load/store touches.  This will be addressed in a future commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60648 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 01:50:16 +00:00
Chris Lattner
d8dd934d16 make clients have to know how to call getCallSiteDependencyFrom
instead of making getDependencyFrom do it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60647 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 01:21:14 +00:00
Chris Lattner
106c6ca7b0 rename some variables for consistency
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60644 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:39:19 +00:00
Chris Lattner
fbc72e3e61 I love how using out of scope variables is not an error with GCC, no really I do.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60643 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:38:27 +00:00
Chris Lattner
8ef57c5faf Rename getCallSiteDependency -> getCallSiteDependencyFrom to
emphasize the scanning and make it more similar to 
getDependencyFrom
 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60642 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:35:51 +00:00
Chris Lattner
745291a6ce a memdep query on a volatile load/store will always return
clobber with the current implementation.  Instead of returning
a "precise clobber" just return a fuzzy one.  This doesn't 
matter to any clients anyway and should speed up analysis time
very very slightly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60641 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:28:02 +00:00
Chris Lattner
f760be1c7f don't bother touching volatile stores, they will just return clobber on
everything interesting anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60640 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:25:15 +00:00
Chris Lattner
84b9a56d11 remove the ability to get memdep info for vaarg. I don't think the
original impl was correct and noone actually makes the query anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:21:18 +00:00
Chris Lattner
630c99fd21 improve a note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60636 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 00:15:10 +00:00
Chris Lattner
6a09a74e46 some more PRE/GVN/DSE related notes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60633 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 22:52:12 +00:00
Chris Lattner
f96ca79cf3 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 22:49:05 +00:00
Chris Lattner
78a7e7c797 some random notes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60624 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 19:28:22 +00:00
Nick Lewycky
4a3136444e Minor cleanup. Use dyn_cast, not isa/cast pairs. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60623 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 17:57:05 +00:00
Evan Cheng
c3ccc1aaaf Clean up some ARM GV asm printing out; minor fixes to match what gcc does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60621 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 02:00:55 +00:00
Chris Lattner
5e600e67b1 Reimplement the inner loop of DSE. It now uniformly uses getDependence(),
doesn't do its own local caching, and is slightly more aggressive about
free/store dse (see testcase).  This eliminates the last external client 
of MemDep::getDependenceFrom().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60619 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 00:53:22 +00:00
Dan Gohman
dd17b25611 Don't use plain %x to print pointer values. I had changed it from %p
since %p isn't formatted consistently, but obviously plain %x is wrong.
PRIxPTR with a cast to uintptr_t would work here, but that requires
inconvenient build-system changes. %lu works on all current and
foreseable future hosts.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60616 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 23:39:24 +00:00
Dale Johannesen
368eb2b22d Forgot a file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60609 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 21:55:35 +00:00
Dale Johannesen
203af58aea Make LoopStrengthReduce smarter about hoisting things out of
loops when they can be subsumed into addressing modes.

Change X86 addressing mode check to realize that
some PIC references need an extra register.
(I believe this is correct for Linux, if not, I'm sure
someone will tell me.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60608 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 21:47:27 +00:00
Chris Lattner
b51deb929c Make a few major changes to memdep and its clients:
1. Merge the 'None' result into 'Normal', making loads
   and stores return their dependencies on allocations as Normal.
2. Split the 'Normal' result into 'Clobber' and 'Def' to
   distinguish between the cases when memdep knows the value is
   produced from when we just know if may be changed.
3. Move some of the logic for determining whether readonly calls
   are CSEs into memdep instead of it being in GVN.  This still
   leaves verification that the arguments are hte same to GVN to
   let it know about value equivalences in different contexts.
4. Change memdep's call/call dependency analysis to use 
   getModRefInfo(CallSite,CallSite) instead of doing something 
   very weak.  This only really matters for things like DSA, but
   someday maybe we'll have some other decent context sensitive
   analyses :)
5. This reimplements the guts of memdep to handle the new results.
6. This simplifies GVN significantly:
   a) readonly call CSE is slightly simpler
   b) I eliminated the "getDependencyFrom" chaining for load 
      elimination and load CSE doesn't have to worry about 
      volatile (they are always clobbers) anymore.
   c) GVN no longer does any 'lastLoad' caching, leaving it to 
      memdep.
7. The logic in DSE is simplified a bit and sped up.  A potentially
   unsafe case was eliminated.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60607 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 21:04:20 +00:00
Dan Gohman
56d9b6dff3 Demangle and pretty-print symbols in internal backtraces. Patch by
Wesley Peck, with a few fixes by me.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 20:12:48 +00:00
Anton Korobeynikov
64b535608e Revert invalid r60393. It causes llvm-gcc bootstrap fails in release builds.
See PR3160 for details

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60604 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 19:38:49 +00:00
Chris Lattner
6951381995 Make it illegal to call getDependency* on non-memory instructions
like binary operators.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60600 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 18:46:19 +00:00
Evan Cheng
650d7f3ff4 Reason #3 from 60595 doesn't hold true. If we can fold a PIC load from constpool into a use, the rewrite happens at time of spill (not in VirtRegMap). Later on, if the GlobalBaseReg is spilled, the spiller can see the use uses GlobalBaseReg and do the right thing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60596 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 17:41:31 +00:00
Evan Cheng
84100ba83d Effectively undo 60461 in PIC mode which simply transform V_SET0 / V_SETALLONES into a load from constpool in order to fold into restores. This is not safe to do when PIC base is being used for a number of reasons:
1. GlobalBaseReg may have been spilled.
2. It may not be live at the use.
3. Spiller doesn't know this is happening so it won't prevent GlobalBaseReg from being spilled later (That by itself is a nasty hack. It's needed because we don't insert the reload until later).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60595 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 17:23:48 +00:00
Chris Lattner
7f7c736682 Fix test/Transforms/GVN/pre-load.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60594 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 17:04:12 +00:00
Evan Cheng
72eeb94fe1 Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60592 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 17:00:16 +00:00
Chris Lattner
72bc70d499 Make IsValueFullyAvailableInBlock safe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60588 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 07:49:08 +00:00
Dan Gohman
2ce7f2068f Drop the reg argument to isRegReDefinedByTwoAddr, which was redundant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60586 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 05:45:42 +00:00
Dan Gohman
9bf23b5452 Teach StackSlotColoring to update MachineMemOperands when
changing the stack slots on an instruction, to keep them
consistent with the actual memory addresses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60584 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 05:31:14 +00:00
Dan Gohman
490b1833a9 Ignore IMPLICIT_DEF instructions when computing physreg liveness.
While they appear to provide a normal clobbering def, they don't
in the case of the awkward IMPLICIT_DEF+INSERT_SUBREG idiom. It
would be good to change INSERT_SUBREG; until then, this change
allows post-regalloc scheduling to cope in a mildly conservative
way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60583 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 05:30:02 +00:00
Evan Cheng
ae94e59416 Re-did 60519. It turns out Darwin's handling of hidden visibility symbols are a bit more complicate than I expected. Both declarations and weak definitions still need a stub indirection. However, the stubs are in data section and they contain the addresses of the actual symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60571 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 01:06:39 +00:00
Ted Kremenek
d75ba1c357 Have raw_fd_ostream keep track of the position in the file to make tell() go faster by not requiring a flush().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 22:51:11 +00:00
Devang Patel
3831005eb1 Rewrite code that 1) filters loops and 2) calculates new loop bounds.
This fixes many bugs. I will add more test cases in a separate check-in.

Some day, the code that manipulates CFG and updates dom. info could use refactoring help.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60554 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 21:38:42 +00:00
Owen Anderson
6002e993e0 Factor out some common code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60553 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 21:20:30 +00:00
Scott Michel
cc18827f59 CellSPU: Fix bug 3055
- Add v4f32, v2f64 to LowerVECTOR_SHUFFLE
- Look for vector rotate in shuffle elements, generate a vector rotate
  instead of a full-blown shuffle when opportunity presents itself.
- Generate larger test harness and fix a few interesting but obscure bugs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60552 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 21:01:44 +00:00
Duncan Sands
9304f2c294 When allocating a stack temporary, use the correct
number of bytes for types such as i1 which are not
a multiple of 8 bits in length.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60543 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 18:08:40 +00:00
Scott Michel
23f2ff74b1 Missing closing brace and reverse conditional condition on NDEBUG
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60541 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 17:16:59 +00:00
Chris Lattner
3cda3cdab1 Start simplifying a switch that has a successor that is a switch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60534 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 06:31:07 +00:00
Chris Lattner
d021901b09 This code is apparently quite confused. In the meantime,
get it building when NDEBUG is set.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60532 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 06:14:27 +00:00
Bill Wendling
a8103dad4e Temporarily revert r60519. It was causing a bootstrap failure:
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./gcc/xgcc -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./gcc/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/bin/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/lib/ -isystem /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/include -isystem /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/sys-include -DHAVE_CONFIG_H -I. -I../../../llvm-gcc.src/libgomp -I. -I../../../llvm-gcc.src/libgomp/config/posix -I../../../llvm-gcc.src/libgomp -Wall -pthread -Werror -O2 -g -O2 -MT barrier.lo -MD -MP -MF .deps/barrier.Tpo -c ../../../llvm-gcc.src/libgomp/barrier.c  -fno-common -DPIC -o .libs/barrier.o
checking for sys/file.h... /var/folders/zG/zGE-ZJOGFiGjv0B5cs5oYE+++TM/-Tmp-//cc34Jg5P.s:13:non-relocatable subtraction expression, "_gomp_tls_key" minus "L1$pb"
/var/folders/zG/zGE-ZJOGFiGjv0B5cs5oYE+++TM/-Tmp-//cc34Jg5P.s:13:symbol: "_gomp_tls_key" can't be undefined in a subtraction expression
make[4]: *** [barrier.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./gcc/xgcc -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.obj/./gcc/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/bin/ -B/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/lib/ -isystem /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/include -isystem /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm-gcc.install/i386-apple-darwin9.5.0/sys-include -DHAVE_CONFIG_H -I. -I../../../llvm-gcc.src/libgomp -I. -I../../../llvm-gcc.src/libgomp/config/posix -I../../../llvm-gcc.src/libgomp -Wall -pthread -Werror -O2 -g -O2 -MT alloc.lo -MD -MP -MF .deps/alloc.Tpo -c ../../../llvm-gcc.src/libgomp/alloc.c -o alloc.o >/dev/null 2>&1
yes
checking for sys/param.h... make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-target-libgomp] Error 2
make[1]: *** Waiting for unfinished jobs....



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60527 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 04:07:00 +00:00
Scott Michel
30ee7df71c CellSPU:
- First patch from Nehal Desai, a new contributor at Aerospace. Nehal's patch
  fixes sign/zero/any-extending loads for integers and floating point. Example
  code, compiled w/o debugging or optimization where he first noticed the bug:

  int main(void) {
    float a = 99.0;
    printf("%d\n", a);
    return 0;
  }

  Verified that this code actually works on a Cell SPU.

Changes by Scott Michel:
- Fix bug in the value type list constructed by SPUISD::LDRESULT to include
  both the load result's result and chain, not just the chain alone.
- Simplify LowerLOAD and remove extraneous and unnecessary chains.
- Remove unused SPUISD pseudo instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60526 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 03:02:42 +00:00
Dan Gohman
80e201b8db Use register names instead of numbers in debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 02:15:26 +00:00
Dan Gohman
b29ffc8870 Make debug output more informative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60524 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 02:14:57 +00:00
Evan Cheng
eb83dfde66 Visibility hidden GVs do not require extra load of symbol address from the GOT or non-lazy-ptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60519 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 01:56:50 +00:00
Dan Gohman
6a9041e5ca Add minimal support for disambiguating memory references. Currently
the main thing this covers is spills to distinct spill slots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60517 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 01:35:46 +00:00
Chris Lattner
77ee977fcf add a debugging option to help track down j-t problems.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60514 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 00:07:59 +00:00
Dan Gohman
cef874ae2b Rewrite the liveness bookkeeping code to fix a bunch of
issues with subreg operands and tied operands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60510 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 23:07:27 +00:00
Dale Johannesen
1bdd93a3dc Make the debugging dump be a full line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60509 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 22:45:31 +00:00
Dale Johannesen
308f24d452 Remove an unused field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60508 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 22:43:56 +00:00
Dan Gohman
d71703deec Have PseudoSourceValue override Value::dump, so that it works
on PseudoSourceValue values. This also fixes a FIXME in
lib/VMCode/AsmWriter.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60507 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 21:37:21 +00:00
Dale Johannesen
544e0d0e52 Fix a misspelled function name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 20:56:12 +00:00
Chris Lattner
29874e0dc6 Factor some code into a new FoldSingleEntryPHINodes method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60501 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:44:02 +00:00
Dan Gohman
e96cc775e4 Fix an inconsistency in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60500 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:38:38 +00:00
Evan Cheng
62fb4f2e1c Use mmx (punpckldq VR64, (mmx_v_set0)) to clear high 32-bits of a VR64 register.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:38:05 +00:00
Dan Gohman
e561751e98 Don't charge the full latency for anti and output dependencies. This is
an area where eventually it would be good to use target-dependent
information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60498 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:37:34 +00:00
Dale Johannesen
f94a327361 A step towards geting linux ppc to work (see PR 3099)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60497 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:33:10 +00:00
Dan Gohman
0dba0e5408 When looking for anti-dependences on the critical path, don't bother
examining non-anti-dependence edges.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60496 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:32:26 +00:00
Dan Gohman
ebb0a31103 Add a comment about callee-saved registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60495 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:30:13 +00:00
Dale Johannesen
67c7989294 Fix a really wrong comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:25:46 +00:00
Dan Gohman
c54baa2d43 Split foldMemoryOperand into public non-virtual and protected virtual
parts, and add target-independent code to add/preserve
MachineMemOperands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60488 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 18:43:12 +00:00
Dan Gohman
15511cf166 Rename isSimpleLoad to canFoldAsLoad, to better reflect its meaning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60487 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 18:15:48 +00:00
Dan Gohman
8cf7713753 Extend X86's addFrameReference to add a MachineMemOperand for
the frame reference. This will help post-RA scheduling determine
that spills to distinct stack slots are independent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60486 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 18:11:40 +00:00
Dan Gohman
f033b5a393 Update a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60484 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 17:10:41 +00:00
Duncan Sands
8b8e5a7f96 Only check that the result of the mapping was not
a new node if the node was actually remapped.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60482 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 12:36:16 +00:00
Rafael Espindola
952b839ce9 Fix bug 3140.
Print a single parameter .file directive if we have an ELF target.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60480 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 11:01:37 +00:00
Richard Osborne
269bc0042f Add support for ISD::TRAP to the XCore backend
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60479 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 10:59:16 +00:00
Evan Cheng
370e5340a5 Refactor code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60478 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 08:38:43 +00:00
Bill Wendling
0ea25cb941 CC should only be a ConstantSDNode at this point. Just use 'cast' instead of 'dyn_cast'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60477 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 08:32:02 +00:00
Chris Lattner
421fa9e32e Teach jump threading some more simple tricks:
1) have it fold "br undef", which does occur with
   surprising frequency as jump threading iterates.
2) teach j-t to delete dead blocks.  This removes the successor
   edges, reducing the in-edges of other blocks, allowing 
   recursive simplification.
3) Fold things like:
     br COND, BBX, BBY
  BBX:
     br COND, BBZ, BBW

   which also happens because jump threading iterates.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60470 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 07:48:08 +00:00
Chris Lattner
2973a25dbc third time is the charm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60469 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 07:45:15 +00:00
Chris Lattner
15efa1a1fd fix assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60468 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 07:43:05 +00:00
Chris Lattner
71af9b07a5 Rename DeleteBlockIfDead to DeleteDeadBlock and make it
unconditionally delete the block.  All likely clients will
do the checking anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60464 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 06:40:52 +00:00
Chris Lattner
2b1ba24fb7 Factor some code out of SimplifyCFG, forming a new
DeleteBlockIfDead method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60463 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 06:37:44 +00:00
Dan Gohman
62c939d7d5 Mark x86's V_SET0 and V_SETALLONES with isSimpleLoad, and teach X86's
foldMemoryOperand how to "fold" them, by converting them into constant-pool
loads. When they aren't folded, they use xorps/cmpeqd, but for example when
register pressure is high, they may now be folded as memory operands, which
reduces register pressure.

Also, mark V_SET0 isAsCheapAsAMove so that two-address-elimination will
remat it instead of copying zeros around (V_SETALLONES was already marked).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60461 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 05:21:24 +00:00
Dan Gohman
41474baac8 Add a sanity-check to tablegen to catch the case where isSimpleLoad
is set but mayLoad is not set. Fix all the problems this turned up.

Change code to not use isSimpleLoad instead of mayLoad unless it
really wants isSimpleLoad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 02:30:17 +00:00
Dan Gohman
c70f329543 Fix a missing #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60458 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 02:10:00 +00:00
Dan Gohman
c5a1a220ea Fix this comment to reflect that it applies to types other
than just i32.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60455 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 01:39:44 +00:00
Dan Gohman
e4300e271a Fix byval arguments in the fastcc calling convention. The fastcc convention
delegates to the regular x86-32 convention which handles byval, but only
after it handles a few cases, and it's necessary to handle byval before
handling those cases. This fixes PR3122 (and rdar://6400815), llvm-gcc
miscompiling LLVM.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60453 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 01:28:04 +00:00
Evan Cheng
96da041949 Remove a (what appears to be) overly strict assertion. Here is what happened:
1. ppcf128 select is expanded to f64 select's.
2. f64 select operand 0 is an i1 truncate, it's promoted to i32 zero_extend.
3. f64 select is updated. It's changed back to a "NewNode" and being re-analyzed.
4. f64 select operands are being processed. Operand 0 is a "NewNode". It's being expunged out of ReplacedValues map.
5. ExpungeNode tries to remap f64 select and notice it's a "NewNode" and assert.
Duncan, please take a look. Thanks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60443 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 21:57:09 +00:00
Dale Johannesen
fb10cd4901 Minor rewrite per review feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60442 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 21:17:11 +00:00
Scott Michel
546d7b5c4a Non-functional change: make custom lowering for truncate stylistically
consistent with the way it's generally done in other places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60439 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 19:55:08 +00:00
Scott Michel
b30e8f6334 CellSPU:
- Incorporate Tilmann Scheller's ISD::TRUNCATE custom lowering patch
- Update SPU calling convention info, even if it's not used yet (but can be
  at some point or another)
- Ensure that any-extended f32 loads are custom lowered, especially when
  they're promoted for use in printf.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60438 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 19:53:53 +00:00
Dan Gohman
d118342b25 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60434 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 19:27:20 +00:00
Owen Anderson
7b9d67c5bf Add support for folding spills into preceding defs when doing pre-alloc splitting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60433 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 18:53:47 +00:00
Dale Johannesen
34d7985927 One more transformation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60432 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 18:40:40 +00:00
Dale Johannesen
eccdd08d4c Make the code do what the comment says it does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60431 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 18:40:09 +00:00
Chris Lattner
01c8e0233d Comment typeo fix, thanks Duncan!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60429 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 18:33:11 +00:00
Tilmann Scheller
b0a5cdd451 make it possible to custom lower TRUNCATE (needed for the CellSPU target)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60409 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 12:12:25 +00:00
Chris Lattner
c89c6a964c Implement PRE of loads in the GVN pass with a pretty cheap and
straight-forward implementation.  This does not require any extra
alias analysis queries beyond what we already do for non-local loads.

Some programs really really like load PRE.  For example, SPASS triggers
this ~1000 times, ~300 times in 255.vortex, and ~1500 times on 403.gcc.

The biggest limitation to the implementation is that it does not split
critical edges.  This is a huge killer on many programs and should be
addressed after the initial patch is enabled by default.

The implementation of this should incidentally speed up rejection of 
non-local loads because it avoids creating the repl densemap in cases 
when it won't be used for fully redundant loads.

This is currently disabled by default.
Before I turn this on, I need to fix a couple of miscompilations in
the testsuite, look at compile time performance numbers, and look at
perf impact.  This is pretty close to ready though.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60408 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 08:16:11 +00:00
Nick Lewycky
48dd644109 Add a new SCEV representing signed division.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60407 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 08:05:48 +00:00
Mon P Wang
fb13f008cb Removed some unnecessary code in widening.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60406 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 07:35:08 +00:00
Chris Lattner
c7f7c1dc50 add a little helper function that does PHI translation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60405 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 07:16:45 +00:00
Chris Lattner
88d84b245c add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60404 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 06:32:34 +00:00
Bill Wendling
286a054908 Remove some errors that crept in. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60403 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 06:24:20 +00:00
Bill Wendling
d16c6e9993 Merge two if-statements into one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 06:22:04 +00:00
Bill Wendling
29976b9e12 More styalistic changes. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60401 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 06:18:11 +00:00
Bill Wendling
3bdcda82a5 - Remove the buggy -X/C -> X/-C transform. This isn't valid when X isn't a
constant. If X is a constant, then this is folded elsewhere.

- Added a note to Target/README.txt to indicate that we'd like to implement
  this when we're able.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60399 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 05:12:47 +00:00
Bill Wendling
a8bb13f989 Improve comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60398 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 05:09:00 +00:00
Bill Wendling
dda74e0702 - Reduce nesting.
- No need to do a swap on a canonicalized pattern.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60397 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 05:06:43 +00:00
Chris Lattner
f8828eb41b some random comment improvements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60395 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 04:52:26 +00:00
Owen Anderson
912c49d169 Fix an issue that Chris noticed, where local PRE was not properly instantiating
a new value numbering set after splitting a critical edge.  This increases
the number of instances of PRE on 403.gcc from ~60 to ~570.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60393 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 04:09:22 +00:00
Evan Cheng
bbe4105cd7 Fix PR3124: overly strict assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60392 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 02:15:36 +00:00
Dale Johannesen
221cd2f081 Add a few more transformations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60391 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 01:30:54 +00:00
Bill Wendling
61edeb5ed2 Second stab at target-dependent lowering of everyone's favorite nodes: [SU]ADDO
- LowerXADDO lowers [SU]ADDO into an ADD with an implicit EFLAGS define. The
  EFLAGS are fed into a SETCC node which has the conditional COND_O or COND_C,
  depending on the type of ADDO requested.

- LowerBRCOND now recognizes if it's coming from a SETCC node with COND_O or
  COND_C set.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60388 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 01:06:39 +00:00
Bill Wendling
9f24874f2e Reapply r60382. This time, don't mark "ADC" nodes with "implicit EFLAGS".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60385 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 00:07:05 +00:00
Bill Wendling
e3b3c00454 Temporarily revert r60382. It caused CodeGen/X86/i2k.ll and others to fail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60383 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 23:44:08 +00:00
Bill Wendling
a047bcacf2 - Have "ADD" instructions return an implicit EFLAGS.
- Add support for seto, setno, setc, and setnc instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60382 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 23:30:42 +00:00
Bill Wendling
13d6d446f6 Expand getVTList, getNodeValueTypes, and SelectNodeTo to handle more value types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60381 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 23:28:22 +00:00
Dale Johannesen
589bf0865c Consider only references to an IV within the loop when
figuring out the base of the IV.  This produces better
code in the example.  (Addresses use (IV) instead of 
(BASE,IV) - a significant improvement on low-register
machines like x86).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60374 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 22:00:01 +00:00
Bill Wendling
57036da328 Don't rebuild RHSNeg. Just use the one that's already there.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60370 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 21:06:30 +00:00
Bill Wendling
69fffa5437 Document what this check is doing. Also, no need to cast to ConstantInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60369 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 21:03:43 +00:00
Bill Wendling
c25c68305c Use a simple comparison. Overflow on integer negation can only occur when the
integer is "minint".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60366 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 19:46:27 +00:00
Scott Michel
1a6cdb6b50 CellSPU:
- Fix v2[if]64 vector insertion code before IBM files a bug report.
- Ensure that zero (0) offsets relative to $sp don't trip an assert
  (add $sp, 0 gets legalized to $sp alone, tripping an assert)
- Shuffle masks passed to SPUISD::SHUFB are now v16i8 or v4i32


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60358 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 17:56:02 +00:00
Duncan Sands
aaffa05d0a There are no longer any places that require a
MERGE_VALUES node with only one operand, so get
rid of special code that only existed to handle
that possibility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 11:41:29 +00:00
Duncan Sands
1607f05cb7 Change the interface to the type legalization method
ReplaceNodeResults: rather than returning a node which
must have the same number of results as the original
node (which means mucking around with MERGE_VALUES,
and which is also easy to get wrong since SelectionDAG
folding may mean you don't get the node you expect),
return the results in a vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60348 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 11:39:25 +00:00
Bill Wendling
d54d86038d Generalize the FoldOrWithConstant method to fold for any two constants which
don't have overlapping bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60344 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 08:32:40 +00:00
Bill Wendling
a698a472f2 Reduce copy-and-paste code by splitting out the code into its own function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60343 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 08:23:25 +00:00
Bill Wendling
03aae5f7e1 Use m_Specific() instead of double matching.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60341 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 08:09:47 +00:00
Bill Wendling
9c531a0f07 Move pattern check outside of the if-then statement. This prevents us from fiddling with constants unless we have to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60340 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 07:47:02 +00:00
Chris Lattner
d0f5bfc9be Rename some variables, only increment BI once at the start of the loop instead of throughout it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60339 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 07:35:54 +00:00
Chris Lattner
09713794c1 pull the predMap densemap out of the inner loop of performPRE, so
that it isn't reallocated all the time.  This is a tiny speedup for
GVN: 3.90->3.88s


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60338 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 07:29:03 +00:00
Chris Lattner
a3522000ab switch a couple more calls to use array_pod_sort.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60337 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:52:57 +00:00
Chris Lattner
99d0015735 Introduce a new array_pod_sort function and switch LSR to use it
instead of std::sort.  This shrinks the release-asserts LSR.o file
by 1100 bytes of code on my system.

We should start using array_pod_sort where possible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60335 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:49:59 +00:00
Chris Lattner
09fb7dadf1 Eliminate use of setvector for the DeadInsts set, just use a smallvector.
This is a lot cheaper and conceptually simpler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60332 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:27:41 +00:00
Chris Lattner
a68d4ca73e DeleteTriviallyDeadInstructions is always passed the
DeadInsts ivar, just use it directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60330 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:14:28 +00:00
Chris Lattner
bfcee36cd7 simplify DeleteTriviallyDeadInstructions again, unlike my previous
buggy rewrite, this notifies ScalarEvolution of a pending instruction
about to be removed and then erases it, instead of erasing it then 
notifying.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60329 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:11:32 +00:00
Chris Lattner
d8aafcb200 simplify these patterns using m_Specific. No need to grep for
xor in testcase (or is a substring).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60328 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 05:16:26 +00:00
Chris Lattner
ef0c6744d5 Teach jump threading to clean up after itself, DCE and constfolding the
new instructions it simplifies.  Because we're threading jumps on edges
with constants coming in from PHI's, we inherently are exposing a lot more
constants to the new block.  Folding them and deleting dead conditions
allows the cost model in jump threading to be more accurate as it iterates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60327 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 04:48:07 +00:00
Chris Lattner
11240d0fdd The PreVerifier pass preserves everything. In practice, this
prevents the passmgr from adding yet-another domtree invocation
for Verifier if there is already one live.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60326 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 03:58:38 +00:00
Chris Lattner
38b3dcc465 Change instcombine to use FoldPHIArgGEPIntoPHI to fold two operand PHIs
instead of using FoldPHIArgBinOpIntoPHI.  In addition to being more
obvious, this also fixes a problem where instcombine wouldn't merge two
phis that had different variable indices.  This prevented instcombine
from factoring big chunks of code in 403.gcc.  For example:

 insn_cuid.exit:                
-       %tmp336 = load i32** @uid_cuid, align 4      
-       %tmp337 = getelementptr %struct.rtx_def* %insn_addr.0.ph.i, i32 0, i32 3    
-       %tmp338 = bitcast [1 x %struct.rtunion]* %tmp337 to i32*               
-       %tmp339 = load i32* %tmp338, align 4           
-       %tmp340 = getelementptr i32* %tmp336, i32 %tmp339     
        br label %bb62
 
 bb61:       
-       %tmp341 = load i32** @uid_cuid, align 4     
-       %tmp342 = getelementptr %struct.rtx_def* %insn, i32 0, i32 3        
-       %tmp343 = bitcast [1 x %struct.rtunion]* %tmp342 to i32*           
-       %tmp344 = load i32* %tmp343, align 4        
-       %tmp345 = getelementptr i32* %tmp341, i32 %tmp344          
        br label %bb62
 
 bb62:      
-       %iftmp.62.0.in = phi i32* [ %tmp345, %bb61 ], [ %tmp340, %insn_cuid.exit ]         
+       %insn.pn2 = phi %struct.rtx_def* [ %insn, %bb61 ], [ %insn_addr.0.ph.i, %insn_cuid.exit ]         
+       %tmp344.pn.in.in = getelementptr %struct.rtx_def* %insn.pn2, i32 0, i32 3     
+       %tmp344.pn.in = bitcast [1 x %struct.rtunion]* %tmp344.pn.in.in to i32*  
+       %tmp341.pn = load i32** @uid_cuid     
+       %tmp344.pn = load i32* %tmp344.pn.in 
+       %iftmp.62.0.in = getelementptr i32* %tmp341.pn, i32 %tmp344.pn   
        %iftmp.62.0 = load i32* %iftmp.62.0.in     



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60325 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 03:42:51 +00:00
Chris Lattner
05f18920e1 Teach inst combine to merge GEPs through PHIs. This is really
important because it is sinking the loads using the GEPs, but
not the GEPs themselves.  This triggers 647 times on 403.gcc
and makes the .s file much much nicer.  For example before:

        je      LBB1_87 ## bb78
LBB1_62:        ## bb77
        leal    84(%esi), %eax
LBB1_63:        ## bb79
        movl    (%eax), %eax
...
LBB1_87:        ## bb78
        movl    $0, 4(%esp)
        movl    %esi, (%esp)
        call    L_make_decl_rtl$stub
        jmp     LBB1_62 ## bb77


after:

        jne     LBB1_63 ## bb79
LBB1_62:        ## bb78
        movl    $0, 4(%esp)
        movl    %esi, (%esp)
        call    L_make_decl_rtl$stub
LBB1_63:        ## bb79
        movl    84(%esi), %eax

The input code was (and the GEPs are merged and
the PHI is now eliminated by instcombine):

        br i1 %tmp233, label %bb78, label %bb77
bb77:           
        %tmp234 = getelementptr %struct.tree_node* %t_addr.3, i32 0, i32 0, i32 22              
        br label %bb79
bb78:           
        call void @make_decl_rtl(%struct.tree_node* %t_addr.3, i8* null) nounwind
        %tmp235 = getelementptr %struct.tree_node* %t_addr.3, i32 0, i32 0, i32 22              
        br label %bb79
bb79:           
        %iftmp.12.0.in = phi %struct.rtx_def** [ %tmp235, %bb78 ], [ %tmp234, %bb77 ]           
        %iftmp.12.0 = load %struct.rtx_def** %iftmp.12.0.in             



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60322 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 02:34:36 +00:00
Chris Lattner
978796eaad Make GVN be more intelligent about redundant load
elimination: when finding dependent load/stores, realize that
they are the same if aliasing claims must alias instead of relying
on the pointers to be exactly equal.  This makes load elimination
more aggressive.  For example, on 403.gcc, we had:

<     68 gvn    - Number of instructions PRE'd
< 152718 gvn    - Number of instructions deleted
<  49699 gvn    - Number of loads deleted
<   6153 memdep - Number of dirty cached non-local responses
< 169336 memdep - Number of fully cached non-local responses
< 162428 memdep - Number of uncached non-local responses

now we have:

>     64 gvn    - Number of instructions PRE'd
> 153623 gvn    - Number of instructions deleted
>  49856 gvn    - Number of loads deleted
>   5022 memdep - Number of dirty cached non-local responses
> 159030 memdep - Number of fully cached non-local responses
> 162443 memdep - Number of uncached non-local responses

That's an extra 157 loads deleted and extra 905 other instructions nuked.

This slows down GVN very slightly, from 3.91 to 3.96s.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60314 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 01:31:36 +00:00
Chris Lattner
bf145d6e2b Reimplement the non-local dependency data structure in terms of a sorted
vector instead of a densemap.  This shrinks the memory usage of this thing
substantially (the high water mark) as well as making operations like
scanning it faster.  This speeds up memdep slightly, gvn goes from
3.9376 to 3.9118s on 403.gcc

This also splits out the statistics for the cached non-local case to
differentiate between the dirty and clean cached case.  Here's the stats
for 403.gcc:

  6153 memdep - Number of dirty cached non-local responses
169336 memdep - Number of fully cached non-local responses
162428 memdep - Number of uncached non-local responses

yay for caching :)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 01:15:42 +00:00
Bill Wendling
b3833d1eb9 Implement ((A|B)&1)|(B&-2) -> (A&1) | B transformation. This also takes care of
permutations of this pattern.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60312 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 01:07:11 +00:00
Chris Lattner
663e441a75 Cache analyses in ivars and add some useful DEBUG output.
This speeds up GVN from 4.0386s to 3.9376s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60310 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 00:40:32 +00:00
Chris Lattner
1440ac5417 improve indentation, do cheap checks before expensive ones,
remove some fixme's.  This speeds up GVN very slightly on 403.gcc 
(4.06->4.03s)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60309 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 23:39:23 +00:00
Chris Lattner
fd3dcbea06 Eliminate the DepResultTy abstraction. It is now completely
redundant with MemDepResult, and MemDepResult has a nicer interface.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60308 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 23:17:19 +00:00
Eli Friedman
8b019c8a45 Minor cleanup: use getTrue and getFalse where appropriate. No
functional change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60307 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 22:48:49 +00:00
Eli Friedman
d1fd1da143 Some minor cleanups to instcombine; no functionality change.
Note that the FoldOpIntoPhi call is dead because it's impossible for the 
first operand of a subtraction to be both a ConstantInt and a PHINode.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60306 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 21:09:11 +00:00
Chris Lattner
d777d405cd Cache TargetData/AliasAnalysis in the pass instead of calling
getAnalysis<>.  getAnalysis<> is apparently extremely expensive.
Doing this speeds up GVN on 403.gcc by 16%!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60304 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 19:24:31 +00:00
Bill Wendling
b01865c210 Add instruction combining for ((A&~B)|(~A&B)) -> A^B and all permutations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 13:52:49 +00:00
Bill Wendling
7f0ef6b325 Implement (A&((~A)|B)) -> A&B transformation in the instruction combiner. This
takes care of all permutations of this pattern.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60290 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 13:08:13 +00:00
Bill Wendling
7c7048ecc6 Forgot one remaining call to getSExtValue().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60289 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 12:41:09 +00:00
Bill Wendling
6e1783fb4a getSExtValue() doesn't work for ConstantInts with bitwidth > 64 bits. Use all
APInt calls instead.

This fixes PR3144.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60288 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 12:38:24 +00:00
Eli Friedman
d83ae7d698 Optimize memmove and memset into the LLVM builtins. Note that these
only show up in code from front-ends besides llvm-gcc, like clang.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60287 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 08:32:11 +00:00
Eli Friedman
91db5271d2 A couple small cleanups, plus a new potential optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60286 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 07:52:27 +00:00
Eli Friedman
4e16b29a6b Moving potential optimizations out of PR2330 into lib/Target/README.txt.
Hopefully this isn't too much stuff to dump into this file.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60285 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 07:36:04 +00:00
Eli Friedman
fc69cb475f Followup to r60283: optimize arbitrary width signed divisions as well
as unsigned divisions.  Same caveats as before.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60284 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 06:35:39 +00:00
Eli Friedman
201c9776bd Fix for PR2164: allow transforming arbitrary-width unsigned divides into
multiplies.

Some more cleverness would be nice, though. It would be nice if we 
could do this transformation on illegal types.  Also, we would 
prefer a narrower constant when possible so that we can use a narrower
multiply, which can be cheaper.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60283 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 06:02:26 +00:00
Bill Wendling
3f93df5733 Don't make TwoToExp signed by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60279 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 05:29:33 +00:00
Bill Wendling
f0e44c4d7a From Hacker's Delight:
"For signed integers, the determination of overflow of x*y is not so simple. If
x and y have the same sign, then overflow occurs iff xy > 2**31 - 1. If they
have opposite signs, then overflow occurs iff xy < -2**31."

In this case, x == -1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60278 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 05:01:05 +00:00
Eli Friedman
86f874d9bb APIntify a test which is potentially unsafe otherwise, and fix the
nearby FIXME.

I'm not sure what the right way to fix the Cell test was; if the 
approach I used isn't okay, please let me know.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60277 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 04:59:26 +00:00
Bill Wendling
e1196d6d3e Instcombine was illegally transforming -X/C into X/-C when either X or C
overflowed on negation. This commit checks to make sure that neithe C nor X
overflows. This requires that the RHS of X (a subtract instruction) be a
constant integer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60275 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 03:42:12 +00:00
Chris Lattner
4a69bade23 Two changes: Make getDependency remove QueryInst for a dirty record's
ReverseLocalDeps when we update it.  This fixes a regression test
failure from my last commit.

Second, for each non-local cached information structure, keep a bit that
indicates whether it is dirty or not.  This saves us a scan over the whole
thing in the common case when it isn't dirty.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60274 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 02:52:26 +00:00
Chris Lattner
25f4b2b7a3 introduce a typedef, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60272 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 02:30:50 +00:00
Chris Lattner
f68f310386 Change NonLocalDeps to be a densemap of pointers to densemap
instead of containing them by value.  This increases the density
(!) of NonLocalDeps as well as making the reallocation case 
faster.  This speeds up gvn on 403.gcc by 2% and makes room for
future improvements.

I'm not super thrilled with having to explicitly manage the new/delete
of the map, but it is necesary for the next change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60271 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 02:28:25 +00:00
Chris Lattner
cfbb634225 calls never depend on allocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60268 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:44:00 +00:00
Chris Lattner
237a828745 Fix a fixme by making memdep's handling of allocations more logical.
If we see that a load depends on the allocation of its memory with no
intervening stores, we now return a 'None' depedency instead of "Normal".
This tweaks GVN to do its optimization with the new result.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60267 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:39:32 +00:00
Chris Lattner
73ec3cdd71 implement a fixme by introducing a new getDependencyFromInternal
method that returns its result as a DepResultTy instead of as a
MemDepResult.  This reduces conversion back and forth.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60266 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:26:32 +00:00
Chris Lattner
37d041c25f Move the getNonLocalDependency method to a more logical place in
the file, no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60265 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:18:27 +00:00
Chris Lattner
0e0a5b690c REmove an old fixme, resolve another fixme by adding liberal
comments about what this class does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:17:08 +00:00
Chris Lattner
125ce36269 remove a bit of incorrect code that tried to be tricky about speeding up
dependencies.  The basic situation was this: consider if we had:

  store1
  ...
  store2
  ...
  store3

Where memdep thinks that store3 depends on store2 and store2 depends 
on store1.  The problem happens when we delete store2: The code in 
question was updating dep info for store3 to be store1.  This is a
spiffy optimization, but is not safe at all, because aliasing isn't
transitive.  This bug isn't exposed today with DSE because DSE will only
zap store2 if it is identifical to store 3, and in this case, it is 
safe to update it to depend on store1.  However, memcpyopt is not so
fortunate, which is presumably why the "dropInstruction" code used to
exist.

Since this doesn't actually provide a speedup in practice, just rip the
code out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60263 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:09:30 +00:00
Chris Lattner
4f8c18c7c7 Eliminate the dropInstruction method, which is not needed any more.
Fix a subtle iterator invalidation bug I introduced in the last commit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60258 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 23:30:39 +00:00
Chris Lattner
0ec48ddef2 implement some fixme's: when deleting an instruction with
an entry in the nonlocal deps map, don't reset entries
referencing that instruction to [dirty, null], instead, set
them to [dirty,next] where next is the instruction after the
deleted one.  Use this information in the non-local deps
code to avoid rescanning entire blocks.

This speeds up GVN slightly by avoiding pointless work.  On
403.gcc this makes GVN 1.5% faster. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60256 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 22:02:15 +00:00
Chris Lattner
396a4a55e5 Change MemDep::getNonLocalDependency to return its results as
a smallvector instead of a DenseMap.  This speeds up GVN by 5%
on 403.gcc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60255 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 21:33:22 +00:00
Chris Lattner
729b23758a move MemoryDependenceAnalysis::verifyRemoved to the end of the file,
no functionality/code change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60254 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 21:25:10 +00:00
Chris Lattner
86b29ef64a reimplement getNonLocalDependency with a simpler worklist
formulation that is faster and doesn't require nonLazyHelper.
Much less code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 21:22:42 +00:00
Chris Lattner
3a76be584b Fix a thinko that manifested as a crash on clamav last night.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 20:29:04 +00:00
Chris Lattner
8c4652790e rename some maps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60242 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 09:20:15 +00:00
Chris Lattner
00314b3d84 rename some variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60241 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 09:15:21 +00:00
Chris Lattner
a161ab06d9 eliminate a bunch of code in favor of using AliasAnalysis::getModRefInfo.
Put a some code back to handle buggy behavior that GVN expects: it wants
loads to depend on each other, and accesses to depend on their allocations.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60240 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 09:09:48 +00:00
Chris Lattner
25a081439f simplify some code and rename some variables. Reduce nesting.
Use getTypeStoreSize instead of ABITypeSize for in-memory size
in a couple places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60238 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 08:51:16 +00:00
Chris Lattner
5391a1d804 Split getDependency into getDependency and getDependencyFrom, the
former does caching, the later doesn't.  This dramatically simplifies
the logic in getDependency and getDependencyFrom.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60234 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 03:47:00 +00:00
Bill Wendling
411052bb96 Temporarily revert r60195. It's causing an optimized bootstrap of llvm-gcc to fail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60233 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 03:43:04 +00:00
Chris Lattner
7f52422a3c Now that DepType is private, we can start cleaning up some of its uses:
Document the Dirty value more precisely, use it for the uninitialized
DepResultTy value.  Change reverse mappings to be from an instruction*
instead of DepResultTy, and stop tracking other forms.  This makes it more
clear that we only care about the instruction cases.

Eliminate a DepResultTy,bool pair by using Dirty in the local case as well,
shrinking the map and simplifying the code.

This speeds up GVN by ~3% on 403.gcc.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60232 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 03:22:12 +00:00
Chris Lattner
4c72400625 Introduce and use a new MemDepResult class to hold the results of a memdep
query.  This makes it crystal clear what cases can escape from MemDep that
the clients have to handle.  This also gives the clients a nice simplified
interface to it that is easy to poke at.

This patch also makes DepResultTy and MemoryDependenceAnalysis::DepType
private, yay.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60231 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 02:29:27 +00:00
Chris Lattner
39f372e23e Reimplement the internal abstraction used by MemDep in terms
of a pointer/int pair instead of a manually bitmangled pointer.
This forces clients to think a little more about checking the 
appropriate pieces and will be useful for internal 
implementation improvements later.

I'm not particularly happy with this.  After going through this
I don't think that the clients of memdep should be exposed to
the internal type at all.  I'll fix this in a subsequent commit.

This has no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60230 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 01:43:36 +00:00
Chris Lattner
d3d12ecadd Fix PR3141 by ensuring that MemoryDependenceAnalysis::removeInstruction
properly updates the reverse dependency map when it installs updated 
dependencies for instructions that depend on the removed instruction.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60222 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 22:51:08 +00:00
Chris Lattner
5425f22fa3 don't revisit instructions off the beginning of the block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60221 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 22:50:08 +00:00
Chris Lattner
baad8881f1 more cleanups for MemoryDependenceAnalysis::removeInstruction,
no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60219 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 22:28:27 +00:00
Chris Lattner
5f589dc77f random cleanups, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60218 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 22:04:47 +00:00
Chris Lattner
0e575f428c Run verifyRemoved from removeInstruction when -debug is specified.
This shows the root problem behind PR3141.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60216 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 21:45:17 +00:00
Chris Lattner
8b589fa135 rename "ping" to "verifyRemoved". I don't know why 'ping' what chosen,
but it doesn't make any sense at all.

Also make the method const, private, and fit in 80 cols while we're at it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60215 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 21:42:09 +00:00
Chris Lattner
565f96b196 simplify some code, remove escaped newline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60213 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 21:29:52 +00:00
Chris Lattner
57d4012f65 remove mysterious escaped newlines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60211 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 21:16:44 +00:00
Chris Lattner
f5102a0f08 don't call MergeBasicBlockIntoOnlyPred on a block whose only
predecessor is itself.  This doesn't make sense, and this is
a dead infinite loop anyway.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60210 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 19:54:49 +00:00
Duncan Sands
c6dbe7fbad Add include files needed when building with
gcc 4.4 (due to use of sprintf).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60209 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 10:20:03 +00:00
Duncan Sands
f9a67a8943 Fix build with gcc-4.4: it doesn't like PICStyle
being both a namespace and a variable name.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60208 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 09:29:37 +00:00
Chris Lattner
7605730ba8 rewrite RecursivelyDeleteTriviallyDeadInstructions to use a more efficient
formulation that doesn't require set lookups or scanning a set.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60203 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 01:20:46 +00:00
Chris Lattner
2872177834 remove some weirdness that came from the LSR code that has
nothing to do with dead instruction elimination.  No tests in
dejagnu depend on this, so I don't know what it was needed for.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60202 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 00:58:15 +00:00
Chris Lattner
925451e020 rewrite a big chunk of how DSE does recursive dead operand
elimination to use more modern infrastructure.  Also do a bunch
of small cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60201 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 00:27:14 +00:00
Chris Lattner
9fd4955c6a delete ErasePossiblyDeadInstructionTree, replacing uses of it with
RecursivelyDeleteTriviallyDeadInstructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60196 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 23:25:44 +00:00
Chris Lattner
1363949380 Simplify LoopStrengthReduce::DeleteTriviallyDeadInstructions by
making it use RecursivelyDeleteTriviallyDeadInstructions to do
the heavy lifting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60195 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 23:23:35 +00:00
Chris Lattner
564c0a2330 enhance RecursivelyDeleteTriviallyDeadInstructions to make
PHIs dead if they are single-value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60194 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 23:18:11 +00:00
Chris Lattner
4f02c74a8e Enhance RecursivelyDeleteTriviallyDeadInstructions to optionally
return a list of deleted instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60193 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 23:14:34 +00:00
Chris Lattner
a0d4486073 use continue to reduce indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60192 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 23:00:20 +00:00
Chris Lattner
3481f24c06 remove doConstantPropagation and dceInstruction, they are just
wrappers around the interesting code and use an obscure iterator
abstraction that dates back many many years.

Move EraseDeadInstructions to Transforms/Utils and name it
RecursivelyDeleteTriviallyDeadInstructions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60191 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 22:57:53 +00:00
Chris Lattner
15678533f3 simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60190 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 22:56:14 +00:00
Chris Lattner
cb03f8547d simplify this logic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60189 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 22:46:09 +00:00
Nick Lewycky
d2f0db1b19 Also update the README.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60188 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 22:41:45 +00:00
Nick Lewycky
8ca5248522 Chris prefers icmp/select over udiv!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60187 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 22:41:10 +00:00
Nick Lewycky
df563ca1f3 Add a synthetic missed optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60186 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 22:12:22 +00:00
Nick Lewycky
895f085385 Add a couple of missed optimizations on integer vectors. Multiply and divide
by 1, as well as multiply by -1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60182 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 20:21:08 +00:00
Chris Lattner
9918fb5631 defensive patch: if CGP is merging a block with the entry block, make sure
it ends up being the entry block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60180 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 19:29:14 +00:00
Chris Lattner
3d86d242c6 Fix PR3138: if we merge the entry block into another block, make sure to
move the other block back up into the entry position!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60179 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 19:25:19 +00:00
Nick Lewycky
a89d102b32 Silence a warning.
Despite changing the order of evaluation, this doesn't actually change the
meaning of the statement.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60177 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 17:29:52 +00:00
Nuno Lopes
440954c64b fix build on some machines. thanks buildbot
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60175 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 16:42:44 +00:00
Nuno Lopes
4ba9aac839 fix my previous commit r60064: compare strings instead of pointers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60174 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 16:37:02 +00:00
Chris Lattner
4aebaee0e4 switch InstCombine::visitLoadInst to use
FindAvailableLoadedValue


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60169 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 08:56:30 +00:00
Chris Lattner
e3a0884ddf improve const correctness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60168 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 08:39:18 +00:00
Chris Lattner
ee6e10bc8e enhance FindAvailableLoadedValue to make use of AliasAnalysis
if it has it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60167 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 08:18:12 +00:00
Chris Lattner
52c95856b4 move FindAvailableLoadedValue from JumpThreading to Transforms/Utils.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60166 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 08:10:05 +00:00
Bill Wendling
b7c0d94465 Get rid of bogus "control may reach end of non-void function ‘...’ being
inlined" message.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60165 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 08:00:12 +00:00
Chris Lattner
5a5c9a5acd simplify this code a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60164 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 07:54:38 +00:00
Chris Lattner
3c4f8b91ef Use the new MergeBasicBlockIntoOnlyPred function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60163 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 07:54:12 +00:00
Chris Lattner
b29714a10a move MergeBasicBlockIntoOnlyPred to Transforms/Utils.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60162 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 07:43:12 +00:00
Chris Lattner
c7bcbf6903 rename ThreadBlock to ProcessBlock, since it does other things than
just simple threading.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60157 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 07:20:04 +00:00
Bill Wendling
109872e360 Comment out code that isn't entirely correct.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60156 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 07:18:35 +00:00
Sanjiv Gupta
9b0f0b5e15 Removing redundant semicolons. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60149 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 05:58:04 +00:00
Chris Lattner
69e067fdd8 Make jump threading substantially more powerful, in the following ways:
1. Make it fold blocks separated by an unconditional branch.  This enables
   jump threading to see a broader scope.
2. Make jump threading able to eliminate locally redundant loads when they
   feed the branch condition of a block.  This frequently occurs due to
   reg2mem running.
3. Make jump threading able to eliminate *partially redundant* loads when
   they feed the branch condition of a block.  This is common in code with
   lots of loads and stores like C++ code and 255.vortex.

This implements thread-loads.ll and rdar://6402033.

Per the fixme's, several pieces of this should be moved into Transforms/Utils.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60148 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 05:07:53 +00:00
Evan Cheng
dc52cf48dc Eliminate a compile time warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60145 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 02:29:25 +00:00
Evan Cheng
df90841690 Avoid inserting noop's in the middle of a loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60141 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 01:16:00 +00:00
Evan Cheng
884c70c912 On x86 favors folding short immediate into some arithmetic operations (e.g. add, and, xor, etc.) because materializing an immediate in a register is expensive in turns of code size.
e.g.
movl 4(%esp), %eax
addl $4, %eax

is 2 bytes shorter than

movl $4, %eax
addl 4(%esp), %eax


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60139 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 00:49:46 +00:00
Dale Johannesen
56eca9103e Add a missing case in visitADD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60137 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 00:43:21 +00:00
Bill Wendling
3fafd93560 Generate something sensible for an [SU]ADDO op when the overflow/carry flag is
the conditional for the BRCOND statement. For instance, it will generate:

    addl %eax, %ecx
    jo LOF

instead of

    addl %eax, %ecx
    ; About 10 instructions to compare the signs of LHS, RHS, and sum.
    jl LOF



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60123 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 22:37:40 +00:00
Chris Lattner
ab8b794a78 Turn on my codegen prepare heuristic by default. It doesn't affect
performance in most cases on the Grawp tester, but does speed some 
things up (like shootout/hash by 15%).  This also doesn't impact 
compile time in a noticable way on the Grawp tester.

It also, of course, gets the testcase it was designed for right :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60120 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 22:16:44 +00:00
Evan Cheng
07213cb4b7 Cosmetic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60110 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 18:00:00 +00:00
Sanjiv Gupta
d3f01aa5a1 Allow custom lowering of ADDE/ADDC/SUBE/SUBC operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60102 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 11:19:00 +00:00
Sanjiv Gupta
8f78fa827e Emit declaration for globals and externs.
Custom lower AND, OR, XOR bitwise operations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60098 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 10:53:50 +00:00
Dan Gohman
25a1b47cc3 Fish kill flag annotations in PUSH instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60095 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 06:39:12 +00:00
Dan Gohman
2ad8245566 LiveRanges are represented as half-open ranges. Fix the findLiveInMBBs code
and the LiveInterval.h top-level comment and accordingly. This fixes blocks
having spurious live-in registers in boundary cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60092 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 05:50:31 +00:00
Chris Lattner
695d8ec33b teach the new heuristic how to handle inline asm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60088 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 04:59:11 +00:00
Ted Kremenek
5984680c1f Add 'tell' method to raw_fd_ostream that clients can use to query the current location in the file the stream is writing to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60085 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 03:33:13 +00:00