Commit Graph

9765 Commits

Author SHA1 Message Date
Dan Gohman
9f93d30a26 ScalarEvolution support for <= and >= loops.
Also, generalize ScalarEvolutions's min and max recognition to handle
some new forms of min and max that this change makes more common.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102234 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-24 03:09:42 +00:00
Chris Lattner
d46316e7ae no longer xfail
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102220 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 22:39:33 +00:00
Stuart Hastings
56dda57679 Per Chris, fuse four trivial tests using grep (r102199) into one that uses FileCheck.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102216 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 22:12:57 +00:00
Dan Gohman
6e8fd90602 Change TargetData's algorithm for computing defualt vector type
alignment to match what's used in clang and GCC for __alignof, rather
than trying to guess what Legalize is going to be doing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102206 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 19:41:15 +00:00
Stuart Hastings
e3ff9ba40c Add some missing x86 patterns for movdq2q. Fixes two (LLVM-)GCC DejaGNU testcases. Radar 6881029.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102199 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 19:03:32 +00:00
Chris Lattner
12104464f3 fix some failures my callgraph dump format change broke.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102197 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 18:38:40 +00:00
Chris Lattner
a56c1c5d4c testcase for the bug that required a patch to be reverted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102195 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 18:31:01 +00:00
Dan Gohman
fafb890ee2 Fix LSR to tolerate cases where ScalarEvolution initially
misses an opportunity to fold add operands, but folds them
after LSR has separated them out. This fixes rdar://7886751.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102157 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 01:55:05 +00:00
Chris Lattner
62cc838b90 disable my previous inliner patch, it appears to be busting self-host.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102153 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-23 00:41:03 +00:00
Chris Lattner
fe9af3b1f7 The inliner was choosing to not consider call sites
that appear in the SCC as a result of inlining as candidates
for inlining.  Change this so that it *does* consider call 
sites that change from being indirect to being direct as a
result of inlining.  This allows it to completely 
"devirtualize" the testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102146 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22 23:37:35 +00:00
Jim Grosbach
3a1287b470 Update ARM DAGtoDAG for matching UBFX instruction for unsigned bitfield
extraction. This fixes PR5998.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102144 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22 23:24:18 +00:00
Devang Patel
9517144f53 Remove the test for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102135 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22 22:06:28 +00:00
Devang Patel
18ee3bb0b7 Adjust debug range offsets for isWeakForLinker() functions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102127 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22 20:52:00 +00:00
Chris Lattner
b61789d4dd add a DEBUG call so that -debug lists when CGSCCPM iterates.
Fix RefreshCallGraph to use CGN->replaceCallEdge instead of hand
rolling its own loop.  replaceCallEdge properly maintains the
reference counts of the nodes, fixing a crash exposed by the
iterative callgraph stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102120 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22 20:42:33 +00:00
Dan Gohman
ddb3eafc32 Don't attempt to analyze values which are obviously undef. This fixes some
assertion failures in extreme cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102042 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-22 01:35:11 +00:00
Evan Cheng
e3dd8550c6 Do not try to optimize a copy that has already been marked for deletion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102027 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21 20:57:54 +00:00
Evan Cheng
e566763b19 Implement -disable-non-leaf-fp-elim which disable frame pointer elimination
optimization for non-leaf functions. This will be hooked up to gcc's
-momit-leaf-frame-pointer option. rdar://7886181


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101984 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21 03:18:23 +00:00
Johnny Chen
52d2b0ed00 Thumb instructions which have reglist operands at the end and predicate operands
before reglist were not properly handled with respect to IT Block.  Fix that by
creating a new method ARMBasicMCBuilder::DoPredicateOperands() used by those
instructions for disassembly.  Add a test case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101974 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21 01:01:19 +00:00
Chris Lattner
08e322db8a Implement (but don't enable) PR6724 and rdar://6295824. In short,
we have RefreshCallGraph detect when a function pass devirtualizes
a call, and have CGSCCPassMgr iterate (up to a count) when this 
happens.  This allows (in the example) GVN to devirtualize the 
call in foo, then the inliner to inline it away.

This is not currently enabled because I haven't done any analysis
on the (potentially substantial) code size or performance impact of
doing this, and guess what, it exposes callgraph updating bugs in
various passes.  This is progress though, and you can play with it
by passing -max-cg-scc-iterations=5 to opt.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101973 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21 00:47:40 +00:00
Evan Cheng
30fdb5c2ac - Clean up some crappy code which deals with coalescing of copies which look at
extract_subreg / insert_subreg, etc.
- Add support for more aggressive insert_subreg coalescing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101971 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21 00:44:22 +00:00
Dan Gohman
d217cfcf46 Revert r101471. For tight recursive functions which have multiple
recursive callsites, inlining can reduce the number of calls by
exponential factors, as it does in
MultiSource/Benchmarks/Olden/treeadd. More involved heuristics
will be needed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101969 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21 00:43:30 +00:00
Dan Gohman
bc7588eb68 Add another variant of this test which found a place where
CodeGen's ComputeMaskedBits was being over-conservative when computing
bits for an ADD.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101963 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-21 00:19:28 +00:00
Chris Lattner
d6139425f5 teach the x86 address matching stuff to handle
(shl (or x,c), 3) the same as (shl (add x, c), 3)
when x doesn't have any bits from c set.

This finishes off PR1135.  Before we compiled the block to:
to:

LBB0_3:                                 ## %bb
	cmpb	$4, %dl
	sete	%dl
	addb	%dl, %cl
	movb	%cl, %dl
	shlb	$2, %dl
	addb	%r8b, %dl
	shlb	$2, %dl
	movzbl	%dl, %edx
	movl	%esi, (%rdi,%rdx,4)
	leaq	2(%rdx), %r9
	movl	%esi, (%rdi,%r9,4)
	leaq	1(%rdx), %r9
	movl	%esi, (%rdi,%r9,4)
	addq	$3, %rdx
	movl	%esi, (%rdi,%rdx,4)
	incb	%r8b
	decb	%al
	movb	%r8b, %dl
	jne	LBB0_1

Now we produce:

LBB0_3:                                 ## %bb
	cmpb	$4, %dl
	sete	%dl
	addb	%dl, %cl
	movb	%cl, %dl
	shlb	$2, %dl
	addb	%r8b, %dl
	shlb	$2, %dl
	movzbl	%dl, %edx
	movl	%esi, (%rdi,%rdx,4)
	movl	%esi, 8(%rdi,%rdx,4)
	movl	%esi, 4(%rdi,%rdx,4)
	movl	%esi, 12(%rdi,%rdx,4)
	incb	%r8b
	decb	%al
	movb	%r8b, %dl
	jne	LBB0_1



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101958 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 23:18:40 +00:00
Johnny Chen
56a1afb6b0 When doing Thumb disassembly, there's no need to consider t2ADDrSPi12/t2SUBrSPi12,
as their generic counterparts t2ADDri12/t2SUBri12 should suffice.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101929 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 18:45:24 +00:00
Bill Wendling
b545cde675 Move CodeGen/X86/2010-04-19-DAGCombineCrash.ll into CodeGen/X86/crash.ll. Also
reduce.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101925 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 18:14:47 +00:00
Johnny Chen
ef37e3abb7 For t2LDRT, t2LDRBT, t2LDRHT, t2LDRSBT, and t2LDRSHT, if Rn(Inst{19-16})=='1111',
transform the Opcode to the corresponding t2LDR*pci counterpart.

Ref: A8.6.86 LDRT, A8.6.65 LDRBT, A8.6.77 LDRHT, A8.6.81 LDRSBT, A8.6.85 LDRSHT


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101915 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 17:28:50 +00:00
Devang Patel
eff666f108 Add RUN:
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101913 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 17:20:10 +00:00
Chris Lattner
44e05080f8 Bill's change in r95336 broke empty aggregates embedded
in other types.  fix this by only bumping zero-byte globals
up to a single byte if the *entire global* is zero size,
fixing PR6340.

This also fixes empty arrays etc to be handled correctly,
and only does this on subsection-via-symbols targets (aka
darwin) which is the only place where this matters.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101879 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 06:20:21 +00:00
Chris Lattner
aa2776e934 teach cellspu how to return i8 and i16 from calls,
patch by Kalle Raiskila!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101875 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 05:36:09 +00:00
Chris Lattner
a78130c320 RewriteLoopBodyWithConditionConstant can end up rewriting the
condition we're unswitching on.  In this case, don't try to
simplify the second copy of the loop which may be dead or not,
but is probably a constant now.  This fixes PR6879


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101870 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 05:09:16 +00:00
Chris Lattner
f1cfb95337 reapply 'reject forward references to functions whose type don't match'
now that the testsuite has been updated.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101866 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 04:49:11 +00:00
Bill Wendling
86c5abb4c0 The visitXOR method can return the same SDNode. If so, we don't want to delete
it as it's not dead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101855 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 01:25:01 +00:00
Eric Christopher
6d972fd087 Remove the palignr intrinsics now that we lower them to vector shuffles,
shifts and null vectors. Autoupgrade these to what we'd lower them to.

Add a testcase to exercise this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101851 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 00:59:54 +00:00
Chris Lattner
eae220259f Fix rdar://7879828 - crash in CallGraph, a self host issue.
Arg promotion was deleting call graph nodes that still had references
from the 'indirect' CGN.  Like the inliner, it should only delete the
function if all references are gone.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101845 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 00:46:50 +00:00
Bob Wilson
02170c0034 Fix tests for Neon load/store intrinsics to match the i8* types expected by
the intrinsics.  The reason for those i8* types is that the intrinsics are
overloaded on the vector type and we don't have a way to declare an intrinsic
where one argument is an overloaded vector type and another argument is a
pointer to the vector element type.  The bitcasts added here will match what
the frontend will typically generate when these intrinsics are used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101840 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-20 00:17:16 +00:00
Dan Gohman
c056454ecf Remove the Expr member from IVUsers. Instead of remembering the expression,
just ask ScalarEvolution for it on demand. This helps IVUsers be more robust
in the case of expressions changing underneath it. This fixes PR6862.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101819 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-19 21:48:58 +00:00
Johnny Chen
22e401f5d4 According to A8.6.16 B (Encoding T3) and A8.3 Conditional execution -- A8.3.1
Pseudocode details of conditional, Condition bits '111x' indicate the
instruction is always executed.  That is, '1111' is a leagl condition field
value, which is now mapped to ARMCC::AL.

Also add a test case for condition field '1111'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101817 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-19 21:19:52 +00:00
Devang Patel
e9afbfe664 Fix typo. add a test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101812 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-19 20:31:39 +00:00
Johnny Chen
4b7df442a8 ARM disassembler did not react to recent changes to the NEON instruction table.
VLD1q*_UPD and VST1q*_UPD have the ${dst:dregpair} operand now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101784 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-19 16:20:34 +00:00
Nick Lewycky
a370a44a76 Fix declarations in a few more tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101676 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 21:29:25 +00:00
Daniel Dunbar
dd3a87912b Revert "reject forward references to functions whose type don't match", because DJG told me to!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101675 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 21:24:55 +00:00
Nick Lewycky
8e13af309b Fix intrinsic signature in this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101674 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 21:12:55 +00:00
Chris Lattner
77e80deabc reject forward references to functions whose type don't match
up with the definition (and fix a broken testcase).  PR6491.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101670 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 20:45:56 +00:00
Chris Lattner
0dd0d49e78 doh, didn't mean to check in my hackaround lit sucking. :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101663 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 19:04:03 +00:00
Chris Lattner
34e9d17d1b fix PR6332, allowing an index of zero into a zero sized array
even if the element of the array has no size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101662 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 19:02:33 +00:00
Chris Lattner
eef6d78be1 teach the x86 asm parser how to handle segment prefixes
in memory operands.  rdar://7874844


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101661 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 18:56:34 +00:00
Chris Lattner
0fb372a497 testcase for r101538, patch by Nico Schmidt!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101642 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 17:22:06 +00:00
Dan Gohman
9f23dee08c Start function numbering at 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101638 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 16:29:15 +00:00
Chris Lattner
65de1b9eb3 a bunch of ssse3 instructions are misencoded to think they have an
i8 field when they really do not.  This fixes rdar://7840289


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101629 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 07:38:24 +00:00
Evan Cheng
8d1092be64 Add nounwind.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101613 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 03:43:36 +00:00
Bob Wilson
84bd6b0c31 Re-commit my previous SSAUpdater changes. The previous version naively tried
to determine where to place PHIs by iteratively comparing reaching definitions
at each block.  That was just plain wrong.  This version now computes the
dominator tree within the subset of the CFG where PHIs may need to be placed,
and then places the PHIs in the iterated dominance frontier of each definition.
The rest of the patch is mostly the same, with a few more performance
improvements added in.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101612 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-17 03:08:24 +00:00
Johnny Chen
f7e2bc80d1 Minor change to make the test case comply with Vd<0> == '0' when Q == '1'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101559 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 22:48:31 +00:00
Johnny Chen
c7b65914e0 Fixed a bug in DisassembleN1RegModImmFrm() where a break stmt was missing for a
case.  Also, the 0xFF hex literal involved in the shift for ESize64 should be
suffixed "ul" to preserve the shift result.

Implemented printHex*ImmOperand() by copying from ARMAsmPrinter.cpp and added a
test case for DisassembleN1RegModImmFrm()/printHex64ImmOperand().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101557 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 22:40:20 +00:00
Johnny Chen
16fda6982b In the same spirit of r101524, which removed the assert() from printAddrMode2OffsetOperand(),
this patch removes the assert() from printAddrMode3OffsetOperand() and adds a test case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101529 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 19:57:21 +00:00
Johnny Chen
2fb10f17d8 Multiclass LdStCop was using pre-UAL syntax LDC<c>L for the L fragment. Changed
to the UAL syntax of LDCL<c>, instead.

Add a test case for this change which also tests the removal of assert() from
printAddrMode2OffsetOperand().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101527 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 19:33:23 +00:00
Dan Gohman
ec1fb6d09a Revert r101455, which fails on the llvm-arm-linux buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101515 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 18:37:31 +00:00
Dan Gohman
b391bb8947 Disable inlining of recursive calls. It can complicate tailcallelim and
dependent analyses, and increase code size, so doing it profitably would
require more complex heuristics.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101471 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 16:01:18 +00:00
Dan Gohman
ea25b48af3 Refine the detection of seemingly infinitely recursive calls where the
callee is expected to be expanded to something else by codegen, so that
normal infinitely recursive calls are still transformed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101468 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 15:57:50 +00:00
Bill Wendling
fef4c69728 Add JIT exception handling test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101455 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 09:04:28 +00:00
Chris Lattner
5f0378251c move comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101433 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 01:05:52 +00:00
Chris Lattner
d55c1c1659 fix PR6832: we were using the alignment of a pointer when we
wanted the alignment of the pointee.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101432 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-16 01:05:38 +00:00
Johnny Chen
cd52932dce Added another test case for am3offset operand, testing Rn, #+/-imm8.
Previous checkin tested Rn, #+/-Rm.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101418 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 23:23:40 +00:00
Jakob Stoklund Olesen
4b231c5705 Add test case for machine-sink on critical edges
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101416 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 23:19:16 +00:00
Johnny Chen
1cfa094562 Fixed a bug in ARM disassembly where LDRSBT should have am3offset operand, not
am2offset.  Modified the instruction table entry and added a new test case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101415 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 23:12:47 +00:00
Evan Cheng
3a1588a2e3 Use default lowering of DYNAMIC_STACKALLOC. As far as I can tell, ARM isle is doing the right thing and codegen looks correct for both Thumb and Thumb2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101410 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 22:20:34 +00:00
Jakob Stoklund Olesen
5ef9d76f6f Fix PR6847. RegScavenger should ignore DebugValues.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101392 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 20:28:39 +00:00
Evan Cheng
0ea7d219ec ARM SelectDYN_ALLOC should emit a copy from SP rather than referencing SP directly. In cases where there are two dyn_alloc in the same BB it would have caused the old SP value to be reused and badness ensues. rdar://7493908
llvm is generating poor code for dynamic alloca, I'll fix that later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101383 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 18:42:28 +00:00
Chris Lattner
e6987587d6 enhance the load/store narrowing optimization to handle a
tokenfactor in between the load/store.  This allows us to 
optimize test7 into:

_test7:                                 ## @test7
## BB#0:                                ## %entry
	movl	(%rdx), %eax
                                        ## kill: SIL<def> ESI<kill>
	movb	%sil, 5(%rdi)
	ret

instead of:

_test7:                                 ## @test7
## BB#0:                                ## %entry
	movl	4(%esp), %ecx
	movl	$-65281, %eax           ## imm = 0xFFFFFFFFFFFF00FF
	andl	4(%ecx), %eax
	movzbl	8(%esp), %edx
	shll	$8, %edx
	addl	%eax, %edx
	movl	12(%esp), %eax
	movl	(%eax), %eax
	movl	%edx, 4(%ecx)
	ret



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101355 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 06:10:49 +00:00
Chris Lattner
6dc868581b teach codegen to turn trunc(zextload) into load when possible.
This doesn't occur much at all, it only seems to formed in the case
when the trunc optimization kicks in due to phase ordering.  In that
case it is saves a few bytes on x86-32.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101350 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 05:40:59 +00:00
Chris Lattner
efcddc3325 add a simple dag combine to replace trivial shl+lshr with
and.  This happens with the store->load narrowing stuff.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101348 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 05:28:43 +00:00
Chris Lattner
2392ae7d73 Implement rdar://7860110 (also in target/readme.txt) narrowing
a load/or/and/store sequence into a narrower store when it is
safe.  Daniel tells me that clang will start producing this sort
of thing with bitfields, and this does  trigger a few dozen times
on 176.gcc produced by llvm-gcc even now.

This compiles code like CodeGen/X86/2009-05-28-DAGCombineCrash.ll 
into:

        movl    %eax, 36(%rdi)

instead of:

        movl    $4294967295, %eax       ## imm = 0xFFFFFFFF
        andq    32(%rdi), %rax
        shlq    $32, %rcx
        addq    %rax, %rcx
        movq    %rcx, 32(%rdi)

and each of the testcases into a single store.  Each of them used
to compile into craziness like this:

_test4:
	movl	$65535, %eax            ## imm = 0xFFFF
	andl	(%rdi), %eax
	shll	$16, %esi
	addl	%eax, %esi
	movl	%esi, (%rdi)
	ret




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101343 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 04:48:01 +00:00
Chris Lattner
dc7d6c9ddc further tweak this to do something useful.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101341 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 04:31:42 +00:00
Chris Lattner
23ab896c13 remove undef control flow.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101340 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 04:30:19 +00:00
Daniel Dunbar
4c7276a4eb tests: MC/Disassembler tests depend on ARM support being compiler in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101337 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-15 03:47:20 +00:00
Jakob Stoklund Olesen
d394e272d2 Remove unneeded types from test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101286 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 20:56:09 +00:00
Bob Wilson
164cd8b8d3 Don't custom lower bit converts to ARM VMOVDRRD or VMOVDRR when the operand
does not have a legal type.  The legalizer does not know how to handle those
nodes.  Radar 7854640.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101282 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 20:45:23 +00:00
Evan Cheng
dda54eef23 Trim tests and convert to FileCheck.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101277 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 20:22:17 +00:00
Nick Lewycky
3715e45da5 Revert r101213.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101231 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 04:51:58 +00:00
Chris Lattner
d305035155 implement mc asmparser support for '.', which gets the
current PC.  rdar://7834775

We now produce an identical .o file compared to the cctools
assembler for something like this:

_f0:
L0:
        jmp L1
        .long . - L0
L1:
        jmp A
        .long . - L1

        .zerofill __DATA,_bss,A,0



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101227 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 04:40:28 +00:00
Nick Lewycky
05f1498efa Commit testcase for r101213.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101214 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-14 03:46:42 +00:00
Devang Patel
7cc11ce5a6 XFAIL this test for powerpc.
This test relies on iSel lowering dbg_declare intrinsic when CodeGen::OptLevel is None. On PPC side, CodeGen::OptLevel stays to default when -O0 is used on the command line.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101190 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 23:23:09 +00:00
Evan Cheng
370aac4a28 Add test for post-ra machine licm.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101182 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 22:10:03 +00:00
Bob Wilson
6a234f07fa Handle a v2f64 formal parameter that is split between registers and memory
such that the entire second half is in memory.  Radar 7855014.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101181 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 22:03:22 +00:00
Devang Patel
50d80e394d Do not include types without any definition in pubtypes list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101171 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 20:35:04 +00:00
Evan Cheng
005de5ef33 Fix test on non-x86 hosts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101163 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 18:54:04 +00:00
Evan Cheng
fc5a03e469 Re-apply 101075 and fix it properly. Just reuse the debug info of the branch instruction being optimized. There is no need to --I which can deref off start of the BB.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101162 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 18:50:27 +00:00
Eric Christopher
97e6992e3e Temporarily revert r101075, it's causing invalid iterator assertions
in a nightly tester.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101158 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 18:37:58 +00:00
Dan Gohman
28287794d4 Teach ScalarEvolution to simplify smax and umax when it can prove
that one operand is always greater than another.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101142 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 16:51:03 +00:00
Dan Gohman
a590b79ee2 Teach IndVarSimplify how to eliminate remainder operators where the
numerator is an induction variable. For example, with code like this:

  for (i=0;i<n;++i)
    x[i%n] = 0;

IndVarSimplify will now recognize that i is always less than n inside
the loop, and eliminate the remainder.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101113 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 01:46:36 +00:00
Chris Lattner
43ac721e3b add llvm codegen support for -ffunction-sections and -fdata-sections,
patch by Sylvere Teissier!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101106 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-13 00:36:43 +00:00
Evan Cheng
82865a10f8 Use .set expression for x86 pic jump table reference to reduce assembly relocation. rdar://7738756
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101085 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 23:07:17 +00:00
Bill Wendling
8cc21cac89 Third time's a charm...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101081 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 22:43:21 +00:00
Bill Wendling
476e62c459 Genericize the label test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101079 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 22:40:37 +00:00
Bill Wendling
35fe23157f Correct test to test what I mean it to test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101077 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 22:25:42 +00:00
Bill Wendling
2aae6ae572 Micro-optimization:
If we have this situation:

    jCC  L1
    jmp  L2
L1:
  ...
L2:
  ...

We can get a small performance boost by emitting this instead:

    jnCC L2
L1:
  ...
L2:
  ...

This testcase shows an example of this:

float func(float x, float y) {
    double product = (double)x * y;
    if (product == 0.0)
        return product;
    return product - 1.0;
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101075 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 22:19:57 +00:00
Dan Gohman
ca9b7037e2 Suppress LinearFunctionTestReplace when the computed backedge-taken
expression is a UDiv and it doesn't appear that the UDiv came from
the user's source.

ScalarEvolution has recently figured out how to compute a tripcount
expression for the inner loop in
SingleSource/Benchmarks/Shootout/sieve.c, using a udiv. Emitting a
udiv instruction dramatically slows down the enclosing loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101068 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 21:13:43 +00:00
Johnny Chen
bb6e9d8cf7 Fixed a crasher in arm disassembler within ARMInstPrinter.cpp after calling
ARM_AM::getSoImmVal(V) with a legitimate so_imm value: #245 rotate right by 2.
Introduce ARM_AM::getSOImmValOneOrNoRotate(unsigned Arg) which is called from
ARMInstPrinter.cpp's printSOImm() function, replacing ARM_AM::getSOImmVal(V).

[12:44:43] johnny:/Volumes/data/llvm/git/trunk (local-trunk) $ gdb Debug/bin/llvm-mc
GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ... done

(gdb) set args  -triple=arm-apple-darwin9 -debug-only=arm-disassembler --disassemble
(gdb) r
Starting program: /Volumes/data/llvm/git/trunk/Debug/bin/llvm-mc -triple=arm-apple-darwin9 -debug-only=arm-disassembler --disassemble
Reading symbols for shared libraries ++. done
0xf5 0x71 0xf0 0x53
Opcode=201 Name=MVNi Format=ARM_FORMAT_DPFRM(4)
 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0 
-------------------------------------------------------------------------------------------------
| 0: 1: 0: 1| 0: 0: 1: 1| 1: 1: 1: 1| 0: 0: 0: 0| 0: 1: 1: 1| 0: 0: 0: 1| 1: 1: 1: 1| 0: 1: 0: 1|
-------------------------------------------------------------------------------------------------

	mvnpls	r7, Assertion failed: (V != -1 && "Not a valid so_imm value!"), function printSOImm, file ARMInstPrinter.cpp, line 229.

Program received signal SIGABRT, Aborted.
0x00007fff88c65886 in __kill ()
(gdb) bt
#0  0x00007fff88c65886 in __kill ()
#1  0x00007fff88d05eae in abort ()
#2  0x00007fff88cf2ef0 in __assert_rtn ()
#3  0x000000010020e422 in printSOImm (O=@0x1010bdf80, V=-1, VerboseAsm=false, MAI=0x1020106d0) at ARMInstPrinter.cpp:229
#4  0x000000010020e5fe in llvm::ARMInstPrinter::printSOImmOperand (this=0x1020107e0, MI=0x7fff5fbfee70, OpNum=1, O=@0x1010bdf80) at ARMInstPrinter.cpp:254
#5  0x00000001001ffbc0 in llvm::ARMInstPrinter::printInstruction (this=0x1020107e0, MI=0x7fff5fbfee70, O=@0x1010bdf80) at ARMGenAsmWriter.inc:3236
#6  0x000000010020c27c in llvm::ARMInstPrinter::printInst (this=0x1020107e0, MI=0x7fff5fbfee70, O=@0x1010bdf80) at ARMInstPrinter.cpp:182
#7  0x000000010003cbff in PrintInsts (DisAsm=@0x10200f4e0, Printer=@0x1020107e0, Bytes=@0x7fff5fbff060, SM=@0x7fff5fbff078) at Disassembler.cpp:65
#8  0x000000010003c8b4 in llvm::Disassembler::disassemble (T=@0x1010c13c0, Triple=@0x1010b6798, Buffer=@0x102010690) at Disassembler.cpp:153
#9  0x000000010004095c in DisassembleInput (ProgName=0x7fff5fbff3f0 "/Volumes/data/llvm/git/trunk/Debug/bin/llvm-mc") at llvm-mc.cpp:347
#10 0x000000010003eefb in main (argc=4, argv=0x7fff5fbff298) at llvm-mc.cpp:374
(gdb) q
The program is running.  Exit anyway? (y or n) y
[13:36:26] johnny:/Volumes/data/llvm/git/trunk (local-trunk) $ 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101053 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 18:46:53 +00:00
Dan Gohman
27dead44e0 Generalize ScalarEvolution's PHI analysis to handle loops that don't
have preheaders or dedicated exit blocks, as clients may not otherwise
need to run LoopSimplify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101030 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 07:49:36 +00:00
Evan Cheng
09010a30fd Enable post regalloc machine licm by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101023 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 06:25:28 +00:00
Eric Christopher
67a71b5306 Verify function prototypes before trying to optimize functions. We also
need TargetData, just return false if we don't have it.

Update testcases accordingly.

Fixes PR6807.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101011 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-12 04:48:00 +00:00