Commit Graph

21957 Commits

Author SHA1 Message Date
Evan Cheng
63e3cd4e0f Remove unnecessary #include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47164 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-15 18:12:09 +00:00
Dan Gohman
21be3849ae Use StoreSDNode::getValue instead of calling getOperand directly
with a hard-coded operand number.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47163 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-15 18:11:59 +00:00
Dale Johannesen
ab1a0354ec Remove warning about 64-bit code on processor
that doesn't support it.  Per Chris.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47162 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-15 18:09:51 +00:00
Lauro Ramos Venancio
2e78b7879d It is not safe to call fork in PrintStackTrace. Sometimes it freezes the program.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47161 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-15 18:05:54 +00:00
Devang Patel
9d9b204d6a Fix PR2028
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47150 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-15 01:24:49 +00:00
Dale Johannesen
b4c9a687eb nocona, core2 and penryn support 64 bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47149 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-15 01:22:41 +00:00
Chris Lattner
b6e1dd7075 Support vector constant zeros, thanks to Zack Rusin for the testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47148 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-15 00:57:28 +00:00
Dale Johannesen
db01c8ba26 Rewrite tblgen handling of subtarget features so
it follows the order of the enum, not alphabetical.
The motivation is to make -mattr=+ssse3,+sse41
select SSE41 as it ought to.  Added "ignored"
enum values of 0 to PPC and SPU to avoid compiler
warnings.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47143 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 23:35:16 +00:00
Devang Patel
9b03daa2a3 If loop header is also loop exiting block then OrigPN is incoming value for B loop header.
Fixes PR 2030.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47141 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 23:18:47 +00:00
Dan Gohman
5a0e7b41c1 Fix a warning about comparison between signed and unsigned,
being consistent with the rest of the APInt implementation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47138 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 22:38:45 +00:00
Chris Lattner
8c5c22f610 Fix PR2029
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47129 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 19:18:13 +00:00
Chris Lattner
423be627e6 Fix a miscompilation from Dan's recent apintification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47128 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 18:48:56 +00:00
Nate Begeman
ccef580583 Fix single precision FP constants on SPU. They are actually legal,
which allows us to kill a target-specific node.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47127 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 18:43:04 +00:00
Duncan Sands
00fee65fd2 In TargetLowering::LowerCallTo, don't assert that
the return value is zero-extended if it isn't
sign-extended.  It may also be any-extended.
Also, if a floating point value was returned
in a larger floating point type, pass 1 as the
second operand to FP_ROUND, which tells it
that all the precision is in the original type.
I think this is right but I could be wrong.
Finally, when doing libcalls, set isZExt on
a parameter if it is "unsigned".  Currently
isSExt is set when signed, and nothing is
set otherwise.  This should be right for all
calls to standard library routines.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47122 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 17:28:50 +00:00
Nate Begeman
e179584f9b Change how FP immediates are handled.
1) ConstantFP is now expand by default
2) ConstantFP is not turned into TargetConstantFP during Legalize
   if it is legal.

This allows ConstantFP to be handled like Constant, allowing for 
targets that can encode FP immediates as MachineOperands.

As a bonus, fix up Itanium FP constants, which now correctly match,
and match more constants!  Hooray.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47121 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 08:57:00 +00:00
Nate Begeman
e8b7ccf0c9 Support a new type of MachineOperand, MO_FPImmediate, used for holding
FP Immediates, crazily enough


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47117 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 07:39:30 +00:00
Chris Lattner
13daadbd25 simplify code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47116 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 07:39:01 +00:00
Nate Begeman
0fec975a18 Move some useful operands up into the all-targets .td
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47115 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 07:25:46 +00:00
Nick Lewycky
95f0ba2703 Fix PR2032. Inform the alias analysis of changes to the underlying program.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47111 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 07:11:24 +00:00
Chris Lattner
eb05f90c71 upgrade some entries, remove stuff that is done.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47109 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 06:19:02 +00:00
Chris Lattner
ea1cddf546 the mid-level optimizer removes this stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47108 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 05:43:18 +00:00
Chris Lattner
48b4d96949 this one is easy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47107 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 05:41:38 +00:00
Chris Lattner
8b0cb7bcc6 This readme entry is done, testcase here: CodeGen/X86/zero-remat.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47106 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 05:39:46 +00:00
Dan Gohman
d9fe41c0c8 Allow the APInt form of ComputeMaskedBits to operate on i128 types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47101 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 23:13:32 +00:00
Dan Gohman
f4f92f5ebe Assigning an APInt to 0 with plain assignment gives it a one-bit
size. Initialize these APInts to properly-sized zero values.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47099 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 23:07:24 +00:00
Dan Gohman
72d2fd57b6 Avoid setting bits that aren't demanded.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47098 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 22:43:25 +00:00
Dan Gohman
977a76fbb6 Simplify some logic in ComputeMaskedBits. And change ComputeMaskedBits
to pass the mask APInt by value, not by reference. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47096 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 22:28:48 +00:00
Devang Patel
ea06906559 A loop latch phi node may have uses inside loop, not just in loop header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47093 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 22:23:07 +00:00
Dan Gohman
7649127ec1 Rename APInt's isPositive to isNonNegative, to reflect what it
actually does.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47090 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 22:09:18 +00:00
Devang Patel
23067dfeac While moving exit condition, do not drop loop latch on the floor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47089 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 22:06:36 +00:00
Dan Gohman
42dd77f207 Add countTrailingOnes member functions to APInt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47086 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 21:11:05 +00:00
Devang Patel
02c4836f3d Keep track of exit value operand number when operands are swapped.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 19:48:48 +00:00
Nicolas Geoffray
afe6c2b001 Enable exception handling int JIT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47079 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 18:39:37 +00:00
Duncan Sands
d462ba8539 Teach LegalizeTypes how to expand and promote CTLZ,
CTTZ and CTPOP.  The expansion code differs from
that in LegalizeDAG in that it chooses to take the
CTLZ/CTTZ count from the Hi/Lo part depending on
whether the Hi/Lo value is zero, not on whether
CTLZ/CTTZ of Hi/Lo returned 32 (or whatever the
width of the type is) for it.  I made this change
because the optimizers may well know that Hi/Lo
is zero and exploit it.  The promotion code for
CTTZ also differs from that in LegalizeDAG: it
uses an "or" to get the right result when the
original value is zero, rather than using a compare
and select.  This also means the value doesn't
need to be zero extended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47075 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 18:01:53 +00:00
Chris Lattner
a1998d1cba Fix the PPC JIT regressions by encoding zeroreg as 0 for BLR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47067 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 17:24:14 +00:00
Chris Lattner
eedcf3fc46 remove some dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47066 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 17:18:26 +00:00
Devang Patel
e45252efee Remove use of ltdl
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47065 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 17:11:39 +00:00
Wojciech Matyjewicz
a65ee03bb2 Fix typo. Thanks to Duncan for noticing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47062 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 12:21:32 +00:00
Wojciech Matyjewicz
3a4cbe2a41 Add comments as per review feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47061 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 11:51:34 +00:00
Evan Cheng
cdbcfccece Some code clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47060 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 09:56:03 +00:00
Evan Cheng
9cec00e7f1 Simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47058 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 09:13:21 +00:00
Evan Cheng
e984e504b5 Fix a potential serious problem where kills belonging to the val# defined by a two-address instruction is also on the val# that defines the input.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 09:06:18 +00:00
Evan Cheng
e35a6d1dfb * Cannot safely commute an instruction there are other defs which can reach its uses.
* Ignore copy instructions which have already been coalesced.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 08:41:08 +00:00
Chris Lattner
86ca3cacc5 In SDISel, for targets that support FORMAL_ARGUMENTS nodes, lower this
node as soon as we create it in SDISel.  Previously we would lower it in
legalize.  The problem with this is that it only exposes the argument
loads implied by FORMAL_ARGUMENTs after legalize, so that only dag combine 2
can hack on them.  This causes us to miss some optimizations because 
datatype expansion also happens here.

Exposing the loads early allows us to do optimizations on them.  For example
we now compile arg-cast.ll to:

_foo:
	movl	$2147483647, %eax
	andl	8(%esp), %eax
	ret

where we previously produced:

_foo:
	subl	$12, %esp
	movsd	16(%esp), %xmm0
	movsd	%xmm0, (%esp)
	movl	$2147483647, %eax
	andl	4(%esp), %eax
	addl	$12, %esp
	ret

It might also make sense to do this for ISD::CALL nodes, which have implicit
stores on many targets.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47054 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 07:39:09 +00:00
Chris Lattner
9f72d1a730 don't try to avoid inserting loads when lowering FORMAL_ARGUMENTS.
DAGCombine is now quite good at zapifying them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47053 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 07:35:30 +00:00
Chris Lattner
fec42eb6da teach dag combiner how to eliminate MERGE_VALUES nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47052 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 07:25:05 +00:00
Nate Begeman
b5041b3085 readme updates
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47051 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 07:06:12 +00:00
Nate Begeman
0325d90348 Support legalizing insert_vector_elt on targets where the element
type is not legal.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47048 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 06:43:04 +00:00
Evan Cheng
70071434ae Initial support for copy elimination by commuting its definition MI.
PR1877.
A3 = op A2 B0<kill>                                                                                                                                                                            
...                                                                                                                                                                                     
B1 = A3      <- this copy                                                                                                                                                                      
...                                                                                                                                                                                          
   = op A3   <- more uses                                                                                                                                                                      
                                                                                                                                                                                                 
==>                                                                                                                                                                                             
                                                                                                                                                                                            
B2 = op B0 A2<kill>                                                                                                                                                                            
...                                                                                                                                                                                          
B1 = B2      <- now an identify copy                                                                                                                                                           
...                                                                                                                                                                                          
   = op B2   <- more uses

This speeds up FreeBench/neural by 29%, Olden/bh by 12%, oopack_v1p8 by 53%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47046 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 03:01:43 +00:00
Nate Begeman
ba8d51c1d7 Make register scavenging happy by not using a reg (CR0) that isn't defined
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47045 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 02:58:33 +00:00
Evan Cheng
d2b8d7bc51 - Added removeValNo() to remove all live ranges of a particular value#.
- removeRange() can now update value# information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47044 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 02:48:26 +00:00
Evan Cheng
a4d16a1f0d commuteInstr() can now commute non-ssa machine instrs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47043 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 02:46:49 +00:00
Evan Cheng
1eb5cf9c7d Added debugging routine dumpUses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47042 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 02:45:38 +00:00
Dan Gohman
fd29e0eb06 Convert SelectionDAG::ComputeMaskedBits to use APInt instead of uint64_t.
Add an overload that supports the uint64_t interface for use by clients
that haven't been updated yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47039 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 00:35:47 +00:00
Dale Johannesen
3006c39e3a __DATA not __DATA__ is the right segment name on darwin.
Spotted by Nick Kledzik.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47037 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 23:35:09 +00:00
Nate Begeman
bf1caa9854 Remove some dead code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47036 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 22:54:40 +00:00
Nate Begeman
cdd1eeca2c SSE4.1 64b integer insert/extract pattern support
Move formats into the formats file


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47035 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 22:51:28 +00:00
Owen Anderson
30b4bd4d10 Re-apply the patch to improve the optimizations of memcpy's, with several
bugs fixed.  This now passes PPC bootstrap.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47026 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 21:15:18 +00:00
Duncan Sands
014e04a5da Generalize getCopyFromParts and getCopyToParts to
handle arbitrary precision integers and any number
of parts.  For example, on a 32 bit machine an i50
corresponds to two i32 parts.  getCopyToParts will
extend the i50 to an i64 then write half of the i64
to each part; getCopyFromParts will combine the two
i32 parts into an i64 then truncate the result to
i50.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47024 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 20:46:31 +00:00
Evan Cheng
394d28048c Revert r46916 PPCTargetAsmInfo.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47020 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 19:25:12 +00:00
Evan Cheng
9f143ce989 Only using x86-64 rip relative addressing in non-staic mode?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47019 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 19:20:46 +00:00
Wojciech Matyjewicz
7b5b76835a Fix PR2002. Suppose n is the initial value for the induction
variable (with step 1) and m is its final value. Then, the correct trip 
count is SMAX(m,n)-n. Previously, we used SMAX(0,m-n), but m-n may 
overflow and can't in general be interpreted as signed.

Patch by Nick Lewycky.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47007 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 15:09:36 +00:00
Eli Friedman
b6c36e4058 Fix for bug 1996: optimize out loads of undef. This code basically just
checks for a malloc/alloca immediately followed by a load.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47006 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 12:08:14 +00:00
Evan Cheng
add251754c Update comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47002 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 07:59:55 +00:00
Evan Cheng
5ae45caf79 Unbreak various insert_vector_elt and extract_vector_elt tests in presence of SSE4.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47001 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 07:59:45 +00:00
Nate Begeman
5bb013c34a Stuff noticed while grepping code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46979 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 23:47:56 +00:00
Duncan Sands
b988baccc2 Generalize the handling of call and return arguments,
in preparation for apint support.  These changes are
intended to have no functional effect.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46967 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 20:58:28 +00:00
Dan Gohman
cc20cd59e6 From Chris' review: use isa instead of explicitly using classof.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46964 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 19:00:34 +00:00
Dan Gohman
027ee7e3ca From Chris' review: minor corrections in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46963 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 19:00:03 +00:00
Dan Gohman
bbbbb9c3dd From Chris' review: use cast instead of dyn_cast with an assert.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46962 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 18:58:42 +00:00
Dan Gohman
debeeba6ec From Chris' review: fix 80 column violations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46961 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 18:57:43 +00:00
Wojciech Matyjewicz
a089b10421 If the LHS of the comparison is a loop-invariant we also want to move it
to the RHS. This simple change allows to compute loop iteration count 
for loops with condition similar to the one in the testcase (which seems 
to be quite common).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46959 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 18:37:34 +00:00
Ted Kremenek
1f801fa5ad Added "Profile" method to APFloat for use with FoldingSet.
Added member template "Add" to FoldingSetNodeID that allows "adding" arbitrary
objects to a profile via dispatch to FoldingSetTrait<T>::Profile().

Removed FoldingSetNodeID::AddAPFloat and FoldingSetNodeID::APInt, as their
functionality is now replaced using the above mentioned member template.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46957 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 17:24:50 +00:00
Wojciech Matyjewicz
e3320a1bcc Fix PR1798 - an error in the evaluation of SCEVAddRecExpr at an
arbitrary iteration.

The patch:
1) changes SCEVSDivExpr into SCEVUDivExpr,
2) replaces PartialFact() function with BinomialCoefficient(); the 
computations (essentially, the division) in BinomialCoefficient() are 
performed with the apprioprate bitwidth necessary to avoid overflow; 
unsigned division is used instead of the signed one.

Computations in BinomialCoefficient() require support from the code 
generator for APInts. Currently, we use a hack rounding up the 
neccessary bitwidth to the nearest power of 2. The hack is easy to turn 
off in future.

One remaining issue: we assume the divisor of the binomial coefficient 
formula can be computed accurately using 16 bits. It means we can handle 
AddRecs of length up to 9. In future, we should use APInts to evaluate 
the divisor.

Thanks to Nicholas for cooperation!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 11:03:14 +00:00
Duncan Sands
0753fc1850 Add a isBigEndian method to complement isLittleEndian.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46954 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 10:37:04 +00:00
Evan Cheng
431bfcbe37 Determine whether a spill kills the register it's spilling before insertion rather than trying to undo the kill marker afterwards.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46953 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 08:30:52 +00:00
Nate Begeman
14d12caf1d Enable SSE4 codegen and pattern matching.
Add some notes to the README.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46949 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 04:19:36 +00:00
Nate Begeman
a6ed0aa8ec additional missing feature
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46948 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 04:16:09 +00:00
Chris Lattner
916c954bf2 Fix scalarrepl to not 'miscompile' undefined code, part #2.
This fixes the store case, my previous patch just fixed the load
case.  rdar://5707076.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46932 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 19:05:37 +00:00
Nate Begeman
ab5d56c6b9 xmm0 variable blends
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46931 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 18:47:57 +00:00
Dan Gohman
6f0d024a53 Rename MRegisterInfo to TargetRegisterInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46930 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 18:45:23 +00:00
Duncan Sands
d885dbdf9e Add truncate and AssertZext result expansion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46926 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 10:08:52 +00:00
Bill Wendling
91b9ad1824 Return "(c1 + c2)" instead of yet another ADD node (which made this a
no-op).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46922 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 08:10:24 +00:00
Chris Lattner
be036a94c3 add anote
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46918 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 01:01:35 +00:00
Nick Lewycky
16b0bd6c83 Match GCC's behaviour for these sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46916 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 00:03:54 +00:00
Nate Begeman
fea2be50b9 memopv16i8 had wrong alignment requirement, would have broken pabsb
pabs{b,w,d} are not two address
fix extract-to-mem sse4 ops
add sse4 vector sign extend nodes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46915 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-09 23:46:37 +00:00
Wojciech Matyjewicz
3913187bf6 We should check that existing cast operation has the appropriate opcode before we reuse it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46908 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-09 18:30:13 +00:00
Evan Cheng
63a18c491a Remove unused hidden option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46903 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-09 08:36:28 +00:00
Nate Begeman
1426d52cab Skeleton of insert and extract matching, more to come
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46902 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-09 01:38:08 +00:00
Nate Begeman
b5af3344c1 Tablegen support for insert & extract element matching
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46901 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-09 01:37:05 +00:00
Chris Lattner
9071dd3a57 check that terminators only occur at the end of a block. This catches the
common problem of putting two terminators in the same block.  I can't write
a testcase for this because the .ll parser rejects this before the verifier
can, but this can occur when generating IR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46900 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-09 01:06:01 +00:00
Dan Gohman
6394b099e8 Change ConstantSDNode to store an APInt instead of a uint64_t, and
begin adding some methods to use it this way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46899 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 22:59:30 +00:00
Devang Patel
82ada54da0 Fix PR 1995.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46898 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 22:49:13 +00:00
Evan Cheng
f2f8c2ae07 Forgot these files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46896 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 22:05:27 +00:00
Evan Cheng
bbd8322daa Also print alignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46895 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 22:05:07 +00:00
Evan Cheng
5fd79d0560 It's not always safe to fold movsd into xorpd, etc. Check the alignment of the load address first to make sure it's 16 byte aligned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46893 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 21:20:40 +00:00
Dale Johannesen
0c191872ab 64-bit (MMX) vectors do not need restrictive alignment.
128-bit vectors need it only when SSE is on.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46890 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 19:48:20 +00:00
Dan Gohman
60783304f6 Avoid needlessly casting away const qualifiers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46877 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 03:29:40 +00:00
Dan Gohman
547ca537b6 Avoid needlessly casting away const qualifiers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46876 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 03:26:46 +00:00
Evan Cheng
33663fc104 Added missing entries in X86 load / store folding tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46866 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 00:12:56 +00:00
Evan Cheng
27240c7d50 Remove remnant of load folding in local register allocator. Patch by Holger Schurig.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46861 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 19:46:55 +00:00
Dan Gohman
3069b87437 Follow Chris' suggestion; change the PseudoSourceValue accessors
to return pointers instead of references, since this is always what
is needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46857 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 18:41:25 +00:00
Dan Gohman
4fdad172de Add SourceValue information for outgoing argument stores on x86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46854 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 16:28:05 +00:00
Dan Gohman
2bfe6ff605 Don't abort if a MemOperand is missing a SourceValue; just print it
as <unknown>. And make some minor adjustments to the MemOperand
dump format.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46853 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 16:18:00 +00:00
Evan Cheng
be3bf42331 Fix a x86-64 codegen deficiency. Allow gv + offset when using rip addressing mode.
Before:
_main:
        subq    $8, %rsp
        leaq    _X(%rip), %rax
        movsd   8(%rax), %xmm1
        movss   _X(%rip), %xmm0
        call    _t
        xorl    %ecx, %ecx
        movl    %ecx, %eax
        addq    $8, %rsp
        ret
Now:
_main:
        subq    $8, %rsp
        movsd   _X+8(%rip), %xmm1
        movss   _X(%rip), %xmm0
        call    _t
        xorl    %ecx, %ecx
        movl    %ecx, %eax
        addq    $8, %rsp
        ret

Notice there is another idiotic codegen issue that needs to be fixed asap:
xorl    %ecx, %ecx
movl    %ecx, %eax


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46850 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 08:53:49 +00:00
Evan Cheng
15246738f2 In some cases, e.g. ADD32ri, no transformation is made. Guide against it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46849 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 08:29:53 +00:00
Nick Lewycky
33d4f7792f Don't make up new directives. (".set_foobar")
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46848 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 06:36:26 +00:00
Dan Gohman
b3f5cfc670 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46836 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 02:30:40 +00:00
Dan Gohman
167b8bc24d Add support to FoldingSet for hashing APInt objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46833 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 23:09:15 +00:00
Dan Gohman
69de1932b3 Re-apply the memory operand changes, with a fix for the static
initializer problem, a minor tweak to the way the
DAGISelEmitter finds load/store nodes, and a renaming of the
new PseudoSourceValue objects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46827 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 22:27:42 +00:00
Bill Wendling
e00fec554b Temporarily reverting:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080128/057882.html

This is causing a miscompilation on PPC G5 and just now seeing it on iMac x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46822 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 20:03:07 +00:00
Evan Cheng
2fc628d662 Fix a number of local register allocator issues: PR1609.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46821 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 19:16:53 +00:00
Evan Cheng
22ff3eeebe RegAllocaLocal still *requires* LiveVariables since it runs PHIElimination, followed by TwoAddress which requires LiveVariables. We cannot run LiveVariables on non-SSA code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46813 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 08:00:32 +00:00
Tanya Lattner
63aa160b27 Throttle the non-local dependence analysis for basic blocks with more than 50 predecessors. Added command line option to play with this threshold.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46790 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 00:54:55 +00:00
Evan Cheng
a58891ff1e Fix PR1975: dag isel emitter produces patterns that isel wrong flag result.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46776 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 22:50:29 +00:00
Evan Cheng
ebaaa91094 Move to getCALLSEQ_END to ensure CALLSEQ_END node produces a flag. This is consistent with the definition in td file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46775 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 22:44:06 +00:00
Chris Lattner
2663ffe751 Make RenamePass faster by making the 'is this a new phi node'
check more intelligent.  This speeds up mem2reg from 5.29s to 
0.79s on a synthetic testcase with tons of predecessors and
phi nodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 21:26:23 +00:00
Dale Johannesen
e672af15d6 Implement sseregparm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46764 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 20:46:33 +00:00
Evan Cheng
bb4151bd1f If a vr is already marked alive in a bb, then it has PHI uses that are visited earlier, then it is not killed in the def block (i.e. not dead).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46763 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 20:04:18 +00:00
Nate Begeman
5a804e3e21 Ident mnemonics appropriately
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46746 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 08:49:09 +00:00
Chris Lattner
7c95debb49 Fix a bug compiling PR1978 (perhaps not the only one though) which
was incorrectly simplifying "x == (gep x, 1, i)" into false, even 
though i could be negative.  As it turns out, all the code to 
handle this already existed, we just need to disable the incorrect
optimization case and let the general case handle it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46739 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 04:45:32 +00:00
Owen Anderson
a8701a6c62 Fix an obscure read-after-free bug that Duncan found.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46738 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 04:34:03 +00:00
Evan Cheng
fc718542a3 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46725 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 23:10:38 +00:00
Evan Cheng
4e3f5a4e9c Dwarf requires variable entries to be in the source order. Right now, since we are recording variable information at isel time this means parameters would appear in the reverse order. The short term fix is to issue recordVariable() at asm printing time instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46724 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 23:06:48 +00:00
Nate Begeman
c451ac0a42 This method should be virtual
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46723 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 23:04:24 +00:00
Nate Begeman
48a65511d0 Eliminate some redundant code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46720 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 21:44:06 +00:00
Ted Kremenek
26e3c445fc Added "bucket_iterators" to FoldingSet. Bucket iterators allow iteration
over all the nodes in a particular bucket.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 21:11:17 +00:00
Devang Patel
a1e4bba98a Set error message.
Patch by Shantonu Sen.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46715 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 20:57:54 +00:00
Ted Kremenek
27a8e0dc2f Fixed 80 col. violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46709 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 17:14:20 +00:00
Duncan Sands
6cb7e6d36b I don't see how NodeUpdated can be called with a
ReadyToProcess node - add an assertion to check
this.  Add an assertion to NodeDeleted that checks
that processed/ready nodes are indeed not deleted.
It is because they are never deleted that none of
the maps can have a deleted node as the source of
a mapping.  It does however seem to be possible in
theory to have a deleted value as the target of a
mapping, however this has not yet been spotted in
the wild.  Still mulling on what to do about this.
[The theoretical situation is this: a node A is
expanded/promoted/whatever to a newly created node
B.  Thus A->B is added to a map.  When the subtree
rooted at B is legalized it is conceivable that B
is deleted due to RAUW on a node somewhere above
it].


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46705 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 09:29:17 +00:00
Nate Begeman
204e84e138 The rest of the SSE4.1 intrinsic patterns that are obvious to me. Getting
Evan's help with the rest.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46697 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 06:00:24 +00:00
Nate Begeman
2f6f1c02ca Some more SSE 4.1 intrinsic patterns.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46696 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 05:34:34 +00:00
Owen Anderson
c69ace3a64 Be more precise when eliminating pointers bue to memcpy's. This allows more
stores to be deleted in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46694 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 04:53:00 +00:00
Owen Anderson
6f7a52d300 Allow GVN to hack on memcpy's, making them open to further optimization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46693 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 02:59:58 +00:00
Nick Lewycky
5be2920149 There are some cases where icmp(add) can be folded into a new icmp. Handle them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 16:33:09 +00:00
Nick Lewycky
0c2c3f6e81 Hack on vectors too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46684 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 08:19:11 +00:00
Nick Lewycky
b6eabff169 Fold away one multiply in instcombine. This would normally be caught in
reassociate anyways, but they could be generated during instcombine's run.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46683 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 07:42:09 +00:00
Chris Lattner
9d3e5d476c Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46682 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 07:30:27 +00:00
Nate Begeman
63ec90a6a8 SSE 4.1 Intrinsics and detection
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46681 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 07:18:54 +00:00
Chris Lattner
fcd8e9e3a2 handle the case where a node can become ready to process
multiple times due to a RAUW.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46680 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 07:13:32 +00:00
Chris Lattner
42bd25f8ec Use the new infrastructure for listening to node updates to
keep the LegalizeTypes node flags up to date when doing a RAUW.
This fixes a nasty bug that Duncan ran into and makes the 
previous (nonbuggy case) more efficent.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46679 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 07:08:51 +00:00
Chris Lattner
d8cd3be370 the world doesn't need my debugging code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46678 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 07:01:05 +00:00
Chris Lattner
f8dc0617ba Change the 'global modification' APIs in SelectionDAG to take a new
DAGUpdateListener object pointer instead of just returning a vector 
of deleted nodes.  This makes the interfaces more efficient (no more
allocating a vector [at least a malloc], filling it in, then walking
it) and more clean.  This also allows the client to be notified of
nodes that are *changed* but not deleted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46677 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 06:49:24 +00:00
Chris Lattner
3d62d780ab explicitly include Compiler.h instead of getting it from tblgen in the middle of a class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46676 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 05:43:57 +00:00
Chris Lattner
11d049c87f Generalize the SDOperand->SDOperand form of
SelectionDAG::ReplaceAllUsesWith to handle replacement of
an SDOperand with *any* sdoperand, not just one for a node with
a single result.  Note that this has a horrible FIXME'd hack in it
to work around PR1975.  This should be removed when PR1975 is fixed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46674 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 03:35:22 +00:00
Chris Lattner
a47b9bcbde don't do ReplaceUses on a result that doesn't exist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46673 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 03:20:59 +00:00
Chris Lattner
a658baba78 add a -view-legalize-types-dags option, for viewing the dags going into legalize types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46672 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 02:05:04 +00:00
Evan Cheng
4eecdeb3fa Get rid of the annoying blank lines before labels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46667 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-02 08:39:46 +00:00
Nick Lewycky
916a9f071f Don't use uninitialized values. Fixes vec_align.ll on X86 Linux.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46666 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-02 08:29:58 +00:00
Evan Cheng
fcf5d4f456 Unbreak ppc debug support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46665 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-02 05:06:29 +00:00
Evan Cheng
a844bdeab3 SDIsel processes llvm.dbg.declare by recording the variable debug information descriptor and its corresponding stack frame index in MachineModuleInfo. This only works if the local variable is "homed" in the stack frame. It does not work for byval parameter, etc.
Added ISD::DECLARE node type to represent llvm.dbg.declare intrinsic. Now the intrinsic calls are lowered into a SDNode and lives on through out the codegen passes.
For now, since all the debugging information recording is done at isel time, when a ISD::DECLARE node is selected, it has the side effect of also recording the variable. This is a short term solution that should be fixed in time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46659 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-02 04:07:54 +00:00
Devang Patel
1cf47cb217 Add comment explaining what is lower level analysis pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46658 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-02 01:43:30 +00:00
Gordon Henriksen
e62a8a353c Fixing a bug creating floating point constants of type other
than double through the C bindings. Thanks to Tomas Lindquist
Olsen for reporting it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46656 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-02 01:07:50 +00:00
Evan Cheng
b8033e821d Frame index can be negative.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46655 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-02 00:17:00 +00:00
Lauro Ramos Venancio
859efca7f9 CBackend: Implement unaligned load/store.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46646 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 21:25:59 +00:00
Duncan Sands
532d022794 Don't drop function/call return attributes like 'nounwind'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46645 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 20:37:16 +00:00
Evan Cheng
1b08bbca55 Remove the nasty LABEL hack with a much less evil one. Now llvm.dbg.func.start implies a stoppoint is set. SelectionDAGISel records a new source line but does not create a ISD::LABEL node for this special stoppoint. Asm printer will magically print this label. This ensures nothing is emitted before.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46635 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 09:10:45 +00:00
Evan Cheng
a647c92ec2 Rename RecordLabel to RecordSourceLine because that's what it is doing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46628 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 02:05:57 +00:00
Evan Cheng
334dc1f58d Revert 46556 and 46585. Dan please fix the PseudoSourceValue problem and re-commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46623 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 21:00:00 +00:00
Dale Johannesen
b63fa050b7 Chris' change to print an approximation to long doubles
exposed a bug in APFloat's long double->double conversion of
NaNs.  Broke several things in the ieee part of gcc testsuite.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46617 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 18:34:01 +00:00
Evan Cheng
7bdc5f734f Add a comment for a nasty short term hack.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46610 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 10:05:13 +00:00
Evan Cheng
bb81d97feb Add an extra operand to LABEL nodes which distinguishes between debug, EH, or misc labels. This fixes the EH breakage. However I am not convinced this is *the* solution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46609 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 09:59:15 +00:00
Christopher Lamb
8535624739 Allow ComplexExpressions in InstrInfo.td files to be slightly more... complex! ComplexExpressions can now have attributes which affect how TableGen interprets
the pattern when generating matchin code. 

The first (and currently, only) attribute causes the immediate parent node of the ComplexPattern operand to be passed into the matching code rather than the node at the root of the entire DAG containing the pattern.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46606 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 07:27:46 +00:00
Christopher Lamb
175e81598a Add more thorough error checking for NULL register classes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46605 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 07:09:08 +00:00
Evan Cheng
c67aa7cbd5 Add x86 specific getFrameIndexOffset(). This fixes local variable debugging info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 04:06:00 +00:00
Evan Cheng
72bebb9205 MRegisterInfo::getLocation() is a really bad idea. Its function is to calculate the offset from frame pointer to a stack slot and then storing the delta in a MachineLocation object. The name is bad (it implies a getter), and MRegisterInfo doesn't need to know about MachineLocation.
Replace getLocation() with getFrameIndexOffset() which returns the delta from frame pointer to stack slot. Dwarf writer can then use the information for whatever it wants.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46597 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 03:37:28 +00:00
Evan Cheng
0a75538a68 Makes the same change in ppc backend: avoid inserting prologue before debug labels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46596 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 03:33:38 +00:00
Dan Gohman
fa9b80eb64 Avoid unnecessarily casting away const, fixing a FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 01:05:10 +00:00
Dan Gohman
bbfb9c57c7 Avoid unnecessarily casting away const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46590 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 01:01:48 +00:00
Dan Gohman
1a0248690a Rename ISD::FLT_ROUNDS to ISD::FLT_ROUNDS_ to avoid conflicting
with the real FLT_ROUNDS (defined in <float.h>).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46587 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 00:41:03 +00:00
Evan Cheng
00dff8dda2 Also avoid adding callee save code before debug labels.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46586 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 00:27:49 +00:00
Dan Gohman
c6c391dadd Create a new class, MemOperand, for describing memory references
in the backend. Introduce a new SDNode type, MemOperandSDNode, for
holding a MemOperand in the SelectionDAG IR, and add a MemOperand
list to MachineInstr, and code to manage them. Remove the offset
field from SrcValueSDNode; uses of SrcValueSDNode that were using
it are all all using MemOperandSDNode now.

Also, begin updating some getLoad and getStore calls to use the
PseudoSourceValue objects.

Most of this was written by Florian Brander, some
reorganization and updating to TOT by me.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46585 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 00:25:39 +00:00
Evan Cheng
294e652491 Fixed a bug in MergeValueInAsValue() pointed out by David Greene. Replace val# with previous liverange's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46579 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 22:44:55 +00:00
Evan Cheng
965d1b4bba Treat the label for the first @llvm.dbg.stoppoint the same way as the dbg_func_start label. Make sure nothing else is inserted before them.
Note this solution might be somewhat fragile since ISD::LABEL may be used for other
purposes. If that ends up to be an issue, we may need to introduce a different node
for debug labels.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46571 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 20:08:35 +00:00
Dale Johannesen
43b8f3b7d3 Adjust loop per review feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46569 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 19:44:39 +00:00
Evan Cheng
6b2cf285bd A semi-gross fix for a debug info issue. When inserting the "function start" label (i.e. first label in the entry block) take care to insert it at the beginning of the block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46568 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 19:35:32 +00:00
Dale Johannesen
7757fff6ae Accept getelementptr starting at GV with all 0 indices as a
legitimate way of representing global variable GV in debug info.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46565 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 19:00:21 +00:00
Evan Cheng
ff9b373e8f Even though InsertAtEndOfBasicBlock is an ugly hack it still deserves a proper name. Rename it to EmitInstrWithCustomInserter since it does not necessarily insert
instruction at the end.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46562 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 18:18:23 +00:00
Dan Gohman
f38dc192dd Add a new PseudoSourceValue class, which will be used to help track
memory reference information in the backend. Most of this was written by
Florian Brander, cleanup and updating to TOT by me.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46556 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 16:35:31 +00:00
Nick Lewycky
b4b0417220 Remove a couple more cases of "getNumUses() == 0". No need to walk the linked
list just to see if whether the list is empty.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46555 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 08:01:28 +00:00
Nick Lewycky
c7444498ee Use empty() instead of comparing size() with zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46554 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 07:54:16 +00:00
Nick Lewycky
d29ce1783c Don't DCE FreeInst's. We were using those! Patch from Owen Anderson.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46553 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 07:45:37 +00:00
Evan Cheng
d2c860cef1 Skip over the label which marks the beginning of the function before inserting prologue code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 03:57:33 +00:00
Scott Michel
15dcd8e19d Back out mods to llvmAsmParser, incorrectly committed
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46545 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 03:10:00 +00:00
Scott Michel
7f9ba9bb3c More cleanups for CellSPU:
- Expand tabs... (poss 80-col violations, will get them later...)
- Consolidate logic for SelectDFormAddr and SelectDForm2Addr into a single
  function, simplifying maintenance. Also reduced custom instruction
  generation for SPUvecinsert/INSERT_MASK.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46544 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 02:55:46 +00:00
Owen Anderson
772601a885 Make DSE much more aggressive by performing DCE earlier. Update a testcase to reflect this increased aggressiveness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46542 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 01:24:47 +00:00
Owen Anderson
9a8ff8cd0f Fix an issue where, under very specific circumstances, memdep could end up dereferencing the end
of one of its internal maps.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46541 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 01:24:05 +00:00
Chris Lattner
b10e0da065 Fix a bug where scalarrepl would discard offset if type would match.
In practice this can only happen on code with already undefined behavior, 
but this is still a good thing to handle correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46539 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 00:39:15 +00:00
Dan Gohman
b625f2f896 Factor the addressing mode and the load/store VT out of LoadSDNode
and StoreSDNode into their common base class LSBaseSDNode. Member
functions getLoadedVT and getStoredVT are replaced with the common
getMemoryVT to simplify code that will handle both loads and stores.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46538 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 00:15:11 +00:00
Evan Cheng
0d9e976ad2 Work in progress. This patch *fixes* x86-64 calls which are modelled as StructRet but really should be return in registers, e.g. _Complex long double, some 128-bit aggregates. This is a short term solution that is necessary only because llvm, for now, cannot model i128 nor call's with multiple results.
Status: This only works for direct calls, and only the caller side is done. Disabled for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46527 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 19:34:22 +00:00
Duncan Sands
648f880dc9 When expanding an operand, it's not the result value
type that matters but the operand type.  This fixes
2008-01-08-IllegalCMP.ll which crashed with the new
legalize infrastructure because SETCC with result
type i8 and operand type i64 was being custom expanded
by the X86 backend.  With this fix, the gcc build gets
as far as the first libcall.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46525 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 19:29:08 +00:00
Chris Lattner
c69d3c9442 Don't let globalopt hack on volatile loads or stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46523 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 19:01:37 +00:00
Dan Gohman
3035959425 Use empty() instead of comparing size() with zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46514 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 13:02:09 +00:00
Dan Gohman
9f65c39f80 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 12:43:50 +00:00
Dan Gohman
97cf759b82 Fix 80-col violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46510 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 12:09:55 +00:00
Dan Gohman
b10abe1e8c Remove top-level const qualifiers from casts, avoiding associated
compiler warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46509 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 12:08:20 +00:00
Dan Gohman
6ee9661390 Fix a typo in a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46508 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 12:07:11 +00:00
Dan Gohman
1327f69d98 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 11:36:12 +00:00
Chris Lattner
2454a2e0c3 eliminate additions of 0.0 when they are obviously dead. This has to be careful to
avoid turning -0.0 + 0.0 -> -0.0 which is incorrect.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 06:52:45 +00:00
Duncan Sands
d102593b42 Use getPreferredAlignmentLog or getPreferredAlignment
to get the alignment of global variables, rather than
using hand-made versions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46495 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 06:23:44 +00:00
Owen Anderson
a34d8a0d83 Add support for eliminating memcpy's at the end of functions. Also fix some errors I noticed in
the handling of eliminating stores to byval arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 06:18:36 +00:00
Owen Anderson
8822eabe36 RegAllocBigBlock doesn't need LiveVariables either.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46488 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 02:32:13 +00:00
Nate Begeman
55030dc460 Properly expand extract-element for non-power-of-2 codegen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46486 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 02:24:00 +00:00
Dale Johannesen
ba2a0b960e Handle 'X' constraint in asm's better.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46485 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 02:21:21 +00:00
Devang Patel
c840da14c6 Filter loops that subtract induction variables.
These loops are not yet handled.

Fix PR 1912.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46484 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 02:20:41 +00:00
Scott Michel
053c1da8d9 Overhaul Cell SPU's addressing mode internals so that there are now
only two addressing mode nodes, SPUaform and SPUindirect (vice the
three previous ones, SPUaform, SPUdform and SPUxform). This improves
code somewhat because we now avoid using reg+reg addressing when
it can be avoided. It also simplifies the address selection logic,
which was the main point for doing this.

Also, for various global variables that would be loaded using SPU's
A-form addressing, prefer D-form offs[reg] addressing, keeping the
base in a register if the variable is used more than once.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46483 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 02:16:57 +00:00
Lauro Ramos Venancio
42f6e455de Simplify the code and fix a typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46458 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-28 20:02:51 +00:00
Lauro Ramos Venancio
599ddf9a76 Fix fpcmp infinite loop when comparing "29-266" with "29-268".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46455 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-28 18:23:23 +00:00
Bill Wendling
200e90c74b If the function has no machine instructions, then emit a "nop" so that
the function label isn't associated with something it shouldn't be.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46449 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-28 09:15:03 +00:00
Chris Lattner
0818ea8317 Transform calls to memcpy into llvm.memcpy calls, patch by Eli Friedman.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46433 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-28 04:41:43 +00:00
Nick Lewycky
4189a538e4 Handle some more combinations of extend and icmp. Fixes PR1940.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46431 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-28 03:48:02 +00:00
Chris Lattner
25feae555d Fix PR1932 by disabling an xform invalid for fdiv.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46429 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-28 00:58:18 +00:00
Chris Lattner
05bb789430 Fix PR1938 by forcing the code that uses an undefined value to branch one
way or the other.  Rewriting the code itself prevents subsequent analysis
passes from making contradictory conclusions about the code that could 
cause an infeasible path to be made feasible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46427 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-28 00:32:30 +00:00
Chris Lattner
f32aac3090 Fix PowerPC/./2007-10-18-PtrArithmetic.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46424 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 23:32:17 +00:00
Chris Lattner
ee339f4b2a fix a crash on CodeGen/X86/vector-rem.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46422 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 23:21:58 +00:00
Owen Anderson
c66a4f912f Reg alloc doesn't really need LiveVariables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46420 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 22:00:00 +00:00
Nick Lewycky
c837abee2f Be more careful modifying the use_list while also iterating through it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46417 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 18:35:00 +00:00
Duncan Sands
d82375c1c4 Revert r46393: readonly/readnone functions are no
longer allowed to write through byval arguments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46416 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 18:12:58 +00:00
Chris Lattner
3bd39d4ca8 Implement some dag combines that allow doing fneg/fabs/fcopysign in integer
registers if used by a bitconvert or using a bitconvert.  This allows us to
avoid constant pool loads and use cheaper integer instructions when the
values come from or end up in integer regs anyway.  For example, we now 
compile CodeGen/X86/fp-in-intregs.ll to:

_test1:
	movl	$2147483648, %eax
	xorl	4(%esp), %eax
	ret
_test2:
	movl	$1065353216, %eax
	orl	4(%esp), %eax
	andl	$3212836864, %eax
	ret

Instead of:
_test1:
	movss	4(%esp), %xmm0
	xorps	LCPI2_0, %xmm0
	movd	%xmm0, %eax
	ret
_test2:
	movss	4(%esp), %xmm0
	andps	LCPI3_0, %xmm0
	movss	LCPI3_1, %xmm1
	andps	LCPI3_2, %xmm1
	orps	%xmm0, %xmm1
	movd	%xmm1, %eax
	ret

bitconverts can happen due to various calling conventions that require
fp values to passed in integer regs in some cases, e.g. when returning
a complex.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46414 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 17:42:27 +00:00
Chris Lattner
f6b935d8e6 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46413 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 07:31:41 +00:00
Chris Lattner
71d07a0dac Use fldz and fld1 for long double constants instead of a constant pool load.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46411 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 06:19:31 +00:00
Bill Wendling
beefd3d0f8 The CorrelatedExpressionElimination pass is known to be buggy. Remove it.
This fixes PR1769.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46408 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 06:11:41 +00:00
Chris Lattner
553c116a1b For long double constants, print an approximation of their value to the .s file to make it easier to read.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46407 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 06:09:28 +00:00
Chris Lattner
b753065f6d Fold fptrunc(add (fpextend x), (fpextend y)) -> add(x,y), as GCC does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46406 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-27 05:29:54 +00:00
Chris Lattner
4d53049c92 Add some notes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46405 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 20:12:07 +00:00
Chris Lattner
ba96fbc164 Remove some code for inferring alignment info from the x86 backend
now that the dag combiner does it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46404 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 20:07:42 +00:00
Chris Lattner
1329cb8d89 Infer alignment of loads and increase their alignment when we can tell they are
from the stack.  This allows us to compile stack-align.ll to:

_test:
	movsd	LCPI1_0, %xmm0
	movapd	%xmm0, %xmm1
***	andpd	4(%esp), %xmm1
	andpd	_G, %xmm0
	addsd	%xmm1, %xmm0
	movl	20(%esp), %eax
	movsd	%xmm0, (%eax)
	ret

instead of:

_test:
	movsd	LCPI1_0, %xmm0
**	movsd	4(%esp), %xmm1
**	andpd	%xmm0, %xmm1
	andpd	_G, %xmm0
	addsd	%xmm1, %xmm0
	movl	20(%esp), %eax
	movsd	%xmm0, (%eax)
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46401 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 19:45:50 +00:00
Bill Wendling
824a721560 If there's no instructions being emitted on X86 for a function, emit a
nop. Emit the nop directly for PPC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46398 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 09:03:52 +00:00
Bill Wendling
381802f8e0 If there are no machine instructions emitted for a function, then insert
a "nop" instruction so that we don't have the function's label associated
with something that it's not supposed to be associated with.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 06:51:24 +00:00
Duncan Sands
418ab3729c Create an explicit copy for byval parameters even
when inlining a readonly function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46393 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 06:41:49 +00:00
Bill Wendling
f69d5d7398 If we have a function like this:
void bork() {
  int *address = 0;
  *address = 0;
}

It's compiled into LLVM code that looks like this:

define void @bork() noreturn nounwind  {
entry:
        unreachable
}

This is bad on some platforms (like PPC) because it will generate the label for
the function but no body. The label could end up being associated with some
non-code related stuff, like a section. This places a "trap" instruction if the
SimplifyCFG pass removed all code from the function leaving only one
"unreachable" instruction.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46387 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 01:43:44 +00:00
Chris Lattner
5eee427594 Fix some bugs in SimplifyNodeWithTwoResults where it would call deletenode to
delete a node even if it was not dead in some cases.  Instead, just add it to
the worklist.  Also, make sure to use the CombineTo methods, as it was doing
things that were unsafe: the top level combine loop could touch dangling memory.

This fixes CodeGen/Generic/2008-01-25-dag-combine-mul.ll



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46384 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 01:09:19 +00:00
Chris Lattner
9967c15183 don't bother making x&-1 only to simplify it in dag combine. This commonly occurs expanding i64 ops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46383 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 01:05:42 +00:00
Chris Lattner
50d8e491a2 reduce indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46377 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 23:34:24 +00:00
Duncan Sands
255bd2852b Do this more neatly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46369 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 22:06:51 +00:00
Chris Lattner
5bab78527a fix long lines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46355 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 17:24:52 +00:00
Chris Lattner
1910e2f3ec JITEmitter.cpp was trying to sync the icache for function stubs, but
was actually passing a completely incorrect size to sys_icache_invalidate.
Instead of having the JITEmitter do this (which doesn't have the correct 
size), just make the target sync its own stubs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 16:41:09 +00:00
Owen Anderson
e3c36f6758 DeadStoreElimination can treat byval parameters as if there were alloca's for the purpose of removing end-of-function stores.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46351 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 10:10:33 +00:00
Chris Lattner
00161a63dd Add skeletal code to increase the alignment of loads and stores when
we can infer it.  This will eventually help stuff, though it doesn't
do much right now because all fixed FI's have an alignment of 1.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46349 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 07:20:16 +00:00
Chris Lattner
1612faae3c move MachineFrameInfo::CreateFixedObject out of line, give MachineFrameInfo
a reference to TargetFrameInfo.  Rearrange order of fields in StackObject to
save a word.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46348 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 07:19:06 +00:00
Chris Lattner
94ffc7eb46 include alignment and volatility information in -view-*-dags output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46347 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 06:40:45 +00:00
Chris Lattner
6cf73267c6 optimize fxor like for
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46345 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 06:14:17 +00:00
Chris Lattner
af723b9ae4 Add target-specific dag combines for FAND(x,0) and FOR(x,0). This allows
us to compile:

double test(double X) {
  return copysign(0.0, X);
}

into:

_test:
	andpd	LCPI1_0(%rip), %xmm0
	ret

instead of:
_test:
	pxor	%xmm1, %xmm1
	andpd	LCPI1_0(%rip), %xmm1
	movapd	%xmm0, %xmm2
	andpd	LCPI1_1(%rip), %xmm2
	movapd	%xmm1, %xmm0
	orpd	%xmm2, %xmm0
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46344 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 05:46:26 +00:00
Anton Korobeynikov
8eea339298 Provide correct DWARF register numbering for debug information emission on x86-32/Darwin.
This should fix bunch of issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46337 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 00:34:13 +00:00
Chris Lattner
40743b83bf Don't dump the function!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46320 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-24 19:28:11 +00:00
Chris Lattner
d087480166 getUnderlyingObject can return null, handle this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46318 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-24 19:07:10 +00:00
Chris Lattner
fd68750038 Teach basicaa that 'byval' arguments define a new memory location that
can't be aliased to other known objects.  This allows us to know that byval 
pointer args don't alias globals, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46315 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-24 18:00:32 +00:00
Chris Lattner
de6fa5f25f Add hasByValAttr() and hasNoAliasAttr() methods to the Argument class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46314 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-24 17:47:11 +00:00
Chris Lattner
23e202dee0 clarify a comment, thanks Duncan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-24 17:10:01 +00:00
Chris Lattner
d43d00cf3a Significantly simplify and improve handling of FP function results on x86-32.
This case returns the value in ST(0) and then has to convert it to an SSE
register.  This causes significant codegen ugliness in some cases.  For 
example in the trivial fp-stack-direct-ret.ll testcase we used to generate:

_bar:
	subl	$28, %esp
	call	L_foo$stub
	fstpl	16(%esp)
	movsd	16(%esp), %xmm0
	movsd	%xmm0, 8(%esp)
	fldl	8(%esp)
	addl	$28, %esp
	ret

because we move the result of foo() into an XMM register, then have to
move it back for the return of bar.

Instead of hacking ever-more special cases into the call result lowering code
we take a much simpler approach: on x86-32, fp return is modeled as always 
returning into an f80 register which is then truncated to f32 or f64 as needed.
Similarly for a result, we model it as an extension to f80 + return.

This exposes the truncate and extensions to the dag combiner, allowing target
independent code to hack on them, eliminating them in this case.  This gives 
us this code for the example above:

_bar:
	subl	$12, %esp
	call	L_foo$stub
	addl	$12, %esp
	ret

The nasty aspect of this is that these conversions are not legal, but we want
the second pass of dag combiner (post-legalize) to be able to hack on them.
To handle this, we lie to legalize and say they are legal, then custom expand
them on entry to the isel pass (PreprocessForFPConvert).  This is gross, but
less gross than the code it is replacing :)

This also allows us to generate better code in several other cases.  For 
example on fp-stack-ret-conv.ll, we now generate:

_test:
	subl	$12, %esp
	call	L_foo$stub
	fstps	8(%esp)
	movl	16(%esp), %eax
	cvtss2sd	8(%esp), %xmm0
	movsd	%xmm0, (%eax)
	addl	$12, %esp
	ret

where before we produced (incidentally, the old bad code is identical to what
gcc produces):

_test:
	subl	$12, %esp
	call	L_foo$stub
	fstpl	(%esp)
	cvtsd2ss	(%esp), %xmm0
	cvtss2sd	%xmm0, %xmm0
	movl	16(%esp), %eax
	movsd	%xmm0, (%eax)
	addl	$12, %esp
	ret

Note that we generate slightly worse code on pr1505b.ll due to a scheduling 
deficiency that is unrelated to this patch.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46307 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-24 08:07:48 +00:00