Commit Graph

55302 Commits

Author SHA1 Message Date
Chris Lattner fda3b559e6 fix some fixme's by using twines
llvm-svn: 91916
2009-12-22 19:23:33 +00:00
Jakob Stoklund Olesen 6f579c12b1 Use proper move instructions. Make the verifier happy.
llvm-svn: 91914
2009-12-22 18:49:55 +00:00
Bob Wilson bac37abe73 Report an error for bad inline assembly, where the value passed for an
"indirect" operand is not a pointer.

llvm-svn: 91913
2009-12-22 18:34:19 +00:00
Evan Cheng 71d7eaa87e Remove target attribute break-sse-dep. Instead, do not fold load into sse partial update instructions unless optimizing for size.
llvm-svn: 91910
2009-12-22 17:47:23 +00:00
Douglas Gregor 8b858396d4 Include based on the current path, since we already -I the X86 target's path. Fixes CMake build
llvm-svn: 91908
2009-12-22 17:25:11 +00:00
Sanjiv Gupta 8c5f05fcee While converting one of the operands to a memory operand, we need to check if it is Legal and does not result into a cyclic dep.
llvm-svn: 91904
2009-12-22 14:25:37 +00:00
Chris Lattner 778f92ab02 specify what is invalid about it
llvm-svn: 91901
2009-12-22 07:03:21 +00:00
Chris Lattner f6d4129c76 specify a triple to use, fixing the test on non-x86-64 hosts.
llvm-svn: 91900
2009-12-22 07:01:12 +00:00
Chris Lattner 502f0f11e0 reject invalid input with a caret, e.g.:
simple-tests.txt:16:1: error: invalid instruction
0xff 0xff
^

llvm-svn: 91898
2009-12-22 06:58:29 +00:00
Bob Wilson 62a84ea8e3 Generalize SROA to allow the first index of a GEP to be non-zero. Add a
missing check that an array reference doesn't go past the end of the array,
and remove some redundant checks for in-bound array and vector references
that are no longer needed.

llvm-svn: 91897
2009-12-22 06:57:14 +00:00
Chris Lattner dd0c01b5de various cleanups, make the disassemble reject lines with too much
data on them, for example:

	addb	%al, (%rax)
simple-tests.txt:11:5: error: excess data detected in input
0 0 0 0 0 
    ^

llvm-svn: 91896
2009-12-22 06:56:51 +00:00
Chris Lattner 8879918722 If you thought that it didn't make sense for the disassembler
to not produce caret diagnostics, you were right!

llvm-svn: 91895
2009-12-22 06:45:48 +00:00
Chris Lattner dc9845b79a rewrite the file parser for the disassembler, implementing support for
comments.  Also, check in a simple testcase for the disassembler,
including a test for r91864

llvm-svn: 91894
2009-12-22 06:37:58 +00:00
Chris Lattner 72cbaa2ecb don't crash on blank lines, rename some variables.
llvm-svn: 91892
2009-12-22 06:24:00 +00:00
Chris Lattner f21a220bcd Implement PR5795 by merging duplicated return blocks. This could go further
by merging all returns in a function into a single one, but simplifycfg 
currently likes to duplicate the return (an unfortunate choice!)

llvm-svn: 91890
2009-12-22 06:07:30 +00:00
Chris Lattner 2b297ed9ee convert to filecheck
llvm-svn: 91889
2009-12-22 06:04:26 +00:00
Chris Lattner f3ef2cada7 don't run GVN at -O1, GCC doesn't do it's equivalent at that optimization level.
llvm-svn: 91886
2009-12-22 04:47:41 +00:00
Chris Lattner 9b7d99eb76 The phi translated pointer can be computed when returning a partially cached result
instead of stored.  This reduces memdep memory usage, and also eliminates a bunch of
weakvh's.  This speeds up gvn on gcc.c-torture/20001226-1.c from 23.9s to 8.45s (2.8x)
on a different machine than earlier.

llvm-svn: 91885
2009-12-22 04:25:02 +00:00
Bill Wendling 919b7aab2e Add more plumbing. This time in the LowerArguments and "get" functions which
return partial registers. This affected the back-end lowering code some.

Also patch up some places I missed before in the "get" functions.

llvm-svn: 91880
2009-12-22 02:10:19 +00:00
Sean Callanan 2f9443f422 Changed REG_* to MODRM_REG_* to avoid conflicts
with symbols in AuroraUX's global namespace.

llvm-svn: 91879
2009-12-22 02:07:42 +00:00
Daniel Dunbar 8b532de418 Fix some may-be-uninitialized var warnings.
llvm-svn: 91878
2009-12-22 01:41:37 +00:00
Chris Lattner 3d1205b3a8 fix unit test that I broke.
llvm-svn: 91877
2009-12-22 01:38:23 +00:00
Bill Wendling ac08758b71 Add SDNode ordering to inlined asm and VA functions.
llvm-svn: 91876
2009-12-22 01:25:10 +00:00
Eric Christopher ab6a0d60d5 Whitespace fixes.
llvm-svn: 91875
2009-12-22 01:23:51 +00:00
Chris Lattner 18d8b7575e types don't need atomic inc/dec, they are local to an llvmcontext.
llvm-svn: 91873
2009-12-22 01:17:43 +00:00
Bill Wendling f376c40d0e Adding more assignment of ordering to SDNodes. This time in the "call" and
generic copy functions.

llvm-svn: 91872
2009-12-22 01:11:43 +00:00
Sean Callanan 5c8f4cd396 Fixed library dependencies between the X86 disassembler and
X86 codegen that were causing circular symbol dependencies.

llvm-svn: 91871
2009-12-22 01:11:26 +00:00
Chris Lattner 2ee6787c1b avoid calling extractMallocCall when it's obvious we don't have
a call.  This speeds up memdep ~1.5%

llvm-svn: 91869
2009-12-22 01:00:32 +00:00
Chris Lattner 84463813a1 comment fix: weakvh -> tracking vh
llvm-svn: 91867
2009-12-22 00:51:57 +00:00
Bill Wendling a4d7df7a37 Add ordering of SDNodes to LowerCallTo.
llvm-svn: 91866
2009-12-22 00:50:32 +00:00
Chris Lattner 6211d7ba4b print pcrel immediates as signed values instead of unsigned so that we
get things like this out of the disassembler:

0x100000ecb: callq	-96

instead of:

0x100000ecb: callq	4294967200

rdar://7491123

llvm-svn: 91864
2009-12-22 00:44:05 +00:00
Bill Wendling b99b2693f3 Now add ordering to SDNodes created by the massive intrinsic lowering function.
llvm-svn: 91863
2009-12-22 00:40:51 +00:00
Bill Wendling ea3e73e596 To make things interesting, I added MORE code to set the ordering of
SDNodes. This time in the load/store and limited-precision code.

llvm-svn: 91860
2009-12-22 00:12:37 +00:00
Lang Hames 4c052261de Changed slot index ranges for MachineBasicBlocks to be exclusive of endpoint.
This fixes an in-place update bug where code inserted at the end of basic blocks may not be covered by existing intervals which were live across the entire block. It is also consistent with the way ranges are specified for live intervals.

llvm-svn: 91859
2009-12-22 00:11:50 +00:00
Bill Wendling c6b473433b Add more plumbing to assign ordering to SDNodes. Have the "getValue" method
assign the ordering when called. Combine some of the ordering assignments to
keep things simple.

llvm-svn: 91857
2009-12-21 23:47:40 +00:00
Daniel Dunbar c661a2d4d8 Add suggested parentheses.
llvm-svn: 91853
2009-12-21 23:27:57 +00:00
Chris Lattner bf20018423 Add a fastpath to Load GVN to special case when we have exactly one dominating
load to avoid even messing around with SSAUpdate at all.  In this case (which
is very common, we can just use the input value directly).

This speeds up GVN time on gcc.c-torture/20001226-1.c from 36.4s to 16.3s,
which still isn't great, but substantially better and this is a simple speedup
that applies to lots of different cases.

llvm-svn: 91851
2009-12-21 23:15:48 +00:00
Bill Wendling e79105b591 More ordering plumbing. This time for GEP. I need to remember to assign
orderings to values returned by getValue().

llvm-svn: 91850
2009-12-21 23:10:19 +00:00
Chris Lattner 927b0ac4b2 refactor some code out to a new helper method.
llvm-svn: 91849
2009-12-21 23:04:33 +00:00
Chris Lattner eaa25da8bb improve indentation avoid a pointless conversion from weakvh to trackingvh,
no functionality change.

llvm-svn: 91848
2009-12-21 22:43:03 +00:00
Bill Wendling fff99f066b Another incremental check-in for assigning ordering to SDNodes. This time for
shuffle and insert vector.

llvm-svn: 91847
2009-12-21 22:42:14 +00:00
Bill Wendling 443d0722b0 Assign ordering to more instructions. Incremental check-in.
llvm-svn: 91846
2009-12-21 22:30:11 +00:00
Bill Wendling 28727f3785 - Add a bit more plumbing assigning an order to SDNodes.
- Modify the "dump" method to emit the order of an SDNode.

llvm-svn: 91845
2009-12-21 21:59:52 +00:00
David Greene dbf7074296 Fix a bug in !subst where TableGen would go and resubstitute text it had
just substituted.  This could cause infinite looping in certain
pathological cases.

llvm-svn: 91843
2009-12-21 21:21:34 +00:00
Anton Korobeynikov 131420c5d7 Remove uber-gross hack. The define _snprintf to snprintf is invalid due to two reasons: 1. Accroding to C++ standard snprintf should be available in std namespace (and __gnu_cxx in case of GCC to). Such ifdef will change all snprintf's to _snprintf's, but won't bring snprintf to all necessary namespaces. Thus e.g. any locale-using code on mingw will yield an error (include this file + string to see the result) 2. MSVCRT's _snprintf does not comply with C99 standard. Standard one is snprintf.
llvm-svn: 91842
2009-12-21 20:19:37 +00:00
Anton Korobeynikov 3e9e87a9cb Mark FPW as allocable when frame address is taken.
llvm-svn: 91841
2009-12-21 20:18:49 +00:00
Bill Wendling 7f5eb53ce2 First wave of plumbing for assigning an ordering to SDNodes. This takes care of
a lot of the branching instructions.

llvm-svn: 91838
2009-12-21 19:59:38 +00:00
Evan Cheng db4d798619 Delete the instruction just before the function terminates for consistency sake.
llvm-svn: 91836
2009-12-21 19:53:39 +00:00
Bill Wendling 6de55a0efd Place SDNodeOrdering.h in the directory it's used.
llvm-svn: 91834
2009-12-21 19:34:59 +00:00
Bob Wilson 88a0598fe8 Remove special-case SROA optimization of variable indexes to one-element and
two-element arrays.  After restructuring the SROA code, it was not safe to
do this without adding more checking.  It is not clear that this special-case
has really been useful, and removing this simplifies the code quite a bit.

llvm-svn: 91828
2009-12-21 18:39:47 +00:00
Daniel Dunbar 0fc1f6c595 XFAIL these tests on powerpc, under the assumption that no one cares. If you care, feel free to fix.
llvm-svn: 91826
2009-12-21 17:31:59 +00:00
Eric Christopher a91c0f48e6 Fix setting and default setting of code model for jit. Do this
by allowing backends to override routines that will default
the JIT and Static code generation to an appropriate code model
for the architecture.

Should fix PR 5773.

llvm-svn: 91824
2009-12-21 08:15:29 +00:00
Eli Friedman dbe2aa91b9 A couple minor README updates.
llvm-svn: 91823
2009-12-21 08:03:16 +00:00
Chris Lattner a0a51c7b0e improve compatibility with SWIG, patch by James Knight!
llvm-svn: 91822
2009-12-21 07:52:40 +00:00
Chris Lattner 4edfcb88e1 revert r89298, which was committed without a testcase. I think
the underlying PHI node insertion issue in SSAUpdate is fixed.

llvm-svn: 91821
2009-12-21 07:45:57 +00:00
Chris Lattner 8fb07c5a21 fix PR5837 by having SSAUpdate reuse phi nodes for the
'GetValueInMiddleOfBlock' case, instead of inserting 
duplicates.

A similar fix is almost certainly needed by the machine-level
SSAUpdate implementation.

llvm-svn: 91820
2009-12-21 07:16:11 +00:00
Chris Lattner 080f666e01 add a helper ctor.
llvm-svn: 91819
2009-12-21 07:15:15 +00:00
Eli Friedman 00879d8faa Change StringRef::startswith and StringRef::endswith to versions which are a
bit more verbose, but optimize to much shorter code.

llvm-svn: 91817
2009-12-21 06:49:24 +00:00
Chris Lattner 7bc85a931e add check lines for min/max tests.
llvm-svn: 91816
2009-12-21 06:08:50 +00:00
Chris Lattner 33269813df really convert this to filecheck.
llvm-svn: 91815
2009-12-21 06:06:10 +00:00
Chris Lattner d4fb4296df give instcombine some helper functions for matching MIN and MAX, and
implement some optimizations for MIN(MIN()) and MAX(MAX()) and 
MIN(MAX()) etc.  This substantially improves the code in PR5822 but
doesn't kick in much elsewhere.  2 max's were optimized in 
pairlocalalign and one in smg2000.

llvm-svn: 91814
2009-12-21 06:03:05 +00:00
Chris Lattner 7a72d50de7 filecheckize
llvm-svn: 91813
2009-12-21 05:53:13 +00:00
Chris Lattner ffbd02829c enhance x-(-A) -> x+A to preserve NUW/NSW.
Use the presence of NSW/NUW to fold "icmp (x+cst), x" to a constant in
cases where it would otherwise be undefined behavior.

Surprisingly (to me at least), this triggers hundreds of the times in
a few benchmarks: lencode, ldecode, and 466.h264ref seem to *really*
like this.

llvm-svn: 91812
2009-12-21 04:04:05 +00:00
Chris Lattner 900ce231f9 Optimize all cases of "icmp (X+Cst), X" to something simpler. This triggers
a bunch in lencode, ldecod, spass, 176.gcc, 252.eon, among others.  It is 
also the first part of PR5822

llvm-svn: 91811
2009-12-21 03:19:28 +00:00
Chris Lattner d18b455086 convert to filecheck
llvm-svn: 91810
2009-12-21 03:11:05 +00:00
Lang Hames 0209f50c0d Fixed use of phi param in SlotIndex constructors.
llvm-svn: 91790
2009-12-19 23:32:32 +00:00
Chris Lattner 25bf6f8946 fix an overly conservative caching issue that caused memdep to
cache a pointer as being unavailable due to phi trans in the
wrong place.  This would cause later queries to fail even when
they didn't involve phi trans.

llvm-svn: 91787
2009-12-19 21:29:22 +00:00
Daniel Dunbar 039d6e11a8 CMake: Update lib deps.
llvm-svn: 91786
2009-12-19 21:27:30 +00:00
Chris Lattner 5c13f389cb .llx is no more.
llvm-svn: 91784
2009-12-19 20:56:53 +00:00
Chris Lattner 95b431dd32 fix inconsistent use of tabs
llvm-svn: 91783
2009-12-19 20:44:43 +00:00
Daniel Dunbar 877075a41f Remove unused variable (noticed by clang++).
llvm-svn: 91780
2009-12-19 18:58:49 +00:00
Daniel Dunbar 4750efc28a #if 0 out X86 disassembler for now, it is breaking the build in multiple places.
llvm-svn: 91778
2009-12-19 17:11:53 +00:00
Sanjiv Gupta 8ac077df57 Emit direction operand in binary insns that stores in memory.
llvm-svn: 91777
2009-12-19 13:52:01 +00:00
Sanjiv Gupta bdef02be69 Adding a bunch of options to the mcc16 driver.
llvm-svn: 91776
2009-12-19 13:13:29 +00:00
Nuno Lopes 3ed6d6003c rename dprintf to dbgpritnf, in order to fix build with glibc (which already defines dprintf in stdio.h
llvm-svn: 91775
2009-12-19 12:07:00 +00:00
Nuno Lopes 91b866a163 fix build and while at it remove a redudant include
llvm-svn: 91774
2009-12-19 11:52:18 +00:00
Sanjiv Gupta bda8002e7f Test cases for changes done in 91768.
llvm-svn: 91773
2009-12-19 11:38:14 +00:00
Sanjiv Gupta 4f469974b2 1. In indirect load/store insns , the name of fsr should be emitted as INDF.
2. include standard asmbly headers in generated asmbly.

llvm-svn: 91768
2009-12-19 08:26:25 +00:00
Douglas Gregor 740ab38bb7 Fix a bunch of little errors that Clang complains about when its being pedantic
llvm-svn: 91764
2009-12-19 07:05:23 +00:00
Chris Lattner 4ad5eba568 fix PR5827 by disabling the phi slicing transformation in a case
where instcombine would have to split a critical edge due to a
phi node of an invoke.  Since instcombine can't change the CFG,
it has to bail out from doing the transformation.

llvm-svn: 91763
2009-12-19 07:01:15 +00:00
Bob Wilson c16811b575 Update my SROA changes in response to review.
* change FindElementAndOffset to return a uint64_t instead of unsigned, and
  to identify the type to be used for that result in a GEP instruction.
* move "isa<ConstantInt>" to be first in conditional.
* replace some dyn_casts with casts.
* add a comment about handling mem intrinsics.

llvm-svn: 91762
2009-12-19 06:53:17 +00:00
Daniel Dunbar 3a821f7f0c More bzero -> memset that I missed.
llvm-svn: 91757
2009-12-19 04:16:57 +00:00
Daniel Dunbar f008ea5fa0 Add missing newlines at EOF (for clang++).
llvm-svn: 91756
2009-12-19 04:16:48 +00:00
Daniel Dunbar c745a620a2 Use memset instead of bzero, its more portable.
llvm-svn: 91754
2009-12-19 03:31:50 +00:00
Douglas Gregor 0a66daf900 Remove spurious semicolon. Thanks, Clang
llvm-svn: 91752
2009-12-19 03:21:36 +00:00
Sean Callanan 04cc307edd Table-driven disassembler for the X86 architecture (16-, 32-, and 64-bit
incarnations), integrated into the MC framework.  

The disassembler is table-driven, using a custom TableGen backend to 
generate hierarchical tables optimized for fast decode.  The disassembler 
consumes MemoryObjects and produces arrays of MCInsts, adhering to the 
abstract base class MCDisassembler (llvm/MC/MCDisassembler.h).

The disassembler is documented in detail in

- lib/Target/X86/Disassembler/X86Disassembler.cpp (disassembler runtime)
- utils/TableGen/DisassemblerEmitter.cpp (table emitter)

You can test the disassembler by running llvm-mc -disassemble for i386
or x86_64 targets.  Please let me know if you encounter any problems
with it.

llvm-svn: 91749
2009-12-19 02:59:52 +00:00
Anton Korobeynikov 148d87b0b0 Bump alignment requirements for windows targets to achieve compartibility with vcpp.
Based on patch by Michael Beck!

llvm-svn: 91745
2009-12-19 02:04:23 +00:00
Anton Korobeynikov 10590171fa Use 4-arg getVTList) variant instead of generic one, when possible
llvm-svn: 91744
2009-12-19 02:04:00 +00:00
Dan Gohman a73df58110 Delete unused code.
llvm-svn: 91743
2009-12-19 01:47:13 +00:00
Dan Gohman 876f45d7d2 Fix a spello in a comment that Nick spotted.
llvm-svn: 91742
2009-12-19 01:46:34 +00:00
Dan Gohman b0da63da1e Fix a comment.
llvm-svn: 91741
2009-12-19 01:46:09 +00:00
Chris Lattner dd3e9aaad3 Make some methods const. The only interesting change here is that
it changes raw_fd_ostream::preferred_buffer_size to return zero on
a scary stat failure instead of setting the stream to an error state.
This method really should not mutate the stream.

llvm-svn: 91740
2009-12-19 01:38:42 +00:00
John McCall 086bb4ef82 Qualify a bunch of explicit template instantiations to satisfy clang++.
llvm-svn: 91736
2009-12-19 00:55:12 +00:00
John McCall 791e5c9dd5 Put TypesEqual and TypeHasCycleThroughItself in namespace llvm so ADL from
the templates in TypesContext.h can find them.  Caught by clang++.

llvm-svn: 91735
2009-12-19 00:51:42 +00:00
Bill Wendling 57f2a6187a Forgot forward declaration.
llvm-svn: 91732
2009-12-19 00:05:07 +00:00
Dan Gohman f902c8c1b5 Eliminate unnecessary LLVMContexts.
llvm-svn: 91729
2009-12-18 23:42:08 +00:00
Bill Wendling 022d18fa3f Changes from review:
- Move DisableScheduling flag into TargetOption.h
- Move SDNodeOrdering into its own header file. Give it a minimal interface that
  doesn't conflate construction with storage.
- Move assigning the ordering into the SelectionDAGBuilder.

This isn't used yet, so there should be no functional changes.

llvm-svn: 91727
2009-12-18 23:32:53 +00:00
Dan Gohman 7db230f5c9 Make this comment more precise.
llvm-svn: 91722
2009-12-18 23:18:03 +00:00
Eli Friedman 36623cc253 Fix an issue in googletest where a name was used before it was defined.
llvm-svn: 91718
2009-12-18 21:38:44 +00:00
Evan Cheng b175de6356 Increase opportunities to optimize (brcond (srl (and c1), c2)).
llvm-svn: 91717
2009-12-18 21:31:31 +00:00
Eli Friedman 3a7cdaca33 Fix gcc warning.
llvm-svn: 91715
2009-12-18 21:07:18 +00:00
Rafael Espindola 2c5792a6bd Catch more cases of a pointer being marked garbage twice. This helps when
debugging some leaks (PR5770 in particular).

llvm-svn: 91713
2009-12-18 20:35:38 +00:00
Bob Wilson 532cd232fb Reapply 91459 with a simple fix for the problem that broke the x86_64-darwin
bootstrap.  This also replaces the WeakVH references that Chris objected to
with normal Value references.

llvm-svn: 91711
2009-12-18 20:14:40 +00:00
Bob Wilson a8e2997aa0 Fix another parallel make race condition.
llvm-svn: 91709
2009-12-18 20:12:14 +00:00
Victor Hernandez 0471abd58b Formalize MDNode's function-localness:
- an MDNode is designated as function-local when created, and continues to be even if its operands are modified not to refer to function-local IR
- function-localness is designated via lowest bit in SubclassData
- getLocalFunction() descends MDNode tree to see if it is consistently function-local

Add verification of MDNodes to checks that MDNodes are consistently function-local.
Update AsmWriter to use isFunctionLocal().

llvm-svn: 91708
2009-12-18 20:09:14 +00:00
Daniel Dunbar cf7744e44d Fix Win32 Path.inc for API update.
llvm-svn: 91706
2009-12-18 19:59:48 +00:00
Dan Gohman 51f13056bd Revert this use of NUW/NSW also. Overflow-undefined multiplication isn't
associative either.

llvm-svn: 91701
2009-12-18 18:45:31 +00:00
Rafael Espindola b73b4fd30e Fix libstdc++ build on ARM linux and part of PR5770.
MI was not being used but it was also not being deleted, so it was kept in the garbage list. The memory itself was freed once the function code gen was done.

Once in a while the codegen of another function would create an instruction on the same address. Adding it to the garbage group would work once, but when another pointer was added it would cause an assert as "Cache" was about to be pushed to Ts.

For a patch that make us detect problems like this earlier, take a look at

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091214/092758.html

With that patch we assert as soon and the new instruction is added to the garbage set.

llvm-svn: 91691
2009-12-18 16:59:39 +00:00
Tilmann Scheller 5b2df8dcb5 Fix wrong frame pointer save offset in the 64-bit PowerPC SVR4 ABI.
Patch contributed by Ken Werner of IBM!

llvm-svn: 91681
2009-12-18 13:00:34 +00:00
Tilmann Scheller 79fef9349c Add support for calls through function pointers in the 64-bit PowerPC SVR4 ABI.
Patch contributed by Ken Werner of IBM!

llvm-svn: 91680
2009-12-18 13:00:15 +00:00
Mikhail Glushenkov d7015906d0 Make 'set_option' work with list options.
This works now: (set_option "list_opt", ["val_1", "val_2", "val_3"])

llvm-svn: 91679
2009-12-18 11:27:26 +00:00
Eli Friedman 86b9d75dc8 Optimize icmp of null and select of two constants even if the select has
multiple uses.  (The construct in question was found in gcc.)

llvm-svn: 91675
2009-12-18 08:22:35 +00:00
Evan Cheng 4cf30b72bf On recent Intel u-arch's, folding loads into some unary SSE instructions can
be non-optimal. To be precise, we should avoid folding loads if the instructions
only update part of the destination register, and the non-updated part is not
needed. e.g. cvtss2sd, sqrtss. Unfolding the load from these instructions breaks
the partial register dependency and it can improve performance. e.g.

movss (%rdi), %xmm0
cvtss2sd %xmm0, %xmm0

instead of
cvtss2sd (%rdi), %xmm0

An alternative method to break dependency is to clear the register first. e.g.
xorps %xmm0, %xmm0
cvtss2sd (%rdi), %xmm0

llvm-svn: 91672
2009-12-18 07:40:29 +00:00
Dan Gohman 7a2dab8826 Revert this use of NSW; this one isn't actually safe. NSW addition
is not reassociative.

llvm-svn: 91667
2009-12-18 03:57:04 +00:00
Dan Gohman 57e808628c Eliminte unnecessary uses of <cstdio>.
llvm-svn: 91666
2009-12-18 03:25:51 +00:00
Dan Gohman 4e3b29e309 Add utility routines for NSW multiply.
llvm-svn: 91664
2009-12-18 03:10:26 +00:00
Dan Gohman 4ab4420d7a Add utility routines for creating integer negation operators with NSW set.
Integer negation only overflows with INT_MIN, but that's an important case.

llvm-svn: 91662
2009-12-18 02:58:50 +00:00
Dan Gohman 916fec41fb Delete an unused variable.
llvm-svn: 91659
2009-12-18 02:14:37 +00:00
Eric Christopher 4c155350f1 Fix typo.
llvm-svn: 91657
2009-12-18 02:12:53 +00:00
Dan Gohman b256ccfbe5 Preserve NSW information in more places.
llvm-svn: 91656
2009-12-18 02:09:29 +00:00
Evan Cheng 3dfd04e2b7 Re-apply 91623 now that I actually know what I was trying to do.
llvm-svn: 91655
2009-12-18 01:59:21 +00:00
Dan Gohman 18fa5686f6 Add Loop contains utility methods for testing whether a loop
contains another loop, or an instruction. The loop form is
substantially more efficient on large loops than the typical
code it replaces.

llvm-svn: 91654
2009-12-18 01:24:09 +00:00
Dan Gohman fd7231f1fe Minor code simplification.
llvm-svn: 91653
2009-12-18 01:20:44 +00:00
Dan Gohman cb0efecd33 Whitespace cleanups.
llvm-svn: 91651
2009-12-18 01:14:11 +00:00
Dan Gohman 51fbfb726f Tidy up this testcase and add test for tailcall optimization
with unreachable.

llvm-svn: 91650
2009-12-18 01:05:06 +00:00
Bob Wilson 3152b0471b Handle ARM inline asm "w" constraints with 64-bit ("d") registers.
The change in SelectionDAGBuilder is needed to allow using bitcasts to convert
between f64 (the default type for ARM "d" registers) and 64-bit Neon vector
types.  Radar 7457110.

llvm-svn: 91649
2009-12-18 01:03:29 +00:00
Dan Gohman 7f4326f8b6 Remove "tail" keywords. These calls are not intended to be tail calls.
This protects this test from depending on codegen not performing the
tail call optimization by default.

llvm-svn: 91648
2009-12-18 01:02:18 +00:00
Dan Gohman b1924e8a0f Don't pass const pointers by reference.
llvm-svn: 91647
2009-12-18 00:38:08 +00:00
Dan Gohman 1af1954852 Update a comment.
llvm-svn: 91645
2009-12-18 00:28:43 +00:00
John McCall eabfd8b155 Pass the error string directly to llvm_unreachable instead of the residual
(0 && "error").  Rough consensus seems to be that g++ *should* be diagnosing
this because the pointer makes it not an ICE in c++03.  Everyone agrees that
the current standard is silly and null-pointer-ness should not be based on
ICE-ness.  Excellent fight scene in Act II, denouement weak, two stars.

llvm-svn: 91644
2009-12-18 00:27:18 +00:00
Jakob Stoklund Olesen 78c5919b14 Add test case for the phi reuse patch.
llvm-svn: 91642
2009-12-18 00:11:44 +00:00
Dan Gohman 92c3696524 Reapply LoopStrengthReduce and IVUsers cleanups, excluding the part
of 91296 that caused trouble -- the Processed list needs to be
preserved for the livetime of the pass, as AddUsersIfInteresting
is called from other passes.

llvm-svn: 91641
2009-12-18 00:06:20 +00:00
Sean Callanan 04d8cb74f3 Instruction fixes, added instructions, and AsmString changes in the
X86 instruction tables.

Also (while I was at it) cleaned up the X86 tables, removing tabs and
80-line violations.

This patch was reviewed by Chris Lattner, but please let me know if
there are any problems.

* X86*.td
	Removed tabs and fixed 80-line violations

* X86Instr64bit.td
	(IRET, POPCNT, BT_, LSL, SWPGS, PUSH_S, POP_S, L_S, SMSW)
		Added
	(CALL, CMOV) Added qualifiers
	(JMP) Added PC-relative jump instruction
	(POPFQ/PUSHFQ) Added qualifiers; renamed PUSHFQ to indicate
		that it is 64-bit only (ambiguous since it has no
		REX prefix)
	(MOV) Added rr form going the other way, which is encoded
		differently
	(MOV) Changed immediates to offsets, which is more correct;
		also fixed MOV64o64a to have to a 64-bit offset
	(MOV) Fixed qualifiers
	(MOV) Added debug-register and condition-register moves
	(MOVZX) Added more forms
	(ADC, SUB, SBB, AND, OR, XOR) Added reverse forms, which
		(as with MOV) are encoded differently
	(ROL) Made REX.W required
	(BT) Uncommented mr form for disassembly only
	(CVT__2__) Added several missing non-intrinsic forms
	(LXADD, XCHG) Reordered operands to make more sense for
		MRMSrcMem
	(XCHG) Added register-to-register forms
	(XADD, CMPXCHG, XCHG) Added non-locked forms
* X86InstrSSE.td
	(CVTSS2SI, COMISS, CVTTPS2DQ, CVTPS2PD, CVTPD2PS, MOVQ)
		Added
* X86InstrFPStack.td
	(COM_FST0, COMP_FST0, COM_FI, COM_FIP, FFREE, FNCLEX, FNOP,
	 FXAM, FLDL2T, FLDL2E, FLDPI, FLDLG2, FLDLN2, F2XM1, FYL2X,
	 FPTAN, FPATAN, FXTRACT, FPREM1, FDECSTP, FINCSTP, FPREM,
	 FYL2XP1, FSINCOS, FRNDINT, FSCALE, FCOMPP, FXSAVE,
	 FXRSTOR)
		Added
	(FCOM, FCOMP) Added qualifiers
	(FSTENV, FSAVE, FSTSW) Fixed opcode names
	(FNSTSW) Added implicit register operand
* X86InstrInfo.td
	(opaque512mem) Added for FXSAVE/FXRSTOR
	(offset8, offset16, offset32, offset64) Added for MOV
	(NOOPW, IRET, POPCNT, IN, BTC, BTR, BTS, LSL, INVLPG, STR,
	 LTR, PUSHFS, PUSHGS, POPFS, POPGS, LDS, LSS, LES, LFS,
	 LGS, VERR, VERW, SGDT, SIDT, SLDT, LGDT, LIDT, LLDT,
	 LODSD, OUTSB, OUTSW, OUTSD, HLT, RSM, FNINIT, CLC, STC,
	 CLI, STI, CLD, STD, CMC, CLTS, XLAT, WRMSR, RDMSR, RDPMC,
	 SMSW, LMSW, CPUID, INVD, WBINVD, INVEPT, INVVPID, VMCALL,
	 VMCLEAR, VMLAUNCH, VMRESUME, VMPTRLD, VMPTRST, VMREAD,
	 VMWRITE, VMXOFF, VMXON) Added
	(NOOPL, POPF, POPFD, PUSHF, PUSHFD) Added qualifier
	(JO, JNO, JB, JAE, JE, JNE, JBE, JA, JS, JNS, JP, JNP, JL,
	 JGE, JLE, JG, JCXZ) Added 32-bit forms
	(MOV) Changed some immediate forms to offset forms
	(MOV) Added reversed reg-reg forms, which are encoded
		differently
	(MOV) Added debug-register and condition-register moves
	(CMOV) Added qualifiers
	(AND, OR, XOR, ADC, SUB, SBB) Added reverse forms, like MOV
	(BT) Uncommented memory-register forms for disassembler
	(MOVSX, MOVZX) Added forms
	(XCHG, LXADD) Made operand order make sense for MRMSrcMem
	(XCHG) Added register-register forms
	(XADD, CMPXCHG) Added unlocked forms
* X86InstrMMX.td
	(MMX_MOVD, MMV_MOVQ) Added forms
* X86InstrInfo.cpp: Changed PUSHFQ to PUSHFQ64 to reflect table
	change

* X86RegisterInfo.td: Added debug and condition register sets
* x86-64-pic-3.ll: Fixed testcase to reflect call qualifier
* peep-test-3.ll: Fixed testcase to reflect test qualifier
* cmov.ll: Fixed testcase to reflect cmov qualifier
* loop-blocks.ll: Fixed testcase to reflect call qualifier
* x86-64-pic-11.ll: Fixed testcase to reflect call qualifier
* 2009-11-04-SubregCoalescingBug.ll: Fixed testcase to reflect call
  qualifier
* x86-64-pic-2.ll: Fixed testcase to reflect call qualifier
* live-out-reg-info.ll: Fixed testcase to reflect test qualifier
* tail-opts.ll: Fixed testcase to reflect call qualifiers
* x86-64-pic-10.ll: Fixed testcase to reflect call qualifier
* bss-pagealigned.ll: Fixed testcase to reflect call qualifier
* x86-64-pic-1.ll: Fixed testcase to reflect call qualifier
* widen_load-1.ll: Fixed testcase to reflect call qualifier

llvm-svn: 91638
2009-12-18 00:01:26 +00:00
John McCall 753100cef3 Sundry dependent-name fixes flagged by clang++.
llvm-svn: 91636
2009-12-17 23:49:16 +00:00
Bill Wendling 3c13667d14 Revert accidental commit.
llvm-svn: 91635
2009-12-17 23:45:18 +00:00
Bill Wendling 819c356a09 Turn off critical edge splitting for landing pads. The introduction of a
non-landing pad basic block as the successor to a block that ends in an
unconditional jump will cause block folding to remove the added block as a
successor. Thus eventually removing it AND the landing pad entirely. Critical
edge splitting is an optimization, so we can safely turn it off when dealing
with landing pads.

llvm-svn: 91634
2009-12-17 23:42:32 +00:00
Jeffrey Yasskin 0de0ce11d8 Revert r91623 to unbreak the buildbots.
llvm-svn: 91632
2009-12-17 22:44:34 +00:00
Eli Friedman 250b119d98 Allow instcombine to combine "sext(a) >u const" to "a >u trunc(const)".
llvm-svn: 91631
2009-12-17 22:42:29 +00:00
Jeffrey Yasskin 2b73a4e90f Don't codegen available_externally functions. Fixes http://llvm.org/PR5735.
llvm-svn: 91626
2009-12-17 21:35:29 +00:00
Eli Friedman 7cc86b4cc6 Make the ptrtoint comparison simplification work if one side is a global.
llvm-svn: 91624
2009-12-17 21:27:47 +00:00
Evan Cheng e43b403c87 Remove an unused option.
llvm-svn: 91623
2009-12-17 21:23:58 +00:00
Chris Lattner cbc0804c71 tabs -> spaces.
llvm-svn: 91622
2009-12-17 21:23:46 +00:00
Eli Friedman 5842c9968a Slightly generalize transformation of memmove(a,a,n) so that it also applies
to memcpy. (Such a memcpy is technically illegal, but in practice is safe
and is generated by struct self-assignment in C code.)

llvm-svn: 91621
2009-12-17 21:07:31 +00:00
Jeffrey Yasskin 5908f1e27b Make Path use StringRef instead of std::string where possible.
llvm-svn: 91620
2009-12-17 21:02:39 +00:00
Bill Wendling 03b5aed7d8 Temporarily revert 91337. It's causing testcase failures.
$ svn merge -c -91337 https://llvm.org/svn/llvm-project/llvm/trunk
--- Reverse-merging r91337 into '.':
U    lib/CodeGen/AsmPrinter/DwarfException.cpp

llvm-svn: 91618
2009-12-17 20:41:01 +00:00
Steve Naroff d3ab107432 Fix Windows build breakage...
llvm-svn: 91617
2009-12-17 20:39:34 +00:00
Ken Dyck df5561db78 Introduce EVT::getHalfSizedIntegerVT() for use in ExpandUnalignedStore() in
LegalizeDAG.cpp. Unlike the code it replaces, which simply decrements the simple
type by one, getHalfSizedIntegerVT() searches for the smallest simple integer
type that is at least half the size of the type it is called on. This approach
has the advantage that it will continue working if a new value type (such as
i24) is added to MVT.

Also, in preparation for new value types, remove the assertions that
non-power-of-2 8-bit-mutiple types are Extended when legalizing extload and
truncstore operations.

llvm-svn: 91614
2009-12-17 20:09:43 +00:00
Chris Lattner 50272752fa finish cleaning up StructLayoutMap.
llvm-svn: 91612
2009-12-17 20:00:21 +00:00
Jeffrey Yasskin 28f244863e This fixes a memory leak in OpaqueType found by Google's internal heapchecker.
llvm-svn: 91611
2009-12-17 19:55:06 +00:00
Eric Christopher 2d1ffe028f Fix unused variable warning.
llvm-svn: 91609
2009-12-17 19:07:19 +00:00