Commit Graph

23772 Commits

Author SHA1 Message Date
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
Matthijs Kooijman
906e423724 Learn IPConstProp to look at individual return values and propagate them
individually.

Also learn IPConstProp how returning first class aggregates work, in addition
to old style multiple return instructions.

Modify the return-constants testscase to confirm this behaviour.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52396 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 12:02:52 +00:00
Matthijs Kooijman
3faf9df08f Use a SmallVector instead of an array, since auto_ptr doesn't handle arrays
properly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52390 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 08:24:37 +00:00
Chris Lattner
ead0d88ad7 add a new -enable-value-prop flag for llcbeta, that enables propagation
of value info (sign/zero ext info) from one MBB to another.  This doesn't
handle much right now because of two limitations:

1) only handles zext/sext, not random bit propagation (no assert exists 
   for this)
2) doesn't handle phis.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52383 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 06:09:18 +00:00
Duncan Sands
a47c6c3703 Fix spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52381 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 03:24:13 +00:00
Evan Cheng
851bc04533 Rather than avoiding to wrap ISD::DECLARE GV operand in X86ISD::Wrapper, simply handle it at dagisel time with x86 specific isel code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52377 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 02:01:22 +00:00
Chris Lattner
fc196f9ee9 Add a missing ~ (dtor became ctor) which caused crashes on a bunch of stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52374 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 23:06:51 +00:00
Evan Cheng
c3de802ad9 Do not issue identity copies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52373 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 22:52:53 +00:00
Dan Gohman
9b93dd1f1a Refine the change in r52258 for avoiding use-before-def conditions
when changing the stride of a comparison so that it's slightly
more precise, by having it scan the instruction list to determine
if there is a use of the condition after the point where the
condition will be inserted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52371 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 22:34:15 +00:00
Chris Lattner
d34ff14358 switch TypeHasCycleThroughItself from using an std::set to using a SmallPtrSet,
this speeds up the linking testcase in PR1860 by 44% (.379 -> 0.263)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52365 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 21:20:58 +00:00
Chris Lattner
a4477f9b31 stop making PATypeHolder's so crazily.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 21:17:12 +00:00
Evan Cheng
4e444436f2 Horizontal-add instructions are not commutative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52363 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 21:16:24 +00:00
Evan Cheng
72b7b098c7 Switch over to SetVector to ensure same order of iterations do not vary across runs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52361 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 21:08:17 +00:00
Chris Lattner
62a81a1eba use a real associative container for type association instead of using
a vector with a linear search.  This speeds up the linking testcase 
in PR1860 from 0.965s to 0.385s on my system.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52357 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 21:00:18 +00:00
Evan Cheng
35b9a7790e mpsadbw is commutable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52352 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 20:25:59 +00:00
Chris Lattner
56539659eb bail out sooner if we have two concrete but different types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52351 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 20:03:01 +00:00
Chris Lattner
9ddf2c898f simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52350 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 19:55:40 +00:00
Chris Lattner
849dcd928a Apply a patch from Nathan Keynes, which speeds up llvm-link on
the testcases in PR1860 from taking more than 1 hour (when I killed it)
to taking 1s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52347 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 19:48:08 +00:00
Owen Anderson
31ec841be1 Remove special case handling of empty MBBs now that we assign indices to them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52345 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 19:32:40 +00:00
Chris Lattner
f6f4f7a149 handle vectors. Any integers that got here would necessarily be different already.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52341 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 18:27:53 +00:00
Chris Lattner
bc1c82a0f7 Simplify ResolveTypes by pulling the null case out into the one
client that cares and simplifying its control flow.

Remove the DestST argument to ResolveTypes and RecursiveResolveTypes*
which are dead now.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52340 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 18:19:05 +00:00
Evan Cheng
69d5053f9c Iterating over SmallPtrSet is not deterministic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52339 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 18:17:09 +00:00
Chris Lattner
371ca83d8b simplify RecursiveResolveTypes and ResolveTypes by pulling the naming out of
ResolveTypes into the one place that needs it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52338 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 18:11:40 +00:00
Chris Lattner
e846db6675 Add a new flag that disables symbol lookup with dlsym when set. This allows
a JIT client to completely control symbol lookup with the LazyFunctionCreator
interface.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52335 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 17:44:14 +00:00
Chris Lattner
16228c08b4 Add support for icache invalidation on non-darwin ppc systems.
Patch by Gary Benson!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52332 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 17:04:06 +00:00
Owen Anderson
1fbb4545d4 Re-enable empty block indexing by default, since it doesn't seem to have any
impact on code quality or compile time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52329 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 16:58:24 +00:00
Matthijs Kooijman
0a9aaf46be Make BuildSubAggregate use FindInsertedElement again to prevent it from
inserting extractvalues. In particular, this prevents the insertion of
extractvalues that can't be folded away later. Also add an example of when this
stuff is needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52328 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 14:13:46 +00:00
Matthijs Kooijman
9772891219 Make the InsertBefore argument to FindInsertedValue optional, so you can find an inserted value without modifying the code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52319 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 13:28:31 +00:00
Matthijs Kooijman
0a7413dad8 Pass around Instruction* instead of Instruction& in FindInsertedValue and friends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52318 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 13:13:08 +00:00
Matthijs Kooijman
710eb236e6 80 column fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52316 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 12:57:37 +00:00
Matthijs Kooijman
b23d5adbc8 Move FindScalarValue from InstructionCombining.cpp to ValueTracking.cpp. While
I'm at it, rename it to FindInsertedValue.

The only functional change is that newly created instructions are no longer
added to instcombine's worklist, but that is not really necessary anyway (and
I'll commit some improvements next that will completely remove the need).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52315 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 12:48:21 +00:00
Argyrios Kyrtzidis
4bd3225088 Minor comment fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52312 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 10:14:09 +00:00
Duncan Sands
ad205a7687 Allow these transforms for types like i256 while
still excluding types like i1 (not byte sized)
and i120 (loading an i120 requires loading an i64,
an i32, an i16 and an i8, which is expensive). 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52310 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 08:14:38 +00:00
Evan Cheng
7a15391c8d Fix read after free found by valgrind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52309 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 07:34:17 +00:00
Evan Cheng
58dcb0e0cd Add option to commuteInstruction() which forces it to create a new (commuted) instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52308 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 07:33:11 +00:00
Owen Anderson
3557801289 Make indexing empty basic blocks an option for the moment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52306 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 07:10:49 +00:00
Chris Lattner
25df20f169 simplify some code by using a helper function. This really really
wants a 'nocapture' predicate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52304 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 06:38:26 +00:00
Chris Lattner
defa1c8034 move a bunch of predicates up into their own section
in this file, no other changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52303 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 06:30:22 +00:00
Chris Lattner
e7275794d3 Other parts of this code treat noalias arguments as objects for
the purposes of escape analysis.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52302 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 06:28:01 +00:00
Chris Lattner
845f0d2f0f If we are checking to see if the result of a call aliases a
pointer derived from a local allocation, if the local allocation
never escapes, the pointers can't alias.  This implements PR2436


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52301 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 06:19:11 +00:00
Owen Anderson
8892b6f307 Assign indices to empty basic blocks. This will be necessary for StrongPHIElimination in the near future.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52300 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 06:18:41 +00:00
Chris Lattner
a413960a48 Refactor basicaa's main alias function somethin' fierce.
This fixes several minor bugs (such as returning noalias
for comparisons between external weak functions an null) but
is mostly a cleanup.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52299 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 06:10:11 +00:00
Chris Lattner
9e4ff94ff7 Switch from generating the int128 typedefs based on targetdata to generating
them based on the end-compiler's capabilities.  This fixes PR2453


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52297 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 04:25:29 +00:00
Chris Lattner
077707ccc0 Fix the crash on SimplifyLibCalls/2005-05-20-sprintf-crash.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52295 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 04:10:21 +00:00
Chris Lattner
6520aa0f5e fix pr2460
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52294 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-16 04:02:40 +00:00
Duncan Sands
ec87aa87fe The transforms in visitEXTRACT_VECTOR_ELT are
not valid if the load is volatile.  Hopefully
all wrong DAG combiner transforms of volatile
loads and stores have now been caught.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52293 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-15 20:12:31 +00:00
Duncan Sands
7d0d846064 LegalizeTypes support for INSERT_VECTOR_ELT with
a non-constant index.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52292 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-15 20:00:14 +00:00
Wojciech Matyjewicz
8a08769bad Fix PR2434. When scanning for exising binary operator to reuse don't
take into account the instrucion pointed by InsertPt. Thanks to it, 
returning the new value of InsertPt to the InsertBinop() caller can be 
avoided. The bug was, actually, in visitAddRecExpr() method which wasn't 
correctly handling changes of InsertPt. There shouldn't be any 
performance regression, as -gvn pass (run after -indvars) removes any 
redundant binops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-15 19:07:39 +00:00
Wojciech Matyjewicz
93c534623c Add a missing semicolon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52290 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-15 18:02:47 +00:00
Argyrios Kyrtzidis
fc19988bcb Fix the sys::Path::getSuffix() implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52288 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-15 15:15:19 +00:00
Argyrios Kyrtzidis
f1844d2f58 Fix the environment block that is passed to the CreateProcess function.
This bug made llvm-ld unable to function with "-native" option, since the process that was used to call 'gcc' was crashing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52284 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-15 03:54:39 +00:00
Duncan Sands
184a876ee6 Remove a redundant AfterLegalize check. Turn
on some code when !AfterLegalize - but since
this whole code section is turned off by an
"if (0)" it's not really turning anything on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52276 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-14 17:48:34 +00:00
Wojciech Matyjewicz
5d2bc857ec Change 'while' loop to 'do' loop.
Add a safety measure. It isn't safe to assume in ScalarEvolutionExpander that
all loops are in canonical form (but it should be safe for loops that have
AddRecs).
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52275 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-14 16:48:22 +00:00
Andrew Lenharth
507a58ac9b add missing atomic intrinsic from gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52270 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-14 05:48:15 +00:00
Chris Lattner
c5dc660ea0 Fix a case where tailcallelim wouldn't set the changed bit when it made a change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52267 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-14 00:49:48 +00:00
Evan Cheng
87bb991aa8 Teach the spiller to commute instructions in order to fold a reload. This hits 410 times on 444.namd and 122 times on 252.eon.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52266 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 23:58:02 +00:00
Eli Friedman
6903a24f32 Don't skip over instructions other than loads that might read memory
when trying to sink stores.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52259 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 22:02:12 +00:00
Dan Gohman
e562b1725e Protect ChangeCompareStride from situations in which it is possible
for it to generate use-before-def IR, such as in this testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52258 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 21:43:41 +00:00
Eli Friedman
66fe80aa57 Make sure SimplifyStoreAtEndOfBlock doesn't mess with loops; the
structure checks are incorrect if the blocks aren't distinct.
Fixes PR2435.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 21:17:49 +00:00
Duncan Sands
d4b9c17fb7 Disable some DAG combiner optimizations that may be
wrong for volatile loads and stores.  In fact this
is almost all of them!  There are three types of
problems: (1) it is wrong to change the width of
a volatile memory access.  These may be used to
do memory mapped i/o, in which case a load can have
an effect even if the result is not used.  Consider
loading an i32 but only using the lower 8 bits.  It
is wrong to change this into a load of an i8, because
you are no longer tickling the other three bytes.  It
is also unwise to make a load/store wider.  For
example, changing an i16 load into an i32 load is
wrong no matter how aligned things are, since the
fact of loading an additional 2 bytes can have
i/o side-effects.  (2) it is wrong to change the
number of volatile load/stores: they may be counted
by the hardware.  (3) it is wrong to change a volatile
load/store that requires one memory access into one
that requires several.  For example on x86-32, you
can store a double in one processor operation, but to
store an i64 requires two (two i32 stores).  In a
multi-threaded program you may want to bitcast an i64
to a double and store as a double because that will
occur atomically, and be indivisible to other threads.
So it would be wrong to convert the store-of-double
into a store of an i64, because this will become two
i32 stores - no longer atomic.  My policy here is
to say that the number of processor operations for
an illegal operation is undefined.  So it is alright
to change a store of an i64 (requires at least two
stores; but could be validly lowered to memcpy for
example) into a store of double (one processor op).
In short, if the new store is legal and has the same
size then I say that the transform is ok.  It would
also be possible to say that transforms are always
ok if before they were illegal, whether after they
are illegal or not, but that's more awkward to do
and I doubt it buys us anything much.
However this exposed an interesting thing - on x86-32
a store of i64 is considered legal!  That is because
operations are marked legal by default, regardless of
whether the type is legal or not.  In some ways this
is clever: before type legalization this means that
operations on illegal types are considered legal;
after type legalization there are no illegal types
so now operations are only legal if they really are.
But I consider this to be too cunning for mere mortals.
Better to do things explicitly by testing AfterLegalize.
So I have changed things so that operations with illegal
types are considered illegal - indeed they can never
map to a machine operation.  However this means that
the DAG combiner is more conservative because before
it was "accidentally" performing transforms where the
type was illegal because the operation was nonetheless
marked legal.  So in a few such places I added a check
on AfterLegalize, which I suppose was actually just
forgotten before.  This causes the DAG combiner to do
slightly more than it used to, which resulted in the X86
backend blowing up because it got a slightly surprising
node it wasn't expecting, so I tweaked it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52254 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 19:07:40 +00:00
Wojciech Matyjewicz
900872186d Use recently added getTruncateOrZeroExtend method to make the code shorter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 17:02:03 +00:00
Nick Lewycky
6f8abf929a Crash less. The i64 restriction in BinomialCoefficient caused some problems
with code that was expecting different bit widths for different values.

Make getTruncateOrZeroExtend a method on ScalarEvolution, and use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52248 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-13 04:38:55 +00:00
Gabor Greif
52ed363fd3 fix a minor deviation from the original in my previous commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52247 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 21:51:29 +00:00
Gabor Greif
177dd3ff11 op_iterator-ify some loops, low hanging fruit only, there is more
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52246 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 21:37:33 +00:00
Evan Cheng
502a4f5162 Do not speculatively execute an instruction by hoisting it to its predecessor BB if any of its operands are defined but not used in BB. The transformation will prevent the operand from being sunk into the use block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52244 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 21:15:59 +00:00
Evan Cheng
0d0ca8572f Revert 52223.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52243 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 20:55:39 +00:00
Owen Anderson
af4240ac2d Switch GVN to use ScopedHashTable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52242 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 19:25:32 +00:00
Matthijs Kooijman
cf45ca0408 Fix redirection of stderr in sys::Program::ExecuteAndWait. There was logic
error that caused it to redirect stderr to stdout too often.

This fix is applied identically to the win32 code as well, but that is
untested.
--Thi line, and those below, will be ignored--

M    System/Unix/Program.inc
M    System/Win32/Program.inc


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52233 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 12:53:35 +00:00
Matthijs Kooijman
905261efed Make I/O redirection handling in sys::Program a bit more consistent. No
functional changes. Win32 code is untested, but should work fine.

In the unix variant, rename RedirectFD to RedirectIO and let that function
handle empty and null paths instead of doing that in the caller 3 times. This
is the same as win32 already does it.

In the win32 variant, use Path::isEmpty() instead of checking the resulting
c_str() manually. This is the same as unix already does it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52230 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 10:47:18 +00:00
Gabor Greif
6725cb5f1c op_iterator-ify some loops, fix 80col violations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52226 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 21:38:51 +00:00
Anton Korobeynikov
096b461b2e Properly lower DYNAMIC_STACKALLOC - bracket all black magic with
CALLSEQ_BEGIN & CALLSEQ_END.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52225 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 20:16:42 +00:00
Evan Cheng
797d95188d For now, avoid generating FP select instructions in order to speculatively execute integer arithmetic instructions. FP selects are more likely to be expensive (even compared to branch on fcmp). This is not a wonderful solution but I rather err on the side of conservative.
This fixes the heapsort performance regressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52224 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 19:18:20 +00:00
Evan Cheng
bb318c073e Avoid duplicating loop header which leads to unnatural loops (and just seem like general badness to me, likely to cause code explosion).
Patch by Florian Brandner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52223 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 19:07:54 +00:00
Matthijs Kooijman
a9012eca1a Teach instruction combining about the extractvalue. It can succesfully fold
useless insert-extract chains, similar to how it folds them for vectors.

Add a testcase for this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52217 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 14:05:05 +00:00
Duncan Sands
edfcf598fa Sometimes (rarely) nodes held in LegalizeTypes
maps can be deleted.  This happens when RAUW
replaces a node N with another equivalent node
E, deleting the first node.  Solve this by
adding (N, E) to ReplacedNodes, which is already
used to remap nodes to replacements.  This means
that deleted nodes are being allowed in maps,
which can be delicate: the memory may be reused
for a new node which might get confused with the
old deleted node pointer hanging around in the
maps, so detect this and flush out maps if it
occurs (ExpungeNode).  The expunging operation
is expensive, however it never occurs during
a llvm-gcc bootstrap or anywhere in the nightly
testsuite.  It occurs three times in "make check":
Alpha/illegal-element-type.ll,
PowerPC/illegal-element-type.ll and
X86/mmx-shift.ll.  If expunging proves to be too
expensive then there are other more complicated
ways of solving the problem.
In the normal case this patch adds the overhead
of a few more map lookups, which is hopefully
negligable.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52214 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 11:42:12 +00:00
Gordon Henriksen
a068fd32e2 Better test for availability of __gnu_cxx::stdio_filebuf.
If this doesn't work, I'll write a configure test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52213 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 10:46:24 +00:00
Matthijs Kooijman
b4d6a5a76c Clarify a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52212 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-11 09:00:12 +00:00
Gabor Greif
f7ea3638e0 op_iterator-ify loops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52191 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-10 22:03:26 +00:00
Dan Gohman
9ea3f56d07 Teach isGAPlusOffset to respect a GlobalAddressSDNode's offset
value, which is something that apparently isn't used much.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52158 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 22:05:52 +00:00
Dan Gohman
7dc1def162 Re-apply 52002, allowing the verifier to accept non-MRV struct return
types on functions, with adjustments so that it accepts both
new-style aggregate returns and old-style MRV returns, including those
with only a single member.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52157 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 21:26:13 +00:00
Dan Gohman
f5025cfa68 CodeGen support for aggregate-value function arguments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52156 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 21:19:23 +00:00
Duncan Sands
893076354a Various tweaks related to apint codegen. No functionality
change for non-funky-sized integers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52151 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 15:48:25 +00:00
Dan Gohman
8a6ccb5f73 Handle empty aggregate values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52150 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 15:21:47 +00:00
Dan Gohman
f910eaaddd AsmParser support for immediate constant aggregate values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52149 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 14:45:02 +00:00
Dan Gohman
75146a6725 CPPBackend support for extractvalue and insertvalue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52147 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 14:12:10 +00:00
Dan Gohman
26825a84e9 Abort on an unrecognized opcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52146 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 14:09:13 +00:00
Dan Gohman
e8e3b5585a Update the CPP backend for the ConstantFP::get API change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52144 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 14:08:11 +00:00
Duncan Sands
8eab8a2798 Remove some DAG combiner assumptions about sizes
of integer types.  Fix the isMask APInt method to
actually work (hopefully) rather than crashing
because it adds apints of different bitwidths.
It looks like isShiftedMask is also broken, but
I'm leaving that one to the APInt people (it is
not used anywhere).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52142 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 11:32:28 +00:00
Rafael Espindola
d674b4e87d add support for PIC on linux x86-64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52139 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 09:52:31 +00:00
Chris Lattner
313f0e63f7 lower calls to abs to inline code, PR2337
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52138 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 08:26:51 +00:00
Chris Lattner
18d73c206e Fix PR2411, where ip constant prop would propagate the
result of a weak function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52137 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 07:58:07 +00:00
Chris Lattner
822143e6f7 use 'continue' to make the function linker simpler. When linking a strong
function into a weak function, zap the weak function body so that the
strong one overrides it.  This fixes PR2410


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52135 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 07:47:34 +00:00
Chris Lattner
8246849829 minor changes to short circuit the 'no linkage' case earlier for
function bodies.  We now don't try to unify types or handling type
mismatches if when linking an internal foo to an external foo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52134 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 07:36:11 +00:00
Chris Lattner
bc3d1c7e4c simplify function visibility handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52133 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-09 07:25:28 +00:00
Duncan Sands
8e4eb09b1e Remove comparison methods for MVT. The main cause
of apint codegen failure is the DAG combiner doing
the wrong thing because it was comparing MVT's using
< rather than comparing the number of bits.  Removing
the < method makes this mistake impossible to commit.
Instead, add helper methods for comparing bits and use
them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52098 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 20:54:56 +00:00
Chris Lattner
7d8ab4efbc Limit the icmp+phi merging optimization to the cases where it is profitable:
don't make i1 phis when it won't be possible to eliminate them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52097 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 20:52:11 +00:00
Bruno Cardoso Lopes
e90ea5e81f Added FP instruction formats.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52086 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 01:39:36 +00:00
Bill Wendling
a8a8f427d6 Temporarily reverting r52056. It's causing PPC to fail to bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52085 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-08 01:36:24 +00:00
Bruno Cardoso Lopes
dfac7cb306 Added support for FP Registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52079 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 21:32:41 +00:00
Evan Cheng
4d09efd7b8 Speculatively execute a block when the the block is the then part of a triangle shape and it contains a single, side effect free, cheap instruction. The branch is eliminated by adding a select instruction. i.e.
Turn                                                                                                                                                                                                       
BB:                                                                                                                                                                                                        
    %t1 = icmp                                                                                                                                                                                             
    br i1 %t1, label %BB1, label %BB2                                                                                                                                                                      
BB1:                                                                                                                                                                                                       
    %t3 = add %t2, c                                                                                                                                                                                       
    br label BB2                                                                                                                                                                                           
BB2:                                                                                                                                                                                                       
=>                                                                                                                                                                                                         
BB:                                                                                                                                                                                                        
    %t1 = icmp                                                                                                                                                                                             
    %t4 = add %t2, c                                                                                                                                                                                       
    %t3 = select i1 %t1, %t2, %t3


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52073 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 08:52:29 +00:00
Evan Cheng
3e3aa86b68 Revert r52046. It broke cbe on x86 / Mac OS X.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52071 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 07:50:29 +00:00
Dan Gohman
1d685a46bf CodeGen support for insertvalue and extractvalue, and for loads and
stores of aggregate values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52069 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 02:02:36 +00:00
Owen Anderson
2d389e8ad7 Connect successors before creating the DAG node for the branch. This has
no visible functionality change, but enables a future patch where node creation
will update the CFG if it decides to create an unconditional rather than a conditional branch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52067 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-07 00:00:23 +00:00
Gabor Greif
76aca6f38f get rid of ExtractValueInst::init's Value argument, it is already passed to the UnaryInstruction ctor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52064 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 21:06:32 +00:00
Evan Cheng
929b39f0a0 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52062 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 21:00:10 +00:00
Gabor Greif
d4f268bdd4 make ExtractValueInst derived from UnaryInstruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52061 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 20:28:12 +00:00
Evan Cheng
877333b99d Enable stack coloring by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 19:52:44 +00:00
Evan Cheng
6b4a65f4e7 PPC preferred loop alignment is 16.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 19:50:46 +00:00
Devang Patel
4c37c07ee3 LoopSimplify preserves AA.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52053 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 17:50:58 +00:00
Devang Patel
8fb6a94b69 Print debug message only if there are dead passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52052 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 17:50:36 +00:00
Anton Korobeynikov
001c73e3a1 Handle assembler identifiers specially in CBE. This fixes PR2418.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52046 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 16:08:26 +00:00
Duncan Sands
3b3adbb745 Tighten up the abstraction slightly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52045 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 12:49:32 +00:00
Duncan Sands
83ec4b6711 Wrap MVT::ValueType in a struct to get type safety
and better control the abstraction.  Rename the type
to MVT.  To update out-of-tree patches, the main
thing to do is to rename MVT::ValueType to MVT, and
rewrite expressions like MVT::getSizeInBits(VT) in
the form VT.getSizeInBits().  Use VT.getSimpleVT()
to extract a MVT::SimpleValueType for use in switch
statements (you will get an assert failure if VT is
an extended value type - these shouldn't exist after
type legalization).
This results in a small speedup of codegen and no
new testsuite failures (x86-64 linux).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52044 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 12:08:01 +00:00
Zhou Sheng
cc41940dff As Chris suggested, handle the situation if ShAmt larger than BitWidth,
otherwise, opt might crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52041 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 08:32:05 +00:00
Evan Cheng
9c3c221364 Refine stack slot interval weight computation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52040 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 07:54:39 +00:00
Anton Korobeynikov
b0a882f540 Turn stdout into binary mode during bitcode emission.
This is necessary on windows targets, since stdout is in text mode there.
Patch by Julien Lerouge!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52038 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 07:24:01 +00:00
Anton Korobeynikov
232a4ab77a Provide hooks for libgcc symbols' address resolution inside lli on mingw32.
Patch by Julien Lerouge!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52037 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 07:20:07 +00:00
Bruno Cardoso Lopes
0af5e095ad Added custom isel for MUL, SDIVREM, UDIVREM, SMUL_LOHI and UMUL_LOHI nodes
MUL is not anymore directly matched because its a pseudoinstruction.
LogicI class fixed to zero-extend immediates. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52036 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 06:37:31 +00:00
Bruno Cardoso Lopes
07cec75913 Added custom SELECT_CC lowering
Added special isel for ADDE,SUBE and new patterns to match SUBC,ADDC


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52031 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-06 00:58:26 +00:00
Dan Gohman
836bfcd689 Revert 52002.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52030 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 23:57:06 +00:00
Chris Lattner
5c490610a1 Expose a public interface to this pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52029 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 23:45:18 +00:00
Chris Lattner
15ccbf59a9 Let libcall semantics decide whether it knows about functions
with definitions or not.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52028 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 23:38:34 +00:00
Evan Cheng
1b022cf688 Don't break strict aliasing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52026 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 22:59:21 +00:00
Owen Anderson
417dc2f595 Remove debugging code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52016 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 18:43:34 +00:00
Owen Anderson
a9efb264b0 Use the newly created helper on LiveIntervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52013 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 17:22:53 +00:00
Owen Anderson
c4dc132c8a Add a helper for constructing new live ranges that ended from an instruction to the end of its MBB.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52012 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 17:15:43 +00:00
Zhou Sheng
17183ab973 If BitWidth equals to ShtAmt, the RHSKnownZero[BitWidth-ShiftAmt-1] will
crash the opt. Just fix this.

Test case in llvm/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52003 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 14:23:44 +00:00
Matthijs Kooijman
411e6a5efb Change the Verifier to support returning first class aggregrates.
Add a testcase for functions returning first class aggregrates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52002 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 14:00:36 +00:00
Zhou Sheng
bfde7d6b9e As comments said, for negative value, the arithmetic
over-shift-right should return -1. So here it should be signed-extended,
when bitwidth larger than 64.

test case: llvm/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51999 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 13:27:38 +00:00
Matthijs Kooijman
02518140ac Learn ScalarReplAggregrates how stores and loads of first class aggregrates
work and how to replace them into individual values. Also, when trying to
replace an aggregrate that is used by load or store with a single (large)
integer, don't crash (but don't replace the aggregrate either).

Also adds a testcase for both structs and arrays.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51997 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 12:51:53 +00:00
Matthijs Kooijman
47c6fd7317 Let StructRetPromotion check if all if its users are really calls or invokesn,
not other instructions. This fixes a crash with the added testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51992 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 08:57:20 +00:00
Matthijs Kooijman
257da0a7fc Let StructRetPromotion check if it's users are really calling it and not
passing its pointer. Fixes test with added testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51991 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-05 08:48:32 +00:00