Commit Graph

27546 Commits

Author SHA1 Message Date
Nick Lewycky
199aa3c09c Mark function returns as noalias.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66369 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 06:20:47 +00:00
Chris Lattner
29e641761e teach SROA to handle promoting vector allocas with a memset into them into
a vector type instead of into an integer type.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66368 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 04:17:04 +00:00
Chris Lattner
cf1bb08368 fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66367 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 04:06:26 +00:00
Chris Lattner
c570487d45 Enhance SROA to "promote to scalar" allocas which are
memcpy/memmove'd into or out of.  This fixes a serious
perf issue that Nate ran into.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 04:04:21 +00:00
Evan Cheng
4b1747430a Recognize triplets starting with armv5-, armv6- etc. And set the ARM arch version accordingly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66365 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 04:02:49 +00:00
Chris Lattner
dfe964ce8c change the MemIntrinsic get/setAlignment method to take an unsigned
instead of a Constant*, which is what the clients of it really want.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66364 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 03:59:00 +00:00
Evan Cheng
821b8560e7 If a MI uses the same register more than once, only mark one of them as 'kill'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 03:58:35 +00:00
Chris Lattner
8e10844ad0 use MemTransferInst.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 03:37:35 +00:00
Chris Lattner
3ce5e887ae Introduce a new MemTransferInst pseudo class, which is a common
parent between MemCpyInst and MemMoveInst, simplify some code to
use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66361 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 03:37:16 +00:00
Chris Lattner
ff9dcee534 add a note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66360 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 03:04:26 +00:00
Chris Lattner
b34487dcba add a note.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66359 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 01:54:43 +00:00
Chris Lattner
476769498e implement an optimization to codegen c ? 1.0 : 2.0 as load { 2.0, 1.0 } + c*4.
For 2009-03-07-FPConstSelect.ll we now produce:

_f:
	xorl	%eax, %eax
	testl	%edi, %edi
	movl	$4, %ecx
	cmovne	%rax, %rcx
	leaq	LCPI1_0(%rip), %rax
	movss	(%rcx,%rax), %xmm0
	ret

previously we produced:

_f:
	subl	$4, %esp
	cmpl	$0, 8(%esp)
	movss	LCPI1_0, %xmm0
	je	LBB1_2	## entry
LBB1_1:	## entry
	movss	LCPI1_1, %xmm0
LBB1_2:	## entry
	movss	%xmm0, (%esp)
	flds	(%esp)
	addl	$4, %esp
	ret

on PPC the code also improves to:

_f:
	cntlzw r2, r3
	srwi r2, r2, 5
	li r3, lo16(LCPI1_0)
	slwi r2, r2, 2
	addis r3, r3, ha16(LCPI1_0)
	lfsx f1, r3, r2
	blr 

from:

_f:
	li r2, lo16(LCPI1_1)
	cmplwi cr0, r3, 0
	addis r2, r2, ha16(LCPI1_1)
	beq cr0, LBB1_2	; entry
LBB1_1:	; entry
	li r2, lo16(LCPI1_0)
	addis r2, r2, ha16(LCPI1_0)
LBB1_2:	; entry
	lfs f1, 0(r2)
	blr 

This also improves the existing pic-cpool case from:

foo:
	subl	$12, %esp
	call	.Lllvm$1.$piclabel
.Lllvm$1.$piclabel:
	popl	%eax
	addl	$_GLOBAL_OFFSET_TABLE_ + [.-.Lllvm$1.$piclabel], %eax
	cmpl	$0, 16(%esp)
	movsd	.LCPI1_0@GOTOFF(%eax), %xmm0
	je	.LBB1_2	# entry
.LBB1_1:	# entry
	movsd	.LCPI1_1@GOTOFF(%eax), %xmm0
.LBB1_2:	# entry
	movsd	%xmm0, (%esp)
	fldl	(%esp)
	addl	$12, %esp
	ret

to:

foo:
	call	.Lllvm$1.$piclabel
.Lllvm$1.$piclabel:
	popl	%eax
	addl	$_GLOBAL_OFFSET_TABLE_ + [.-.Lllvm$1.$piclabel], %eax
	xorl	%ecx, %ecx
	cmpl	$0, 4(%esp)
	movl	$8, %edx
	cmovne	%ecx, %edx
	fldl	.LCPI1_0@GOTOFF(%eax,%edx)
	ret

This triggers a few dozen times in spec FP 2000.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66358 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 01:51:30 +00:00
Chris Lattner
d2e936a513 random cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66357 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 01:47:41 +00:00
Chris Lattner
6f6923fd4f fix a serious pessimization that Tron on IRC pointed out where we would
"boolify" pointers, generating really awful code because getting the pointer
value requires a load itself.  Before:

_foo:
	movb	$1, _X.b
	ret
_get:
	xorl	%ecx, %ecx
	movb	_X.b, %al
	testb	%al, %al
	movl	$_Y, %eax
	cmove	%ecx, %eax
	ret

With the xform disabled:

_foo:
	movl	$_Y, _X
	ret
_get:
	movl	_X, %eax
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66351 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 23:32:02 +00:00
Duncan Sands
667d4b8de6 Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr.  These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global.  In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time.   This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function.  If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body.  The
code generators on the other hand map weak and weak_odr linkage
to the same thing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 15:45:40 +00:00
Gabor Greif
0dd2a6a89f simplify the way how traits get hold of the symbol table
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66336 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 12:33:24 +00:00
Gabor Greif
7afd3e1599 further simplifications arising from peruse of the more declarative interface
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66333 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 10:49:57 +00:00
Chris Lattner
922a881f32 When a crash signal is delivered do two things: remove all of our
signal handlers to prevent reentrance on unrelated things (a sigabort
where the handle bus errors) also, clear the signal mask so that the
signal doesn't infinitely reissue.  This fixes rdar://6654827 -
Crash causes clang to loop



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66330 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 08:15:47 +00:00
Nate Begeman
b9c6c9bfe4 Finish cross-process JIT work, and clean up previous work.
1. When the JIT is asked to remove a function, updating it's
   mapping to 0, we invalidate any function stubs used only 
   by that function.  Now, also invalidate the JIT's mapping
   from the GV the stub pointed to, to the address of the GV.

2. When dlsym stubs for cross-process JIT are enabled, do not
   abort just because a named function cannot be found in the
   JIT's process.

3. Fix various assumptions about when it is ok to use the lazy
   resolver when non-lazy JITing is enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66324 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 06:41:19 +00:00
Dan Gohman
3112581441 Arithmetic instructions don't set EFLAGS bits OF and CF bits
the same say the "test" instruction does in overflow cases,
so eliminating the test is only safe when those bits aren't
needed, as is the case for COND_E and COND_NE, or if it
can be proven that no overflow will occur. For now, just
restrict the optimization to COND_E and COND_NE and don't
do any overflow analysis.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66318 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 01:58:32 +00:00
Daniel Dunbar
f56ec6423c Add Module::getNamedValue; use to normalize access to Module symbol
table.
 - No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66289 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 22:04:43 +00:00
Dale Johannesen
3a56d14641 Fix another case where debug info interferes with
an optimization.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66288 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 21:08:33 +00:00
Dan Gohman
c7ffc9efd6 Use c_str() to force the string to be nul-terminated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66279 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 18:13:15 +00:00
Chris Lattner
57c03831cc add a bunch more passes to the C bindings (PR3734), patch by
Lennart Augustsson!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66272 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 16:52:18 +00:00
Duncan Sands
fc5940d2a0 While thinking about the one-definition-rule and trying
to find a tiny mouse hole to squeeze through, it struck
me that globals without a name can be considered internal
since they can't be referenced from outside the current
module.  This patch makes GlobalOpt give them internal
linkage.  Also done for aliases even though they always
have names, since in my opinion anonymous aliases should
be allowed for consistency with global variables and
functions.  So if that happens one day, this code is ready!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66267 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 10:21:56 +00:00
Chris Lattner
49155ffaba on apple systems, integrate nicely with crash reporter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66264 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 07:19:54 +00:00
Devang Patel
00e389c8c8 While converting an aggregate to scalare, ignore and remove aggregate's debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66262 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 07:03:54 +00:00
Chris Lattner
d6f16587ab Sprinkle some PrettyStackEntry magic into the passmanager. With this, we now
get nice and happy stack traces when we crash in an optimizer or codegen.  For
example, an abort put in UnswitchLoops now looks like this:

Stack dump:
0.	Program arguments: clang pr3399.c -S -O3 
1.	<eof> parser at end of file
2.	per-module optimization passes
3.	Running pass 'CallGraph Pass Manager' on module 'pr3399.c'.
4.	Running pass 'Loop Pass Manager' on function '@foo'
5.	Running pass 'Unswitch loops' on basic block '%for.inc'
Abort



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66260 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 06:45:05 +00:00
Zhou Sheng
7157228a58 Remove this as dbginfo intrinsics has been defined as
IntrNoMem.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66256 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 06:05:01 +00:00
Devang Patel
06b1e67d44 While hoisting instruction to speculatively execute simple bb, ignore dbg intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66255 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 06:00:17 +00:00
Chris Lattner
f957436254 various cosmetic cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 05:53:14 +00:00
Chris Lattner
0070ce511e this wasn't intended to go in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66252 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 05:42:30 +00:00
Chris Lattner
cc14d25dd9 Change various llvm utilities to use PrettyStackTraceProgram in
their main routines.  This makes the tools print their argc/argv
commands if they crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66248 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 05:34:10 +00:00
Devang Patel
3f43a7021f Do not count DbgInfoIntrinsic while estimating loop header size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66245 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 03:51:30 +00:00
Devang Patel
c64bc16cae Skip DbgInfoIntrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66244 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 02:59:27 +00:00
Dan Gohman
16e8eda4b8 Fix ScheduleDAGRRList::CopyAndMoveSuccessors' handling of nodes
with multiple chain operands. This can occur when the scheduler
has added chain operands to a node that already has a chain
operand, in order to handle physical register dependencies.

This fixes an llvm-gcc bootstrap failure on x86-64 introduced
in r66058.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66240 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 02:23:01 +00:00
Dale Johannesen
03afd02ca2 Don't assign rank numbers to debug intrinsic "calls".
This is needed so debug info doesn't change codegen.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 01:41:59 +00:00
Bill Wendling
5601699d7c When we split a basic block, there's a default branch to the newly created BB.
Delete this default branch, because we're going to generate our own.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66234 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 01:41:15 +00:00
Devang Patel
771281f180 Revert 66224.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66233 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 01:39:36 +00:00
Devang Patel
743cdf8edf Revert rev. 66167.
We are still not out of woods yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66232 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 01:37:41 +00:00
Evan Cheng
67fca63da2 SRThreshold is meant to be inclusive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66227 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 00:56:43 +00:00
Dale Johannesen
2511abf6e7 Tweak the check for promotable alloca's to handle
debug intrinsics correctly.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66225 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 00:42:50 +00:00
Devang Patel
f70bda2f81 Do not let debug info prevert globalopt from shriking a global vars to boolean.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66224 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 00:21:00 +00:00
Devang Patel
c79e118247 Add "check/remove dbg var" helper routines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66223 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 00:19:37 +00:00
Dan Gohman
1f4af262d5 Don't use plain INC32 and DEC32 on x86-64; it needs
INC64_32r and INC64_16r, because these instructions are encoded
differently on x86-64. This fixes JIT regressions on x86-64 in
kimwitu++ and others.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66207 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 21:32:23 +00:00
Dan Gohman
51bb47480e When creating X86ISD::INC and X86ISD::DEC nodes, only add one operand.
The extra operand didn't appear to cause any trouble, but it was
erroneous regardless.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66206 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 21:29:28 +00:00
Dan Gohman
4bfcf2a2a6 Fix the "test" optimization to recognize "dec" as an add of
negative one, as subtracts of immediates are canonicalized
to adds.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66180 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 19:32:48 +00:00
Chris Lattner
0f6290d698 move some code to gracefully handle the case when a handler crashes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66171 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 18:22:14 +00:00
Devang Patel
5049600672 GlobalOpt only process non constant local GVs while optimizing global vars.
If non constant local GV named A is used by a constant local GV named B (e.g. llvm.dbg.variable) and B is not used by anyone else then eliminate A as well as B.

In other words, debug info should not interfere in removal of unused GV.
--This life, and those below, will be ignored--

M    test/Transforms/GlobalOpt/2009-03-03-dbg.ll
M    lib/Transforms/IPO/GlobalOpt.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66167 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 18:12:02 +00:00
Duncan Sands
30a31ebf7f Add missing file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66160 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 09:19:13 +00:00