oota-llvm.git
16 years agoAdd a testcase for eliminating memcpy's at the end of functions. Forgot to commit...
Owen Anderson [Tue, 29 Jan 2008 06:40:32 +0000 (06:40 +0000)]
Add a testcase for eliminating memcpy's at the end of functions.  Forgot to commit this with my last commit.

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

16 years agoAdd target triples to these so they don't fail on linux.
Chris Lattner [Tue, 29 Jan 2008 06:26:07 +0000 (06:26 +0000)]
Add target triples to these so they don't fail on linux.

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

16 years agoUse getPreferredAlignmentLog or getPreferredAlignment
Duncan Sands [Tue, 29 Jan 2008 06:23:44 +0000 (06:23 +0000)]
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

16 years agoAdd support for eliminating memcpy's at the end of functions. Also fix some errors...
Owen Anderson [Tue, 29 Jan 2008 06:18:36 +0000 (06:18 +0000)]
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

16 years agoThis would be better done as an executable test.
Duncan Sands [Tue, 29 Jan 2008 06:04:54 +0000 (06:04 +0000)]
This would be better done as an executable test.

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

16 years agoAfter recent changes we fail to optimize this test
Duncan Sands [Tue, 29 Jan 2008 05:57:23 +0000 (05:57 +0000)]
After recent changes we fail to optimize this test
sufficiently to have it pass.  I'm removing it from
the testsuite and adding it to PR452 instead.

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

16 years agoRegAllocBigBlock doesn't need LiveVariables either.
Owen Anderson [Tue, 29 Jan 2008 02:32:13 +0000 (02:32 +0000)]
RegAllocBigBlock doesn't need LiveVariables either.

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

16 years agoFix to bug 1951: tblgen gratuitously renames variables when no temporary was
Scott Michel [Tue, 29 Jan 2008 02:29:31 +0000 (02:29 +0000)]
Fix to bug 1951: tblgen gratuitously renames variables when no temporary was
generated. This feature would only show up in fairly complex patterns, such
as this one in CellSPU:

  def : Pat<(add (SPUhi tconstpool:$in, 0), (SPUlo tconstpool:$in, 0)),
    (IOHLlo (ILHUhi tconstpool:$in), tconstpool:$in)>;

which generated the following emit code:

SDNode *Emit_0(const SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, MVT::ValueType VT1) DISABLE_INLINE {
  SDOperand N0 = N.getOperand(0);
  SDOperand N00 = N0.getOperand(0);
  SDOperand N01 = N0.getOperand(1);
  SDOperand N1 = N.getOperand(1);
  SDOperand N10 = N1.getOperand(0);
  SDOperand N11 = N1.getOperand(1);
  SDOperand Tmp3(CurDAG->getTargetNode(Opc0, VT0, N00), 0);
  return CurDAG->SelectNodeTo(N.Val, Opc1, VT1, Tmp3, Tmp2); /* Tmp2 s/b N00 */
}

Tested against the test suites without incident.

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

16 years agoProperly expand extract-element for non-power-of-2 codegen
Nate Begeman [Tue, 29 Jan 2008 02:24:00 +0000 (02:24 +0000)]
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

16 years agoHandle 'X' constraint in asm's better.
Dale Johannesen [Tue, 29 Jan 2008 02:21:21 +0000 (02:21 +0000)]
Handle 'X' constraint in asm's better.

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

16 years agoFilter loops that subtract induction variables.
Devang Patel [Tue, 29 Jan 2008 02:20:41 +0000 (02:20 +0000)]
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

16 years agoOverhaul Cell SPU's addressing mode internals so that there are now
Scott Michel [Tue, 29 Jan 2008 02:16:57 +0000 (02:16 +0000)]
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

16 years agoNew test.
Devang Patel [Tue, 29 Jan 2008 01:10:04 +0000 (01:10 +0000)]
New test.

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

16 years agoAdd test to make sure that #pragma mark/error doesn't error if there are
Bill Wendling [Tue, 29 Jan 2008 00:41:29 +0000 (00:41 +0000)]
Add test to make sure that #pragma mark/error doesn't error if there are
unbalanced quotes.

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

16 years agoAdded destructor for template class FoldingSetNodeWrapper.
Ted Kremenek [Mon, 28 Jan 2008 22:05:23 +0000 (22:05 +0000)]
Added destructor for template class FoldingSetNodeWrapper.
Added getValue() to FoldingSetNodeWrapper.

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

16 years agoSimplify the code and fix a typo.
Lauro Ramos Venancio [Mon, 28 Jan 2008 20:02:51 +0000 (20:02 +0000)]
Simplify the code and fix a typo.

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

16 years agoPure/const functions with ByVal parameters cannot
Duncan Sands [Mon, 28 Jan 2008 19:25:47 +0000 (19:25 +0000)]
Pure/const functions with ByVal parameters cannot
be marked readonly either.

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

16 years agoFix fpcmp infinite loop when comparing "29-266" with "29-268".
Lauro Ramos Venancio [Mon, 28 Jan 2008 18:23:23 +0000 (18:23 +0000)]
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

16 years agothis test is now compiled into the right thing.
Chris Lattner [Mon, 28 Jan 2008 17:38:46 +0000 (17:38 +0000)]
this test is now compiled into the right thing.

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

16 years agoUnbreak builds with differing object and source
Duncan Sands [Mon, 28 Jan 2008 17:38:30 +0000 (17:38 +0000)]
Unbreak builds with differing object and source
directories.  Patch by Sam Bishop.

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

16 years agoMake this more likely to be passed byval.
Duncan Sands [Mon, 28 Jan 2008 10:35:11 +0000 (10:35 +0000)]
Make this more likely to be passed byval.

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

16 years agoIf the function has no machine instructions, then emit a "nop" so that
Bill Wendling [Mon, 28 Jan 2008 09:15:03 +0000 (09:15 +0000)]
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

16 years agoTransform calls to memcpy into llvm.memcpy calls, patch by Eli Friedman.
Chris Lattner [Mon, 28 Jan 2008 04:41:43 +0000 (04:41 +0000)]
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

16 years agoreduce duplicate -I flags passed to the compiler, cleaning up the VERBOSE
Chris Lattner [Mon, 28 Jan 2008 04:18:41 +0000 (04:18 +0000)]
reduce duplicate -I flags passed to the compiler, cleaning up the VERBOSE
output.  Patch contributed by Sam Bishop!

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

16 years agoHandle some more combinations of extend and icmp. Fixes PR1940.
Nick Lewycky [Mon, 28 Jan 2008 03:48:02 +0000 (03:48 +0000)]
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

16 years agoFix PR1932 by disabling an xform invalid for fdiv.
Chris Lattner [Mon, 28 Jan 2008 00:58:18 +0000 (00:58 +0000)]
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

16 years agomake handling of overflow and undefined results much more clear.
Chris Lattner [Mon, 28 Jan 2008 00:36:27 +0000 (00:36 +0000)]
make handling of overflow and undefined results much more clear.
Patch by Eli Friedman, thanks!

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

16 years agoFix PR1938 by forcing the code that uses an undefined value to branch one
Chris Lattner [Mon, 28 Jan 2008 00:32:30 +0000 (00:32 +0000)]
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

16 years agoAlways for PACKAGEVERSION to 'mainline' for teh llvm web page.
Chris Lattner [Sun, 27 Jan 2008 23:43:26 +0000 (23:43 +0000)]
Always for PACKAGEVERSION to 'mainline' for teh llvm web page.

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

16 years agoFix PowerPC/./2007-10-18-PtrArithmetic.ll
Chris Lattner [Sun, 27 Jan 2008 23:32:17 +0000 (23:32 +0000)]
Fix PowerPC/./2007-10-18-PtrArithmetic.ll

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

16 years agoUpdate this test. Due to dag combiner improvements, we now compile
Chris Lattner [Sun, 27 Jan 2008 23:26:37 +0000 (23:26 +0000)]
Update this test.  Due to dag combiner improvements, we now compile
f7/f11 to:

_f7:
eor r0, r0, #2, 2 @ -2147483648
bx lr
_f11:
bic r0, r0, #2, 2 @ -2147483648
bx lr

instead of:

_f7:
fmsr s0, r0
fnegs s0, s0
fmrs r0, s0
bx lr

_f11:
fmsr s0, r0
fabss s0, s0
fmrs r0, s0
bx lr

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

16 years agofix a crash on CodeGen/X86/vector-rem.ll
Chris Lattner [Sun, 27 Jan 2008 23:21:58 +0000 (23:21 +0000)]
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

16 years agoAdd support for frameworks. Patch by Shantonu Sen!
Chris Lattner [Sun, 27 Jan 2008 22:58:59 +0000 (22:58 +0000)]
Add support for frameworks.  Patch by Shantonu Sen!

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

16 years agoReg alloc doesn't really need LiveVariables.
Owen Anderson [Sun, 27 Jan 2008 22:00:00 +0000 (22:00 +0000)]
Reg alloc doesn't really need LiveVariables.

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

16 years agoFixes for BreakCriticalMachineCodeEdge by Fernando.
Owen Anderson [Sun, 27 Jan 2008 19:51:03 +0000 (19:51 +0000)]
Fixes for BreakCriticalMachineCodeEdge by Fernando.

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

16 years agoBe more careful modifying the use_list while also iterating through it.
Nick Lewycky [Sun, 27 Jan 2008 18:35:00 +0000 (18:35 +0000)]
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

16 years agoRevert r46393: readonly/readnone functions are no
Duncan Sands [Sun, 27 Jan 2008 18:12:58 +0000 (18:12 +0000)]
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

16 years agoImplement some dag combines that allow doing fneg/fabs/fcopysign in integer
Chris Lattner [Sun, 27 Jan 2008 17:42:27 +0000 (17:42 +0000)]
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

16 years agoadd a note
Chris Lattner [Sun, 27 Jan 2008 07:31:41 +0000 (07:31 +0000)]
add a note

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

16 years agoUse fldz and fld1 for long double constants instead of a constant pool load.
Chris Lattner [Sun, 27 Jan 2008 06:19:31 +0000 (06:19 +0000)]
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

16 years agomake isExactlyValue work for long double.
Chris Lattner [Sun, 27 Jan 2008 06:19:08 +0000 (06:19 +0000)]
make isExactlyValue work for long double.

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

16 years agoThe CorrelatedExpressions pass is now no more.
Bill Wendling [Sun, 27 Jan 2008 06:13:32 +0000 (06:13 +0000)]
The CorrelatedExpressions pass is now no more.

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

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