Benjamin Kramer
fff2517edc
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.
llvm-svn: 123547
2011-01-15 20:30:30 +00:00
Michael J. Spencer
b587180fa7
Unittests/Support/Path: Tweak test.
...
llvm-svn: 123546
2011-01-15 18:52:49 +00:00
Michael J. Spencer
7887466adc
Support/PathV2: Implement has_magic in terms of get_magic.
...
llvm-svn: 123545
2011-01-15 18:52:41 +00:00
Michael J. Spencer
ee1699c362
Support/PathV2: Implement get_magic.
...
llvm-svn: 123544
2011-01-15 18:52:33 +00:00
Nick Lewycky
4a1ff16b29
Add missing whitespace.
...
llvm-svn: 123543
2011-01-15 18:42:52 +00:00
Ken Dyck
cc56c54889
Add toCharUnitsInBits() to simplify the many calls to CharUnits::fromQuantity() of the form CharUnits::fromQuantity(bitSize, Context.getCharWidth()).
...
llvm-svn: 123542
2011-01-15 18:38:59 +00:00
Nick Lewycky
0296a481f9
Make constmerge a two-pass algorithm so that it won't miss merging
...
opporuntities. Fixes PR8978.
llvm-svn: 123541
2011-01-15 18:14:21 +00:00
Oscar Fuentes
25ac830e72
Make config.h.cmake similar to config.h.in
...
Patch by arrowdodger!
llvm-svn: 123539
2011-01-15 13:35:37 +00:00
Francois Pichet
07a2e14f44
Unbreak the MSVC build again: replace bzero by memset.
...
llvm-svn: 123538
2011-01-15 13:27:47 +00:00
Benjamin Kramer
ed5f2e504e
Try to unbreak selfhost.
...
llvm-svn: 123537
2011-01-15 11:25:34 +00:00
Nick Lewycky
540f9536c8
Add a cache that protects mergefunc's internals from more surprises in DenseSet.
...
Also, replace tabs with spaces. Yes, it's 2011.
llvm-svn: 123535
2011-01-15 10:16:23 +00:00
Nick Lewycky
367f98f000
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.
llvm-svn: 123533
2011-01-15 09:16:12 +00:00
Rafael Espindola
facb7d0ade
Also set unnamed_addr on declarations.
...
llvm-svn: 123531
2011-01-15 08:23:14 +00:00
Rafael Espindola
f1ed781aea
Add a clarification about merging constants with and without unnamed_addr.
...
llvm-svn: 123530
2011-01-15 08:20:57 +00:00
Rafael Espindola
489e505adf
Allow unnamed_addr on declarations.
...
llvm-svn: 123529
2011-01-15 08:15:00 +00:00
Chris Lattner
af26390790
temporarily revert r123526. While working on a follow-on patch I
...
realize that ConstantFoldTerminator doesn't preserve dominfo.
llvm-svn: 123527
2011-01-15 07:51:19 +00:00
Chris Lattner
8df83c4a24
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.
llvm-svn: 123526
2011-01-15 07:36:13 +00:00
Chris Lattner
ee588defc6
simplify code, no functionality change.
...
llvm-svn: 123525
2011-01-15 07:29:01 +00:00
Chris Lattner
1b93be501d
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.
llvm-svn: 123524
2011-01-15 07:25:29 +00:00
Chris Lattner
7a2771440f
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.
llvm-svn: 123523
2011-01-15 07:14:54 +00:00
Chris Lattner
008c0a4a68
clean up some dead code around __has_include() processing code identified by the ted-o-matic.
...
rdar://8867482
llvm-svn: 123522
2011-01-15 06:57:04 +00:00
Douglas Gregor
5590be0491
Introduce a new kind of TemplateName that captures a substituted
...
template template parameter pack that cannot be fully expanded because
its enclosing pack expansion could not be expanded. This form of
TemplateName plays the same role as SubstTemplateTypeParmPackType and
SubstNonTypeTemplateParmPackExpr do for template type parameter packs
and non-type template parameter packs, respectively.
We should now handle these multi-level pack expansion substitutions
anywhere. The largest remaining gap in our variadic-templates support
is that we cannot cope with non-type template parameter packs whose
type is a pack expansion.
llvm-svn: 123521
2011-01-15 06:45:20 +00:00
Chris Lattner
9c10d587f6
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 :-)
llvm-svn: 123520
2011-01-15 06:32:33 +00:00
Chris Lattner
c23ca1f217
fix typo
...
llvm-svn: 123519
2011-01-15 06:27:35 +00:00
Chris Lattner
76580f0ec3
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.
llvm-svn: 123518
2011-01-15 05:52:27 +00:00
Chris Lattner
e20dd530d0
one more instcombine variant that is needed to work with future changes,
...
no functionality change currently.
llvm-svn: 123517
2011-01-15 05:50:18 +00:00
Chris Lattner
497459d5fd
fix typo
...
llvm-svn: 123516
2011-01-15 05:42:47 +00:00
Chris Lattner
f3c4eefff8
Catch ~x < cst just like ~x < ~y, we currently handle this through
...
means that are about to disappear.
llvm-svn: 123515
2011-01-15 05:41:33 +00:00
Chris Lattner
311aa63c87
reduce indentation
...
llvm-svn: 123514
2011-01-15 05:40:29 +00:00
Greg Clayton
45eacff2ad
lldb-41 and debugserver-126 are set in the Xcode projects.
...
llvm-svn: 123513
2011-01-15 03:06:23 +00:00
Ted Kremenek
b749a6d62a
Add initial prototype for implementation of
...
-Wuninitialized based on CFG dataflow analysis. WIP.
llvm-svn: 123512
2011-01-15 02:58:47 +00:00
Ted Kremenek
688b674087
Add const version if CFG::isBlkExpr().
...
llvm-svn: 123511
2011-01-15 02:58:42 +00:00
Argyrios Kyrtzidis
a88942ad9c
Store/retrieve -fshort-enums for PCH, fixes rdar://8854933.
...
llvm-svn: 123510
2011-01-15 02:56:16 +00:00
Greg Clayton
49462ea7e4
Added complete complex support for displaying and parsing complex types.
...
llvm-svn: 123509
2011-01-15 02:52:14 +00:00
Douglas Gregor
36c0c791a8
Tweak the storage mechanism for a set of overloaded template names in
...
the TemplateName class. Nothing actually changes, but I find this less
objectionable (and it will factor into an upcoming change).
llvm-svn: 123508
2011-01-15 01:39:24 +00:00
Greg Clayton
f83f32d3ef
Enabled ObjC 2 abilities for expressions. We will enable the fragile ivar
...
stuff soon when we get a fix for looking up the "OBJC_IVAR_$_Class.ivar"
style symbols into IRForTarget::ResolveExternals() next week.
llvm-svn: 123507
2011-01-15 01:32:14 +00:00
Douglas Gregor
cdbc539aee
Introduce a new expression kind, SubstNonTypeTemplateParmPackExpr,
...
that captures the substitution of a non-type template argument pack
for a non-type template parameter pack within a pack expansion that
cannot be fully expanded. This follows the approach taken by
SubstTemplateTypeParmPackType.
llvm-svn: 123506
2011-01-15 01:15:58 +00:00
Eric Christopher
cc385c0c97
80-col.
...
llvm-svn: 123505
2011-01-15 00:25:09 +00:00
Stephen Wilson
fda49a0540
Add empty implementation of pure virtual RegisterContext::InvalidateAllRegisters.
...
This patch simply allows the tree to build. A proper implementation still needs
to be provided.
llvm-svn: 123504
2011-01-15 00:15:12 +00:00
Stephen Wilson
2f8e0f24dd
Set the ID of a ProcessLinux instance to the PID of the inferior on launch.
...
llvm-svn: 123503
2011-01-15 00:13:27 +00:00
Stephen Wilson
57740ecedb
Miscellaneous cleanups in ProcessMonitor.
...
Propagate the environment if one is not provided. Also, do not allocate the
monitor threads launch arguments on the stack.
llvm-svn: 123502
2011-01-15 00:12:41 +00:00
Chris Lattner
b68ec5c339
Generalize LoadAndStorePromoter a bit and switch LICM
...
to use it.
llvm-svn: 123501
2011-01-15 00:12:35 +00:00
Stephen Wilson
f62308c9b0
Use the correct type for thread handle.
...
llvm-svn: 123500
2011-01-15 00:11:28 +00:00
Stephen Wilson
c4391cb11e
Implement ProcessLinux::GetImageInfoAddress().
...
llvm-svn: 123499
2011-01-15 00:10:37 +00:00
Stephen Wilson
7f3b57ca35
Test if an ELF object is executable by checking if an entry point is defined.
...
The previous check on header type ET_EXEC is not general enough. Position
independent executables have type ET_DYN.
llvm-svn: 123498
2011-01-15 00:09:50 +00:00
Bob Wilson
b7a3c42eae
Fix a comment.
...
llvm-svn: 123497
2011-01-15 00:09:18 +00:00
Stephen Wilson
2ab0a5858f
Implement GetEntryPoint, GetImageInfoAddress and GetArchitecture for ObjectFileELF.
...
llvm-svn: 123496
2011-01-15 00:08:44 +00:00
Stephen Wilson
5a75c91eeb
Have LinuxThread cache it's current StopInfo object.
...
llvm-svn: 123495
2011-01-15 00:07:36 +00:00
Eric Christopher
2af9551ebf
Fix 80-cols.
...
llvm-svn: 123494
2011-01-14 23:50:53 +00:00
Douglas Gregor
e1d60df0fc
Teach template template argument pack expansions to keep track of the
...
number of expansions, when we know it, and propagate that information
through Sema.
llvm-svn: 123493
2011-01-14 23:41:42 +00:00