Commit Graph

4647 Commits

Author SHA1 Message Date
Duncan Sands ae8c041b85 This test is now the same as byval-1.ll, so remove it.
llvm-svn: 45960
2008-01-14 14:57:30 +00:00
Duncan Sands 4e079479bb Test that byval cannot be used with pointers to
types with no size.

llvm-svn: 45959
2008-01-14 14:55:05 +00:00
Duncan Sands 1f5340c023 We now allow byval on fairly general pointer types.
llvm-svn: 45956
2008-01-14 06:53:45 +00:00
Chris Lattner 26fe7ebc03 Fix the miscompilation of MiBench/consumer-lame that was exposed by Evan's
byval work.  This miscompilation is due to the program indexing an array out
of range and us doing a transformation that broke this.

llvm-svn: 45949
2008-01-14 02:09:12 +00:00
Chris Lattner 92bd785323 Turn a memcpy from a double* into a load/store of double instead of
a load/store of i64.  The later prevents promotion/scalarrepl of the
source and dest in many cases.

This fixes the 300% performance regression of the byval stuff on 
stepanov_v1p2.

llvm-svn: 45945
2008-01-14 00:28:35 +00:00
Chris Lattner 5bc253c8f2 Fix PR1907, a nasty miscompilation because instcombine didn't
realize that ne & sgt  was a signed comparison (it was only 
looking at whether the left compare was signed).

llvm-svn: 45937
2008-01-13 20:59:02 +00:00
Duncan Sands 93ebe1df27 Check that nested functions don't get pointless
static chains.

llvm-svn: 45936
2008-01-13 18:44:12 +00:00
Duncan Sands 781f6549db When turning a call to a bitcast function into a direct call,
if this becomes a varargs call then deal correctly with any
parameter attributes on the newly vararg call arguments.

llvm-svn: 45931
2008-01-13 08:02:44 +00:00
Chris Lattner 0d815f8f21 new testcase for rdar://5685492
llvm-svn: 45918
2008-01-13 00:19:57 +00:00
Chris Lattner 4f6c81ac68 we don't have to make an explicit copy of a byval argument when
inlining a function if we know that the function does not write
to *any* memory.  This implements test/Transforms/Inline/byval2.ll

llvm-svn: 45912
2008-01-12 18:54:29 +00:00
Duncan Sands 0009c44464 Be more liberal in what parameter attributes are
allowed on the vararg arguments of a call.

llvm-svn: 45909
2008-01-12 16:42:01 +00:00
Chris Lattner ca2af72c7b this actually does pass with 4.0
llvm-svn: 45899
2008-01-12 01:45:22 +00:00
Duncan Sands 5b721fc21d When DAE drops the varargs part of a function, ensure any
attributes on the vararg call arguments are also dropped.

llvm-svn: 45892
2008-01-11 23:13:45 +00:00
Chris Lattner 5a3deb99b3 llvm-g++ 4.0 has completely different code for this warning,
just xfail it.

llvm-svn: 45890
2008-01-11 23:06:56 +00:00
Chris Lattner 031f5e1b8c new testcase
llvm-svn: 45888
2008-01-11 23:04:14 +00:00
Duncan Sands b99f44aa5e Do not allow attributes beyond a function's last
parameter, even if it is a varargs function.  Do
allow attributes on the varargs part of a call,
but not beyond the last argument.  Only allow
selected attributes to be on the varargs part of
a call (currently only 'byval' is allowed).  The
reasoning here is that most attributes, eg inreg,
simply make no sense here.

llvm-svn: 45887
2008-01-11 22:36:48 +00:00
Chris Lattner b5bd924e83 Teach argpromote to ruthlessly hack small byval structs when it can
get away with it, which exposes opportunities to eliminate the memory
objects entirely.  For example, we now compile byval.ll to:

define internal void @f1(i32 %b.0, i64 %b.1) {
entry:
	%tmp2 = add i32 %b.0, 1		; <i32> [#uses=0]
	ret void
}

define i32 @main() nounwind  {
entry:
	call void @f1( i32 1, i64 2 )
	ret i32 0
}

This seems like it would trigger a lot for code that passes around small
structs (e.g. SDOperand's or _Complex)...

llvm-svn: 45886
2008-01-11 22:31:41 +00:00
Duncan Sands 0ebaf91f48 Two occurrences on one line count as one...
llvm-svn: 45885
2008-01-11 21:46:24 +00:00
Duncan Sands 7e46c50c6a If there are attributes on the varargs part of a
call, don't discard them.

llvm-svn: 45884
2008-01-11 21:23:39 +00:00
Scott Michel a8f67e04bd More CellSPU refinements:
- struct_2.ll: Completely unaligned load/store testing

- call_indirect.ll, struct_1.ll: Add test lines to exercise
   X-form [$reg($reg)] addressing

At this point, loads and stores should be under control (he says
in an optimistic tone of voice.)

llvm-svn: 45882
2008-01-11 21:01:19 +00:00
Dale Johannesen 04b99780cf Disable for now.
llvm-svn: 45881
2008-01-11 20:47:33 +00:00
Chris Lattner 908117bf69 When inlining a functino with a byval argument, make an explicit
copy of it in case the callee modifies the struct.

llvm-svn: 45853
2008-01-11 06:09:30 +00:00
Scott Michel 8d5841ae3c More CellSPU refinement and progress:
- Cleaned up custom load/store logic, common code is now shared [see note
  below], cleaned up address modes

- More test cases: various intrinsics, structure element access (load/store
  test), updated target data strings, indirect function calls.

Note: This patch contains a refactoring of the LoadSDNode and StoreSDNode
structures: they now share a common base class, LSBaseSDNode, that
provides an interface to their common functionality. There is some hackery
to access the proper operand depending on the derived class; otherwise,
to do a proper job would require finding and rearranging the SDOperands
sent to StoreSDNode's constructor. The current refactor errs on the
side of being conservatively and backwardly compatible while providing
functionality that reduces redundant code for targets where loads and
stores are custom-lowered.

llvm-svn: 45851
2008-01-11 02:53:15 +00:00
Duncan Sands 53c954fa86 Output sinl for a long double FSIN node, not sin.
Likewise fix up a bunch of other libcalls.  While
there I remove NEG_F32 and NEG_F64 since they are
not used anywhere.  This fixes 9 Ada ACATS failures.

llvm-svn: 45833
2008-01-10 10:28:30 +00:00
Evan Cheng 0f8c7c4a73 Codegen improvement has reduced one spill.
llvm-svn: 45814
2008-01-10 02:54:40 +00:00
Chris Lattner e34d7d0e24 new testcase for PR1845
llvm-svn: 45795
2008-01-10 00:30:38 +00:00
Evan Cheng 0e400d4cb7 Special copy SUnit's do not have SDNode's.
llvm-svn: 45787
2008-01-09 23:01:55 +00:00
Evan Cheng a31824a08e Fix sse2.psrl.w and sse2.psrl.q definitions.
llvm-svn: 45772
2008-01-09 02:16:44 +00:00
Chris Lattner 51b01bf8a5 Make load->store deletion a bit smarter. This allows us to compile this:
void test(long long *P) { *P ^= 1; }

into just:

_test:
	movl	4(%esp), %eax
	xorl	$1, (%eax)
	ret

instead of code like this:

_test:
	movl	4(%esp), %ecx
        xorl    $1, (%ecx)
	movl	4(%ecx), %edx
	movl	%edx, 4(%ecx)
	ret

llvm-svn: 45762
2008-01-08 23:08:06 +00:00
Duncan Sands 7b1460cca4 Crashes llc when using Chris's new legalization logic.
llvm-svn: 45758
2008-01-08 21:51:53 +00:00
Chris Lattner 2940c5c56d Implement PR1795, an instcombine hack for forming GEPs with integer pointer arithmetic.
llvm-svn: 45745
2008-01-08 07:23:51 +00:00
Chris Lattner b17db3afa8 remove darwin/i386 t-t
llvm-svn: 45743
2008-01-08 06:52:51 +00:00
Chris Lattner 89f36e6b21 Finally implement correct ordered comparisons for PPC, even though
the code generated is not wonderful.  This turns a miscompilation into
a code quality bug (noted in the ppc readme).  This fixes PR642, which
is over 2 years old (!).  Nate, please review this.

llvm-svn: 45742
2008-01-08 06:46:30 +00:00
Chris Lattner 184f79a5e1 Testcase for PR1721
llvm-svn: 45739
2008-01-08 05:16:29 +00:00
Nate Begeman d3d49df3f1 Update test to catch recent x86 insert regression and improvements
llvm-svn: 45705
2008-01-07 17:49:23 +00:00
Gordon Henriksen c7e991b7c3 Setting GlobalDirective in TargetAsmInfo by default rather than
providing a misleading facility. It's used once in the MIPS backend
and hardcoded as "\t.globl\t" everywhere else.

llvm-svn: 45676
2008-01-07 02:31:11 +00:00
Gordon Henriksen 6047b6e140 With this patch, the LowerGC transformation becomes the
ShadowStackCollector, which additionally has reduced overhead with
no sacrifice in portability.

Considering a function @fun with 8 loop-local roots,
ShadowStackCollector introduces the following overhead
(x86):

; shadowstack prologue
        movl    L_llvm_gc_root_chain$non_lazy_ptr, %eax
        movl    (%eax), %ecx
        movl    $___gc_fun, 20(%esp)
        movl    $0, 24(%esp)
        movl    $0, 28(%esp)
        movl    $0, 32(%esp)
        movl    $0, 36(%esp)
        movl    $0, 40(%esp)
        movl    $0, 44(%esp)
        movl    $0, 48(%esp)
        movl    $0, 52(%esp)
        movl    %ecx, 16(%esp)
        leal    16(%esp), %ecx
        movl    %ecx, (%eax)

; shadowstack loop overhead
        (none)

; shadowstack epilogue
        movl    48(%esp), %edx
        movl    %edx, (%ecx)

; shadowstack metadata
        .align  3
___gc_fun:                              # __gc_fun
        .long   8
        .space  4

In comparison to LowerGC:

; lowergc prologue
        movl    L_llvm_gc_root_chain$non_lazy_ptr, %eax
        movl    (%eax), %ecx
        movl    %ecx, 48(%esp)
        movl    $8, 52(%esp)
        movl    $0, 60(%esp)
        movl    $0, 56(%esp)
        movl    $0, 68(%esp)
        movl    $0, 64(%esp)
        movl    $0, 76(%esp)
        movl    $0, 72(%esp)
        movl    $0, 84(%esp)
        movl    $0, 80(%esp)
        movl    $0, 92(%esp)
        movl    $0, 88(%esp)
        movl    $0, 100(%esp)
        movl    $0, 96(%esp)
        movl    $0, 108(%esp)
        movl    $0, 104(%esp)
        movl    $0, 116(%esp)
        movl    $0, 112(%esp)

; lowergc loop overhead
        leal    44(%esp), %eax
        movl    %eax, 56(%esp)
        leal    40(%esp), %eax
        movl    %eax, 64(%esp)
        leal    36(%esp), %eax
        movl    %eax, 72(%esp)
        leal    32(%esp), %eax
        movl    %eax, 80(%esp)
        leal    28(%esp), %eax
        movl    %eax, 88(%esp)
        leal    24(%esp), %eax
        movl    %eax, 96(%esp)
        leal    20(%esp), %eax
        movl    %eax, 104(%esp)
        leal    16(%esp), %eax
        movl    %eax, 112(%esp)

; lowergc epilogue
        movl    48(%esp), %edx
        movl    %edx, (%ecx)

; lowergc metadata
        (none)

llvm-svn: 45670
2008-01-07 01:30:53 +00:00
Duncan Sands 404eb05247 The transform that tries to turn calls to bitcast functions into
direct calls bails out unless caller and callee have essentially
equivalent parameter attributes.  This is illogical - the callee's
attributes should be of no relevance here.  Rework the logic, which
incidentally fixes a crash when removed arguments have attributes.

llvm-svn: 45658
2008-01-06 18:27:01 +00:00
Duncan Sands 55e5090fe8 When transforming a call to a bitcast function into
a direct call with cast parameters and cast return
value (if any), instcombine was prepared to cast any
non-void return value into any other, whether castable
or not.  Add a new predicate for testing whether casting
is valid, and check it both for the return value and
(as a cleanup) for the parameters.

llvm-svn: 45657
2008-01-06 10:12:28 +00:00
Nick Lewycky 0e519bb555 Accept both %y, %x and %x, %y as valid answers.
llvm-svn: 45649
2008-01-06 03:12:44 +00:00
Chris Lattner e666bc272d remove a couple more unsafe xforms in the face of overflow.
llvm-svn: 45613
2008-01-05 01:22:42 +00:00
Duncan Sands d98c63ebb9 Testcase with non-integer "bitfields" (in quotes,
since they didn't actually need to be bitfields,
though they are marked as such).

llvm-svn: 45588
2008-01-04 17:31:56 +00:00
Duncan Sands 99fc7197f2 Testcase for PR1386.
llvm-svn: 45583
2008-01-04 13:15:39 +00:00
Chris Lattner bdd6acfb59 Fix PR1896
llvm-svn: 45568
2008-01-04 05:04:53 +00:00
Duncan Sands 338b462b6f Test for handling of large bit offset from a
variable field offset.

llvm-svn: 45534
2008-01-03 11:53:52 +00:00
Chris Lattner f391883670 don't hoist FP additions into unconditional adds + selects. This
could theoretically introduce a trap, but is also a performance issue.
This speeds up ptrdist/ks by 8%.

llvm-svn: 45533
2008-01-03 07:25:26 +00:00
Duncan Sands a7f7ac7072 An example for which the TYPE_SIZE was being set from
the initial value, while the type fields were not (this
is a qualified union type, so not all fields are always
present).  This resulted in the size of the corresponding
LLVM type being larger than the gcc TYPE_SIZE.

llvm-svn: 45522
2008-01-03 00:26:42 +00:00
Duncan Sands 1d03fb4e7e Test handling of records for which the fields are
not ordered by offset.

llvm-svn: 45520
2008-01-03 00:17:02 +00:00
Chris Lattner 41e423a6f5 fix this to use a valid triple.
llvm-svn: 45509
2008-01-02 22:21:45 +00:00
Chris Lattner 5d998c5712 verify that aligned common support doesn't break.
llvm-svn: 45495
2008-01-02 19:48:24 +00:00