Commit Graph

40152 Commits

Author SHA1 Message Date
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
Matthijs Kooijman
ae15ddf61b Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 13:15:10 +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
Devang Patel
f0d286b77f LinkOnce definitions have default scope, like weak definitions. Otherwise, the linker may not be able to match LinkOnce definition from one module with an exteranl reference from other module.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53580 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-15 00:00:11 +00:00
Evan Cheng
5f2f218825 Goodbye tail duplication (for good this time).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53574 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 22:29:15 +00:00
Chris Lattner
d28516e3b1 This replaces all $(SolutionDir) macros with $(ProjectDir)..\
Patch by Nicolas Capens!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53571 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 18:46:16 +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
Dan Gohman
cebf59b4a9 Reformat this message to fit in 80 cols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 17:43:27 +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
de29d92420 whitespace fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53537 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 00:28:45 +00:00
Chris Lattner
6838d8726e doxygenate comments and wrap to 80 cols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53536 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-14 00:27:31 +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