Chris Lattner [Sun, 16 Jan 2011 05:58:24 +0000 (05:58 +0000)]
Use an irbuilder to get some trivial constant folding when doing a store
of a constant.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123570
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2011 05:37:55 +0000 (05:37 +0000)]
remove a dead check, this was needed before we had an explicit veto on uses of phis.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123569
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2011 05:28:59 +0000 (05:28 +0000)]
enhance FoldOpIntoPhi in instcombine to try harder when a phi has
multiple uses. In some cases, all the uses are the same operation,
so instcombine can go ahead and promote the phi. In the testcase
this pushes an add out of the loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123568
91177308-0d34-0410-b5e6-
96231b3b80d8
Evan Cheng [Sun, 16 Jan 2011 05:14:33 +0000 (05:14 +0000)]
Spill R4 if it's going to be used to restore SP from FP.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123567
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2011 05:14:26 +0000 (05:14 +0000)]
remove the AllowAggressive argument to FoldOpIntoPhi. It is forced to false in the
first line of the function because it isn't a good idea, even for compares.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123566
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2011 05:08:00 +0000 (05:08 +0000)]
more cleanups: use the IR builder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123565
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2011 04:37:29 +0000 (04:37 +0000)]
tidy up code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123564
91177308-0d34-0410-b5e6-
96231b3b80d8
Owen Anderson [Sun, 16 Jan 2011 04:33:33 +0000 (04:33 +0000)]
Improve the safety of my globalopt enhancement by ensuring that the bitcast
of the stored value to the new store type is always. Also, add a testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123563
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2011 03:43:53 +0000 (03:43 +0000)]
fix PR8983, a broken assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123562
91177308-0d34-0410-b5e6-
96231b3b80d8
Venkatraman Govindaraju [Sun, 16 Jan 2011 03:15:11 +0000 (03:15 +0000)]
Implement AnalyzeBranch in Sparc Backend.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123561
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sun, 16 Jan 2011 02:56:53 +0000 (02:56 +0000)]
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
Chris Lattner [Sun, 16 Jan 2011 02:27:38 +0000 (02:27 +0000)]
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
Chris Lattner [Sun, 16 Jan 2011 02:05:10 +0000 (02:05 +0000)]
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
Michael J. Spencer [Sun, 16 Jan 2011 01:43:22 +0000 (01:43 +0000)]
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
Chandler Carruth [Sun, 16 Jan 2011 01:40:23 +0000 (01:40 +0000)]
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
Chris Lattner [Sun, 16 Jan 2011 01:04:49 +0000 (01:04 +0000)]
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
Chris Lattner [Sun, 16 Jan 2011 00:27:10 +0000 (00:27 +0000)]
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
Michael J. Spencer [Sat, 15 Jan 2011 21:43:45 +0000 (21:43 +0000)]
Archive: Fix spelling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123552
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael J. Spencer [Sat, 15 Jan 2011 21:43:37 +0000 (21:43 +0000)]
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
Michael J. Spencer [Sat, 15 Jan 2011 21:43:25 +0000 (21:43 +0000)]
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
Benjamin Kramer [Sat, 15 Jan 2011 21:19:37 +0000 (21:19 +0000)]
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
Michael J. Spencer [Sat, 15 Jan 2011 20:39:36 +0000 (20:39 +0000)]
Support/PathV2: Add identify_magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123548
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Sat, 15 Jan 2011 20:30:30 +0000 (20:30 +0000)]
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
Michael J. Spencer [Sat, 15 Jan 2011 18:52:49 +0000 (18:52 +0000)]
Unittests/Support/Path: Tweak test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123546
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael J. Spencer [Sat, 15 Jan 2011 18:52:41 +0000 (18:52 +0000)]
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
Michael J. Spencer [Sat, 15 Jan 2011 18:52:33 +0000 (18:52 +0000)]
Support/PathV2: Implement get_magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123544
91177308-0d34-0410-b5e6-
96231b3b80d8
Nick Lewycky [Sat, 15 Jan 2011 18:42:52 +0000 (18:42 +0000)]
Add missing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123543
91177308-0d34-0410-b5e6-
96231b3b80d8
Nick Lewycky [Sat, 15 Jan 2011 18:14:21 +0000 (18:14 +0000)]
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
Oscar Fuentes [Sat, 15 Jan 2011 13:35:37 +0000 (13:35 +0000)]
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
Benjamin Kramer [Sat, 15 Jan 2011 11:25:34 +0000 (11:25 +0000)]
Try to unbreak selfhost.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123537
91177308-0d34-0410-b5e6-
96231b3b80d8
Nick Lewycky [Sat, 15 Jan 2011 10:16:23 +0000 (10:16 +0000)]
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
Nick Lewycky [Sat, 15 Jan 2011 09:16:12 +0000 (09:16 +0000)]
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
Rafael Espindola [Sat, 15 Jan 2011 08:20:57 +0000 (08:20 +0000)]
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
Rafael Espindola [Sat, 15 Jan 2011 08:15:00 +0000 (08:15 +0000)]
Allow unnamed_addr on declarations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123529
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sat, 15 Jan 2011 07:51:19 +0000 (07:51 +0000)]
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
Chris Lattner [Sat, 15 Jan 2011 07:36:13 +0000 (07:36 +0000)]
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
Chris Lattner [Sat, 15 Jan 2011 07:29:01 +0000 (07:29 +0000)]
simplify code, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123525
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sat, 15 Jan 2011 07:25:29 +0000 (07:25 +0000)]
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
Chris Lattner [Sat, 15 Jan 2011 07:14:54 +0000 (07:14 +0000)]
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
Chris Lattner [Sat, 15 Jan 2011 06:32:33 +0000 (06:32 +0000)]
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
Chris Lattner [Sat, 15 Jan 2011 06:27:35 +0000 (06:27 +0000)]
fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123519
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sat, 15 Jan 2011 05:52:27 +0000 (05:52 +0000)]
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
Chris Lattner [Sat, 15 Jan 2011 05:50:18 +0000 (05:50 +0000)]
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
Chris Lattner [Sat, 15 Jan 2011 05:42:47 +0000 (05:42 +0000)]
fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123516
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sat, 15 Jan 2011 05:41:33 +0000 (05:41 +0000)]
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
Chris Lattner [Sat, 15 Jan 2011 05:40:29 +0000 (05:40 +0000)]
reduce indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123514
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Sat, 15 Jan 2011 00:25:09 +0000 (00:25 +0000)]
80-col.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123505
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Sat, 15 Jan 2011 00:12:35 +0000 (00:12 +0000)]
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
Bob Wilson [Sat, 15 Jan 2011 00:09:18 +0000 (00:09 +0000)]
Fix a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123497
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Fri, 14 Jan 2011 23:50:53 +0000 (23:50 +0000)]
Fix 80-cols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123494
91177308-0d34-0410-b5e6-
96231b3b80d8
Ted Kremenek [Fri, 14 Jan 2011 22:58:11 +0000 (22:58 +0000)]
Update CMake build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123491
91177308-0d34-0410-b5e6-
96231b3b80d8
Bob Wilson [Fri, 14 Jan 2011 22:58:09 +0000 (22:58 +0000)]
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
Ted Kremenek [Fri, 14 Jan 2011 22:34:17 +0000 (22:34 +0000)]
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
Ted Kremenek [Fri, 14 Jan 2011 22:34:13 +0000 (22:34 +0000)]
'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
Owen Anderson [Fri, 14 Jan 2011 22:31:13 +0000 (22:31 +0000)]
Fix a false-positive warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123480
91177308-0d34-0410-b5e6-
96231b3b80d8
Dan Gohman [Fri, 14 Jan 2011 22:26:16 +0000 (22:26 +0000)]
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
Owen Anderson [Fri, 14 Jan 2011 22:19:20 +0000 (22:19 +0000)]
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
Anton Korobeynikov [Fri, 14 Jan 2011 21:58:08 +0000 (21:58 +0000)]
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
Anton Korobeynikov [Fri, 14 Jan 2011 21:57:58 +0000 (21:57 +0000)]
Cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123475
91177308-0d34-0410-b5e6-
96231b3b80d8
Anton Korobeynikov [Fri, 14 Jan 2011 21:57:53 +0000 (21:57 +0000)]
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
Anton Korobeynikov [Fri, 14 Jan 2011 21:57:45 +0000 (21:57 +0000)]
Split stuff as a preparation for CFI directives-based frame information emission
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123473
91177308-0d34-0410-b5e6-
96231b3b80d8
Anton Korobeynikov [Fri, 14 Jan 2011 21:57:39 +0000 (21:57 +0000)]
Use common style for .cfi directives
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123472
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Trick [Fri, 14 Jan 2011 21:11:41 +0000 (21:11 +0000)]
Support for precise scheduling of the instruction selection DAG,
disabled in this checkin. Sorry for the large diffs due to
refactoring. New functionality is all guarded by EnableSchedCycles.
Scheduling the isel DAG is inherently imprecise, but we give it a best
effort:
- Added MayReduceRegPressure to allow stalled nodes in the queue only
if there is a regpressure need.
- Added BUHasStall to allow checking for either dependence stalls due to
latency or resource stalls due to pipeline hazards.
- Added BUCompareLatency to encapsulate and standardize the heuristics
for minimizing stall cycles (vs. reducing register pressure).
- Modified the bottom-up heuristic (now in BUCompareLatency) to
prioritize nodes by their depth rather than height. As long as it
doesn't stall, height is irrelevant. Depth represents the critical
path to the DAG root.
- Added hybrid_ls_rr_sort::isReady to filter stalled nodes before
adding them to the available queue.
Related Cleanup: most of the register reduction routines do not need
to be templates.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123468
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 14 Jan 2011 19:50:47 +0000 (19:50 +0000)]
switch SRoA to use LoadAndStorePromoter instead of its own copy of the code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123457
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 14 Jan 2011 19:36:13 +0000 (19:36 +0000)]
Add a new LoadAndStorePromoter class, which implements the general
"promote a bunch of load and stores" logic, allowing the code to
be shared and reused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123456
91177308-0d34-0410-b5e6-
96231b3b80d8
Jay Foad [Fri, 14 Jan 2011 18:41:56 +0000 (18:41 +0000)]
OperandTraits<>::Layout isn't used for anything. Remove it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123452
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Fri, 14 Jan 2011 17:01:20 +0000 (17:01 +0000)]
Update llvm-gcc's tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123447
91177308-0d34-0410-b5e6-
96231b3b80d8
Oscar Fuentes [Fri, 14 Jan 2011 16:41:03 +0000 (16:41 +0000)]
Reorder macros on config.h.cmake to easily compare it against
config.h.in.
Patch by arrowdodger!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123445
91177308-0d34-0410-b5e6-
96231b3b80d8
Devang Patel [Fri, 14 Jan 2011 15:55:50 +0000 (15:55 +0000)]
Disable debug mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123443
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan Sands [Fri, 14 Jan 2011 15:26:10 +0000 (15:26 +0000)]
Turn X-(X-Y) into Y. According to my auto-simplifier this is the most common
simplification present in fully optimized code (I think instcombine fails to
transform some of these when "X-Y" has more than one use). Fires here and
there all over the test-suite, for example it eliminates 8 subtractions in
the final IR for 445.gobmk, 2 subs in 447.dealII, 2 in paq8p etc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123442
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan Sands [Fri, 14 Jan 2011 14:44:12 +0000 (14:44 +0000)]
Factorize common code out of the InstructionSimplify shift logic. Add in
threading of shifts over selects and phis while there. This fires here and
there in the testsuite, to not much effect. For example when compiling spirit
it fires 5 times, during early-cse, resulting in 6 more cse simplifications,
and 3 more terminators being folded by jump threading, but the final bitcode
doesn't change in any interesting way: other optimizations would have caught
the opportunity anyway, only later.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123441
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan Sands [Fri, 14 Jan 2011 14:16:33 +0000 (14:16 +0000)]
Rename this test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123440
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 14 Jan 2011 08:21:08 +0000 (08:21 +0000)]
switch the second scalarrepl pass to use SSAUpdater. We run two scalarrepl passes: one
early in the cleanup code and one late interlaced with the inliner. The second one is
important because inlining and other scalar optzns can unpin allocas, allowing them to
be split up and promoted. While important for performance, this is also relatively
rare, and we would previously force a (non-lazy) computation of DomFrontiers, which
happened even if nothing became unpinned.
With this patch, the first pass of scalarrepl still promotes the vast bulk of allocas
in programs, but hte second pass has changed to use SSAUpdater, which is more "sparse"
and lazy. This speeds up opt -O3 time on kimwitu++ (a c++ app) by about 1%. The
numbers are interesting: the first pass promotes ~17500 allocas. The second pass
promotes about 1600. For non-C++ codes, the compile time win should be greater,
because the second pass of scalarrepl does less.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123437
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 14 Jan 2011 08:13:00 +0000 (08:13 +0000)]
split SROA into two passes: one that uses DomFrontiers (-scalarrepl)
and one that uses SSAUpdater (-scalarrepl-ssa)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123436
91177308-0d34-0410-b5e6-
96231b3b80d8
Jay Foad [Fri, 14 Jan 2011 08:07:43 +0000 (08:07 +0000)]
Remove casts between Value** and Constant**, which won't work if a
static_cast from Constant* to Value* has to adjust the "this" pointer.
This is groundwork for PR889.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123435
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 14 Jan 2011 07:50:47 +0000 (07:50 +0000)]
Implement full support for promoting allocas to registers using SSAUpdater
instead of DomTree/DomFrontier. This may be interesting for reducing compile
time. This is currently disabled, but seems to work just fine.
When this is enabled, we eliminate two runs of dominator frontier, one in the
"early per-function" optimizations and one in the "interlaced with inliner"
function passes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123434
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 14 Jan 2011 07:46:33 +0000 (07:46 +0000)]
relax testcase a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123433
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Fri, 14 Jan 2011 06:33:45 +0000 (06:33 +0000)]
Try for the third time to teach getFirstTerminator() about debug values.
This time let's rephrase to trick gcc-4.3 into not miscompiling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123432
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 14 Jan 2011 06:14:33 +0000 (06:14 +0000)]
revert my fastisel patch again which apparently still gives the
llvm-gcc-i386-linux-selfhost buildbot heartburn...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123431
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 14 Jan 2011 04:24:28 +0000 (04:24 +0000)]
reapply r123414 now that the botz are calmed down and the fix is already in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123427
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 14 Jan 2011 04:23:53 +0000 (04:23 +0000)]
indentation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123426
91177308-0d34-0410-b5e6-
96231b3b80d8
Evan Cheng [Fri, 14 Jan 2011 02:38:49 +0000 (02:38 +0000)]
Completed :lower16: / :upper16: support for movw / movt pairs on Darwin.
- Fixed :upper16: fix up routine. It should be shifting down the top 16 bits first.
- Added support for Thumb2 :lower16: and :upper16: fix up.
- Added :upper16: and :lower16: relocation support to mach-o object writer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123424
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Fri, 14 Jan 2011 02:12:54 +0000 (02:12 +0000)]
Revert r123419. It still breaks llvm-gcc-i386-linux-selfhost.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123423
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 14 Jan 2011 02:07:32 +0000 (02:07 +0000)]
r123414 broke llvm-gcc bootstrap apparently, revert
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123422
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 14 Jan 2011 01:33:40 +0000 (01:33 +0000)]
Set the insertion point correctly for instructions generated by load folding:
they should go *before* the new instruction not after it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123420
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Fri, 14 Jan 2011 01:17:53 +0000 (01:17 +0000)]
Try again to teach getFirstTerminator() about debug values.
Fix some callers to better deal with debug values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123419
91177308-0d34-0410-b5e6-
96231b3b80d8
Owen Anderson [Fri, 14 Jan 2011 00:41:11 +0000 (00:41 +0000)]
Rather than doing early instcombine, try doing early CSE instead. This should still handle
most important simplifications, as well as resolving phase ordering issues where instcombine
would inhibit important CSE'ing opportunities, for instance on BitBench/drop3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123418
91177308-0d34-0410-b5e6-
96231b3b80d8
Duncan Sands [Fri, 14 Jan 2011 00:37:45 +0000 (00:37 +0000)]
Move some shift transforms out of instcombine and into InstructionSimplify.
While there, I noticed that the transform "undef >>a X -> undef" was wrong.
For example if X is 2 then the top two bits must be equal, so the result can
not be anything. I fixed this in the constant folder as well. Also, I made
the transform for "X << undef" stronger: it now folds to undef always, even
though X might be zero. This is in accordance with the LangRef, but I must
admit that it is fairly aggressive. Also, I added "i32 X << 32 -> undef"
following the LangRef and the constant folder, likewise fairly aggressive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123417
91177308-0d34-0410-b5e6-
96231b3b80d8
Owen Anderson [Fri, 14 Jan 2011 00:36:40 +0000 (00:36 +0000)]
Don't bother conditionalizing the use of SROA in -O1 mode. We're already running it unconditionally
later in the pipeline.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123416
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Fri, 14 Jan 2011 00:01:01 +0000 (00:01 +0000)]
fix PR8961 - a fast isel miscompilation where we'd insert a new instruction
after sext's generated for addressing that got folded. Previously we compiled
test5 into:
_test5: ## @test5
## BB#0:
movq -8(%rsp), %rax ## 8-byte Reload
movq (%rdi,%rax), %rdi
addq %rdx, %rdi
movslq %esi, %rax
movq %rax, -8(%rsp) ## 8-byte Spill
movq %rdi, %rax
ret
which is insane and wrong. Now we produce:
_test5: ## @test5
## BB#0:
movslq %esi, %rax
movq (%rdi,%rax), %rax
addq %rdx, %rax
ret
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123414
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Thu, 13 Jan 2011 23:35:53 +0000 (23:35 +0000)]
Better terminator avoidance.
This approach also works when the terminator doesn't have a slot index. (Which
can happen??)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123413
91177308-0d34-0410-b5e6-
96231b3b80d8
Evan Cheng [Thu, 13 Jan 2011 23:27:39 +0000 (23:27 +0000)]
Add comment about Thumb2 fixup comments being completely bogus.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123411
91177308-0d34-0410-b5e6-
96231b3b80d8
Tobias Grosser [Thu, 13 Jan 2011 23:18:04 +0000 (23:18 +0000)]
Add single entry / single exit accessors.
Add methods for accessing the (single) entry / exit edge of a region. If no such
edge exists, null is returned. Both accessors return the start block of the
corresponding edge. The edge can finally be formed by utilizing
Region::getEntry() or Region::getExit();
Contributed by: Andreas Simbuerger <simbuerg@fim.uni-passau.de>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123410
91177308-0d34-0410-b5e6-
96231b3b80d8
Owen Anderson [Thu, 13 Jan 2011 22:50:36 +0000 (22:50 +0000)]
Recognize alternative register names like ip -> r12.
Fixes <rdar://problem/
8857982>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123409
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakob Stoklund Olesen [Thu, 13 Jan 2011 22:47:43 +0000 (22:47 +0000)]
Fix a few more places that should use MBB::getLastNonDebugInstr().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123408
91177308-0d34-0410-b5e6-
96231b3b80d8
Owen Anderson [Thu, 13 Jan 2011 22:38:16 +0000 (22:38 +0000)]
As far as I can tell, unified syntax uses c0-c15 instead of cr0-cr15 for mcr and friends.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123407
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 13 Jan 2011 22:11:56 +0000 (22:11 +0000)]
typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123406
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Lattner [Thu, 13 Jan 2011 22:08:15 +0000 (22:08 +0000)]
memcpy + metadata = bliss :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123405
91177308-0d34-0410-b5e6-
96231b3b80d8
Owen Anderson [Thu, 13 Jan 2011 21:46:02 +0000 (21:46 +0000)]
Add support to the ARM MC infrastructure to support mcr and friends. This requires supporting
the symbolic immediate names used for these instructions, fixing their pretty-printers, and
adding proper encoding information for them.
With this, we can properly pretty-print and encode assembly like:
mrc p15, #0, r3, c13, c0, #3
Fixes <rdar://problem/
8857858>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123404
91177308-0d34-0410-b5e6-
96231b3b80d8
Evan Cheng [Thu, 13 Jan 2011 21:45:26 +0000 (21:45 +0000)]
Relax an assertion. On archs like ARM, an immediate field may be scattered. So it's possible for some bits of every 8 bits to be encoded already, and the rest still needs to be fixed up.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123403
91177308-0d34-0410-b5e6-
96231b3b80d8