Commit Graph

23197 Commits

Author SHA1 Message Date
Owen Anderson
78ecf0d7b1 Use a DenseMap instead of an std::map, speeding up the testcase in PR2368 by about a third.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51565 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-26 10:07:43 +00:00
Bill Wendling
a16157a410 The enabling of remat in 2-address conversion breaks this test:
Running /Users/void/llvm/llvm.src/test/CodeGen/X86/dg.exp ...
FAIL: /Users/void/llvm/llvm.src/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll
Failed with exit(1) at line 1
while running: llvm-as < /Users/void/llvm/llvm.src/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll | llc -march=x86 -mattr=+sse2 -stats |&  grep {1 .*folded into instructions}
child process exited abnormally

Make this conditional for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51563 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-26 05:49:49 +00:00
Bill Wendling
48f7f237ea A problem that's exposed when machine LICM is enabled. Consider this code:
LBB1_3:   # bb
...
        xorl    %ebp, %ebp
        subl    (%ebx), %ebp
...
        incl    %ecx
        cmpl    %edi, %ecx
        jl      LBB1_3  # bb

Whe using machine LICM, LLVM converts it into:

        xorl %esi, %esi
LBB1_3: # bb
...
        movl    %esi, %ebp
        subl    (%ebx), %ebp
...
        incl    %ecx
        cmpl    %edi, %ecx
        jl      LBB1_3  # bb

Two address conversion inserts the copy instruction. However, it's cheaper to
rematerialize it, and remat helps reduce register pressure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51562 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-26 05:18:34 +00:00
Nick Lewycky
04b35e8532 Don't treat values as signed when looking at loop steppings in HowForToNonZero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-25 23:43:32 +00:00
Nick Lewycky
3dfd7bf511 "ret (constexpr)" can't be folded into a Constant. Add a method to
Analysis/ConstantFolding to fold ConstantExpr's, then make instcombine use it
to try to use targetdata to fold constant expressions on void instructions.

Also extend the icmp(inttoptr, inttoptr) folding to handle the case where
int size != ptr size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51559 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-25 20:56:15 +00:00
Owen Anderson
a5464f3659 Create archives with the same permissions are ar.
Patch by Mikael Lepistö.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51540 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 05:42:29 +00:00
Chris Lattner
e7a83dfac6 Add FreeBSD/PPC support, patch by Marcel Moolenaar!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51538 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 04:58:48 +00:00
Chris Lattner
393f7eb60a Fix a serious brain-o. Obviously no-one reviewed my patch :(
This fixes PR2359


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51536 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 04:06:28 +00:00
Chris Lattner
60301608f8 Fix PR2358 by resolving calls with undef arguments to overdefined.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51535 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 03:59:33 +00:00
Evan Cheng
a31593901d Eliminate x86.sse2.punpckh.qdq and x86.sse2.punpckl.qdq.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51533 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 02:56:30 +00:00
Evan Cheng
e716bb1c59 Eliminate x86.sse2.movs.d, x86.sse2.shuf.pd, x86.sse2.unpckh.pd, and x86.sse2.unpckl.pd intrinsics. These will be lowered into shuffles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51531 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 02:14:05 +00:00
Duncan Sands
5ea38a6144 Tweak how ConstantFP80Ty constants are output
so that gcc doesn't warn about them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51529 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 01:00:52 +00:00
Dale Johannesen
247580b569 Put initialized const weak objects into correct
sections on ppc32 darwin.  g++.dg/abi/key2.C



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51527 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 00:10:20 +00:00
Evan Cheng
fe5b159ae2 This is done.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51526 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 00:10:13 +00:00
Evan Cheng
4797f61657 Autoupgrade x86.sse2.loadh.pd and x86.sse2.loadl.pd.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51523 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 00:08:39 +00:00
Evan Cheng
999dbe6bbc Remove x86.sse2.loadh.pd and x86.sse2.loadl.pd. These will be lowered into load and shuffle instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51522 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 00:07:29 +00:00
Evan Cheng
3cc8f9bfef Remove x86.sse2.loadh.pd and x86.sse2.loadl.pd. These will be lowered into load and shuffle instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51521 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-24 00:07:06 +00:00
Evan Cheng
0a891ed7d5 Revert 51440 as it breaks a bunch of PIC tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 23:00:04 +00:00
Dan Gohman
80f0f616e8 Don't silently truncate array extents to 32 bits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51505 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 21:40:55 +00:00
Dale Johannesen
80d7e26513 Add a missed CommonLinkage check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 21:33:27 +00:00
Evan Cheng
cd0baf21a1 Use movlps / movhps to modify low / high half of 16-byet memory location.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51501 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 21:23:16 +00:00
Dan Gohman
02dea8b39f Tidy up BasicBlock::getFirstNonPHI, and change a bunch of places to
use it instead of duplicating its functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 21:05:58 +00:00
Dan Gohman
ee335e35ac Add #includes to make some dependencies explicit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51496 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 20:40:06 +00:00
Dan Gohman
9c531cdf02 Issue errors in several situations instead of aborting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51493 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 18:23:11 +00:00
Dan Gohman
a9e75631a7 Elaborate on the entry on integer vector multiplication by constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51491 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 18:05:39 +00:00
Evan Cheng
50f778deed Fix a duplicated pattern.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51490 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 18:00:18 +00:00
Dan Gohman
0b924dcef8 Use PMULDQ for v2i64 multiplies when SSE4.1 is available. And add
load-folding table entries for PMULDQ and PMULLD.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51489 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 17:49:40 +00:00
Evan Cheng
d4083d01d2 New entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51487 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 17:28:11 +00:00
Dale Johannesen
679860e31b Rewrite a loop to avoid using iterators pointing to
elements that have been erased.  Based on a patch
by Nicolas Capens.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51485 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 17:19:02 +00:00
Dan Gohman
17dab19226 Fix another isFirstClassType that now needs to be isSingleValueType.
This fixes recent CBE regressions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51483 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 16:57:00 +00:00
Matthijs Kooijman
214142cd4f Replace some weird usage of UserOp1 introduced in r49492 by a plain if.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51482 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 16:17:48 +00:00
Matthijs Kooijman
5e179a23e3 Restucture a part of the SimplifyCFG pass and include a testcase.
The SimplifyCFG pass looks at basic blocks that contain only phi nodes,
followed by an unconditional branch. In a lot of cases, such a block (BB) can
be merged into their successor (Succ).

This merging is performed by TryToSimplifyUncondBranchFromEmptyBlock. It does
this by taking all phi nodes in the succesor block Succ and expanding them to
include the predecessors of BB. Furthermore, any phi nodes in BB are moved to
Succ and expanded to include the predecessors of Succ as well.

Before attempting this merge, CanPropagatePredecessorsForPHIs checks to see if
all phi nodes can be properly merged. All functional changes are made to
this function, only comments were updated in
TryToSimplifyUncondBranchFromEmptyBlock.

In the original code, CanPropagatePredecessorsForPHIs looks quite convoluted
and more like stack of checks added to handle different kinds of situations
than a comprehensive check. In particular the first check in the function did
some value checking for the case that BB and Succ have a common predecessor,
while the last check in the function simply rejected all cases where BB and
Succ have a common predecessor. The first check was still useful in the case
that BB did not contain any phi nodes at all, though, so it was not completely
useless.

Now, CanPropagatePredecessorsForPHIs is restructured to to look a lot more
similar to the code that actually performs the merge. Both functions now look
at the same phi nodes in about the same order.  Any conflicts (phi nodes with
different values for the same source) that could arise from merging or moving
phi nodes are detected. If no conflicts are found, the merge can happen.

Apart from only restructuring the checks, two main changes in functionality
happened.

Firstly, the old code rejected blocks with common predecessors in most cases.
The new code performs some extra checks so common predecessors can be handled
in a lot of cases. Wherever common predecessors still pose problems, the
blocks are left untouched.

Secondly, the old code rejected the merge when values (phi nodes) from BB were
used in any other place than Succ. However, it does not seem that there is any
situation that would require this check. Even more, this can be proven.

Consider that BB is a block containing of a single phi node "%a" and a branch
to Succ. Now, since the definition of %a will dominate all of its uses, BB
will dominate all blocks that use %a. Furthermore, since the branch from BB to
Succ is unconditional, Succ will also dominate all uses of %a.

Now, assume that one predecessor of Succ is not dominated by BB (and thus not
dominated by Succ). Since at least one use of %a (but in reality all of them)
is reachable from Succ, you could end up at a use of %a without passing
through it's definition in BB (by coming from X through Succ). This is a
contradiction, meaning that our original assumption is wrong. Thus, all
predecessors of Succ must also be dominated by BB (and thus also by Succ).

This means that moving the phi node %a from BB to Succ does not pose any
problems when the two blocks are merged, and any use checks are not needed.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51478 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 09:09:41 +00:00
Matthijs Kooijman
992e97eed3 Indent fix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51477 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 07:57:02 +00:00
Nick Lewycky
18b3da6c34 Constant integer vectors may also be negated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51476 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 04:54:45 +00:00
Nick Lewycky
7d26bd8e97 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51475 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 04:39:38 +00:00
Nick Lewycky
02d639fcc0 Revert X + X --> X * 2 optz'n which pessimizes heavily on x86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51474 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 04:34:58 +00:00
Chris Lattner
3adaa93700 we compile multiply-by-constant into horrible code. Doesn't sse4 have some
instruction for doing this?


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51473 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 04:29:53 +00:00
Nick Lewycky
8539fe26b7 Implement X + X for vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51472 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 04:14:51 +00:00
Nick Lewycky
39ac3b57bc Fix a recently added optimization to not crash on vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51471 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 03:26:47 +00:00
Dan Gohman
a332f17c8c Generalize the new code in instcombine's ComputeNumSignBits for handling
and/or to handle more cases (such as this add-sitofp.ll testcase), and
port it to selectiondag's ComputeNumSignBits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51469 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 02:28:01 +00:00
Dan Gohman
e4977cf750 Make structs and arrays first-class types, and add assembly
and bitcode support for the extractvalue and insertvalue
instructions and constant expressions.

Note that this does not yet include CodeGen support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51468 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 01:55:30 +00:00
Dan Gohman
8f8e269270 Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51467 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 01:52:21 +00:00
Bill Wendling
f3061f8210 Remove warnings about comparison between signed and unsigned expressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51465 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 01:29:08 +00:00
Dale Johannesen
9bca583f9d Allow for switch with no cases. Was causing fault
in gcc.dg/pr27531-1.c.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51464 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 01:01:31 +00:00
Evan Cheng
b1938263c7 Bug: rcpps can only folds a load if the address is 16-byte aligned. Fixed many 'ps' load folding patterns in X86InstrSSE.td which are missing the proper alignment checks.
Also fixed some 80 col. violations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51462 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 00:37:07 +00:00
Dan Gohman
e4569943d9 Add more IR support for the new extractvalue and insertvalue
instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51461 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 00:36:11 +00:00
Dan Gohman
4fa2a3f0ef Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51460 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 00:34:04 +00:00
Dan Gohman
399101a599 Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 00:17:26 +00:00
Dale Johannesen
bbcb34cafb Put const weak stuff in appropriate section on Darwin.
g++.dg/abi/key2.C



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51458 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 00:16:59 +00:00
Dan Gohman
31e5bdccf2 Use isSingleValueType instead of isFirstClassType to
exclude struct and array types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51456 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 00:12:03 +00:00