Commit Graph

4767 Commits

Author SHA1 Message Date
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
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
Dale Johannesen
84ad8378ee New test, see comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47078 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 18:36:48 +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
Eli Friedman
35327b3e57 Add a note pointing to PR1996.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47055 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 07:56:04 +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
Eli Friedman
261c704da1 Add test for PR1996. (This is my first time adding a test for a
transform, so please review.)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47050 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 06:55:57 +00:00
Nate Begeman
5e1dd5597e Add testcase for recent legalizer change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47049 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 06:48:40 +00:00
Evan Cheng
b2e72b0feb New tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47047 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 03:23:53 +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
Evan Cheng
073c5b721d Don't mask the isel bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47018 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 19:11:29 +00:00
Evan Cheng
aeb231cb59 This test assumes no SSE4.1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 19:11:08 +00:00
Wojciech Matyjewicz
52f321f525 Now that ScalarEvolution::print writes to the correct stream, there is
no need to redirect stderr into stdout.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47009 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 15:12:40 +00:00
Wojciech Matyjewicz
2a9054cfd6 Change negative grep into positive one in my yesterday's testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47008 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 15:10:35 +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
Tanya Lattner
3c593c947c Test case for annotate builtin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46999 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 07:46:33 +00:00
Evan Cheng
65b2e3df0d Fix some test cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46998 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 07:22:46 +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
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
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
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
Dale Johannesen
b3c4eb46d6 Alignment of struct containing vectors depends on
whether SSE is present, on Darwin anyway.  Make it
explicit.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-09 19:04:25 +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
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
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
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
b745e88bf0 It's PR1925, not PR1609.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46825 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 22:07:17 +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
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
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
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
Evan Cheng
e4908814d2 This should also work on x86 now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46730 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 00:25:31 +00:00
Duncan Sands
6cc24947b6 Crashes LegalizeTypes with "Do not know how to
expand the result of this operator!" (node: ctlz).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46713 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 18:07:02 +00:00
Duncan Sands
06418c5610 Crashes LegalizeTypes with "Do not know how to split
this operator's operand" (node: extract_subvector).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46712 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 18:05:42 +00:00
Chris Lattner
003de9a81e remove target triple to make this test more "generic"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46711 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 18:02:37 +00:00
Duncan Sands
df3fb5ef97 Crashed the new type legalizer. Not likely to catch
any bugs in the future since to get the crash you also
need hacked in fake libcall support (which creates odd
but legal trees), but since adding it doesn't hurt...
Thanks to Chris for this ultimately reduced version.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 09:40:27 +00:00
Owen Anderson
d02c0bc984 Make this test more aggressive, to cover recent improvements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 04:55:24 +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
f2a5f012f3 Tag this test with the PR reference.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46688 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-03 16:35:19 +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
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
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
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
Tanya Lattner
e504d76a15 Pointers change size depending upon the target. Remove them to make the test more stable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46548 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 05:15:15 +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
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
Evan Cheng
c748412c42 Update this test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46526 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 19:30:05 +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