Commit Graph

24194 Commits

Author SHA1 Message Date
Owen Anderson c7d53fd331 Make the remapping of interval indices (particularly ending indices) more robust.
This is tricky business, and will probably take a few more iterations to get
the last kinks out of it.

llvm-svn: 54043
2008-07-25 19:50:48 +00:00
Nate Begeman 283b2da27a Disable mov{L, LP, HP, HLP, *DUP} shuffles for mmx
mmx needs its own fancy shuffle logic based on unpack; for now we get correct but awful code.

Also commit Mon Ping's VSETCC patch

llvm-svn: 54039
2008-07-25 19:05:58 +00:00
Nate Begeman 098cc6f22c Remove unnecessary implicit argument
llvm-svn: 54031
2008-07-25 17:56:27 +00:00
Nate Begeman c96e2e4968 Fix minor issues with VICmp/VFCmp constant expressions
llvm-svn: 54030
2008-07-25 17:35:37 +00:00
Nate Begeman 6559ada908 Fit in 80 cols
llvm-svn: 54029
2008-07-25 17:34:41 +00:00
Nate Begeman fd7b2be8e3 Allow verifier to be run on partially materialized modules.
llvm-svn: 54028
2008-07-25 17:28:23 +00:00
Nate Begeman 628ab8c673 Remove dead PatLeaf; there are a number of issues around MMX movl that need to be fixed.
llvm-svn: 54026
2008-07-25 17:25:04 +00:00
Nate Begeman 8a4afd921e Tab removal
llvm-svn: 54025
2008-07-25 17:24:13 +00:00
Dan Gohman 394ec3ab5a Disable the new aggressive remat logic introduced in 54000; it causes some
regressions, such as PR2595. Also, there is a significant code-quality
issue in SPEC 464.h264ref and a few others.

llvm-svn: 54014
2008-07-25 15:08:37 +00:00
Mon P Wang 7334350d31 When splitting a vector shuffle, fixed which type we used for the hi part
llvm-svn: 54007
2008-07-25 01:30:26 +00:00
Evan Cheng c90a11256e Teach ARM isLegalAddressingMode to handle unknown type without crashing. This fixes pr2589.
llvm-svn: 54004
2008-07-25 00:55:17 +00:00
Dan Gohman 9268601d8a Use AliasAnalysis::pointsToConstantMemory in SDISel to avoid unnecessary
dependencies with constant load nodes. This allows them to be scheduled
freely.

llvm-svn: 54001
2008-07-25 00:04:14 +00:00
Dan Gohman 09b0448dbc Enable rematerialization of constants using AliasAnalysis::pointsToConstantMemory,
and knowledge of PseudoSourceValues. This unfortunately isn't sufficient to allow
constants to be rematerialized in PIC mode -- the extra indirection is a
complication.

llvm-svn: 54000
2008-07-25 00:02:30 +00:00
Dan Gohman 5f36a32e7b Put the LICM of constant GlobalVariables, introduced in r53945, under a
command-line option, and disable it by default. It introduced performance
regressions because CodeGen is currently not able to remat such loads.

llvm-svn: 53997
2008-07-24 23:57:25 +00:00
Dan Gohman f29c5279e9 Avoid emitting casts in static initializer contexts. This fixes
large numbers of CBE regressions caused by r53958.

llvm-svn: 53990
2008-07-24 17:57:48 +00:00
Owen Anderson 79b66966b8 Store the predecessor MBB in the PHIUnion, rather than an index, since the indices will change after renumbering.
llvm-svn: 53985
2008-07-24 17:12:16 +00:00
Evan Cheng 0f0aee213f Fix a catastrophic PPC64 ABI bug: i32 operands which are passed in memory (all of the parameter registers are used) are loaded from sp offsets that were off by 4.
llvm-svn: 53979
2008-07-24 08:17:07 +00:00
Devang Patel cbfc1a4737 Create temp. file in current path.
llvm-svn: 53973
2008-07-24 00:35:38 +00:00
Evan Cheng a05c07eb62 Rename instance variables, parameter argument names to eliminate a bunch of compilation warnings with -Wshadow.
llvm-svn: 53970
2008-07-24 00:08:56 +00:00
Owen Anderson 50d393a68d Enable the insertion of empty indices into LiveInterals, thereby making renumbering possible.
llvm-svn: 53961
2008-07-23 21:37:49 +00:00
Owen Anderson 7c800ad977 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.

llvm-svn: 53959
2008-07-23 19:47:27 +00:00
Dan Gohman ae187c6eba Use C99 aggregate literal syntax for first-class struct and array values.
This fixes several recent CBE regressions.

llvm-svn: 53958
2008-07-23 18:41:03 +00:00
Bruno Cardoso Lopes fdb4cec2fe Minor fixes.
Added ConstantPool support.

llvm-svn: 53951
2008-07-23 16:01:50 +00:00
Chris Lattner 8a8fb908dc "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!

llvm-svn: 53945
2008-07-23 05:06:28 +00:00
Dan Gohman 16a84c6e2d Update the generated .cvs files.
llvm-svn: 53943
2008-07-23 00:54:54 +00:00
Dan Gohman fa1211f69b 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.

llvm-svn: 53941
2008-07-23 00:34:11 +00:00
Evan Cheng a2b4b4ad99 Fix PR2485: do all 4-element SSE shuffles in max. of 2 shuffle instructions.
Based on patch by Nicolas Capens.

llvm-svn: 53939
2008-07-23 00:22:17 +00:00
Duncan Sands 775e509525 LegalizeTypes support for VSETCC. Fixes PR2575.
llvm-svn: 53938
2008-07-22 23:54:03 +00:00
Owen Anderson 029182f3a3 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.

llvm-svn: 53937
2008-07-22 22:46:49 +00:00
Evan Cheng 0c23ed6364 Factor out SSE 4 wide shuffle lowering code into its own function. No functionality changes.
llvm-svn: 53933
2008-07-22 21:13:36 +00:00
Evan Cheng b8ff223f26 Fix pr2566: incorrect assumption about bit_convert. It doesn't not have to output a vector value. Patch by Nicolas Capens!
llvm-svn: 53932
2008-07-22 20:42:56 +00:00
Devang Patel c5552c44a0 While creating temp. file on disk, if the current filename points to a existing directory then create new temp. file inside the directory.
llvm-svn: 53929
2008-07-22 20:02:39 +00:00
Evan Cheng 0384670141 Fix PR2574: implement v2f32 scalar_to_vector.
llvm-svn: 53927
2008-07-22 18:39:19 +00:00
Devang Patel bd06440440 Handle bitcode wrappers.
llvm-svn: 53924
2008-07-22 18:00:36 +00:00
Dan Gohman 57c749294c 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.

llvm-svn: 53923
2008-07-22 17:52:59 +00:00
Anton Korobeynikov 4fdeb9b2d3 Provide default implementation of different small-sections related stuff
llvm-svn: 53920
2008-07-22 17:09:59 +00:00
Anton Korobeynikov 4a4484ee97 Tie small stuff to non-small by default on ELF platforms
llvm-svn: 53919
2008-07-22 17:09:41 +00:00
Bruno Cardoso Lopes 19b7f815a0 simplified small section logic
llvm-svn: 53912
2008-07-22 16:24:21 +00:00
Anton Korobeynikov 2d29ee06cd Fix encoding of atomic compare and swap for i64
llvm-svn: 53911
2008-07-22 16:22:48 +00:00
Bruno Cardoso Lopes a380798988 Added small section asm emition logic for mips.
Fixed small bug.

llvm-svn: 53908
2008-07-22 15:34:27 +00:00
Bruno Cardoso Lopes 9cfd2f8e57 Basic support for small sections
llvm-svn: 53907
2008-07-22 15:26:53 +00:00
Bill Wendling a6ac974bd1 Remove another tab.
llvm-svn: 53904
2008-07-22 08:54:38 +00:00
Bill Wendling b83a9ee320 More tab removals.
llvm-svn: 53903
2008-07-22 08:50:44 +00:00
Bill Wendling 9fe8b29012 Another buildbot test commit.
llvm-svn: 53896
2008-07-22 00:53:37 +00:00
Dan Gohman e343021fbd Fix a typo in a comment.
llvm-svn: 53894
2008-07-22 00:52:04 +00:00
Dan Gohman cf971f0513 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.

llvm-svn: 53890
2008-07-22 00:36:48 +00:00
Bill Wendling d07cee2e5c Trivial check-in to test buildbot. No functionality change.
llvm-svn: 53889
2008-07-22 00:28:47 +00:00
Dan Gohman d5d24f63fd 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.

llvm-svn: 53887
2008-07-21 23:30:30 +00:00
Dan Gohman ebeccb44cf Fix grammaros in comments.
llvm-svn: 53884
2008-07-21 22:38:59 +00:00
Dan Gohman 7ad3cd8c9d 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.

llvm-svn: 53879
2008-07-21 21:45:02 +00:00
Dan Gohman f1dc362547 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.

llvm-svn: 53875
2008-07-21 21:06:55 +00:00
Dan Gohman a6191cde79 After early-lowering the FORMAL_ARGUMENTS node, delete it.
llvm-svn: 53874
2008-07-21 21:04:07 +00:00
Evan Cheng fa374ca223 Eliminate a compilation warning.
llvm-svn: 53873
2008-07-21 20:02:45 +00:00
Dan Gohman 581cc87f57 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.

llvm-svn: 53872
2008-07-21 20:00:07 +00:00
Dan Gohman 8c08a692ee Fix uses of underscore-capital names.
llvm-svn: 53870
2008-07-21 19:48:15 +00:00
Bruno Cardoso Lopes e5d1fcfe4e 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.

llvm-svn: 53869
2008-07-21 18:52:34 +00:00
Dan Gohman 3e9ad4d8e6 Now that the MachineInstr leaks are fixed, enable leak checking
in the MachineInstr clone code.

llvm-svn: 53868
2008-07-21 18:47:29 +00:00
Anton Korobeynikov e61ad2b229 Use better variable names
llvm-svn: 53859
2008-07-21 18:29:23 +00:00
Anton Korobeynikov b35f9b2819 Don't use larger alignment.
llvm-svn: 53857
2008-07-21 18:25:17 +00:00
Duncan Sands b0e3938651 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!

llvm-svn: 53850
2008-07-21 10:20:31 +00:00
Evan Cheng e001643358 Use movaps instead of movups to spill 16-byte vector values when default alignment is >= 16. This fixes some massive performance regressions.
llvm-svn: 53844
2008-07-21 06:34:17 +00:00
Nick Lewycky 56e328bb81 Revert r53812 -- premature. LegalizeTypes isn't actually on yet!
llvm-svn: 53816
2008-07-21 04:03:00 +00:00
Nick Lewycky 419a174ccf 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.

llvm-svn: 53812
2008-07-21 02:51:31 +00:00
Wojciech Matyjewicz 1185ad1abc This header isn't necessary now.
llvm-svn: 53811
2008-07-20 17:35:32 +00:00
Wojciech Matyjewicz f0d21cdd19 Fix PR2088. Use modulo linear equation solver to compute loop iteration
count.

llvm-svn: 53810
2008-07-20 15:55:14 +00:00
Bill Wendling 75840e6435 Fix for first part of PR2562. Generate the "pinsrw" instruction for inserts
into v4i16 vectors.

llvm-svn: 53807
2008-07-20 02:32:23 +00:00
Bill Wendling 1071bfb17d 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.

llvm-svn: 53803
2008-07-20 00:11:19 +00:00
Anton Korobeynikov bc780e3441 Unbreak build: 'DarwinTargetAsmInfo' was already taken as PPC TAI flavour.
llvm-svn: 53801
2008-07-19 21:44:57 +00:00
Duncan Sands 2a28791789 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.

llvm-svn: 53794
2008-07-19 16:26:02 +00:00
Anton Korobeynikov b26de0765e Use chars, where possible
llvm-svn: 53791
2008-07-19 13:16:32 +00:00
Anton Korobeynikov bb24791a57 Switch MIPS to new ELFTargetAsmInfo. Add few FIXMEs.
llvm-svn: 53790
2008-07-19 13:16:11 +00:00
Anton Korobeynikov aaee859a18 Fix a FIXME :)
llvm-svn: 53789
2008-07-19 13:15:46 +00:00
Anton Korobeynikov 4e05489745 Use generic ELFTargetAsmInfo and DarwinTargetAsmInfo for X86 code
llvm-svn: 53788
2008-07-19 13:15:21 +00:00
Anton Korobeynikov c187438dcd Add TargetAsmInfo stuff for all darwin-based targets
llvm-svn: 53787
2008-07-19 13:14:46 +00:00
Anton Korobeynikov 1d03fcc7c9 Add TargetAsmInfo for all ELF-based targets
llvm-svn: 53786
2008-07-19 13:14:11 +00:00
Anton Korobeynikov b7a49925a1 Use aligned stack spills, where possible. This fixes PR2549.
llvm-svn: 53784
2008-07-19 06:30:51 +00:00
Evan Cheng a7a20c4946 Fix a memory leak in LiveIntervalAnalysis.
llvm-svn: 53779
2008-07-19 00:37:25 +00:00
Duncan Sands 6b418e750d Softfloat support for FDIV. Patch by
Richard Pennington.

llvm-svn: 53773
2008-07-18 21:18:48 +00:00
Duncan Sands 694228b47d Eliminate unused variable.
llvm-svn: 53772
2008-07-18 21:07:41 +00:00
Duncan Sands 2c741145a7 Supress a gcc-4.3 warning.
llvm-svn: 53771
2008-07-18 21:06:02 +00:00
Duncan Sands 32e387c461 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.

llvm-svn: 53768
2008-07-18 20:12:05 +00:00
Dan Gohman 44dfd7bf56 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.

llvm-svn: 53767
2008-07-18 18:43:12 +00:00
Dan Gohman 597bd1633e Fix a LocalSpiller leak. This fixes tramp3d-v4.
llvm-svn: 53766
2008-07-18 18:28:56 +00:00
Owen Anderson 04a6e0ba8c Make PRE actually handle critical edges (by splitting them). Confirmed that bootstrap passes with this change.
llvm-svn: 53762
2008-07-18 18:03:38 +00:00
Owen Anderson 9858691f25 Reapply r53735. My last patch fixed the failures Dan observed.
llvm-svn: 53761
2008-07-18 17:49:43 +00:00
Owen Anderson 1468bec06e Add some checks that got lost in the shuffle. This fixes 464.h264ref.
llvm-svn: 53760
2008-07-18 17:46:41 +00:00
Dan Gohman 29c3adaae0 Revert r53735. It broke SPEC 464.h264ref.
llvm-svn: 53757
2008-07-18 16:44:49 +00:00
Chris Lattner eee1f57cea 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.

llvm-svn: 53749
2008-07-18 05:23:39 +00:00
Dan Gohman 0ece943845 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.

llvm-svn: 53746
2008-07-17 23:49:46 +00:00
Dan Gohman 7168de7872 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.

llvm-svn: 53738
2008-07-17 21:12:16 +00:00
Owen Anderson fd7102037d Use MergeBlockIntoPredecessor to simplify some code.
llvm-svn: 53735
2008-07-17 20:00:46 +00:00
Evan Cheng cefd6e62fa Subreg live interval valno may not have a corresponding def machineinstr since it's less precise.
llvm-svn: 53734
2008-07-17 19:48:53 +00:00
Owen Anderson 27405efdc0 Make MergeBlockIntoPredecessor more aggressive when the same successor appears
more than once.

llvm-svn: 53731
2008-07-17 19:42:29 +00:00
Owen Anderson addbe3eed1 Enable PRE. My last batch of changes fixed the miscompile.
llvm-svn: 53730
2008-07-17 19:41:00 +00:00
Duncan Sands 656b256a1a 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.

llvm-svn: 53729
2008-07-17 19:28:41 +00:00
Dan Gohman 1705968102 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.

llvm-svn: 53728
2008-07-17 19:10:17 +00:00
Duncan Sands 7e5edf1a1f LegalizeTypes support for what seems to be the
only missing ppc long double operations: FNEG
and FP_EXTEND.

llvm-svn: 53723
2008-07-17 17:35:14 +00:00
Nate Begeman 3851e29e20 Remove unnecessary readme entry
llvm-svn: 53722
2008-07-17 17:21:14 +00:00
Duncan Sands d9256a7ceb Turn LegalizeTypes back off again for the moment:
it is breaking Darwin bootstrap due to missing
functionality.

llvm-svn: 53721
2008-07-17 17:06:03 +00:00
Nate Begeman 3a2147aa97 Fix a typo in last commit
llvm-svn: 53720
2008-07-17 17:04:58 +00:00
Nate Begeman 55b7becb29 SSE codegen for vsetcc nodes
llvm-svn: 53719
2008-07-17 16:51:19 +00:00
Matthijs Kooijman 8b69d77a7a Make GlobalOpt preserve address spaces when scalar replacing aggregate globals.
llvm-svn: 53716
2008-07-17 11:59:53 +00:00
Chris Lattner c600c53d1f Fix PR2553
llvm-svn: 53715
2008-07-17 06:07:20 +00:00
Mon P Wang 1e2c6bfa41 When lowering certain atomics, we need to copy the memoperand from the old
atomic operation to the new one.

llvm-svn: 53714
2008-07-17 04:54:06 +00:00
Duncan Sands 77a3d05f1e Factorize some code for determining which libcall to use.
llvm-svn: 53713
2008-07-17 02:36:29 +00:00
Evan Cheng 97cd0298cc Inliner tweak. Function calls should cost more than one instruction!
llvm-svn: 53712
2008-07-17 01:31:49 +00:00
Owen Anderson c062381c7b Factor MergeBlockIntoPredecessor out into BasicBlockUtils.
llvm-svn: 53705
2008-07-17 00:01:40 +00:00
Devang Patel 78e8a09f39 Mark function used by asm block as used, otherwise optimizer may not see the use and may delete the function.
llvm-svn: 53692
2008-07-16 17:54:34 +00:00
Owen Anderson ac31096311 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.

llvm-svn: 53691
2008-07-16 17:52:31 +00:00
Scott Michel fe09508210 Somehow, custom lowering of i64 multiplications got dropped along the way.
llvm-svn: 53689
2008-07-16 17:17:29 +00:00
Dan Gohman f169f81036 Fix the result type of X86's truncate to i8.
llvm-svn: 53688
2008-07-16 16:20:48 +00:00
Dan Gohman 2714059079 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.

llvm-svn: 53687
2008-07-16 16:13:58 +00:00
Duncan Sands 2d28e281e9 Add support for promoting and expanding AssertZext
and AssertSext.  Needed when passing huge integer
parameters with the zeroext or signext attributes.

llvm-svn: 53684
2008-07-16 16:03:07 +00:00
Dan Gohman 26ffe2bea6 Fix a comment to say nonnegative instead of positive.
llvm-svn: 53681
2008-07-16 15:57:10 +00:00
Dan Gohman bf98f68265 Add an assert to check for empty flags for MachineMemOperand.
llvm-svn: 53680
2008-07-16 15:56:42 +00:00
Matthijs Kooijman c1d7477ed2 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.

llvm-svn: 53673
2008-07-16 12:55:45 +00:00
Duncan Sands e766b4230e 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.

llvm-svn: 53672
2008-07-16 11:41:33 +00:00
Duncan Sands c359055fa9 Turn on LegalizeTypes by default.
llvm-svn: 53671
2008-07-16 11:36:51 +00:00
Matthijs Kooijman b85cc9db19 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

llvm-svn: 53670
2008-07-16 10:47:35 +00:00
Evan Cheng c97094552c Fix PR2296. Do not transform x86_sse2_storel_dq into a full-width store.
llvm-svn: 53666
2008-07-16 07:28:14 +00:00
Evan Cheng cf06fe476f x86-64 PIC JIT fixes: do not generate the extra load for external GV's.
llvm-svn: 53661
2008-07-16 01:34:02 +00:00
Evan Cheng 68bd1546ab X86-64 PIC jump table values are different from x86-32 cases, they are dest - table base.
llvm-svn: 53660
2008-07-16 01:33:08 +00:00
Dan Gohman efa4160fcc TargetAsmInfo::SectionForGlobal showed up in a profile. Simplify it a little.
llvm-svn: 53639
2008-07-15 18:37:51 +00:00
Dan Gohman 1e5aa12b7d SelectionDAG::AssignNodeIds is unused.
llvm-svn: 53636
2008-07-15 18:29:32 +00:00
Dan Gohman 1d093846b5 Don't sort SDNodes by their addresses in SelectionDAG::dump. Instead,
just use the AllNodes order, which is at least relatively stable
across runs.

llvm-svn: 53632
2008-07-15 18:18:54 +00:00
Owen Anderson 24768e3dc4 Revert this, as it seems to still be broken.
llvm-svn: 53627
2008-07-15 17:59:02 +00:00
Owen Anderson 9d1f497a28 Enable local PRE by default.
llvm-svn: 53616
2008-07-15 16:28:23 +00:00
Owen Anderson 53d546e40b Have GVN do a pre-pass over the CFG that folds away unconditional branches where possible. This allows local PRE to be more aggressive.
llvm-svn: 53615
2008-07-15 16:28:06 +00:00
Duncan Sands 0f1a1cdcf8 LegalizeTypes support for fabs on ppc long double.
llvm-svn: 53613
2008-07-15 15:02:44 +00:00
Matthijs Kooijman c893bf472d Allow deadargelim to change return types even though now values were dead. This
again canonicalizes {i32} into i32 and {} into void.

llvm-svn: 53610
2008-07-15 14:42:31 +00:00
Matthijs Kooijman 5e8c022e21 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.

llvm-svn: 53609
2008-07-15 14:39:36 +00:00
Matthijs Kooijman c1da874478 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.

llvm-svn: 53608
2008-07-15 14:03:10 +00:00
Matthijs Kooijman 04d4c328ac Don't use isa when we can reuse a previous dyn_cast.
llvm-svn: 53607
2008-07-15 13:39:08 +00:00
Matthijs Kooijman 84194b6768 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.

llvm-svn: 53606
2008-07-15 13:36:06 +00:00
Duncan Sands 6162e0377c 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.

llvm-svn: 53604
2008-07-15 10:18:22 +00:00
Duncan Sands 202225cdf8 LegalizeTypes support for promotion of SIGN_EXTEND_INREG.
llvm-svn: 53603
2008-07-15 10:14:24 +00:00
Duncan Sands b9b5a671d3 Reorder the integer promotion methods alphabetically.
No change in functionality.

llvm-svn: 53602
2008-07-15 10:12:34 +00:00
Matthijs Kooijman 79a8eb547c 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.

llvm-svn: 53601
2008-07-15 09:11:16 +00:00
Matthijs Kooijman e9af814669 Split DAE::MarkLive into MarkLive and PropagateLiveness.
llvm-svn: 53600
2008-07-15 09:00:17 +00:00
Matthijs Kooijman 2ce5709e31 Pass around const RetOrArg references instead of copying values. Also, mark
RetOrArg::getDescription() as const.

llvm-svn: 53599
2008-07-15 08:56:49 +00:00
Matthijs Kooijman f2860b9fb3 Simplify debug code by using RetOrArg::getDescription().
llvm-svn: 53598
2008-07-15 08:53:36 +00:00
Matthijs Kooijman 90d08addb0 Fix indentation (intentionally left out of the previous commit).
llvm-svn: 53592
2008-07-15 08:47:32 +00:00
Matthijs Kooijman 06642d3812 Move the deadargelim code for intrinsically alive functions into its own
method, to slightly simplify control flow.

llvm-svn: 53591
2008-07-15 08:45:12 +00:00
Mon P Wang 97432f4f1b Fixed potential bug if the source and target of a bit convert have different alignment
llvm-svn: 53590
2008-07-15 05:28:34 +00:00
Nick Lewycky 970914c8c8 Correct this inversion!
I swear that didn't show up in svn diff...

llvm-svn: 53587
2008-07-15 03:47:44 +00:00
Nick Lewycky 3752e51311 Fix up comments.
llvm-svn: 53586
2008-07-15 03:40:27 +00:00
Bruno Cardoso Lopes 7d5d402b16 Fixed call stack alignment. Improved AsmPrinter alignment issues.
llvm-svn: 53585
2008-07-15 02:03:36 +00:00
Dan Gohman adec96f438 Reapply 53476 and 53480, with a fix so that it properly updates
the BB member to the current basic block after emitting
instructions.

llvm-svn: 53567
2008-07-14 18:19:29 +00:00
Dan Gohman 162668fa78 Fix uninitialized use of the Changed variable.
llvm-svn: 53564
2008-07-14 17:55:01 +00:00
Dan Gohman e7c8387616 Improve debug output for MemOperandSDNode. PseudoSourceValue nodes
don't have value names, so use print instead of getName() to get a
useful string.

llvm-svn: 53563
2008-07-14 17:51:24 +00:00
Dan Gohman 793357b115 Fix edito in the PseudoSourceValue name list.
llvm-svn: 53562
2008-07-14 17:45:47 +00:00
Duncan Sands 673cf1836b I don't think BUILD_PAIR can have a vector result.
Remove support for this.

llvm-svn: 53559
2008-07-14 17:34:19 +00:00
Duncan Sands 0ca9a38f68 Tighten up some checks. Fix FPOWI splitting for
non-power-of-two vectors.

llvm-svn: 53558
2008-07-14 17:33:37 +00:00
Chris Lattner 8882b1c41c Reapply r53540, now with the matching header!
llvm-svn: 53557
2008-07-14 17:32:59 +00:00
Duncan Sands a30cbd9797 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.

llvm-svn: 53556
2008-07-14 17:32:02 +00:00
Duncan Sands 693185bcee 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.

llvm-svn: 53555
2008-07-14 17:27:46 +00:00
Duncan Sands b766084cb0 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.

llvm-svn: 53554
2008-07-14 17:22:31 +00:00
Duncan Sands d47d2d6b12 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.

llvm-svn: 53553
2008-07-14 17:15:45 +00:00
Bruno Cardoso Lopes 80ab8f9649 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.

llvm-svn: 53551
2008-07-14 14:42:54 +00:00
Duncan Sands 68b0383057 Revert r53540 - it does not compile.
llvm-svn: 53549
2008-07-14 07:59:28 +00:00
Chris Lattner 0ead7a50b2 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.

llvm-svn: 53548
2008-07-14 07:23:24 +00:00
Chris Lattner c08e7a00c3 don't do any linkage, not even type resolution, of symbols that have
internal linkage.

llvm-svn: 53547
2008-07-14 06:52:19 +00:00
Chris Lattner 34fc5a0eaa 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.

llvm-svn: 53546
2008-07-14 06:49:45 +00:00
Chris Lattner 177a3008e1 wrap long lines, remove some code from a non-assert build.
llvm-svn: 53545
2008-07-14 05:52:33 +00:00
Chris Lattner eab49263b5 Fix a bunch of bugs handling vector compare constant expressions, fixing
PR2317.

llvm-svn: 53544
2008-07-14 05:17:31 +00:00
Chris Lattner c5098a2877 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.  

llvm-svn: 53541
2008-07-14 05:10:41 +00:00
Chris Lattner 2831ad28be 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.

llvm-svn: 53540
2008-07-14 00:46:56 +00:00
Chris Lattner 6f5ea6e49c simplify some code, shuffle and insertelt always return a vector.
llvm-svn: 53538
2008-07-14 00:32:20 +00:00
Chris Lattner 8377c02308 Add a note.
llvm-svn: 53535
2008-07-14 00:19:59 +00:00
Chris Lattner 16395e51f4 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
}

llvm-svn: 53534
2008-07-14 00:15:52 +00:00
Chris Lattner 80b03a1b49 Fix mishandling of the infinite loop case when merging two blocks. This
fixes PR2540.

llvm-svn: 53533
2008-07-13 22:23:11 +00:00
Chris Lattner 834ab4ec1b more refactoring. Use early exits instead of really complex logic.
No functionality change.

llvm-svn: 53532
2008-07-13 22:04:41 +00:00
Chris Lattner 5eed37224a improve comments.
llvm-svn: 53531
2008-07-13 21:55:46 +00:00
Chris Lattner 9aada1d755 factor another large hunk of code out into its own function.
No functionality change.

llvm-svn: 53530
2008-07-13 21:53:26 +00:00
Chris Lattner 55eaae1e0c Final bit of simplification for FoldBranchToCommonDest.
llvm-svn: 53528
2008-07-13 21:20:19 +00:00
Chris Lattner 1b317ea48a simplify logic a bit
llvm-svn: 53527
2008-07-13 21:15:11 +00:00
Chris Lattner 2e25b8f444 Refactor some code out into its own helper function, getting rid of crazy multiline
conditionals and commenting the code better.

No functionality change.

llvm-svn: 53526
2008-07-13 21:12:01 +00:00
Nick Lewycky b5688ccf57 Stop creating extraneous smax/umax in SCEV. This removes a regression where we
started complicating many loops ('for' loops, in fact).

llvm-svn: 53508
2008-07-12 07:41:32 +00:00
Nick Lewycky f76aa23b54 Enhance analysis of srem.
Remove dead code analyzing urem. 'urem' of power-of-2 is canonicalized to an
'and' instruction.

llvm-svn: 53506
2008-07-12 05:04:38 +00:00
Evan Cheng 32e376f354 Implement llvm.atomic.cmp.swap.i32 on PPC. Patch by Gary Benson!
llvm-svn: 53505
2008-07-12 02:23:19 +00:00
Evan Cheng 2b3c52d5c4 Typos.
llvm-svn: 53504
2008-07-12 02:22:07 +00:00
Evan Cheng e0a352e8e7 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.

llvm-svn: 53503
2008-07-12 01:56:02 +00:00
Evan Cheng ef8412c822 Back out 53476 and 53480 for now. Somehow they cause llc to miscompile 179.art.
llvm-svn: 53502
2008-07-12 01:38:51 +00:00
Dan Gohman 9a542a4d5f 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.

llvm-svn: 53498
2008-07-12 00:10:52 +00:00
Dan Gohman 0e52a0c89e Fix spelling of "hierarchy" in comments.
llvm-svn: 53489
2008-07-11 22:51:32 +00:00
Dan Gohman 02c7c6cb33 Include a frame index in the "fixed stack" pseudo source value
instead of using the frame index for the SVOffset, which was
inconsistent.

llvm-svn: 53486
2008-07-11 22:44:52 +00:00
Dan Gohman ed087a62dc Fix an obsolete top-level comment.
llvm-svn: 53481
2008-07-11 22:39:58 +00:00
Dan Gohman f4cd404e6f Factor out debugging code into the common base class.
llvm-svn: 53480
2008-07-11 22:36:22 +00:00
Dan Gohman 36a69373dc 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.

llvm-svn: 53476
2008-07-11 21:54:34 +00:00
Dan Gohman 3707f1daba Use find instead of lower_bound.
llvm-svn: 53474
2008-07-11 20:58:19 +00:00
Chris Lattner 9fc580f2d0 add support for returning i128, PR2532.
llvm-svn: 53472
2008-07-11 20:53:00 +00:00
Dan Gohman 0597e5b697 Trim unnecessary #includes.
llvm-svn: 53471
2008-07-11 20:38:31 +00:00
Owen Anderson 8e462e9a82 Don't call lookupNumber more than we have to.
llvm-svn: 53470
2008-07-11 20:05:13 +00:00
Duncan Sands 121641d601 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.

llvm-svn: 53462
2008-07-11 17:02:09 +00:00
Duncan Sands 3e7d0fa3ca 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.

llvm-svn: 53461
2008-07-11 17:00:14 +00:00
Duncan Sands 37b7322b35 Add two missing SINT_TO_FP libcalls.
llvm-svn: 53460
2008-07-11 16:57:02 +00:00
Duncan Sands d9948110a6 Port a shift-by-1 optimization from LegalizeDAG: it
was presumably added after the rest of the code was
copied to LegalizeTypes.

llvm-svn: 53459
2008-07-11 16:54:57 +00:00
Duncan Sands 927a3648d5 Add support for 128 bit shifts and 32 bit shifts
on 16 bit machines.

llvm-svn: 53458
2008-07-11 16:52:29 +00:00
Nick Lewycky 45e127ab20 Document 'mask' in this calculation.
llvm-svn: 53454
2008-07-11 08:16:26 +00:00
Duncan Sands 914ca2d368 Align comments, colons and cases. Remove trailing
whitespace.

llvm-svn: 53453
2008-07-11 07:37:30 +00:00