Commit Graph

45274 Commits

Author SHA1 Message Date
John Criswell 073e4d16c5 Do not attempt to do parial redundancy elimination on void values.
Also fixed a punctuation error in the header comment.
This fixes PR3775.

llvm-svn: 66542
2009-03-10 15:04:53 +00:00
Torok Edwin 51b4a28878 Global variables don't have a corresponding llvm.dbg.declare, yet it is possible
to obtain debug info about them.
Introduce helpers to access debug info for global variables. Also introduce a
helper that works for both local and global variables.

llvm-svn: 66541
2009-03-10 13:41:26 +00:00
Sanjiv Gupta afb355f281 Mark the Defs and Uses of STATUS register correctly, plus some reformatting.
llvm-svn: 66540
2009-03-10 10:35:34 +00:00
Evan Cheng 1c94228de3 If a function is marked alwaysinline, it must be inlined (possibly for correctness). Do so even if the callee has dynamic alloca and the caller doesn't.
llvm-svn: 66539
2009-03-10 07:57:50 +00:00
Bill Wendling a042a82408 Add radar number.
llvm-svn: 66534
2009-03-10 06:53:54 +00:00
Chris Lattner 1522e2498f wire up support for emitting "special" values from inline asm
format strings with the standard ${:foo} syntax.

llvm-svn: 66527
2009-03-10 05:37:13 +00:00
Dan Gohman b0d4009ec8 Add more information to the EFLAGS note.
llvm-svn: 66515
2009-03-10 00:26:23 +00:00
Stuart Hastings 9895a1c66a Check for warnings about inappropriate weak_imports.
Darwin-specific; marked XFAIL for others.

llvm-svn: 66514
2009-03-10 00:17:39 +00:00
Dan Gohman d5b35ee215 Add a note about EFLAGS optimization.
llvm-svn: 66508
2009-03-09 23:47:02 +00:00
Devang Patel 04852aa933 Ignore debug info while evaluating function.
llvm-svn: 66490
2009-03-09 23:04:12 +00:00
Dan Gohman f12436891e Don't record the increment instruction; just recompute it from the Phi
if needed. This simplifies the code a little, and is needed for an
upcoming refactoring.

llvm-svn: 66479
2009-03-09 22:04:01 +00:00
Chris Lattner 26161cdc6c Fix PR3724 by searching for the largest free block when
allocating memory in the JIT.  This is insanely inefficient, but
hey, most people implement their own memory managers anyway.

Patch by Eric Yew!

llvm-svn: 66472
2009-03-09 21:34:10 +00:00
Devang Patel 4a1b0776b3 Remove llvm.dbg.global_variables also.
llvm-svn: 66471
2009-03-09 21:32:28 +00:00
Dan Gohman b855164751 Fix a few more places where induction variable types were used
where memory access types are needed.

llvm-svn: 66470
2009-03-09 21:22:12 +00:00
Dan Gohman 5a4e31666d Use ReplacedTy instead of recomputing the same value.
llvm-svn: 66469
2009-03-09 21:19:58 +00:00
Dan Gohman 34e52ddb7d Use LoopInfo's getLoopLatch() instead of doing what it does manualy.
llvm-svn: 66467
2009-03-09 21:14:16 +00:00
Dan Gohman 70cc9875d8 Don't use an induction variable type as a memory access type.
Use VoidTy instead, to be properly conservative.

llvm-svn: 66463
2009-03-09 21:04:19 +00:00
Dan Gohman 917ffe4592 Factor out the code that determines the memory access type
of an instruction into a helper function.

llvm-svn: 66460
2009-03-09 21:01:17 +00:00
Chris Lattner dd282825a8 Clarify wording, patch by Stefanus Du Toit!
llvm-svn: 66458
2009-03-09 20:55:18 +00:00
Devang Patel 66f84e7a42 Add helper pass to remove llvm.dbg.declare intrinsics.
llvm-svn: 66454
2009-03-09 20:49:37 +00:00
Dan Gohman e201f8ff1d Move the sorting of the StrideOrder array earlier so that it doesn't
have to be done twice.

llvm-svn: 66449
2009-03-09 20:46:50 +00:00
Dan Gohman b5001909b0 Delete the isOnlyStride argument, which is unused.
llvm-svn: 66446
2009-03-09 20:41:15 +00:00
Dan Gohman 85875f7120 Tidy some LSR debug output: announce the loop it's about to process
before it does any processing.

llvm-svn: 66443
2009-03-09 20:34:59 +00:00
Evan Cheng 0ee0da841d ARM target now also recognize triplets like thumbv6-apple-darwin and set thumb mode and arch subversion. Eventually thumb triplets will go way and replaced with function notes.
llvm-svn: 66435
2009-03-09 20:25:39 +00:00
Chris Lattner 4249b9a698 Fix PR3763 by using proper APInt methods instead of uint64_t's.
llvm-svn: 66434
2009-03-09 20:22:18 +00:00
Gabor Greif c0bee2986c make the Op<N> methods protected, how it was intended to be
llvm-svn: 66430
2009-03-09 19:57:49 +00:00
Evan Cheng ce5dfb692a ARM isLegalAddressImmediate should check if type is a simple type now that optimizer can create values of funky scalar types.
llvm-svn: 66429
2009-03-09 19:15:00 +00:00
Evan Cheng fb8ded911e Yet another case where the spiller marked two uses of the same register on the same instruction as kill. This fixes PR3706.
llvm-svn: 66428
2009-03-09 19:00:05 +00:00
Evan Cheng 3807bb77fa Re-apply 66315, but restrict it to Darwin only.
llvm-svn: 66427
2009-03-09 18:28:37 +00:00
Bill Wendling c08580af44 Revert r66415. It's causing failures during bootstrap builds:
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c: In function '__muldi3':
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c:567: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c: In function '__lshrdi3':
/Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmgcc42.roots/llvmgcc42~obj/src/gcc/libgcc2.c:421: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.
make[5]: *** [libgcc/./_lshrdi3.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [libgcc/./_muldi3.o] Error 1
make[5]: *** [libgcc/./_negdi2.o] Error 1


--- Reverse-merging (from foreign repository) r66415 into '.':
U    include/llvm/BasicBlock.h
U    include/llvm/ADT/ilist_node.h
U    include/llvm/CodeGen/SelectionDAG.h
U    include/llvm/CodeGen/MachineFunction.h
U    include/llvm/CodeGen/MachineBasicBlock.h
U    include/llvm/Function.h

llvm-svn: 66426
2009-03-09 18:01:33 +00:00
Bob Wilson 4718296d64 Add a constructor for BuildVectorSDNode and revert the temporary workaround
from 66280.  I was unable to verify this with gcc-3.4.6, but with gcc-3.3 it
avoids the "base class with only non-default constructor in class without
a constructor" warning.  Apparently that warning was promoted to an error
in gcc-3.4.

llvm-svn: 66424
2009-03-09 17:07:15 +00:00
Duncan Sands 5cbd3d9c52 This debug info special case should no longer
be needed now that these intrinsics are marked
as not accessing memory.

llvm-svn: 66420
2009-03-09 11:57:08 +00:00
Chris Lattner 126dab2f76 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.

llvm-svn: 66417
2009-03-09 08:18:48 +00:00
Gabor Greif f183a3e95b in builds without asserts we do not need to allocate the Next pointer in "ghostly" sentinels
llvm-svn: 66415
2009-03-09 07:09:01 +00:00
Nick Lewycky 714976b70f Regenerate.
llvm-svn: 66407
2009-03-09 06:16:46 +00:00
Nick Lewycky b2f34f6211 Remove configurey-fu to autodetect hash_map and hash_set now that they are
no longer used in LLVM.

llvm-svn: 66406
2009-03-09 06:16:26 +00:00
Chris Lattner 317293b504 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.

llvm-svn: 66404
2009-03-09 05:52:15 +00:00
Chris Lattner 6f884e07c5 make GlobalValue::removeDeadConstantUsers() const.
llvm-svn: 66403
2009-03-09 05:50:45 +00:00
Chris Lattner 822015d96e testcase for PR3744
llvm-svn: 66401
2009-03-09 05:44:59 +00:00
Chris Lattner 4ce03e66a1 don't allow hash_map or hash_set.
llvm-svn: 66400
2009-03-09 05:20:45 +00:00
Owen Anderson f9a9cf96a1 Ignore debug intrinsics when computing dependences.
llvm-svn: 66399
2009-03-09 05:12:38 +00:00
Chris Lattner 0eab5ecb71 reimplement AliasSetTracker in terms of DenseMap instead of hash_map,
hopefully no functionality change.

llvm-svn: 66398
2009-03-09 05:11:09 +00:00
Chris Lattner 7c2ab26007 add a #include to improve portability to windows, as requested by
someone on llvmdev.

llvm-svn: 66397
2009-03-09 05:10:08 +00:00
Bill Wendling c6869f4695 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.

llvm-svn: 66396
2009-03-09 05:04:40 +00:00
Chris Lattner 4a48815bd9 fix Analysis/BasicAA/2004-12-08-BasicAACrash.ll by allowing opaque types.
llvm-svn: 66395
2009-03-09 04:56:22 +00:00
Chris Lattner f880ca2a31 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}
           ^

llvm-svn: 66394
2009-03-09 04:49:14 +00:00
Chris Lattner 6090a42fe5 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
              ^

llvm-svn: 66393
2009-03-09 04:46:40 +00:00
Chris Lattner 3b935fbcf2 Fix PR3743 - -mmacosx-version-min inappropriate for Mac OS X 10.4.11,
by stripping off any versions past the "10.4".

llvm-svn: 66392
2009-03-09 04:45:03 +00:00
Chris Lattner bb1ba7b7d3 add some explicit llvm:: qualifiers to the unix side, fix problems on the windows side.
llvm-svn: 66386
2009-03-08 19:13:45 +00:00
Nick Lewycky dc9642feb1 Keep calling-convention and tail-call bit when creating new invoke or call.
llvm-svn: 66384
2009-03-08 19:02:17 +00:00
Chris Lattner d5ac9d87b4 do not export all the X86FastISel symbols, ever.
llvm-svn: 66382
2009-03-08 18:44:31 +00:00
Nick Lewycky 9ec96d19e3 Fix comments, pointed out by Duncan Sands.
llvm-svn: 66381
2009-03-08 17:08:09 +00:00
Duncan Sands d725c99199 Apply ODR linkage changes accidentally dropped during
final cleaning.  This fixes a bunch of testsuite failures.

llvm-svn: 66380
2009-03-08 13:35:23 +00:00
Sebastian Redl 4c5c4a5ac3 Test commit
llvm-svn: 66378
2009-03-08 11:43:20 +00:00
Nick Lewycky fbed86a865 Mark function returns as noalias.
llvm-svn: 66369
2009-03-08 06:20:47 +00:00
Chris Lattner 21a84f3054 teach SROA to handle promoting vector allocas with a memset into them into
a vector type instead of into an integer type.

llvm-svn: 66368
2009-03-08 04:17:04 +00:00
Chris Lattner e408601cec fix typo
llvm-svn: 66367
2009-03-08 04:06:26 +00:00
Chris Lattner c009757761 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.

llvm-svn: 66366
2009-03-08 04:04:21 +00:00
Evan Cheng ec415efb44 Recognize triplets starting with armv5-, armv6- etc. And set the ARM arch version accordingly.
llvm-svn: 66365
2009-03-08 04:02:49 +00:00
Chris Lattner dc35e5b43a change the MemIntrinsic get/setAlignment method to take an unsigned
instead of a Constant*, which is what the clients of it really want.

llvm-svn: 66364
2009-03-08 03:59:00 +00:00
Evan Cheng de22116f39 If a MI uses the same register more than once, only mark one of them as 'kill'.
llvm-svn: 66363
2009-03-08 03:58:35 +00:00
Chris Lattner fee0a55c84 use MemTransferInst.
llvm-svn: 66362
2009-03-08 03:37:35 +00:00
Chris Lattner 334268a211 Introduce a new MemTransferInst pseudo class, which is a common
parent between MemCpyInst and MemMoveInst, simplify some code to
use it.

llvm-svn: 66361
2009-03-08 03:37:16 +00:00
Chris Lattner 393ac62837 add a note.
llvm-svn: 66360
2009-03-08 03:04:26 +00:00
Chris Lattner cfd1f7aa9f add a note.
llvm-svn: 66359
2009-03-08 01:54:43 +00:00
Chris Lattner ab5a443144 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.

llvm-svn: 66358
2009-03-08 01:51:30 +00:00
Chris Lattner 21cf4bf235 random cleanups.
llvm-svn: 66357
2009-03-08 01:47:41 +00:00
Nick Lewycky add31939ed Fix misaligned whitespace. No functionality change.
llvm-svn: 66355
2009-03-08 00:57:09 +00:00
Chris Lattner e313283199 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

llvm-svn: 66351
2009-03-07 23:32:02 +00:00
Nick Lewycky f653c2e18e Revert r66315. Fix the build on mixed 64/32 Linux systems.
llvm-svn: 66350
2009-03-07 22:17:05 +00:00
Mikhail Glushenkov d18088a7b1 Remove some duplication.
llvm-svn: 66347
2009-03-07 20:18:46 +00:00
Duncan Sands 12da8ce3d2 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.

llvm-svn: 66339
2009-03-07 15:45:40 +00:00
Gabor Greif 51bbcf834c simplify the way how traits get hold of the symbol table
llvm-svn: 66336
2009-03-07 12:33:24 +00:00
Gabor Greif 6e1ca84d2c further simplifications arising from peruse of the more declarative interface
llvm-svn: 66333
2009-03-07 10:49:57 +00:00
Gabor Greif 5cd1b25822 Remove the burden of dealing with list offsets
from SymbolTableListTraits' clients, and
intead request a nice declarative interface.
Cleans up an IMHO ugly wart.

llvm-svn: 66331
2009-03-07 10:00:35 +00:00
Chris Lattner 6acb4d6f7e 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

llvm-svn: 66330
2009-03-07 08:15:47 +00:00
Nate Begeman 52b696c7ad 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.

llvm-svn: 66324
2009-03-07 06:41:19 +00:00
Dan Gohman ff659b5b86 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.

llvm-svn: 66318
2009-03-07 01:58:32 +00:00
Evan Cheng 9153f08c74 If ARCH is x86_64, pass -m64 to the host compiler. -m32 for i386. This makes sure the JIT work correctly.
llvm-svn: 66315
2009-03-07 01:40:17 +00:00
Daniel Dunbar d39e0974fe Add IRBuilder::CreateConstGEP{1, 2}_{32, 64}.
- Names are lame, but it seems better to be explicit.

llvm-svn: 66295
2009-03-06 22:26:07 +00:00
Daniel Dunbar 3b3c3f02cc Rename my makefile debugging rule to prevent accidental collisions.
llvm-svn: 66294
2009-03-06 22:23:25 +00:00
Daniel Dunbar dcf8d3c9eb Add Module::getNamedValue; use to normalize access to Module symbol
table.
 - No functionality change.

llvm-svn: 66289
2009-03-06 22:04:43 +00:00
Dale Johannesen 6e447e08ee Fix another case where debug info interferes with
an optimization.

llvm-svn: 66288
2009-03-06 21:08:33 +00:00
Tanya Lattner 8498d2dd2b Add default constructor to SDNode to make gcc 3.4.6 happy.
llvm-svn: 66280
2009-03-06 18:17:45 +00:00
Dan Gohman ec5f2b5e05 Use c_str() to force the string to be nul-terminated.
llvm-svn: 66279
2009-03-06 18:13:15 +00:00
Mikhail Glushenkov 211f3c0f97 Add a comment.
llvm-svn: 66278
2009-03-06 17:59:58 +00:00
Chris Lattner 040ce02174 some nits noticed by Duncan
llvm-svn: 66274
2009-03-06 17:05:04 +00:00
Chris Lattner a59518276e fix header comment and include guard.
llvm-svn: 66273
2009-03-06 16:54:19 +00:00
Chris Lattner e48f897ca7 add a bunch more passes to the C bindings (PR3734), patch by
Lennart Augustsson!

llvm-svn: 66272
2009-03-06 16:52:18 +00:00
Mikhail Glushenkov 0658cac532 Trailing whitespace.
llvm-svn: 66269
2009-03-06 12:25:56 +00:00
Mikhail Glushenkov 6a64f907c6 Trailing whitespace.
llvm-svn: 66268
2009-03-06 12:21:40 +00:00
Duncan Sands ed7228319a 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!

llvm-svn: 66267
2009-03-06 10:21:56 +00:00
Chris Lattner e41a434f89 on apple systems, integrate nicely with crash reporter.
llvm-svn: 66264
2009-03-06 07:19:54 +00:00
Devang Patel 25b625165f While converting an aggregate to scalare, ignore and remove aggregate's debug info.
llvm-svn: 66262
2009-03-06 07:03:54 +00:00
Chris Lattner 4c1e9541d3 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

llvm-svn: 66260
2009-03-06 06:45:05 +00:00
Zhou Sheng c8e5085cd3 Remove this as dbginfo intrinsics has been defined as
IntrNoMem.

llvm-svn: 66256
2009-03-06 06:05:01 +00:00
Devang Patel 5aed7765b8 While hoisting instruction to speculatively execute simple bb, ignore dbg intrinsics.
llvm-svn: 66255
2009-03-06 06:00:17 +00:00
Chris Lattner 609873608e various cosmetic cleanups.
llvm-svn: 66254
2009-03-06 05:53:14 +00:00
Chris Lattner e6d1e8d0cc this wasn't intended to go in.
llvm-svn: 66252
2009-03-06 05:42:30 +00:00
Chris Lattner e3fc2d13be Change various llvm utilities to use PrettyStackTraceProgram in
their main routines.  This makes the tools print their argc/argv
commands if they crash.

llvm-svn: 66248
2009-03-06 05:34:10 +00:00
Devang Patel bab43b4c91 Do not count DbgInfoIntrinsic while estimating loop header size.
llvm-svn: 66245
2009-03-06 03:51:30 +00:00
Devang Patel e8c6d3102d Skip DbgInfoIntrinsic.
llvm-svn: 66244
2009-03-06 02:59:27 +00:00
Gordon Henriksen 1424861a62 Committing unsaved changes that should've been with r66237.
llvm-svn: 66242
2009-03-06 02:42:47 +00:00
Dan Gohman 15af5524a4 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.

llvm-svn: 66240
2009-03-06 02:23:01 +00:00
Dan Gohman bcad718f73 Use CloneModule's ValueMap to avoid needing to look up
functions by name. This fixes PR718.

llvm-svn: 66239
2009-03-06 02:16:23 +00:00
Gordon Henriksen 3519d5d828 Incorporate feedback to improve GarbageCollection.html.
llvm-svn: 66237
2009-03-06 01:57:32 +00:00
Dale Johannesen fb1caf3e1f Don't assign rank numbers to debug intrinsic "calls".
This is needed so debug info doesn't change codegen.

llvm-svn: 66235
2009-03-06 01:41:59 +00:00
Bill Wendling 6d8472b9cc 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.

llvm-svn: 66234
2009-03-06 01:41:15 +00:00
Devang Patel fc507a1f9c Revert 66224.
llvm-svn: 66233
2009-03-06 01:39:36 +00:00
Devang Patel d926aaa28f Revert rev. 66167.
We are still not out of woods yet.

llvm-svn: 66232
2009-03-06 01:37:41 +00:00
Oscar Fuentes afbe97542f CMake: auto-discover project files under the projects/ subdirectory.
Patch by Viktar Zviarovich!

llvm-svn: 66230
2009-03-06 01:16:52 +00:00
Gabor Greif b3805878d1 do not close friendship with every odd class
llvm-svn: 66229
2009-03-06 01:09:27 +00:00
Evan Cheng 5fd4fc76bf SRThreshold is meant to be inclusive.
llvm-svn: 66227
2009-03-06 00:56:43 +00:00
Dale Johannesen 073ab5acab Tweak the check for promotable alloca's to handle
debug intrinsics correctly.

llvm-svn: 66225
2009-03-06 00:42:50 +00:00
Devang Patel ab16577ade Do not let debug info prevert globalopt from shriking a global vars to boolean.
llvm-svn: 66224
2009-03-06 00:21:00 +00:00
Devang Patel 0c970f94e9 Add "check/remove dbg var" helper routines.
llvm-svn: 66223
2009-03-06 00:19:37 +00:00
Bob Wilson 8932717421 Fix a parallel make race condition by swapping the order of -I directories.
The .cmi files are generated in $(ObjDir) and then copied to $(OcamlDir).
The ocamldep output references the .cmi files in $(ObjDir), so make kicks
off a dependent compile as soon as the local copy is generated.  If the
copy to $(OcamlDir) is not complete at that point, the compiler will read
the partially copied file and complain about a "Corrupted compiled
interface".  Searching $(ObjDir) first avoids this.

llvm-svn: 66217
2009-03-06 00:00:58 +00:00
Dan Gohman 4f42ac8400 Fix a bugpoint bug on anonymous functions. Instead of looking up
functions in the new module by name, use the ValueMap provided by
CloneModule to do the lookups.

llvm-svn: 66216
2009-03-05 23:20:46 +00:00
Dan Gohman c719d73eec 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.

llvm-svn: 66207
2009-03-05 21:32:23 +00:00
Dan Gohman e014b193c9 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.

llvm-svn: 66206
2009-03-05 21:29:28 +00:00
Dan Gohman 2c2f192c74 Fix the "test" optimization to recognize "dec" as an add of
negative one, as subtracts of immediates are canonicalized
to adds.

llvm-svn: 66180
2009-03-05 19:32:48 +00:00
Dan Gohman 14cc4a458e Make this test more thorough. Not only should there be no %esi,
there should be no spilling of anything.

llvm-svn: 66179
2009-03-05 19:31:32 +00:00
Chris Lattner bbbbbf30bd move some code to gracefully handle the case when a handler crashes.
llvm-svn: 66171
2009-03-05 18:22:14 +00:00
Devang Patel 709d6ac46d 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

llvm-svn: 66167
2009-03-05 18:12:02 +00:00
Duncan Sands 96f52eb13f Add missing file.
llvm-svn: 66160
2009-03-05 09:19:13 +00:00
Owen Anderson 380b3838f6 (Hopefully) silence a warning.
llvm-svn: 66158
2009-03-05 08:23:20 +00:00
Nick Lewycky c540cc6591 Regenerate.
llvm-svn: 66157
2009-03-05 08:20:44 +00:00
Nick Lewycky 16aac9994b Autodetect the availability of -export-dynamic in the linker.
llvm-svn: 66156
2009-03-05 08:20:21 +00:00
Owen Anderson ad503987a8 Be more careful about choosing restore points when doing restore folding. This fixes some subtle miscompilations.
llvm-svn: 66147
2009-03-05 07:19:18 +00:00
Chris Lattner 8d0fe8cd90 Daniel wanted the stack printed upside down. Perhaps he
feels a kinship to machine stacks that grow down.  Now we get
stuff like this:

Stack dump:
0.	Program arguments: clang clang_crash_Iw2Osj.mi 
1.	/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/xmmintrin.h:624:1: parsing function body '_mm_cvtpi16_ps'
2.	/Developer/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin9/4.0.1/include/xmmintrin.h:624:1: in compound statement ('{}')
Abort

llvm-svn: 66145
2009-03-05 07:03:49 +00:00
Chris Lattner 2674eb4bd1 indicate what the program args line is.
llvm-svn: 66144
2009-03-05 06:51:42 +00:00
Chris Lattner 0c33d436b3 switch this message back to only being in -debug mode.
llvm-svn: 66143
2009-03-05 06:48:16 +00:00
Nate Begeman 359df7420f When allocating stubs, keep track of which Functions are referencing the stub.
This invalidates the stubs in the resolver map when they are no longer referenced,
and should the JIT memory manager ever pick up a deallocateStub interface, the
JIT could reclaim the memory for unused stubs as well.

llvm-svn: 66141
2009-03-05 06:34:37 +00:00
Evan Cheng b7922dee15 Do not split edges to EH landing pads. It will cause code size explosion.
llvm-svn: 66140
2009-03-05 06:31:26 +00:00
Evan Cheng f0bfc6a675 Fix how livein live intervals are handled. Previously it could end at MBB start. Sorry, no small test case possible.
llvm-svn: 66129
2009-03-05 03:34:26 +00:00
Dale Johannesen 78ab338024 Fix another case where debug info was affecting
codegen.  I convinced myself it was OK to skip all
pointer bitcasts here too.

llvm-svn: 66122
2009-03-05 02:06:48 +00:00
Zhou Sheng abe4192442 Ignore the debug info intrinsics when looking for dependency through basic block.
llvm-svn: 66119
2009-03-05 01:45:43 +00:00
Bill Wendling 0bf1ded7bd Add comment to emphasize that the while body is empty.
llvm-svn: 66115
2009-03-05 01:08:35 +00:00
Dale Johannesen ad6b47377f Fix another case where a dbg.declare meant something
had 2 uses instead of 1.

llvm-svn: 66112
2009-03-05 00:39:02 +00:00
Bill Wendling 19ce8619da Should have XFAILed this test.
llvm-svn: 66086
2009-03-04 22:29:34 +00:00
Bill Wendling 803da0db79 Temporarily revert r65994. It was causing rdar://6646455.
llvm-svn: 66083
2009-03-04 22:02:09 +00:00
Gabor Greif ebd4998c1f ooops, forgot to include the pointless-write eliminator in my previous checkin
llvm-svn: 66081
2009-03-04 21:54:31 +00:00
Dale Johannesen a31552c151 Add some cautionary comments.
llvm-svn: 66080
2009-03-04 21:53:29 +00:00
Chris Lattner 68061d5995 add some helper classes for building light-weight symbolic stack traces
that get printed when a program crashes.  This is the first step of many.

llvm-svn: 66076
2009-03-04 21:40:23 +00:00
Dale Johannesen df4226c0e2 Re-commit 65975 and a fix for the problem that
was causing llvm-gcc to fail to build.  I've
verified it bootstraps now; good enough for me.

llvm-svn: 66073
2009-03-04 21:24:04 +00:00
Chris Lattner 4fdd042d9e Add a new 'AddSignalHandler' function to Signals.h that allows
arbitrary functions to be run when a crash happens.  Delete 
RemoveDirectoryOnSignal as it is dead and has never had clients.

Change PrintStackTraceOnErrorSignal to be implemented in terms of
AddSignalHandler.

I updated the Win32 versions of these APIs, but can't test them.
If there are any problems, I'd be happy to fix them as well.

llvm-svn: 66072
2009-03-04 21:21:36 +00:00
Dan Gohman 66476b582d Fix this comment.
llvm-svn: 66065
2009-03-04 20:50:23 +00:00
Dan Gohman ae0035ee15 Add an assertion for a condition that's always true, and not
immediately obvious.

llvm-svn: 66062
2009-03-04 20:49:01 +00:00
Gabor Greif de2fb05246 Give sentinel traits the right to determine the policy where the sentinel is kept.
This should result in less indirect memory accesses, less dead writes and tighter code.

llvm-svn: 66061
2009-03-04 20:36:44 +00:00
Dan Gohman 55d7b2ac4f Re-apply 66008, now that the unfoldMemoryOperand bug is fixed.
llvm-svn: 66058
2009-03-04 19:44:21 +00:00