platform/upstream/llvm.git
9 years agoStart adding some tests for the gold plugin.
Rafael Espindola [Sun, 27 Jul 2014 23:11:06 +0000 (23:11 +0000)]
Start adding some tests for the gold plugin.

These are only used when the 'ld' in the path is gold and the plugin has
been built, but it is already a start to make sure we don't regress features
that cannot be tested with llvm-lto.

llvm-svn: 214058

9 years agoARM: correct handling of features in arch_extension
Saleem Abdulrasool [Sun, 27 Jul 2014 19:07:09 +0000 (19:07 +0000)]
ARM: correct handling of features in arch_extension

The subtarget information is the ultimate source of truth for the feature set
that is enabled at this point.  We would previously not propagate the feature
information to the subtarget.  While this worked for the most part (features
would be enabled/disabled as requested), if another operation that changed the
feature bits was encountered (such as a mode switch via a .arm or .thumb
directive), we would end up resetting the behaviour of the architectural
extensions.

Handling this properly requires a slightly more complicated handling.  We need
to check if the feature is now being toggled.  If so, only then do we toggle the
features.  In return, we no longer have to calculate the feature bits ourselves.

The test changes are mostly to the diagnosis, which is now more uniform (a nice
side effect!).  Add an additional test to ensure that we handle this case
properly.

Thanks to Nico Weber for alerting me to this issue!

llvm-svn: 214057

9 years agoARM: convert loop to range based
Saleem Abdulrasool [Sun, 27 Jul 2014 19:07:05 +0000 (19:07 +0000)]
ARM: convert loop to range based

Convert a loop to use range based iteration.  Rename structure members to help
naming, and make structure definition anonymous.  NFC.

llvm-svn: 214056

9 years agoAdd alignment value to allowsUnalignedMemoryAccess
Matt Arsenault [Sun, 27 Jul 2014 17:46:40 +0000 (17:46 +0000)]
Add alignment value to allowsUnalignedMemoryAccess

Rename to allowsMisalignedMemoryAccess.

On R600, 8 and 16 byte accesses are mostly OK with 4-byte alignment,
and don't need to be split into multiple accesses. Vector loads with
an alignment of the element type are not uncommon in OpenCL code.

llvm-svn: 214055

9 years agoRemove unused empty folder `unittest`.
Simon Atanasyan [Sun, 27 Jul 2014 12:23:34 +0000 (12:23 +0000)]
Remove unused empty folder `unittest`.

llvm-svn: 214054

9 years agoAArch64: fix conversion of 'J' inline asm constraints.
Tim Northover [Sun, 27 Jul 2014 07:10:29 +0000 (07:10 +0000)]
AArch64: fix conversion of 'J' inline asm constraints.

'J' represents a negative number suitable for an add/sub alias
instruction, but while preparing it to become an int64_t we were
mangling the sign extension. So "i32 -1" became 0xffffffffLL, for
example.

Should fix one half of PR20456.

llvm-svn: 214052

9 years agoFix default argument comma disambiguation bug following the 'template' keyword.
Richard Smith [Sun, 27 Jul 2014 05:38:12 +0000 (05:38 +0000)]
Fix default argument comma disambiguation bug following the 'template' keyword.

llvm-svn: 214051

9 years agoWhen looking for temporary dtors while building the CFG, do not walk into
Richard Smith [Sun, 27 Jul 2014 05:12:49 +0000 (05:12 +0000)]
When looking for temporary dtors while building the CFG, do not walk into
lambda expressions (other than their capture initializers) nor blocks. Do walk
into default argument expressions and default initializer expressions.

These bugs were causing us to produce broken CFGs whenever a lambda expression
was used to initialize a libstdc++ std::function object!

llvm-svn: 214050

9 years ago[modules] Add some missing record names. We really should be generating this from...
Richard Smith [Sun, 27 Jul 2014 04:29:04 +0000 (04:29 +0000)]
[modules] Add some missing record names. We really should be generating this from a .def file or similar...

llvm-svn: 214049

9 years ago[modules] Add abbreviation for ImplicitCastExpr. This is the most common
Richard Smith [Sun, 27 Jul 2014 04:19:32 +0000 (04:19 +0000)]
[modules] Add abbreviation for ImplicitCastExpr. This is the most common
record type in LLVM's IR module.

llvm-svn: 214048

9 years agoWrap to 80 columns. No behavior change.
Nico Weber [Sun, 27 Jul 2014 04:09:29 +0000 (04:09 +0000)]
Wrap to 80 columns. No behavior change.

llvm-svn: 214047

9 years agobuiltins: make ARM compilation with GAS work again
Saleem Abdulrasool [Sun, 27 Jul 2014 02:01:24 +0000 (02:01 +0000)]
builtins: make ARM compilation with GAS work again

The LLVM IAS seems to accept wide instructions for add and sub in ARM mode even
though it is not permitted.  This uses a macro to ensure that the wide modifier
is only applied when building in THUMB mode.

This repairs building with GCC/GAS in ARM mode.

llvm-svn: 214046

9 years agobuiltins: move macro definitions into assembly.h
Saleem Abdulrasool [Sun, 27 Jul 2014 02:01:20 +0000 (02:01 +0000)]
builtins: move macro definitions into assembly.h

The macro definitions are shared across multiple files.  Define them once in the
assembly.h header rather than redefining it in each file.

llvm-svn: 214045

9 years agobuiltins: whitespace
Saleem Abdulrasool [Sun, 27 Jul 2014 02:01:15 +0000 (02:01 +0000)]
builtins: whitespace

llvm-svn: 214044

9 years ago[x86] Sink a variable only used by asserts into the asserts. Should fix
Chandler Carruth [Sun, 27 Jul 2014 01:45:49 +0000 (01:45 +0000)]
[x86] Sink a variable only used by asserts into the asserts. Should fix
some -Werror bots, sorry for the noise.

llvm-svn: 214043

9 years ago[x86] Add a much more powerful framework for combining x86 shuffle
Chandler Carruth [Sun, 27 Jul 2014 01:15:58 +0000 (01:15 +0000)]
[x86] Add a much more powerful framework for combining x86 shuffle
instructions in the legalized DAG, and leverage it to combine long
sequences of instructions to PSHUFB.

Eventually, the other x86-instruction-specific shuffle combines will
probably all be driven out of this routine. But the real motivation is
to detect after we have fully legalized and optimized a shuffle to the
minimal number of x86 instructions whether it is profitable to replace
the chain with a fully generic PSHUFB instruction even though doing so
requires either a load from a constant pool or tying up a register with
the mask.

While the Intel manuals claim it should be used when it replaces 5 or
more instructions (!!!!) my experience is that it is actually very fast
on modern chips, and so I've gon with a much more aggressive model of
replacing any sequence of 3 or more instructions.

I've also taught it to do some basic canonicalization to special-purpose
instructions which have smaller encodings than their generic
counterparts.

There are still quite a few FIXMEs here, and I've not yet implemented
support for lowering blends with PSHUFB (where its power really shines
due to being able to zero out lanes), but this starts implementing real
PSHUFB support even when using the new, fancy shuffle lowering. =]

llvm-svn: 214042

9 years ago[ADT] Add a remarkbly useful little helper routine to ArrayRef for
Chandler Carruth [Sun, 27 Jul 2014 01:11:19 +0000 (01:11 +0000)]
[ADT] Add a remarkbly useful little helper routine to ArrayRef for
checking whether the ArrayRef is equal to an explicit list of arguments.

This is particularly easy to implement even without variadic templates
because ArrayRef happens to be homogeneously typed. As a consequence we
can use a "clever" wrapper type and default arguments to capture in
a single method many arguments as well as *how many* arguments the user
specified.

Thanks to Dave Blaikie for helping me pull together this little helper.
Suggestions for how to improve or generalize it are of course welcome.
I'll be using it immediately in my follow-up patch. =D

llvm-svn: 214041

9 years agobuiltins: avoid multiple definitions of symbols
Saleem Abdulrasool [Sat, 26 Jul 2014 23:44:22 +0000 (23:44 +0000)]
builtins: avoid multiple definitions of symbols

The architecture specific implementation of routines would be built and included
along with the generic implementation.  This would result in multiple
definitions of those symbols.

The linker is free to select either of the two.  Most of the time, this
shouldn't be too terrible as the forward iteration should catch the architecture
version due to the ordering.  Rather than relying on the linker and build
infrastructure ordering things in a specific manner, only provide the
architecture version when available.

This reduces the size of compiler-rt, simplifies inspection of the library
implementations, and guarantees that the desired version is selected at a
slightly complex build system.

llvm-svn: 214040

9 years agobuiltins: add missed files from previous commits
Saleem Abdulrasool [Sat, 26 Jul 2014 23:44:18 +0000 (23:44 +0000)]
builtins: add missed files from previous commits

This adds missed files in SVN r214033 for alignment and corrects a change from
SVN r214034 for fixing compilation with GCC.

llvm-svn: 214039

9 years agoWrap to 80 columns. No behavior change.
Nico Weber [Sat, 26 Jul 2014 23:20:08 +0000 (23:20 +0000)]
Wrap to 80 columns. No behavior change.

llvm-svn: 214038

9 years agoBetter defaults for in-tree libc++ with cmake.
Dan Albert [Sat, 26 Jul 2014 23:08:33 +0000 (23:08 +0000)]
Better defaults for in-tree libc++ with cmake.

This will detect if you are building libcxx in-tree and libcxxabi is
available.  If so, it will default to using the in-tree libcxxabi by
setting LIBCXX_CXX_ABI to "libcxxabi", LIBCXX_LIBCXXABI_INCLUDE_PATHS to
"${CMAKE_SOURCE_DIR}/projects/libcxxabi/include" and will add "cxxabi"
as a proper dependency.

Patch by Russell Harmon.

llvm-svn: 214037

9 years agoWrap to 80 columns, no functionality change.
Nico Weber [Sat, 26 Jul 2014 22:15:25 +0000 (22:15 +0000)]
Wrap to 80 columns, no functionality change.

llvm-svn: 214036

9 years agoR600/SI: Fix broken test.
Matt Arsenault [Sat, 26 Jul 2014 21:21:42 +0000 (21:21 +0000)]
R600/SI: Fix broken test.

There was no check prefix for the instruction lines.
Match what is emitted though, although I'm pretty sure it is
incorrect.

llvm-svn: 214035

9 years agobuiltins: move the readonly constants into rodata
Saleem Abdulrasool [Sat, 26 Jul 2014 21:08:41 +0000 (21:08 +0000)]
builtins: move the readonly constants into rodata

Place the floating point constants into the read-only data section.  This was
already being done for x86_64, this simply mirrors the behaviour for i686.

llvm-svn: 214034

9 years agobuiltins: correct constant alignments
Saleem Abdulrasool [Sat, 26 Jul 2014 21:08:34 +0000 (21:08 +0000)]
builtins: correct constant alignments

MMX/SSE instructions expect 128-bit alignment (16-byte) for constants that they
reference.  Correct the alignment on the constant values.  Although it is quite
possible for the data to end up aligned, there is no guarantee that this will
occur unless it is explicitly aligned to the desired location.  If the data ends
up being unaligned, the resultant binary would fault at runtime due to the
unaligned access.

As an example, the follow would fault previously:
  cc -c lib/builtins/x86_64/floatundidf.S -o floatundidf.o
  cc -c test/builtins/Unit/floatundidf_test.c -o floatundidf_test.c
  ld -m elf_x86_64 floatundidf.o floatundidf_test.o -lc -o floatundidf

However, if the object files were reversed, the data would end up aligned and
the problem would go unnoticed.

llvm-svn: 214033

9 years agoObjective-C. Issue more warning diagnostic when certain
Fariborz Jahanian [Sat, 26 Jul 2014 20:52:26 +0000 (20:52 +0000)]
Objective-C. Issue more warning diagnostic when certain
properties are not synthesized in property auto-synthesis,
as it can potentiall lead to runtime errors.
rdar://17774815

llvm-svn: 214032

9 years agollgs: add --reverse-connect support.
Todd Fiala [Sat, 26 Jul 2014 20:39:17 +0000 (20:39 +0000)]
llgs: add --reverse-connect support.

Also includes --reverse-connect tests for llgs and debugserver.

llvm-svn: 214031

10 years agotsan: advise shadow for 0x7f region to not use huge pages
Dmitry Vyukov [Sat, 26 Jul 2014 17:41:10 +0000 (17:41 +0000)]
tsan: advise shadow for 0x7f region to not use huge pages
see the comment for justification

llvm-svn: 214030

10 years agotsan: improve shadow flush benchmark
Dmitry Vyukov [Sat, 26 Jul 2014 16:40:33 +0000 (16:40 +0000)]
tsan: improve shadow flush benchmark
allow to specify access stride

llvm-svn: 214029

10 years agoFix the failing test 'vector-idiv.ll'.
Joey Gouly [Sat, 26 Jul 2014 10:58:14 +0000 (10:58 +0000)]
Fix the failing test 'vector-idiv.ll'.
On Darwin the comment character is ##.

llvm-svn: 214028

10 years agotsan: reduce internal allocator region from 16M to 1M
Dmitry Vyukov [Sat, 26 Jul 2014 10:17:26 +0000 (10:17 +0000)]
tsan: reduce internal allocator region from 16M to 1M
16M regions can waste almost 1G for nothing.
Since region size is used only during initial heap growth,
it's unclear why we even need such huge regions.

llvm-svn: 214027

10 years agotsan: remove meta from internal allocator
Dmitry Vyukov [Sat, 26 Jul 2014 10:06:11 +0000 (10:06 +0000)]
tsan: remove meta from internal allocator
I am puzzled why it is even there.

llvm-svn: 214026

10 years ago[Driver][Mips] Check output of -dynamic-linker arguments by the Clang driver
Simon Atanasyan [Sat, 26 Jul 2014 09:52:21 +0000 (09:52 +0000)]
[Driver][Mips] Check output of -dynamic-linker arguments by the Clang driver
for a couple of MIPS toolchains.

No functional changes.

llvm-svn: 214025

10 years ago[modules] Improve abbreviations for C++:
Richard Smith [Sat, 26 Jul 2014 06:37:51 +0000 (06:37 +0000)]
[modules] Improve abbreviations for C++:

 * Add abbreviation for CXXMethodDecl and for FunctionProtoType. These come up
   a *lot* in C++ modules.
 * Allow typedef declarations to use the abbreviation if they're class members,
   or if they're used.

In passing, add more record name records for Clang AST node kinds.

The downside is that we had already used up our allotment of 12 abbreviations,
so this pushes us to an extra bit on each record to support the extra abbrev
kinds, which increases file size by ~1%. This patch *barely* pays for that
through the other improvements, but we've got room for another 18 abbrevs,
so we should be able to make it much more profitable with future changes.

llvm-svn: 214024

10 years agoR600: Move intrinsic lowering to separate functions
Matt Arsenault [Sat, 26 Jul 2014 06:23:37 +0000 (06:23 +0000)]
R600: Move intrinsic lowering to separate functions

llvm-svn: 214023

10 years ago[SDAG] Add an assert that we don't mess up the number of values when
Chandler Carruth [Sat, 26 Jul 2014 05:53:16 +0000 (05:53 +0000)]
[SDAG] Add an assert that we don't mess up the number of values when
replacing nodes in the legalizer.

This caught a number of bugs for me during development.

llvm-svn: 214022

10 years ago[SDAG] Simplify the code for handling single-value nodes and add
Chandler Carruth [Sat, 26 Jul 2014 05:52:51 +0000 (05:52 +0000)]
[SDAG] Simplify the code for handling single-value nodes and add
a missing transfer of debug information (without which tests fail).

llvm-svn: 214021

10 years ago[SDAG] When performing post-legalize DAG combining, run the legalizer
Chandler Carruth [Sat, 26 Jul 2014 05:49:40 +0000 (05:49 +0000)]
[SDAG] When performing post-legalize DAG combining, run the legalizer
over each node in the worklist prior to combining.

This allows the combiner to produce new nodes which need to go back
through legalization. This is particularly useful when generating
operands to target specific nodes in a post-legalize DAG combine where
the operands are significantly easier to express as pre-legalized
operations. My immediate use case will be PSHUFB formation where we need
to build a constant shuffle mask with a build_vector node.

This also refactors the relevant functionality in the legalizer to
support this, and updates relevant tests. I've spoken to the R600 folks
and these changes look like improvements to them. The avx512 change
needs to be investigated, I suspect there is a disagreement between the
legalizer and the DAG combiner there, but it seems a minor issue so
leaving it to be re-evaluated after this patch.

Differential Revision: http://reviews.llvm.org/D4564

llvm-svn: 214020

10 years agoFix broken assert.
Nick Lewycky [Sat, 26 Jul 2014 05:44:15 +0000 (05:44 +0000)]
Fix broken assert.

llvm-svn: 214019

10 years agoParse: Don't crash on trailing whitespace before EOF
David Majnemer [Sat, 26 Jul 2014 05:41:31 +0000 (05:41 +0000)]
Parse: Don't crash on trailing whitespace before EOF

Parser::ParseDeclarationSpecifiers eagerly updates the source range of
the DeclSpec with the current token position.  However, it might not
consume any more tokens.

Fix this by only setting the start of the range, not the end.  This way
the SourceRange will be invalid if we don't consume any more tokens.

This fixes PR20413.

Differential Revision: http://reviews.llvm.org/D4646

llvm-svn: 214018

10 years agoSatisfy -Wparentheses.
Nick Lewycky [Sat, 26 Jul 2014 05:07:41 +0000 (05:07 +0000)]
Satisfy -Wparentheses.

llvm-svn: 214017

10 years agoX86ShuffleDecode.cpp: Silence a warning. [-Wunused-variable]
NAKAMURA Takumi [Sat, 26 Jul 2014 04:53:05 +0000 (04:53 +0000)]
X86ShuffleDecode.cpp: Silence a warning. [-Wunused-variable]

llvm-svn: 214016

10 years agollvm/test/CodeGen/X86/vector-idiv.ll: Fix for -Asserts.
NAKAMURA Takumi [Sat, 26 Jul 2014 04:47:01 +0000 (04:47 +0000)]
llvm/test/CodeGen/X86/vector-idiv.ll: Fix for -Asserts.

llvm-svn: 214015

10 years agoclang/test/CodeGenCXX/microsoft-abi-byval-thunks.cpp: Fix for -Asserts, like CHECK64...
NAKAMURA Takumi [Sat, 26 Jul 2014 04:12:34 +0000 (04:12 +0000)]
clang/test/CodeGenCXX/microsoft-abi-byval-thunks.cpp: Fix for -Asserts, like CHECK64 does.

llvm-svn: 214014

10 years agobuiltins: re-enable building assembly sources
Saleem Abdulrasool [Sat, 26 Jul 2014 04:04:02 +0000 (04:04 +0000)]
builtins: re-enable building assembly sources

Re-apply SVN r213684 which was reverted in SVN r213724 since it broke the
build bots.  Add a tweak to enable inclusion of the assembly sources in
standalone build as well.

Original commit message:

This patch address the PR20360. The CMake assembler build system
ignores the .S assembly files in builtins library build. This patch
fixes the issue.

llvm-svn: 214013

10 years agobuiltins: make the x86_64 compatible with GAS
Saleem Abdulrasool [Sat, 26 Jul 2014 04:03:59 +0000 (04:03 +0000)]
builtins: make the x86_64 compatible with GAS

The .rodata directive was added on the IA-64 (Itanium) platform.  The LLVM IAS
supports the .rodata on i386 and x86_64 as well.  There is no reason to really
restrict compilation of the builtins to just clang.  By explicitly indicating
that the data is meant to be pushed into the .rodata section via the .section
.rodata, the assembly is made compatible with clang and gcc (with GAS).

This will enable building these routines on the Linux buildbots via CMake.

llvm-svn: 214012

10 years ago[x86] Fix PR20355 (for real). There are many layers to this bug.
Chandler Carruth [Sat, 26 Jul 2014 03:46:57 +0000 (03:46 +0000)]
[x86] Fix PR20355 (for real). There are many layers to this bug.

The tale starts with r212808 which attempted to fix inversion of the low
and high bits when lowering MUL_LOHI. Sadly, that commit did not include
any positive test cases, and just removed some operations from a test
case where the actual logic being changed isn't fully visible from the
test.

What this commit did was two things. First, it reversed the low and high
results in the formation of the MERGE_VALUES node for the multiple
results. This is entirely correct.

Second it changed the shuffles for extracting the low and high
components from the i64 results of the multiplies to extract them
assuming a big-endian-style encoding of the multiply results. This
second change is wrong. There is no big-endian encoding in x86, the
results of the multiplies are normal v2i64s: when cast to v4i32, the low
i32s are at offsets 0 and 2, and the high i32s are at offsets 1 and 3.

However, the first change wasn't enough to actually fix the bug, which
is (I assume) why the second change was also made. There was another bug
in the MERGE_VALUES formation: we weren't using a VTList, and so were
getting a single result node! When grabbing the *second* result from the
node, we got... well.. colud be anything. I think this *appeared* to
invert things, but had to be causing other problems as well.

Fortunately, I fixed the MERGE_VALUES issue in r213931, so we should
have been fine, right? NOOOPE! Because the core bug was never addressed,
the test in vector-idiv failed when I fixed the MERGE_VALUES node.
Because there are essentially no docs for this node, I had to guess at
how to fix it and tried swapping the operands, restoring the order of
the original code before r212808. While this "fixed" the test case (in
that we produced the write instructions) we were still extracting the
wrong elements of the i64s, and thus PR20355 was still broken.

This commit essentially reverts the big-endian-style extraction part of
r212808 and goes back to the original masks which were correct. Now that
the MERGE_VALUES node formation is also correct, everything works. I've
also included a more detailed test from PR20355 to make sure this stays
fixed.

llvm-svn: 214011

10 years ago[x86] Finish switching from CHECK to ALL. This was mistakenly included
Chandler Carruth [Sat, 26 Jul 2014 03:46:54 +0000 (03:46 +0000)]
[x86] Finish switching from CHECK to ALL. This was mistakenly included
in r214007 and then reverted when I backed that (very misguided) patch
out. This recovers the test case cleanup which was good.

llvm-svn: 214010

10 years ago[x86] Revert r214007: Fix PR20355 ...
Chandler Carruth [Sat, 26 Jul 2014 02:14:54 +0000 (02:14 +0000)]
[x86] Revert r214007: Fix PR20355 ...

The clever way to implement signed multiplication with unsigned *is
already implemented* and tested and working correctly. The bug is
somewhere else. Re-investigating.

This will teach me to not scroll far enough to read the code that did
what I thought needed to be done.

llvm-svn: 214009

10 years agoIf a template argument is non-evaluable expression, use the profile ID to see
Richard Trieu [Sat, 26 Jul 2014 02:10:52 +0000 (02:10 +0000)]
If a template argument is non-evaluable expression, use the profile ID to see
if the two arguments are equal.

llvm-svn: 214008

10 years ago[x86] Fix PR20355 (and dups) by not using unsigned multiplication when
Chandler Carruth [Sat, 26 Jul 2014 01:52:13 +0000 (01:52 +0000)]
[x86] Fix PR20355 (and dups) by not using unsigned multiplication when
signed multiplication is requested. While there is not a difference in
the *low* half of the result, the *high* half (used specifically to
implement the signed division by these constants) certainly is used. The
test case I've nuked was actively asserting wrong code.

There is a delightful solution to doing signed multiplication even when
we don't have it that Richard Smith has crafted, but I'll add the
machinery back and implement that in a follow-up patch. This at least
restores correctness.

llvm-svn: 214007

10 years ago[UBSan] Initialize symbolizer inside __ubsan::Init().
Alexey Samsonov [Sat, 26 Jul 2014 01:41:45 +0000 (01:41 +0000)]
[UBSan] Initialize symbolizer inside __ubsan::Init().

We used to initialize symbolizer lazily, but this doesn't work in
various sandboxed environments. Instead, let's be consistent with
the rest of sanitizers.

llvm-svn: 214006

10 years ago[Sanitizer] Simplify Symbolizer creation interface.
Alexey Samsonov [Sat, 26 Jul 2014 01:37:23 +0000 (01:37 +0000)]
[Sanitizer] Simplify Symbolizer creation interface.

Get rid of Symbolizer::Init(path_to_external) in favor of
thread-safe Symbolizer::GetOrInit(), and use the latter version
everywhere. Implicitly depend on the value of external_symbolizer_path
runtime flag instead of passing it around manually.

No functionality change.

llvm-svn: 214005

10 years agoMS ABI: Use musttail for vtable thunks that pass arguments by value
Reid Kleckner [Sat, 26 Jul 2014 01:34:32 +0000 (01:34 +0000)]
MS ABI: Use musttail for vtable thunks that pass arguments by value

This moves some memptr specific code into the generic thunk emission
codepath.

Fixes PR20053.

Reviewers: majnemer

Differential Revision: http://reviews.llvm.org/D4613

llvm-svn: 214004

10 years agoRemove an extra parameter and C++11 for loop-ify this code
Reid Kleckner [Sat, 26 Jul 2014 01:30:05 +0000 (01:30 +0000)]
Remove an extra parameter and C++11 for loop-ify this code

llvm-svn: 214003

10 years agoAdd a missing close quote in "while building module 'Foo:" diagnostic.
Jordan Rose [Sat, 26 Jul 2014 01:22:02 +0000 (01:22 +0000)]
Add a missing close quote in "while building module 'Foo:" diagnostic.

This isn't a real diagnostic kind, only a location note, and this form isn't even
used if the SourceManager can provide a valid presumed location. But still.

llvm-svn: 214002

10 years ago[x86] Add coverage for PMUL* instruction testing on SSE2 as well as
Chandler Carruth [Sat, 26 Jul 2014 01:11:10 +0000 (01:11 +0000)]
[x86] Add coverage for PMUL* instruction testing on SSE2 as well as
SSE4.1.

llvm-svn: 214001

10 years ago[modules] Work around mislayering of MC / Object.
Richard Smith [Sat, 26 Jul 2014 01:10:32 +0000 (01:10 +0000)]
[modules] Work around mislayering of MC / Object.

llvm-svn: 214000

10 years agoR600: Add processor type for Mullins
Tom Stellard [Sat, 26 Jul 2014 01:05:20 +0000 (01:05 +0000)]
R600: Add processor type for Mullins

llvm-svn: 213999

10 years agoRevert new test from 213993.
Bob Wilson [Sat, 26 Jul 2014 00:51:28 +0000 (00:51 +0000)]
Revert new test from 213993.

It requires an arm backend and also writes output in the test directory.

llvm-svn: 213998

10 years ago[DFSan] Fixup for r213980
Alexey Samsonov [Sat, 26 Jul 2014 00:49:36 +0000 (00:49 +0000)]
[DFSan] Fixup for r213980

llvm-svn: 213997

10 years agoImprove -UNDEBUG binary size. We don't need a different assert fail message for
Richard Smith [Sat, 26 Jul 2014 00:47:13 +0000 (00:47 +0000)]
Improve -UNDEBUG binary size. We don't need a different assert fail message for
each different enum value here.

llvm-svn: 213996

10 years agoUpdate X86/Utils/LLVMBuild.txt corresponding to r213986. "Core" has been introduced.
NAKAMURA Takumi [Sat, 26 Jul 2014 00:45:43 +0000 (00:45 +0000)]
Update X86/Utils/LLVMBuild.txt corresponding to r213986. "Core" has been introduced.

llvm-svn: 213995

10 years agoIR/UseTest.cpp: Avoid std::to_string() to appease mingw32 bot.
NAKAMURA Takumi [Sat, 26 Jul 2014 00:45:30 +0000 (00:45 +0000)]
IR/UseTest.cpp: Avoid std::to_string() to appease mingw32 bot.

llvm-svn: 213994

10 years agoUse -enable-global-merge option to match llvm r210639. <rdar://problem/17803206>
Bob Wilson [Sat, 26 Jul 2014 00:37:28 +0000 (00:37 +0000)]
Use -enable-global-merge option to match llvm r210639. <rdar://problem/17803206>

llvm revision 210639 renamed the -global-merge backend option to
-enable-global-merge. This change simply updates clang to match that.

Patch by Steven Wu!

llvm-svn: 213993

10 years agoclang/test/CodeGenCXX/cxx1y-variable-template-linkage.cpp: Appease -Asserts build.
NAKAMURA Takumi [Sat, 26 Jul 2014 00:28:09 +0000 (00:28 +0000)]
clang/test/CodeGenCXX/cxx1y-variable-template-linkage.cpp: Appease -Asserts build.

llvm-svn: 213992

10 years ago[x86] More cleanup for this test -- simplify the command line.
Chandler Carruth [Sat, 26 Jul 2014 00:21:52 +0000 (00:21 +0000)]
[x86] More cleanup for this test -- simplify the command line.

llvm-svn: 213991

10 years agoMS ABI: Ensure 'this' is first for byval+sret methods
Reid Kleckner [Sat, 26 Jul 2014 00:12:26 +0000 (00:12 +0000)]
MS ABI: Ensure 'this' is first for byval+sret methods

Previously we were building up the inalloca struct in the usual pattern
of return type followed by arguments.  However, on Windows, 'this'
always precedes the 'sret' parameter, so we need to insert it into the
struct first as a special case.

llvm-svn: 213990

10 years ago[x86] Fix unused variable warning in no-asserts build.
Chandler Carruth [Sat, 26 Jul 2014 00:04:41 +0000 (00:04 +0000)]
[x86] Fix unused variable warning in no-asserts build.

llvm-svn: 213989

10 years ago[x86] FileCheck-ize this test.
Chandler Carruth [Fri, 25 Jul 2014 23:59:20 +0000 (23:59 +0000)]
[x86] FileCheck-ize this test.

llvm-svn: 213988

10 years agoAdd test case for fix of linkage bug that miscompiled variable templates instantiated...
Larisse Voufo [Fri, 25 Jul 2014 23:58:13 +0000 (23:58 +0000)]
Add test case for fix of linkage bug that miscompiled variable templates instantiated from similarly named local types (cf. r212233)

llvm-svn: 213987

10 years ago[x86] Teach the X86 backend to print shuffle comments for PSHUFB
Chandler Carruth [Fri, 25 Jul 2014 23:47:11 +0000 (23:47 +0000)]
[x86] Teach the X86 backend to print shuffle comments for PSHUFB
instructions which happen to have a constant mask.

Currently, this only handles a very narrow set of cases, but those
happen to be the cases that I care about for testing shuffles sanely.
This is a bit trickier than other shuffle instructions because we're
decoding constants out of the constant pool. The current MC layer makes
it completely impossible to inspect a constant pool entry, so we have to
do it at the MI level and attach the comment to the streamer on its way
out. So no joy for disassembling, but it does make test cases and asm
dumps *much* nicer.

Sorry for no test cases, but it didn't really seem that valuable to go
trolling through existing old test cases and updating them. I'll have
lots of testing of this in the upcoming patch for SSSE3 emission in the
new vector shuffle lowering code paths.

llvm-svn: 213986

10 years agoR600/SI: Allow partial unrolling and increase thresholds.
Matt Arsenault [Fri, 25 Jul 2014 23:02:42 +0000 (23:02 +0000)]
R600/SI: Allow partial unrolling and increase thresholds.

llvm-svn: 213985

10 years ago[PECOFF] Add /profile command line option.
Rui Ueyama [Fri, 25 Jul 2014 22:28:49 +0000 (22:28 +0000)]
[PECOFF] Add /profile command line option.

llvm-svn: 213984

10 years ago[UBSan] Call UBSan initialization as early as possible.
Alexey Samsonov [Fri, 25 Jul 2014 22:24:34 +0000 (22:24 +0000)]
[UBSan] Call UBSan initialization as early as possible.

Specifically, use .preinit_array initialization on Linux and dynamic global
initializer on another platforms. Historically UBSan didn't have any
initialization code and its runtime was stateless. This is no longer the
case - UBSan relies on some non-trivial functionality from sanitizer_common
(e.g. online symbolization) and is now configurable by runtime flags.
Additionally, we've dropped support for enabling UBSan only for a few shared
objects, so UBSan is now always linked into the main executable, so now
we can use similar initialization as all the rest sanitizers.

llvm-svn: 213983

10 years agoMove R600 subtarget dependent variables onto the subtarget.
Eric Christopher [Fri, 25 Jul 2014 22:22:39 +0000 (22:22 +0000)]
Move R600 subtarget dependent variables onto the subtarget.

No functional change.

llvm-svn: 213982

10 years agocoverage: remove empty mapping regions
Alex Lorenz [Fri, 25 Jul 2014 22:22:24 +0000 (22:22 +0000)]
coverage: remove empty mapping regions

This patch removes the empty coverage mapping regions.
Those regions were produced by clang's old mapping region generation
algorithm, but the new algorithm doesn't generate them.

llvm-svn: 213981

10 years ago[Sanitizer] Introduce SANITIZER_CAN_USE_PREINIT_ARRAY definition and use it across...
Alexey Samsonov [Fri, 25 Jul 2014 22:05:02 +0000 (22:05 +0000)]
[Sanitizer] Introduce SANITIZER_CAN_USE_PREINIT_ARRAY definition and use it across sanitizers.

Get rid of ASAN_USE_PREINIT_ARRAY and LSAN_USE_PREINIT_ARRAY - just always
use .preinit_array if it's available. This mode seems stable enough, and
we've been relying on default values of these macro for a long time.

llvm-svn: 213980

10 years agoFix my broken test case in NDEBUG :(
Reid Kleckner [Fri, 25 Jul 2014 21:52:11 +0000 (21:52 +0000)]
Fix my broken test case in NDEBUG  :(

llvm-svn: 213979

10 years agoFix my busted FileCheck invocation
Reid Kleckner [Fri, 25 Jul 2014 21:48:10 +0000 (21:48 +0000)]
Fix my busted FileCheck invocation

llvm-svn: 213978

10 years agoCanonicalization for @llvm.assume
Hal Finkel [Fri, 25 Jul 2014 21:45:17 +0000 (21:45 +0000)]
Canonicalization for @llvm.assume

Adds simple logical canonicalization of assumption intrinsics to instcombine,
currently:
 - invariant(a && b) -> invariant(a); invariant(b)
 - invariant(!(a || b)) -> invariant(!a); invariant(!b)

llvm-svn: 213977

10 years agoMS ABI: Don't push destructor cleanups for aggregate parameters in thunks
Reid Kleckner [Fri, 25 Jul 2014 21:39:46 +0000 (21:39 +0000)]
MS ABI: Don't push destructor cleanups for aggregate parameters in thunks

The target method of the thunk will perform the cleanup.  This can't be
tested in 32-bit x86 yet because passing something by value would create
an inalloca, and we refuse to generate broken code for that.

llvm-svn: 213976

10 years agoWrap to 80 columns, no behavior change.
Nico Weber [Fri, 25 Jul 2014 21:37:41 +0000 (21:37 +0000)]
Wrap to 80 columns, no behavior change.

llvm-svn: 213975

10 years agollvm-uselistorder: Fix up LINK_COMPONENTS.
NAKAMURA Takumi [Fri, 25 Jul 2014 21:33:18 +0000 (21:33 +0000)]
llvm-uselistorder: Fix up LINK_COMPONENTS.

llvm-svn: 213974

10 years agoAdd @llvm.assume, lowering, and some basic properties
Hal Finkel [Fri, 25 Jul 2014 21:13:35 +0000 (21:13 +0000)]
Add @llvm.assume, lowering, and some basic properties

This is the first commit in a series that add an @llvm.assume intrinsic which
can be used to provide the optimizer with a condition it may assume to be true
(when the control flow would hit the intrinsic call). Some basic properties are added here:

 - llvm.invariant(true) is dead.
 - llvm.invariant(false) is unreachable (this directly corresponds to the
   documented behavior of MSVC's __assume(0)), so is llvm.invariant(undef).

The intrinsic is tagged as writing arbitrarily, in order to maintain control
dependencies. BasicAA has been updated, however, to return NoModRef for any
particular location-based query so that we don't unnecessarily block code
motion.

llvm-svn: 213973

10 years agoNow that PIC generation on PPC32 is supported, hook up linking support
Joerg Sonnenberger [Fri, 25 Jul 2014 20:57:24 +0000 (20:57 +0000)]
Now that PIC generation on PPC32 is supported, hook up linking support
for NetBSD.

llvm-svn: 213972

10 years agoRevert r213437
Warren Hunt [Fri, 25 Jul 2014 20:52:51 +0000 (20:52 +0000)]
Revert r213437
We no longer plan to use __except_hander3 and rather use custom
personality functions per __try block.

llvm-svn: 213971

10 years ago[stack protector] Add test cases for thumb and thumb2.
Akira Hatanaka [Fri, 25 Jul 2014 19:47:46 +0000 (19:47 +0000)]
[stack protector] Add test cases for thumb and thumb2.

<rdar://problem/12475629>

llvm-svn: 213970

10 years agoFix unsafe memory access
Rui Ueyama [Fri, 25 Jul 2014 19:46:31 +0000 (19:46 +0000)]
Fix unsafe memory access

The following expression

  m[i] = m[j]

where m is a DenseMap and i != j is not safe. m[j] returns a
reference, which would be invalidated when a rehashing occurs.
If rehashing occurs to make room for m[i], m[j] becomes
invalid, and that invalid reference would be used as the RHS
value of the expression.

llvm-svn: 213969

10 years agoObjective-C. Warn if protocol used in an @protocol
Fariborz Jahanian [Fri, 25 Jul 2014 19:45:01 +0000 (19:45 +0000)]
Objective-C. Warn if protocol used in an @protocol
expression is a forward declaration as this results
in undefined behavior. rdar://17768630

llvm-svn: 213968

10 years ago[stack protector] Fix a potential security bug in stack protector where the
Akira Hatanaka [Fri, 25 Jul 2014 19:31:34 +0000 (19:31 +0000)]
[stack protector] Fix a potential security bug in stack protector where the
address of the stack guard was being spilled to the stack.

Previously the address of the stack guard would get spilled to the stack if it
was impossible to keep it in a register. This patch introduces a new target
independent node and pseudo instruction which gets expanded post-RA to a
sequence of instructions that load the stack guard value. Register allocator
can now just remat the value when it can't keep it in a register.

<rdar://problem/12475629>

llvm-svn: 213967

10 years agoFix arc4random detection.
Brad Smith [Fri, 25 Jul 2014 19:28:44 +0000 (19:28 +0000)]
Fix arc4random detection.

Patch by Pascal Stumpf.

llvm-svn: 213966

10 years agoMinor fixups to documentation for Process::Launch()/DoLaunch().
Todd Fiala [Fri, 25 Jul 2014 19:24:52 +0000 (19:24 +0000)]
Minor fixups to documentation for Process::Launch()/DoLaunch().

The code had moved forward with changes for using ProcessLaunchInfo,
but the documentation still referred to arguments that no longer
get passed to these methods.

llvm-svn: 213965

10 years agoReturn a StringRef in getDefaultUniversalArchName.
Rafael Espindola [Fri, 25 Jul 2014 19:22:51 +0000 (19:22 +0000)]
Return a StringRef in getDefaultUniversalArchName.

Patch by Stephen Drake.

llvm-svn: 213964

10 years agoRemove dead code.
Rafael Espindola [Fri, 25 Jul 2014 19:06:39 +0000 (19:06 +0000)]
Remove dead code.

llvm-svn: 213963

10 years ago[Fix] Added RuntimeDebugBuilder to the build
Johannes Doerfert [Fri, 25 Jul 2014 17:49:55 +0000 (17:49 +0000)]
[Fix] Added RuntimeDebugBuilder to the build

llvm-svn: 213962

10 years ago[PowerPC] Support TLS on PPC32/ELF
Hal Finkel [Fri, 25 Jul 2014 17:47:22 +0000 (17:47 +0000)]
[PowerPC] Support TLS on PPC32/ELF

Patch by Justin Hibbits!

llvm-svn: 213960

10 years ago[FastISel][AArch64] Add support for frameaddress intrinsic.
Juergen Ributzka [Fri, 25 Jul 2014 17:47:14 +0000 (17:47 +0000)]
[FastISel][AArch64] Add support for frameaddress intrinsic.

This commit implements the frameaddress intrinsic for the AArch64 architecture
in FastISel.

There were two test cases that pretty much tested the same, so I combined them
to a single test case.

Fixes <rdar://problem/17811834>

llvm-svn: 213959

10 years agoclang-cl: Add support for /Zp
David Majnemer [Fri, 25 Jul 2014 17:30:10 +0000 (17:30 +0000)]
clang-cl: Add support for /Zp

CL's /Zp flag is analogous to GCC's -fpack-struct, it controls the
default maximum alignment of records.

Differential Revision: http://reviews.llvm.org/D4671

llvm-svn: 213958

10 years agoMove -verify-use-list-order into llvm-uselistorder
Duncan P. N. Exon Smith [Fri, 25 Jul 2014 17:13:03 +0000 (17:13 +0000)]
Move -verify-use-list-order into llvm-uselistorder

Ugh.  Turns out not even transformation passes link in how to read IR.
I sincerely believe the buildbots will finally agree with my system
after this though.  (I don't really understand why all of this has been
working on my system, but not on all the buildbots.)

Create a new tool called llvm-uselistorder to use for verifying use-list
order.  For now, just dump everything from the (now defunct)
-verify-use-list-order pass into the tool.

This might be a better way to test use-list order anyway.

Part of PR5680.

llvm-svn: 213957