1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-23 04:52:54 +02:00
Commit Graph

9382 Commits

Author SHA1 Message Date
Chris Lattner
b29b154904 make pcrel immediate values relative to the start of the field,
not the end of the field, fixing rdar://7651978

llvm-svn: 96330
2010-02-16 05:03:17 +00:00
Dan Gohman
d19ecedc40 Split the main for-each-use loop again, this time for GenerateTruncates,
as it also peeks at which registers are being used by other uses. This
makes LSR less sensitive to use-list order.

llvm-svn: 96308
2010-02-16 01:42:53 +00:00
Anton Korobeynikov
dccd240998 Preliminary patch to improve dwarf EH generation - Hooks to return Personality / FDE / LSDA / TType encoding depending on target / options (e.g. code model / relocation model) - MCIzation of Dwarf EH printer to use encoding information - Stub generation for ELF target (needed for indirect references) - Some other small changes here and there
llvm-svn: 96285
2010-02-15 22:35:59 +00:00
Jakob Stoklund Olesen
143339a43a Fix PR6300.
A virtual register can be used before it is defined in the same MBB if the MBB
is part of a loop. Teach the implicit-def pass about this case.

llvm-svn: 96279
2010-02-15 22:03:29 +00:00
Bob Wilson
01e8d35855 Last week we were generating code with duplicate induction variables in this
test, but the problem seems to have gone away today.  Add a check to make sure
it doesn't come back.

llvm-svn: 96277
2010-02-15 21:56:40 +00:00
Chris Lattner
2ce5f89c01 remove empty file.
llvm-svn: 96271
2010-02-15 21:14:50 +00:00
Chris Lattner
d7470aa340 revert r96241. It breaks two regression tests, isn't documented,
and the testcase needs improvement.

llvm-svn: 96265
2010-02-15 20:53:01 +00:00
Chris Lattner
a8505609fe fix PR6305 by handling BlockAddress in a helper function
called by jump threading.

llvm-svn: 96263
2010-02-15 20:47:49 +00:00
David Greene
ba8bac644b Add support for emitting non-temporal stores for DAGs marked
non-temporal.

llvm-svn: 96241
2010-02-15 17:02:56 +00:00
Mikhail Glushenkov
47bcd93456 Revert r96130 ("Forward parameter options as '-option=param'").
This behaviour must be configurable.

llvm-svn: 96210
2010-02-15 03:17:06 +00:00
Eric Christopher
96f3c4222f Fix a problem where we had bitcasted operands that gave us
odd offsets since the bitcasted pointer size and the offset pointer
size are going to be different types for the GEP vs base object.

llvm-svn: 96134
2010-02-13 23:38:01 +00:00
Mikhail Glushenkov
09bf7f44e8 Forward parameter options as '-option=parameter'.
Some tools do not like the '-option parameter' form. Should this be
configurable?

llvm-svn: 96130
2010-02-13 22:37:28 +00:00
Chris Lattner
8530ba626c add encoder support and tests for rdtscp
llvm-svn: 96076
2010-02-13 03:42:24 +00:00
Jakob Stoklund Olesen
0a65533a38 Fix PR6283.
When coalescing with a physreg, remember to add imp-def and imp-kill when
dealing with sub-registers.

Also fix a related bug in VirtRegRewriter where substitutePhysReg may
reallocate the operand list on an instruction and invalidate the reg_iterator.
This can happen when a register is mentioned twice on the same instruction.

llvm-svn: 96072
2010-02-13 02:06:10 +00:00
Daniel Dunbar
09733841aa MC/AsmParser: Attempt to constant fold expressions up-front. This ensures we avoid fixups for obvious cases like '-(16)'.
llvm-svn: 96064
2010-02-13 01:28:07 +00:00
Chris Lattner
d4fe983f23 rip out the 'heinous' x86 MCCodeEmitter implementation.
We still have the templated X86 JIT emitter, *and* the
almost-copy in X86InstrInfo for getting instruction sizes.

llvm-svn: 96059
2010-02-13 00:49:29 +00:00
Chris Lattner
5b01ab848c remove special cases for vmlaunch, vmresume, vmxoff, and swapgs
fix swapgs to be spelled right.

llvm-svn: 96058
2010-02-13 00:41:14 +00:00
Bob Wilson
5d66f81412 Besides removing phi cycles that reduce to a single value, also remove dead
phi cycles.  Adjust a few tests to keep dead instructions from being optimized
away.  This (together with my previous change for phi cycles) fixes Apple
radar 7627077.

llvm-svn: 96057
2010-02-13 00:31:44 +00:00
Daniel Dunbar
4ef0be5df5 MC/X86: Push immediate operands as immediates not expressions when possible.
llvm-svn: 96055
2010-02-13 00:17:21 +00:00
Chris Lattner
c80a6de0a9 add some disassemble testcases for weird instructions
llvm-svn: 96045
2010-02-12 23:46:48 +00:00
Chris Lattner
4170bb81da implement the rest of correct x86-64 encoder support for
rip-relative addresses, and add a testcase.

llvm-svn: 96040
2010-02-12 23:24:09 +00:00
Dale Johannesen
ea96b2974f When save/restoring CR at prolog/epilog, in a large
stack frame, the prolog/epilog code was using the same
register for the copy of CR and the address of the save slot.  Oops.
This is fixed here for Darwin, sort of, by reserving R2 for this case.
A better way would be to do the store before the decrement of SP,
which is safe on Darwin due to the red zone.

SVR4 probably has the same problem, but I don't know how to fix it;
there is no red zone and R2 is already used for something else.
I'm going to leave it to someone interested in that target.

Better still would be to rewrite the CR-saving code completely;
spilling each CR subregister individually is horrible code.

llvm-svn: 96015
2010-02-12 21:35:34 +00:00
Chris Lattner
2265d6280b Add support for a union type in LLVM IR. Patch by Talin!
llvm-svn: 96011
2010-02-12 20:49:41 +00:00
Chris Lattner
ecb203898a 1. modernize the constantmerge pass, using densemap/smallvector.
2. don't bother trying to merge globals in non-default sections,
   doing so is quite dubious at best anyway.
3. fix a bug reported by Arnaud de Grandmaison where we'd try to
   merge two globals in different address spaces.

llvm-svn: 95995
2010-02-12 18:17:23 +00:00
Chris Lattner
fbf6ef7c34 rename test
llvm-svn: 95993
2010-02-12 18:05:00 +00:00
Anton Korobeynikov
c66de6687b Testcases for recent stdcall / fastcall mangling improvements
llvm-svn: 95982
2010-02-12 15:29:13 +00:00
Anton Korobeynikov
7073515c86 Cleanup stdcall / fastcall name mangling.
This should fix alot of problems we saw so far, e.g. PRs 5851 & 2936

llvm-svn: 95980
2010-02-12 15:28:40 +00:00
Dan Gohman
c40eb525ad Reapply the new LoopStrengthReduction code, with compile time and
bug fixes, and with improved heuristics for analyzing foreign-loop
addrecs.

This change also flattens IVUsers, eliminating the stride-oriented
groupings, which makes it easier to work with.

llvm-svn: 95975
2010-02-12 10:34:29 +00:00
Evan Cheng
dc2bb77b1b Update test to match 95961.
llvm-svn: 95971
2010-02-12 07:48:46 +00:00
Evan Cheng
06c22ed109 Test for 95961.
llvm-svn: 95962
2010-02-12 02:35:03 +00:00
Evan Cheng
86a3020e95 Test case for 95958.
llvm-svn: 95959
2010-02-12 02:02:23 +00:00
Bob Wilson
2fd80c3d94 Add a new pass on machine instructions to optimize away PHI cycles that
reduce down to a single value.  InstCombine already does this transformation
but DAG legalization may introduce new opportunities.  This has turned out to
be important for ARM where 64-bit values are split up during type legalization:
InstCombine is not able to remove the PHI cycles on the 64-bit values but
the separate 32-bit values can be optimized.  I measured the compile time 
impact of this (running llc on 176.gcc) and it was not significant.

llvm-svn: 95951
2010-02-12 01:30:21 +00:00
Chris Lattner
9307e00dc0 fix the encodings of monitor and mwait, which were completely
busted in both encoders.  I'm not bothering to fix it in the
old one at this point.

llvm-svn: 95947
2010-02-12 01:06:22 +00:00
Charles Davis
d69c12ecc6 Add a new function attribute, 'alignstack'. It will indicate (when the backends
implement support for it) that the stack should be forcibly realigned in the
prologue (and the process reversed in the epilogue).

llvm-svn: 95945
2010-02-12 00:31:15 +00:00
Jakob Stoklund Olesen
b800ff8ca9 Reapply coalescer fix for better cross-class coalescing.
This time with fixed test cases.

llvm-svn: 95938
2010-02-11 23:55:29 +00:00
Eric Christopher
2e0201ee18 Make sure that ConstantExpr offsets also aren't off of extern
symbols.

Thanks to Duncan Sands for the testcase!

llvm-svn: 95877
2010-02-11 17:44:04 +00:00
Chris Lattner
a59eb7c09c Rename ValueRequiresCast to ShouldOptimizeCast, to better reflect
what it does.  Enhance it to return false to optimizing vector
sign extensions from vector comparisions, which is the idiom used
to get a splatted vector for a vector comparison.

Doing this breaks vector-casts.ll, add some compensating 
transformations to handle the important case they cover without
depending on this canonicalization.

This fixes rdar://7434900 a serious pessimization of vector compares.

llvm-svn: 95855
2010-02-11 06:26:33 +00:00
Chris Lattner
ef91e752a6 convert to filecheck.
llvm-svn: 95854
2010-02-11 06:24:37 +00:00
Chris Lattner
a087e6e82f Make DSE only scan blocks that are reachable from the entry
block.  Other blocks may have pointer cycles that will crash
basicaa and other alias analyses.  In any case, there is no
point wasting cycles optimizing dead blocks.  This fixes 
rdar://7635088

llvm-svn: 95852
2010-02-11 05:11:54 +00:00
Chris Lattner
199f4187b6 a testcase that doesn't crash GVN but could someday.
llvm-svn: 95851
2010-02-11 05:08:05 +00:00
Chris Lattner
733ffcdb1f Make jump threading honor x|undef -> true and x&undef -> false,
instead of considering x|undef -> x, which may not be true.

llvm-svn: 95850
2010-02-11 04:40:44 +00:00
Eric Christopher
9516309f55 Add ConstantExpr handling to Intrinsic::objectsize lowering.
Update testcase accordingly now that we can optimize another
section.

llvm-svn: 95846
2010-02-11 01:48:54 +00:00
Devang Patel
f4f1901ec8 test case for r95842.
llvm-svn: 95844
2010-02-11 01:31:01 +00:00
Kevin Enderby
b1094f1489 Remove the few # TAILCALL comments that snuck in. As they may fail on linux.
llvm-svn: 95827
2010-02-11 00:18:12 +00:00
Kevin Enderby
3763f70025 Update the X86 assembler matcher test case now that a few more things match
with some of the recent changes that have gone into llvm-mc.

llvm-svn: 95826
2010-02-11 00:13:43 +00:00
Mon P Wang
c17e781f35 The previous fix of widening divides that trap was too fragile as it depends on custom
lowering and requires that certain types exist in ValueTypes.h.  Modified widening to
check if an op can trap and if so, the widening algorithm will apply only the op on
the defined elements.  It is safer to do this in widening because the optimizer can't
guarantee removing unused ops in some cases.

llvm-svn: 95823
2010-02-10 23:37:45 +00:00
Bob Wilson
82d5534acc Delete dead PHI machine instructions. These can be created due to type
legalization even when the IR-level optimizer has removed dead phis, such
as when the high half of an i64 value is unused on a 32-bit target.
I had to adjust a few test cases that had dead phis.
This is a partial fix for Radar 7627077.

llvm-svn: 95816
2010-02-10 22:58:57 +00:00
Daniel Dunbar
b20be19ae6 MC/X86 AsmMatcher: Fix a use after free spotted by d0k, and de-XFAIL
x86_32-encoding.s in on expectation of it passing.

llvm-svn: 95806
2010-02-10 21:19:28 +00:00
Daniel Dunbar
7f6e51fc2a XFAIL this on linux until I figure out what is happening.
llvm-svn: 95804
2010-02-10 21:01:04 +00:00
Kevin Enderby
9be8c4c590 Replace this file containing 4 tests of x86 32-bit encodings with a file
containing the subset of the full auto generated test case that currently
encodes correctly.  Again it is useful as we bring up the the new encoder
to make sure currently working stuff stays working.

llvm-svn: 95791
2010-02-10 19:13:56 +00:00
Dan Gohman
ff8027e33a Canonicalize sizeof and alignof on pointer types to a canonical
pointer type.

llvm-svn: 95769
2010-02-10 06:13:07 +00:00
Evan Cheng
8bee7fb61d Now that ShrinkDemandedOps() is separated out from DAG combine. It sometimes leave some obvious nops which dag combine used to clean up afterwards e.g. (trunk (ext n)) -> n. Look for them and squash them.
llvm-svn: 95757
2010-02-10 02:17:34 +00:00
Kevin Enderby
f31bc700f1 Fix the encoding of the movntdqa X86 instruction. It was missing the 0x66
prefix which is part of the opcode encoding.

llvm-svn: 95729
2010-02-10 00:10:31 +00:00
Chris Lattner
2457a30898 fix X86 encoder to output [disp] only addresses with no SIB byte
in X86-32 mode.  This is still required in x86-64 mode to avoid
forming [disp+rip] encoding.  Rewrite the SIB byte decision logic
to be actually understandable.

llvm-svn: 95693
2010-02-09 21:47:19 +00:00
Eric Christopher
6691a59247 Move Intrinsic::objectsize lowering back to InstCombineCalls and
enable constant 0 offset lowering.

llvm-svn: 95691
2010-02-09 21:24:27 +00:00
Dale Johannesen
3cd434fa86 Re-disable for Darwin; I was mistaken to think this was fixed.
llvm-svn: 95688
2010-02-09 19:54:29 +00:00
Eric Christopher
871cf7bce2 Pull these back out, they're a little too aggressive and time
consuming for a simple optimization.

llvm-svn: 95671
2010-02-09 17:29:18 +00:00
Chris Lattner
340fe1f187 move tests that depend on the x86 backend out of codegen/generic,
and remove a few old and unreduced ones.  Fixes PR5624. 

llvm-svn: 95656
2010-02-09 06:41:03 +00:00
Chris Lattner
fdb9fda4af make target independent.
llvm-svn: 95655
2010-02-09 06:36:30 +00:00
Chris Lattner
28b79c686d merge a target-specific add test into x86 directory.
llvm-svn: 95654
2010-02-09 06:35:50 +00:00
Chris Lattner
34c420d11b merge another test in, drop the trivially constant folded cases.
llvm-svn: 95653
2010-02-09 06:33:27 +00:00
Chris Lattner
ddb2e5a05c consolidate and filecheckize two tests.
llvm-svn: 95652
2010-02-09 06:24:00 +00:00
Chris Lattner
e669789912 merge two tests, make target independent.
llvm-svn: 95651
2010-02-09 06:19:20 +00:00
Chris Lattner
26b712379f fix PR6193, only considering sign extensions *from i1* for this
xform.

llvm-svn: 95642
2010-02-09 01:12:41 +00:00
Chris Lattner
682f64dc8d Implement x86 asm parsing support for %st and %st(4)
llvm-svn: 95634
2010-02-09 00:49:22 +00:00
Eric Christopher
428b385575 Add a new pass to do llvm.objsize lowering using SCEV.
Initial skeleton and SCEVUnknown lowering implemented,
the rest should come relatively quickly.  Move testcase
to new directory.

Move pass to right before SimplifyLibCalls - which is
moved down a bit so we can take advantage of a few opts.

llvm-svn: 95628
2010-02-09 00:35:38 +00:00
Chris Lattner
20be5fb012 convert to filecheck.
llvm-svn: 95608
2010-02-08 23:47:34 +00:00
Devang Patel
8f947ff5d6 test case for r95604.
llvm-svn: 95605
2010-02-08 23:27:46 +00:00
Chris Lattner
6162c89bfe add an x86 implementation of MCTargetExpr for
representing @GOT and friends.  Use it for
personality references as a first use.

llvm-svn: 95588
2010-02-08 22:09:08 +00:00
Dan Gohman
56b9ea088b When CodeGen'ing unoptimized code, there may be unfolded constant expressions
in global initializers. Instead of aborting, attempt to fold them on the
spot. If folding succeeds, emit the folded expression instead.

This fixes PR6255.

llvm-svn: 95583
2010-02-08 22:02:38 +00:00
Dan Gohman
f113e5466c In guaranteed tailcall mode, don't decline the tailcall optimization
for blocks ending in "unreachable".

llvm-svn: 95565
2010-02-08 20:34:14 +00:00
Evan Cheng
5541068ad3 Run codegen dce pass for all targets at all optimization levels. Previously it's
only run for x86 with fastisel. I've found it being very effective in
eliminating some obvious dead code as result of formal parameter lowering
especially when tail call optimization eliminated the need for some of the loads
from fixed frame objects. It also shrinks a number of the tests. A couple of
tests no longer make sense and are now eliminated.

llvm-svn: 95493
2010-02-06 09:07:11 +00:00
Evan Cheng
c3cfda4e7e Remove a large test case that (soon will) no longer make sense.
llvm-svn: 95492
2010-02-06 09:00:30 +00:00
Rafael Espindola
b0bb1ddfe3 Fix alignment on ppc linux. This fixes the build of crtend.o
llvm-svn: 95477
2010-02-06 03:32:21 +00:00
Evan Cheng
de1a4726e6 Do not emit callseq instructions around sibcalls. This eliminated some unnecessary stack adjustments.
llvm-svn: 95475
2010-02-06 03:28:46 +00:00
Victor Hernandez
e65222a748 Function-local metadata whose operands had been optimized to no longer refer to function-local IR were not getting written by BitcodeWriter; solution is for these metadata to be enumerated just like global metadata.
llvm-svn: 95467
2010-02-06 01:21:09 +00:00
Bob Wilson
60fb5a2446 Add a test for my change to disable reassociation for i1 types.
llvm-svn: 95465
2010-02-06 01:16:25 +00:00
Bob Wilson
1a324958d6 Handle AddrMode6 (for NEON load/stores) in Thumb2's rewriteT2FrameIndex.
Radar 7614112.

llvm-svn: 95456
2010-02-06 00:24:38 +00:00
Jakob Stoklund Olesen
7b4c60adae Don't unroll loops containing function calls.
llvm-svn: 95454
2010-02-05 23:21:31 +00:00
Chris Lattner
e1b8c529a4 fix incorrect encoding of SBB8mi that Kevin noticed.
llvm-svn: 95448
2010-02-05 22:56:11 +00:00
Chris Lattner
9d4e878b6a fix a case where we'd mis-encode fisttp because of an incorrect (and
redundant with a correct one) pattern that was added for the disassembler.

llvm-svn: 95446
2010-02-05 22:49:06 +00:00
Chris Lattner
bec530a499 remove fixme
llvm-svn: 95444
2010-02-05 22:46:46 +00:00
Jakob Stoklund Olesen
670458b3be Teach SimplifyCFG about magic pointer constants.
Weird code sometimes uses pointer constants other than null. This patch
teaches SimplifyCFG to build switch instructions in those cases.

Code like this:

void f(const char *x) {
  if (!x)
    puts("null");
  else if ((uintptr_t)x == 1)
    puts("one");
  else if (x == (char*)2 || x == (char*)3)
    puts("two");
  else if ((intptr_t)x == 4)
    puts("four");
  else
    puts(x);
}

Now becomes a switch:

define void @f(i8* %x) nounwind ssp {
entry:
  %magicptr23 = ptrtoint i8* %x to i64            ; <i64> [#uses=1]
  switch i64 %magicptr23, label %if.else16 [
    i64 0, label %if.then
    i64 1, label %if.then2
    i64 2, label %if.then9
    i64 3, label %if.then9
    i64 4, label %if.then14
  ]

Note that LLVM's own DenseMap uses magic pointers.

llvm-svn: 95439
2010-02-05 22:03:18 +00:00
Chris Lattner
44965f1107 fix logical-select to invoke filecheck right, and fix hte instcombine
xform it is checking to actually pass.  There is no need to match
m_SelectCst<0, -1> since instcombine canonicalizes that into not(sext).

Add matches for sext(not(x)) in addition to not(sext(x)).

llvm-svn: 95420
2010-02-05 19:53:02 +00:00
Eric Christopher
f89979ce6a Remove this code for now. I have a better idea and will rewrite with
that in mind.

llvm-svn: 95402
2010-02-05 19:04:06 +00:00
Bill Wendling
c3f4101cc6 Make test more fucused eliminating extraneous bits.
llvm-svn: 95384
2010-02-05 11:21:05 +00:00
Evan Cheng
4b03f55de1 Fix test.
llvm-svn: 95373
2010-02-05 06:37:00 +00:00
Evan Cheng
81dde4c7f7 Handle tail call with byval arguments.
llvm-svn: 95351
2010-02-05 02:21:12 +00:00
Evan Cheng
94fe5501b7 When the scheduler unfold a load folding instruction it move some of the predecessors to the unfolded load. It decides what gets moved to the load by checking whether the new load is using the predecessor as an operand. The check neglects the cases whether the predecessor is a flagged scheduling unit.
rdar://7604000

llvm-svn: 95339
2010-02-05 01:27:11 +00:00
Bill Wendling
9761f067f8 An empty global constant (one of size 0) may have a section immediately
following it. However, the EmitGlobalConstant method wasn't emitting a body for
the constant. The assembler doesn't like that. Before, we were generating this:

  .zerofill __DATA, __common, __cmd, 1, 3

This fix puts us back to that semantic.

llvm-svn: 95336
2010-02-05 00:17:02 +00:00
Jakob Stoklund Olesen
d72e82107d Fix small bug in handling instructions with more than one implicitly defined operand.
ProcessImplicitDefs would only mark one operand per instruction with <undef>.
This fixed PR6086.

llvm-svn: 95319
2010-02-04 18:46:28 +00:00
Benjamin Kramer
707c8c5e00 Get the LLVMC tests working with clang++ by removing the problematic CXXFLAG in lit.
llvm-svn: 95318
2010-02-04 18:40:11 +00:00
Chris Lattner
43030eddcd fix a broken archive that was breaking dejagnu only (not lit)
after r95292 

llvm-svn: 95296
2010-02-04 07:11:08 +00:00
Evan Cheng
f5ee7fb571 Re-enable x86 tail call optimization.
llvm-svn: 95295
2010-02-04 06:47:24 +00:00
Eric Christopher
ee4a176739 Temporarily revert this since it appears to have caused a build
failure.

llvm-svn: 95294
2010-02-04 06:41:27 +00:00
Chris Lattner
e43007d443 add support for the sparcv9-*-* target triple to turn on
64-bit sparc codegen.  Patch by Nathan Keynes!

llvm-svn: 95293
2010-02-04 06:34:01 +00:00
Chris Lattner
eabd2085d7 From PR6228:
"Attached patch removes the extra NUL bytes from the output and changes
test/Archive/MacOSX.toc from a binary to a text file (removes
svn:mime-type=application/octet-stream and adds svn:eol-style=native).  I can't
figure out how to get SVN to include the new contents of the file in the patch
so I'm attaching it separately."

Patch by James Abbatiello!

llvm-svn: 95292
2010-02-04 06:19:43 +00:00
Eric Christopher
9b3e42f09e Rework constant expr and array handling for objectsize instcombining.
Fix bugs where we would compute out of bounds as in bounds, and where
we couldn't know that the linker could override the size of an array.

Add a few new testcases, change existing testcase to use a private
global array instead of extern.

llvm-svn: 95283
2010-02-04 02:55:34 +00:00
Victor Hernandez
28f795182c Fix (and test) function-local metadata that occurs before the instruction that it refers to; fix is to not enumerate operands of function-local metadata until after all instructions have been enumerated
llvm-svn: 95269
2010-02-04 01:13:08 +00:00
Eric Christopher
fe6ab1518e If we're dealing with a zero-length array, don't lower to any
particular size, we just don't know what the length is yet.

llvm-svn: 95266
2010-02-03 23:56:07 +00:00
Dale Johannesen
c413673047 This test passes now on ppc darwin; if it doesn't pass
on some other ppc say something on the list.

llvm-svn: 95265
2010-02-03 22:33:17 +00:00
Dale Johannesen
0a85fd105b This test passes now on ppc darwin, so reenable it.
llvm-svn: 95264
2010-02-03 22:29:02 +00:00
Dale Johannesen
ddc82307fa Debugging is now reenabled on PPC darwin, so reenable
these tests (they pass).

llvm-svn: 95263
2010-02-03 22:24:49 +00:00
Evan Cheng
5c8b1b9164 Speculatively disable x86 automatic tail call optimization while we track down a self-hosting issue.
llvm-svn: 95259
2010-02-03 21:40:40 +00:00
Evan Cheng
ccbbdfa8c4 Make test less fragile
llvm-svn: 95258
2010-02-03 21:39:04 +00:00
Kevin Enderby
57859abd72 Added support for X86 instruction prefixes so llvm-mc can assemble them. The
Lock prefix, Repeat string operation prefixes and the Segment override prefixes.
Also added versions of the move string and store string instructions without the
repeat prefixes to X86InstrInfo.td. And finally marked the rep versions of
move/store string records in X86InstrInfo.td as isCodeGenOnly = 1 so tblgen is
happy building the disassembler files.

llvm-svn: 95252
2010-02-03 21:04:42 +00:00
Daniel Dunbar
37b3f25e19 Add llvm_supports_darwin_and_target to DejaGNU as well, I'd almost forgotten it
ever existed. :)

llvm-svn: 95230
2010-02-03 18:43:46 +00:00
Evan Cheng
e273e42195 Revert 94937 and move the noreturn check to codegen.
llvm-svn: 95198
2010-02-03 03:55:59 +00:00
Evan Cheng
d9cf09b0d6 Allow all types of callee's to be tail called. But avoid automatic tailcall if the callee is a result of bitcast to avoid losing necessary zext / sext etc.
llvm-svn: 95195
2010-02-03 03:28:02 +00:00
Dale Johannesen
1e9d147461 Reapply 95050 with a tweak to check the register class.
llvm-svn: 95183
2010-02-03 01:40:33 +00:00
Chris Lattner
2b798aafd0 make these less sensitive to asm verbose changes by disabling it for them.
llvm-svn: 95175
2010-02-03 00:48:53 +00:00
Eric Christopher
ac28e14b77 Recommit this, looks like it wasn't the cause.
llvm-svn: 95165
2010-02-03 00:21:58 +00:00
Daniel Dunbar
c6f8382263 AsmParser/X86: Add temporary hack to allow parsing "sal". Eventually we need
some mechanism for specifying alternative syntaxes, but I'm not sure what form
that should take yet.

llvm-svn: 95158
2010-02-02 23:46:47 +00:00
Eric Christopher
f070aae6f7 Hopefully temporarily revert this.
llvm-svn: 95154
2010-02-02 23:01:31 +00:00
Chris Lattner
c49053be3f remove the # TAILCALL markers, which was causing the to fail.
It's unclear if the matcher is nondeterminstic of what here,
but I'm getting matches without TAILCALL and some other hosts
are getting matches with it.

llvm-svn: 95149
2010-02-02 22:36:29 +00:00
Eric Christopher
575fe8690d Re-add strcmp and known size object size checking optimization.
Passed bootstrap and nightly test run here.

llvm-svn: 95145
2010-02-02 22:10:43 +00:00
Daniel Dunbar
d01668aaf5 MCAssembler/Darwin: Add a test (on Darwin) that we assemble a bunch of
instructions exactly like 'as', and produce equivalent .o files.

llvm-svn: 95143
2010-02-02 22:00:15 +00:00
Daniel Dunbar
eb0b81040a MC/Mach-O: Set SOME_INSTRUCTIONS bit for sections.
llvm-svn: 95135
2010-02-02 21:44:01 +00:00
Chris Lattner
7c37b4942d this apparently depends on the host somehow.
llvm-svn: 95122
2010-02-02 20:57:28 +00:00
Bill Wendling
3146baa68c XFAIL for PPC Darwin.
llvm-svn: 95121
2010-02-02 20:56:02 +00:00
Chris Lattner
136eeef6b6 disable this test for now.
llvm-svn: 95120
2010-02-02 20:41:39 +00:00
Kevin Enderby
a10566900d Added another version of the X86 assembler matcher test case.
This test case is different subset of the full auto generated test case, and a
larger subset that is in x86_32-bit.s (that set will encode correctly).  These
instructions can pass though llvm-mc as it were a logical cat(1) and then
reassemble to the same instruction.  It is useful as we bring up the parser and
matcher so we don't break things that currently work.

llvm-svn: 95107
2010-02-02 19:05:57 +00:00
Dale Johannesen
08ab638bdc Test revert 95050; there's a good chance it's causing
buildbot failure.

llvm-svn: 95103
2010-02-02 18:52:56 +00:00
Chris Lattner
9f50341a96 don't turn (A & (C0?-1:0)) | (B & ~(C0?-1:0)) -> C0 ? A : B
for vectors.  Codegen is generating awful code or segfaulting
in various cases (e.g. PR6204).

llvm-svn: 95058
2010-02-02 02:43:51 +00:00
Chris Lattner
e471d94f91 fix a crash in loop unswitch on a loop invariant vector condition.
llvm-svn: 95055
2010-02-02 02:26:54 +00:00
Chris Lattner
5371fc3f06 remove an unreduced testcase, rename another.
llvm-svn: 95054
2010-02-02 02:23:37 +00:00
Evan Cheng
fac0fdc6a0 Perform sibcall in some cases when arguments are passes memory. Look for cases
where callee's arguments are already in the caller's own caller's stack and
they line up perfectly. e.g.

extern int foo(int a, int b, int c);

int bar(int a, int b, int c) {
  return foo(a, b, c);
}

llvm-svn: 95053
2010-02-02 02:22:50 +00:00
Dale Johannesen
a20fc3d1a9 Make local RA smarter about reusing input register of a copy
as output.  Needed for (functional) correctness in inline asm,
and should be generally beneficial.  7361612.

llvm-svn: 95050
2010-02-02 02:08:02 +00:00
Dan Gohman
dd6702be8f Factor out alignof expression folding into a separate function and
generalize it to handle more cases.

llvm-svn: 95045
2010-02-02 01:41:39 +00:00
Dale Johannesen
893435a736 Testcase for 94996 (PR 6157)
llvm-svn: 95021
2010-02-01 22:46:05 +00:00
Evan Cheng
efa391da81 Fix PR6196. GV callee may not be a function.
llvm-svn: 95017
2010-02-01 22:40:09 +00:00
Evan Cheng
b91a142542 Add test case for 95013.
llvm-svn: 95014
2010-02-01 22:32:42 +00:00
Chris Lattner
18e6b4eb6b fix PR6195, a bug constant folding scalar -> vector compares.
llvm-svn: 94997
2010-02-01 20:04:40 +00:00
Chris Lattner
8e4042108e fix PR6197 - infinite recursion in ipsccp due to block addresses
evaluateICmpRelation wasn't handling blockaddress.

llvm-svn: 94993
2010-02-01 19:35:08 +00:00
Dan Gohman
7b3c210a47 Update this test for a trivial register allocation difference.
llvm-svn: 94989
2010-02-01 19:00:32 +00:00
Dan Gohman
0b2c2769ba Generalize target-independent folding rules for sizeof to handle more
cases, and implement target-independent folding rules for alignof and
offsetof. Also, reassociate reassociative operators when it leads to
more folding.

Generalize ScalarEvolution's isOffsetOf to recognize offsetof on
arrays. Rename getAllocSizeExpr to getSizeOfExpr, and getFieldOffsetExpr
to getOffsetOfExpr, for consistency with analagous ConstantExpr routines.

Make the target-dependent folder promote GEP array indices to
pointer-sized integers, to make implicit casting explicit and exposed
to subsequent folding.

And add a bunch of testcases for this new functionality, and a bunch
of related existing functionality.

llvm-svn: 94987
2010-02-01 18:27:38 +00:00
Chris Lattner
5f10919836 fix rdar://7590304, a miscompilation of objc apps on arm. The caller
of objc message send was getting marked arm_apcscc, but the prototype
isn't.  This is fine at runtime because objcmsgsend is implemented in
assembly.  Only turn a mismatched caller and callee into 'unreachable'
if the callee is a definition.

llvm-svn: 94986
2010-02-01 18:11:34 +00:00
Chris Lattner
a336497d3f fix rdar://7590304, an infinite loop in instcombine. In the invoke
case, instcombine can't zap the invoke for fear of changing the CFG.
However, we have to do something to prevent the next iteration of
instcombine from inserting another store -> undef before the invoke
thereby getting into infinite iteration between dead store elim and
store insertion.

Just zap the callee to null, which will prevent the next iteration
from doing anything.

llvm-svn: 94985
2010-02-01 18:04:58 +00:00
Evan Cheng
dcc1816642 Undo r94946 now all the tests are passing again.
llvm-svn: 94970
2010-02-01 02:13:39 +00:00
Evan Cheng
b5f97d871c Avoid recursive sibcall's.
llvm-svn: 94946
2010-01-31 06:44:49 +00:00
Eli Friedman
0babc63336 Remove test which is no longer relevant.
llvm-svn: 94944
2010-01-31 04:40:45 +00:00
Eli Friedman
19c5c57885 Simplify/generalize the xor+add->sign-extend instcombine.
llvm-svn: 94943
2010-01-31 04:29:12 +00:00
Eli Friedman
58c7936637 Add a small transform: transform -(X<<Y) to (-X<<Y) when the shift has a single
use and X is free to negate.

llvm-svn: 94941
2010-01-31 02:30:23 +00:00
Evan Cheng
c2f3c20680 Do not mark no-return calls tail calls. It'll screw up special calls like longjmp and it doesn't make much sense for performance reason. If my logic is faulty, please let me know.
llvm-svn: 94937
2010-01-31 00:59:31 +00:00
Anton Korobeynikov
f7651ec593 Fix a gross typo: ARMv6+ may or may not support unaligned memory operations.
Even if they are suported by the core, they can be disabled
(this is just a configuration bit inside some register).

Allow unaligned memops on darwin and conservatively disallow them otherwise.

llvm-svn: 94889
2010-01-30 14:08:12 +00:00
Bob Wilson
0f04082970 Check alignment of loads when deciding whether it is safe to execute them
unconditionally.  Besides checking the offset, also check that the underlying
object is aligned as much as the load itself.

llvm-svn: 94875
2010-01-30 04:42:39 +00:00
Evan Cheng
40ae22e14d Allow more tailcall optimization: calls with inputs that are all passed in registers.
llvm-svn: 94873
2010-01-30 01:22:00 +00:00
Daniel Dunbar
23e8bc782c MC/X86 AsmParser: Handle absolute memory operands correctly. We were doing
something totally broken and parsing them as immediates, but the .td file also
had the wrong match class so things sortof worked. Except, that is, that we
would parse
  movl $0, %eax
as
  movl 0, %eax
Feel free to guess how well that worked.

llvm-svn: 94869
2010-01-30 01:02:48 +00:00
Bob Wilson
ccd1585ba8 Remove ARM-specific calling convention from this test. Target data is
needed for this test, but otherwise, there's nothing ARM-specific about
it and no need to specify the calling convention.

llvm-svn: 94862
2010-01-30 00:40:23 +00:00
Daniel Dunbar
b0a870919b MC/X86: Add a nice X86 assembler matcher test case from Kevin Enderby.
- This test case is auto generated, and has been verified to round-trip
   correctly through llvm-mc by checking the assembled .o file before and after
   piping through llvm-mc. It will be extended over time as the matcher grows
   support for more instructions.

llvm-svn: 94857
2010-01-29 23:32:40 +00:00
Eric Christopher
47d90f7adb Revert my last couple of patches. They appear to have broken bison.
llvm-svn: 94841
2010-01-29 21:16:24 +00:00
Bob Wilson
f897b7b37e Improve isSafeToLoadUnconditionally to recognize that GEPs with constant
indices are safe if the result is known to be within the bounds of the
underlying object.

llvm-svn: 94829
2010-01-29 19:19:08 +00:00
Evan Cheng
2cbd1b19db Catch more trivial tail call opportunities: no inputs and output types match.
llvm-svn: 94804
2010-01-29 06:45:59 +00:00
Eric Christopher
f01379e6c2 Make strcpy_chk lower to strcpy if we have a safe size.
llvm-svn: 94783
2010-01-29 01:37:11 +00:00
Eric Christopher
7d74af1824 Add constant support to object size handling and remove default
lowering. We'll either figure it out, or not and be lowered by
SelectionDAGBuild.

Add test.

llvm-svn: 94775
2010-01-29 01:09:57 +00:00
Dan Gohman
0dc9176f36 Remove the folding rule
getelementptr (i8* inttoptr (i64 1 to i8*), i32 -1) 
  to
  inttoptr (i64 0 to i8*)
from the VMCore constant folder. It didn't handle sign-extension properly
in the case where the source integer is smaller than a pointer size. And,
it relied on an assumption about sizeof(i8).

The Analysis constant folder still folds these kinds of things; it has
access to TargetData, so it can do them right.

Add a testcase which tests that the VMCore constant folder doesn't
miscompile this, and that the Analysis folder does fold it.

llvm-svn: 94750
2010-01-28 18:08:26 +00:00
Duncan Sands
a3395c61b5 Fix PR6165. The bug was that LHSKnownZero was being and'd with DemandedMask
when it should have been and'd with LowBits.  Fix that and while there beef
up the logic in the case of a negative LHS.

llvm-svn: 94745
2010-01-28 17:22:42 +00:00
Chris Lattner
d7a8482810 convert the last 3 targets to use EmitFunctionBody() now that
it has before/end body hooks.

 lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp |   49 ++-----------
 lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp   |   87 ++++++------------------
 lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp |   56 +++------------
 test/CodeGen/XCore/ashr.ll                      |    2 
 4 files changed, 48 insertions(+), 146 deletions(-)

llvm-svn: 94741
2010-01-28 06:22:43 +00:00
Evan Cheng
7e26fdaa78 Fix a bug introduced by r94490 where it created a X86ISD::CMP whose output type is different from its inputs.
This fixes PR6146.

llvm-svn: 94731
2010-01-28 01:57:22 +00:00
Chris Lattner
95118672e3 Give AsmPrinter the most common expected implementation of
runOnMachineFunction, and switch PPC to use EmitFunctionBody.
The two ppc asmprinters now don't heave to define 
runOnMachineFunction.

llvm-svn: 94722
2010-01-28 01:28:58 +00:00
Chris Lattner
df1662f0e6 emit a 0 byte instead of a noop if a function is empty on darwin.
"0" is nice and target independent.

llvm-svn: 94718
2010-01-28 01:06:32 +00:00
Bob Wilson
2e1a609654 Avoid creating redundant PHIs in SSAUpdater::GetValueInMiddleOfBlock.
This was already being done in SSAUpdater::GetValueAtEndOfBlock so I've
just changed SSAUpdater to check for existing PHIs in both places.

llvm-svn: 94690
2010-01-27 22:01:02 +00:00
Chandler Carruth
4b62a01a0c Quick fix to a test that is currently failing on every Linux build bot. No idea
if this is the "correct" fix, but it seems a strict improvement.

llvm-svn: 94675
2010-01-27 10:36:15 +00:00
Duncan Sands
3cd86bc569 Revert commit 94666 (ddunbar) [Suppress clang warning about unused arguments].
It causes g++ to complain: unrecognized option '-Qunused-arguments'

llvm-svn: 94670
2010-01-27 10:08:08 +00:00
Daniel Dunbar
c1f02aa29c Suppress clang warning about unused arguments.
llvm-svn: 94666
2010-01-27 07:10:10 +00:00
Evan Cheng
381bc804d6 Perform trivial tail call optimization for callees with "C" ABI. These are done
even when -tailcallopt is not specified and it does not require changing ABI.
First case is the most trivial one. Perform tail call optimization when both
the caller and callee do not return values and when the callee does not take
any input arguments.

llvm-svn: 94664
2010-01-27 06:25:16 +00:00
Victor Hernandez
e6321dc910 When converting dbg.declare to dbg.value, attach promoted store's debug metadata to dbg.value
llvm-svn: 94634
2010-01-27 00:44:36 +00:00
Chris Lattner
ee2b6b1cc5 emit jump table an alias ".set" directives through MCStreamer as
assignments.

.set x, a-b

is the same as:

x = a-b

llvm-svn: 94596
2010-01-26 21:53:08 +00:00
Rafael Espindola
f46baf3304 Emit .comm alignment in bytes but .align in powers of 2 for ARM ELF.
Original patch by Sandeep Patel and updated by me.

llvm-svn: 94582
2010-01-26 20:21:43 +00:00
Chris Lattner
044439c9bc eliminate MCAsmInfo::NeedsSet: we now just use .set on any platform
that has it.

llvm-svn: 94581
2010-01-26 20:20:43 +00:00
Dan Gohman
71fc5e8fce -disable-output is no longer needed with -analyze.
llvm-svn: 94574
2010-01-26 19:25:59 +00:00
Dan Gohman
5e06a05a16 Fix the the ceiling-division used in computing the MaxBECount so that it doesn't
have trouble with an intermediate add overflowing. Also, be more conservative
about the case where the induction variable in an SLT loop exit can step past
the RHS of the SLT and overflow in a single step.

Make getSignedRange more aggressive, to recover for some common cases which
the above fixes pessimized.

This addresses rdar://7561161.

llvm-svn: 94512
2010-01-26 04:40:18 +00:00
Victor Hernandez
f12e8a120f In mem2reg, for all alloca/stores that get promoted where the alloca has an associated llvm.dbg.declare instrinsic, insert an llvm.dbg.var intrinsic before each store.
llvm-svn: 94493
2010-01-26 02:42:15 +00:00
Evan Cheng
548d00d77c Implement cond ? -1 : 0 with sbb.
llvm-svn: 94490
2010-01-26 02:00:44 +00:00
Dale Johannesen
d75f9dc3ff Generate DEBUG_VALUE comments on x86. The (limited)
dbg.declare's we currently generate go through both
register allocators without perturbing the results.

llvm-svn: 94480
2010-01-26 00:09:58 +00:00
Dan Gohman
18bbc20ac8 Fix the bitcode reader to deserialize nuw/nsw/etc. bits properly in the case
of a forward-reference, which doesn't use an "abbrev" encoding.

llvm-svn: 94454
2010-01-25 21:55:39 +00:00
Chris Lattner
5f919913e8 wirte up .file and .file to the mc asmparser.
llvm-svn: 94438
2010-01-25 19:02:58 +00:00
Victor Hernandez
253c09eb8f Revert r94260 until findDbgDeclare() is made more efficient
llvm-svn: 94432
2010-01-25 17:52:13 +00:00
Rafael Espindola
575697fd65 Update test for darwin.
llvm-svn: 94421
2010-01-25 15:32:10 +00:00
Chris Lattner
2020423588 we removed support for darwin8 tools.
llvm-svn: 94414
2010-01-25 07:43:40 +00:00
Rafael Espindola
82a8b3efd4 Fix PR6134.
We are not emitting alignments on Darwin for "bar". Not sure what is the
correct way to do it.

llvm-svn: 94400
2010-01-25 02:27:39 +00:00
Daniel Dunbar
c1df55e99c Attempt to unbreak test on Linux. Chris, please check.
llvm-svn: 94399
2010-01-25 00:54:13 +00:00
Chris Lattner
6fdaf12267 just remove this test, it is not reduced, is not clear what its testing for and
it is dying due to fragility in the asmprinter .s comments.

llvm-svn: 94372
2010-01-24 19:23:09 +00:00
Chris Lattner
9cb699ec58 this test has been failing or a long time, just disable it for now to get
back to green.

llvm-svn: 94371
2010-01-24 19:13:39 +00:00
Chris Lattner
5d31547fec fix a parsing problem on instructions like:
movw	$8, (_cost_table_-L97$pb)+66(%eax)

After the parens, we could still have a binop.

llvm-svn: 94345
2010-01-24 01:07:33 +00:00
Mon P Wang
d4d1cbb72b It seems better to scalarize vectors of size 1 instead of widening them.
Add support to widen SETCC.

llvm-svn: 94342
2010-01-24 00:24:43 +00:00
Chris Lattner
91fafbd4e8 change the canonical form of "cond ? -1 : 0" to be
"sext cond" instead of a select.  This simplifies some instcombine
code, matches the policy for zext (cond ? 1 : 0 -> zext), and allows
us to generate better code for a testcase on ppc.

llvm-svn: 94339
2010-01-24 00:09:49 +00:00
Mon P Wang
871ea08e40 Improved widening loads by adding support for wider loads if
the alignment allows.  Fixed a bug where we didn't use a
vector load/store for PR5626.

llvm-svn: 94338
2010-01-24 00:05:03 +00:00
Nick Lewycky
f9a681fb61 Speculatively revert r94322 to see if it fixes darwin selfhost buildbot.
llvm-svn: 94331
2010-01-23 20:32:12 +00:00
Chris Lattner
b444bc0234 third bug from PR6119: the xor dupe extension allows
for arbitrary terminators in predecessors, don't assume
it is a conditional or uncond branch.  The testcase shows
an example where they can happen with switches.

llvm-svn: 94323
2010-01-23 19:21:31 +00:00
Nick Lewycky
8bbb754c7c Teach DAE that even though it can't modify the function signature of an
externally visible function, it can still find all callers of it and replace
the parameters to a dead argument with undef.

llvm-svn: 94322
2010-01-23 19:19:34 +00:00
Chris Lattner
7130788ea2 add an early out to ProcessBranchOnXOR to speed it up,
handle the case when we can infer an input to the xor
from all inputs that agree, instead of going into an
infinite loop.  Another part of PR6199

llvm-svn: 94321
2010-01-23 19:16:25 +00:00
Chris Lattner
e4391a1adb fix a crash in jump threading, PR6119
llvm-svn: 94319
2010-01-23 18:56:07 +00:00
Chris Lattner
8909d5aca5 implement a simple instcombine xform that has been in the
readme forever.

llvm-svn: 94318
2010-01-23 18:49:30 +00:00
Chris Lattner
1b7c00a4f2 Change constantexpr global variable initializers to convert the constants
to MCExpr then emit them through MCStreamer with EmitValue.  I think all
global variable initializers are now going through mcstreamer.

llvm-svn: 94293
2010-01-23 06:17:14 +00:00
Eric Christopher
e6d6bfcc32 Don't lower splat vector load to relative to the esp if the
stack may be misaligned.

Update test accordingly.

Patch by Evan Cheng!

llvm-svn: 94291
2010-01-23 06:02:43 +00:00
Chris Lattner
e5e7b41090 stop testing for invalid output.
llvm-svn: 94288
2010-01-23 05:45:28 +00:00
Chris Lattner
20a336f1df emit .ascii and .asciz through MCStreamer.
llvm-svn: 94282
2010-01-23 04:54:10 +00:00
Mon P Wang
b7fce13b78 InstCombine should not fold sext/zext of a vector and a bitcast to a scalar to a sext/zext
llvm-svn: 94280
2010-01-23 04:35:57 +00:00
Chris Lattner
4515320f9f remove this test.
llvm-svn: 94276
2010-01-23 03:11:10 +00:00