1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

8989 Commits

Author SHA1 Message Date
Nick Lewycky
503ef79cc5 Make this test pass on Linux.
llvm-svn: 91521
2009-12-16 07:35:25 +00:00
Devang Patel
537d43e757 XFAIL on ppc-darwin.
llvm-svn: 91495
2009-12-16 02:11:38 +00:00
Evan Cheng
aaf2f58a04 Re-enable 91381 with fixes.
llvm-svn: 91489
2009-12-16 00:53:11 +00:00
Chris Lattner
8751050a34 revert my strstr optimization, I'm told it breaks x86-64 bootstrap.
Will reapply with a fix when I get a chance.

llvm-svn: 91486
2009-12-16 00:46:02 +00:00
Dale Johannesen
365ae431a7 Do better with physical reg operands (typically, from inline asm)
in local register allocator.  If a reg-reg copy has a phys reg
input and a virt reg output, and this is the last use of the phys
reg, assign the phys reg to the virt reg.  If a reg-reg copy has
a phys reg output and we need to reload its spilled input, reload
it directly into the phys reg than passing it through another reg.

Following 76208, there is sometimes no dependency between the def of
a phys reg and its use; this creates a window where that phys reg
can be used for spilling (this is true in linear scan also).  This
is bad and needs to be fixed a better way, although 76208 works too
well in practice to be reverted.  However, there should normally be
no spilling within inline asm blocks.  The patch here goes a long way
towards making this actually be true.

llvm-svn: 91485
2009-12-16 00:29:41 +00:00
Bob Wilson
8505aa648d Reapply 91184 with fixes and an addition to the testcase to cover the problem
found last time.  Instead of trying to modify the IR while iterating over it,
I've change it to keep a list of WeakVH references to dead instructions, and
then delete those instructions later.  I also added some special case code to
detect and handle the situation when both operands of a memcpy intrinsic are
referencing the same alloca.

llvm-svn: 91459
2009-12-15 22:00:51 +00:00
Chris Lattner
fa960751b1 optimize strstr, PR5783
llvm-svn: 91438
2009-12-15 19:14:40 +00:00
Mikhail Glushenkov
7743ee06be Convert llvmc tests to FileCheck.
llvm-svn: 91420
2009-12-15 07:21:14 +00:00
Mikhail Glushenkov
2d69ef4077 Support hook invocation from 'append_cmd'.
llvm-svn: 91419
2009-12-15 07:20:50 +00:00
Kenneth Uildriks
c0ab5a6e88 For fastcc on x86, let ECX be used as a return register after EAX and EDX
llvm-svn: 91410
2009-12-15 03:27:52 +00:00
Evan Cheng
4adb4acc7b Disable 91381 for now. It's miscompiling ARMISelDAG2DAG.cpp.
llvm-svn: 91405
2009-12-15 03:07:11 +00:00
Mikhail Glushenkov
93c8d86be9 Validate the generated C++ code in llvmc tests.
Checks that the code generated by 'tblgen --emit-llvmc' can be actually
compiled. Also fixes two bugs found in this way:

- forward_transformed_value didn't work with non-list arguments
- cl::ZeroOrOne is now called cl::Optional

llvm-svn: 91404
2009-12-15 03:04:52 +00:00
Mikhail Glushenkov
d2373fd4dc Pipe 'grep' output to 'count'.
llvm-svn: 91403
2009-12-15 03:04:14 +00:00
Mikhail Glushenkov
39b16212f2 Allow $CALL(Hook, '$INFILE') for non-join tools.
llvm-svn: 91402
2009-12-15 03:04:02 +00:00
Evan Cheng
c531da60aa Make 91378 more conservative.
1. Only perform (zext (shl (zext x), y)) -> (shl (zext x), y) when y is a constant. This makes sure it remove at least one zest.
2. If the shift is a left shift, make sure the original shift cannot shift out bits.

llvm-svn: 91399
2009-12-15 03:00:32 +00:00
Evan Cheng
cd8f0de016 Use sbb x, x to materialize carry bit in a GPR. The result is all one's or all zero's.
llvm-svn: 91381
2009-12-15 00:53:42 +00:00
Evan Cheng
bd48ad16fa Fold (zext (and x, cst)) -> (and (zext x), cst).
llvm-svn: 91380
2009-12-15 00:52:11 +00:00
Evan Cheng
f3b2e55b34 Propagate zest through logical shift.
llvm-svn: 91378
2009-12-15 00:41:36 +00:00
Dan Gohman
57dc006590 Fix integer cast code to handle vector types.
llvm-svn: 91362
2009-12-14 23:40:38 +00:00
Eric Christopher
abf9df5e6d Add radar fixed in comment.
llvm-svn: 91312
2009-12-14 19:07:25 +00:00
Shantonu Sen
9782dd21e0 Remove empty file completely
llvm-svn: 91277
2009-12-14 14:15:15 +00:00
Chris Lattner
6603d21f13 revert r91184, because it causes a crash on a .bc file I just
sent to Bob.

llvm-svn: 91268
2009-12-14 05:11:02 +00:00
Mikhail Glushenkov
9bad5b8fe4 Add a test for the 'init' option property.
llvm-svn: 91259
2009-12-14 04:06:38 +00:00
Evan Cheng
ee5b5917fd Disable r91104 for x86. It causes partial register stall which pessimize code in 32-bit.
llvm-svn: 91223
2009-12-12 20:03:14 +00:00
Benjamin Kramer
6cd9b2ba74 Fix some CHECK lines which were ignored by accident.
llvm-svn: 91214
2009-12-12 09:25:50 +00:00
Bob Wilson
8486cae4ce Revise scalar replacement to be more flexible about handle bitcasts and GEPs.
While scanning through the uses of an alloca, keep track of the current offset
relative to the start of the alloca, and check memory references to see if
the offset & size correspond to a component within the alloca.  This has the
nice benefit of unifying much of the code from isSafeUseOfAllocation,
isSafeElementUse, and isSafeUseOfBitCastedAllocation.  The code to rewrite
the uses of a promoted alloca, after it is determined to be safe, is
reorganized in the same way.

Also, when rewriting GEP instructions, mark them as "in-bounds" since all the
indices are known to be safe.

llvm-svn: 91184
2009-12-11 23:47:40 +00:00
Anton Korobeynikov
724c82337f Lower setcc branchless, if this is profitable.
Based on the patch by Brian Lucas!

llvm-svn: 91175
2009-12-11 23:01:29 +00:00
Dan Gohman
2e616e859b Implement vector widening, splitting, and scalarizing for SIGN_EXTEND_INREG.
llvm-svn: 91158
2009-12-11 21:31:27 +00:00
Dan Gohman
0a78e32f6b Change this to the correct PR number.
llvm-svn: 91148
2009-12-11 20:09:21 +00:00
Dan Gohman
c22d542754 Make getUniqueExitBlocks's precondition assert more precise, to
avoid spurious failures. This fixes PR5758.

llvm-svn: 91147
2009-12-11 20:05:23 +00:00
Dan Gohman
b2cbb1e37e Fix the result type of SELECT nodes lowered from Select instructions with
aggregate return values. This fixes PR5754.

llvm-svn: 91145
2009-12-11 19:50:50 +00:00
Anton Korobeynikov
f8b2e2868e Honour setHasCalls() set from isel.
This is used in some weird cases like general dynamic TLS model.
This fixes PR5723

llvm-svn: 91144
2009-12-11 19:39:55 +00:00
Evan Cheng
4c304eebe9 Tests for 91103 and 91104.
llvm-svn: 91105
2009-12-11 06:02:21 +00:00
Eric Christopher
02ce8cd8a6 Add a test for the fix in revision 91009.
llvm-svn: 91062
2009-12-10 21:11:40 +00:00
Evan Cheng
4b7cf3ed41 It's not safe to coalesce a move where src and dst registers have different subregister indices. e.g.:
%reg16404:1<def> = MOV8rr %reg16412:2<kill>

llvm-svn: 91061
2009-12-10 20:59:45 +00:00
Chris Lattner
ffedf37584 Fix PR5744, a case where we were getting the pointer size instead of the
value size.  This only manifested when memdep inprecisely returns clobber,
which is do to a caching issue in the PR5744 testcase.  We can 'efficiently
emulate' this by using '-no-aa'

llvm-svn: 91004
2009-12-10 00:11:45 +00:00
Evan Cheng
bc633478bd Fix test.
llvm-svn: 90988
2009-12-09 22:24:42 +00:00
Evan Cheng
9e2442c0be Optimize splat of a scalar load into a shuffle of a vector load when it's legal. e.g.
vector_shuffle (scalar_to_vector (i32 load (ptr + 4))), undef, <0, 0, 0, 0>
=>
vector_shuffle (v4i32 load ptr), undef, <1, 1, 1, 1>

iff ptr is 16-byte aligned (or can be made into 16-byte aligned).

llvm-svn: 90984
2009-12-09 21:00:30 +00:00
Chris Lattner
bf3d03b576 fix hte last remaining known (by me) phi translation bug. When we reanalyze
clobbers to forward pieces of large stores to small loads, we need to consider
the properly phi translated pointer in the store block.

llvm-svn: 90978
2009-12-09 18:21:46 +00:00
Chris Lattner
2f9b661ab8 Add a minor optimization: if we haven't changed the operands of an
add, there is no need to scan the world to find the same add again.
This invalidates the previous testcase, which wasn't wonderful anyway,
because it needed a run of instcombine to permute the use-lists in 
just the right way to before GVN was run (so it was really fragile).
Not a big loss.

llvm-svn: 90973
2009-12-09 17:27:45 +00:00
Chris Lattner
e05f9a128c fix PR5733, a case where we'd replace an add with a lexically identical
binary operator that wasn't an add.  In this case, a xor.  Whoops.

llvm-svn: 90971
2009-12-09 17:18:49 +00:00
Chris Lattner
8361f3cfc9 merge crash-2.ll into crash.ll
llvm-svn: 90969
2009-12-09 17:17:26 +00:00
Chris Lattner
1f1da3a5a6 the code in GVN that tries to forward large loads to small
stores is not phi translating, thus it miscompiles really
crazy testcases.  This is from inspection, I haven't seen
this in the wild.

llvm-svn: 90930
2009-12-09 02:43:05 +00:00
Chris Lattner
dda5ca59e2 Switch GVN and memdep to use PHITransAddr, which correctly handles
phi translation of complex expressions like &A[i+1].  This has the
following benefits:

1. The phi translation logic is all contained in its own class with
   a strong interface and verification that it is self consistent.

2. The logic is more correct than before.  Previously, if intermediate
   expressions got PHI translated, we'd miss the update and scan for
   the wrong pointers in predecessor blocks.  @phi_trans2 is a testcase
   for this.

3. We have a lot less code in memdep.

We can handle phi translation across blocks of things like @phi_trans3,
which is pretty insane :).

This patch should fix the miscompiles of 255.vortex, and I tested it 
with a bootstrap of llvm-gcc, llvm-test and dejagnu of course.

llvm-svn: 90926
2009-12-09 01:59:31 +00:00
Evan Cheng
41c13e41fe Teach InferPtrAlignment to infer GV+cst alignment and use it to simplify x86 isl lowering code.
llvm-svn: 90925
2009-12-09 01:53:58 +00:00
Devang Patel
d5a8051dea Remove tests that are not suitable anymore. Plus they are not testing the original bugfixes anymore. These tests were inserted to check bug fixes in code that handled debug info intrinsics. These intrinsics are no longer used and now llvm parser simply ignores old .dbg intrinsics from these dead tests.
llvm-svn: 90923
2009-12-09 01:46:00 +00:00
Devang Patel
11874672da Revert 90858 90875 and 90805 for now.
llvm-svn: 90898
2009-12-08 23:21:45 +00:00
Evan Cheng
edcc21919f - Support inline asm 'w' constraint for 128-bit vector types.
- Also support the 'q' NEON registers asm code.

llvm-svn: 90894
2009-12-08 23:06:22 +00:00
Daniel Dunbar
1b05b09ba4 CMake/lit: Add llvm_{unit_,}site_config parameters, and always pass them when running tests from the project files.
llvm-svn: 90869
2009-12-08 19:47:36 +00:00
Devang Patel
cb39ef375f Do not try to push dead variable's debug info into namespace info.
llvm-svn: 90857
2009-12-08 15:01:35 +00:00
Duncan Sands
897f9579d6 Teach GlobalOpt to delete aliases with internal linkage (after
forwarding any uses).  GlobalDCE can also do this, but is only
run at -O3.

llvm-svn: 90850
2009-12-08 10:10:20 +00:00
Anton Korobeynikov
0ace515a4c Reduce (cmp 0, and_su (foo, bar)) into (bit foo, bar). This saves extra instruction. Patch inspired by Brian Lucas!
llvm-svn: 90819
2009-12-08 01:03:04 +00:00
Evan Cheng
433b8a8753 Test case for 90787.
llvm-svn: 90791
2009-12-07 19:42:22 +00:00
David Greene
73ad44c6b6 Use FileCheck and set nounwind on calls.
llvm-svn: 90790
2009-12-07 19:40:26 +00:00
Dan Gohman
44e25ed254 Don't enable the post-RA scheduler on x86 except at -O3. In its
current form, it is too expensive in compile time.

llvm-svn: 90781
2009-12-07 19:04:31 +00:00
Mikhail Glushenkov
9f567e2e67 Implement 'forward_value' and 'forward_transformed_value'.
llvm-svn: 90770
2009-12-07 17:03:05 +00:00
Anton Korobeynikov
eee906f4f0 Dynamic stack realignment use of sp register as source/dest register
in "bic sp, sp, #15" leads to unpredicatble behaviour in Thumb2 mode.
Emit the following code instead:
mov r4, sp
bic r4, r4, #15
mov sp, r4

llvm-svn: 90724
2009-12-06 22:39:50 +00:00
Chris Lattner
7066a138ff fix PR5698
llvm-svn: 90708
2009-12-06 17:17:23 +00:00
Chris Lattner
ea3007ddb8 constant fold loads from memcpy's from global constants. This is important
because clang lowers nontrivial automatic struct/array inits to memcpy from
a global array.

llvm-svn: 90698
2009-12-06 05:29:56 +00:00
Chris Lattner
8885e71303 add support for forwarding mem intrinsic values to non-local loads.
llvm-svn: 90697
2009-12-06 04:54:31 +00:00
Chris Lattner
6d180b4a2c gvn is optimizing this better now.
llvm-svn: 90696
2009-12-06 04:16:05 +00:00
Chris Lattner
5eba6ee969 Handle forwarding local memsets to loads. For example, we optimize this:
short x(short *A) {
  memset(A, 1, sizeof(*A)*100);
  return A[42];
}

to 'return 257' instead of doing the load.  

llvm-svn: 90695
2009-12-06 01:57:02 +00:00
Chris Lattner
f9ff4c0fc4 merge two tests.
llvm-svn: 90691
2009-12-06 01:47:24 +00:00
Bill Wendling
887646a585 Temporarily revert r90502. It was causing the llvm-gcc bootstrap on PPC to fail.
llvm-svn: 90653
2009-12-05 07:30:23 +00:00
Nick Lewycky
10693e2bb0 Generalize this optimization to work on equality comparisons between any two
integers that are constant except for a single bit (the same n-th bit in each).

llvm-svn: 90646
2009-12-05 05:00:00 +00:00
Dan Gohman
cf29c2243b Fix this code to use DIScope instead of DICompileUnit, as in r90181.
Don't print "SrcLine"; just print the filename and line number, which
is obvious enough and more informative.

llvm-svn: 90631
2009-12-05 00:23:29 +00:00
Dan Gohman
e23727694c Remove now-redundant llvm-as invocations.
llvm-svn: 90626
2009-12-05 00:02:37 +00:00
Bill Wendling
87980517df Add testcase for PR4262.
llvm-svn: 90623
2009-12-04 23:29:57 +00:00
Bill Wendling
7993d94840 Temporarily revert r72620 because r72619 was reverted.
llvm-svn: 90619
2009-12-04 23:16:56 +00:00
Chris Lattner
107fc93d48 Fix PR5551 by not ignoring the top level constantexpr when
folding a load from constant.

llvm-svn: 90545
2009-12-04 06:29:29 +00:00
Chris Lattner
0876163071 Small and carefully crafted testcase showing a miscompilation by GVN
that I'm working on.  This is manifesting as a miscompile of 255.vortex
on some targets.  No check lines yet because it fails.

llvm-svn: 90520
2009-12-04 02:12:12 +00:00
Jakob Stoklund Olesen
7c5af26d12 Also attempt trivial coalescing for live intervals that end in a copy.
The coalescer is supposed to clean these up, but when setting up parameters
for a function call, there may be copies to physregs. If the defining
instruction has been LICM'ed far away, the coalescer won't touch it.

The register allocation hint does not always work - when the register
allocator is backtracking, it clears the hints.

This patch takes care of a few more cases that r90163 missed.

llvm-svn: 90502
2009-12-04 00:16:04 +00:00
Nate Begeman
3a9c51f256 Don't pull vector sext through both hands of a logical operation, since doing so prevents the fusion of vector sext and setcc into vsetcc.
Add a testcase for the above transformation.
Fix a bogus use of APInt noticed while tracking this down.

llvm-svn: 90423
2009-12-03 07:11:29 +00:00
Bob Wilson
b53c801366 Recognize canonical forms of vector shuffles where the same vector is used for
both source operands.  In the canonical form, the 2nd operand is changed to an
undef and the shuffle mask is adjusted to only reference elements from the 1st
operand.  Radar 7434842.

llvm-svn: 90417
2009-12-03 06:40:55 +00:00
Owen Anderson
251cb28a25 Fix this crasher, and add a FIXME for a missed optimization.
llvm-svn: 90408
2009-12-03 03:43:29 +00:00
Chris Lattner
3bf9321d67 add a failing testcase.
llvm-svn: 90380
2009-12-03 01:46:18 +00:00
Chris Lattner
851aea6ce2 fix PR5673 by being more careful about pointers to functions.
llvm-svn: 90369
2009-12-03 01:05:45 +00:00
Bill Wendling
0eb481a249 Remove unnecessary check.
llvm-svn: 90352
2009-12-02 22:02:20 +00:00
Owen Anderson
f47cde694f Cleanup/remove some parts of the lifetime region handling code in memdep and GVN,
per Chris' comments.  Adjust testcases to match.

llvm-svn: 90304
2009-12-02 07:35:19 +00:00
Chris Lattner
2d3554c3d9 merge sext-2 into sext.ll
llvm-svn: 90293
2009-12-02 05:34:35 +00:00
Chris Lattner
3781027d07 rename test
llvm-svn: 90292
2009-12-02 05:32:33 +00:00
Chris Lattner
2c2a69cd14 filecheckize
llvm-svn: 90291
2009-12-02 05:32:16 +00:00
Mon P Wang
91ac05d480 Fixed an assertion failure for tracking sext of a vector of integers
llvm-svn: 90290
2009-12-02 04:59:58 +00:00
Evan Cheng
0c687845b1 Fix PR5391: support early clobber physical register def tied with a use (ewwww)
- A valno should be set HasRedefByEC if there is an early clobber def in the middle of its live ranges. It should not be set if the def of the valno is defined by an early clobber.
- If a physical register def is tied to an use and it's an early clobber, it just means the HasRedefByEC is set since it's still one continuous live range.
- Add a couple of missing checks for HasRedefByEC in the coalescer. In general, it should not coalesce a vr with a physical register if the physical register has a early clobber def somewhere. This is overly conservative but that's the price for using such a nasty inline asm "feature".

llvm-svn: 90269
2009-12-01 22:25:00 +00:00
Jim Grosbach
7688d320c9 test case for IV-Users simplification loop improvement
llvm-svn: 90260
2009-12-01 21:53:51 +00:00
Devang Patel
45858cdfe6 Clear function specific containers while processing end of a function, even if DW_TAG_subprogram for current function is not found.
llvm-svn: 90247
2009-12-01 18:13:48 +00:00
Chris Lattner
ec294dac55 minimize this a bit more.
llvm-svn: 90216
2009-12-01 07:30:01 +00:00
Chris Lattner
7323159b21 merge 2009-11-29-ReverseMap.ll into crash.ll
llvm-svn: 90212
2009-12-01 06:22:10 +00:00
Chris Lattner
7c0c90df97 fix PR5640 by tracking whether a block is the header of a loop more
precisely, which prevents us from infinitely peeling the loop.

llvm-svn: 90211
2009-12-01 06:04:43 +00:00
Jakob Stoklund Olesen
f07d6129a2 Use CFG connectedness as a secondary sort key when deciding the order of copy coalescing.
This means that well connected blocks are copy coalesced before the less connected blocks. Connected blocks are more difficult to
coalesce because intervals are more complicated, so handling them first gives a greater chance of success.

llvm-svn: 90194
2009-12-01 03:03:00 +00:00
Dan Gohman
6bb055cfcd Add a comment about A[i+(j+1)].
llvm-svn: 90185
2009-12-01 01:38:10 +00:00
Evan Cheng
fcbc30f36e Fix PR5614: parts of a physical register def may be killed the rest.
llvm-svn: 90180
2009-12-01 00:44:45 +00:00
Devang Patel
41e98a786b Test case for r90175.
llvm-svn: 90176
2009-12-01 00:13:06 +00:00
Jakob Stoklund Olesen
ce2743a619 New virtual registers created for spill intervals should inherit allocation hints from the original register.
This helps us avoid silly copies when rematting values that are copied to a physical register:

leaq	_.str44(%rip), %rcx
movq	%rcx, %rsi
call	_strcmp

becomes:

leaq	_.str44(%rip), %rsi
call	_strcmp

The coalescer will not touch the movq because that would tie down the physical register.

llvm-svn: 90163
2009-11-30 22:55:54 +00:00
Bill Wendling
bacc153c6c Debug info is disabled on PPC Darwin.
llvm-svn: 90160
2009-11-30 22:23:29 +00:00
Nick Lewycky
51b973c964 Add a testcase for the current llvm-gcc build failure.
llvm-svn: 90112
2009-11-30 07:02:18 +00:00
Mon P Wang
22b4e4e223 Add test case for r90108
llvm-svn: 90109
2009-11-30 02:42:27 +00:00
Nick Lewycky
bc81d0985e Fix this test on 64-bit systems which seem to use i64 for gep indices sometimes
while 32-bit gcc uses i32.

llvm-svn: 90106
2009-11-30 02:23:57 +00:00
Nick Lewycky
5f9ca6b5c9 Commit r90099 made LLVM simplify one of these constant expressions a little
more. Update the syntax we're checking for and filecheckize it too.

This will fix the selfhost buildbots but will 'break' the others (sigh) because
they're still linked against older LLVM which is emitting less optimized IR.

llvm-svn: 90104
2009-11-30 00:38:56 +00:00
Nick Lewycky
116b145b02 Teach ConstantFolding to do a better job when folding gep(bitcast).
This permits the devirtualization of llvm.org/PR3100#c9 when compiled by clang.

llvm-svn: 90099
2009-11-29 21:40:55 +00:00
Chris Lattner
cd6fed25d5 add testcases for the foo_with_overflow op xforms added recently and
fix bugs exposed by the tests.  Testcases from Alastair Lynn!

llvm-svn: 90056
2009-11-29 02:57:29 +00:00
Chris Lattner
5b1941cafb add PR#
llvm-svn: 90049
2009-11-29 01:28:58 +00:00
Chris Lattner
8ba0b842a2 Add a testcase for:
void test(int N, double* G) {
  long j;
  for (j = 1; j < N - 1; j++)
      G[j] = G[j] + G[j+1] + G[j-1];
}

which we now compile to one load in the loop:

LBB1_2:                                                     ## %bb
	movsd	16(%rsi,%rax,8), %xmm2
	incq	%rdx
	addsd	%xmm2, %xmm1
	addsd	%xmm1, %xmm0
	movapd	%xmm2, %xmm1
	movsd	%xmm0, 8(%rsi,%rax,8)
	incq	%rax
	cmpq	%rcx, %rax
	jne	LBB1_2

instead of:

LBB1_2:                                                     ## %bb
	movsd	8(%rsi,%rax,8), %xmm0
	addsd	16(%rsi,%rax,8), %xmm0
	addsd	(%rsi,%rax,8), %xmm0
	movsd	%xmm0, 8(%rsi,%rax,8)
	incq	%rax
	cmpq	%rcx, %rax
	jne	LBB1_2

llvm-svn: 90048
2009-11-29 01:15:43 +00:00
Chris Lattner
e7dbdc6a7e add a testcase for
void test9(int N, double* G) {
  long j;
  for (j = 1; j < N - 1; j++)
      G[j+1] = G[j] + G[j+1];
}

llvm-svn: 90047
2009-11-29 01:04:40 +00:00
Chris Lattner
d48ff7ea6a Implement PR5634.
llvm-svn: 90046
2009-11-29 00:51:17 +00:00
Nick Lewycky
ff44d9d88a Teach memdep to look for memory use intrinsics during dependency queries. Fixes
PR5574.

llvm-svn: 90045
2009-11-28 21:27:49 +00:00
Chris Lattner
83284453a1 reenable load address insertion in load pre. This allows us to
handle cases like this:
void test(int N, double* G) {
  long j;
  for (j = 1; j < N - 1; j++)
      G[j+1] = G[j] + G[j+1];
}

where G[1] isn't live into the loop.

llvm-svn: 90041
2009-11-28 16:08:18 +00:00
Chris Lattner
f825d5d176 implement a FIXME: limit the depth that DecomposeGEPExpression goes the same
way that getUnderlyingObject does it. 

This fixes the 'DecomposeGEPExpression and getUnderlyingObject disagree!' 
assertion on sqlite3.

llvm-svn: 90038
2009-11-28 15:12:41 +00:00
Chris Lattner
f3e5cbfc99 disable value insertion for now, I need to figure out how
to inform GVN about the newly inserted values.  This fixes 
PR5631.

llvm-svn: 90022
2009-11-27 22:50:07 +00:00
Chris Lattner
1fc57583fa I accidentally implemented this :)
llvm-svn: 90014
2009-11-27 19:56:00 +00:00
Chris Lattner
b1fceb6006 add support for recursive phi translation and phi
translation of add with immediate.  This allows us
to optimize this function:

void test(int N, double* G) {
  long j;
  G[1] = 1;
    for (j = 1; j < N - 1; j++)
        G[j+1] = G[j] + G[j+1];
}

to only do one load every iteration of the loop.

llvm-svn: 90013
2009-11-27 19:11:31 +00:00
Chris Lattner
6f124b48c3 add two simple test cases we now optimize (to one load in the loop each) and one we don't (corresponding to the fixme I added yesterday).
llvm-svn: 90012
2009-11-27 18:08:30 +00:00
Chris Lattner
cdfa9dadf1 fix PR5436 by making the 'simple' case of SRoA not promote out of range
array indexes.  The "complex" case of SRoA still handles them, and correctly.

This fixes a weirdness where we'd correctly avoid transforming A[0][42] if
the 42 was too large, but we'd only do it if it was one gep, not two separate
ones.

llvm-svn: 90007
2009-11-27 16:37:41 +00:00
Chris Lattner
02211273c7 filecheckize
llvm-svn: 90006
2009-11-27 16:31:59 +00:00
Duncan Sands
638c57757d While this test is testing a problem in the generic part of codegen,
the problem only shows for msp430 and pic16 which is why it specifies
them using -march.  But it is wrong to put such tests in CodeGen/Generic,
since not everyone builds these targets.  Put a copy of the test in each
of the target test directories.

llvm-svn: 90005
2009-11-27 16:04:14 +00:00
Chris Lattner
a466dbe80a teach GVN's load PRE to insert computations of the address in predecessors
where it is not available.  It's unclear how to get this inserted 
computation into GVN's scalar availability sets, Owen, help? :)

llvm-svn: 89997
2009-11-27 08:25:10 +00:00
Chris Lattner
9c8da17055 add some tests for memdep phi translation + PRE.
llvm-svn: 89996
2009-11-27 06:42:42 +00:00
Chris Lattner
3e12a00447 this test is failing, and is expected to.
llvm-svn: 89995
2009-11-27 06:36:28 +00:00
Chris Lattner
ed6850eb34 filecheckize
llvm-svn: 89994
2009-11-27 06:33:09 +00:00
Chris Lattner
479eda6018 rename test.
llvm-svn: 89993
2009-11-27 06:31:55 +00:00
Chris Lattner
0971e6da1f Fix phi translation in load PRE to agree with the phi
translation done by memdep, and reenable gep translation 
again.

llvm-svn: 89992
2009-11-27 06:31:14 +00:00
Chris Lattner
16ee3226ce redisable this, my bootstrap worked because it wasn't an optimized build, whoops.
llvm-svn: 89991
2009-11-27 05:53:01 +00:00
Chris Lattner
ea3b1f2186 try again.
llvm-svn: 89990
2009-11-27 05:19:56 +00:00
Chris Lattner
895214c65e this is causing buildbot failures, disable for now.
llvm-svn: 89985
2009-11-27 01:52:22 +00:00
Chris Lattner
02ffb0a608 teach phi translation of GEPs to simplify geps like 'gep x, 0'.
This allows us to compile the example from PR5313 into:

LBB1_2:                                                     ## %bb
	incl	%ecx
	movb	%al, (%rsi)
	movslq	%ecx, %rax
	movb	(%rdi,%rax), %al
	testb	%al, %al
	jne	LBB1_2

instead of:

LBB1_2:                                                     ## %bb
	movslq	%eax, %rcx
	incl	%eax
	movb	(%rdi,%rcx), %cl
	movb	%cl, (%rsi)
	movslq	%eax, %rcx
	cmpb	$0, (%rdi,%rcx)
	jne	LBB1_2

llvm-svn: 89981
2009-11-27 00:34:38 +00:00
Chris Lattner
4810fa619f teach memdep to do trivial PHI translation of GEPs. More to
come.

llvm-svn: 89979
2009-11-27 00:07:37 +00:00
Chris Lattner
4824ebfded Teach memdep to phi translate bitcasts. This allows us to compile
the example in GCC PR16799 to:

LBB1_2:                                                     ## %bb1
	movl	%eax, %eax
	subq	%rax, %rdi
	movq	%rdi, (%rcx)
	movl	(%rdi), %eax
	testl	%eax, %eax
	je	LBB1_2

instead of:

LBB1_2:                                                     ## %bb1
	movl	(%rdi), %ecx
	subq	%rcx, %rdi
	movq	%rdi, (%rax)
	cmpl	$0, (%rdi)
	je	LBB1_2

llvm-svn: 89978
2009-11-26 23:41:07 +00:00
Chris Lattner
4bf628a9ba convert to filecheck
llvm-svn: 89977
2009-11-26 23:32:59 +00:00
Chris Lattner
cf7665b0c8 Fix PR5471 by removing an instcombine xform. Some pieces of the code
generates store to undef and some generates store to null as the idiom
for undefined behavior.  Since simplifycfg zaps both, don't remove the
undefined behavior in instcombine.

llvm-svn: 89971
2009-11-26 22:04:42 +00:00
Chris Lattner
911e5047d0 @test9 is a testcase for r89958. Before 89958, we misanalyzed the
first expression as P+4+4*i which we considered to possibly alias
P+4*j.  Now we correctly analyze the former one as P+1+4*i.

@test10 is a sanity test that verfies that we know that P+4+4*i != P+4*i.

llvm-svn: 89960
2009-11-26 19:25:46 +00:00
Chris Lattner
ce573daf09 Implement PR1143 (at -m64) by making basicaa look through extensions. We
previously already handled it at -m32 because there were no i32->i64 
extensions for addressing.

llvm-svn: 89959
2009-11-26 18:53:33 +00:00
Chris Lattner
d86a693b70 teach GetLinearExpression to be a bit more aggressive.
llvm-svn: 89955
2009-11-26 17:00:01 +00:00
Chris Lattner
993cb8c911 update status of this. basicaa is much improved now,
only missing the one form (in this testcase).  Dan, do you
consider this example to be important?

llvm-svn: 89953
2009-11-26 16:42:00 +00:00
Chris Lattner
9c88c96b3f Teach basicaa that x|c == x+c when the c bits of x are clear. This
allows us to compile the example in readme.txt into:

LBB1_1:                                                     ## %bb
	movl	4(%rdx,%rax), %ecx
	movl	%ecx, %esi
	imull	(%rdx,%rax), %esi
	imull	%esi, %ecx
	movl	%esi, 8(%rdx,%rax)
	imull	%ecx, %esi
	movl	%ecx, 12(%rdx,%rax)
	movl	%esi, 16(%rdx,%rax)
	imull	%ecx, %esi
	movl	%esi, 20(%rdx,%rax)
	addq	$16, %rax
	cmpq	$4000, %rax
	jne	LBB1_1

instead of:

LBB1_1: 
	movl	(%rdx,%rax), %ecx
	imull	4(%rdx,%rax), %ecx
	movl	%ecx, 8(%rdx,%rax)
	imull	4(%rdx,%rax), %ecx
	movl	%ecx, 12(%rdx,%rax)
	imull	8(%rdx,%rax), %ecx
	movl	%ecx, 16(%rdx,%rax)
	imull	12(%rdx,%rax), %ecx
	movl	%ecx, 20(%rdx,%rax)
	addq	$16, %rax
	cmpq	$4000, %rax
	jne	LBB1_1

GCC (4.2) doesn't seem to be able to eliminate the loads in this 
testcase either, it generates:

L2:
	movl	(%rdx), %eax
	imull	4(%rdx), %eax
	movl	%eax, 8(%rdx)
	imull	4(%rdx), %eax
	movl	%eax, 12(%rdx)
	imull	8(%rdx), %eax
	movl	%eax, 16(%rdx)
	imull	12(%rdx), %eax
	movl	%eax, 20(%rdx)
	addl	$4, %ecx
	addq	$16, %rdx
	cmpl	$1002, %ecx
	jne	L2

llvm-svn: 89952
2009-11-26 16:26:43 +00:00
Chris Lattner
677b93d4c8 teach basicaa that A[i] != A[i+1].
llvm-svn: 89951
2009-11-26 16:18:10 +00:00
Chris Lattner
82257f0385 rename test
llvm-svn: 89950
2009-11-26 16:08:41 +00:00
Chris Lattner
69e59e50f3 Change the other half of aliasGEP (which handles GEP differencing) to use DecomposeGEPExpression. This dramatically simplifies and shrinks the code by eliminating the horrible CheckGEPInstructions method, fixes a miscompilation (@test3) and makes the code more aggressive. In particular, we now handle the @test4 case, which is reduced from the SmallPtrSet constructor. Missing this caused us to emit a variable length memset instead of a fixed size one.
llvm-svn: 89922
2009-11-26 02:17:34 +00:00
Chris Lattner
862a3532d6 add a new random feature test
llvm-svn: 89921
2009-11-26 02:16:28 +00:00
Evan Cheng
dd352c2a81 Test for 89905.
llvm-svn: 89906
2009-11-26 00:35:01 +00:00
Dale Johannesen
8f1aaa92b2 Test for llvm-gcc checkin 89898.
llvm-svn: 89899
2009-11-25 23:50:09 +00:00
Evan Cheng
bdedf32e51 ProcessImplicitDefs should watch out for invalidated iterator and extra implicit operands on copies.
llvm-svn: 89880
2009-11-25 21:13:39 +00:00
Bruno Cardoso Lopes
038281c523 Support PIC loading of constant pool entries
llvm-svn: 89863
2009-11-25 12:17:58 +00:00
Edward O'Callaghan
4b197b8908 Reverting patch in revision 89758, initial attempt at fixing PR5373 has proven to be bogus.
llvm-svn: 89844
2009-11-25 05:38:41 +00:00
Dale Johannesen
5809ff0e58 Do not store R31 into the caller's link area on PPC.
This violates the ABI (that area is "reserved"), and
while it is safe if all code is generated with current
compilers, there is some very old code around that uses
that slot for something else, and breaks if it is stored
into.  Adjust testcases looking for current behavior.
I've verified that the stack frame size is right in all
testcases, whether it changed or not.  7311323.

llvm-svn: 89811
2009-11-24 22:59:02 +00:00
Edward O'Callaghan
8c1cd4fdbc Fix for PR5373, Credit to Jakub Staszak.
llvm-svn: 89758
2009-11-24 11:51:52 +00:00
Evan Cheng
b81878ed80 Enable predication of NEON instructions in Thumb2 mode.
llvm-svn: 89748
2009-11-24 08:06:15 +00:00
Anton Korobeynikov
0f885eb7fd Materialize global addresses via movt/movw pair, this is always better
than doing the same via constpool:
1. Load from constpool costs 3 cycles on A9, movt/movw pair - just 2.
2. Load from constpool might stall up to 300 cycles due to cache miss.
3. Movt/movw does not use load/store unit.
4. Less constpool entries => better compiler performance.

This is only enabled on ELF systems, since darwin does not have needed
relocations (yet).

llvm-svn: 89720
2009-11-24 00:44:37 +00:00
Jim Grosbach
76b545e988 move fconst[sd] to UAL. <rdar://7414913>
llvm-svn: 89700
2009-11-23 21:08:25 +00:00
Jim Grosbach
b7607ee5fe update test for 89694
llvm-svn: 89695
2009-11-23 20:39:53 +00:00
Dan Gohman
58bb87921b Make ConstantFoldConstantExpression recursively visit the entire
ConstantExpr, not just the top-level operator. This allows it to
fold many more constants.

Also, make GlobalOpt call ConstantFoldConstantExpression on
GlobalVariable initializers.

llvm-svn: 89659
2009-11-23 16:22:21 +00:00
Dan Gohman
0ef3e7cf76 Fix a use of an invalidated iterator in the case where there are multiple
adjacent uses of a dead basic block from the same user. This fixes PR5596.

llvm-svn: 89658
2009-11-23 16:13:39 +00:00
Nick Lewycky
9d1ee635e3 Reapply r88830 with a bugfix: this transform only applies to icmp eq/ne. This
fixes part of PR5438.

llvm-svn: 89639
2009-11-23 03:17:33 +00:00
Chris Lattner
632f60ccc9 remove a silly condition that doesn't make a lot of sense anymore.
llvm-svn: 89601
2009-11-22 16:15:59 +00:00
Edward O'Callaghan
573a04cfbb Miss two, PR5307.
llvm-svn: 89596
2009-11-22 15:35:28 +00:00
Edward O'Callaghan
a295e7bd9b Convert Thumb2 tests to FileCheck for PR5307.
llvm-svn: 89595
2009-11-22 15:18:27 +00:00
Benjamin Kramer
7968de0cde Turns out stuff gets allocated to different registers depending on the subtarget.
llvm-svn: 89594
2009-11-22 15:15:52 +00:00
Edward O'Callaghan
d1c7b40bb5 Convert ARM tests to FileCheck for PR5307.
llvm-svn: 89593
2009-11-22 14:23:33 +00:00
Benjamin Kramer
a08534a88d Convert test to FileCheck.
llvm-svn: 89589
2009-11-22 13:16:36 +00:00
Edward O'Callaghan
1a250b4109 Forgot to alter RUN line when converting to FileCheck.
llvm-svn: 89588
2009-11-22 13:09:48 +00:00
Edward O'Callaghan
5ae4559914 Fix for bad FileCheck converts in revision 89584.
llvm-svn: 89586
2009-11-22 12:50:05 +00:00
Edward O'Callaghan
949850890f Convert a few tests to FileCheck for PR5307.
llvm-svn: 89584
2009-11-22 11:45:44 +00:00
Bob Wilson
5d46596707 Fix pr5470. Tablegen handles template arguments by temporarily setting their
values, resolving references to them, and then removing the definitions.
If a template argument is set to an undefined value, we need to resolve
references to that argument to an explicit undefined value.  The current code
leaves the reference to the template argument as it is, which causes an
assertion failure later when the definition of the template argument is
removed.

llvm-svn: 89581
2009-11-22 03:58:57 +00:00
Jim Grosbach
99c5b49c61 Revert 89562. We're being sneakier than I was giving us credit for, and this
isn't necessary.

llvm-svn: 89568
2009-11-21 23:34:09 +00:00
Jim Grosbach
d4603a5c4e Darwin requires a frame pointer for all non-leaf functions to support correct
backtraces.

llvm-svn: 89562
2009-11-21 21:40:08 +00:00
Jakob Stoklund Olesen
78f465dc49 Don't leave temporary files in the test directory.
llvm-svn: 89531
2009-11-21 02:05:31 +00:00
Dale Johannesen
907ff5a620 When generating a vector the really slow way, via loads
and stores, handle the case where the element size is not
a valid target type correctly (PPC).

llvm-svn: 89521
2009-11-21 00:53:23 +00:00
Evan Cheng
9828118adf Enable hoisting load from constant memories.
llvm-svn: 89510
2009-11-20 23:31:34 +00:00
Sean Callanan
78ee7f5d57 Recommitting PALIGNR shift width fixes.
Thanks to Daniel Dunbar for fixing clang intrinsics:
  http://llvm.org/viewvc/llvm-project?view=rev&revision=89499

llvm-svn: 89500
2009-11-20 22:28:42 +00:00
Dale Johannesen
45f80d39f6 Remove an incorrect overaggressive optimization
(PPC specific).

llvm-svn: 89496
2009-11-20 22:16:40 +00:00
Sean Callanan
d92626fc0d Reverting PALIGNR fix until I figure out how this
broke the Clang testsuite.

llvm-svn: 89495
2009-11-20 22:09:28 +00:00
Sean Callanan
0da77167d3 Fixed PALIGNR to take 8-bit rotations in all cases.
Also fixed the corresponding testcase, and the PALIGNR
  intrinsic (tested for correctness with llvm-gcc).

llvm-svn: 89491
2009-11-20 21:40:28 +00:00
Dan Gohman
d115107ef2 Make Loop::getLoopLatch() work on loops which don't have preheaders, as
it may be used in contexts where preheader insertion may have failed due
to an indirectbr.

Make LoopSimplify's LoopSimplify::SeparateNestedLoop properly fail in
the case that it would require splitting an indirectbr edge.

These fix PR5502.

llvm-svn: 89484
2009-11-20 20:51:18 +00:00
Dan Gohman
94cca19d9d Fix IPSCCP's code for deleting dead blocks to tolerate outstanding
blockaddress users. This fixes PR5569.

llvm-svn: 89483
2009-11-20 20:19:14 +00:00
Evan Cheng
9f57c4916e Remat VLDRD from constpool. Clean up some instruction property specifications.
llvm-svn: 89478
2009-11-20 19:57:15 +00:00
Duncan Sands
072d688d75 Fix PR5558, which was caused by a wrong fix for PR3393 (see commit 63048),
which was an expensive checks failure due to a bug in the checking.  This
patch in essence reverts the original fix for PR3393, and refixes it by a
tweak to the way expensive checking is done.

llvm-svn: 89454
2009-11-20 10:45:10 +00:00
Benjamin Kramer
8be7ccec51 Try to work around grep's "Binary file (standard input) matches" complaints seen
on ppc buildbot.

llvm-svn: 89452
2009-11-20 09:53:25 +00:00
Daniel Dunbar
66d480dc05 Fix -march= name for x86-64.
llvm-svn: 89445
2009-11-20 02:52:08 +00:00
Dan Gohman
d3d7358309 Fix fast-isel to avoid selecting the return instruction if a
tail call has been encountered.

llvm-svn: 89444
2009-11-20 02:51:26 +00:00
Evan Cheng
5fe8b0b3c5 Also CSE non-pic load from constant pools.
llvm-svn: 89440
2009-11-20 02:10:27 +00:00
Dan Gohman
9f19d60c14 Teach getSmallConstantTripMultiple about Shl operators.
llvm-svn: 89426
2009-11-20 01:09:34 +00:00
Evan Cheng
405012b096 Fix codegen of conditional move of immediates. We were not making use of the immediate forms of cmov instructions at all.
llvm-svn: 89423
2009-11-20 00:54:03 +00:00
Bill Wendling
9c08122387 Specify proper arch and triple for 64-bit.
llvm-svn: 89418
2009-11-20 00:40:21 +00:00
Bill Wendling
80716c8fd8 Testcase for r89415.
llvm-svn: 89417
2009-11-20 00:32:16 +00:00
Dan Gohman
44ddc50043 Extend CaptureTracking to indicate when a value is never stored, even
if it is not ultimately captured. Teach BasicAliasAnalysis that a 
local object address which does not escape and is never stored does
not alias with a value resulting from a load.

llvm-svn: 89398
2009-11-19 21:57:48 +00:00
Dan Gohman
026230b0a9 Enable hoisting of loads from constant memory by default. In cases where
they are lowered to instruction sequences more complex than a simple
load, such that CodeGen cannot rematerialize them, a reload from a
spill slot is likely to be cheaper than the complex sequence.

llvm-svn: 89374
2009-11-19 19:00:10 +00:00
Daniel Dunbar
cfcc2952fb Unbreak test, Bruno please check.
llvm-svn: 89329
2009-11-19 07:18:49 +00:00
Evan Cheng
987b8c3d9a More consistent thumb1 asm printing.
llvm-svn: 89328
2009-11-19 06:57:41 +00:00
Evan Cheng
c2e359a418 Shrink ldr / str [sp, imm0-1024] to 16-bit instructions.
llvm-svn: 89326
2009-11-19 06:32:27 +00:00
Bruno Cardoso Lopes
bf95b9699e - Add sugregister logic to handle f64=(f32,f32).
- Support mips1 like load/store of doubles:

Instead of:
  sdc $f0, X($3)
Generate:
  swc $f0, X($3)
  swc $f1, X+4($3)

llvm-svn: 89322
2009-11-19 06:06:13 +00:00
Bill Wendling
ecc50bcc77 Test from Dhrystone to make sure that we're not emitting an aligned load for a
string that's aligned at 8-bytes instead of 16-bytes.

llvm-svn: 89295
2009-11-19 01:33:57 +00:00
Bob Wilson
70bfa110eb Fix buildbots.
llvm-svn: 89274
2009-11-18 23:30:38 +00:00
Richard Osborne
fc2d5141a4 Add XCore support for indirectbr / blockaddress.
llvm-svn: 89273
2009-11-18 23:20:42 +00:00
Bob Wilson
dccd3bdb4e Tail duplication still needs to iterate. Duplicating new instructions onto
the tail of a block may make that block a new candidate for duplication.

llvm-svn: 89264
2009-11-18 22:52:37 +00:00
Bill Wendling
fe0d83e1fe Not all ASM has # for comments.
llvm-svn: 89250
2009-11-18 21:54:13 +00:00
Jakob Stoklund Olesen
7b5afd4dd6 Fix PR5300.
When TwoAddressInstructionPass deletes a dead instruction, make sure that all
register kills are accounted for. The 2-addr register does not get special
treatment.

llvm-svn: 89246
2009-11-18 21:33:35 +00:00
Jakob Stoklund Olesen
9472aae362 Fix inverted test and add testcase from failing self-host.
llvm-svn: 89167
2009-11-18 00:02:18 +00:00
Jakob Stoklund Olesen
f96b51a084 Remove fragile test.
llvm-svn: 89150
2009-11-17 21:52:40 +00:00
Jim Grosbach
d4db2d58ae Enable arm jumpt table adjustment.
llvm-svn: 89143
2009-11-17 21:24:11 +00:00
Anton Korobeynikov
6b1a243be8 Forgot to commit test fixes
llvm-svn: 89138
2009-11-17 20:38:36 +00:00
Jakob Stoklund Olesen
0ca73b9208 Enable -split-phi-edges by default, except when -regalloc=local.
The local register allocator doesn't like it when LiveVariables is run.
We should also disable edge splitting under -O0, but that has to wait a bit.

llvm-svn: 89125
2009-11-17 19:15:50 +00:00
Evan Cheng
aaa58b7653 Generalize OptimizeLoopTermCond to optimize more loop terminating icmp to use postinc iv.
llvm-svn: 89116
2009-11-17 18:10:11 +00:00
Evan Cheng
0f7e9f7cec Revert 89021. It's miscompiling llvm-gcc driver driver at -O0.
llvm-svn: 89082
2009-11-17 09:55:52 +00:00
Jakob Stoklund Olesen
6ac8f7ec34 Enable -split-phi-edges by default
llvm-svn: 89021
2009-11-17 01:07:22 +00:00
Evan Cheng
6e4430374e MOV64rm should be marked isReMaterializable.
llvm-svn: 89019
2009-11-17 00:55:55 +00:00
Jim Grosbach
b123a9cbc0 Convert to FileCheck
llvm-svn: 89007
2009-11-17 00:20:26 +00:00
Jim Grosbach
2f09113304 Convert to FileCheck
llvm-svn: 89002
2009-11-17 00:03:38 +00:00
Jim Grosbach
299e4e76c4 Cleanup. Missed removing these when converting. Oops.
llvm-svn: 89001
2009-11-17 00:00:33 +00:00
Dan Gohman
c2979de134 Fix this test - there don't appear to be any actual Reload Reuses
in this testcase.

llvm-svn: 88998
2009-11-16 23:49:55 +00:00
Dan Gohman
c35e84e1f5 Revert r87049, which was the workaround for the regression triggered
by the recent FixedStackPseudoSourceValue-related changes, now that
the specific bug that affected it is fixed, in r88954.

llvm-svn: 88997
2009-11-16 23:43:42 +00:00
Jeffrey Yasskin
9f05d972b7 Revert the test from r88984. It relies on being able to mmap 16GB of
address space (though it only uses a small fraction of that), and the
buildbots disallow that.

Also add a comment to the Makefile's ulimit line warning future
developers that changing it won't work.

llvm-svn: 88994
2009-11-16 23:32:30 +00:00
Jim Grosbach
95cf7fad36 Convert to FileCheck
llvm-svn: 88991
2009-11-16 23:19:29 +00:00
Jeffrey Yasskin
0f846dbb3e Make X86-64 in the Large model always emit 64-bit calls.
The large code model is documented at
http://www.x86-64.org/documentation/abi.pdf and says that calls should
assume their target doesn't live within the 32-bit pc-relative offset
that fits in the call instruction.

To do this, we turn off the global-address->target-global-address
conversion in X86TargetLowering::LowerCall(). The first attempt at
this broke the lazy JIT because it can separate the movabs(imm->reg)
from the actual call instruction. The lazy JIT receives the address of
the movabs as a relocation and needs to record the return address from
the call; and then when that call happens, it needs to patch the
movabs with the newly-compiled target. We could thread the call
instruction into the relocation and record the movabs<->call mapping
explicitly, but that seems to require at least as much new
complication in the code generator as this change.

To fix this, we make lazy functions _always_ go through a call
stub. You'd think we'd only have to force lazy calls through a stub on
difficult platforms, but that turns out to break indirect calls
through a function pointer. The right fix for that is to distinguish
between calls and address-of operations on uncompiled functions, but
that's complex enough to leave for someone else to do.

Another attempt at this defined a new CALL64i pseudo-instruction,
which expanded to a 2-instruction sequence in the assembly output and
was special-cased in the X86CodeEmitter's emitInstruction()
function. That broke indirect calls in the same way as above.

This patch also removes a hack forcing Darwin to the small code model.
Without far-call-stubs, the small code model requires things of the
JITMemoryManager that the DefaultJITMemoryManager can't provide.

Thanks to echristo for lots of testing!

llvm-svn: 88984
2009-11-16 22:41:33 +00:00
Evan Cheng
78be20d62e - Check memoperand alignment instead of checking stack alignment. Most load / store folding instructions are not referencing spill stack slots.
- Mark MOVUPSrm re-materializable.

llvm-svn: 88974
2009-11-16 21:56:03 +00:00
Jim Grosbach
f4abb1280a Convert to FileCheck
llvm-svn: 88947
2009-11-16 20:04:15 +00:00
Lang Hames
6a5810c037 Added a testcase for PR5495.
llvm-svn: 88946
2009-11-16 20:03:13 +00:00
Jim Grosbach
deee4fbd5d Convert to FileCheck
llvm-svn: 88942
2009-11-16 19:46:46 +00:00
Jim Grosbach
0ba7bb08d7 tbb opt off by default
llvm-svn: 88921
2009-11-16 17:24:45 +00:00
David Greene
6469fa6824 Support spill comments.
Have the asm printer emit a comment if an instruction is a spill or
reload and have the spiller mark copies it introdues so the asm printer
can also annotate those.

llvm-svn: 88911
2009-11-16 15:12:23 +00:00
Evan Cheng
ea46259f53 Check if subreg index is zero.
llvm-svn: 88899
2009-11-16 06:31:49 +00:00
Evan Cheng
2fa416debd For some targets, a copy can use a register multiple times, e.g. ppc.
llvm-svn: 88895
2009-11-16 05:52:06 +00:00
Evan Cheng
5c06a152a8 xfail for now. It has been failing.
llvm-svn: 88892
2009-11-16 05:44:04 +00:00
Bruno Cardoso Lopes
21ca44ba49 - Fix a small bug while handling target constant pools (one param was missing).
- Add a smarter constant pool loading, instead of:

lui $2, %hi($CPI1_0)
addiu $2, $2, %lo($CPI1_0)
lwc1 $f0, 0($2)

Generate:

lui $2, %hi($CPI1_0)
lwc1 $f0, %lo($CPI1_0)($2)

llvm-svn: 88886
2009-11-16 04:33:42 +00:00
Jim Grosbach
1aa571da3c Detect need for autoalignment of the stack earlier to catch spills more
conservatively. eliminateFrameIndex() machinery adjust to handle addr mode
6 (vld1/vst1) used for spills. Fix tests to expect aligned Q-reg spilling

llvm-svn: 88874
2009-11-15 21:45:34 +00:00
Nick Lewycky
f05946faff Revert r88830 and r88831 which appear to have caused a selfhost buildbot some
grief. I suspect this patch merely exposed a bug else.

llvm-svn: 88841
2009-11-15 07:47:32 +00:00
Nick Lewycky
62f00c17eb Correct typo.
llvm-svn: 88831
2009-11-15 06:16:57 +00:00
Nick Lewycky
14a2122db3 Teach instcombine to look for booleans in wider integers when it encounters a
zext(icmp). It may be able to optimize that away. This fixes one of the cases
in PR5438.

llvm-svn: 88830
2009-11-15 05:55:17 +00:00
Jim Grosbach
6028068e88 remove xfail
llvm-svn: 88817
2009-11-14 21:57:35 +00:00
Richard Osborne
8748f55236 Add XCore support for arbitrary-sized aggregate returns.
llvm-svn: 88802
2009-11-14 19:33:35 +00:00
Nick Lewycky
fba1efd298 Teach BasicAA that a constant expression can't alias memory provably not
allocated until runtime (such as an alloca). Patch by Hans Wennborg!

llvm-svn: 88760
2009-11-14 06:15:14 +00:00
Evan Cheng
b8c04e1226 Added getSubRegIndex(A,B) that returns subreg index of A to B. Use it to replace broken code in VirtRegRewriter.
llvm-svn: 88753
2009-11-14 03:42:17 +00:00
Evan Cheng
9b46e74f42 - Change TargetInstrInfo::reMaterialize to pass in TargetRegisterInfo.
- If destination is a physical register and it has a subreg index, use the
  sub-register instead.
This fixes PR5423.

llvm-svn: 88745
2009-11-14 02:55:43 +00:00
Evan Cheng
3781b2e7b3 Add radar number.
llvm-svn: 88739
2009-11-14 02:11:32 +00:00
Evan Cheng
c56b0a0f14 Fix PR5412: Fix an inverted check and another missing sub-register check.
llvm-svn: 88738
2009-11-14 02:09:09 +00:00
Dan Gohman
b36274632d Enable the tail call optimization when the caller returns undef.
llvm-svn: 88737
2009-11-14 02:06:30 +00:00
Evan Cheng
e43198c166 When expanding t2STRDi8 r, r to two stores, add kill markers correctly.
llvm-svn: 88734
2009-11-14 01:50:00 +00:00
Evan Cheng
e2907b91de Fix PR5411. Bug in UpdateKills. A reg def partially define its super-registers.
llvm-svn: 88719
2009-11-13 23:16:41 +00:00
David Greene
97a1f550d1 Move DebugInfo checks into EmitComments and remove them from
target-specific AsmPrinters.  Not all comments need DebugInfo.

Re-enable the line numbers comment test.

llvm-svn: 88697
2009-11-13 21:34:57 +00:00
Dan Gohman
972293611d When optimizing for size, don't tail-merge unless it's likely to be a
code-size win, and not when it's only likely to be code-size neutral,
such as when only a single instruction would be eliminated and a new
branch would be required.

This fixes rdar://7392894.

llvm-svn: 88692
2009-11-13 21:02:15 +00:00
Evan Cheng
f629fdcab2 Fix PR5410: LiveVariables lost subreg def:
D0<def,dead> = ...
...
             = S0<use, kill>
S0<def>      = ...
...
D0<def>      = 

The first D0 def is correctly marked dead, however, livevariables should have
added an implicit def of S0 or we end up with a use without a def.

llvm-svn: 88690
2009-11-13 20:36:40 +00:00
Dan Gohman
01b65e1e48 Don't let a noalias difference disrupt the tailcall optimization.
llvm-svn: 88672
2009-11-13 18:49:38 +00:00
Dale Johannesen
f57a58c4fe Adjust isConstantSplat to allow for big-endian targets.
PPC is such a target; make it work.

llvm-svn: 87060
2009-11-13 01:45:18 +00:00
Daniel Dunbar
cdeab5257c Update test.
llvm-svn: 87049
2009-11-13 01:01:58 +00:00
Jim Grosbach
8ffdb5d109 Clean up testcase a bit. Simplify case blocks and adjust switch instruction to not take an undefined value as input.
llvm-svn: 86997
2009-11-12 17:19:09 +00:00
Benjamin Kramer
86592507dc Fix typo in run line.
llvm-svn: 86984
2009-11-12 12:35:27 +00:00
Gabor Greif
15afbc8fa9 typo
llvm-svn: 86980
2009-11-12 09:44:17 +00:00
Chris Lattner
00a9240c9c implement a nice little efficiency hack in the inliner. Since we're now
running IPSCCP early, and we run functionattrs interlaced with the inliner,
we often (particularly for small or noop functions) completely propagate
all of the information about a call to its call site in IPSSCP (making a call
dead) and functionattrs is smart enough to realize that the function is
readonly (because it is interlaced with inliner).

To improve compile time and make the inliner threshold more accurate, realize
that we don't have to inline dead readonly function calls.  Instead, just 
delete the call.  This happens all the time for C++ codes, here are some
counters from opt/llvm-ld counting the number of times calls were deleted vs
inlined on various apps:

Tramp3d opt:
  5033 inline                - Number of call sites deleted, not inlined
 24596 inline                - Number of functions inlined
llvm-ld:
  667 inline           - Number of functions deleted because all callers found
  699 inline           - Number of functions inlined

483.xalancbmk opt:
  8096 inline                - Number of call sites deleted, not inlined
 62528 inline                - Number of functions inlined
llvm-ld:
   217 inline           - Number of allocas merged together
  2158 inline           - Number of functions inlined

471.omnetpp:
  331 inline                - Number of call sites deleted, not inlined
 8981 inline                - Number of functions inlined
llvm-ld:
  171 inline           - Number of functions deleted because all callers found
  629 inline           - Number of functions inlined


Deleting a call is much faster than inlining it, and is insensitive to the
size of the callee. :)

llvm-svn: 86975
2009-11-12 07:56:08 +00:00
Evan Cheng
deacae0dd9 RegScavenger::enterBasicBlock should always reset register state.
llvm-svn: 86972
2009-11-12 07:49:10 +00:00
Evan Cheng
b0a193db31 - Teach LSR to avoid changing cmp iv stride if it will create an immediate that
cannot be folded into target cmp instruction.
- Avoid a phase ordering issue where early cmp optimization would prevent the
  later count-to-zero optimization.
- Add missing checks which could cause LSR to reuse stride that does not have
  users.
- Fix a bug in count-to-zero optimization code which failed to find the pre-inc
  iv's phi node.
- Remove, tighten, loosen some incorrect checks disable valid transformations.
- Quite a bit of code clean up.

llvm-svn: 86969
2009-11-12 07:35:05 +00:00
Chris Lattner
01fddcec53 use getPredicateOnEdge to fold comparisons through PHI nodes,
which implements GCC PR18046.  This also gets us 360 more
jump threads on 176.gcc.

llvm-svn: 86953
2009-11-12 05:24:05 +00:00
Chris Lattner
b976027c91 should not commit when distracted.
llvm-svn: 86929
2009-11-12 02:04:17 +00:00