Commit Graph

23703 Commits

Author SHA1 Message Date
Evan Cheng
601ca4b434 Enable two-address remat by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52701 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 01:16:38 +00:00
Owen Anderson
e4f6ee590b Use push_back rather than operator[], which is incorrect in this cases. Unfortunately, this slow the testcase down a little bit,
but only marginally.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52700 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-25 01:05:05 +00:00
Dan Gohman
153d28a414 Append to the ActiveTimers std::vector before looking at the timer instead
of after, so that any reallocation it does doesn't get counted for the pass
being timed.  This probably doesn't account for a timing discrepancy I was
looking into, but I'm fixing it anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52693 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 22:07:07 +00:00
Dale Johannesen
a68f9013f2 Add v2f32 (MMX) type to X86. Support is primitive:
load,store,call,return,bitcast.  This is enough to
make call and return work.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52691 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 22:01:44 +00:00
Owen Anderson
45e3958941 In ConstantArray::getAsString(), we know the size of the resultant string in advance so we can pre-allocate it and just fill in
the entries.  This improves the time for the AsmPrinter on InstructionCombining.cpp from 0.4248s to 0.3370s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52690 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 21:58:29 +00:00
Owen Anderson
873e1b5642 Use SmallVector instead of std::vector for a minor compile time improvement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52689 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 21:44:59 +00:00
Dan Gohman
8dbe7f832e Revert 52645, the loop unroller changes. It caused a regression in 252.eon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52688 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 20:44:42 +00:00
Dan Gohman
2864ce6065 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 18:00:21 +00:00
Dan Gohman
78f39da1e8 Use const_cast instead of a C-style cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 17:47:37 +00:00
Matthijs Kooijman
1d9a277761 Commit the new DeadArgElim pass again, this time with the gcc bootstrap failures fixed.
Also add a testcase to reproduce the gcc bootstrap failure in very much reduced form.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52677 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 16:30:26 +00:00
Matthijs Kooijman
4e78908b94 Rename a few variables to be more consistent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52672 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 09:14:10 +00:00
Evan Cheng
9ef4ca2e81 If it's determined safe, remat MOV32r0 (i.e. xor r, r) and others as it is instead of using the longer MOV32ri instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52670 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 07:10:51 +00:00
Dan Gohman
46e803b3e6 Fix some signed vs. unsigned issues in array and vector handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52664 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 01:17:52 +00:00
Dan Gohman
2d0d59380a Add a note about a potential PIC optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52663 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 00:53:07 +00:00
Dan Gohman
db7991de75 Fixes for being compiled PIC on Linux. This isn't the most
general solution possible, but it's a fairly simple one.
Based on a patch from the OpenGTL project!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52662 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 00:50:01 +00:00
Dan Gohman
51cd9d6e07 A brief survey of priority_queue usage in the tree turned this up
as a questionable case, but the code isn't actually needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52657 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 23:51:16 +00:00
Bill Wendling
ebcba612b5 This situation can occur:
,------.
    |      |
    |      v
    |   t2 = phi ... t1 ...
    |      |
    |      v
    |   t1 = ...
    |  ... = ... t1 ...
    |      |
    `------'

where there is a use in a PHI node that's a predecessor to the defining
block. We don't want to mark all predecessors as having the value "alive" in
this case. Also, the assert was too restrictive and didn't handle this case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52655 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 23:41:14 +00:00
Dan Gohman
aabdded3b4 Use the new PriorityQueue in ScheduleDAGList too, which also
needs arbitrary-element removal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52654 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 23:40:09 +00:00
Dan Gohman
cb41e6bf52 Use use_empty() instead of getNumUses(), avoiding a use list traversal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52651 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 23:23:49 +00:00
Owen Anderson
b3db9c90d2 Use getMBBEndIdx rather than assuming that the end is right after the last instruction in the block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52649 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 22:12:23 +00:00
Dan Gohman
73b43b9b54 Fix spelling and grammar in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52648 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 22:11:52 +00:00
Dan Gohman
55e283c71e Revamp the loop unroller, extending it to correctly update PHI nodes
in the presence of out-of-loop users of in-loop values and the trip
count is not a known multiple of the unroll count, and to be a bit
simpler overall. This fixes PR2253.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52645 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 21:29:41 +00:00
Evan Cheng
d17e44769f Remove option used to debug stack coloring bugs. It's no longer needed since stack coloring is now bug free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52644 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 21:24:32 +00:00
Evan Cheng
2e9f0b1a32 Disable PRE. It's breaking bootstrapping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52643 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 21:22:35 +00:00
Dan Gohman
8cb8245cf1 Move a DenseMap's declaration outside of a loop, and just call
clear() on each iteration. This avoids allocating and deallocating
all of DenseMap's memory on each iteration.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52642 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 21:15:00 +00:00
Evan Cheng
99ec779a93 Instead of adding an isSS field to LiveInterval to denote stack slot. Use top bit of 'reg' instead. If the top bit is set, than the LiveInterval represents a stack slot live interval.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 21:03:19 +00:00
Wojciech Matyjewicz
300c6c5167 First step to fix PR2088. Implement routine to compute the
multiplicative inverse of a given number. Modify udivrem to allow input and 
output pairs of arguments to overlap. Patch is based on the work by Chandler
Carruth.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52638 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 19:39:50 +00:00
Dan Gohman
180c1691c7 Update the .cvs files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52637 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 18:43:26 +00:00
Dan Gohman
ebb5a971d9 Fix the types for NumElements variables, and add a comment
explaining why empty array constants use ValID::createUndef().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52636 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 18:40:28 +00:00
Owen Anderson
b70a571c99 Tighten the conditions under which we do PRE, remove some unneeded code, and correct our preserved analyses list, since we
do now change the CFG by splitting critical edges during PRE.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52631 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 17:49:45 +00:00
Chris Lattner
2a6a645709 minor tidying of comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52630 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 17:11:23 +00:00
Dan Gohman
2f27e174a9 Remove two convenience constructors because they're now private, and the
private implementation doesn't really need the convenience.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52629 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 16:48:17 +00:00
Dan Gohman
7894ea75b5 Use std::copy instead of a loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52628 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 16:45:24 +00:00
Dan Gohman
1a203571ca More changes from Chris' review: simplify getIndices and avoid
copying its return value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52627 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 16:39:44 +00:00
Dan Gohman
0a4627d71f Duncan pointed out this code could be tidied.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52624 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 15:29:14 +00:00
Duncan Sands
e9c80f4d57 Port some integer multiplication fixes from LegalizeDAG.
Bail out with an error if there is no libcall available
for the given size of integer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 15:15:44 +00:00
Duncan Sands
4a307ecce6 Support for expanding the result of EXTRACT_ELEMENT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52621 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 15:08:15 +00:00
Duncan Sands
ab09b7e8f3 Cleanup up LegalizeTypes handling of loads and
stores.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52620 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 14:19:45 +00:00
Owen Anderson
ae18bd4246 At Chris' suggestion, move the liveness and worklist datastructures into
instance variables so they can be allocated just once, and reuse the worklist
as the dead list as well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52618 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 06:13:12 +00:00
Dan Gohman
cbfe5bbe88 Improve LSR's dead-phi detection to handle use-def cycles
with more than two nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52617 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-22 20:44:02 +00:00
Dan Gohman
9b78763fce Use Loop::block_iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52616 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-22 20:18:58 +00:00
Dan Gohman
6c459a28ec Generalize createSCEV to be able to form SCEV expressions from
ConstantExprs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52615 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-22 19:56:46 +00:00
Dan Gohman
17f1972c77 Use SCEVAddRecExpr::isAffine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52614 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-22 19:23:09 +00:00
Dan Gohman
09d3fdc254 Remove unnecessary #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52613 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-22 19:21:26 +00:00
Dan Gohman
11f6d3b478 Move a few more SCEVExpander methods out-of-line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52612 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-22 19:09:18 +00:00
Chris Lattner
963a97f1a3 Fix PR2369 by making scalarrepl more careful about promoting
structures.  Its default threshold is to promote things that are
smaller than 128 bytes, which is sane.  However, it is not sane
to do this for things that turn into 128 *registers*.  Add a cap
on the number of registers introduced, defaulting to 128/4=32.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52611 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-22 17:46:21 +00:00
Duncan Sands
69bfb15ecd Make custom lowering of ADD work correctly. This
fixes PR2476; patch by Richard Osborne.  The same
problem exists for a bunch of other operators, but
I'm ignoring this because they will be automagically
fixed when the new LegalizeTypes infrastructure lands,
since it already solves this problem centrally.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52610 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-22 09:42:16 +00:00
Eli Friedman
5c1f172213 Fix for PR2479: correctly optimize expressions like (a > 13) & (a ==
15).

See also PR1800, which is about the signed case.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52608 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 23:36:13 +00:00
Dan Gohman
1adec83ae8 Use Instruction::eraseFromParent().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52606 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 22:08:46 +00:00
Dan Gohman
4d515d0b09 Use Function's arg_size() and size() methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 22:06:54 +00:00
Dan Gohman
5686752099 Simplify some getNode calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52604 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 22:06:07 +00:00
Dan Gohman
2f1d3108e4 canClobberPhysRegDefs shouldn't called without checking hasPhysRegDefs;
check this with an assert.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52603 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 22:05:24 +00:00
Dan Gohman
95df6b3603 Avoid creating a redundant zero APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52602 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 22:03:12 +00:00
Dan Gohman
317adcc9c6 Use clear() to zero an existing APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52601 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 22:02:15 +00:00
Dan Gohman
719de53742 Use back() instead of [size()-1].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52600 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 22:00:54 +00:00
Dan Gohman
0011dc4738 Use MachineBasicBlock::transferSuccessors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52594 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 20:21:19 +00:00
Dan Gohman
933e51c5e3 Use static_cast instead of reinterpret_cast for casting void*.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52592 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 20:17:03 +00:00
Chris Lattner
629c1a3f78 Fix warning when assertions disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52590 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 19:49:01 +00:00
Chris Lattner
9d2c9bd113 fix warning when assertions disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52589 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 19:48:22 +00:00
Chris Lattner
48a0eec1da fix warning when assertion disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52588 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 19:47:44 +00:00
Chris Lattner
a1aabe422f fix some warnings when assertions are disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52587 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 19:47:03 +00:00
Dan Gohman
8d96144b0e Remove a redundant return.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52585 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 19:34:57 +00:00
Dan Gohman
94d7a5f815 Remove ScheduleDAG's SUnitMap altogether. Instead, use SDNode's NodeId
field, which is otherwise unused after instruction selection, as an index
into the SUnit array.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52583 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 19:18:17 +00:00
Dan Gohman
3627e34486 Add a priority queue class, which is a wrapper around std::priority_queue
and provides fairly efficient removal of arbitrary elements. Switch
ScheduleDAGRRList from std::set to this new priority queue.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52582 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 18:35:25 +00:00
Duncan Sands
a1ace76c70 Support for load/store of expanded float types. I
don't know if a truncating store is possible here,
but added support for it anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52577 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 17:00:47 +00:00
Dan Gohman
4c8c83022b Change ScheduleDAG's SUnitMap from DenseMap<SDNode*, vector<SUnit*> >
to DenseMap<SDNode*, SUnit*>, and adjust the way cloned SUnit nodes are
handled so that only the original node needs to be in the map.
This speeds up llc on 447.dealII.llvm.bc by about 2%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52576 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 15:52:51 +00:00
Evan Cheng
4ce138cc55 Enable PRE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52574 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 07:26:53 +00:00
Evan Cheng
c3417609ae Undo spill weight tweak. Need to investigate the performance regressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 06:45:54 +00:00
Dan Gohman
16c6859651 Simplify some template parameterization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52571 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 01:08:22 +00:00
Evan Cheng
9f99b7c595 Back out Matthijs' DAE patches. It's miscompiling gcc driver.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52570 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 00:31:44 +00:00
Evan Cheng
3e172254c1 Enhanced heuristic to determine the *best* register to spill. Instead of picking the register with the lowest spill weight. Consider (up to) 2 additional registers with spill weights that are close to the lowest spill weight. The one with fewest defs and uses that conflicts with the current interval (weighted by loop depth) is the spill candidate.
This is not always a win, but there are much more wins than loses and wins tend to be more noticeable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52554 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 21:45:16 +00:00
Duncan Sands
78cd649ad3 Share some code that is common between integer and
float expansion (and sometimes vector splitting too).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52548 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 18:40:50 +00:00
Duncan Sands
4fc4fd657d Rename the operation of turning a float type into an
integer of the same type.  Before it was "promotion",
but this is confusing because it is quite different
to promotion of integers.  Call it "softening" instead,
inspired by "soft float".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 17:49:55 +00:00
Dan Gohman
3461cc9e98 Clean up some uses of std::distance, now that we have allnodes_size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52545 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 17:15:19 +00:00
Dan Gohman
9614fcc640 Clean up a use of std::distance.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52544 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 17:11:32 +00:00
Dan Gohman
60ea268645 Tidy up some commments and use the getAggregateOperand and
getInsertedValueOperand accessors. Thanks Matthijs!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52543 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 16:41:17 +00:00
Dan Gohman
dfaceb49fc Fix the conditions under which SCCP should examine insertvalue
instructions. Thanks to Matthijs Kooijman for pointing this out!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52542 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 16:39:44 +00:00
Matthijs Kooijman
7e43b3be88 80 column and trailing whitespace fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52539 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 15:34:07 +00:00
Matthijs Kooijman
df0891d2ff Don't let DeadArgumentElimination attempt to update callers when the return
type wasn't changed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52538 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 15:25:43 +00:00
Matthijs Kooijman
03d18569cb Don't let DeadArgElimination change the return type ({} into void and {T}
into T) when no return values are actually dead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52537 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 15:16:45 +00:00
Matthijs Kooijman
9cb6ec26b3 Explicitely track if any arguments or return values were removed in
DeadArgumentElimination and assert that the function type does not change if
nothing was changed. This should catch subtle changes in function type that are
not intended.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52536 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 14:28:52 +00:00
Matthijs Kooijman
1b492b2f8d Remove debug output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52535 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 14:03:35 +00:00
Matthijs Kooijman
c95e44b4e0 Recommit r52459, rewriting of the dead argument elimination pass.
This is a fixed version that no longer uses multimap::equal_range, which
resulted in a pointer invalidation problem.

Also, DAE::InspectedFunctions was not really necessary, so it got removed.

Lastly, this version no longer applies the extra arg hack on functions who did
not have any arguments to start with.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52532 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 09:36:16 +00:00
Owen Anderson
f2204d7bb1 Really disable PRE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52531 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 08:59:13 +00:00
Chris Lattner
ec91ccba3c Fix an error handling redefinition of linkonce functions where the
types differ.  Patch by Nathan Keynes!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52527 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 05:29:39 +00:00
Chris Lattner
2de3fec61c Fix PR2471, which is a bug involving an invalid promotion from a conditional load.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 05:12:56 +00:00
Gordon Henriksen
54227f6752 Add C binding for ExecutionEngine::addGlobalMapping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52523 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 02:16:11 +00:00
Dan Gohman
ab8ec0a26c Teach ReturnInst lowering about aggregate return values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52522 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 01:29:26 +00:00
Owen Anderson
6fafe847b2 Change around the data structures used to store availability sets, resulting in a GVN+PRE that is faster that GVN alone was before.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52521 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 01:15:47 +00:00
Dan Gohman
c4b65ea56b Teach SCCP about insertvalue and extractvalue, and about
propagating constants across aggregate return values when
insertvalue and extractvalue are used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52520 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 01:15:44 +00:00
Dan Gohman
2c31750cd0 Teach InlineFunction how to differentiate between multiple-value
return statements and aggregate returns so that it handles both
correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52519 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 01:03:44 +00:00
Evan Cheng
88d11c03cd Disable PRE for now. It seems to be breaking llvm-gcc bootstrapping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52518 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 01:01:07 +00:00
Dan Gohman
dded0fd398 Fix the index calculations for the extractvalue lowering code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52517 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 00:54:19 +00:00
Dan Gohman
8f36f6d117 Simplify the ComputeLinearIndex logic and fix a few bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52516 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 00:53:00 +00:00
Dan Gohman
09ef00f979 Simplify this code. Thanks Chris!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52514 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20 00:47:44 +00:00
Evan Cheng
c8af52c898 ISD::UNDEF should be expanded recursively / iteratively.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52508 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 22:01:11 +00:00
Owen Anderson
aa0b63422a Add a hidden -disable-pre flag for testing purposes. This should be removed
once benchmarking is completed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 19:57:25 +00:00
Owen Anderson
5c274eebc6 PRE requires that critical edges be split.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52505 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 19:54:19 +00:00
Bill Wendling
ac151da204 Remove dead code causing a warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 18:00:44 +00:00
Dan Gohman
52d36e6f87 Use the common API for adding instructions to basic blocks instead of
using BasicBlock::getInstList.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52500 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 17:53:32 +00:00
Owen Anderson
9da52dce89 Be sure to remove values from the value numbering table after we delete them.
This fixes a failure on povray.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 17:53:26 +00:00
Dan Gohman
d02d917c72 Use Instruction::moveBefore instead of manipulating the instruction list
directly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52498 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 17:47:47 +00:00
Dan Gohman
610c0e2b40 Avoid using BasicBlock::getInstList directly in a few places.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52497 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 17:37:25 +00:00
Owen Anderson
3cd8eb314a Revert support for insertvalue and extractvalue instructions for the moment.
GVN expects that all inputs which to an instruction fall somewhere in the value
hierarchy, which isn't true for these.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52496 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 17:25:39 +00:00
Dan Gohman
04478e56f7 Use the transferSuccessors helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52495 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 17:22:29 +00:00
Dan Gohman
f3dc70092c Delete dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 17:18:39 +00:00
Matthijs Kooijman
f0da2039d1 Use a CallSite to find the nth argument of a call/invoke instruction instead of
using getOperand() directly. This makes things work with invoke instructions as
well.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52489 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 08:53:24 +00:00
Duncan Sands
9954c76f2c Fix some warnings reported by gcc-4.3. Hopefully
this still compiles on windows - I can't test!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52488 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 08:47:31 +00:00
Evan Cheng
32a3ac7911 Missed a check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52487 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 06:17:19 +00:00
Eli Friedman
2c8e64d3e4 Fix a bug with <8 x i16> shuffle lowering on X86 where parts of the
shuffle could be skipped.  The check is invalid because the loop index i 
doesn't correspond to the element actually inserted. The correct check is
already done a few lines earlier, for whether the element is already in 
the right spot, so this shouldn't have any effect on the codegen for 
code that was already correct.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52486 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 06:09:51 +00:00
Owen Anderson
29b039976f Revert my last patch, which was causing regression test failures.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52485 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 05:29:34 +00:00
Evan Cheng
e00f5de361 Coalesce copy from one register class to a sub register class. e.g. X86::MOV16to16_.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52480 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 01:39:21 +00:00
Evan Cheng
1b38ec83f0 Cosmetic changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52479 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 01:21:26 +00:00
Evan Cheng
082e7c12a1 Unneeded include's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52478 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 01:21:02 +00:00
Evan Cheng
bdf34bc12b Minor spiller tweak to unfavor reload into load/store instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52477 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 01:16:17 +00:00
Owen Anderson
6c5e561668 Insert empty slots into the instruction numbering in live intervals, so that we can more easily
add new instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52475 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 00:10:49 +00:00
Owen Anderson
d34ac6e782 Add support for extractvalue and insertvalue instructions in GVN.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52472 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 21:59:00 +00:00
Owen Anderson
b230372437 Add local PRE to GVN. This only operates in cases where it would not increase code size, namely when the instantiated expression
would only need to be created in one predecessor.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52471 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 21:41:49 +00:00
Argyrios Kyrtzidis
f7acf8f288 Fix the source line debug information for the Windows platform.
According to DWARF-2 specification, the line information is provided through an offset in the .debug_line section.
Replace the label reference that is used with a section offset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52468 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 19:27:37 +00:00
Chris Lattner
6c3bfba06e Fix the regressions on sext-misc.ll my patch yesterday caused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52466 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 18:11:55 +00:00
Owen Anderson
bb3761c9e5 Revert r52459, which was causing an infinite loop or massive slowdown on MultiSource/Applications/SPASS, and possibly others as well.
Please reapply once this is fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52465 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 17:32:16 +00:00
Dan Gohman
e24fa64d52 Move SCEVExpander::visitAddExpr out-of-line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52464 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 16:37:11 +00:00
Dan Gohman
cfeb6a4506 Move LSR's private isZero function to a public SCEV member
function, and make use of it in several places.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52463 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 16:23:07 +00:00
Matthijs Kooijman
ca85d65277 Rewrite the DeadArgumentElimination pass, to use a more explicit tracking of
dependencies between return values and/or arguments. Also make the handling of
arguments and return values the same.

The pass now looks properly inside returned structs, but only at the first                                                                                     
level (ie, not inside nested structs).

Also add a testcase for testing various variations of (multiple) dead rerturn
values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 11:12:53 +00:00
Matthijs Kooijman
c2afe89019 Reapply r52397 (make IPConstProp promote returned arguments), but fixed this
time. Sorry for the trouble!

This time, also add a testcase, which I should have done in the first place...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52455 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 08:30:37 +00:00
Evan Cheng
359e9371b9 XOR32rr, etc. are not AsCheapAsMove, but MOV32ri, etc. are.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52454 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 08:13:07 +00:00
Matthijs Kooijman
8b0fcf38ef Reapply r52396, it was unrelated to the breakage (that was caused by r52397, my
commit after this).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52453 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 08:09:27 +00:00
Evan Cheng
7543e58a77 Complete support for two-address pass rematerialization. Now *almost* always a win.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52452 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 07:49:14 +00:00
Evan Cheng
625986afea Cosmetic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52450 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 07:47:28 +00:00
Chris Lattner
0521e3cdc1 implement some simple bswap optimizations, rdar://5992453
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52442 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 04:33:20 +00:00
Chris Lattner
8114b718c9 make truncate/sext elimination capable of changing phi's. This
implements rdar://6013816 and the testcase in Transforms/InstCombine/sext-misc.ll.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52440 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 04:00:49 +00:00
Evan Cheng
fab8387384 Unbreak DECLARE isel in pic mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52439 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 02:48:27 +00:00
Devang Patel
64cd658223 Preserve dominance frontier while trivially unswitching loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52438 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18 02:16:38 +00:00
Dan Gohman
44f6a2c951 Auto-upgrade code for multiple-value return statements. This code
isn't actually called yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52435 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 23:38:43 +00:00
Dan Gohman
80b9626ee3 In InsertValueInst's copy ctor, actually copy the operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52434 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 23:25:49 +00:00
Owen Anderson
2960ed4b85 We don't want to find dependencies within the same block in this case. It leads to incorrect results because
we're detecting something at or after the call we're querying on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52433 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 22:27:06 +00:00
Dan Gohman
b79bf1966d Implement the ExtractValueInst::getIndexedType that accepts one
index value.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52432 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 21:07:55 +00:00
Evan Cheng
f26e8557de Live-through live interval is [mbb start, mbb end+1].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52431 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 20:13:36 +00:00
Evan Cheng
739583be56 When extending a liveinterval by commuting, don't throw away the live ranges that are not affected.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52430 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 20:11:16 +00:00
Ted Kremenek
8d6a58c5d5 Consistently set "Buckets[NumBuckets] = reinterpret_cast<void*>(-1)" throughout FoldingSet.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52425 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 19:12:43 +00:00
Owen Anderson
26bb50ab48 Add an insertBefore method for attaching previously unattached instructions,
such as those created by clone(), to a basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52424 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 18:29:27 +00:00
Evan Cheng
95350b9cd2 It's not safe to remove SUBREG_TO_REG that looks like identity copies, e.g. movl %eax, %eax on x86-64 actually does a zero-extend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52421 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 17:59:16 +00:00
Anton Korobeynikov
0b725f17e0 Add one more 'magic' define :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52420 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 17:57:43 +00:00
Anton Korobeynikov
7a17ff7b3f Unbreak non-PPC builds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 17:38:31 +00:00
Anton Korobeynikov
210539ebc4 Provide generic hooks for icache invalidation. Add PPC implementation.
Patch by Gary Benson!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52418 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 17:30:05 +00:00
Chris Lattner
fc329f4fa1 revert recent patch which is causing widespread breakage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52415 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 17:06:43 +00:00
Evan Cheng
1b088f3310 Don't forget to initialize SymbolSearchingDisabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52414 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 16:49:02 +00:00
Duncan Sands
34b176a181 Fix typo that changed the logic to something wrong.
Spotted by Nick Lewycky.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52411 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 15:55:30 +00:00
Duncan Sands
69b01e92a2 Split type expansion into ExpandInteger and ExpandFloat
rather than bundling them together.  Rename FloatToInt
to PromoteFloat (better, if not perfect).  Reorganize
files by types rather than by operations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52408 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 14:27:01 +00:00
Matthijs Kooijman
2fbabf6e6d Learn IPConstProp to propagate arguments that are directly returned. Strictly
speaking these are not constant values. However, when a function always returns
one of its arguments, then from the point of view of each caller the return
value is constant (or at least a known value) and can be replaced.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52397 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 12:20:24 +00:00