Commit Graph

24263 Commits

Author SHA1 Message Date
Evan Cheng
1bf9a18834 Rename instance variables, parameter argument names to eliminate a bunch of compilation warnings with -Wshadow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53970 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-24 00:08:56 +00:00
Owen Anderson
7fbad27cfb Enable the insertion of empty indices into LiveInterals, thereby making renumbering possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53961 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 21:37:49 +00:00
Owen Anderson
496bac5b08 Fix a compile-time regression introduced by my heuristic-changing patch. I forgot
to multiply the instruction count by a constant factor in a few places, which
caused the register allocator to require many more iterations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53959 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 19:47:27 +00:00
Dan Gohman
1a24539405 Use C99 aggregate literal syntax for first-class struct and array values.
This fixes several recent CBE regressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53958 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 18:41:03 +00:00
Bruno Cardoso Lopes
92e87f2379 Minor fixes.
Added ConstantPool support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53951 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 16:01:50 +00:00
Chris Lattner
967948b4e2 "Allow LICM to sink or lift loads from constant memory. Also add a test
case for this.

This allows instructions like loads from global variables declared to
be constant to be moved out of loops."

Patch by Stefanus Du Toit!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53945 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 05:06:28 +00:00
Dan Gohman
1a570244f0 Update the generated .cvs files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53943 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 00:54:54 +00:00
Dan Gohman
fc74abfba5 Enable first-class aggregates support.
Remove the GetResultInst instruction. It is still accepted in LLVM assembly
and bitcode, where it is now auto-upgraded to ExtractValueInst. Also, remove
support for return instructions with multiple values. These are auto-upgraded
to use InsertValueInst instructions.

The IRBuilder still accepts multiple-value returns, and auto-upgrades them
to InsertValueInst instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53941 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 00:34:11 +00:00
Evan Cheng
5e6ebaf4d1 Fix PR2485: do all 4-element SSE shuffles in max. of 2 shuffle instructions.
Based on patch by Nicolas Capens.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53939 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 00:22:17 +00:00
Duncan Sands
11e56cb4dc LegalizeTypes support for VSETCC. Fixes PR2575.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 23:54:03 +00:00
Owen Anderson
a1566f2e12 Change the heuristics used in the coalescer, register allocator, and within
live intervals itself to use an instruction count approximation that is 
not affected by inserting empty indices.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53937 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 22:46:49 +00:00
Evan Cheng
ace3c17798 Factor out SSE 4 wide shuffle lowering code into its own function. No functionality changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 21:13:36 +00:00
Evan Cheng
2925786765 Fix pr2566: incorrect assumption about bit_convert. It doesn't not have to output a vector value. Patch by Nicolas Capens!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53932 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 20:42:56 +00:00
Devang Patel
ce8fdf105c While creating temp. file on disk, if the current filename points to a existing directory then create new temp. file inside the directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53929 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 20:02:39 +00:00
Evan Cheng
52672b813e Fix PR2574: implement v2f32 scalar_to_vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53927 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 18:39:19 +00:00
Devang Patel
54ce536a2d Handle bitcode wrappers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 18:00:36 +00:00
Dan Gohman
694caf56f1 Make the GraphRoot edge look like a chain edge, which is more accurate,
and use the right result number, in the off chance that the graph root
has multiple result values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53923 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 17:52:59 +00:00
Anton Korobeynikov
04dda73926 Provide default implementation of different small-sections related stuff
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53920 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 17:09:59 +00:00
Anton Korobeynikov
0980980174 Tie small stuff to non-small by default on ELF platforms
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53919 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 17:09:41 +00:00
Bruno Cardoso Lopes
c92a0e90b7 simplified small section logic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53912 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 16:24:21 +00:00
Anton Korobeynikov
f88a6faf93 Fix encoding of atomic compare and swap for i64
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53911 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 16:22:48 +00:00
Bruno Cardoso Lopes
feb95cc7e3 Added small section asm emition logic for mips.
Fixed small bug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53908 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 15:34:27 +00:00
Bruno Cardoso Lopes
62d590cc8e Basic support for small sections
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53907 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 15:26:53 +00:00
Bill Wendling
829487e7c9 Remove another tab.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53904 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 08:54:38 +00:00
Bill Wendling
bbf2e06f73 More tab removals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53903 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 08:50:44 +00:00
Bill Wendling
c91d0b9bdd Another buildbot test commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53896 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 00:53:37 +00:00
Dan Gohman
62bdec0de3 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53894 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 00:52:04 +00:00
Dan Gohman
ceab39f0b7 Fix multiple-return-value-to-first-class-aggregates autoupgrade to
correctly handle the case where multiple-return-value constructs
were used to return one or zero values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53890 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 00:36:48 +00:00
Bill Wendling
4e97401e1f Trivial check-in to test buildbot. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53889 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 00:28:47 +00:00
Dan Gohman
e089160d10 InsertValue and ExtractValue constant expressions are always
folded. Remove code that handled the case where they aren't
folded, and remove bitcode reader/writer support for them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 23:30:30 +00:00
Dan Gohman
79acd2b51f Fix grammaros in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53884 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 22:38:59 +00:00
Dan Gohman
7375fbcbf2 Fix a bug in LSR's dead-PHI cleanup. If a PHI has a def-use chain that
leads into a cycle involving a different PHI, LSR got stuck running
around that cycle looking for the original PHI. To avoid this, keep
track of visited PHIs and stop searching if we see one more than once.
This fixes PR2570.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53879 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:45:02 +00:00
Dan Gohman
358033102f Enhance the GraphWriter support for edge destinations, and teach the
SelectionDAG graph writer to make use of them. Now, nodes with multiple
values are displayed as such, with incoming edges pointing to the
specific value they use.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53875 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:06:55 +00:00
Dan Gohman
2dbc167294 After early-lowering the FORMAL_ARGUMENTS node, delete it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53874 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 21:04:07 +00:00
Evan Cheng
a022bdfd99 Eliminate a compilation warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53873 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 20:02:45 +00:00
Dan Gohman
462dc7f496 Add titles to the various SelectionDAG viewGraph calls
that include useful information like the name of the
block being viewed and the current phase of compilation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53872 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 20:00:07 +00:00
Dan Gohman
80f3d46968 Fix uses of underscore-capital names.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53870 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 19:48:15 +00:00
Bruno Cardoso Lopes
91fd532eb9 Added initial support for small sections on Mips.
Added gp_rel relocations to support addressing small section contents.
Added command line to specify small section threshold in bytes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53869 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 18:52:34 +00:00
Dan Gohman
6116a73da4 Now that the MachineInstr leaks are fixed, enable leak checking
in the MachineInstr clone code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53868 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 18:47:29 +00:00
Anton Korobeynikov
9685506c4f Use better variable names
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53859 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 18:29:23 +00:00
Anton Korobeynikov
d493b043c4 Don't use larger alignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53857 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 18:25:17 +00:00
Duncan Sands
d038e04188 Add VerifyNode, a place to put sanity checks on
generic SDNode's (nodes with their own constructors
should do sanity checking in the constructor).  Add
sanity checks for BUILD_VECTOR and fix all the places
that were producing bogus BUILD_VECTORs, as found by
"make check".  My favorite is the BUILD_VECTOR with
only two operands that was being used to build a
vector with four elements!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53850 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 10:20:31 +00:00
Evan Cheng
41c0840583 Use movaps instead of movups to spill 16-byte vector values when default alignment is >= 16. This fixes some massive performance regressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53844 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 06:34:17 +00:00
Nick Lewycky
9e13cbc171 Revert r53812 -- premature. LegalizeTypes isn't actually on yet!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53816 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 04:03:00 +00:00
Nick Lewycky
2ceb40f3da Switch on the use of arbitrary precision integers in scalar evolution. This will
bail after 256-bits to avoid producing code that the backends can't handle.
Previously, we capped it at 64-bits, preferring to miscompile in those cases.

This change also reverts much of r52248 because the invariants the code was
expecting are now being met.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53812 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 02:51:31 +00:00
Wojciech Matyjewicz
8b82c49084 This header isn't necessary now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53811 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-20 17:35:32 +00:00
Wojciech Matyjewicz
de0f2382e4 Fix PR2088. Use modulo linear equation solver to compute loop iteration
count.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53810 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-20 15:55:14 +00:00
Bill Wendling
3180e20cda Fix for first part of PR2562. Generate the "pinsrw" instruction for inserts
into v4i16 vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53807 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-20 02:32:23 +00:00
Bill Wendling
fbbd701bbd Pull r53795 from Gaz into mainline:
If .loc and .file aren't used, always emit the "debug_line" section. This
requires at least one entry in the line matrix. So if there's nothing to emit
into the matrix, emit an end of matrix value anyway.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53803 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-20 00:11:19 +00:00
Anton Korobeynikov
badd8df972 Unbreak build: 'DarwinTargetAsmInfo' was already taken as PPC TAI flavour.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53801 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 21:44:57 +00:00
Duncan Sands
a7360f0178 Make sure custom lowering for LegalizeTypes
returns a node with the right number of
return values.  This fixes codegen of
Generic/cast-fp.ll, Generic/fp_to_int.ll
and PowerPC/multiple-return-values.ll
when using -march=ppc32 -mattr=+64bit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53794 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 16:26:02 +00:00
Anton Korobeynikov
055a76bb51 Use chars, where possible
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53791 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 13:16:32 +00:00
Anton Korobeynikov
ae408e6f1e Switch MIPS to new ELFTargetAsmInfo. Add few FIXMEs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53790 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 13:16:11 +00:00
Anton Korobeynikov
cff2ea06af Fix a FIXME :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53789 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 13:15:46 +00:00
Anton Korobeynikov
18f6ed9c29 Use generic ELFTargetAsmInfo and DarwinTargetAsmInfo for X86 code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53788 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 13:15:21 +00:00
Anton Korobeynikov
745e864eab Add TargetAsmInfo stuff for all darwin-based targets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53787 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 13:14:46 +00:00
Anton Korobeynikov
debe34bd8d Add TargetAsmInfo for all ELF-based targets
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53786 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 13:14:11 +00:00
Anton Korobeynikov
88bbf6941f Use aligned stack spills, where possible. This fixes PR2549.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53784 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 06:30:51 +00:00
Evan Cheng
1ed9922794 Fix a memory leak in LiveIntervalAnalysis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53779 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-19 00:37:25 +00:00
Duncan Sands
c3e26727c1 Softfloat support for FDIV. Patch by
Richard Pennington.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53773 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 21:18:48 +00:00
Duncan Sands
f8ac645c59 Eliminate unused variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53772 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 21:07:41 +00:00
Duncan Sands
6c4d8e3ee4 Supress a gcc-4.3 warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53771 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 21:06:02 +00:00
Duncan Sands
77926da196 Revert 53729, after waking up in the middle of
the night realising that it was wrong :)  I
think the reason the same type was being used
for the shufflevec of indices as for the actual
indices is so that if one of them needs splitting
then so does the other.  After my patch it might
be that the indices need splitting but not the
rest, yet there is no good way of handling that.
I think the right solution is to not have the
shufflevec be an operand at all: just have it
be the list of numbers it actually is, stored
as extra info in the node.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53768 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 20:12:05 +00:00
Dan Gohman
5a11abaf2c In the CBackend, use casts to force integer add, subtract, and
multiply to be done as unsigned, so that they have well defined
behavior on overflow. This fixes PR2408.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 18:43:12 +00:00
Dan Gohman
fa82857e41 Fix a LocalSpiller leak. This fixes tramp3d-v4.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53766 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 18:28:56 +00:00
Owen Anderson
e98c54c47c Make PRE actually handle critical edges (by splitting them). Confirmed that bootstrap passes with this change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53762 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 18:03:38 +00:00
Owen Anderson
cfa94198d5 Reapply r53735. My last patch fixed the failures Dan observed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53761 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 17:49:43 +00:00
Owen Anderson
3ecaf1b339 Add some checks that got lost in the shuffle. This fixes 464.h264ref.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53760 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 17:46:41 +00:00
Dan Gohman
79c23effe2 Revert r53735. It broke SPEC 464.h264ref.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53757 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 16:44:49 +00:00
Chris Lattner
0c141e6673 verify limits-fndefn.c from the GCC testsuite before the
heat death of the universe, fixing an O(N^2) problem in the
size of a basic block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53749 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18 05:23:39 +00:00
Dan Gohman
2c3f7ae384 Re-introduce LeakDetector support for MachineInstrs and MachineBasicBlocks.
Fix a leak that this turned up in LowerSubregs.cpp.
And, comment a leak in LiveIntervalAnalysis.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53746 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 23:49:46 +00:00
Dan Gohman
dc5f936bf8 When printing MemOperand nodes, only use print() for
PseudoSourceValue values, which never have names. Use getName()
for all other values, because we want to print just a short summary
of the value, not the entire instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53738 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 21:12:16 +00:00
Owen Anderson
f7d3ecf091 Use MergeBlockIntoPredecessor to simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53735 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 20:00:46 +00:00
Evan Cheng
76a4d58998 Subreg live interval valno may not have a corresponding def machineinstr since it's less precise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53734 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:48:53 +00:00
Owen Anderson
11f2ec8eb5 Make MergeBlockIntoPredecessor more aggressive when the same successor appears
more than once.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53731 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:42:29 +00:00
Owen Anderson
c2b856e5b4 Enable PRE. My last batch of changes fixed the miscompile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53730 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:41:00 +00:00
Duncan Sands
f1bb7f1d3e Use a legal type for elements of the vector_shuffle
mask.  These are just indices into the shuffled vector
so their type is unrelated to the type of the
shuffled elements (which is what was being used before).
This fixes vec_shuffle-11.ll when using LegalizeTypes.
What seems to have happened is that Dan's recent change
r53687, which corrected the result type of the shuffle,
somehow caused LegalizeTypes to notice that the mask
operand was a BUILD_VECTOR with a legal type but elements
of an illegal type (i64).  LegalizeTypes legalized this
by introducing a new BUILD_VECTOR of i32 and bitcasting
it to the old type.  But the mask operand is not supposed
to be a bitcast but a straight BUILD_VECTOR of constants,
causing a crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53729 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:28:41 +00:00
Dan Gohman
e8be6c6391 Add a new function, ReplaceAllUsesOfValuesWith, which handles bulk
replacement of multiple values. This is slightly more efficient
than doing multiple ReplaceAllUsesOfValueWith calls, and theoretically
could be optimized even further. However, an important property of this
new function is that it handles the case where the source value set and
destination value set overlap. This makes it feasible for isel to use
SelectNodeTo in many very common cases, which is advantageous because
SelectNodeTo avoids a temporary node and it doesn't require CSEMap
updates for users of values that don't change position.

Revamp MorphNodeTo, which is what does all the work of SelectNodeTo, to
handle operand lists more efficiently, and to correctly handle a number
of corner cases to which its new wider use exposes it.

This commit also includes a change to the encoding of post-isel opcodes
in SDNodes; now instead of being sandwiched between the target-independent
pre-isel opcodes and the target-dependent pre-isel opcodes, post-isel
opcodes are now represented as negative values. This makes it possible
to test if an opcode is pre-isel or post-isel without having to know
the size of the current target's post-isel instruction set.

These changes speed up llc overall by 3% and reduce memory usage by 10%
on the InstructionCombining.cpp testcase with -fast and -regalloc=local.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53728 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:10:17 +00:00
Duncan Sands
79ada108dd LegalizeTypes support for what seems to be the
only missing ppc long double operations: FNEG
and FP_EXTEND.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53723 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 17:35:14 +00:00
Nate Begeman
29681a5385 Remove unnecessary readme entry
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53722 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 17:21:14 +00:00
Duncan Sands
f00e74f4d6 Turn LegalizeTypes back off again for the moment:
it is breaking Darwin bootstrap due to missing
functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53721 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 17:06:03 +00:00
Nate Begeman
e99b255b5c Fix a typo in last commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53720 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 17:04:58 +00:00
Nate Begeman
30a0de94e7 SSE codegen for vsetcc nodes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53719 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 16:51:19 +00:00
Matthijs Kooijman
bc1f989e3c Make GlobalOpt preserve address spaces when scalar replacing aggregate globals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 11:59:53 +00:00
Chris Lattner
d137ab4783 Fix PR2553
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53715 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 06:07:20 +00:00
Mon P Wang
f595266b91 When lowering certain atomics, we need to copy the memoperand from the old
atomic operation to the new one.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53714 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 04:54:06 +00:00
Duncan Sands
b2ff885aae Factorize some code for determining which libcall to use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53713 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 02:36:29 +00:00
Evan Cheng
066fcf8628 Inliner tweak. Function calls should cost more than one instruction!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53712 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 01:31:49 +00:00
Owen Anderson
b31b06d04b Factor MergeBlockIntoPredecessor out into BasicBlockUtils.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53705 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 00:01:40 +00:00
Devang Patel
0d885d1661 Mark function used by asm block as used, otherwise optimizer may not see the use and may delete the function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 17:54:34 +00:00
Owen Anderson
5d0af038a7 There's no need to iterate block merging and PRE. In fact, iterating the latter
could cause problems for memdep when it breaks critical edges.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53691 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 17:52:31 +00:00
Scott Michel
5af8f0e67e Somehow, custom lowering of i64 multiplications got dropped along the way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53689 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 17:17:29 +00:00
Dan Gohman
2fbdf0e711 Fix the result type of X86's truncate to i8.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53688 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 16:20:48 +00:00
Dan Gohman
7a9a5af6a0 Fix the result type of a VECTOR_SHUFFLE+BIT_CONVERT dagcombine. This
was turned up by some new SelectionDAG assertion checks that I'm
working on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 16:13:58 +00:00
Duncan Sands
95db39a9de Add support for promoting and expanding AssertZext
and AssertSext.  Needed when passing huge integer
parameters with the zeroext or signext attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 16:03:07 +00:00
Dan Gohman
c0d6012b31 Fix a comment to say nonnegative instead of positive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53681 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 15:57:10 +00:00
Dan Gohman
c5e1f98fdf Add an assert to check for empty flags for MachineMemOperand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53680 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 15:56:42 +00:00
Matthijs Kooijman
780ae5e179 Redo InstCombiner::visitExtractValueInst. Instead of using the (complicate)
FindInsertedValue, it now performs a number of simple transformations that
should result in the same effect when applied iteratively.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53673 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 12:55:45 +00:00
Duncan Sands
05c397d52a Reorder methods alphabetically. No functionality change.
While this is not a wonderful organizing principle, it
does make it easy to find routines, and clear where to
insert new ones.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53672 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 11:41:33 +00:00
Duncan Sands
7f1d8aeef6 Turn on LegalizeTypes by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53671 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 11:36:51 +00:00
Matthijs Kooijman
dddc827125 Don't use ++idx_begin when I actually mean idx_begin + 1, especially since we
also use *idx_begin in the same expression, giving unpredictable results.

This fixes this bug: http://lists.cs.uiuc.edu/pipermail/llvmdev/2008-July/015877.html



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53670 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 10:47:35 +00:00
Evan Cheng
be8efa54b6 Fix PR2296. Do not transform x86_sse2_storel_dq into a full-width store.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53666 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 07:28:14 +00:00
Evan Cheng
817a6a9eaa x86-64 PIC JIT fixes: do not generate the extra load for external GV's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53661 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 01:34:02 +00:00
Evan Cheng
81fb5feede X86-64 PIC jump table values are different from x86-32 cases, they are dest - table base.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53660 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-16 01:33:08 +00:00
Dan Gohman
9c578eb223 TargetAsmInfo::SectionForGlobal showed up in a profile. Simplify it a little.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 18:37:51 +00:00
Dan Gohman
4093d83010 SelectionDAG::AssignNodeIds is unused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53636 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 18:29:32 +00:00
Dan Gohman
90a7b8fba6 Don't sort SDNodes by their addresses in SelectionDAG::dump. Instead,
just use the AllNodes order, which is at least relatively stable
across runs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 18:18:54 +00:00
Owen Anderson
2b4f7bbd49 Revert this, as it seems to still be broken.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53627 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 17:59:02 +00:00
Owen Anderson
b33f7cc7e6 Enable local PRE by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53616 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 16:28:23 +00:00
Owen Anderson
961edc8be6 Have GVN do a pre-pass over the CFG that folds away unconditional branches where possible. This allows local PRE to be more aggressive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53615 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 16:28:06 +00:00
Duncan Sands
295a7cddbd LegalizeTypes support for fabs on ppc long double.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53613 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 15:02:44 +00:00
Matthijs Kooijman
4f72368529 Allow deadargelim to change return types even though now values were dead. This
again canonicalizes {i32} into i32 and {} into void.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53610 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 14:42:31 +00:00
Matthijs Kooijman
d1d1de7f39 Revert r53606. It turns out that explicitely tracking the liveness of the
return value as a whole in deadargelim is really not needed now that we simply
rebuild the old return value and actually prevents some canonicalization from
taking place.

This revert stops deadargelim from changing {i32} into i32 for now, but I'll
fix that next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53609 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 14:39:36 +00:00
Matthijs Kooijman
eb32b453b3 Make deadargelim a bit less smart, so it doesn't choke on nested structs as
return values that are still (partially) live. Instead of updating all uses of
a call instruction after removing some elements, it now just rebuilds the
original struct (With undef gaps where the unused values were) and leaves it to
instcombine to clean this up.

The added testcase still fails currently, but this is due to instcombine which
isn't good enough yet. I will fix that part next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53608 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 14:03:10 +00:00
Matthijs Kooijman
9c9418d0f3 Don't use isa when we can reuse a previous dyn_cast.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53607 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 13:39:08 +00:00
Matthijs Kooijman
ddd1a79b6d Make DeadArgElim keep liveness of the return value as a whole in addition to
only the liveness of partial return values (for functions returning a struct).
This is more explicit to prevent unwanted changes in the return value. 

In particular, deadargelim now canonicalizes a function returning {i32} to
returning i32 and {} to void, if the struct returned is not used in its
entirety, but only the single element is used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53606 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 13:36:06 +00:00
Duncan Sands
c07e6e53f7 LegalizeTypes support for promotion of bswap.
In LegalizeDAG the value is zero-extended to
the new type before byte swapping.  It doesn't
matter how the extension is done since the new
bits are shifted off anyway after the swap, so
extend by any old rubbish bits.  This results
in the final assembler for the testcase being
one line shorter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53604 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 10:18:22 +00:00
Duncan Sands
8d56a6f4d8 LegalizeTypes support for promotion of SIGN_EXTEND_INREG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53603 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 10:14:24 +00:00
Duncan Sands
bf304c2065 Reorder the integer promotion methods alphabetically.
No change in functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53602 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 10:12:34 +00:00
Matthijs Kooijman
2bf5372d8a Let DAE keep a list of live functions, instead of simply marking all arguments
and return values live for those functions. This doesn't change anything yet,
but prepares for the coming commits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53601 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 09:11:16 +00:00
Matthijs Kooijman
3015652473 Split DAE::MarkLive into MarkLive and PropagateLiveness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53600 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 09:00:17 +00:00
Matthijs Kooijman
6cdd54b6f7 Pass around const RetOrArg references instead of copying values. Also, mark
RetOrArg::getDescription() as const.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53599 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 08:56:49 +00:00
Matthijs Kooijman
03016ca361 Simplify debug code by using RetOrArg::getDescription().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 08:53:36 +00:00
Matthijs Kooijman
0d1730a14c Fix indentation (intentionally left out of the previous commit).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53592 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 08:47:32 +00:00
Matthijs Kooijman
a3ec5d6ecc Move the deadargelim code for intrinsically alive functions into its own
method, to slightly simplify control flow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 08:45:12 +00:00
Mon P Wang
2920d2b7b6 Fixed potential bug if the source and target of a bit convert have different alignment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53590 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 05:28:34 +00:00
Nick Lewycky
8ae38e1516 Correct this inversion!
I swear that didn't show up in svn diff...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53587 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 03:47:44 +00:00
Nick Lewycky
86dae65baa Fix up comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53586 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 03:40:27 +00:00
Bruno Cardoso Lopes
b27cb55923 Fixed call stack alignment. Improved AsmPrinter alignment issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53585 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 02:03:36 +00:00
Dan Gohman
5e84368b26 Reapply 53476 and 53480, with a fix so that it properly updates
the BB member to the current basic block after emitting
instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53567 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 18:19:29 +00:00
Dan Gohman
3fea643fb4 Fix uninitialized use of the Changed variable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53564 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:55:01 +00:00
Dan Gohman
91d49f5ba1 Improve debug output for MemOperandSDNode. PseudoSourceValue nodes
don't have value names, so use print instead of getName() to get a
useful string.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53563 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:51:24 +00:00
Dan Gohman
2b062994a6 Fix edito in the PseudoSourceValue name list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53562 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:45:47 +00:00
Duncan Sands
189a2b32f8 I don't think BUILD_PAIR can have a vector result.
Remove support for this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53559 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:34:19 +00:00
Duncan Sands
a489be59ef Tighten up some checks. Fix FPOWI splitting for
non-power-of-two vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53558 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:33:37 +00:00
Chris Lattner
46868c07bb Reapply r53540, now with the matching header!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53557 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:32:59 +00:00
Duncan Sands
262e04b307 An INSERT_VECTOR_ELT can insert a larger value
than the vector element type.  Don't forget to
handle this when the insertion index is not a
constant.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53556 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:32:02 +00:00
Duncan Sands
8cc364c5cc According to the docs, it is possible to have an
extending load of a vector.  Handle this case when
splitting vector loads.  I'm not completely sure
what is supposed to happen, but I think it means
hi should be set to undef.  LegalizeDAG does not
consider this case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53555 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:27:46 +00:00
Duncan Sands
28c05ac995 There should be no extending loads or truncating
stores of one-element vectors.  Also, neaten the
handling of INSERT_VECTOR_ELT when the inserted
type is larger than the vector element type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53554 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:22:31 +00:00
Duncan Sands
d164ea2fb0 Ignore TargetConstant with an illegal type. These
are used for passing huge immediates in inline ASM
from the front-end straight down to the ASM writer.
Of course this is a hack, but it is simple, limited
in scope, works in practice, and is what LegalizeDAG
does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53553 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:15:45 +00:00
Bruno Cardoso Lopes
43d526d162 Added Subtarget support into RegisterInfo
Added HasABICall and HasAbsoluteCall (equivalent to gcc -mabicall and 
-mno-shared). HasAbsoluteCall is not implemented but HasABICall is the 
default for o32 ABI. Now, both should help into a more accurate 
relocation types implementation. 
Added IsLinux is needed to choose between asm directives.
Instruction name strings cleanup.
AsmPrinter improved.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53551 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 14:42:54 +00:00
Duncan Sands
91e1c32dd0 Revert r53540 - it does not compile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53549 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 07:59:28 +00:00
Chris Lattner
6157e383c4 Reimplement LinkFunctionProtos in terms of GetLinkageResult. This fixes
the second half of link-global-to-func.ll and causes some minor changes in
messages.

There are two TODOs here.  First, this causes a regression in 
2008-07-06-AliasWeakDest.ll, which is now failing (so I xfailed it).  Anton,
I would really appreciate it if you could take a look at this.  It should be
a matter of adding proper alias support to GetLinkageResult, and was probably
already a latent bug that would manifest with globals.

The second todo is to reimplement LinkAlias in the same pattern as 
function and global linking.  This should be pretty straight-forward for 
someone who knows aliases, but isn't a requirement for correctness.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53548 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 07:23:24 +00:00
Chris Lattner
ae1132d2b8 don't do any linkage, not even type resolution, of symbols that have
internal linkage.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53547 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 06:52:19 +00:00
Chris Lattner
d1ec48c641 implement linking of globals to functions, in one direction
(replacing a function with a global).  This is needed when building
llvm itself with LTO on darwin, because of the EXPLICIT_SYMBOL hack
in lib/system/DynamicLibrary.cpp.

Implementation of linking the other way will need to wait for a 
cleanup of LinkFunctionProtos.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 06:49:45 +00:00
Chris Lattner
0bb8757997 wrap long lines, remove some code from a non-assert build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53545 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 05:52:33 +00:00
Chris Lattner
bbedb0e408 Fix a bunch of bugs handling vector compare constant expressions, fixing
PR2317.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53544 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 05:17:31 +00:00
Chris Lattner
071aade5f0 Document and fix Constant::getVectorElements to return an empty vector
when presented with a constant expr.

If ConstantExpr::getV[IF]Cmp to work when ConstantFoldCompareInstruction
returns an undef or constant expr.  



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53541 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 05:10:41 +00:00
Chris Lattner
ac77bfdbd4 If a function calls setjmp, never inline it into other functions. This is
a hack around the fact that we don't represent the CFG correctly for sj/lj.
It fixes PR2486.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53540 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 00:46:56 +00:00
Chris Lattner
4238453135 simplify some code, shuffle and insertelt always return a vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53538 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 00:32:20 +00:00
Chris Lattner
10c5d36ca9 Add a note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53535 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 00:19:59 +00:00
Chris Lattner
fdb19e5887 Fix PR2506 by being a bit more careful about reverse fact propagation when
disproving a condition.  This actually compiles the existing testcase
(udiv_select_to_select_shift) to:

define i64 @test(i64 %X, i1 %Cond) {
entry:
	%divisor1.t = lshr i64 %X, 3		; <i64> [#uses=1]
	%quotient2 = lshr i64 %X, 3		; <i64> [#uses=1]
	%sum = add i64 %divisor1.t, %quotient2		; <i64> [#uses=1]
	ret i64 %sum
}

instead of:

define i64 @test(i64 %X, i1 %Cond) {
entry:
	%quotient1.v = select i1 %Cond, i64 3, i64 4		; <i64> [#uses=1]
	%quotient1 = lshr i64 %X, %quotient1.v		; <i64> [#uses=1]
	%quotient2 = lshr i64 %X, 3		; <i64> [#uses=1]
	%sum = add i64 %quotient1, %quotient2		; <i64> [#uses=1]
	ret i64 %sum
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53534 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 00:15:52 +00:00
Chris Lattner
093a438502 Fix mishandling of the infinite loop case when merging two blocks. This
fixes PR2540.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53533 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-13 22:23:11 +00:00
Chris Lattner
b824512b8d more refactoring. Use early exits instead of really complex logic.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53532 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-13 22:04:41 +00:00
Chris Lattner
eb388af89f improve comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53531 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-13 21:55:46 +00:00
Chris Lattner
867661ac8b factor another large hunk of code out into its own function.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53530 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-13 21:53:26 +00:00
Chris Lattner
3698909623 Final bit of simplification for FoldBranchToCommonDest.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53528 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-13 21:20:19 +00:00
Chris Lattner
70087f31f1 simplify logic a bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53527 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-13 21:15:11 +00:00
Chris Lattner
1347e87c7b Refactor some code out into its own helper function, getting rid of crazy multiline
conditionals and commenting the code better.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53526 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-13 21:12:01 +00:00
Nick Lewycky
59cff12f88 Stop creating extraneous smax/umax in SCEV. This removes a regression where we
started complicating many loops ('for' loops, in fact).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53508 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 07:41:32 +00:00
Nick Lewycky
3ac9e109b2 Enhance analysis of srem.
Remove dead code analyzing urem. 'urem' of power-of-2 is canonicalized to an
'and' instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 05:04:38 +00:00
Evan Cheng
5330192ab5 Implement llvm.atomic.cmp.swap.i32 on PPC. Patch by Gary Benson!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53505 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 02:23:19 +00:00
Evan Cheng
b9890ae3c3 Typos.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53504 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 02:22:07 +00:00
Evan Cheng
79a796c2b1 Fix PR2536: a nasty spiller bug. If a two-address instruction uses a register but the use portion of its live range is not part of its liveinterval, it must be defined by an implicit_def. In that case, do not spill the use. e.g.
8   %reg1024<def> = IMPLICIT_DEF
12  %reg1024<def> = INSERT_SUBREG %reg1024<kill>, %reg1025, 2

The live range [12, 14) are not part of the r1024 live interval since it's defined by an implicit def. It will not conflicts with live interval of r1025. Now suppose both registers are spilled, you can easily see a situation where both registers are reloaded before the INSERT_SUBREG and both target registers that would overlap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 01:56:02 +00:00
Evan Cheng
b5eec33dcd Back out 53476 and 53480 for now. Somehow they cause llc to miscompile 179.art.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 01:38:51 +00:00
Dan Gohman
cddc11e757 Add a utility function to MachineInstr for testing whether an instruction
has exactly one MachineMemOperand, and change some X86 lowering code to
make use of it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53498 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-12 00:10:52 +00:00
Dan Gohman
e6acf36dca Fix spelling of "hierarchy" in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53489 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 22:51:32 +00:00
Dan Gohman
a54cf17661 Include a frame index in the "fixed stack" pseudo source value
instead of using the frame index for the SVOffset, which was
inconsistent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53486 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 22:44:52 +00:00
Dan Gohman
5e76c3be73 Fix an obsolete top-level comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53481 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 22:39:58 +00:00
Dan Gohman
0f4012f475 Factor out debugging code into the common base class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53480 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 22:36:22 +00:00
Dan Gohman
dbe2a5a269 Add support for putting NamedRegionTimers in TimerGroups, and
use a timer group for the timers in SelectionDAGISel. Also,
Split scheduling out from emitting, to give each their own
timer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53476 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 21:54:34 +00:00
Dan Gohman
c418bf3dd5 Use find instead of lower_bound.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53474 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 20:58:19 +00:00
Chris Lattner
78d60458d5 add support for returning i128, PR2532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53472 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 20:53:00 +00:00
Dan Gohman
dc2fbddd9d Trim unnecessary #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53471 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 20:38:31 +00:00
Owen Anderson
c45996bf74 Don't call lookupNumber more than we have to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53470 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 20:05:13 +00:00
Duncan Sands
92e0834ac7 Remove an apparently useless routine: there should
be no need to split the result of a vector RET node,
since they are always already legal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53462 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 17:02:09 +00:00
Duncan Sands
ac6cecec18 It is pointless to turn a UINT_TO_FP into an
SINT_TO_FP libcall plus additional operations:
it might as well be a direct UINT_TO_FP libcall.
So only turn it into an SINT_TO_FP if the target
has special handling for SINT_TO_FP.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53461 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 17:00:14 +00:00
Duncan Sands
9bed0f58eb Add two missing SINT_TO_FP libcalls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53460 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 16:57:02 +00:00
Duncan Sands
edfba7e707 Port a shift-by-1 optimization from LegalizeDAG: it
was presumably added after the rest of the code was
copied to LegalizeTypes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 16:54:57 +00:00
Duncan Sands
dddc6291fb Add support for 128 bit shifts and 32 bit shifts
on 16 bit machines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53458 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 16:52:29 +00:00
Nick Lewycky
7d9843fc37 Document 'mask' in this calculation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53454 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 08:16:26 +00:00
Duncan Sands
569d8f7087 Align comments, colons and cases. Remove trailing
whitespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53453 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 07:37:30 +00:00
Nick Lewycky
1f26c188f8 Remove misleading constant from comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53452 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 07:36:19 +00:00
Nick Lewycky
4bf1e59819 Add another optimization from PR2330. Also catch some missing cases that are
similar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53451 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 07:20:53 +00:00
Bill Wendling
71ca353ae6 The frame address on an x86-64 box needs to be offset by -8, not -4.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53450 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 07:18:52 +00:00
Chris Lattner
d01bee7170 a missed optimization that Eli spotted
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53449 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 06:40:29 +00:00
Chris Lattner
f9685ac68e another bug in the same line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53448 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 06:38:16 +00:00
Chris Lattner
a8ff4a88bb fix a bug spotted by Eli's eagle eyes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53447 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 06:36:01 +00:00
Chris Lattner
183661e43a simplify and merge a bunch of code. Instead of comparing against
the min/max values for an integer type, compare against the min/max
values we can prove contain the input.  This might be a tighter bound,
so this is general goodness.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53446 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 05:40:05 +00:00
Chris Lattner
84dff672a4 fold away (x <= cst) earlier, allowing us to not have to
handle them in some code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53445 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 05:08:55 +00:00
Chris Lattner
85b5eb0505 Fix folding of icmp's of i1 where the comparison is signed. The code
was using the algorithm for folding unsigned comparisons which is
completely wrong.  This has been broken since the signless types change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53444 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 04:20:58 +00:00
Chris Lattner
f299184565 Fix a bogus optimization: folding (slt (zext i1 A to i32), 1) -> (slt i1 A, true)
This cause a regression in InstCombine/JavaCompare, which was doing the right
thing on accident.  To handle the missed case, generalize the comparisons based
on masked bits a little bit to handle comparisons against the max value. For 
example, we can now xform (slt i32 (and X, 4), 4) -> (setne i32 (and X, 4), 4)




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53443 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 04:09:09 +00:00
Chris Lattner
1913b94c11 regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53440 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 00:30:39 +00:00
Chris Lattner
d15990189d Implement PR2538
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53438 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11 00:30:06 +00:00
Chris Lattner
c563e1d8fe Fix a bug in the soft-float handling of FCOPYSIGN that Duncan noticed
when working on legalizetypes.  Both legalizetypes and legalizeops now
produce hte same code for CodeGen/ARM/fcopysign.ll.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53435 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 23:46:13 +00:00
Chris Lattner
70587ea813 make legalize types be a command line option: -enable-legalize-types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53434 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 23:37:50 +00:00
Dan Gohman
fdeb4b3f1d Make stack slot coloring's debug output more consistent with
other passes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53415 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 19:49:32 +00:00
Evan Cheng
bdb10fe0f6 Change StackSlotForVirtReg (which maps vregs to frame indices) from std::map to IndexedMap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53414 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 18:23:23 +00:00
Chris Lattner
6291d69c4c Remove extraneous vertical whitespace before Eric gets the wrong idea ;-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53411 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 16:49:53 +00:00
Chris Lattner
85e7ac0353 Fix an altivec constant miscompilation that Duncan found through
his work on legalizetypes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53410 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10 16:33:38 +00:00