oota-llvm.git
16 years agoEnable PRE. My last batch of changes fixed the miscompile.
Owen Anderson [Thu, 17 Jul 2008 19:41:00 +0000 (19:41 +0000)]
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

16 years agoUse a legal type for elements of the vector_shuffle
Duncan Sands [Thu, 17 Jul 2008 19:28:41 +0000 (19:28 +0000)]
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

16 years agoAdd a new function, ReplaceAllUsesOfValuesWith, which handles bulk
Dan Gohman [Thu, 17 Jul 2008 19:10:17 +0000 (19:10 +0000)]
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

16 years agoIndentation.
Evan Cheng [Thu, 17 Jul 2008 18:41:20 +0000 (18:41 +0000)]
Indentation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53727 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoLegalizeTypes support for what seems to be the
Duncan Sands [Thu, 17 Jul 2008 17:35:14 +0000 (17:35 +0000)]
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

16 years agoRemove unnecessary readme entry
Nate Begeman [Thu, 17 Jul 2008 17:21:14 +0000 (17:21 +0000)]
Remove unnecessary readme entry

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53722 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTurn LegalizeTypes back off again for the moment:
Duncan Sands [Thu, 17 Jul 2008 17:06:03 +0000 (17:06 +0000)]
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

16 years agoFix a typo in last commit
Nate Begeman [Thu, 17 Jul 2008 17:04:58 +0000 (17:04 +0000)]
Fix a typo in last commit

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53720 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSSE codegen for vsetcc nodes
Nate Begeman [Thu, 17 Jul 2008 16:51:19 +0000 (16:51 +0000)]
SSE codegen for vsetcc nodes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53719 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMake GlobalOpt preserve address spaces when scalar replacing aggregate globals.
Matthijs Kooijman [Thu, 17 Jul 2008 11:59:53 +0000 (11:59 +0000)]
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

16 years agoFix PR2553
Chris Lattner [Thu, 17 Jul 2008 06:07:20 +0000 (06:07 +0000)]
Fix PR2553

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53715 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen lowering certain atomics, we need to copy the memoperand from the old
Mon P Wang [Thu, 17 Jul 2008 04:54:06 +0000 (04:54 +0000)]
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

16 years agoFactorize some code for determining which libcall to use.
Duncan Sands [Thu, 17 Jul 2008 02:36:29 +0000 (02:36 +0000)]
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

16 years agoInliner tweak. Function calls should cost more than one instruction!
Evan Cheng [Thu, 17 Jul 2008 01:31:49 +0000 (01:31 +0000)]
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

16 years agoFactor MergeBlockIntoPredecessor out into BasicBlockUtils.
Owen Anderson [Thu, 17 Jul 2008 00:01:40 +0000 (00:01 +0000)]
Factor MergeBlockIntoPredecessor out into BasicBlockUtils.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53705 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoName string length is end position marker - begin position marker.
Devang Patel [Wed, 16 Jul 2008 19:49:09 +0000 (19:49 +0000)]
Name string length is end position marker - begin position marker.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53697 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDo not forget global definitions from inline asm code block.
Devang Patel [Wed, 16 Jul 2008 18:06:52 +0000 (18:06 +0000)]
Do not forget global definitions from inline asm code block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53693 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMark function used by asm block as used, otherwise optimizer may not see the use...
Devang Patel [Wed, 16 Jul 2008 17:54:34 +0000 (17:54 +0000)]
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

16 years agoThere's no need to iterate block merging and PRE. In fact, iterating the latter
Owen Anderson [Wed, 16 Jul 2008 17:52:31 +0000 (17:52 +0000)]
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

16 years agoSomehow, custom lowering of i64 multiplications got dropped along the way.
Scott Michel [Wed, 16 Jul 2008 17:17:29 +0000 (17:17 +0000)]
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

16 years agoFix the result type of X86's truncate to i8.
Dan Gohman [Wed, 16 Jul 2008 16:20:48 +0000 (16:20 +0000)]
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

16 years agoFix the result type of a VECTOR_SHUFFLE+BIT_CONVERT dagcombine. This
Dan Gohman [Wed, 16 Jul 2008 16:13:58 +0000 (16:13 +0000)]
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

16 years agoFix the name of BreakCriticalMachineEdge.h's include guard
Dan Gohman [Wed, 16 Jul 2008 16:04:07 +0000 (16:04 +0000)]
Fix the name of BreakCriticalMachineEdge.h's include guard

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53686 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCorrect a top-level comment.
Dan Gohman [Wed, 16 Jul 2008 16:03:31 +0000 (16:03 +0000)]
Correct a top-level comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53685 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd support for promoting and expanding AssertZext
Duncan Sands [Wed, 16 Jul 2008 16:03:07 +0000 (16:03 +0000)]
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

16 years agoClarify the comments here, to make slightly more clear the
Dan Gohman [Wed, 16 Jul 2008 16:02:59 +0000 (16:02 +0000)]
Clarify the comments here, to make slightly more clear the
difference in purpose of TargetInstrInfo and TargetInstrDesc,
which isn't immediately obvious from the name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53683 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTidy a doxygen comment.
Dan Gohman [Wed, 16 Jul 2008 15:59:56 +0000 (15:59 +0000)]
Tidy a doxygen comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53682 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a comment to say nonnegative instead of positive.
Dan Gohman [Wed, 16 Jul 2008 15:57:10 +0000 (15:57 +0000)]
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

16 years agoAdd an assert to check for empty flags for MachineMemOperand.
Dan Gohman [Wed, 16 Jul 2008 15:56:42 +0000 (15:56 +0000)]
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

16 years agoTest passing of integer parameters for integers
Duncan Sands [Wed, 16 Jul 2008 13:37:36 +0000 (13:37 +0000)]
Test passing of integer parameters for integers
of all sizes from i1 to i256.  The code is not
always that great, for example (x86)
        movw    %di, %ax
        movw    %ax, i17_s
where the store could be directly from %di.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53677 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTest codegen of loads and stores of all integer
Duncan Sands [Wed, 16 Jul 2008 13:10:20 +0000 (13:10 +0000)]
Test codegen of loads and stores of all integer
sizes from i1 to i256.  The generated code is
like one huge bug report of things that the DAG
combiner fails to simplify!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53676 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd a few cases to instcombine's extractvalue testcase.
Matthijs Kooijman [Wed, 16 Jul 2008 12:57:25 +0000 (12:57 +0000)]
Add a few cases to instcombine's extractvalue testcase.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53675 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUn-XFAIL multdeadretval, since instcombine now properly handles the mess deadargelim...
Matthijs Kooijman [Wed, 16 Jul 2008 12:56:52 +0000 (12:56 +0000)]
Un-XFAIL multdeadretval, since instcombine now properly handles the mess deadargelim leaves behind :-)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53674 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRedo InstCombiner::visitExtractValueInst. Instead of using the (complicate)
Matthijs Kooijman [Wed, 16 Jul 2008 12:55:45 +0000 (12:55 +0000)]
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

16 years agoReorder methods alphabetically. No functionality change.
Duncan Sands [Wed, 16 Jul 2008 11:41:33 +0000 (11:41 +0000)]
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

16 years agoTurn on LegalizeTypes by default.
Duncan Sands [Wed, 16 Jul 2008 11:36:51 +0000 (11:36 +0000)]
Turn on LegalizeTypes by default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53671 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't use ++idx_begin when I actually mean idx_begin + 1, especially since we
Matthijs Kooijman [Wed, 16 Jul 2008 10:47:35 +0000 (10:47 +0000)]
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

16 years agoThe atomic.cmp.swap promotion logic is wrong: it
Duncan Sands [Wed, 16 Jul 2008 08:09:48 +0000 (08:09 +0000)]
The atomic.cmp.swap promotion logic is wrong: it
simply does the atomic.cmp.swap on the larger type,
which means it blows away whatever is sitting in
the bytes just after the memory location, i.e.
causes a buffer overflow.  This really requires
target specific code, which is why LegalizeTypes
doesn't try to handle this case generically.  The
existing (wrong) code in LegalizeDAG will go away
automatically once the type legalization code is
removed from LegalizeDAG so I'm leaving it there
for the moment.  Meanwhile, don't test for this
feature.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53669 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix PR2296. Do not transform x86_sse2_storel_dq into a full-width store.
Evan Cheng [Wed, 16 Jul 2008 07:28:14 +0000 (07:28 +0000)]
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

16 years agox86-64 PIC JIT fixes: do not generate the extra load for external GV's.
Evan Cheng [Wed, 16 Jul 2008 01:34:02 +0000 (01:34 +0000)]
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

16 years agoX86-64 PIC jump table values are different from x86-32 cases, they are dest - table...
Evan Cheng [Wed, 16 Jul 2008 01:33:08 +0000 (01:33 +0000)]
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

16 years agoTargetAsmInfo::SectionForGlobal showed up in a profile. Simplify it a little.
Dan Gohman [Tue, 15 Jul 2008 18:37:51 +0000 (18:37 +0000)]
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

16 years agoSelectionDAG::AssignNodeIds is unused.
Dan Gohman [Tue, 15 Jul 2008 18:29:32 +0000 (18:29 +0000)]
SelectionDAG::AssignNodeIds is unused.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53636 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't sort SDNodes by their addresses in SelectionDAG::dump. Instead,
Dan Gohman [Tue, 15 Jul 2008 18:18:54 +0000 (18:18 +0000)]
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

16 years agoRevert this, as it seems to still be broken.
Owen Anderson [Tue, 15 Jul 2008 17:59:02 +0000 (17:59 +0000)]
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

16 years agoEnable local PRE by default.
Owen Anderson [Tue, 15 Jul 2008 16:28:23 +0000 (16:28 +0000)]
Enable local PRE by default.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53616 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoHave GVN do a pre-pass over the CFG that folds away unconditional branches where...
Owen Anderson [Tue, 15 Jul 2008 16:28:06 +0000 (16:28 +0000)]
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

16 years agoXFAIL the multdeadretval test for now, I will be fixing instcombine to make it work...
Matthijs Kooijman [Tue, 15 Jul 2008 16:05:09 +0000 (16:05 +0000)]
XFAIL the multdeadretval test for now, I will be fixing instcombine to make it work again tomorrow.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53614 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoLegalizeTypes support for fabs on ppc long double.
Duncan Sands [Tue, 15 Jul 2008 15:02:44 +0000 (15:02 +0000)]
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

16 years agoRemove a few tests which no longer hold for deadargelim (since it is now
Matthijs Kooijman [Tue, 15 Jul 2008 14:57:01 +0000 (14:57 +0000)]
Remove a few tests which no longer hold for deadargelim (since it is now
allowed to canonicalize return values).

Add a test that checks if return value and function attributes are not removed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53612 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd a testcase for the canonicalizations now performed by deadargelim.
Matthijs Kooijman [Tue, 15 Jul 2008 14:42:58 +0000 (14:42 +0000)]
Add a testcase for the canonicalizations now performed by deadargelim.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53611 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAllow deadargelim to change return types even though now values were dead. This
Matthijs Kooijman [Tue, 15 Jul 2008 14:42:31 +0000 (14:42 +0000)]
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

16 years agoRevert r53606. It turns out that explicitely tracking the liveness of the
Matthijs Kooijman [Tue, 15 Jul 2008 14:39:36 +0000 (14:39 +0000)]
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

16 years agoMake deadargelim a bit less smart, so it doesn't choke on nested structs as
Matthijs Kooijman [Tue, 15 Jul 2008 14:03:10 +0000 (14:03 +0000)]
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

16 years agoDon't use isa when we can reuse a previous dyn_cast.
Matthijs Kooijman [Tue, 15 Jul 2008 13:39:08 +0000 (13:39 +0000)]
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

16 years agoMake DeadArgElim keep liveness of the return value as a whole in addition to
Matthijs Kooijman [Tue, 15 Jul 2008 13:36:06 +0000 (13:36 +0000)]
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

16 years agoFix typo.
Matthijs Kooijman [Tue, 15 Jul 2008 13:15:10 +0000 (13:15 +0000)]
Fix typo.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53605 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoLegalizeTypes support for promotion of bswap.
Duncan Sands [Tue, 15 Jul 2008 10:18:22 +0000 (10:18 +0000)]
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

16 years agoLegalizeTypes support for promotion of SIGN_EXTEND_INREG.
Duncan Sands [Tue, 15 Jul 2008 10:14:24 +0000 (10:14 +0000)]
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

16 years agoReorder the integer promotion methods alphabetically.
Duncan Sands [Tue, 15 Jul 2008 10:12:34 +0000 (10:12 +0000)]
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

16 years agoLet DAE keep a list of live functions, instead of simply marking all arguments
Matthijs Kooijman [Tue, 15 Jul 2008 09:11:16 +0000 (09:11 +0000)]
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

16 years agoSplit DAE::MarkLive into MarkLive and PropagateLiveness.
Matthijs Kooijman [Tue, 15 Jul 2008 09:00:17 +0000 (09:00 +0000)]
Split DAE::MarkLive into MarkLive and PropagateLiveness.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53600 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPass around const RetOrArg references instead of copying values. Also, mark
Matthijs Kooijman [Tue, 15 Jul 2008 08:56:49 +0000 (08:56 +0000)]
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

16 years agoSimplify debug code by using RetOrArg::getDescription().
Matthijs Kooijman [Tue, 15 Jul 2008 08:53:36 +0000 (08:53 +0000)]
Simplify debug code by using RetOrArg::getDescription().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53598 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix indentation (intentionally left out of the previous commit).
Matthijs Kooijman [Tue, 15 Jul 2008 08:47:32 +0000 (08:47 +0000)]
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

16 years agoMove the deadargelim code for intrinsically alive functions into its own
Matthijs Kooijman [Tue, 15 Jul 2008 08:45:12 +0000 (08:45 +0000)]
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

16 years agoFixed potential bug if the source and target of a bit convert have different alignment
Mon P Wang [Tue, 15 Jul 2008 05:28:34 +0000 (05:28 +0000)]
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

16 years agoCorrect this inversion!
Nick Lewycky [Tue, 15 Jul 2008 03:47:44 +0000 (03:47 +0000)]
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

16 years agoFix up comments.
Nick Lewycky [Tue, 15 Jul 2008 03:40:27 +0000 (03:40 +0000)]
Fix up comments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53586 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFixed call stack alignment. Improved AsmPrinter alignment issues.
Bruno Cardoso Lopes [Tue, 15 Jul 2008 02:03:36 +0000 (02:03 +0000)]
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

16 years agoLinkOnce definitions have default scope, like weak definitions. Otherwise, the linker...
Devang Patel [Tue, 15 Jul 2008 00:00:11 +0000 (00:00 +0000)]
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

16 years agoGoodbye tail duplication (for good this time).
Evan Cheng [Mon, 14 Jul 2008 22:29:15 +0000 (22:29 +0000)]
Goodbye tail duplication (for good this time).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53574 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoThis replaces all $(SolutionDir) macros with $(ProjectDir)..\
Chris Lattner [Mon, 14 Jul 2008 18:46:16 +0000 (18:46 +0000)]
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

16 years agoReapply 53476 and 53480, with a fix so that it properly updates
Dan Gohman [Mon, 14 Jul 2008 18:19:29 +0000 (18:19 +0000)]
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

16 years agoFix uninitialized use of the Changed variable.
Dan Gohman [Mon, 14 Jul 2008 17:55:01 +0000 (17:55 +0000)]
Fix uninitialized use of the Changed variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53564 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImprove debug output for MemOperandSDNode. PseudoSourceValue nodes
Dan Gohman [Mon, 14 Jul 2008 17:51:24 +0000 (17:51 +0000)]
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

16 years agoFix edito in the PseudoSourceValue name list.
Dan Gohman [Mon, 14 Jul 2008 17:45:47 +0000 (17:45 +0000)]
Fix edito in the PseudoSourceValue name list.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53562 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoReformat this message to fit in 80 cols.
Dan Gohman [Mon, 14 Jul 2008 17:43:27 +0000 (17:43 +0000)]
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

16 years agoI don't think BUILD_PAIR can have a vector result.
Duncan Sands [Mon, 14 Jul 2008 17:34:19 +0000 (17:34 +0000)]
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

16 years agoTighten up some checks. Fix FPOWI splitting for
Duncan Sands [Mon, 14 Jul 2008 17:33:37 +0000 (17:33 +0000)]
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

16 years agoReapply r53540, now with the matching header!
Chris Lattner [Mon, 14 Jul 2008 17:32:59 +0000 (17:32 +0000)]
Reapply r53540, now with the matching header!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53557 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAn INSERT_VECTOR_ELT can insert a larger value
Duncan Sands [Mon, 14 Jul 2008 17:32:02 +0000 (17:32 +0000)]
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

16 years agoAccording to the docs, it is possible to have an
Duncan Sands [Mon, 14 Jul 2008 17:27:46 +0000 (17:27 +0000)]
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

16 years agoThere should be no extending loads or truncating
Duncan Sands [Mon, 14 Jul 2008 17:22:31 +0000 (17:22 +0000)]
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

16 years agoIgnore TargetConstant with an illegal type. These
Duncan Sands [Mon, 14 Jul 2008 17:15:45 +0000 (17:15 +0000)]
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

16 years agoAdded Subtarget support into RegisterInfo
Bruno Cardoso Lopes [Mon, 14 Jul 2008 14:42:54 +0000 (14:42 +0000)]
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

16 years agoRevert r53540 - it does not compile.
Duncan Sands [Mon, 14 Jul 2008 07:59:28 +0000 (07:59 +0000)]
Revert r53540 - it does not compile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53549 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoReimplement LinkFunctionProtos in terms of GetLinkageResult. This fixes
Chris Lattner [Mon, 14 Jul 2008 07:23:24 +0000 (07:23 +0000)]
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

16 years agodon't do any linkage, not even type resolution, of symbols that have
Chris Lattner [Mon, 14 Jul 2008 06:52:19 +0000 (06:52 +0000)]
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

16 years agoimplement linking of globals to functions, in one direction
Chris Lattner [Mon, 14 Jul 2008 06:49:45 +0000 (06:49 +0000)]
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

16 years agowrap long lines, remove some code from a non-assert build.
Chris Lattner [Mon, 14 Jul 2008 05:52:33 +0000 (05:52 +0000)]
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

16 years agoFix a bunch of bugs handling vector compare constant expressions, fixing
Chris Lattner [Mon, 14 Jul 2008 05:17:31 +0000 (05:17 +0000)]
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

16 years agoDocument and fix Constant::getVectorElements to return an empty vector
Chris Lattner [Mon, 14 Jul 2008 05:10:41 +0000 (05:10 +0000)]
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

16 years agoIf a function calls setjmp, never inline it into other functions. This is
Chris Lattner [Mon, 14 Jul 2008 00:46:56 +0000 (00:46 +0000)]
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

16 years agosimplify some code, shuffle and insertelt always return a vector.
Chris Lattner [Mon, 14 Jul 2008 00:32:20 +0000 (00:32 +0000)]
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

16 years agowhitespace fix.
Chris Lattner [Mon, 14 Jul 2008 00:28:45 +0000 (00:28 +0000)]
whitespace fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53537 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agodoxygenate comments and wrap to 80 cols.
Chris Lattner [Mon, 14 Jul 2008 00:27:31 +0000 (00:27 +0000)]
doxygenate comments and wrap to 80 cols.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53536 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd a note.
Chris Lattner [Mon, 14 Jul 2008 00:19:59 +0000 (00:19 +0000)]
Add a note.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53535 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix PR2506 by being a bit more careful about reverse fact propagation when
Chris Lattner [Mon, 14 Jul 2008 00:15:52 +0000 (00:15 +0000)]
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

16 years agoFix mishandling of the infinite loop case when merging two blocks. This
Chris Lattner [Sun, 13 Jul 2008 22:23:11 +0000 (22:23 +0000)]
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