Commit Graph

27562 Commits

Author SHA1 Message Date
Duncan Sands
ee199f72bb This debug info special case should no longer
be needed now that these intrinsics are marked
as not accessing memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 11:57:08 +00:00
Chris Lattner
ea3a9ff53d just remove the use_empty() check entirely, the only reason it
existed was for llvm-gcc 3.4 (which used the __main hack) which 
is really really long dead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66417 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 08:18:48 +00:00
Chris Lattner
f231c07228 Make the code generator rip of dead constant expr uses before deciding
whether a global is dead or not.  This should fix PR3749 - linker adds 
spurious use to appending globals.  I can't reasonably add a testcase
for this, because the bc writer/reader strip dead constant users.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66404 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 05:52:15 +00:00
Chris Lattner
319e63234a make GlobalValue::removeDeadConstantUsers() const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66403 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 05:50:45 +00:00
Owen Anderson
f6cec85a4b Ignore debug intrinsics when computing dependences.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66399 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 05:12:38 +00:00
Chris Lattner
d7168ddb11 reimplement AliasSetTracker in terms of DenseMap instead of hash_map,
hopefully no functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66398 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 05:11:09 +00:00
Bill Wendling
ccbdc7ab82 Pass in a std::string when getting the names of debugging things. This cuts down
on the number of times a std::string is created and copied.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 05:04:40 +00:00
Chris Lattner
bce6091d95 fix Analysis/BasicAA/2004-12-08-BasicAACrash.ll by allowing opaque types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66395 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 04:56:22 +00:00
Chris Lattner
a9a9e07d1c Fix two classes of bugs. First:
validate an invariant so that the asmparser rejects a bad construct
instead of the verifier.  Before:

llvm-as: assembly parsed, but does not verify as correct!
Invalid struct return type!
i64 (%struct.Type*, %struct.Type*)* @foo

after:

llvm-as: t.ll:5:8: functions with 'sret' argument must return void
define i64 @foo(%struct.Type* noalias nocapture sret %agg.result, %struct.Type* nocapture byval %t) nounwind {
       ^


Second, check that void is only used where allowed (in function return types) not in
arbitrary places, fixing PR3747 - Crash in llvm-as with void field in struct.  We
now reject that example with:

$ llvm-as t.ll
llvm-as: t.ll:1:12: struct element can not have void type
%x = type {void}
           ^





git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66394 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 04:49:14 +00:00
Chris Lattner
c66996ab34 Fix PR3746 - Crash in isel with GEP of function pointer
by checking that the top-level type of a gep is sized. This
causes us to reject the example with:

llvm-as: t2.ll:2:16: invalid getelementptr indices
getelementptr i32()* null, i32 1
              ^



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66393 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 04:46:40 +00:00
Chris Lattner
f48ba7b74c add some explicit llvm:: qualifiers to the unix side, fix problems on the windows side.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66386 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 19:13:45 +00:00
Nick Lewycky
d694a789cb Keep calling-convention and tail-call bit when creating new invoke or call.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66384 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 19:02:17 +00:00
Chris Lattner
087fcf3e89 do not export all the X86FastISel symbols, ever.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66382 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 18:44:31 +00:00
Nick Lewycky
4bfba9da0a Fix comments, pointed out by Duncan Sands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66381 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 17:08:09 +00:00
Duncan Sands
a05ef5e107 Apply ODR linkage changes accidentally dropped during
final cleaning.  This fixes a bunch of testsuite failures.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66380 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 13:35:23 +00:00
Sebastian Redl
1183c71efc Test commit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66378 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-08 11:43:20 +00:00
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