Commit Graph

9765 Commits

Author SHA1 Message Date
Dan Gohman
30fc5bbfd1 Fix a bug which prevented tail merging of return instructions in
beneficial cases. See the changes in test/CodeGen/X86/tail-opts.ll and
test/CodeGen/ARM/ifcvt2.ll for details.

The fix is to change HashEndOfMBB to hash at most one instruction,
instead of trying to apply heuristics about when it will be profitable to
consider more than one instruction. The regular tail-merging heuristics
are already prepared to handle the same cases, and they're more precise.

Also, make test/CodeGen/ARM/ifcvt5.ll and
test/CodeGen/Thumb2/thumb2-branch.ll slightly more complex so that they
continue to test what they're intended to test.

And, this eliminates the problem in
test/CodeGen/Thumb2/2009-10-15-ITBlockBranch.ll, the testcase from
PR5204. Update it accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102907 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-03 14:35:47 +00:00
Duncan Sands
57b6e9eb6c Remove the -enable-sjlj-eh option, which doesn't do anything.
Remove the -enable-eh option which is only used by the JIT,
and replace it with -jit-enable-eh.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102865 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-02 15:36:26 +00:00
Chris Lattner
83f66fe614 revert r102831. We already delete dead readonly calls in
other places, killing a valid transformation is not the right
answer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102850 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 17:19:38 +00:00
Anton Korobeynikov
17458a786e Insert ANY_EXTEND node instead of invalid truncate during DAG Combining (X & 1),
when needed. This fixes PR7001

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102838 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 12:52:34 +00:00
Anton Korobeynikov
1b17614a72 Do folding for indirect branches, where possible
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102836 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 12:28:21 +00:00
Anton Korobeynikov
69d5b48bc3 Implement indirect branches on MSP430
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102835 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 12:04:32 +00:00
Owen Anderson
1b4a38646f Disable the call-deletion transformation introduced in r86975. Without
halting analysis, it is illegal to delete a call to a read-only function.
The correct solution is almost certainly to add a "must halt" attribute and
only allow deletions in its presence.

XFAIL the relevant testcase for now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102831 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 08:34:28 +00:00
Chris Lattner
bccb41afc8 fix PR5009 by making CGSCCPM realize that a call was devirtualized
if an indirect call site was removed and a direct one was added, not
just if an indirect call site was modified to be direct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102830 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 06:38:43 +00:00
Chris Lattner
1951e108be rename test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102829 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 06:34:13 +00:00
Chris Lattner
6da12e6767 Implement rdar://6295824 and PR6724 with two tiny changes
that can have a big effect :).  The first is to enable the
iterative SCC passmanager juice that kicks in when the
scc passmgr detects that a function pass has devirtualized
a call.  In this case, it will rerun all the passes it 
manages on the SCC, up to the iteration count limit (4). This
is useful because a function pass may devirualize a call, and
we want the inliner to inline it, or pruneeh to infer stuff
about it, etc.

The second patch is to add *all* call sites to the 
DevirtualizedCalls list the inliner uses.  This list is
about to get renamed, but the jist of this is that the 
inliner now reconsiders *all* inlined call sites as candidates
for further inlining.  The intuition is this that in cases 
like this:

f() { g(1); }     g(int x) { h(x); }

We analyze this bottom up, and may decide that it isn't 
profitable to inline H into G.  Next step, we decide that it is
profitable to inline G into F, and do so, which means that F 
now calls H.  Even though the call from G -> H may not have been
profitable to inline, the call from F -> H may be (in this case
because a constant allows folding etc).

In my spot checks, this doesn't have a big impact on code.  For
example, the LLC output for 252.eon grew from 0.02% (from
317252 to 317308) and 176.gcc actually shrunk by .3% (from 1525612
to 1520964 bytes).  252.eon never iterated in the SCC Passmgr,
176.gcc iterated at most 1 time.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102823 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 01:15:56 +00:00
Chris Lattner
159528702a The inliner has traditionally not considered call sites
that appear due to inlining a callee as candidates for
futher inlining, but a recent patch made it do this if
those call sites were indirect and became direct.

Unfortunately, in bizarre cases (see testcase) doing this
can cause us to infinitely inline mutually recursive
functions into callers not in the cycle.  Fix this by
keeping track of the inline history from which callsite
inline candidates got inlined from.

This shouldn't affect any "real world" code, but is required
for a follow on patch that is coming up next.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102822 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 01:05:10 +00:00
Bill Wendling
3f755d7ec6 Test failing too much on too many platforms.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102812 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-01 00:12:33 +00:00
Bill Wendling
1c2d7f1196 Maybe it needs sse2?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102802 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 23:19:29 +00:00
Bill Wendling
6c84fdeb9c Force 64-bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102800 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 22:45:20 +00:00
Chris Lattner
4b7b42c831 Dan recently disabled recursive inlining within a function, but we
were still inlining self-recursive functions into other functions.

Inlining a recursive function into itself has the potential to
reduce recursion depth by a factor of 2, inlining a recursive
function into something else reduces recursion depth by exactly 
1.  Since inlining a recursive function into something else is a
weird form of loop peeling, turn this off.

The deleted testcase was added by Dale in r62107, since then
we're leaning towards not inlining recursive stuff ever.  In any
case, if we like inlining recursive stuff, it should be done 
within the recursive function itself to get the algorithm 
recursion depth win.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102798 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 22:37:22 +00:00
Bill Wendling
d71bb56275 EXTRACT_VECTOR_ELT of an INSERT_VECTOR_ELT may have the same index, but the
indexes could be of a different value type. Or not even using the same SDNode
for the constant (weird, I know). Compare the actual values instead of the
pointers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102791 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 22:19:17 +00:00
Jakob Stoklund Olesen
8387d7db19 The local register allocator has to spill dirty callee saved registers before a
call that might throw. The landing pad assumes that all registers are in stack
slots.

We used to spill those dirty CSRs after the call, and the stack slots would be
wrong when arriving at the landing pad.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102770 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 21:19:29 +00:00
Devang Patel
0aa885d3ab Preserve debug info attached with call instruction while eliminating dead argument.
Radar 7927803


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102760 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 20:23:54 +00:00
Devang Patel
95dbda70c4 New test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102746 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 19:39:29 +00:00
Dan Gohman
5b61b3818a Add lint checks for invalid uses of memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102733 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 19:05:00 +00:00
Dan Gohman
01baea3c2c Add -o /dev/null to some tests which don't care about their output.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102722 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 17:42:30 +00:00
Evan Cheng
f2d36d91e2 Fix test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102694 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 06:00:56 +00:00
Evan Cheng
1361796dd0 Another sibcall bug. If caller and callee calling conventions differ, then it's only safe to do a tail call if the results are returned in the same way.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102683 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-30 01:12:32 +00:00
Jakob Stoklund Olesen
f07fc974d3 Reject really weird coalescer case when trying to merge identical subregisters
of different register classes. e.g.

  %reg1048:3<def> = EXTRACT_SUBREG %RAX<kill>, 3

Where %reg1048 is a GR32 register. This is not impossible to handle, but it is
pretty hard and very rare.

This should unbreak the dragonegg builder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102672 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-29 23:47:46 +00:00
Evan Cheng
3f54c64a98 Load folding tail call should not use ebp / rbp after it's popped. PEI
should use esp / rsp to reference frame instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102596 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-29 05:08:22 +00:00
Kevin Enderby
9ac7282117 Fixed the word sized Bit Scan Forward/Reverse instructions, they needed the
Operand size override prefix to be part of their records.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102556 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-28 23:20:40 +00:00
Chris Lattner
c1c4595d1f fix this to work with objdir != srcdir
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102547 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-28 22:34:35 +00:00
Dale Johannesen
de5996e33a Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102545 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-28 22:23:46 +00:00
Dale Johannesen
21a9bd91e9 Test for llvm-gcc checkin 102543.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102544 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-28 22:17:33 +00:00
Devang Patel
518e21ae8a Update tests. Now DBG_VALUE instruction is created only if alloca corresponding to llvm.dbg.declare is missing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102524 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-28 20:27:48 +00:00
Chris Lattner
f3f325b82f fix PR6112 - When globalopt (or any other pass) does RAUW(@G, %G),
metadata references in non-function-local MDNodes should drop to 
null.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102519 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-28 20:16:12 +00:00
Chris Lattner
e87f7bb50e Rework global alignment computation again. Now we do round up
alignment of globals to the preferred alignment, but only when
there is no section specified on the global (by far the common
case).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102515 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-28 19:58:07 +00:00
Evan Cheng
2bce5f4b56 Enable i16 to i32 promotion by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102493 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-28 08:30:49 +00:00
Evan Cheng
da3a8a647d Update tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102487 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-28 01:53:13 +00:00
Devang Patel
28ff35d030 Emit debug info for byval parameters.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102486 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-28 01:39:28 +00:00
Evan Cheng
ed33b13a10 Do not count kill, implicit_def instructions as printed instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102453 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-27 19:38:45 +00:00
Chris Lattner
4c4d0c0cc5 round zero-byte .zerofill directives up to 1 byte. This
should fix some "g++.dg-struct-layout-1" failures, 
rdar://7886017


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102421 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-27 07:41:44 +00:00
Dale Johannesen
caf6750455 Un-XFAIL this on ppc. My enabling of dbg_declare handling
in ISel fixed it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102404 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-27 00:01:42 +00:00
Chris Lattner
ee9eb411ff on darwin empty functions need to codegen into something of non-zero length,
otherwise labels get incorrectly merged.  We handled this by emitting a 
".byte 0", but this isn't correct on thumb/arm targets where the text segment
needs to be a multiple of 2/4 bytes.  Handle this by emitting a noop.  This
is more gross than it should be because arm/ppc are not fully mc'ized yet.

This fixes rdar://7908505



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102400 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26 23:37:21 +00:00
Bob Wilson
5dfa87ecc6 Handle register-to-register copies within the tGPR class.
Radar 7896289


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102396 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26 23:20:08 +00:00
Devang Patel
5098da0a7e Use DW_AT_entry_pc instead of DW_AT_low_pc/DW_AT_high_pc pair. This simplifies debug range entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102394 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26 22:54:28 +00:00
Dan Gohman
948c8a3e3d When checking whether the special handling for an addrec increment which
doesn't dominate the header is needed, don't check whether the increment
expression has computable loop evolution. While the operands of an
addrec are required to be loop-invariant, they're not required to 
dominate any part of the loop. This fixes PR6914.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102389 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26 21:46:36 +00:00
Dan Gohman
585c40129f Add a comment to this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102387 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26 21:37:43 +00:00
Chris Lattner
567dd1f5d0 fix PR6921 a different way. Intead of increasing the
alignment of globals with a specified alignment, we fix
common variables to obey their alignment.  Add a comment
explaining why this behavior is important.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102365 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26 18:46:46 +00:00
Chris Lattner
f74e25f60c Revert r102300/102301, which serious broke objc apps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102359 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26 18:30:45 +00:00
Chris Lattner
8581c260d3 fix PR6940: sitofp(undef) folds to 0.0, not undef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102358 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-26 18:21:23 +00:00
Chris Lattner
84c6e60c02 testcase for PR6913
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102303 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-25 05:51:14 +00:00
Chris Lattner
ff1c0444ea this passes now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102301 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-25 05:49:31 +00:00
Chris Lattner
044698b39a Fix PR6921: globals were not getting correctly rounded up to their
preferred alignment unless they were common or some other special
case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102300 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-25 05:30:43 +00:00
Dan Gohman
1d367988e2 Generalize LSR's OptimizeMax to handle the new kinds of max expressions
that indvars may use, now that indvars is recognizing le and ge loops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102235 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-24 03:13:44 +00:00