Commit Graph

21152 Commits

Author SHA1 Message Date
Chris Lattner
f286f6fd93 Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.
Reimplement the xform in Analysis/ConstantFolding.cpp where we can use
targetdata to validate that it is safe.  While I'm in there, fix some const
correctness issues and generalize the interface to the "operand folder".


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44817 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 22:53:04 +00:00
Chris Lattner
ec90cd1bf8 Disable cfi directives for now, darwin does't support them.
These should probably be something like:

  CFI(".cfi_def_cfa_offset 16\n")

where CFI is defined to a noop on darwin and other platforms
that don't support those directives.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44803 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 19:10:18 +00:00
Duncan Sands
cbb8badce8 Make PruneEH update the nounwind/noreturn attributes
on functions as it calculates them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44802 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 19:09:40 +00:00
Duncan Sands
1eff70451f Fix PR1836: in the interpreter, read and write apints
using the minimum possible number of bytes.  For little
endian targets run on little endian machines, apints are
stored in memory from LSB to MSB as before.  For big endian
targets on big endian machines they are stored from MSB to
LSB which wasn't always the case before (if the target and
host endianness doesn't match values are stored according
to the host's endianness).  Doing this requires knowing the
endianness of the host, which is determined when configuring -
thanks go to Anton for this.  Only having access to little
endian machines I was unable to properly test the big endian
part, which is also the most complicated...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44796 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 17:43:13 +00:00
Anton Korobeynikov
3a7bcc4d1b And finally annotate X86-64 version of callback.
All bad stuff from SSE version is implicitely inherited :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44794 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 15:27:07 +00:00
Anton Korobeynikov
df7814ce92 Provide annotation for SSE version of callback. It's even more
broken, because doesn't mark xmm regs properly


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44793 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 15:13:55 +00:00
Anton Korobeynikov
a14b6696c0 Annotate JIT callback function with call frame infromation.
This will allow us (theoretically) to unwind through JITer.
The code wasn't verified, so I'm pretty sure offsets are wrong :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44792 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 14:54:42 +00:00
Duncan Sands
22ad1d72cd It looks like this has been broken for some time -
get it to compile.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44791 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 14:43:10 +00:00
Owen Anderson
afc6de0015 A little more progress on StrongPHIElimination, now that I have a better sense of
how the CodeGen machinery works.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44786 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 08:07:09 +00:00
Christopher Lamb
11a4f64bd4 Improve branch folding by recgonizing that explict successor relationships impact the value of fall-through choices.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44785 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 07:24:06 +00:00
Gordon Henriksen
53c34b1db9 Delete the CollectorNamePool if it should become empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44775 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 03:35:18 +00:00
Gordon Henriksen
80a75bfae9 Adding a collector name attribute to Function in the IR. These
methods are new to Function:

  bool hasCollector() const;
  const std::string &getCollector() const;
  void setCollector(const std::string &);
  void clearCollector();

The assembly representation is as such:

  define void @f() gc "shadow-stack" { ...

The implementation uses an on-the-side table to map Functions to 
collector names, such that there is no overhead. A StringPool is 
further used to unique collector names, which are extremely
likely to be unique per process.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44769 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 03:18:06 +00:00
Gordon Henriksen
afba8fe662 Reverting dtor devirtualization patch.
_sabre_: it has a major problem: by the time ~Value is run, all of the "parts" of the derived classes have been destroyed
_sabre_: the vtable lives to fight another day

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44760 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 02:14:30 +00:00
Chris Lattner
d418239da7 fix some warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44756 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 01:51:22 +00:00
Chris Lattner
429c8221cc Fix a big problem in the recent dtor refactoring work, now it passes 2007-11-19-InlineAsm.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44755 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 01:48:29 +00:00
Gordon Henriksen
ed455c8fa2 Devirtualizing Value destructor (PR889). Patch by Pawel Kunio!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44747 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 22:46:10 +00:00
Chris Lattner
46a6e79e60 Duncan points out that the subtraction is unneeded since hte code
knows the vector is not pow2


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44740 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 17:56:34 +00:00
Chris Lattner
f88380ba2c Fix PR1782, patch by Wojtek Matyjewicz!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44733 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 07:35:13 +00:00
Chris Lattner
0097555e01 Add support for splitting the operand of a return instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44728 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 00:06:19 +00:00
Bill Wendling
041b3f8356 Reverting 44702. It wasn't correct to rename them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44727 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 23:58:46 +00:00
Chris Lattner
eeaad40246 add many new cases to SplitResult. SplitResult now handles all the cases that LegalizeDAG does.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44726 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 23:58:27 +00:00
Chris Lattner
50187864c1 Implement splitting support for store, allowing us to compile:
%f8 = type <8 x float>

define void @test_f8(%f8* %P, %f8* %Q, %f8* %S) {
	%p = load %f8* %P		; <%f8> [#uses=1]
	%q = load %f8* %Q		; <%f8> [#uses=1]
	%R = add %f8 %p, %q		; <%f8> [#uses=1]
	store %f8 %R, %f8* %S
	ret void
}

into:

_test_f8:
	movaps	16(%rdi), %xmm0
	addps	16(%rsi), %xmm0
	movaps	(%rdi), %xmm1
	addps	(%rsi), %xmm1
	movaps	%xmm0, 16(%rdx)
	movaps	%xmm1, (%rdx)
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44725 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 23:24:26 +00:00
Chris Lattner
697b53e0b2 implement vector splitting of load, undef, and binops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44724 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 23:08:49 +00:00
Chris Lattner
e4af7b5a57 implement some methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44723 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 22:40:18 +00:00
Chris Lattner
13c6a1740c add scaffolding for splitting of vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44722 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 22:37:41 +00:00
Chris Lattner
e507c48eeb Remove dead file and directory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44720 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 22:17:33 +00:00
Chris Lattner
7514646b31 reorganize header to separate into functional blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44719 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 21:59:32 +00:00
Chris Lattner
ee88813275 split scalarization out to its own file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44718 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 20:30:28 +00:00
Chris Lattner
cc663a8112 Split expansion out into its own file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44717 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 20:27:32 +00:00
Chris Lattner
08d1275cb8 Split promotion support out to its own file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44716 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 20:24:38 +00:00
Chris Lattner
524825b626 Rename LegalizeDAGTypes.cpp -> LegalizeTypes.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44715 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 20:17:13 +00:00
Chris Lattner
dff67f5770 Split the class definition of DAGTypeLegalizer out into a header.
Leave it visibility hidden, but not in an anon namespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44714 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 20:16:06 +00:00
Chris Lattner
d185f64f82 add #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44710 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 19:03:30 +00:00
Chris Lattner
36d26c201f proper #include order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44707 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 19:00:03 +00:00
Gordon Henriksen
985cb62234 Adding a StringPool data structure, which GC will use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44705 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 17:07:47 +00:00
Chris Lattner
5aaddaa7b8 aesthetic changes, no functionality change. Evan, it's not clear
what 'Available' is, please add a comment near it and rename it
if appropriate.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44703 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 07:22:58 +00:00
Bill Wendling
320c630c1b Renaming:
isTriviallyReMaterializable -> hasNoSideEffects
  isReallyTriviallyReMaterializable -> isTriviallyReMaterializable


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44702 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 07:17:56 +00:00
Chris Lattner
d96428597b Fix a significant code quality regression I introduced on PPC64 quite
a while ago.  We now produce:

_foo:
	mflr r0
	std r0, 16(r1)
	ld r2, 16(r1)
	std r2, 0(r3)
	ld r0, 16(r1)
	mtlr r0
	blr 

instead of:

_foo:
	mflr r0
	std r0, 16(r1)
	lis r0, 0
	ori r0, r0, 16
	ldx r2, r1, r0
	std r2, 0(r3)
	ld r0, 16(r1)
	mtlr r0
	blr 

for:

void foo(void **X) {
  *X = __builtin_return_address(0);
}

on ppc64.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44701 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 07:04:58 +00:00
Chris Lattner
3fc027df4f implement __builtin_return_addr(0) on ppc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44700 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 06:59:59 +00:00
Chris Lattner
73944fb222 refactor some code to avoid overloading the name 'usesLR' in
different places to mean different things.  Document what the
one in PPCFunctionInfo means and when it is valid.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44699 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 06:39:11 +00:00
Bill Wendling
b48519cbad Incorporated comments from Evan and Chris:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071203/056043.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071203/056048.html



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44696 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 01:47:01 +00:00
Owen Anderson
5fc4abac3d Fix several cache coherence bugs in MemDep/GVN that were found. Also add some (disabled) debugging code
to make such problems easier to diagnose in the future, written by Duncan Sands.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44695 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 01:37:09 +00:00
Evan Cheng
1713d8bcff Doh
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44694 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 01:01:07 +00:00
Evan Cheng
7658445fa6 Fix a compilation warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44692 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 01:00:31 +00:00
Evan Cheng
5a759616b6 Fix a compilation warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44691 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 01:00:21 +00:00
Bill Wendling
0f940c95d4 Initial commit of the machine code LICM pass. It successfully hoists this:
_foo:
        li r2, 0
LBB1_1: ; bb
        li r5, 0
        stw r5, 0(r3)
        addi r2, r2, 1
        addi r3, r3, 4
        cmplw cr0, r2, r4
        bne cr0, LBB1_1 ; bb
LBB1_2: ; return
        blr 

to:

_foo:
        li r2, 0
        li r5, 0
LBB1_1: ; bb
        stw r5, 0(r3)
        addi r2, r2, 1
        addi r3, r3, 4
        cmplw cr0, r2, r4
        bne cr0, LBB1_1 ; bb
LBB1_2: ; return
        blr

ZOMG!! :-)

Moar to come...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44687 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07 21:42:31 +00:00
Evan Cheng
779ccea5b6 Add comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44686 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07 21:30:01 +00:00
Evan Cheng
8a86c3f3ae Much improved v8i16 shuffles. (Step 1).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44676 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07 08:07:39 +00:00
Evan Cheng
dfb1561434 Add an option to control this heuristic tweak so I can test it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44671 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07 00:28:32 +00:00
Evan Cheng
1076210ee3 Remove a bogus optimization. It's not possible to do a move to low element to a <8 x i16> or <16 x i8> vector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44669 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 22:14:22 +00:00
Dale Johannesen
e0e6fac5e9 Redo previous patch so optimization only done for i1.
Simpler and safer.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44663 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 17:53:31 +00:00
Evan Cheng
33faddc35d Turning simple splitting on. Start testing new coalescer heuristics as new llcbeta.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44660 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 08:54:31 +00:00
Chris Lattner
d3fd6d2b25 third time around: instead of disabling this completely,
only disable it if we don't know it will be obviously profitable.
Still fixme, but less so. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44658 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 07:47:55 +00:00
Chris Lattner
e00cbad78d Actually, disable this code for now. More analysis and improvements to
the X86 backend are needed before this should be enabled by default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44657 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 07:44:31 +00:00
Chris Lattner
e70da20f9a implement a readme entry, compiling the code into:
_foo:
	movl	$12, %eax
	andl	4(%esp), %eax
	movl	_array(%eax), %eax
	ret

instead of:

_foo:
	movl	4(%esp), %eax
	shrl	$2, %eax
	andl	$3, %eax
	movl	_array(,%eax,4), %eax
	ret

As it turns out, this triggers all the time, in a wide variety of
situations, for example, I see diffs like this in various programs:

-       movl    8(%eax), %eax
-       shll    $2, %eax
-       andl    $1020, %eax
-       movl    (%esi,%eax), %eax
+       movzbl  8(%eax), %eax
+       movl    (%esi,%eax,4), %eax


-       shll    $2, %edx
-       andl    $1020, %edx
-       movl    (%edi,%edx), %edx
+       andl    $255, %edx
+       movl    (%edi,%edx,4), %edx

Unfortunately, I also see stuff like this, which can be fixed in the
X86 backend:

-       andl    $85, %ebx
-       addl    _bit_count(,%ebx,4), %ebp
+       shll    $2, %ebx
+       andl    $340, %ebx
+       addl    _bit_count(%ebx), %ebp



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44656 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 07:33:36 +00:00
Chris Lattner
c95ba44b30 simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44655 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 06:25:04 +00:00
Chris Lattner
72b2df1f77 implement the rest of the functionality from SelectionDAGLegalize::ScalarizeVectorOp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44654 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 05:53:43 +00:00
Chuck Rose III
3012ac63d3 Adjust VStudio files to add JITMemoryManager files + include <cassert> from same.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44651 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 02:03:01 +00:00
Chris Lattner
348f665ee2 move some ashr-specific code out of commonShiftTransforms into visitAShr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44650 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 01:59:46 +00:00
Dale Johannesen
59f1e97ef3 Fix PR1842.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44649 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 01:43:46 +00:00
Chris Lattner
34c9433004 add a new ExecutionEngine::createJIT which can be used if you only want
to create a JIT.  This lets you specify JIT-specific configuration items
like the JITMemoryManager to use.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44647 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 01:34:04 +00:00
Chris Lattner
9f2f142d25 simplify creation of the interpreter, make ExecutionEngine ctor protected,
delete one ExecutionEngine ctor, minor cleanup.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44646 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 01:08:09 +00:00
Evan Cheng
5ef3a04b54 Fix for PR1831: if all defs of an interval are re-materializable, then it's a preferred spill candiate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44644 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 00:01:56 +00:00
Evan Cheng
bdcb726fca If both result of the {s|z}xt and its source are live out, rewrite all uses of the source with result of extension.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44643 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 23:58:20 +00:00
Chris Lattner
8907b4ba47 split the JIT memory management code out from the main JIT logic into its
own JITMemoryManager interface.  There is no functionality change with 
this patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44640 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 23:39:57 +00:00
Chris Lattner
81f2d71d52 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44638 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 23:05:06 +00:00
Chris Lattner
7d13015e32 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44637 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 22:58:19 +00:00
Scott Michel
42aa501491 Minor updates:
- Fix typo in SPUCallingConv.td
- Credit myself for CellSPU work
- Add CellSPU to 'all' host target list


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44627 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 21:23:16 +00:00
Duncan Sands
5d84afdc83 Commit 44487 broke bootstrap of llvm-gcc-4.2. It is
not yet clear why, but in the meantime work around the
problem by making less use of readnone/readonly info.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44626 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 21:03:28 +00:00
Evan Cheng
8c24e74b02 Added canFoldMemoryOperand for PPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44623 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 18:41:29 +00:00
Evan Cheng
7db2811f6e Update foldMemoryOperand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44621 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 18:36:37 +00:00
Chris Lattner
4d321c55c4 fix warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44620 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 18:32:18 +00:00
Chris Lattner
58dd8568ee allow this to build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44619 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 18:30:11 +00:00
Neil Booth
cc2335968f Prior commit updated wrong if, apologies.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44614 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 13:06:04 +00:00
Neil Booth
a89e45f754 Handle zero correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44613 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 13:01:24 +00:00
Evan Cheng
d120ffd26f MachineInstr can change. Store indexes instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44612 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 10:24:35 +00:00
Evan Cheng
adf8590690 If a split live interval is spilled again, remove the kill marker on its last use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44611 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 09:51:10 +00:00
Evan Cheng
f38d14f03e Clobber more bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44610 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 09:05:34 +00:00
Evan Cheng
b50bb8cf19 Fix kill info for split intervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44609 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 08:16:32 +00:00
Chris Lattner
60fb5ecccc more scalarization
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44608 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 07:45:02 +00:00
Chris Lattner
d36db029c8 scalarize vector binops
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44607 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 07:36:58 +00:00
Evan Cheng
018f9b020b - Mark last use of a split interval as kill instead of letting spiller track it.
This allows an important optimization to be re-enabled.
- If all uses / defs of a split interval can be folded, give the interval a
  low spill weight so it would not be picked in case spilling is needed (avoid
  pushing other intervals in the same BB to be spilled).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44601 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 03:22:34 +00:00
Evan Cheng
d64b5c82b9 Add a argument to storeRegToStackSlot and storeRegToAddr to specify whether
the stored register is killed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44600 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 03:14:33 +00:00
Scott Michel
b216a1b0b9 More stuff for CellSPU -- this should be enough to get an error-free
compilation (no files missing). Test cases remain to be checked in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44598 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 02:01:41 +00:00
Scott Michel
2466c3766d Updated source file headers to llvm coding standard.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44597 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 01:40:25 +00:00
Scott Michel
67d5755d69 Two missing files.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44596 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 01:31:18 +00:00
Scott Michel
564427eabd Main CellSPU backend files checked in. Intrinsics and autoconf files
remain.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44595 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 01:24:05 +00:00
Dale Johannesen
db1e30272c Handle 0 correctly in string->APFloat conversion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44594 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 01:10:19 +00:00
Evan Cheng
dd86ce3d57 Remove a unsafe optimization. This fixes 401.bzip2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44587 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-04 23:57:55 +00:00
Scott Michel
6637752998 More files in the CellSPU drop...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44584 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-04 22:35:58 +00:00
Scott Michel
266bc8f777 More of the Cell SPU code drop from "Team Aerospace".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44582 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-04 22:23:35 +00:00
Evan Cheng
35a3e4abb9 Spiller unfold optimization bug: do not clobber a reusable stack slot value unless it can be modified.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44575 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-04 19:19:45 +00:00
Chris Lattner
eb1819d1e5 Implement framework for scalarizing node results. This is sufficient
to codegen this:

define float @test_extract_elt(<1 x float> * %P) {
	%p = load <1 x float>* %P
	%R = extractelement <1 x float> %p, i32 0
	ret float %R
}




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44570 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-04 07:48:46 +00:00
Chris Lattner
13c207b5c8 start providing framework for scalarizing vectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44569 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-04 07:29:51 +00:00
Evan Cheng
597d10d84f Discard split intervals made empty due to folding.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44565 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-04 00:32:23 +00:00
Scott Michel
a589a08c91 More CellSPU files... more to follow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44559 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 23:14:43 +00:00
Scott Michel
01f4fc1a80 Makefile fragment for CellSPU.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44558 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 23:12:49 +00:00
Scott Michel
f2a2416bb4 First commit to CellSPU. More to follow
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44557 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 23:09:49 +00:00
Evan Cheng
e4b39007c9 Bug fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44549 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 21:31:55 +00:00
Anton Korobeynikov
05e5a7468a Regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44546 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 21:01:29 +00:00
Anton Korobeynikov
f8c751a663 Fix fallout from my last patch: don't reject varargs functions :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44545 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 21:00:45 +00:00
Duncan Sands
a3355ffb3d Rather than having special rules like "intrinsics cannot
throw exceptions", just mark intrinsics with the nounwind
attribute.  Likewise, mark intrinsics as readnone/readonly
and get rid of special aliasing logic (which didn't use
anything more than this anyway).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44544 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 20:06:50 +00:00
Chris Lattner
4cf4b69330 update file comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44543 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 19:43:18 +00:00
Anton Korobeynikov
c36284e93a Regenerate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44541 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 19:17:47 +00:00
Devang Patel
5ffdc56f53 If ExitValue operand is also defined in Loop header then
insert new ExitValue after this operand definition.

This fixes PR1828.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44539 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 19:17:21 +00:00
Anton Korobeynikov
c1d848dd11 More sanity checks for function types.
Thanks goes to PyPy folks for generating broken stuff :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44538 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 19:16:54 +00:00
Gordon Henriksen
94007ec7da Applying Anton's binmode fix to the other ofstream too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44535 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 14:50:37 +00:00
Anton Korobeynikov
3194012664 Sorry, typo :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44534 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 14:35:57 +00:00
Anton Korobeynikov
037dd942c9 Open output file correctly. This is extremely important for
windows-based hosts, where files are opened in text mode by default.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44533 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 14:28:26 +00:00
Evan Cheng
31d43183a4 Typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44532 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 10:00:00 +00:00
Evan Cheng
70306f8348 Update kill info for uses of split intervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44531 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 09:58:48 +00:00
Anton Korobeynikov
96ea209b52 Provide hook for _alloca to make JITing on Cygwin slightly happier :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44528 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 05:30:41 +00:00
Evan Cheng
aee4af68ae Remove redundant foldMemoryOperand variants and other code clean up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44517 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-02 08:30:39 +00:00
Duncan Sands
dff6710717 Integrate the readonly/readnone logic more deeply
into alias analysis.  This meant updating the API
which now has versions of the getModRefBehavior,
doesNotAccessMemory and onlyReadsMemory methods
which take a callsite parameter.  These should be
used unless the callsite is not known, since in
general they can do a better job than the versions
that take a function.  Also, users should no longer
call the version of getModRefBehavior that takes
both a function and a callsite.  To reduce the
chance of misuse it is now protected.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44487 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-01 07:51:45 +00:00
Evan Cheng
e3110d0825 Fix a bug where splitting cause some unnecessary spilling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44482 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-01 04:42:39 +00:00
Evan Cheng
e62f97c094 Allow some reloads to be folded in multi-use cases. Specifically testl r, r -> cmpl [mem], 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44479 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-01 02:07:52 +00:00
Ted Kremenek
f64903b7d8 Fixed subtle bug in Deserializer::JumpTo when jumping when the block-nesting
information matching did not exactly match the underlying stream's scoping
information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44470 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 22:45:05 +00:00
Evan Cheng
cddbb83ea8 Do not fold reload into an instruction with multiple uses. It issues one extra load.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44467 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 21:23:43 +00:00
Chris Lattner
cd883f203d chain update requests properly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44460 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 18:52:58 +00:00
Duncan Sands
6bb0ae4711 Small optimization of parameter attribute lookup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44458 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 18:20:58 +00:00
Duncan Sands
757d243167 Add a convenience method for modifying parameter
attributes.  While there, I noticed that not all
attribute methods returned a pointer-to-constant,
so I fixed that.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44457 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 18:19:18 +00:00
Duncan Sands
a8b974648f Check that there are not more attributes than
function parameters.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44452 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 15:52:20 +00:00
Devang Patel
962e0750a5 Provide a way to update DescGlobals cache directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44446 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 00:51:33 +00:00
Evan Cheng
cb3c330d39 Do not lose rematerialization info when spilling already split live intervals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44443 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 23:02:50 +00:00
Owen Anderson
1fb136464d Fix a miscompilation in spiff on PPC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44437 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 18:02:22 +00:00
Evan Cheng
1953d0cb7d Fix a major performance issue with splitting. If there is a def (not def/use)
in the middle of a split basic block, create a new live interval starting at
the def. This avoid artifically extending the live interval over a number of
cycles where it is dead. e.g.

bb1:
       = vr1204   (use / kill) <= new interval starts and ends here.
...
...
vr1204 =          (new def)   <= start a new interval here.
       = vr1204   (use)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44436 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 10:12:14 +00:00
Evan Cheng
c3fc7d9ec9 Replace the odd kill# hack with something less fragile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44434 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 09:49:23 +00:00
Duncan Sands
fd8890dbee Small parameter attributes cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44433 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 08:30:15 +00:00
Evan Cheng
0cbb1164b3 Fixed various live interval splitting bugs / compile time issues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44428 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 01:06:25 +00:00
Evan Cheng
c3868e04bf Kill info update bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44427 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 01:05:47 +00:00
Chris Lattner
4045e6db8c Work around a GCC bug, producing this code:
unsigned char *llvm_cbe_X;
...
  llvm_cbe_X = 0; *((void**)&llvm_cbe_X) = __builtin_stack_save();

instead of:

  llvm_cbe_X = __builtin_stack_save();

See PR1809 for details.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44415 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 21:26:17 +00:00
Chris Lattner
1f87300326 Implement ExpandOperationResult for ppc i64 fp->int, which fixes
CodeGen/Generic/fp_to_int.ll among others.  Its unclear why this 
just started failing...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44407 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 18:44:47 +00:00
Chris Lattner
5e037fce2b for consistency, allow a fallthrough if the final check returns null.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44406 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 18:30:18 +00:00
Duncan Sands
afa3b6da11 Add some convenience methods for querying attributes, and
use them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44403 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 17:07:01 +00:00
Duncan Sands
dd65a73af4 My compiler complains that "x always evaluates to true"
in this call:

	Result.IntVal = APInt(80, 2, x);

What is x?

	uint16_t x[8];

I deduce that the APInt constructor being used is this one:

  APInt(uint32_t numBits, uint64_t val, bool isSigned = false);

rather than this one:

  APInt(uint32_t numBits, uint32_t numWords, const uint64_t bigVal[]);

That doesn't seem right!  This fix compiles but is otherwise completely
untested.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44400 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 10:36:19 +00:00
Duncan Sands
0a488b320c Add missing newlines at EOF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44399 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 10:13:38 +00:00
Evan Cheng
cada245d06 Recover compile time regression.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44386 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 01:28:46 +00:00
Owen Anderson
e4ad9c70e4 Add MachineLoopInfo. This is not yet tested.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44384 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 22:47:08 +00:00
Chris Lattner
a3f61df4ff several entries got significantly better, though they still aren't done.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44382 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 22:41:52 +00:00
Chris Lattner
f1b1c5ed1a implement a trivial readme entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44380 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 22:36:16 +00:00
Chris Lattner
789db09cde Fix a crash on invalid code due to memcpy lowering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44378 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 22:14:42 +00:00
Chris Lattner
a8d700138a Make this actually work on systems that support ppc long double.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44374 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 20:45:25 +00:00
Chris Lattner
1c8f374a3b Unbreak all of the darwin/ppc32 JIT failures having to do
with not being able to find printf.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44373 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 20:41:32 +00:00
Nate Begeman
d73ab8884f Support returning non-power-of-2 vectors to unblock some work
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44371 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 19:28:48 +00:00
Andrew Lenharth
19914ed97f something wrong with this opt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44370 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 18:31:30 +00:00
Chris Lattner
a1afde77fa Unbreak backwards compatibility with bytecode format. Regression
introduced by this patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071126/055824.html



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44364 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 17:48:06 +00:00
Duncan Sands
dc024674ff Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls.  This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll).  Hopefully
a bitcode guru (who might that be? :) ) will fix it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44359 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 13:23:08 +00:00
Chris Lattner
b3d9cdb677 err, no really.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44352 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 06:14:32 +00:00
Chris Lattner
5ebfaa2c9d don't depend on ADL.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44351 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 06:14:12 +00:00
Owen Anderson
d735ee85db Make LoopInfoBase more generic, in preparation for having MachineLoopInfo. This involves a small interface change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44348 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-27 03:43:35 +00:00
Dan Gohman
77003040b2 Don't lower srem/urem X%C to X-X/C*C unless the division is actually
optimized. This avoids creating illegal divisions when the combiner is
running after legalize; this fixes PR1815. Also, it produces better
code in the included testcase by avoiding the subtract and multiply
when the division isn't optimized.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44341 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-26 23:46:11 +00:00
Owen Anderson
a16bbc9aa7 Fix another bug that was causing siod to fail.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44325 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-26 07:17:19 +00:00
Owen Anderson
97d4e51df1 Fix a silly bug that Nicholas noticed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44324 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-26 03:27:38 +00:00
Owen Anderson
00a6d1448d Allow GVN to eliminate read-only function calls when it can detect that they are redundant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44323 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-26 02:26:36 +00:00
Anton Korobeynikov
fd94dd58ff Remove another leak. Due to some reason AliasSetTracker didn't had any dtor...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44320 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 23:52:02 +00:00
Nick Lewycky
c54c561c9f Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44319 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 22:41:31 +00:00
Chris Lattner
cfa597569d Implement PR1822
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44318 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 21:27:53 +00:00
Duncan Sands
827cde1c83 Fix PR1816. If a bitcast of a function only exists because of a
trivial difference in function attributes, allow calls to it to
be converted to direct calls.  Based on a patch by Török Edwin.
While there, move the various lists of mutually incompatible
parameters etc out of the verifier and into ParameterAttributes.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44315 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 14:10:56 +00:00
Chris Lattner
8a594489bf Fix a long standing deficiency in the X86 backend: we would
sometimes emit "zero" and "all one" vectors multiple times,
for example:

_test2:
	pcmpeqd	%mm0, %mm0
	movq	%mm0, _M1
	pcmpeqd	%mm0, %mm0
	movq	%mm0, _M2
	ret

instead of:

_test2:
	pcmpeqd	%mm0, %mm0
	movq	%mm0, _M1
	movq	%mm0, _M2
	ret

This patch fixes this by always arranging for zero/one vectors
to be defined as v4i32 or v2i32 (SSE/MMX) instead of letting them be
any random type.  This ensures they get trivially CSE'd on the dag.
This fix is also important for LegalizeDAGTypes, as it gets unhappy
when the x86 backend wants BUILD_VECTOR(i64 0) to be legal even when
'i64' isn't legal.

This patch makes the following changes:

1) X86TargetLowering::LowerBUILD_VECTOR now lowers 0/1 vectors into
   their canonical types.
2) The now-dead patterns are removed from the SSE/MMX .td files.
3) All the patterns in the .td file that referred to immAllOnesV or
   immAllZerosV in the wrong form now use *_bc to match them with a
   bitcast wrapped around them.
4) X86DAGToDAGISel::SelectScalarSSELoad is generalized to handle 
   bitcast'd zero vectors, which simplifies the code actually.
5) getShuffleVectorZeroOrUndef is updated to generate a shuffle that
   is legal, instead of generating one that is illegal and expecting
   a later legalize pass to clean it up.
6) isZeroShuffle is generalized to handle bitcast of zeros.
7) several other minor tweaks.

This patch is definite goodness, but has the potential to cause random
code quality regressions.  Please be on the lookout for these and let 
me know if they happen.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44310 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 00:24:49 +00:00
Chris Lattner
c58d558a79 Implement expand support for MERGE_VALUEs that only produces one result.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44304 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-24 19:12:15 +00:00
Chris Lattner
ffc04d3e4f add a immAllZerosV_bc pattern fragment for consistency with others.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44303 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-24 19:02:07 +00:00
Chris Lattner
0a32092103 remove bogus assertion that broke CodeGen/Generic/cast-fp.ll on x86
among others.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44302 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-24 18:37:20 +00:00
Chris Lattner
87726ac0f9 Implement support for custom legalization in DAGTypeLegalizer::ExpandOperand.
Improve a comment.
Unbreak Duncan's carefully written path compression where I didn't realize
what was happening!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44301 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-24 18:11:42 +00:00
Chris Lattner
27a6c7380f Several changes:
1) Change the interface to TargetLowering::ExpandOperationResult to 
   take and return entire NODES that need a result expanded, not just
   the value.  This allows us to handle things like READCYCLECOUNTER,
   which returns two values.
2) Implement (extremely limited) support in LegalizeDAG::ExpandOp for MERGE_VALUES.
3) Reimplement custom lowering in LegalizeDAGTypes in terms of the new
   ExpandOperationResult.  This makes the result simpler and fully 
   general.
4) Implement (fully general) expand support for MERGE_VALUES in LegalizeDAGTypes.
5) Implement ExpandOperationResult support for ARM f64->i64 bitconvert and ARM
   i64 shifts, allowing them to work with LegalizeDAGTypes.
6) Implement ExpandOperationResult support for X86 READCYCLECOUNTER and FP_TO_SINT,
   allowing them to work with LegalizeDAGTypes.

LegalizeDAGTypes now passes several more X86 codegen tests when enabled and when
type legalization in LegalizeDAG is ifdef'd out.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44300 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-24 07:07:01 +00:00
Chris Lattner
94613166b7 add a note
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44299 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-24 06:13:33 +00:00
Chris Lattner
9e513acd31 Fix PR1816, by correcting the broken definition of APInt::countTrailingZeros.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44296 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 22:42:31 +00:00
Chris Lattner
8314a0cd0f simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44295 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 22:36:49 +00:00
Chris Lattner
5e557123ad Fix APInt::countTrailingZeros to return BitWidth if the input is zero instead of returning some random large number.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44294 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 22:36:25 +00:00
Chris Lattner
148083a529 add a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44293 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 22:35:18 +00:00
Chris Lattner
ecc0274a54 splice some lines together, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44292 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 22:34:59 +00:00
Duncan Sands
e4dc717585 Ding dong, the DoesntAccessMemoryFns and
OnlyReadsMemoryFns tables are dead!  We
get more, and more accurate, information
from gcc via the readnone and readonly
function attributes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44288 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 19:30:27 +00:00
Duncan Sands
bb65098d2c Remove some logic I thoughtlessly copied over
from the old ADCE implementation (there it was
correct because the transform was being done
for read-only functions).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44287 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 09:10:17 +00:00
Chris Lattner
42b5e08e71 Fix a bug where we'd try to find a scev value for a bitcast operand,
even though the bitcast operand did not have integer type.  This fixes
PR1814.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44286 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-23 08:46:22 +00:00
Chris Lattner
eec8b9a7d6 Fix PR1817.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44284 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 23:47:13 +00:00
Anton Korobeynikov
311c4b6e98 Don't crash on bogus llvm.noinline. This is first part of PR1817 (preventing reduction)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44281 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 22:30:10 +00:00
Duncan Sands
73d4bb6676 Turn invokes of nounwind functions into ordinary calls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44280 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 22:24:59 +00:00
Duncan Sands
920653d41e Teach alias analysis about readnone/readonly functions.
Based on a patch by Török Edwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44279 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 21:43:27 +00:00
Duncan Sands
5ef7be79e0 Readonly/readnone functions are allowed to throw
exceptions, so don't turn invokes of them into
calls.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44278 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 21:40:06 +00:00
Duncan Sands
ed4a2f1688 Rename the 'const' parameter attribute to 'readnone',
and the 'pure' parameter attribute to 'readonly'.
Names suggested by DannyB.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44273 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 20:23:04 +00:00
Nick Lewycky
83bb0055fd Instead of calculating constant factors, calculate the number of trailing
bits. Patch from Wojciech Matyjewicz.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44268 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 07:59:40 +00:00
Nick Lewycky
4ac0e8da4a Create nodes for inline asm so that we don't crash looking for the node later.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44267 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-22 03:07:37 +00:00
Duncan Sands
baccd5872e Fix a bug in which node A is replaced by node B, but later
node A gets back into the DAG again because it was hiding in
one of the node maps: make sure that node replacement happens
in those maps too.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44263 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-21 16:43:19 +00:00
Nick Lewycky
79a2c4f7a9 typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44262 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-21 05:21:54 +00:00
Dale Johannesen
9305dcb3c7 Fix compiler warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44261 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-21 00:45:00 +00:00
Chuck Rose III
0ccb93034a This change does a couple of things. First it gets the Visual Studio builds working.
I added the lexing files to the VStudio projects and removed the .l files from the 
VStudio projects.  There was a problem with use of strtoll in TGLexer.cpp and Chris
suggested switching to strtol, so that's included here.

Additionally, this checkin adds minimal x64 builds to the VStudio builds.  Build issues
related to x64 in the windows specific files for DynamicLibrary.inc and Singals.inc
are worked around, but not ultimately solved.  Binaries used to be stored in

...\win32\{Debug|Release}

but are now kept in

...\win32\bin\{win32|x64}\{Debug|Release}

intermediate files will continue to be stored in the individual project directories under 
win32.  

Some names will likely change in the future to reflect that the vstudio projects
are no longer 32-bit only, but I wanted to get things up and running today so kept away
from bigger restructuring.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44260 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-21 00:37:56 +00:00
Dale Johannesen
1d4ce2ab96 Fix .eh table linkage issues on Darwin. Some EH support
for Darwin PPC, but it's not fully working yet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44258 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-20 23:24:42 +00:00
Duncan Sands
5e41f65699 In order for parameter attribute uniquing to make
any sense it is important that ParamAttr::None gets
treated the same as not supplying an attribute at
all.  Rather than stripping ParamAttr::None out of
the list of attributes, assert if ParamAttr::None
is seen.  Fix up the bitcode reader which liked to
insert ParamAttr::None all over the place.  Patch
based on one by Török Edwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44250 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-20 14:09:29 +00:00
Nick Lewycky
6e801dc6c0 Small cleanup. Use APInt::getHighBitsSet method instead of shift left.
"setcc" -> "icmp op" in comments. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44249 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-20 08:44:50 +00:00
Nick Lewycky
cf96db2c1d Be more careful when transforming | to +. Patch from Wojciech Matyjewicz.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44248 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-20 08:24:44 +00:00
Chris Lattner
e400af83b3 ExpandUnalignedLoad doesn't handle vectors right at all apparently.
Fix a couple of problems:
1. Don't assume the VT-1 is a VT that is half the size.
2. Treat vectors of FP in the vector path, not the FP path.

This has a couple of remaining problems before it will work with
the code in PR1811: the code below this change assumes that it can
use extload/shift/or to construct the result, which isn't right for
vectors.

This also doesn't handle vectors of 1 or vectors that aren't pow-2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44243 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-19 21:38:03 +00:00
Chris Lattner
6c9c6800b8 Implement vector expand support for shuffle_vector. This fixes PR1811.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44242 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-19 21:16:54 +00:00
Dan Gohman
50cdabcfd5 Remove meaningless qualifiers from return types, avoiding compiler warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44240 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-19 20:46:23 +00:00
Chris Lattner
daf9bc8eee Implement splitting of UNDEF nodes. This is the first step towards fixing PR1811
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44239 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-19 20:21:32 +00:00
Dan Gohman
adf3eab773 Add explicit keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44234 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-19 15:30:20 +00:00
Dan Gohman
089617d9e3 Add support in SplitVectorOp for remainder operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44233 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-19 15:15:03 +00:00
Chris Lattner
2b1f1066ac Fix the Linker testcase regressions, by making MemoryBuffer::getFileOrSTDIN return
a valid but empty buffer if stdin is empty.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44219 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-18 18:52:28 +00:00
Chris Lattner
4ce0df6108 autoupgrade files that use callfoo as call foo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44218 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-18 18:43:24 +00:00
Chris Lattner
b28a6dce6d print a call to a fastcc function as:
call x86_fastcallcc void @func( i32* %X, i64 0 )
not:
	callx86_fastcallcc  void @func( i32* %X, i64 0 )

This fixes Codegen/X86/fast-cc-merge-stack-adj.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44217 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-18 18:32:16 +00:00
Chris Lattner
d343c6b70e Bugfix, this fixes CodeGen/X86/ldzero.ll and CodeGen/X86/2007-10-16-fp80_select.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44215 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-18 18:25:18 +00:00
Chris Lattner
8e3a8e0452 Replace the original flex lexer with a hand writen one. This
drops a dependency on flex and lets us make future progress more 
easily.  Yay for 2 fewer .cvs files to make silly conflicts with.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44213 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-18 08:46:26 +00:00