oota-llvm.git
16 years agoThe CorrelatedExpressionElimination pass is known to be buggy. Remove it.
Bill Wendling [Sun, 27 Jan 2008 06:11:41 +0000 (06:11 +0000)]
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

16 years agoFor long double constants, print an approximation of their value to the .s file to...
Chris Lattner [Sun, 27 Jan 2008 06:09:28 +0000 (06:09 +0000)]
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

16 years agoFold fptrunc(add (fpextend x), (fpextend y)) -> add(x,y), as GCC does.
Chris Lattner [Sun, 27 Jan 2008 05:29:54 +0000 (05:29 +0000)]
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

16 years agoAdd some notes.
Chris Lattner [Sat, 26 Jan 2008 20:12:07 +0000 (20:12 +0000)]
Add some notes.

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

16 years agoRemove some code for inferring alignment info from the x86 backend
Chris Lattner [Sat, 26 Jan 2008 20:07:42 +0000 (20:07 +0000)]
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

16 years agoNew test to verify that "merging 4 loads into a vec load" continues to work and
Chris Lattner [Sat, 26 Jan 2008 20:06:45 +0000 (20:06 +0000)]
New test to verify that "merging 4 loads into a vec load" continues to work and
continues to infer alignment info.

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

16 years agomake this 64-bit safe
Chris Lattner [Sat, 26 Jan 2008 19:50:30 +0000 (19:50 +0000)]
make this 64-bit safe

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

16 years agoInfer alignment of loads and increase their alignment when we can tell they are
Chris Lattner [Sat, 26 Jan 2008 19:45:50 +0000 (19:45 +0000)]
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

16 years agoremove a useless xfailed test.
Chris Lattner [Sat, 26 Jan 2008 19:35:46 +0000 (19:35 +0000)]
remove a useless xfailed test.

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

16 years agoInvert this test, because it is wrong if we allow
Duncan Sands [Sat, 26 Jan 2008 12:33:01 +0000 (12:33 +0000)]
Invert this test, because it is wrong if we allow
readonly functions to use byval parameters as local
storage (how much do we want this?).

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

16 years agoIf there's no instructions being emitted on X86 for a function, emit a
Bill Wendling [Sat, 26 Jan 2008 09:03:52 +0000 (09:03 +0000)]
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

16 years agoNeed to convert to LLVM code and not C.
Bill Wendling [Sat, 26 Jan 2008 06:56:08 +0000 (06:56 +0000)]
Need to convert to LLVM code and not C.

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

16 years agoRename the .c to .ll
Bill Wendling [Sat, 26 Jan 2008 06:53:40 +0000 (06:53 +0000)]
Rename the .c to .ll

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

16 years agoMove testcase to the code gen directory.
Bill Wendling [Sat, 26 Jan 2008 06:53:06 +0000 (06:53 +0000)]
Move testcase to the code gen directory.

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

16 years agoIf there are no machine instructions emitted for a function, then insert
Bill Wendling [Sat, 26 Jan 2008 06:51:24 +0000 (06:51 +0000)]
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

16 years agoCreate an explicit copy for byval parameters even
Duncan Sands [Sat, 26 Jan 2008 06:41:49 +0000 (06:41 +0000)]
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

16 years agoIf we have a function like this:
Bill Wendling [Sat, 26 Jan 2008 01:43:44 +0000 (01:43 +0000)]
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

16 years agoAdd another testcase.
Devang Patel [Sat, 26 Jan 2008 01:21:48 +0000 (01:21 +0000)]
Add another testcase.

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

16 years agoFix some bugs in SimplifyNodeWithTwoResults where it would call deletenode to
Chris Lattner [Sat, 26 Jan 2008 01:09:19 +0000 (01:09 +0000)]
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

16 years agodon't bother making x&-1 only to simplify it in dag combine. This commonly occurs...
Chris Lattner [Sat, 26 Jan 2008 01:05:42 +0000 (01:05 +0000)]
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

16 years agoNew test case.
Evan Cheng [Sat, 26 Jan 2008 00:35:43 +0000 (00:35 +0000)]
New test case.

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

16 years agoreduce indentation
Chris Lattner [Fri, 25 Jan 2008 23:34:24 +0000 (23:34 +0000)]
reduce indentation

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

16 years agoadd a testcase for a bug Duncan pointed out.
Chris Lattner [Fri, 25 Jan 2008 22:36:24 +0000 (22:36 +0000)]
add a testcase for a bug Duncan pointed out.

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

16 years agoDo this more neatly.
Duncan Sands [Fri, 25 Jan 2008 22:06:51 +0000 (22:06 +0000)]
Do this more neatly.

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

16 years agoReorder a field to reduce the size of StackObject. Note that this
Chris Lattner [Fri, 25 Jan 2008 17:49:41 +0000 (17:49 +0000)]
Reorder a field to reduce the size of StackObject.  Note that this
may require a clean rebuild on leopard. :(

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

16 years agoTest for PR1942.
Duncan Sands [Fri, 25 Jan 2008 17:36:44 +0000 (17:36 +0000)]
Test for PR1942.

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

16 years agofix long lines.
Chris Lattner [Fri, 25 Jan 2008 17:24:52 +0000 (17:24 +0000)]
fix long lines.

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

16 years agoJITEmitter.cpp was trying to sync the icache for function stubs, but
Chris Lattner [Fri, 25 Jan 2008 16:41:09 +0000 (16:41 +0000)]
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

16 years agoAdd more assertions to catch accesses outside of
Duncan Sands [Fri, 25 Jan 2008 10:20:53 +0000 (10:20 +0000)]
Add more assertions to catch accesses outside of
arrays.  Also, as a convenience, don't barf, just
return false, if someone calls isTruncStoreLegal
or isLoadXLegal with an extended type for the in
memory type.

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

16 years agoDeadStoreElimination can treat byval parameters as if there were alloca's for the...
Owen Anderson [Fri, 25 Jan 2008 10:10:33 +0000 (10:10 +0000)]
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

16 years agomove this field back. Moving the field causes miscompilations (!) of voronoi and...
Chris Lattner [Fri, 25 Jan 2008 07:29:34 +0000 (07:29 +0000)]
move this field back.  Moving the field causes miscompilations (!) of voronoi and others.

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

16 years agoAdd skeletal code to increase the alignment of loads and stores when
Chris Lattner [Fri, 25 Jan 2008 07:20:16 +0000 (07:20 +0000)]
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

16 years agomove MachineFrameInfo::CreateFixedObject out of line, give MachineFrameInfo
Chris Lattner [Fri, 25 Jan 2008 07:19:06 +0000 (07:19 +0000)]
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

16 years agoinclude alignment and volatility information in -view-*-dags output
Chris Lattner [Fri, 25 Jan 2008 06:40:45 +0000 (06:40 +0000)]
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

16 years agoadd a fixme.
Chris Lattner [Fri, 25 Jan 2008 06:20:20 +0000 (06:20 +0000)]
add a fixme.

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

16 years agooptimize fxor like for
Chris Lattner [Fri, 25 Jan 2008 06:14:17 +0000 (06:14 +0000)]
optimize fxor like for

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

16 years agoAdd target-specific dag combines for FAND(x,0) and FOR(x,0). This allows
Chris Lattner [Fri, 25 Jan 2008 05:46:26 +0000 (05:46 +0000)]
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

16 years agoProvide correct DWARF register numbering for debug information emission on x86-32...
Anton Korobeynikov [Fri, 25 Jan 2008 00:34:13 +0000 (00:34 +0000)]
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

16 years agoNew test.
Devang Patel [Thu, 24 Jan 2008 23:55:34 +0000 (23:55 +0000)]
New test.

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

16 years agoDon't dump the function!
Chris Lattner [Thu, 24 Jan 2008 19:28:11 +0000 (19:28 +0000)]
Don't dump the function!

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

16 years agogetUnderlyingObject can return null, handle this.
Chris Lattner [Thu, 24 Jan 2008 19:07:10 +0000 (19:07 +0000)]
getUnderlyingObject can return null, handle this.

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

16 years agoAdded additional overloaded operators for APSInt to match the operators of
Ted Kremenek [Thu, 24 Jan 2008 18:59:52 +0000 (18:59 +0000)]
Added additional overloaded operators for APSInt to match the operators of
APInt.

While some operators were already specifically overloaded for APSInt, others
resulted in using the overloaded operator methods in APInt, which would result
in the signedness bit being lost.

Modified the APSInt(APInt&) constructor to be "explicit" and to take an
extra (optional) flag to indicate the signedness.  Making the ctor explicit
will catch any implicit conversations between APSInt -> APInt -> APSInt that
results in the signedness flag being lost.

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

16 years agoTeach basicaa that 'byval' arguments define a new memory location that
Chris Lattner [Thu, 24 Jan 2008 18:00:32 +0000 (18:00 +0000)]
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

16 years agoAdd hasByValAttr() and hasNoAliasAttr() methods to the Argument class.
Chris Lattner [Thu, 24 Jan 2008 17:47:11 +0000 (17:47 +0000)]
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

16 years agoclarify a comment, thanks Duncan.
Chris Lattner [Thu, 24 Jan 2008 17:10:01 +0000 (17:10 +0000)]
clarify a comment, thanks Duncan.

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

16 years agoSignificantly simplify and improve handling of FP function results on x86-32.
Chris Lattner [Thu, 24 Jan 2008 08:07:48 +0000 (08:07 +0000)]
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

16 years agoFix this buggy transformation. Two observations:
Chris Lattner [Thu, 24 Jan 2008 07:57:06 +0000 (07:57 +0000)]
Fix this buggy transformation.  Two observations:
1. we already know the value is dead, so don't bother replacing
   it with undef.
2. The very case the comment describes actually makes the load
   live which asserts in deletenode.  If we do the replacement
   and the node becomes live, just treat it as new.  This fixes
   a failure on X86/2008-01-16-InvalidDAGCombineXform.ll with
   some local changes in my tree.

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

16 years agoThe dag combiner is missing revisiting nodes that it really should, and thus leaving
Chris Lattner [Thu, 24 Jan 2008 07:18:21 +0000 (07:18 +0000)]
The dag combiner is missing revisiting nodes that it really should, and thus leaving
dead stuff around.  This gets fed into the isel pass and causes certain foldings from
happening because nodes have extraneous uses floating around.  For example, if we turned
foo(bar(x)) -> baz(x), we sometimes left bar(x) around.

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

16 years agofold fp_round(fp_round(x)) -> fp_round(x).
Chris Lattner [Thu, 24 Jan 2008 06:45:35 +0000 (06:45 +0000)]
fold fp_round(fp_round(x)) -> fp_round(x).

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

16 years agotake these with a pr #
Chris Lattner [Thu, 24 Jan 2008 06:35:44 +0000 (06:35 +0000)]
take these with a pr #

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

16 years agoFixing the stack walker.
Gordon Henriksen [Thu, 24 Jan 2008 05:16:36 +0000 (05:16 +0000)]
Fixing the stack walker.

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

16 years agoFix potential buffer overflow
Anton Korobeynikov [Thu, 24 Jan 2008 01:20:48 +0000 (01:20 +0000)]
Fix potential buffer overflow

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

16 years agoMove some functionality for adding flags to MachineInstr's into methods on MachineIns...
Owen Anderson [Thu, 24 Jan 2008 01:10:07 +0000 (01:10 +0000)]
Move some functionality for adding flags to MachineInstr's into methods on MachineInstr rather than LiveVariables.

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

16 years agoForgot these.
Evan Cheng [Thu, 24 Jan 2008 00:22:01 +0000 (00:22 +0000)]
Forgot these.

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

16 years agoLet each target decide byval alignment. For X86, it's 4-byte unless the aggregare...
Evan Cheng [Wed, 23 Jan 2008 23:17:41 +0000 (23:17 +0000)]
Let each target decide byval alignment. For X86, it's 4-byte unless the aggregare contains SSE vector(s). For x86-64, it's max of 8 or alignment of the type.

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

16 years agoAdded special escape sequences "\{", "\}", and "\|" when processing
Ted Kremenek [Wed, 23 Jan 2008 22:29:58 +0000 (22:29 +0000)]
Added special escape sequences "\{", "\}", and "\|" when processing
getNodeLabel(); these sequences allow the user to specify the characters '{',
'}', and '|' in the label, which facilitate breaking the label into multiple
record segments.

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

16 years agoThe last pieces needed for loading arbitrary
Duncan Sands [Wed, 23 Jan 2008 20:39:46 +0000 (20:39 +0000)]
The last pieces needed for loading arbitrary
precision integers.  This won't actually work
(and most of the code is dead) unless the new
legalization machinery is turned on.  While
there, I rationalized the handling of i1, and
removed some bogus (and unused) sextload patterns.
For i1, this could result in microscopically
better code for some architectures (not X86).
It might also result in worse code if annotating
with AssertZExt nodes turns out to be more harmful
than helpful.

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

16 years agoAdded "getRoot()" to ImmutableSet.
Ted Kremenek [Wed, 23 Jan 2008 19:57:33 +0000 (19:57 +0000)]
Added "getRoot()" to ImmutableSet.

Made ImmutableSet::ImmutableSet(ImutAVLTree* Root) public. (this allows handy
casting between trees and sets).

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

16 years agoHonor explicit section information on Darwin.
Dale Johannesen [Wed, 23 Jan 2008 00:58:14 +0000 (00:58 +0000)]
Honor explicit section information on Darwin.

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

16 years agoFix an iterator invalidation issue.
Owen Anderson [Tue, 22 Jan 2008 23:58:54 +0000 (23:58 +0000)]
Fix an iterator invalidation issue.

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

16 years agoSSE varargs arguments are passed in memory.
Evan Cheng [Tue, 22 Jan 2008 23:26:53 +0000 (23:26 +0000)]
SSE varargs arguments are passed in memory.

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

16 years agoSimplify SelectionDAG::getNode so that a big switch stmt is not #ifndef
Chris Lattner [Tue, 22 Jan 2008 19:09:33 +0000 (19:09 +0000)]
Simplify SelectionDAG::getNode so that a big switch stmt is not #ifndef
NDEBUG.  This is in response to a really nasty bug I introduced that
Dale tracked down, hopefully this won't happen in the future.
Many thanks Dale.

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

16 years agoSilence a warning. Should we turn this into configure-time check?
Anton Korobeynikov [Tue, 22 Jan 2008 11:01:23 +0000 (11:01 +0000)]
Silence a warning. Should we turn this into configure-time check?

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

16 years agoAdd interator interface to DAGInit also
Anton Korobeynikov [Tue, 22 Jan 2008 11:00:07 +0000 (11:00 +0000)]
Add interator interface to DAGInit also

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

16 years agoThe final piece needed for storing arbitrary precision
Duncan Sands [Tue, 22 Jan 2008 07:17:34 +0000 (07:17 +0000)]
The final piece needed for storing arbitrary precision
integers.  Handle truncstore of a legal type to an unusual
number of bits.  Most of this code is not reachable unless
the new legalize infrastructure is turned on.

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

16 years agoEnable the fix I just checked in, silly me.
Nick Lewycky [Tue, 22 Jan 2008 05:42:02 +0000 (05:42 +0000)]
Enable the fix I just checked in, silly me.

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

16 years agoupdate this test to pass with duncan's change.
Chris Lattner [Tue, 22 Jan 2008 05:31:58 +0000 (05:31 +0000)]
update this test to pass with duncan's change.

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

16 years agoOne too many )'s breaks 'make clean' with certain versions of make.
Chris Lattner [Tue, 22 Jan 2008 05:19:26 +0000 (05:19 +0000)]
One too many )'s breaks 'make clean' with certain versions of make.
This fixes PR1927

This should be pulled into llvm 2.2.

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

16 years agoMultiply can be evaluated in a different type, so long as the target type has
Nick Lewycky [Tue, 22 Jan 2008 05:08:48 +0000 (05:08 +0000)]
Multiply can be evaluated in a different type, so long as the target type has
a smaller bitwidth.

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

16 years agoTrivial patch to fix two warnings, please pull into llvm 2.2
Chris Lattner [Tue, 22 Jan 2008 04:47:47 +0000 (04:47 +0000)]
Trivial patch to fix two warnings, please pull into llvm 2.2

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

16 years agoFixed buggy caching of the hash value of an ImutAVLTree node.
Ted Kremenek [Mon, 21 Jan 2008 22:54:46 +0000 (22:54 +0000)]
Fixed buggy caching of the hash value of an ImutAVLTree node.

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

16 years agoMoved method call within a conditional branch because its effects will
Ted Kremenek [Mon, 21 Jan 2008 22:51:35 +0000 (22:51 +0000)]
Moved method call within a conditional branch because its effects will
be ignored on the false branch.

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

16 years agoAdjusted ImutAVLTree::ComputeHash to compute a hash value that is based on a
Ted Kremenek [Mon, 21 Jan 2008 22:50:37 +0000 (22:50 +0000)]
Adjusted ImutAVLTree::ComputeHash to compute a hash value that is based on a
clearer sequence of hashing compositions.

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

16 years agoAdded "clear" method to FoldingSetNodeID to allow a FoldingSetNodeID object
Ted Kremenek [Mon, 21 Jan 2008 22:49:22 +0000 (22:49 +0000)]
Added "clear" method to FoldingSetNodeID to allow a FoldingSetNodeID object
to be reused to compute multiple object profiles.

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

16 years agoReplaced (FoldingSet) profiling of ImutAVLTree with a hashing based scheme. The
Ted Kremenek [Mon, 21 Jan 2008 22:33:30 +0000 (22:33 +0000)]
Replaced (FoldingSet) profiling of ImutAVLTree with a hashing based scheme. The
problem was that we previously hashed based on the pointers of the left and
right children, but this is bogus: we can easily have different trees that
represent the same set. Now we use a hashing based scheme that compares the
*contents* of the trees, but not without having to do a full scan of a tree. The
only caveat is that with hashing is that we may have collisions, which result in
two different trees being falsely labeled as equivalent. If this becomes a
problem, we can add extra data to the profile to hopefully resolve most
collisions.

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

16 years agoProvide iterator access to ListInit contents
Anton Korobeynikov [Mon, 21 Jan 2008 22:30:26 +0000 (22:30 +0000)]
Provide iterator access to ListInit contents

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

16 years agoFix the failures in the PPC JIT by marking relocation entries for
Chris Lattner [Mon, 21 Jan 2008 22:27:27 +0000 (22:27 +0000)]
Fix the failures in the PPC JIT by marking relocation entries for
external symbols (e.g. 'fmod') as needing a stub.  This regression
was introduced by Evan's jit patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071231/056749.html

With this fixed, the two ExecutionEngine failures are passing on ppc,
and the ppc jit works on freebench and olden.

This should be pulled into the 2.2 release branch.

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

16 years agoNew test.
Devang Patel [Mon, 21 Jan 2008 22:15:58 +0000 (22:15 +0000)]
New test.

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

16 years agoClarify a deviation from the original algorithm.
Owen Anderson [Mon, 21 Jan 2008 22:03:00 +0000 (22:03 +0000)]
Clarify a deviation from the original algorithm.

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

16 years agoImprove a few comments.
Owen Anderson [Mon, 21 Jan 2008 22:01:01 +0000 (22:01 +0000)]
Improve a few comments.

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

16 years agoIt turns out that in C++ it is legal to declare functions
Duncan Sands [Mon, 21 Jan 2008 21:37:41 +0000 (21:37 +0000)]
It turns out that in C++ it is legal to declare functions
that return an opaque type by value, as long as you don't
call it or provide a body (you can take the address of it).
So it is wrong to insist that sret parameters not be an
opaque*.  And I guess it is really up to codegen to complain
if someone tries to call such a function.  I'm also removing
the analogous check from byval parameters, since I don't
see why we shouldn't allow them as long as no-one tries to
call the function or give it a body.

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

16 years agoNew test.
Devang Patel [Mon, 21 Jan 2008 19:28:13 +0000 (19:28 +0000)]
New test.

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

16 years agoCheck that sret is only used on pointers to types
Duncan Sands [Mon, 21 Jan 2008 11:28:49 +0000 (11:28 +0000)]
Check that sret is only used on pointers to types
with a size, like byval.

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

16 years agoBe consistent with other attribute methods, and
Duncan Sands [Mon, 21 Jan 2008 11:27:55 +0000 (11:27 +0000)]
Be consistent with other attribute methods, and
check the callee also if it is known.

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

16 years agoMove DAG-changing code out of #ifndef NDEBUG.
Dale Johannesen [Mon, 21 Jan 2008 01:00:34 +0000 (01:00 +0000)]
Move DAG-changing code out of #ifndef NDEBUG.

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

16 years agoMake sure the caller doesn't use freed memory.
Duncan Sands [Sun, 20 Jan 2008 16:51:46 +0000 (16:51 +0000)]
Make sure the caller doesn't use freed memory.
Fixes PR1935.

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

16 years agoHonour ByVal parameter attribute for name decoration
Anton Korobeynikov [Sun, 20 Jan 2008 14:00:07 +0000 (14:00 +0000)]
Honour ByVal parameter attribute for name decoration

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

16 years agoRemove Darwin'ism
Anton Korobeynikov [Sun, 20 Jan 2008 13:59:37 +0000 (13:59 +0000)]
Remove Darwin'ism

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

16 years agoEnable PIC codegen on x86-64/linux
Anton Korobeynikov [Sun, 20 Jan 2008 13:58:16 +0000 (13:58 +0000)]
Enable PIC codegen on x86-64/linux

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

16 years agoInitializing an unsigned with ~0UL causes the compiler
Duncan Sands [Sun, 20 Jan 2008 10:49:23 +0000 (10:49 +0000)]
Initializing an unsigned with ~0UL causes the compiler
to complain on x86-64 (gcc 4.1).  Use ~0U instead.

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

16 years agoDo not generate a FP_ROUND of f64 to f64.
Dale Johannesen [Sun, 20 Jan 2008 01:18:38 +0000 (01:18 +0000)]
Do not generate a FP_ROUND of f64 to f64.

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

16 years agoChanged argument name for 'Profile' method to potentially fix a name conflict
Ted Kremenek [Sat, 19 Jan 2008 17:21:43 +0000 (17:21 +0000)]
Changed argument name for 'Profile' method to potentially fix a name conflict
reported in pr1929 (http://llvm.org/PR1929).

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

16 years agoNeed to handle any 'nest' parameter before integer
Duncan Sands [Sat, 19 Jan 2008 16:42:10 +0000 (16:42 +0000)]
Need to handle any 'nest' parameter before integer
parameters, since otherwise it won't be passed in
the right register.  With this change trampolines
work on x86-64 (thanks to Luke Guest for providing
access to an x86-64 box).

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

16 years agoModified ImmutableSet/ImmutableMap to use FoldingSet profiling using
Ted Kremenek [Sat, 19 Jan 2008 04:51:55 +0000 (04:51 +0000)]
Modified ImmutableSet/ImmutableMap to use FoldingSet profiling using
FoldingSetTrait instead of directly calling a 'Profile' method.

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

16 years agoAdded FoldingSet style 'profiling' support for APSInt.
Ted Kremenek [Sat, 19 Jan 2008 04:31:12 +0000 (04:31 +0000)]
Added FoldingSet style 'profiling' support for APSInt.

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

16 years agoAdded FoldingSet style 'profiling' support for APInt.
Ted Kremenek [Sat, 19 Jan 2008 04:23:33 +0000 (04:23 +0000)]
Added FoldingSet style 'profiling' support for APInt.

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

16 years agoMade 'FoldingSetNodeID' a proper class instead of a nested class in
Ted Kremenek [Sat, 19 Jan 2008 04:22:50 +0000 (04:22 +0000)]
Made 'FoldingSetNodeID' a proper class instead of a nested class in
'FoldingSetNodeImpl' (previously 'FoldingSetNodeID' was a typedef of
'FoldingSetNodeImpl::NodeID').

Why?  Clients can now easily forward declare 'FoldingSetNodeID' without having
to include FoldingSet.h.

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

16 years agoMade 'profiling' of objects in a FoldingSet trait-based using FoldingSetTrait
Ted Kremenek [Sat, 19 Jan 2008 03:58:00 +0000 (03:58 +0000)]
Made 'profiling' of objects in a FoldingSet trait-based using FoldingSetTrait
instead of always assuming that the stored objects had a method called
'Profile'. The default behavior is to dispatch to a 'Profile' method (as
before), but via template specialization this behavior can now be overridden by
clients.

Added templated class 'FoldingSetNodeWrapper', a generic wrapper class that
allows one to insert objects into a FoldingSet that do not directly inherit from
FoldingSetNode. This is useful for inserting objects that do not always need to
pay the overhead of inheriting from FoldingSetNode, or were designed with that
behavior in mind.

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

16 years agoFix makefiles to enable Apply style debug build.
Evan Cheng [Fri, 18 Jan 2008 21:01:00 +0000 (21:01 +0000)]
Fix makefiles to enable Apply style debug build.

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

16 years agoImplement flt_rounds for PowerPC.
Dale Johannesen [Fri, 18 Jan 2008 19:55:37 +0000 (19:55 +0000)]
Implement flt_rounds for PowerPC.

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