Commit Graph

1208 Commits

Author SHA1 Message Date
Dale Johannesen 3059924bdd When considering whether to inline Callee into Caller,
and that will make Caller too big to inline, see if it
might be better to inline Caller into its callers instead.
This situation is described in PR 2973, although I haven't
tried the specific case in SPASS.

llvm-svn: 83602
2009-10-09 00:11:32 +00:00
Chris Lattner a893f5bdf5 remove predicate simplifier, it never got the last bugs beaten
out of it, and jump threading, condprop and gvn are now getting
most of the benefit.  This was approved by Nicholas and Nicolas.

llvm-svn: 83390
2009-10-06 16:59:46 +00:00
Evan Phoenix 44e5dbcaf0 Extend ConstantFolding to understand signed overflow variants
llvm-svn: 83338
2009-10-05 22:53:52 +00:00
Chris Lattner 59d939894b teach the optimizer how to constant fold uadd/usub intrinsics.
llvm-svn: 83295
2009-10-05 05:26:04 +00:00
Chris Lattner 463716d559 instcombine shouldn't delete all null checks for mallocs.
This fixes PR5130.

llvm-svn: 83290
2009-10-05 02:47:47 +00:00
Chris Lattner 5f3cc06cd2 remove the GVNPRE pass. It has been subsumed by the GVN pass.
Ok'd by Owen.

llvm-svn: 83193
2009-10-01 02:18:36 +00:00
Dan Gohman 82ef61857e Add a testcase for r83011.
llvm-svn: 83012
2009-09-28 21:03:02 +00:00
Dan Gohman 21c0774ba9 Add a testcase to help test analysis preservation.
llvm-svn: 83002
2009-09-28 18:40:27 +00:00
Chris Lattner 0261b5d2d2 The select instruction is not neccesarily in the same block as the
phi nodes.  Make sure to phi translate from the right block. 

This fixes a llvm-building-llvm failure on GVN-PRE.cpp

llvm-svn: 82970
2009-09-28 06:49:44 +00:00
Dan Gohman 4dbb301f17 Move the dominator verification code out of special code embedded within
the PassManager code into a regular verifyAnalysis method.

Also, reorganize loop verification. Make the LoopPass infrastructure
call verifyLoop as needed instead of having LoopInfo::verifyAnalysis
check every loop in the function after each looop pass. Add a new
command-line argument, -verify-loop-info, to enable the expensive
full checking.

llvm-svn: 82952
2009-09-28 00:27:48 +00:00
Chris Lattner ae289632ef Enhance the previous fix for PR4895 to allow more values than just
simple constants for the true/false value of the select.  We now
do phi translation etc.  This really fixes PR4895 :)

llvm-svn: 82917
2009-09-27 20:18:49 +00:00
Chris Lattner facb867af3 implement PR4895, by making FoldOpIntoPhi handle select conditions
that are phi nodes.  Also tighten up FoldOpIntoPhi to treat constantexpr
operands to phis just like other variables, avoiding moving constantexpr
computations around.

Patch by Daniel Dunbar.

llvm-svn: 82913
2009-09-27 19:57:57 +00:00
Nick Lewycky b56e1ab033 Filecheckify this one test.
llvm-svn: 82888
2009-09-27 06:25:05 +00:00
Dan Gohman 62995c71a2 Fix SimplifyLibCalls to transfer attributes from callees rather than
calls, since direct calls don't always reflect the attributes of their
callees.

llvm-svn: 82867
2009-09-26 18:10:13 +00:00
Dan Gohman 5bafe38916 Fix a case where ScalarEvolution was expanding pointer arithmetic
to inttoptr/ptrtoint unnecessarily.

llvm-svn: 82864
2009-09-26 16:11:57 +00:00
Dan Gohman 48f7da742a I put the wrong rdar number in this test.
llvm-svn: 82829
2009-09-26 01:11:57 +00:00
Dan Gohman 5ffd53892d Transform pow(x, 0.5) to (x == -inf ? inf : fabs(sqrt(x))), which is
typically faster then doing a general pow.

llvm-svn: 82819
2009-09-25 23:10:17 +00:00
Dale Johannesen f6a987b784 Handle sqrt in CannotBeNegativeZero. absf and absl
appear to be misspellings, removed in favor of fabs*.

llvm-svn: 82796
2009-09-25 20:54:50 +00:00
Victor Hernandez e6ff7662b6 Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests.
llvm-svn: 82784
2009-09-25 18:11:52 +00:00
Torok Edwin 21bd8c9fc5 Constant propagating byval pointer is safe if function is readonly.
llvm-svn: 82700
2009-09-24 18:33:42 +00:00
Victor Hernandez 46cd467310 Auto-upgrade malloc instructions to malloc calls.
Reviewed by Devang Patel.

llvm-svn: 82694
2009-09-24 17:47:49 +00:00
Torok Edwin f95a450ef9 Don't constant propagate byval pointers, since they are not really pointers, but
rather structs passed by value.
This fixes PR5038.

llvm-svn: 82689
2009-09-24 09:47:18 +00:00
Chris Lattner cf295039e4 Fix PR5023: The instruction form of DominatorTree::dominates did not
take into consideration that the result of an invoke is only valid in
the normal dest, not the unwind dest.  This caused 'PHINode::hasConstantValue'
to return true in an invalid situation, causing mem2reg to delete a phi that
was actually needed.  This caused a crash building 483.xalancbmk.

llvm-svn: 82491
2009-09-21 22:39:35 +00:00
Chris Lattner 9045f235d2 fix PR5016, a crash I introduced in GVN handing first class
arrays and structs, which cannot be bitcast to integers.

llvm-svn: 82460
2009-09-21 17:24:04 +00:00
Chris Lattner 4d8af2f1ae enable non-local analysis and PRE of large store -> little load.
This doesn't kick in too much because of phi translation issues,
but this can be resolved in the future.

llvm-svn: 82447
2009-09-21 06:48:08 +00:00
Chris Lattner e2b8a80487 add pr#
llvm-svn: 82440
2009-09-21 05:57:47 +00:00
Chris Lattner 0a9616d906 Improve GVN to be able to forward substitute a small load
from a piece of a large store when both are in the same block.

This allows clang to compile the testcase in PR4216 to this code:

_test_bitfield:
	movl	4(%esp), %eax
	movl	%eax, %ecx
	andl	$-65536, %ecx
	orl	$32962, %eax
	andl	$40186, %eax
	orl	%ecx, %eax
	ret

This is not ideal, but is a whole lot better than the code produced
by llvm-gcc:

_test_bitfield:
	movw	$-32574, %ax
	orw	4(%esp), %ax
	andw	$-25350, %ax
	movw	%ax, 4(%esp)
	movw	7(%esp), %cx
	shlw	$8, %cx
	movzbl	6(%esp), %edx
	orw	%cx, %dx
	movzwl	%dx, %ecx
	shll	$16, %ecx
	movzwl	%ax, %eax
	orl	%ecx, %eax
	ret

and dramatically better than that produced by gcc 4.2:

_test_bitfield:
	pushl	%ebx
	call	L3
"L00000000001$pb":
L3:
	popl	%ebx
	movl	8(%esp), %eax
	leal	0(,%eax,4), %edx
	sarb	$7, %dl
	movl	%eax, %ecx
	andl	$7168, %ecx
	andl	$-7201, %ebx
	movzbl	%dl, %edx
	andl	$1, %edx
	sall	$5, %edx
	orl	%ecx, %ebx
	orl	%edx, %ebx
	andl	$24, %eax
	andl	$-58336, %ebx
	orl	%eax, %ebx
	orl	$32962, %ebx
	movl	%ebx, %eax
	popl	%ebx
	ret

llvm-svn: 82439
2009-09-21 05:57:11 +00:00
Chris Lattner b9f2bf46f7 fix a FileCheck bug where:
; CHECK: foo
; CHECK-NOT: foo
; CHECK: bar

would always fail.

llvm-svn: 82424
2009-09-21 02:30:42 +00:00
Daniel Dunbar ffb60d566f Work around a FileCheck bug, for now.
llvm-svn: 82416
2009-09-20 23:30:31 +00:00
Chris Lattner 7e6d56ebc5 Revert r82404, it is causing a bootstrap miscompile. This is very very
scary, as it indicates a lurking bug. yay.

llvm-svn: 82411
2009-09-20 22:44:26 +00:00
Chris Lattner 973f14c8fa this was not supposed to be committed
llvm-svn: 82409
2009-09-20 22:36:11 +00:00
Chris Lattner 236d2d5e7b implement and document support for CHECK-NOT
llvm-svn: 82408
2009-09-20 22:35:26 +00:00
Chris Lattner eea16a168a improve memdep to eliminate bitcasts (and aliases, and noop geps)
early for the stated reasons: this allows it to find more 
equivalences and depend less on code layout.

llvm-svn: 82404
2009-09-20 21:00:18 +00:00
Chris Lattner a0aa8fb6a6 Move CoerceAvailableValueToLoadType earlier in GVN.cpp. Hook it up
so that nonlocal and partially redundant loads can use it as well.
The testcase shows examples of craziness this can handle.  This triggers
*many* times in 176.gcc.

llvm-svn: 82403
2009-09-20 20:09:34 +00:00
Chris Lattner 1dd48c34e5 enhance GVN to forward substitute a stored value to a load
(and load -> load) when the base pointers must alias but when
they are different types.  This occurs very very frequently in
176.gcc and other code that uses bitfields a lot.

llvm-svn: 82399
2009-09-20 19:03:47 +00:00
Nick Lewycky 9b3ed87506 Peer through zext and sext to eliminate them when it is safe to do so.
llvm-svn: 82389
2009-09-20 07:31:25 +00:00
Nick Lewycky b0225ba289 Fold 'icmp eq (icmp), true' into an xor(icmp).
llvm-svn: 82386
2009-09-20 07:21:39 +00:00
Nick Lewycky 22fc051bd7 Rewrite this check so that it checks what it's supposed to and doesn't use
CHECK-NOT.

llvm-svn: 82383
2009-09-20 07:00:24 +00:00
Nick Lewycky 28260409f2 Teach the constant folder how to not a cmpinst.
llvm-svn: 82378
2009-09-20 06:24:51 +00:00
Nick Lewycky 4a03452077 Try turning icmp(bitcast(x), bitcast(y)) into icmp(bitcast(bitcast(x)), y) in
the hopes that the two bitcasts will merge.

llvm-svn: 82371
2009-09-20 05:48:50 +00:00
Nick Lewycky 605109d151 Teach the constant folder how to handle a few simple i1 cases.
llvm-svn: 82340
2009-09-20 00:04:02 +00:00
Dan Gohman e5acc61f03 Fix the comment in this test.
llvm-svn: 82051
2009-09-16 16:33:59 +00:00
Dan Gohman 3b7ce109ec Don't sink gep operators through phi nodes if the result would require
more than one phi, since that leads to higher register pressure on
entry to the phi. This is especially problematic when the phi is in
a loop header, as it increases register pressure throughout the loop.

llvm-svn: 81993
2009-09-16 02:01:52 +00:00
Chris Lattner d7490a4763 convert to filecheck
llvm-svn: 81848
2009-09-15 06:34:29 +00:00
Dan Gohman f9eafce3af When extending a memset range past the front, set the alignment of the
memset region to the alignment of the new start address.

llvm-svn: 81810
2009-09-14 23:39:10 +00:00
Dan Gohman a080159a7c Convert more tests to avoid llvm-as.
llvm-svn: 81545
2009-09-11 18:36:27 +00:00
Dan Gohman 0f3ef7be50 Eliminate more redundant llvm-as calls.
llvm-svn: 81540
2009-09-11 18:17:12 +00:00
Dan Gohman 1880092722 Change tests from "opt %s" to "opt < %s" so that opt doesn't see the
input filename so that opt doesn't print the input filename in the
output so that grep lines in the tests don't unintentionally match
strings in the input filename.

llvm-svn: 81537
2009-09-11 18:01:28 +00:00
Chris Lattner 7158513fe0 another random update
llvm-svn: 81531
2009-09-11 17:07:01 +00:00
Chris Lattner e54242dc02 fix a bunch of spurious failures for people whose home directory
is sabre.

llvm-svn: 81528
2009-09-11 17:02:12 +00:00