1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
Commit Graph

24066 Commits

Author SHA1 Message Date
Duncan Sands
39da9f4a43 Eliminate unused variable.
llvm-svn: 53772
2008-07-18 21:07:41 +00:00
Duncan Sands
b4646d7dbe Supress a gcc-4.3 warning.
llvm-svn: 53771
2008-07-18 21:06:02 +00:00
Duncan Sands
3d68e2ff9c 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
b97c076af4 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
e119f3db46 Fix a LocalSpiller leak. This fixes tramp3d-v4.
llvm-svn: 53766
2008-07-18 18:28:56 +00:00
Owen Anderson
8500aba55a 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
bba5ddaf0f Reapply r53735. My last patch fixed the failures Dan observed.
llvm-svn: 53761
2008-07-18 17:49:43 +00:00
Owen Anderson
736e4b3a3f 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
4dc7526774 Revert r53735. It broke SPEC 464.h264ref.
llvm-svn: 53757
2008-07-18 16:44:49 +00:00
Chris Lattner
0429684d2d 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
f38f99ccc5 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
c666c01e65 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
8e971c22fd Use MergeBlockIntoPredecessor to simplify some code.
llvm-svn: 53735
2008-07-17 20:00:46 +00:00
Evan Cheng
d26080487b 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
cb787a2004 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
5524271234 Enable PRE. My last batch of changes fixed the miscompile.
llvm-svn: 53730
2008-07-17 19:41:00 +00:00
Duncan Sands
08ea7c0351 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
8981962672 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
c3331602f9 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
64f8f7f6bb Remove unnecessary readme entry
llvm-svn: 53722
2008-07-17 17:21:14 +00:00
Duncan Sands
778e45e748 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
61f6c21028 Fix a typo in last commit
llvm-svn: 53720
2008-07-17 17:04:58 +00:00
Nate Begeman
af01bfff99 SSE codegen for vsetcc nodes
llvm-svn: 53719
2008-07-17 16:51:19 +00:00
Matthijs Kooijman
5ec5e264e4 Make GlobalOpt preserve address spaces when scalar replacing aggregate globals.
llvm-svn: 53716
2008-07-17 11:59:53 +00:00
Chris Lattner
eccd57d118 Fix PR2553
llvm-svn: 53715
2008-07-17 06:07:20 +00:00
Mon P Wang
57cd9d6e5a 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
41aeb22c1d Factorize some code for determining which libcall to use.
llvm-svn: 53713
2008-07-17 02:36:29 +00:00
Evan Cheng
a7598b31ee Inliner tweak. Function calls should cost more than one instruction!
llvm-svn: 53712
2008-07-17 01:31:49 +00:00
Owen Anderson
7fb36c8bba Factor MergeBlockIntoPredecessor out into BasicBlockUtils.
llvm-svn: 53705
2008-07-17 00:01:40 +00:00
Devang Patel
a6c5ff690a 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
f91aa3b22f 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
ba160e6396 Somehow, custom lowering of i64 multiplications got dropped along the way.
llvm-svn: 53689
2008-07-16 17:17:29 +00:00
Dan Gohman
4c8c8e3aad Fix the result type of X86's truncate to i8.
llvm-svn: 53688
2008-07-16 16:20:48 +00:00
Dan Gohman
0025513482 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
3448d4087f 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
2638ec5b4c Fix a comment to say nonnegative instead of positive.
llvm-svn: 53681
2008-07-16 15:57:10 +00:00
Dan Gohman
bc29205ccc Add an assert to check for empty flags for MachineMemOperand.
llvm-svn: 53680
2008-07-16 15:56:42 +00:00
Matthijs Kooijman
ceee0ddd1b 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
b753d27377 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
b2e1ddbd0b Turn on LegalizeTypes by default.
llvm-svn: 53671
2008-07-16 11:36:51 +00:00
Matthijs Kooijman
96d9bcbdf6 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
7218339189 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
face16f9d8 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
cabfd3f78c 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
8cf62e122f TargetAsmInfo::SectionForGlobal showed up in a profile. Simplify it a little.
llvm-svn: 53639
2008-07-15 18:37:51 +00:00
Dan Gohman
c4400b8618 SelectionDAG::AssignNodeIds is unused.
llvm-svn: 53636
2008-07-15 18:29:32 +00:00
Dan Gohman
c9b72806d7 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
e12f7904ff Revert this, as it seems to still be broken.
llvm-svn: 53627
2008-07-15 17:59:02 +00:00
Owen Anderson
73bdb28e89 Enable local PRE by default.
llvm-svn: 53616
2008-07-15 16:28:23 +00:00
Owen Anderson
f1b3898e7f 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
7ca2df2319 LegalizeTypes support for fabs on ppc long double.
llvm-svn: 53613
2008-07-15 15:02:44 +00:00
Matthijs Kooijman
f9532fe71b 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
18c6979fed 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
f940585c1c 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
50a2233b45 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
4b75601340 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
58eb5e35da 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
710be60c23 LegalizeTypes support for promotion of SIGN_EXTEND_INREG.
llvm-svn: 53603
2008-07-15 10:14:24 +00:00
Duncan Sands
d2097e5b92 Reorder the integer promotion methods alphabetically.
No change in functionality.

llvm-svn: 53602
2008-07-15 10:12:34 +00:00
Matthijs Kooijman
86a46174fe 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
caa3ed0c99 Split DAE::MarkLive into MarkLive and PropagateLiveness.
llvm-svn: 53600
2008-07-15 09:00:17 +00:00
Matthijs Kooijman
31b7208f7d 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
937016427b Simplify debug code by using RetOrArg::getDescription().
llvm-svn: 53598
2008-07-15 08:53:36 +00:00
Matthijs Kooijman
c9c8644910 Fix indentation (intentionally left out of the previous commit).
llvm-svn: 53592
2008-07-15 08:47:32 +00:00
Matthijs Kooijman
52acc10fdc 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
834c054b1d 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
0d582485f9 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
ac8e34e574 Fix up comments.
llvm-svn: 53586
2008-07-15 03:40:27 +00:00
Bruno Cardoso Lopes
0c154df07f Fixed call stack alignment. Improved AsmPrinter alignment issues.
llvm-svn: 53585
2008-07-15 02:03:36 +00:00
Dan Gohman
e76fd33ee5 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
8280b2e66e Fix uninitialized use of the Changed variable.
llvm-svn: 53564
2008-07-14 17:55:01 +00:00
Dan Gohman
7b61b66334 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
bf764c6a4c Fix edito in the PseudoSourceValue name list.
llvm-svn: 53562
2008-07-14 17:45:47 +00:00
Duncan Sands
ef690bbffe 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
bb3251e1f4 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
8a9725bffe Reapply r53540, now with the matching header!
llvm-svn: 53557
2008-07-14 17:32:59 +00:00
Duncan Sands
134155a263 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
5a4bab9849 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
fd63c72205 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
a9d2c2042e 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
f5a55301e0 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
63940a7330 Revert r53540 - it does not compile.
llvm-svn: 53549
2008-07-14 07:59:28 +00:00
Chris Lattner
ef7178406b 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
0b95d5f57d 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
d31cacb5d6 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
c68c953e71 wrap long lines, remove some code from a non-assert build.
llvm-svn: 53545
2008-07-14 05:52:33 +00:00
Chris Lattner
b786d147c9 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
accde0a86b 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
6841e1dc33 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
f8e9922213 simplify some code, shuffle and insertelt always return a vector.
llvm-svn: 53538
2008-07-14 00:32:20 +00:00
Chris Lattner
15ae951af5 Add a note.
llvm-svn: 53535
2008-07-14 00:19:59 +00:00
Chris Lattner
14faada3a3 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
3444f4d4c4 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
7cb257551f 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
a4a80e0092 improve comments.
llvm-svn: 53531
2008-07-13 21:55:46 +00:00
Chris Lattner
824fbca1ee 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
67bf4acd15 Final bit of simplification for FoldBranchToCommonDest.
llvm-svn: 53528
2008-07-13 21:20:19 +00:00
Chris Lattner
3346d311c7 simplify logic a bit
llvm-svn: 53527
2008-07-13 21:15:11 +00:00
Chris Lattner
2ac1854097 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
df9e9f0b0e 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
3fb5816774 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
c69b53dff9 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
7457283357 Typos.
llvm-svn: 53504
2008-07-12 02:22:07 +00:00
Evan Cheng
05e5317cab 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
ebf7ff4531 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
bf47a27643 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
fee8b04935 Fix spelling of "hierarchy" in comments.
llvm-svn: 53489
2008-07-11 22:51:32 +00:00
Dan Gohman
4c18394001 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
b21183f645 Fix an obsolete top-level comment.
llvm-svn: 53481
2008-07-11 22:39:58 +00:00
Dan Gohman
3b91ef27b5 Factor out debugging code into the common base class.
llvm-svn: 53480
2008-07-11 22:36:22 +00:00
Dan Gohman
6ee2195ab1 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
d1342570f2 Use find instead of lower_bound.
llvm-svn: 53474
2008-07-11 20:58:19 +00:00
Chris Lattner
4f20448c91 add support for returning i128, PR2532.
llvm-svn: 53472
2008-07-11 20:53:00 +00:00
Dan Gohman
d7a32ecde2 Trim unnecessary #includes.
llvm-svn: 53471
2008-07-11 20:38:31 +00:00
Owen Anderson
cc861329ee Don't call lookupNumber more than we have to.
llvm-svn: 53470
2008-07-11 20:05:13 +00:00
Duncan Sands
eb04d356e3 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
1e3fe05638 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
58130a26f4 Add two missing SINT_TO_FP libcalls.
llvm-svn: 53460
2008-07-11 16:57:02 +00:00
Duncan Sands
52f1dbf139 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
669d4d6909 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
cafc3d583d Document 'mask' in this calculation.
llvm-svn: 53454
2008-07-11 08:16:26 +00:00
Duncan Sands
94f659d6cb Align comments, colons and cases. Remove trailing
whitespace.

llvm-svn: 53453
2008-07-11 07:37:30 +00:00
Nick Lewycky
12c88a28f5 Remove misleading constant from comment.
llvm-svn: 53452
2008-07-11 07:36:19 +00:00
Nick Lewycky
8cd0f2058e Add another optimization from PR2330. Also catch some missing cases that are
similar.

llvm-svn: 53451
2008-07-11 07:20:53 +00:00
Bill Wendling
9f17caa9a9 The frame address on an x86-64 box needs to be offset by -8, not -4.
llvm-svn: 53450
2008-07-11 07:18:52 +00:00
Chris Lattner
07bfade2d4 a missed optimization that Eli spotted
llvm-svn: 53449
2008-07-11 06:40:29 +00:00
Chris Lattner
34b0895d4d another bug in the same line.
llvm-svn: 53448
2008-07-11 06:38:16 +00:00
Chris Lattner
3cdb6789b9 fix a bug spotted by Eli's eagle eyes
llvm-svn: 53447
2008-07-11 06:36:01 +00:00
Chris Lattner
3d40848bfd 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.

llvm-svn: 53446
2008-07-11 05:40:05 +00:00
Chris Lattner
d1198896ae fold away (x <= cst) earlier, allowing us to not have to
handle them in some code.

llvm-svn: 53445
2008-07-11 05:08:55 +00:00
Chris Lattner
16b8ae98c1 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.

llvm-svn: 53444
2008-07-11 04:20:58 +00:00
Chris Lattner
f3f6b6d7af 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)

llvm-svn: 53443
2008-07-11 04:09:09 +00:00
Chris Lattner
20b1bde882 regenerate
llvm-svn: 53440
2008-07-11 00:30:39 +00:00
Chris Lattner
9dff6fbe58 Implement PR2538
llvm-svn: 53438
2008-07-11 00:30:06 +00:00
Chris Lattner
78d60a220b 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.

llvm-svn: 53435
2008-07-10 23:46:13 +00:00
Chris Lattner
5e784a8ebd make legalize types be a command line option: -enable-legalize-types.
llvm-svn: 53434
2008-07-10 23:37:50 +00:00
Dan Gohman
1f42b96c7e Make stack slot coloring's debug output more consistent with
other passes.

llvm-svn: 53415
2008-07-10 19:49:32 +00:00
Evan Cheng
d7023b66ea Change StackSlotForVirtReg (which maps vregs to frame indices) from std::map to IndexedMap.
llvm-svn: 53414
2008-07-10 18:23:23 +00:00
Chris Lattner
b5d45a49ea Remove extraneous vertical whitespace before Eric gets the wrong idea ;-)
llvm-svn: 53411
2008-07-10 16:49:53 +00:00
Chris Lattner
5f3c587276 Fix an altivec constant miscompilation that Duncan found through
his work on legalizetypes.

llvm-svn: 53410
2008-07-10 16:33:38 +00:00
Duncan Sands
a6c09579f0 Add support for 128 bit multiplicative operations.
Lack of these caused a bootstrap failure with Fortran
on x86-64 with LegalizeTypes turned on.  While there,
be nice to 16 bit machines and support expansion of
i32 too.

llvm-svn: 53408
2008-07-10 15:35:05 +00:00
Duncan Sands
90a916539d Add a mysteriously missing libcall, FPTOSINT_F80_I32.
Be nice to 16 bit machines by supporting FP_TO_XINT
expansion for these.

llvm-svn: 53407
2008-07-10 15:33:02 +00:00
Duncan Sands
91912e046a Fix a FIXME: use an apint in CTTZ legalization.
llvm-svn: 53406
2008-07-10 15:30:54 +00:00
Duncan Sands
f2734eabf2 Remove PromoteIntRes_FP_ROUND - not sure what it
was doing there: FP_ROUND returns a float, not an
integer.

llvm-svn: 53405
2008-07-10 15:29:55 +00:00
Duncan Sands
16f5ab06b0 Make sure the alignment of the temporary created
in CreateStackStoreLoad is good enough for both
the source and destination types.

llvm-svn: 53404
2008-07-10 15:26:17 +00:00
Duncan Sands
a219bb03e1 Make the LegalizeType method naming scheme more regular.
llvm-svn: 53403
2008-07-10 15:25:04 +00:00
Duncan Sands
8afe39dc56 Don't barf when dumping a constant that contains
a ginormous value (eg: i128 -1).

llvm-svn: 53402
2008-07-10 11:23:14 +00:00
Matthijs Kooijman
ca5124a630 Restructure dead argument elimination, try #3 :-)
Rewrite the DeadArgumentElimination pass, to use a more explicit tracking of
dependencies between return values and/or arguments. Also make the handling of
arguments and return values the same.

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

This version fixed a few more bugs and was cleaned up a bit. It now passes all
of LLVM's testing, and should still pass SPEC2006. There is still a minor bug
with regard to returning nested structs. Since there is currently nothing that
emits such IR, I will fix that in a seperate commit (partly because it requires
a non-trivial fix).

llvm-svn: 53400
2008-07-10 10:24:08 +00:00
Evan Cheng
3ec3113431 - Change the horrible N^2 isRegReDefinedByTwoAddr. Now callers must supply the operand index of def machineoperand and at most one full scan of non-implicit operands is needed.
- Change local register allocator to use the new isRegReDefinedByTwoAddr instead of reinventing the wheel.

llvm-svn: 53394
2008-07-10 07:35:43 +00:00
Nick Lewycky
26ccb8e9a8 Fix overzealous optimization. Thanks to Duncan Sands for pointing out my error!
llvm-svn: 53393
2008-07-10 05:51:40 +00:00