Commit Graph

58036 Commits

Author SHA1 Message Date
Evan Cheng 654ec2a663 Fix an oops in x86 sibcall optimization. If the ByVal callee argument is itself passed as a pointer, then it's obviously not safe to do a tail call.
llvm-svn: 97797
2010-03-05 08:38:04 +00:00
Duncan Sands 798ca1e6fe If LD_LIBRARY_PATH is set in the system environment, use it.
llvm-svn: 97796
2010-03-05 08:21:02 +00:00
Chris Lattner 343d2e48b2 simplify some functions and make them work with vector
compares, noticed by inspection.

llvm-svn: 97795
2010-03-05 07:47:57 +00:00
Chris Lattner c6c1523f59 fix a nice subtle reassociate bug which would only occur
in a very specific use pattern embodied in the carefully
reduced testcase.

llvm-svn: 97794
2010-03-05 07:18:54 +00:00
Eric Christopher 4899cbc77d Move GetStringLength and helper from SimplifyLibCalls to ValueTracking.
No functionality change.

llvm-svn: 97793
2010-03-05 06:58:57 +00:00
Jeffrey Yasskin 5c92f933b3 Revert r97788 because it broke test/FrontendC/2010-02-16-DbgVarScope.c.
llvm-svn: 97792
2010-03-05 06:43:49 +00:00
Chris Lattner 55e81eb49f Fix PR6497, a bug where we'd fold a load into an addc
node which has a flag.  That flag in turn was used by an
already-selected adde which turned into an ADC32ri8 which
used a selected load which was chained to the load we
folded.  This flag use caused us to form a cycle.  Fix
this by not ignoring chains in IsLegalToFold even in
cases where the isel thinks it can.

llvm-svn: 97791
2010-03-05 06:19:13 +00:00
Chris Lattner bfdd17a2ea cleanup
llvm-svn: 97790
2010-03-05 06:17:43 +00:00
Chris Lattner 374a3ac744 inline a small function with one call site.
llvm-svn: 97789
2010-03-05 05:49:45 +00:00
Jeffrey Yasskin 39e0d52080 Free MDNodes when the LLVMContext is destroyed. Leak found by Valgrind.
llvm-svn: 97788
2010-03-05 05:47:09 +00:00
Mikhail Glushenkov a764083db3 Make it not an error to specify -O* options several times.
As in 'llvmc -O2 -O2 test.c'.

llvm-svn: 97787
2010-03-05 04:46:39 +00:00
Mikhail Glushenkov cb231bb618 Use FindExecutable as a fall-back search method.
Allows us to find executables that are in the same directory.

llvm-svn: 97786
2010-03-05 04:46:28 +00:00
Evan Cheng cf67ffa500 Rever 96389 and 96990. They are causing some miscompilation that I do not fully understand.
llvm-svn: 97782
2010-03-05 03:08:23 +00:00
Dan Gohman 998c7c2614 Revert r97778 and r97779. They're somehow breaking llvm-gcc builds.
llvm-svn: 97781
2010-03-05 02:40:23 +00:00
Chris Lattner 5ec1b24f8f apparently if gold is around lto needs to be part of DIRS.
llvm-svn: 97780
2010-03-05 02:34:34 +00:00
Dan Gohman ba9eb0bf2e Fix these constants to be more portable.
llvm-svn: 97779
2010-03-05 02:13:10 +00:00
Dan Gohman 7fbeeebaf6 Rewrite i64-to-f64 conversion using an algorithm which handles
rounding correctly. This implementation is a generalization of
the x86_64 code in compiler-rt.

This fixes rdar://7683708.

llvm-svn: 97778
2010-03-05 02:00:46 +00:00
Johnny Chen 70e01cd001 Trivial comment change.
llvm-svn: 97776
2010-03-05 01:45:46 +00:00
Evan Cheng 43d6ff7701 Add missing break for Intrinsic::objectsize case. It was falling through to the following Intrinsic::bswap code. I have no idea why it wasn't breaking stuff.
llvm-svn: 97774
2010-03-05 01:22:47 +00:00
Chris Lattner 6dbf5cc64c disable libprofile on cygwin, patch by Aaron Gray.
llvm-svn: 97772
2010-03-05 01:00:34 +00:00
Chris Lattner 2e89d20ad3 Only build libedis if ENABLE_SHARED is specified, just like liblto.
Don't build any of the dynamic library stuff on cygwin/mingw.

llvm-svn: 97771
2010-03-05 00:59:18 +00:00
Chris Lattner 274c8d8d07 liblto and gold don't need to be built in serial
llvm-svn: 97770
2010-03-05 00:54:45 +00:00
Chris Lattner 6783832ec2 add an assertion requested on llvmdev.
llvm-svn: 97769
2010-03-05 00:49:08 +00:00
Bill Wendling 543ce1f64a Revert r97766. It's deleting a tag.
llvm-svn: 97768
2010-03-05 00:33:59 +00:00
Bill Wendling 6517f88f25 Micro-optimization:
This code:

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

produces this:

_floatingPointComparison:
0000000000000000        cvtss2sd        %xmm1,%xmm1
0000000000000004        cvtss2sd        %xmm0,%xmm0
0000000000000008        mulsd           %xmm1,%xmm0
000000000000000c        pxor            %xmm1,%xmm1
0000000000000010        ucomisd         %xmm1,%xmm0
0000000000000014        jne             0x00000004
0000000000000016        jp              0x00000002
0000000000000018        jmp             0x00000008
000000000000001a        addsd           0x00000006(%rip),%xmm0
0000000000000022        cvtsd2ss        %xmm0,%xmm0
0000000000000026        ret

The "jne/jp/jmp" sequence can be reduced to this instead:

_floatingPointComparison:
0000000000000000        cvtss2sd        %xmm1,%xmm1
0000000000000004        cvtss2sd        %xmm0,%xmm0
0000000000000008        mulsd           %xmm1,%xmm0
000000000000000c        pxor            %xmm1,%xmm1
0000000000000010        ucomisd         %xmm1,%xmm0
0000000000000014        jp              0x00000002
0000000000000016        je              0x00000008
0000000000000018        addsd           0x00000006(%rip),%xmm0
0000000000000020        cvtsd2ss        %xmm0,%xmm0
0000000000000024        ret

for a savings of 2 bytes.

This xform can happen when we recognize that jne and jp jump to the same "true"
MBB, the unconditional jump would jump to the "false" MBB, and the "true" branch
is the fall-through MBB.

llvm-svn: 97766
2010-03-05 00:24:26 +00:00
Dale Johannesen 2061c84109 Fix some more places where dbg_value affected codegen.
llvm-svn: 97765
2010-03-05 00:02:59 +00:00
Devang Patel 9984bd6092 Add metadata example.
llvm-svn: 97764
2010-03-04 23:44:48 +00:00
Jeffrey Yasskin bd8a759589 Stop leaking MDStrings.
llvm-svn: 97763
2010-03-04 23:24:19 +00:00
Johnny Chen ece1797542 Drop the ".w" qualifier for t2UXTB16* instructions as there is no 16-bit version
of either sxtb16 or uxtb16, and the unified syntax does not specify ".w".

llvm-svn: 97760
2010-03-04 22:24:41 +00:00
Jeffrey Yasskin 735b0ae247 Fix memcheck-found leaks: one false positive from using new[], and one true
positive where pointers would be leaked on llvm_shutdown.

llvm-svn: 97759
2010-03-04 22:15:01 +00:00
Jim Grosbach 1201f29321 For SJLJ exception handling, make sure that all calls that are not marked
as nounwind are marked with a -1 call-site value. This is necessary to, for
example, correctly process exceptions thrown from within an "unexpected"
execption handler (see SingleSource/Regression/C++/EH/expection_spec_test.cpp).

llvm-svn: 97757
2010-03-04 22:07:46 +00:00
Bob Wilson 749ba9a7d5 pr6478: The frame pointer spill frame index is only defined when there is a
frame pointer.

llvm-svn: 97755
2010-03-04 21:42:36 +00:00
Evan Cheng a325e562ee Run machine licm before machine cse to avoid messing up licm opportunities.
llvm-svn: 97752
2010-03-04 21:28:09 +00:00
Evan Cheng 1abd1a9f4b Avoid cse load instructions unless they are known to be invariant loads.
llvm-svn: 97747
2010-03-04 21:18:08 +00:00
Bob Wilson cf6e29a818 pr6480: Don't try producing ld/st-multiple instructions when the address is
an undef value.  This is only going to come up for bugpoint-reduced tests --
correct programs will not access memory at undefined addresses -- so it's not
worth the effort of doing anything more aggressive.

llvm-svn: 97745
2010-03-04 21:04:38 +00:00
Erick Tryzelaar 444c0955af Rewrite makefiles to explicitly reference DESTDIR to fix bug 3153.
We need this so can not bake DESTDIR into the O'Caml symlinks.

llvm-svn: 97743
2010-03-04 20:56:19 +00:00
Jakob Stoklund Olesen af6ca23294 Fix the remaining MUL8 and DIV8 to define AX instead of AL,AH.
These instructions technically define AL,AH, but a trick in X86ISelDAGToDAG
reads AX in order to avoid reading AH with a REX instruction.

Fix PR6489.

llvm-svn: 97742
2010-03-04 20:42:07 +00:00
Dan Gohman b8ebd408da Fix recognition of 16-bit bswap for C front-ends which emit the
clobber registers in a different order.

llvm-svn: 97741
2010-03-04 19:58:08 +00:00
Chris Lattner 795667b424 not committing what you test = bad.
llvm-svn: 97740
2010-03-04 19:54:45 +00:00
Chris Lattner 6ce8e24b70 make gep matching in fastisel match the base of the gep as a
register if it isn't possible to match the indexes *and* the base.
This fixes some fast isel rejects of load instructions on oggenc.

llvm-svn: 97739
2010-03-04 19:48:19 +00:00
Chris Lattner c1cb75eb72 add a statistic for # times fastisel fails.
llvm-svn: 97738
2010-03-04 19:46:56 +00:00
Jeffrey Yasskin c3b7d1edfa Fix PR6360. It's easy for a stub's address to escape to user code, so we can't
just count references to it from JIT output to decide when to destroy it.  This
patch waits to destroy the JIT's memory of a stub until the Function it refers
to is destroyed.  External function stubs and GVIndirectSyms aren't destroyed
until the JIT itself is.

llvm-svn: 97737
2010-03-04 19:45:09 +00:00
Dan Gohman 9cc886b9f1 Fix a typo Duncan noticed.
llvm-svn: 97735
2010-03-04 19:11:28 +00:00
Johnny Chen 334db0ce7f Added 32-bit Thumb instructions for Preload Data (PLD, PLDW) and Preload
Instruction (PLI) for disassembly only.

According to A8.6.120 PLI (immediate, literal), for example, different
instructions are generated for "pli [pc, #0]" and "pli [pc, #-0"].  The
disassembler solves it by mapping -0 (negative zero) to -1, -1 to -2, ..., etc.

llvm-svn: 97731
2010-03-04 17:40:44 +00:00
John McCall 77ffdaf033 Simplify the condition-checking logic and hopefully clear up a build failure
that somehow got through my testing.

llvm-svn: 97728
2010-03-04 11:48:42 +00:00
John McCall d423572e86 Teach lit to honor conditional directives. The syntax is:
IF(condition(value)):
If the value satisfies the condition, the line is processed by lit;  otherwise
it is skipped.  A test with no unignored directives is resolved as Unsupported.

The test suite is responsible for defining conditions;  conditions are unary
functions over strings.  I've defined two conditions in the LLVM test suite,
TARGET (with values like those in TARGETS_TO_BUILD) and BINDING (with values
like those in llvm_bindings).  So for example you can write:
  IF(BINDING(ocaml)): RUN: %blah %s -o -
and the RUN line will only execute if LLVM was configured with the ocaml
bindings.

llvm-svn: 97726
2010-03-04 09:36:50 +00:00
Nick Lewycky 1a7ed5868b Make the 'icmp pred trunc(ext(X)), CST --> icmp pred X, ext(trunc(CST))'
transformation much more careful. Truncating binary '01' to '1' sounds like it's
safe until you realize that it switched from positive to negative under a signed
interpretation, and that depends on the icmp predicate.

Also a few miscellaneous cleanups.

llvm-svn: 97721
2010-03-04 06:54:10 +00:00
Jeffrey Yasskin 391aad6327 Fix PR5291, in which a SmallPtrSet iterator was held across an insertion into
the set.

llvm-svn: 97720
2010-03-04 06:50:01 +00:00
Evan Cheng c58aea0086 Rename -machine-cse to -enable-machine-cse.
llvm-svn: 97713
2010-03-04 02:08:04 +00:00
Chris Lattner 82cc53388e add a comment.
llvm-svn: 97709
2010-03-04 01:43:43 +00:00