Commit Graph

69356 Commits

Author SHA1 Message Date
Chris Lattner
9cd3da47f9 fix PR8981, a crash trying to form a conditional inc with a floating point compare.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123560 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 02:56:53 +00:00
Chris Lattner
b99fdee325 reapply my fix for PR8961 with a tweak to properly handle
multi-instruction sequences like calls.  Many thanks to Jakob for
finding a testcase.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123559 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 02:27:38 +00:00
Chris Lattner
d5f656f48b simplify this code, it is still broken but will follow up on llvm-commits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123558 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 02:05:10 +00:00
Michael J. Spencer
c850965ec0 Revert "Archive: Replace all internal uses of PathV1 with PathV2. The external API still uses PathV1."
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123557 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 01:43:22 +00:00
Chandler Carruth
cad33c624e Simplify a README.txt entry significantly to expose the core issue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123556 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 01:40:23 +00:00
Chris Lattner
02efda4b4e one of michael's recent patches broke this, temporarily disable
it so the bots go green


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123555 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 01:04:49 +00:00
Chris Lattner
0092b1142f remove the partial specialization pass. It is unmaintained and has bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123554 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 00:27:10 +00:00
Michael J. Spencer
a7a71a375c Archive: Fix spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123552 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 21:43:45 +00:00
Michael J. Spencer
770772e831 Archive: Replace all internal uses of PathV1 with PathV2. The external API still uses PathV1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123551 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 21:43:37 +00:00
Michael J. Spencer
36852d3681 Support/GraphWriter: Replace all internal uses of PathV1 with PathV2. The external API still uses PathV1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123550 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 21:43:25 +00:00
Benjamin Kramer
5df5a22d1a Add an assert so we don't silently miscompile ctpop for bit widths > 128.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123549 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 21:19:37 +00:00
Michael J. Spencer
28f0ed5c9d Support/PathV2: Add identify_magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123548 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 20:39:36 +00:00
Benjamin Kramer
b6516aeef1 Reimplement CTPOP legalization with the "best" algorithm from
http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel

In a silly microbenchmark on a 65 nm core2 this is 1.5x faster than the old
code in 32 bit mode and about 2x faster in 64 bit mode. It's also a lot shorter,
especially when counting 64 bit population on a 32 bit target.

I hope this is fast enough to replace Kernighan-style counting loops even when
the input is rather sparse.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123547 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 20:30:30 +00:00
Michael J. Spencer
248f9f2807 Unittests/Support/Path: Tweak test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123546 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 18:52:49 +00:00
Michael J. Spencer
b33594be3d Support/PathV2: Implement has_magic in terms of get_magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123545 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 18:52:41 +00:00
Michael J. Spencer
d6cdf1d3cb Support/PathV2: Implement get_magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123544 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 18:52:33 +00:00
Nick Lewycky
cd7f0a1a7f Add missing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123543 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 18:42:52 +00:00
Nick Lewycky
2820c25e84 Make constmerge a two-pass algorithm so that it won't miss merging
opporuntities. Fixes PR8978.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123541 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 18:14:21 +00:00
Oscar Fuentes
111fd9ce64 Make config.h.cmake similar to config.h.in
Patch by arrowdodger!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123539 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 13:35:37 +00:00
Benjamin Kramer
bfa3b90582 Try to unbreak selfhost.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123537 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 11:25:34 +00:00
Nick Lewycky
e8f8139429 Add a cache that protects mergefunc's internals from more surprises in DenseSet.
Also, replace tabs with spaces. Yes, it's 2011.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123535 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 10:16:23 +00:00
Nick Lewycky
786c7cd141 Teach LazyValueInfo that allocas aren't NULL. Over all of llvm-test, this saves
half a million non-local queries, each of which would otherwise have triggered a
linear scan over a basic block.

Also fix a fixme for memory intrinsics which dereference pointers. With this,
we prove that a pointer is non-null because it was dereferenced by an intrinsic
112 times in llvm-test.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123533 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 09:16:12 +00:00
Rafael Espindola
a5eaa861e4 Add a clarification about merging constants with and without unnamed_addr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123530 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 08:20:57 +00:00
Rafael Espindola
ba7c38c36a Allow unnamed_addr on declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123529 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 08:15:00 +00:00
Chris Lattner
6ccb5ef1b5 temporarily revert r123526. While working on a follow-on patch I
realize that ConstantFoldTerminator doesn't preserve dominfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123527 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 07:51:19 +00:00
Chris Lattner
eeba3f5695 fix rdar://8785296 - -fcatch-undefined-behavior generates inefficient code
The basic issue is that isel (very reasonably!) expects conditional branches
to be folded, so CGP leaving around a bunch dead computation feeding
conditional branches isn't such a good idea.  Just fold branches on constants
into unconditional branches.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123526 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 07:36:13 +00:00
Chris Lattner
1a8943a1f8 simplify code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123525 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 07:29:01 +00:00
Chris Lattner
94e8e0cfbe Now that instruction optzns can update the iterator as they go, we can
have objectsize folding recursively simplify away their result when it
folds.  It is important to catch this here, because otherwise we won't
eliminate the cross-block values at isel and other times.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123524 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 07:25:29 +00:00
Chris Lattner
7579609bfe make the current instruction iterator an ivar, allowing xforms that
potentially invalidate it (like inline asm lowering) to be sunk into
their proper place, cleaning up a ton of code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123523 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 07:14:54 +00:00
Chris Lattner
62fe406dc2 implement an instcombine xform that canonicalizes casts outside of and-with-constant operations.
This fixes rdar://8808586 which observed that we used to compile:


union xy {
        struct x { _Bool b[15]; } x;
        __attribute__((packed))
        struct y {
                __attribute__((packed)) unsigned long b0to7;
                __attribute__((packed)) unsigned int b8to11;
                __attribute__((packed)) unsigned short b12to13;
                __attribute__((packed)) unsigned char b14;
        } y;
};

struct x
foo(union xy *xy)
{
        return xy->x;
}

into:

_foo:                                   ## @foo
	movq	(%rdi), %rax
	movabsq	$1095216660480, %rcx    ## imm = 0xFF00000000
	andq	%rax, %rcx
	movabsq	$-72057594037927936, %rdx ## imm = 0xFF00000000000000
	andq	%rax, %rdx
	movzbl	%al, %esi
	orq	%rdx, %rsi
	movq	%rax, %rdx
	andq	$65280, %rdx            ## imm = 0xFF00
	orq	%rsi, %rdx
	movq	%rax, %rsi
	andq	$16711680, %rsi         ## imm = 0xFF0000
	orq	%rdx, %rsi
	movl	%eax, %edx
	andl	$-16777216, %edx        ## imm = 0xFFFFFFFFFF000000
	orq	%rsi, %rdx
	orq	%rcx, %rdx
	movabsq	$280375465082880, %rcx  ## imm = 0xFF0000000000
	movq	%rax, %rsi
	andq	%rcx, %rsi
	orq	%rdx, %rsi
	movabsq	$71776119061217280, %r8 ## imm = 0xFF000000000000
	andq	%r8, %rax
	orq	%rsi, %rax
	movzwl	12(%rdi), %edx
	movzbl	14(%rdi), %esi
	shlq	$16, %rsi
	orl	%edx, %esi
	movq	%rsi, %r9
	shlq	$32, %r9
	movl	8(%rdi), %edx
	orq	%r9, %rdx
	andq	%rdx, %rcx
	movzbl	%sil, %esi
	shlq	$32, %rsi
	orq	%rcx, %rsi
	movl	%edx, %ecx
	andl	$-16777216, %ecx        ## imm = 0xFFFFFFFFFF000000
	orq	%rsi, %rcx
	movq	%rdx, %rsi
	andq	$16711680, %rsi         ## imm = 0xFF0000
	orq	%rcx, %rsi
	movq	%rdx, %rcx
	andq	$65280, %rcx            ## imm = 0xFF00
	orq	%rsi, %rcx
	movzbl	%dl, %esi
	orq	%rcx, %rsi
	andq	%r8, %rdx
	orq	%rsi, %rdx
	ret

We now compile this into:

_foo:                                   ## @foo
## BB#0:                                ## %entry
	movzwl	12(%rdi), %eax
	movzbl	14(%rdi), %ecx
	shlq	$16, %rcx
	orl	%eax, %ecx
	shlq	$32, %rcx
	movl	8(%rdi), %edx
	orq	%rcx, %rdx
	movq	(%rdi), %rax
	ret

A small improvement :-)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123520 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 06:32:33 +00:00
Chris Lattner
bdf466c27d fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123519 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 06:27:35 +00:00
Chris Lattner
4de2c76542 Fix m_Not and m_Neg to not match random ConstantInt's. Before
these would try hard to match constants by inverting the bits
and recursively matching.  There are two problems with this:
1) some patterns would match when we didn't want them to (theoretical)
2) this is insanely expensive to do, and most often pointless.

This was apparently useful in just 2 instcombine cases, which I
added code to handle explicitly.  This change speeds up 'opt'
time on 176.gcc by 1% and produces bitwise identical code.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123518 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 05:52:27 +00:00
Chris Lattner
67920320b2 one more instcombine variant that is needed to work with future changes,
no functionality change currently.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123517 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 05:50:18 +00:00
Chris Lattner
27a98482bd fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123516 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 05:42:47 +00:00
Chris Lattner
fdb5b01df4 Catch ~x < cst just like ~x < ~y, we currently handle this through
means that are about to disappear.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123515 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 05:41:33 +00:00
Chris Lattner
28621cb36f reduce indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123514 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 05:40:29 +00:00
Eric Christopher
a0f720f500 80-col.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123505 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 00:25:09 +00:00
Chris Lattner
deaf55f698 Generalize LoadAndStorePromoter a bit and switch LICM
to use it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123501 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 00:12:35 +00:00
Bob Wilson
ca3f06963c Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123497 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 00:09:18 +00:00
Eric Christopher
41262da6cc Fix 80-cols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123494 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 23:50:53 +00:00
Ted Kremenek
439ea279a5 Update CMake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123491 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 22:58:11 +00:00
Bob Wilson
dc1a2bd3aa Fix some tablegen issues to allow using zero_reg for InstAlias definitions.
This is needed to allow an InstAlias for an instruction with an "OptionalDef"
result register (like ARM's cc_out) where you want to set the optional register
to reg0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123490 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 22:58:09 +00:00
Ted Kremenek
7cefd0e9d5 Fix memory leak found by clang static analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123487 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 22:34:17 +00:00
Ted Kremenek
d7f696edec 'HiReg' is written but never read. Nuke its
declaration and its assignments.

Found by clang static analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123486 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 22:34:13 +00:00
Owen Anderson
e95a32ce40 Fix a false-positive warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123480 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 22:31:13 +00:00
Dan Gohman
ca5f616769 Delete an assignment to ThisBB which isn't needed, and tidy up some
comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123479 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 22:26:16 +00:00
Owen Anderson
cff6b3772b Enhance GlobalOpt to be able evaluate initializers that involve stores through
bitcasts, at least in simple cases.  This fixes clang's CodeGenCXX/virtual-base-dtor.cpp


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123477 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 22:19:20 +00:00
Anton Korobeynikov
3965b5e974 Add a possibility to switch between CFI directives- and table-based frame description emission. Currently all the backends use table-based stuff.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123476 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 21:58:08 +00:00
Anton Korobeynikov
e749911372 Cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123475 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 21:57:58 +00:00
Anton Korobeynikov
9a1ef4ef36 Add CFI directives-based frame information emission. Not hooked yet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123474 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 21:57:53 +00:00