platform/upstream/llvm.git
8 years agoImprove lit "native" feature to check if the native backend is builtin
Mehdi Amini [Tue, 4 Aug 2015 06:32:31 +0000 (06:32 +0000)]
Improve lit "native" feature to check if the native backend is builtin

The goal is to have 'ninja check' passing even if the X86 backend is
not built.

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 243958

8 years agoRemove the configure and cmake checks for sys/wait.h
Justin Bogner [Tue, 4 Aug 2015 06:29:58 +0000 (06:29 +0000)]
Remove the configure and cmake checks for sys/wait.h

If we don't have sys/wait.h and we're on a unix system there's no way
that several of the llvm tools work at all. This includes clang.

Just remove the configure and cmake checks entirely - we'll get a
build error instead of building something broken now.

llvm-svn: 243957

8 years ago[SDAG] Fix a result chain in ExpandUnalignedLoad
Hal Finkel [Tue, 4 Aug 2015 06:29:12 +0000 (06:29 +0000)]
[SDAG] Fix a result chain in ExpandUnalignedLoad

On the code path in ExpandUnalignedLoad which expands an unaligned vector/fp
value in terms of a legal integer load of the same size, the ChainResult needs
to be the chain result of the integer load.

No in-tree test case is currently available.

Patch by Jan Hranac!

llvm-svn: 243956

8 years ago[LAA] Remove unused pointer partition argument from addRuntimeCheck, NFC
Adam Nemet [Tue, 4 Aug 2015 05:16:20 +0000 (05:16 +0000)]
[LAA] Remove unused pointer partition argument from addRuntimeCheck, NFC

This variant of addRuntimeCheck is only used now from the LoopVectorizer
which does not use this parameter.

llvm-svn: 243955

8 years agoIntroduce enum value for previously defined metadata -- make.implicit
Chen Li [Tue, 4 Aug 2015 04:41:34 +0000 (04:41 +0000)]
Introduce enum value for previously defined metadata -- make.implicit

Summary: This patch adds enum value for an existing metadata type -- make.implicit. Using preassigned enum will be helpful to get compile time type checking and avoid string construction and comparison. The patch also changes uses of make.implicit from string metadata to enum metadata. There is no functionality change.

Reviewers: reames

Subscribers: llvm-commits

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

llvm-svn: 243954

8 years ago[debugserver] Fix "control may reach end of non-void function" warnings.
Bruce Mitchener [Tue, 4 Aug 2015 04:01:16 +0000 (04:01 +0000)]
[debugserver] Fix "control may reach end of non-void function" warnings.

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 243953

8 years agoARM: support windows division routines
Saleem Abdulrasool [Tue, 4 Aug 2015 03:57:56 +0000 (03:57 +0000)]
ARM: support windows division routines

This adds the software division routines for the Windows RTABI.  These are not
expected to be used often though as most modern Windows ARM capable targets
support hardware division.  In the case that the target CPU doesnt support
hardware division, this will be the fallback.

llvm-svn: 243952

8 years agoARM: make Darwin libcall registration table driven (NFC)
Saleem Abdulrasool [Tue, 4 Aug 2015 03:57:52 +0000 (03:57 +0000)]
ARM: make Darwin libcall registration table driven (NFC)

Make the libcall updating table driven similar to the approach that the Linux
and Windows codepath does below.  NFC.

llvm-svn: 243951

8 years ago[UB] Avoid a really broken call to realloc that would later result in
Chandler Carruth [Tue, 4 Aug 2015 03:53:04 +0000 (03:53 +0000)]
[UB] Avoid a really broken call to realloc that would later result in
a bad call to memcpy.

When we only have a buffer from one of the two reparse calls, we can
just return that buffer rather than going through the realloc/memcpy
dance.

Found with UBsan.

llvm-svn: 243950

8 years ago[UB] Guard two calls to memcpy in generated attribute code to handle
Chandler Carruth [Tue, 4 Aug 2015 03:53:01 +0000 (03:53 +0000)]
[UB] Guard two calls to memcpy in generated attribute code to handle
null StringRef objects as inputs.

Found by UBSan.

llvm-svn: 243949

8 years ago[UB] Another place where we were trying to put string data into
Chandler Carruth [Tue, 4 Aug 2015 03:53:00 +0000 (03:53 +0000)]
[UB] Another place where we were trying to put string data into
a BumpPtrAllocator. This at least now handles the case where there is no
concatentation without calling memcpy on a null pointer. It might be
interesting to handle the case where everything is empty without
round-tripping through the allocator, but it wasn't clear to me if the
pointer returned is significant in any way, so I've left it in
a conservatively more-correct state.

Again, found with UBSan.

llvm-svn: 243948

8 years ago[UB] When attaching empty strings to the AST, use an empty StringRef
Chandler Carruth [Tue, 4 Aug 2015 03:52:58 +0000 (03:52 +0000)]
[UB] When attaching empty strings to the AST, use an empty StringRef
rather than forcing the bump pointer allocator to produce a viable
pointer. This also fixes UB when we would try to memcpy from the null
incoming StringRef.

llvm-svn: 243947

8 years ago[UB] Fix the two ways that we would try to memcpy from a null buffer in
Chandler Carruth [Tue, 4 Aug 2015 03:52:56 +0000 (03:52 +0000)]
[UB] Fix the two ways that we would try to memcpy from a null buffer in
the nested name specifier code.

First, skip the entire thing when the input is empty.

Next, handle the case where we started off with a null buffer and a zero
capacity to skip copying and freeing.

This was found with UBSan.

llvm-svn: 243946

8 years ago[UB] Fix two cases of UB in copy/pasted code from SmallVector.
Chandler Carruth [Tue, 4 Aug 2015 03:52:52 +0000 (03:52 +0000)]
[UB] Fix two cases of UB in copy/pasted code from SmallVector.

We should really stop copying and pasting code around. =/

Found by UBSan.

llvm-svn: 243945

8 years ago[UB] Don't allocate space for contained types and then try to copy the
Chandler Carruth [Tue, 4 Aug 2015 03:48:26 +0000 (03:48 +0000)]
[UB] Don't allocate space for contained types and then try to copy the
contained types into the space when we have no contained types. This
fixes the UB stemming from a call to memcpy with a null pointer. This
also reduces the calls to allocate because this actually happens in
a notable client - Clang.

Found by UBSan.

llvm-svn: 243944

8 years agoBump the version # in the xcode proj file from major number 340 to 350.
Jason Molenda [Tue, 4 Aug 2015 03:14:49 +0000 (03:14 +0000)]
Bump the version # in the xcode proj file from major number 340 to 350.
The SB API for major version 340 won't be changing any more.

llvm-svn: 243943

8 years ago[GettingStarted.rst] Commit the right patch.
Sean Silva [Tue, 4 Aug 2015 03:12:33 +0000 (03:12 +0000)]
[GettingStarted.rst] Commit the right patch.

Looks like the rebased version that Mehdi committed didn't incorporate
the latest changes.

Patch by Erik de Castro Lopo <erikd@mega-nerd.com>!

llvm-svn: 243942

8 years agoFix cmake build on non-Windows platforms.
Bruce Mitchener [Tue, 4 Aug 2015 02:41:49 +0000 (02:41 +0000)]
Fix cmake build on non-Windows platforms.

r243914 introduced a change which mistakenly tried to build the
Windows minidump code on all platforms rather than only on Windows.

llvm-svn: 243941

8 years ago[modules] Make IndirectFieldDecl mergeable to avoid lookup ambiguity when the same...
Richard Smith [Tue, 4 Aug 2015 02:05:09 +0000 (02:05 +0000)]
[modules] Make IndirectFieldDecl mergeable to avoid lookup ambiguity when the same anonymous union is defined across multiple modules.

llvm-svn: 243940

8 years agoRevert "[LSR] Generate and use zero extends"
Sanjoy Das [Tue, 4 Aug 2015 01:52:05 +0000 (01:52 +0000)]
Revert "[LSR] Generate and use zero extends"

This reverts commit r243348 and r243357.  They caused PR24347.

llvm-svn: 243939

8 years agoRemove unused header include.
Argyrios Kyrtzidis [Tue, 4 Aug 2015 01:44:13 +0000 (01:44 +0000)]
Remove unused header include.

llvm-svn: 243938

8 years agoChange char_traits<char16_t>::eof() to return 0xFFFF instead of 0xDFFF. Fixes PR...
Marshall Clow [Tue, 4 Aug 2015 01:38:34 +0000 (01:38 +0000)]
Change char_traits<char16_t>::eof() to return 0xFFFF instead of 0xDFFF. Fixes PR#24342

llvm-svn: 243937

8 years ago[AArch64] Rename FP formats to be more consistent. NFC.
Ahmed Bougacha [Tue, 4 Aug 2015 01:38:08 +0000 (01:38 +0000)]
[AArch64] Rename FP formats to be more consistent. NFC.

Some are named "FP", others "SD", others still "FP*SD".
Rename all this to just use "FP", which, except for conversions
(which don't use this format naming scheme), implies "SD" anyway.

llvm-svn: 243936

8 years ago[AArch64] Add isel support for f16 indexed LD/ST.
Ahmed Bougacha [Tue, 4 Aug 2015 01:29:38 +0000 (01:29 +0000)]
[AArch64] Add isel support for f16 indexed LD/ST.

llvm-svn: 243935

8 years ago[UB] Fix yet another use of memcpy with a null pointer argument. I think
Chandler Carruth [Tue, 4 Aug 2015 01:00:56 +0000 (01:00 +0000)]
[UB] Fix yet another use of memcpy with a null pointer argument. I think
this is the last of them in my build of LLVM. Haven't tried Clang yet.

Found via UBSan.

llvm-svn: 243934

8 years ago[AArch64][v8.1a] The "pan" sysreg isn't MSR-specific. NFCI.
Ahmed Bougacha [Tue, 4 Aug 2015 00:55:11 +0000 (00:55 +0000)]
[AArch64][v8.1a] The "pan" sysreg isn't MSR-specific. NFCI.

It's already in SysRegMappings, no need to also have it in MSRMappings:
the latter is only used if we didn't find a match in the former.

llvm-svn: 243933

8 years ago[UB] Fix another place where we would pass a null pointer to memcpy.
Chandler Carruth [Tue, 4 Aug 2015 00:53:01 +0000 (00:53 +0000)]
[UB] Fix another place where we would pass a null pointer to memcpy.

This too was found by UBSan. Down to 35 failures for me.

llvm-svn: 243932

8 years ago[AArch64] Remove unnecessary "break". NFC.
Ahmed Bougacha [Tue, 4 Aug 2015 00:49:08 +0000 (00:49 +0000)]
[AArch64] Remove unnecessary "break".  NFC.

llvm-svn: 243931

8 years ago[AArch64] Use SDValue bool operator. NFC.
Ahmed Bougacha [Tue, 4 Aug 2015 00:48:02 +0000 (00:48 +0000)]
[AArch64] Use SDValue bool operator.  NFC.

llvm-svn: 243930

8 years agoAdd a -revert option to utils/release/merge.sh
Hans Wennborg [Tue, 4 Aug 2015 00:47:58 +0000 (00:47 +0000)]
Add a -revert option to utils/release/merge.sh

llvm-svn: 243929

8 years ago[UB] Fix a nasty place where we would pass null pointers to memcpy.
Chandler Carruth [Tue, 4 Aug 2015 00:44:07 +0000 (00:44 +0000)]
[UB] Fix a nasty place where we would pass null pointers to memcpy.

This happens to work, but is not guaranteed to work. Indeed, most memcpy
interfaces in Linux-land annotate these arguments as nonnull, and GCC
and LLVM both can and do optimized based upon that. When they do so,
they might legitimately have miscompiled code calling this routine with
two valid iterators, 'nullptr' and 'nullptr'. There was even code doing
precisely this because StringRef().begin() and StringRef().end() both
produce null pointers.

This was found by UBSan.

llvm-svn: 243927

8 years ago[AArch64] Vector FCOPYSIGN supports Custom-lowering: mark it as such.
Ahmed Bougacha [Tue, 4 Aug 2015 00:42:34 +0000 (00:42 +0000)]
[AArch64] Vector FCOPYSIGN supports Custom-lowering: mark it as such.

There's a bunch of code in LowerFCOPYSIGN that does smart lowering, and
is actually already vector-aware; let's use it instead of scalarizing!

The only interesting change is that for v2f32, we previously always used
use v4i32 as the integer vector type.
Use v2i32 instead, and mark FCOPYSIGN as Custom.

llvm-svn: 243926

8 years ago[CodeGen] Fix FCOPYSIGN legalization to account for mismatched types.
Ahmed Bougacha [Tue, 4 Aug 2015 00:32:55 +0000 (00:32 +0000)]
[CodeGen] Fix FCOPYSIGN legalization to account for mismatched types.

We used to legalize it like it's any other binary operations.  It's not,
because it accepts mismatched operand types.  Because of that, we used
to hit various asserts and miscompiles.

Specialize vector legalizations to, in the worst case, unroll, or, when
possible, to just legalize the operand that needs legalization.

Scalarization isn't covered, because I can't think of a target where
some but not all of the 1-element vector types are to be scalarized.

llvm-svn: 243924

8 years agoMIR Serialization: Serialize the 'volatile' machine memory operand flag.
Alex Lorenz [Tue, 4 Aug 2015 00:24:45 +0000 (00:24 +0000)]
MIR Serialization: Serialize the 'volatile' machine memory operand flag.

llvm-svn: 243923

8 years agoXFAIL TestInferiorAssert for Android API <= 16.
Chaoren Lin [Mon, 3 Aug 2015 23:59:41 +0000 (23:59 +0000)]
XFAIL TestInferiorAssert for Android API <= 16.

llvm-svn: 243922

8 years ago[LAA] Remove unused needsAnyChecking(), NFC
Adam Nemet [Mon, 3 Aug 2015 23:33:03 +0000 (23:33 +0000)]
[LAA] Remove unused needsAnyChecking(), NFC

llvm-svn: 243921

8 years ago[LoopVer] Remove unused needsRuntimeChecks(), NFC
Adam Nemet [Mon, 3 Aug 2015 23:32:57 +0000 (23:32 +0000)]
[LoopVer] Remove unused needsRuntimeChecks(), NFC

The previous commits moved this functionality into the client.

Also remove the now unused member variable.

llvm-svn: 243920

8 years agoDocs: s/Sanitiser/Sanitizer/ for consistency
Mehdi Amini [Mon, 3 Aug 2015 23:25:46 +0000 (23:25 +0000)]
Docs: s/Sanitiser/Sanitizer/ for consistency

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 243918

8 years agoGettingStarted.rst: Add info about building sanitizers
Mehdi Amini [Mon, 3 Aug 2015 23:17:47 +0000 (23:17 +0000)]
GettingStarted.rst: Add info about building sanitizers

From: Erik de Castro Lopo <erikd@qti.qualcomm.com>
llvm-svn: 243917

8 years agodocs/GettingStarted.rst: Whitespace only
Mehdi Amini [Mon, 3 Aug 2015 23:17:44 +0000 (23:17 +0000)]
docs/GettingStarted.rst: Whitespace only

From: Erik de Castro Lopo <erikd@qti.qualcomm.com>
llvm-svn: 243916

8 years agoMIR Serialization: Initial serialization of the machine memory operands.
Alex Lorenz [Mon, 3 Aug 2015 23:08:19 +0000 (23:08 +0000)]
MIR Serialization: Initial serialization of the machine memory operands.

Reviewers: Duncan P. N. Exon Smith
llvm-svn: 243915

8 years agoCreate a Windows mini-dump target Differential Revision: http://reviews.llvm.org...
Adrian McCarthy [Mon, 3 Aug 2015 23:01:51 +0000 (23:01 +0000)]
Create a Windows mini-dump target  Differential Revision:  reviews.llvm.org/D11611

llvm-svn: 243914

8 years agoRuntime check of poisoning derived class members.
Naomi Musgrave [Mon, 3 Aug 2015 23:01:19 +0000 (23:01 +0000)]
Runtime check of poisoning derived class members.

Summary: Simple test case to verify that an instance of a derived class with virtual base is properly poisoned

Reviewers: eugenis, kcc

Subscribers: cfe-commits

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

modified test to be more concise, and check the local pointer to the destroyed object

revised test to not examine padding- only explicit object members

llvm-svn: 243913

8 years agoDtor callback emitted when msan attribute not repressed for this function.
Naomi Musgrave [Mon, 3 Aug 2015 22:53:11 +0000 (22:53 +0000)]
Dtor callback emitted when msan attribute not repressed for this function.

Summary: In addition to checking compiler flags, the front-end also examines the attributes of the destructor definition to ensure that the SanitizeMemory attribute is attached.

Reviewers: eugenis, kcc

Subscribers: cfe-commits

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

refactored test into new file, revised how function attribute examined

modified test to examine default dtor with and without attribute

removed attribute check

llvm-svn: 243912

8 years agolto: Avoid relying on the environment for this test
Justin Bogner [Mon, 3 Aug 2015 22:43:14 +0000 (22:43 +0000)]
lto: Avoid relying on the environment for this test

It's better to pass libLTO to ld64 via the command line flag than rely
on setting DYLD_LIBRARY_PATH.

llvm-svn: 243911

8 years agoUpdate/correct comment.
David Blaikie [Mon, 3 Aug 2015 22:33:50 +0000 (22:33 +0000)]
Update/correct comment.

llvm-svn: 243910

8 years ago-Wdeprecated-clean: Fix cases of violating the rule of 5 in ways that are deprecated...
David Blaikie [Mon, 3 Aug 2015 22:30:24 +0000 (22:30 +0000)]
-Wdeprecated-clean: Fix cases of violating the rule of 5 in ways that are deprecated in C++11

Various value handles needed to be copy constructible and copy
assignable (mostly for their use in DenseMap). But to avoid an API that
might allow accidental slicing, make these members protected in the base
class and make derived classes final (the special members become
implicitly public there - but disallowing further derived classes that
might be sliced to the intermediate type).

Might be worth having a warning a bit like -Wnon-virtual-dtor that
catches public move/copy assign/ctors in classes with virtual functions.
(suppressable in the same way - by making them protected in the base,
and making the derived classes final) Could be fancier and only diagnose
them when they're actually called, potentially.

Also allow a few default implementations where custom implementations
(especially with non-standard return types) were implemented.

llvm-svn: 243909

8 years agoX86: Teach X86 builtins which target features they require
Justin Bogner [Mon, 3 Aug 2015 22:26:06 +0000 (22:26 +0000)]
X86: Teach X86 builtins which target features they require

This adds the required target feature names to x86 builtins that need
particular features. Most have exactly one ("avx", "aes", etc), but some
of the avx512 features have multiple requirements, eg "avx512vl,avx512bw".

llvm-svn: 243908

8 years agoARM: remove horrible printf left over from debugging
Tim Northover [Mon, 3 Aug 2015 22:19:08 +0000 (22:19 +0000)]
ARM: remove horrible printf left over from debugging

llvm-svn: 243907

8 years ago[clang-tidy] Improve the misc-unused-alias-decl message
Alexander Kornienko [Mon, 3 Aug 2015 22:02:08 +0000 (22:02 +0000)]
[clang-tidy] Improve the misc-unused-alias-decl message

"this namespace alias decl is unused" -> "namespace alias decl '...' is unused"

llvm-svn: 243906

8 years ago[llvm-objdump] Range-loopify. NFC intended.
Davide Italiano [Mon, 3 Aug 2015 21:46:32 +0000 (21:46 +0000)]
[llvm-objdump] Range-loopify. NFC intended.

llvm-svn: 243905

8 years agoFix memory leak in unit test of Bitcode/BitReaderTest.cpp
Derek Schuff [Mon, 3 Aug 2015 21:23:51 +0000 (21:23 +0000)]
Fix memory leak in unit test of Bitcode/BitReaderTest.cpp

Fixes obvious memory leak in test
TestForEofAfterReadFailureOnDataStreamer.  Also removes constexpr use
from same test.

Patch by Karl Schimpf.

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

llvm-svn: 243904

8 years agoFix with a bit more care. (but only a bit)
David Blaikie [Mon, 3 Aug 2015 20:55:00 +0000 (20:55 +0000)]
Fix with a bit more care. (but only a bit)

llvm-svn: 243903

8 years agoJim suggested to use eArgTypeAddressOrExpression for the addresses that 'memory find...
Enrico Granata [Mon, 3 Aug 2015 20:47:19 +0000 (20:47 +0000)]
Jim suggested to use eArgTypeAddressOrExpression for the addresses that 'memory find' takes

llvm-svn: 243902

8 years agoGrammar: Don't imply that a program wouldn't want a person as its output.
Douglas Katzman [Mon, 3 Aug 2015 20:41:31 +0000 (20:41 +0000)]
Grammar: Don't imply that a program wouldn't want a person as its output.

(Because, hey, who wouldn't?)

llvm-svn: 243901

8 years ago[Unroll] Improve the brute force loop unroll estimate by propagating
Chandler Carruth [Mon, 3 Aug 2015 20:32:27 +0000 (20:32 +0000)]
[Unroll] Improve the brute force loop unroll estimate by propagating
through PHI nodes across iterations.

This patch teaches the new advanced loop unrolling heuristics to propagate
constants into the loop from the preheader and around the backedge after
simulating each iteration. This lets us brute force solve simple recurrances
that aren't modeled effectively by SCEV. It also makes it more clear why we
need to process the loop in-order rather than bottom-up which might otherwise
make much more sense (for example, for DCE).

This came out of an attempt I'm making to develop a principled way to account
for dead code in the unroll estimation. When I implemented
a forward-propagating version of that it produced incorrect results due to
failing to propagate *cost* between loop iterations through the PHI nodes, and
it occured to me we really should at least propagate simplifications across
those edges, and it is quite easy thanks to the loop being in canonical and
LCSSA form.

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

llvm-svn: 243900

8 years agoTry to fix the build for C++ standard libraries missing std::map::emplace
David Blaikie [Mon, 3 Aug 2015 20:30:53 +0000 (20:30 +0000)]
Try to fix the build for C++ standard libraries missing std::map::emplace

llvm-svn: 243899

8 years ago[Release Script] Check for correct symlink name
Renato Golin [Mon, 3 Aug 2015 20:19:35 +0000 (20:19 +0000)]
[Release Script] Check for correct symlink name

While checking for the existence of the clang-tools-extra directory,
the script was not checking for its destination name, "extra", and
the script was failing when re-running without checking out new
sources.

llvm-svn: 243898

8 years ago-Wdeprecated-clean: Fix cases of violating the rule of 5 in ways that are deprecated...
David Blaikie [Mon, 3 Aug 2015 20:12:58 +0000 (20:12 +0000)]
-Wdeprecated-clean: Fix cases of violating the rule of 5 in ways that are deprecated in C++11

Some functions return concrete ByteStreamers by value - explicitly
support that in the base class. (dtor can be virtual, no one seems to be
polymorphically owning/destroying them)

llvm-svn: 243897

8 years agoRecommit r243824: -Wdeprecated-clean: Fix cases of violating the rule of 5 in ways...
David Blaikie [Mon, 3 Aug 2015 20:08:41 +0000 (20:08 +0000)]
Recommit r243824: -Wdeprecated-clean: Fix cases of violating the rule of 5 in ways that are deprecated in C++11

This reverts commit r243888, recommitting r243824.

This broke the Windows build due to a difference in the C++ standard
library implementation. Using emplace/forward_as_tuple should ensure
there's no need to copy ValIDs.

llvm-svn: 243896

8 years ago[asan] Print VAs instead of RVAs for module offsets on Windows
Reid Kleckner [Mon, 3 Aug 2015 19:51:18 +0000 (19:51 +0000)]
[asan] Print VAs instead of RVAs for module offsets on Windows

Summary:
This is consistent with binutils and ASan behavior on other platforms,
and makes it easier to use llvm-symbolizer with WinASan. The
--relative-address flag to llvm-symbolizer is also no longer needed.

An RVA is a "relative virtual address", meaning it is the address of
something inside the image minus the base of the mapping at runtime.

A VA in this context is an RVA plus the "preferred base" of the module,
and not a real runtime address. The real runtime address of a symbol
will equal the VA iff the module is loaded at its preferred base at
runtime.

On Windows, the preferred base is stored in the ImageBase field of one
of the PE file header, and this change adds the necessary code to
extract it. On Linux, this offset is typically included in program and
section headers of executables.

ELF shared objects typically use a preferred base of zero, meaning the
smallest p_vaddr field in the program headers is zero. This makes it so
that PIC and PIE module offsets come out looking like RVAs, but they're
actually VAs. The difference between them simply happens to be zero.

Reviewers: samsonov, majnemer

Subscribers: llvm-commits

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

llvm-svn: 243895

8 years agoConvert some AArch64 code to foreach loops. NFC.
Pete Cooper [Mon, 3 Aug 2015 19:04:32 +0000 (19:04 +0000)]
Convert some AArch64 code to foreach loops.  NFC.

Also converted a cast<> to dyn_cast while i was working on the same
line of code.

llvm-svn: 243894

8 years agoFix the memory find command such that it can actually take an expression
Enrico Granata [Mon, 3 Aug 2015 18:51:39 +0000 (18:51 +0000)]
Fix the memory find command such that it can actually take an expression

llvm-svn: 243893

8 years ago[MCJIT] Fix a cast warning in the unit-test introduced in r243589.
Lang Hames [Mon, 3 Aug 2015 18:03:40 +0000 (18:03 +0000)]
[MCJIT] Fix a cast warning in the unit-test introduced in r243589.

Thanks to Aaron Ballman for spotting this.

llvm-svn: 243891

8 years agoFix testing for end of stream in bitstream reader.
Derek Schuff [Mon, 3 Aug 2015 18:01:50 +0000 (18:01 +0000)]
Fix testing for end of stream in bitstream reader.

This fixes a bug found while working on the bitcode reader. In
particular, the method BitstreamReader::AtEndOfStream doesn't always
behave correctly when processing a data streamer. The method
fillCurWord doesn't properly set CurWord/BitsInCurWord if the data
streamer was already at eof, but GetBytes had not yet set the
ObjectSize field of the streaming memory object.

This patch fixes this problem, and provides a test to show that
this problem has been fixed.

Patch by Karl Schimpf.

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

llvm-svn: 243890

8 years agoDo not add spaces into memory-access identifiers
Tobias Grosser [Mon, 3 Aug 2015 17:53:21 +0000 (17:53 +0000)]
Do not add spaces into memory-access identifiers

llvm-svn: 243889

8 years agoRevert "-Wdeprecated-clean: Fix cases of violating the rule of 5 in ways that are...
Reid Kleckner [Mon, 3 Aug 2015 17:36:22 +0000 (17:36 +0000)]
Revert "-Wdeprecated-clean: Fix cases of violating the rule of 5 in ways that are deprecated in C++11"

This reverts commit r243824.

It broke the build on Windows.

llvm-svn: 243888

8 years agoUpdate testcases after LLVM r243885
Duncan P. N. Exon Smith [Mon, 3 Aug 2015 17:28:43 +0000 (17:28 +0000)]
Update testcases after LLVM r243885

llvm-svn: 243887

8 years agoDI: Disallow uniquable DICompileUnits
Duncan P. N. Exon Smith [Mon, 3 Aug 2015 17:26:41 +0000 (17:26 +0000)]
DI: Disallow uniquable DICompileUnits

Since r241097, `DIBuilder` has only created distinct `DICompileUnit`s.
The backend is liable to start relying on that (if it hasn't already),
so make uniquable `DICompileUnit`s illegal and automatically upgrade old
bitcode.  This is a nice cleanup, since we can remove an unnecessary
`DenseSet` (and the associated uniquing info) from `LLVMContextImpl`.

Almost all the testcases were updated with this script:

    git grep -e '= !DICompileUnit' -l -- test |
    grep -v test/Bitcode |
    xargs sed -i '' -e 's,= !DICompileUnit,= distinct !DICompileUnit,'

I imagine something similar should work for out-of-tree testcases.

llvm-svn: 243885

8 years agoARM: prefer allocating VFP regs at stride 4 on Darwin.
Tim Northover [Mon, 3 Aug 2015 17:20:10 +0000 (17:20 +0000)]
ARM: prefer allocating VFP regs at stride 4 on Darwin.

This is necessary for WatchOS support, where the compact unwind format assumes
this kind of layout. For now we only want this on Swift-like CPUs though, where
it's been the Xcode behaviour for ages. Also, since it can expand the prologue
we don't want it at -Oz.

llvm-svn: 243884

8 years agoLinker: Move distinct MDNodes instead of cloning
Duncan P. N. Exon Smith [Mon, 3 Aug 2015 17:09:38 +0000 (17:09 +0000)]
Linker: Move distinct MDNodes instead of cloning

Instead of cloning distinct `MDNode`s when linking in a module, just
move them over.  The module linker destroys the source module, so the
old node would otherwise just be leaked on the context.  Create the new
node in place.  This also reduces the number of cloned uniqued nodes
(since it's less likely their operands have changed).

This mapping strategy is only correct when we're discarding the source,
so the linker turns it on via a ValueMapper flag, `RF_MoveDistinctMDs`.

There's nothing observable in terms of `llvm-link` output here: the
linked module should be semantically identical.

I'll be adding more 'distinct' nodes to the debug info metadata graph in
order to break uniquing cycles, so the benefits of this will partly come
in future commits.  However, we should get some gains immediately, since
we have a fair number of 'distinct' `DILocation`s being linked in.

llvm-svn: 243883

8 years agoAdd option -polly-view-only
Tobias Grosser [Mon, 3 Aug 2015 16:39:56 +0000 (16:39 +0000)]
Add option -polly-view-only

If set, this option instructs -view-scops and -polly-show to only print
functions that contain the specified string in their name. This allows to
look at the scops of a specific function in a large .ll file, without flooding
the screen with .dot graphs.

llvm-svn: 243882

8 years agoAllow derived DOTViewers to choose the functions to illustrate
Tobias Grosser [Mon, 3 Aug 2015 16:37:12 +0000 (16:37 +0000)]
Allow derived DOTViewers to choose the functions to illustrate

Instead of always showing/printing all functions, a class derived from
the DOTViewer class can overwrite the set of functions that will be
processed.

This will be used (and tested) by Polly's scop viewers, but other users
can be imagined as well.

llvm-svn: 243881

8 years agoRefactor AtomicExpand::expandAtomicRMWToCmpXchg into a standalone function.
JF Bastien [Mon, 3 Aug 2015 15:29:47 +0000 (15:29 +0000)]
Refactor AtomicExpand::expandAtomicRMWToCmpXchg into a standalone function.

Summary:
This is useful for PNaCl's `RewriteAtomics` pass. NaCl intrinsics don't exist for some of the more exotic RMW instructions, so by refactoring this function into its own, `RewriteAtomics` can share code rewriting those atomics with `AtomicExpand` while additionally saving a few cycles by generating the `cmpxchg` NaCl-specific intrinsic with the callback. Without this patch, `RewriteAtomics` would require two extra passes over functions, by first requiring use of the full `AtomicExpand` pass to just expand the leftover exotic RMWs and then running itself again to expand resulting `cmpxchg`s.

NFC

Reviewers: jfb

Subscribers: jfb, llvm-commits

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

llvm-svn: 243880

8 years ago[asan] Fix dyld version detection on OS X
Kuba Brecka [Mon, 3 Aug 2015 14:48:59 +0000 (14:48 +0000)]
[asan] Fix dyld version detection on OS X

We currently have a dyld check in DyldNeedsEnvVariable that detects whether we are on a new OS X (10.11+) where we don't need to re-exec. For iOS simulator, we have a dlsym() hack that checks for a specific symbol, but this turns out to be fragile and problematic, because dlsym can sometimes call malloc(), which is not a good idea this early in the process runtime.

Let's instead of this do a direct comparison of dyld's version, which is exported in a public symbol `dyldVersionNumber`.

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

llvm-svn: 243879

8 years ago[SHAVE] Pass all -f, -g, -O, -W options through directly to moviCompile.
Douglas Katzman [Mon, 3 Aug 2015 14:34:22 +0000 (14:34 +0000)]
[SHAVE] Pass all -f, -g, -O, -W options through directly to moviCompile.

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

llvm-svn: 243878

8 years agoCurrently string attributes on function arguments/return values can be generated...
Artur Pilipenko [Mon, 3 Aug 2015 14:31:49 +0000 (14:31 +0000)]
Currently string attributes on function arguments/return values can be generated using LLVM API. However they are not supported in parser. So, the following scenario will fail:
* generate function with string attribute using API,
* dump it in LL format,
* try to parse.
Add parser support for string attributes to fix the issue.

Reviewed By: reames, hfinkel

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

llvm-svn: 243877

8 years ago[CONCEPTS] Add concept to VarDecl and diagnostic for uninitialized variable concept
Nathan Wilson [Mon, 3 Aug 2015 14:25:45 +0000 (14:25 +0000)]
[CONCEPTS] Add concept to VarDecl and diagnostic for uninitialized variable concept

Summary: Add IsConcept bit to VarDecl::NonParmVarDeclBitfields and associated isConcept/setConcept member functions. Set IsConcept to true when 'concept' specifier is in variable declaration. Create diagnostic when variable concept is not initialized.

Reviewers: fraggamuffin, hubert.reinterpretcast, faisalv, aaron.ballman, rsmith

Subscribers: aemerson, cfe-commits

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

llvm-svn: 243876

8 years ago[TTI] Fix default costs for interleaved accesses
Silviu Baranga [Mon, 3 Aug 2015 14:00:58 +0000 (14:00 +0000)]
[TTI] Fix default costs for interleaved accesses

Summary:
Modify the cost calculation function for interleaved accesses
to use the target-specific costs for insert/extract element and
memory operations.

This better models the case where the backend can't match
the interleaved group, and we are forced to use a wide load
and shuffle vectors.

Interleaved accesses are not enabled by default, so this shouldn't
cause a performance change.

Reviewers: jmolloy

Subscribers: jmolloy, llvm-commits

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

llvm-svn: 243875

8 years ago[ARM] Make GlobalMerge merge extern globals by default
John Brawn [Mon, 3 Aug 2015 12:13:33 +0000 (12:13 +0000)]
[ARM] Make GlobalMerge merge extern globals by default

Enabling merging of extern globals appears to be generally either beneficial or
harmless. On some benchmarks suites (on Cortex-M4F, Cortex-A9, and Cortex-A57)
it gives improvements in the 1-5% range, but in the rest the overall effect is
zero.

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

llvm-svn: 243874

8 years ago[GlobalMerge] Allow targets to enable merging of extern variables, NFC.
John Brawn [Mon, 3 Aug 2015 12:08:41 +0000 (12:08 +0000)]
[GlobalMerge] Allow targets to enable merging of extern variables, NFC.

Adjust the GlobalMergeOnExternal option so that the default behaviour is to
do whatever the Target thinks is best. Explicitly enabled or disabling the
option will override this default.

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

llvm-svn: 243873

8 years agoDon't use test inputs from other directories.
Alexander Kornienko [Mon, 3 Aug 2015 11:59:45 +0000 (11:59 +0000)]
Don't use test inputs from other directories.

The test/DebugInfo/dwarfdump-macho-universal.test test added in r243862 uses
an input from another test's directory (test/tools/dsymutil/Inputs/fat-test.o)
which breaks our test setup.

Copying the required test input to the test's Input directory to fix the issue.

llvm-svn: 243872

8 years agoReplace callback-if with isExpansionInMainFile as suggested in post
Daniel Jasper [Mon, 3 Aug 2015 10:52:27 +0000 (10:52 +0000)]
Replace callback-if with isExpansionInMainFile as suggested in post
commit review.

llvm-svn: 243871

8 years agoAdditional fix for PR14269: Crash on vector elements / global register vars in inline...
Andrey Bokhanko [Mon, 3 Aug 2015 10:38:10 +0000 (10:38 +0000)]
Additional fix for PR14269: Crash on vector elements / global register vars in inline assembler.

Compiler crashed when vector elements / global register vars were used in inline assembler with "m" restriction. This patch fixes this.

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

llvm-svn: 243870

8 years agoBe less conservative about forming IT blocks.
James Molloy [Mon, 3 Aug 2015 09:24:48 +0000 (09:24 +0000)]
Be less conservative about forming IT blocks.

In http://reviews.llvm.org/rL215382, IT forming was made more conservative under
the belief that a flag-setting instruction was unpredictable inside an IT block on ARMv6M.

But actually, ARMv6M doesn't even support IT blocks so that's impossible. In the ARMARM for
v7M, v7AR and v8AR it states that the semantics of such an instruction changes inside an
IT block - it doesn't set the flags. So actually it is fine to use one inside an IT block
as long as the flags register is dead afterwards.

This gives significant performance improvements in a variety of MPEG based workloads.

Differential revision: http://reviews.llvm.org/D11680

llvm-svn: 243869

8 years agoFix the test added at r243777.
Alexander Kornienko [Mon, 3 Aug 2015 09:13:19 +0000 (09:13 +0000)]
Fix the test added at r243777.

When RUN: lines are split into multiple lines, each one must be prefixed with
RUN:.

llvm-svn: 243868

8 years ago[X86][AVX512VLBW] add pack, cvt, mulhi and madd intrinsics
Asaf Badouh [Mon, 3 Aug 2015 07:51:00 +0000 (07:51 +0000)]
[X86][AVX512VLBW] add pack, cvt, mulhi and madd intrinsics

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

llvm-svn: 243867

8 years agoValueMapper: Only check for cycles if operands change
Duncan P. N. Exon Smith [Mon, 3 Aug 2015 03:45:32 +0000 (03:45 +0000)]
ValueMapper: Only check for cycles if operands change

This is a minor optimization to only check for unresolved operands
inside `mapDistinctNode()` if the operands have actually changed.  This
shouldn't really cause any change in behaviour.  I didn't actually see a
slowdown in a profile, I was just poking around nearby and saw the
opportunity.

llvm-svn: 243866

8 years agoValueMapper: Use a range-based for, NFC
Duncan P. N. Exon Smith [Mon, 3 Aug 2015 03:27:12 +0000 (03:27 +0000)]
ValueMapper: Use a range-based for, NFC

llvm-svn: 243865

8 years agoValueMapper: Reuse local variable, NFC
Duncan P. N. Exon Smith [Mon, 3 Aug 2015 03:24:28 +0000 (03:24 +0000)]
ValueMapper: Reuse local variable, NFC

llvm-svn: 243864

8 years agoUse early return NFC.
Frederic Riss [Mon, 3 Aug 2015 00:10:33 +0000 (00:10 +0000)]
Use early return NFC.

llvm-svn: 243863

8 years ago[dwarfdump] Add support for dumping mach-o universal objectfiles
Frederic Riss [Mon, 3 Aug 2015 00:10:31 +0000 (00:10 +0000)]
[dwarfdump] Add support for dumping mach-o universal objectfiles

llvm-svn: 243862

8 years ago[dwarfdump] Move dumping to a helper function NFC
Frederic Riss [Mon, 3 Aug 2015 00:10:25 +0000 (00:10 +0000)]
[dwarfdump] Move dumping to a helper function NFC

llvm-svn: 243861

8 years agoWebAssembly: implement getScalarShiftAmountTy so we can shift by amount, with type
JF Bastien [Mon, 3 Aug 2015 00:00:11 +0000 (00:00 +0000)]
WebAssembly: implement getScalarShiftAmountTy so we can shift by amount, with type

Summary: This currently sets the shift amount RHS to the same type as the LHS, and assumes that the LHS is a simple type. This isn't currently the case e.g. with weird integers sizes, but will eventually be true and will assert if not. That's what you get for having an experimental backend: break it and you get to keep both pieces. Most backends either set the RHS to MVT::i32 or MVT::i64, but WebAssembly is a virtual ISA and tries to have regular-looking binary operations where both operands are the same type (even if a 64-bit RHS shifter is slightly silly, hey it's free!).

Subscribers: llvm-commits, sunfish, jfb

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

llvm-svn: 243860

8 years agoUse range-based for loops. NFC
Craig Topper [Sun, 2 Aug 2015 22:34:02 +0000 (22:34 +0000)]
Use range-based for loops. NFC

llvm-svn: 243859

8 years agoAsmPrinter: Stop inheriting from DIE
Duncan P. N. Exon Smith [Sun, 2 Aug 2015 20:54:50 +0000 (20:54 +0000)]
AsmPrinter: Stop inheriting from DIE

Change `DIELoc` and `DIEBlock` to stop inheriting from `DIE`, instead
inheriting from `DIEValueList` to share the value storage API.  This
awkward bit of code-sharing was also fairly confusing: neither `DIELoc`
nor `DIEBlock` represents a `DIE`, so why would they inherit from it?

Aside from the API cleanup, this should improve debug info memory usage
in the backend, since it shaves five pointers off of every `DIELoc` and
`DIEBlock`.  I haven't bothered to measure the savings, though.

llvm-svn: 243858

8 years agoDwarfLinker: Use DIEValueList instead of DIE, NFC
Duncan P. N. Exon Smith [Sun, 2 Aug 2015 20:48:47 +0000 (20:48 +0000)]
DwarfLinker: Use DIEValueList instead of DIE, NFC

Use `DIEValueList` as a pointer to either `DIEBlock` or `DIELoc` instead
of `DIE`, since soon they won't inherit from the latter.

llvm-svn: 243857

8 years agoAsmPrinter: Split out non-DIE printing from DIE::print(), NFC
Duncan P. N. Exon Smith [Sun, 2 Aug 2015 20:46:49 +0000 (20:46 +0000)]
AsmPrinter: Split out non-DIE printing from DIE::print(), NFC

Split out a helper `printValues()` for printing `DIEBlock` and `DIELoc`,
instead of relying on `DIE::print()`.  The shared code was actually
fairly small there.  No functionality change intended.

llvm-svn: 243856

8 years agoAsmPrinter: Take DIEValueList in some DwarfUnit API, NFC
Duncan P. N. Exon Smith [Sun, 2 Aug 2015 20:44:46 +0000 (20:44 +0000)]
AsmPrinter: Take DIEValueList in some DwarfUnit API, NFC

Take `DIEValueList` instead of `DIE` so that `DIEBlock` and `DIELoc` can
stop inheriting from `DIE` in a future commit.

llvm-svn: 243855

8 years agoAsmPrinter: Change DIEValueList to a subclass of DIE, NFC
Duncan P. N. Exon Smith [Sun, 2 Aug 2015 20:42:45 +0000 (20:42 +0000)]
AsmPrinter: Change DIEValueList to a subclass of DIE, NFC

Rewrite `DIEValueList` as a subclass of `DIE`, renaming its API to match
`DIE`'s.  This is preparation for changing `DIEBlock` and `DIELoc` to
stop inheriting from `DIE` and inherit directly from `DIEValueList`.

I thought about leaving this as a has-a relationship (and changing
`DIELoc` and `DIEBlock` to also have-a `DIEValueList`), but that seemed
to require a fair bit more boilerplate and I think it needed more
changes to the `DwarfUnit` API than this will.

No functionality change intended here.

llvm-svn: 243854