platform/upstream/llvm.git
8 years agoclang-cl: support __cdecl-on-struct anachronism
Reid Kleckner [Mon, 21 Mar 2016 16:08:49 +0000 (16:08 +0000)]
clang-cl: support __cdecl-on-struct anachronism

Summary:
The Microsoft compiler emits

  warning C4229: anachronism used : modifiers on data are ignored

for

  struct {} __cdecl s;

but ICU's gendict can generate such (and does when building
LibreOffice), so accepting this in clang-cl too would be useful.

Reviewers: rnk

Patch by Stephan Bergmann

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

llvm-svn: 263947

8 years ago[tsan] Adding a test case for r263939 ("Add some NULL pointer checks into the debuggi...
Kuba Brecka [Mon, 21 Mar 2016 16:05:42 +0000 (16:05 +0000)]
[tsan] Adding a test case for r263939 ("Add some NULL pointer checks into the debugging API")

llvm-svn: 263946

8 years agoImplement constant folding for bitreverse
Matt Arsenault [Mon, 21 Mar 2016 15:00:35 +0000 (15:00 +0000)]
Implement constant folding for bitreverse

llvm-svn: 263945

8 years agoRevert "[ELF] SHF_MERGE section with 0 entsize is not fatal"
Rafael Espindola [Mon, 21 Mar 2016 14:57:20 +0000 (14:57 +0000)]
Revert "[ELF] SHF_MERGE section with 0 entsize is not fatal"

This reverts commit r263664.

The reason we were getting broken files was lld -r, and that has been
fixed.

llvm-svn: 263944

8 years agoclang-format: Make include sorting's main include detection configurable.
Daniel Jasper [Mon, 21 Mar 2016 14:11:27 +0000 (14:11 +0000)]
clang-format: Make include sorting's main include detection configurable.

This patch adds a regular expression to configure suffixes of an
included file to check whether it is the "main" include of the current
file. Previously, clang-format has allowed arbitrary suffixes on the
formatted file, which is still the case when no IncludeMainRegex is
specified.

llvm-svn: 263943

8 years ago[AArch64] Fix a -Wdocumentation warning. NFC.
Chad Rosier [Mon, 21 Mar 2016 13:43:58 +0000 (13:43 +0000)]
[AArch64] Fix a -Wdocumentation warning. NFC.

llvm-svn: 263942

8 years ago[IndVars] Fix PR26974: make sure replaceCongruentIVs doesn't break LCSSA
Silviu Baranga [Mon, 21 Mar 2016 12:44:29 +0000 (12:44 +0000)]
[IndVars] Fix PR26974: make sure replaceCongruentIVs doesn't break LCSSA

Summary:
replaceCongruentIVs can break LCSSA when trying to replace IV increments
since it tries to replace all uses of a phi node with another phi node
while both of the phi nodes are not necessarily in the processed loop.
This will cause an assert in IndVars.

To fix this, we add a check to make sure that the replacement maintains
LCSSA.

Reviewers: sanjoy

Subscribers: mzolotukhin, llvm-commits

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

llvm-svn: 263941

8 years ago[OMPT] Fix wrong parent_task_id in serialized parallel_begin with GCC
Jonas Hahnfeld [Mon, 21 Mar 2016 12:37:52 +0000 (12:37 +0000)]
[OMPT] Fix wrong parent_task_id in serialized parallel_begin with GCC

Without this patch a simple '#pragma omp parallel num_threads(1)' leads to
ompt_event_parallel_begin: parent_task_id=3, [...], parallel_id=2, [...]
ompt_event_parallel_end: parallel_id=2, task_id=4, [...]

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

llvm-svn: 263940

8 years ago[tsan] Add some NULL pointer checks into the debugging API
Kuba Brecka [Mon, 21 Mar 2016 12:12:44 +0000 (12:12 +0000)]
[tsan] Add some NULL pointer checks into the debugging API

`__tsan_get_report_thread` and others can crash if a stack trace is missing, let's add the missing checks.

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

llvm-svn: 263939

8 years agoRemove debug output. Sorry for the noise.
NAKAMURA Takumi [Mon, 21 Mar 2016 11:44:05 +0000 (11:44 +0000)]
Remove debug output. Sorry for the noise.

llvm-svn: 263936

8 years ago[DAGCombine] Catch the case where extract_vector_elt can cause an any_ext while proce...
Silviu Baranga [Mon, 21 Mar 2016 11:43:46 +0000 (11:43 +0000)]
[DAGCombine] Catch the case where extract_vector_elt can cause an any_ext while processing AND SDNodes

Summary:
extract_vector_elt can cause an implicit any_ext if the types don't
match. When processing the following pattern:

  (and (extract_vector_elt (load ([non_ext|any_ext|zero_ext] V))), c)

DAGCombine was ignoring the possible extend, and sometimes removing
the AND even though it was required to maintain some of the bits
in the result to 0, resulting in a miscompile.

This change fixes the issue by limiting the transformation only to
cases where the extract_vector_elt doesn't perform the implicit
extend.

Reviewers: t.p.northover, jmolloy

Subscribers: llvm-commits

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

llvm-svn: 263935

8 years agoclang/test/CodeGenCXX/cxx1z-lambda-star-this.cpp: Satisfy -Asserts.
NAKAMURA Takumi [Mon, 21 Mar 2016 11:40:15 +0000 (11:40 +0000)]
clang/test/CodeGenCXX/cxx1z-lambda-star-this.cpp: Satisfy -Asserts.

llvm-svn: 263934

8 years agoEliminated trailing whitespaces from test. NFC.
George Rimar [Mon, 21 Mar 2016 11:23:53 +0000 (11:23 +0000)]
Eliminated trailing whitespaces from test. NFC.

llvm-svn: 263933

8 years agoFixed -mcpu flag
Elena Demikhovsky [Mon, 21 Mar 2016 11:06:20 +0000 (11:06 +0000)]
Fixed -mcpu flag
"core-avx" does not exist; I changed to "nehalem"

llvm-svn: 263932

8 years agoclang/test/Frontend/plugin-annotate-functions.c requires the target examples/Annotate...
NAKAMURA Takumi [Mon, 21 Mar 2016 11:03:39 +0000 (11:03 +0000)]
clang/test/Frontend/plugin-annotate-functions.c requires the target examples/AnnotateFunctions.

llvm-svn: 263931

8 years agoReorder data members to be consistent with member initializers, to silence warnings.
Faisal Vali [Mon, 21 Mar 2016 10:37:42 +0000 (10:37 +0000)]
Reorder data members to be consistent with member initializers, to silence warnings.

llvm-svn: 263922

8 years ago[Cxx1z] Implement Lambda Capture of *this by Value as [=,*this] (P0018R3)
Faisal Vali [Mon, 21 Mar 2016 09:25:37 +0000 (09:25 +0000)]
[Cxx1z] Implement Lambda Capture of *this by Value as [=,*this] (P0018R3)

Implement lambda capture of *this by copy.
For e.g.:
struct A {

  int d = 10;
  auto foo() { return [*this] (auto a) mutable { d+=a; return d; }; }

};

auto L = A{}.foo(); // A{}'s lifetime is gone.

// Below is still ok, because *this was captured by value.
assert(L(10) == 20);
assert(L(100) == 120);

If the capture was implicit, or [this] (i.e. *this was captured by reference), this code would be otherwise undefined.

Implementation Strategy:
  - amend the parser to accept *this in the lambda introducer
  - add a new king of capture LCK_StarThis
  - teach Sema::CheckCXXThisCapture to handle by copy captures of the
    enclosing object (i.e. *this)
  - when CheckCXXThisCapture does capture by copy, the corresponding
    initializer expression for the closure's data member
    direct-initializes it thus making a copy of '*this'.
  - in codegen, when assigning to CXXThisValue, if *this was captured by
    copy, make sure it points to the corresponding field member, and
    not, unlike when captured by reference, what the field member points
    to.
  - mark feature as implemented in svn

Much gratitude to Richard Smith for his carefully illuminating reviews!

llvm-svn: 263921

8 years agoclang-cl: Add a comment about /Oy- (see r245913).
Nico Weber [Mon, 21 Mar 2016 02:48:05 +0000 (02:48 +0000)]
clang-cl: Add a comment about /Oy- (see r245913).

llvm-svn: 263920

8 years ago[COFF] Don't call memcpy with a NULL argument
David Majnemer [Sun, 20 Mar 2016 23:10:12 +0000 (23:10 +0000)]
[COFF] Don't call memcpy with a NULL argument

Some declarations of memcpy (like glibc's for example) are attributed
with notnull which makes it UB for NULL to get passed in, even if the
memcpy count is zero.

To account for this, guard the memcpy with an appropriate precondition.

This should fix the last UBSan bug, exposed by the test suite, in the
COFF linker.

llvm-svn: 263919

8 years ago[COFF] Remove undefined behavior from ObjectFile::createWeakExternal
David Majnemer [Sun, 20 Mar 2016 22:56:31 +0000 (22:56 +0000)]
[COFF] Remove undefined behavior from ObjectFile::createWeakExternal

LLD type-punned an integral type and a pointer type using a pointer
field.  This is problematic because the pointer type has alignment
greater than some of the integral values.

This would be less problematic if a union was used but it turns out the
integral values are only present for a short, transient, amount of time.

Let's remove this undefined behavior by skipping the punning altogether
by storing the state in a separate memory location: a vector which
informs us which symbols to process for weak externs.

llvm-svn: 263918

8 years ago[X86][SSE] Add vector integer division by constant tests
Simon Pilgrim [Sun, 20 Mar 2016 21:46:58 +0000 (21:46 +0000)]
[X86][SSE] Add vector integer division by constant tests

Expanded tests and split into sdiv/srem and udiv/urem cases for 128 and 256 bit vectors.

llvm-svn: 263917

8 years ago[NVPTX] Adds a new address space inference pass.
Jingyue Wu [Sun, 20 Mar 2016 20:59:20 +0000 (20:59 +0000)]
[NVPTX] Adds a new address space inference pass.

Summary:
The old address space inference pass (NVPTXFavorNonGenericAddrSpaces) is unable
to convert the address space of a pointer induction variable. This patch adds a
new pass called NVPTXInferAddressSpaces that overcomes that limitation using a
fixed-point data-flow analysis (see the file header comments for details).

The new pass is experimental and not enabled by default. Users can turn
it on by setting the -nvptx-use-infer-addrspace flag of llc.

Reviewers: jholewinski, tra, jlebar

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 263916

8 years agoVisual Studio Visualizers for clang::FunctionDecl
Mike Spertus [Sun, 20 Mar 2016 20:15:23 +0000 (20:15 +0000)]
Visual Studio Visualizers for clang::FunctionDecl

Readably displays a FunctionDecl in the Visual Studio Locals Window something like:
  void g(int, double d, struct A && arr)

llvm-svn: 263915

8 years ago[gold] Emit a diagnostic in case we fail to remove a file.
Davide Italiano [Sun, 20 Mar 2016 20:12:33 +0000 (20:12 +0000)]
[gold] Emit a diagnostic in case we fail to remove a file.

llvm-svn: 263914

8 years ago[tsan] Allow -fsanitize=thread for iOS-style simulator targets
Devin Coughlin [Sun, 20 Mar 2016 18:24:33 +0000 (18:24 +0000)]
[tsan] Allow -fsanitize=thread for iOS-style simulator targets

Update the clang driver to allow -fsanitize=thread when targeting x86_64 iOS and tvOS
simulators. Also restrict TSan targeting OS X to only be supported on x86_64 and not i386.

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

llvm-svn: 263913

8 years ago[VFS] Fix test to use more restrict set of headers
Bruno Cardoso Lopes [Sun, 20 Mar 2016 18:08:32 +0000 (18:08 +0000)]
[VFS] Fix test to use more restrict set of headers

llvm-svn: 263912

8 years ago[X86][SSE] Tidyup setTargetShuffleZeroElements to match computeZeroableShuffleElements
Simon Pilgrim [Sun, 20 Mar 2016 17:43:07 +0000 (17:43 +0000)]
[X86][SSE] Tidyup setTargetShuffleZeroElements to match computeZeroableShuffleElements

Based on feedback for D14261

llvm-svn: 263911

8 years ago[tsan] Build TSan dylibs for iOS-style simulators
Devin Coughlin [Sun, 20 Mar 2016 17:35:45 +0000 (17:35 +0000)]
[tsan] Build TSan dylibs for iOS-style simulators

Update the compiler-rt cmake to build TSan dylibs for iOS-style simulators when the
corresponding COMPILER_RT_ENABLE_FOO_OS setting is enabled.

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

Part of rdar://problem/24048382

llvm-svn: 263910

8 years agoAST: Fix some bogus indentation. NFC
Justin Bogner [Sun, 20 Mar 2016 16:58:03 +0000 (16:58 +0000)]
AST: Fix some bogus indentation. NFC

Noticed by Liu Xin. Thanks!

llvm-svn: 263909

8 years agoFixed -Wdocumentation warning
Simon Pilgrim [Sun, 20 Mar 2016 16:25:23 +0000 (16:25 +0000)]
Fixed -Wdocumentation warning

llvm-svn: 263908

8 years ago[X86][SSE] Detect zeroable shuffle elements from different value types
Simon Pilgrim [Sun, 20 Mar 2016 15:45:42 +0000 (15:45 +0000)]
[X86][SSE] Detect zeroable shuffle elements from different value types

Improve computeZeroableShuffleElements to be able to peek through bitcasts to extract zero/undef values from BUILD_VECTOR nodes of different element sizes to the shuffle mask.

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

llvm-svn: 263906

8 years ago[clang-tidy] Update check for API change in r263895.
Benjamin Kramer [Sun, 20 Mar 2016 14:24:49 +0000 (14:24 +0000)]
[clang-tidy] Update check for API change in r263895.

for range stmts now have split begin and ends, just apply OR to the
condition. Should unbreak the build.

llvm-svn: 263900

8 years agoAttempt to fix MSVC build (no __attribute__ there)
Pavel Labath [Sun, 20 Mar 2016 13:37:55 +0000 (13:37 +0000)]
Attempt to fix MSVC build (no __attribute__ there)

llvm-svn: 263899

8 years agoAVX512BW: Enable v32i1/v64i1 BUILD_VECTOR
Igor Breger [Sun, 20 Mar 2016 13:09:43 +0000 (13:09 +0000)]
AVX512BW: Enable v32i1/v64i1 BUILD_VECTOR

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

llvm-svn: 263898

8 years ago[ELF][MIPS] Add case demonstrates creation redundant MIPS GOT entries for non-local...
Simon Atanasyan [Sun, 20 Mar 2016 11:53:39 +0000 (11:53 +0000)]
[ELF][MIPS] Add case demonstrates creation redundant MIPS GOT entries for non-local symbols. NFC.

llvm-svn: 263897

8 years agoMark C++ features implemented in Clang 3.8 as done now that 3.8 has released.
Richard Smith [Sun, 20 Mar 2016 10:37:12 +0000 (10:37 +0000)]
Mark C++ features implemented in Clang 3.8 as done now that 3.8 has released.

llvm-svn: 263896

8 years agoP0184R0: Allow types of 'begin' and 'end' expressions in range-based for loops to...
Richard Smith [Sun, 20 Mar 2016 10:33:40 +0000 (10:33 +0000)]
P0184R0: Allow types of 'begin' and 'end' expressions in range-based for loops to differ.

llvm-svn: 263895

8 years ago[ELF] Update x86_64 relocations to 0.99.8 ABI
George Rimar [Sun, 20 Mar 2016 09:45:08 +0000 (09:45 +0000)]
[ELF] Update x86_64 relocations to 0.99.8 ABI

Added: R_X86_64_GOTPCRELX, R_X86_64_REX_GOTPCRELX
llvm-svn: 263894

8 years agoReapply [2] [VFS] Add 'overlay-relative' field to YAML files
Bruno Cardoso Lopes [Sun, 20 Mar 2016 02:08:48 +0000 (02:08 +0000)]
Reapply [2] [VFS] Add 'overlay-relative' field to YAML files

This reapplies r261552 and r263748. Fixed testcase to reapply.

The VFS overlay mapping between virtual paths and real paths is done through
the 'external-contents' entries in YAML files, which contains hardcoded paths
to the real files.

When a module compilation crashes, headers are dumped into <name>.cache/vfs
directory and are mapped via the <name>.cache/vfs/vfs.yaml. The script
generated for reproduction uses -ivfsoverlay pointing to file to gather the
mapping between virtual paths and files inside <name>.cache/vfs. Currently, we
are only capable of reproducing such crashes in the same machine as they
happen, because of the hardcoded paths in 'external-contents'.

To be able to reproduce a crash in another machine, this patch introduces a new
option in the VFS yaml file called 'overlay-relative'. When it's equal to
'true' it means that the provided path to the YAML file through the
-ivfsoverlay option should also be used to prefix the final path for every
'external-contents'.

Example, given the invocation snippet "... -ivfsoverlay
<name>.cache/vfs/vfs.yaml" and the following entry in the yaml file:

"overlay-relative": "true",
"roots": [
...
  "type": "directory",
  "name": "/usr/include",
  "contents": [
    {
      "type": "file",
      "name": "stdio.h",
      "external-contents": "/usr/include/stdio.h"
    },
...

Here, a file manager request for virtual "/usr/include/stdio.h", that will map
into real path "/<absolute_path_to>/<name>.cache/vfs/usr/include/stdio.h.

This is a useful feature for debugging module crashes in machines other than
the one where the error happened.

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

rdar://problem/24499339

llvm-svn: 263893

8 years agoSuppress a -Wunused-variable warning in release builds.
Craig Topper [Sun, 20 Mar 2016 01:17:54 +0000 (01:17 +0000)]
Suppress a -Wunused-variable warning in release builds.

llvm-svn: 263892

8 years agoBetter visualization of clang::BuiltinType in VisualStudio
Mike Spertus [Sun, 20 Mar 2016 00:32:30 +0000 (00:32 +0000)]
Better visualization of clang::BuiltinType in VisualStudio

Whenever possible, use C++ names for visualizing builtin types. E.g., "long double" instead of "LongDouble"

llvm-svn: 263891

8 years agoVisual Studio Visualizer for clang::FunctionProtoType
Mike Spertus [Sun, 20 Mar 2016 00:20:43 +0000 (00:20 +0000)]
Visual Studio Visualizer for clang::FunctionProtoType

Displays return type and parameters for the Function Protoype object in the Locals window.

llvm-svn: 263890

8 years agoUse a range-based for loop. NFC.
Michael Kuperstein [Sun, 20 Mar 2016 00:16:13 +0000 (00:16 +0000)]
Use a range-based for loop. NFC.

llvm-svn: 263889

8 years ago[Sema] Make type deduction work with some overloadable functions
George Burgess IV [Sat, 19 Mar 2016 21:51:45 +0000 (21:51 +0000)]
[Sema] Make type deduction work with some overloadable functions

Some functions can't have their address taken. If we encounter an
overload set where only one of the candidates can have its address
taken, we should automatically select that candidate's type in type
deduction.

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

llvm-svn: 263888

8 years ago[Sema] Allow casting of some overloaded functions
George Burgess IV [Sat, 19 Mar 2016 21:36:10 +0000 (21:36 +0000)]
[Sema] Allow casting of some overloaded functions

Some functions can't have their address taken. If we encounter an
overload set where only one of the candidates can have its address
taken, we should automatically select that candidate in cast
expressions.

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

llvm-svn: 263887

8 years agoExpose IRBuilder::CreateAtomicCmpXchg as LLVMBuildAtomicCmpXchg in the C API.
Mehdi Amini [Sat, 19 Mar 2016 21:28:28 +0000 (21:28 +0000)]
Expose IRBuilder::CreateAtomicCmpXchg as LLVMBuildAtomicCmpXchg in the C API.

Summary: Also expose getters and setters in the C API, so that the change can be tested.

Reviewers: nhaehnle, axw, joker.eph

Subscribers: llvm-commits

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

From: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
llvm-svn: 263886

8 years agoConst-correctness in libLTO
Mehdi Amini [Sat, 19 Mar 2016 21:28:18 +0000 (21:28 +0000)]
Const-correctness in libLTO

Looks like I was sloppy when bridging to C.
Thanks D. Blaikie for noticing!

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

8 years agoCodeGen: use range based for loop
Saleem Abdulrasool [Sat, 19 Mar 2016 16:35:32 +0000 (16:35 +0000)]
CodeGen: use range based for loop

Convert a loop to use a range based style loop.  NFC.

llvm-svn: 263884

8 years ago[ELF] - ignore the -rpath-link option
George Rimar [Sat, 19 Mar 2016 11:15:54 +0000 (11:15 +0000)]
[ELF] - ignore the -rpath-link option

Just ignore the -rpath-link command line
option in the same way like gold do.

Behavior of lld/gold differs from gnu ld here.
GNU ld tries to resolve undefined symbols in all
shared object files at link time.

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

llvm-svn: 263876

8 years ago[SimplifyLibCalls] Only consider sinpi/cospi functions within the same function
David Majnemer [Sat, 19 Mar 2016 04:53:02 +0000 (04:53 +0000)]
[SimplifyLibCalls] Only consider sinpi/cospi functions within the same function

The sinpi/cospi can be replaced with sincospi to remove unnecessary
computations.  However, we need to make sure that the calls are within
the same function!

This fixes PR26993.

llvm-svn: 263875

8 years ago[InstCombine] Don't insert instructions before a catch switch
David Majnemer [Sat, 19 Mar 2016 04:39:52 +0000 (04:39 +0000)]
[InstCombine] Don't insert instructions before a catch switch

CatchSwitches are not splittable, we cannot insert casts, etc. before
them.

This fixes PR26992.

llvm-svn: 263874

8 years agoAdd a dependency from llvm-link to TransformUtils following r263860
Mehdi Amini [Sat, 19 Mar 2016 03:12:54 +0000 (03:12 +0000)]
Add a dependency from llvm-link to TransformUtils following r263860

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

8 years ago[gold] Use early return to simplify.
Davide Italiano [Sat, 19 Mar 2016 02:34:33 +0000 (02:34 +0000)]
[gold] Use early return to simplify.

llvm-svn: 263872

8 years agoRemoved trailing whitespace
Simon Pilgrim [Sat, 19 Mar 2016 02:05:33 +0000 (02:05 +0000)]
Removed trailing whitespace

llvm-svn: 263871

8 years agoFix a const_cast related warning in GCC in the C API for libLTO
Mehdi Amini [Sat, 19 Mar 2016 01:24:23 +0000 (01:24 +0000)]
Fix a const_cast related warning in GCC in the C API for libLTO

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

8 years agoAdd a comment on partial hashing of Metadata
Mehdi Amini [Sat, 19 Mar 2016 01:06:24 +0000 (01:06 +0000)]
Add a comment on partial hashing of Metadata

Following r263866, on D. Blaikie suggestion.

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

8 years ago[libFuzzer] one more trophie
Kostya Serebryany [Sat, 19 Mar 2016 01:05:33 +0000 (01:05 +0000)]
[libFuzzer] one more trophie

llvm-svn: 263868

8 years agoHash Metadata using pointer for MDString argument instead of value (NFC)
Mehdi Amini [Sat, 19 Mar 2016 01:02:34 +0000 (01:02 +0000)]
Hash Metadata using pointer for MDString argument instead of value (NFC)

MDString are uniqued in the Context on creation, hashing the
pointer is less expensive than hashing the String itself.

Reviewers: dexonsmith
Differential Revision: http://reviews.llvm.org/D16560

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

8 years agoCompute some Debug Info Metadata hash key partially (NFC)
Mehdi Amini [Sat, 19 Mar 2016 00:59:26 +0000 (00:59 +0000)]
Compute some Debug Info Metadata hash key partially (NFC)

Summary:
This patch changes the computation of the hash key for DISubprogram to
be computed on a small subset of the fields. The hash is computed a
lot faster, but there might be more collision in the table.
However by carefully selecting the fields, colisions should be rare.

Using `opt` to load the IR for FastISelEmitter.cpp.o, with this patch:
 - DISubprogram::getImpl() goes from 28ms to 15ms.
 - DICompositeType::getImpl() goes from 6ms to 2ms
 - DIDerivedType::getImpl() goes from 18 to 12ms

Reviewers: dexonsmith

Subscribers: llvm-commits

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

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

8 years agoUse Enrico's new CommandAlias to give better help to the "sif" command.
Jim Ingham [Sat, 19 Mar 2016 00:53:20 +0000 (00:53 +0000)]
Use Enrico's new CommandAlias to give better help to the "sif" command.

llvm-svn: 263865

8 years agoHandle any persistent Decl in the Clang expression parser, not just types.
Sean Callanan [Sat, 19 Mar 2016 00:51:43 +0000 (00:51 +0000)]
Handle any persistent Decl in the Clang expression parser, not just types.

Persistent decls have traditionally only been types.  However, we want to
be able to persist more things, like functions and global variables.  This
changes some of the nomenclature and the lookup rules to make this possible.

<rdar://problem/22864976>

llvm-svn: 263864

8 years agoRework linkInModule(), making it oblivious to ThinLTO
Mehdi Amini [Sat, 19 Mar 2016 00:40:31 +0000 (00:40 +0000)]
Rework linkInModule(), making it oblivious to ThinLTO

Summary:
ThinLTO is relying on linkInModule to import selected function.
However a lot of "magic" was hidden in linkInModule and the IRMover,
who would rename and promote global variables on the fly.

This is moving to an approach where the steps are decoupled and the
client is reponsible to specify the list of globals to import.
As a consequence some test are changed because they were relying on
the previous behavior which was importing the definition of *every*
single global without control on the client side.
Now the burden is on the client to decide if a global has to be imported
or not.

Reviewers: tejohnson

Subscribers: joker.eph, llvm-commits

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

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

8 years ago[LTO] Ignore -plugin/-plugin-opt options.
Davide Italiano [Sat, 19 Mar 2016 00:40:09 +0000 (00:40 +0000)]
[LTO] Ignore -plugin/-plugin-opt options.

This is required to get 'clang -flto' to work transparently
with lld. Please refer to the short comment in the code
for a more detailed explanation.

llvm-svn: 263862

8 years agoFix the project file for the removal of lldb-mi's Platform.cpp.
Jim Ingham [Sat, 19 Mar 2016 00:21:21 +0000 (00:21 +0000)]
Fix the project file for the removal of lldb-mi's Platform.cpp.

llvm-svn: 263861

8 years agoAdd a test for r263577: "Add missing error handling in llvm-lto"
Mehdi Amini [Sat, 19 Mar 2016 00:17:32 +0000 (00:17 +0000)]
Add a test for r263577: "Add missing error handling in llvm-lto"

On Rafael's suggestion!
(also fix a discrepancy between this error message format and the others)

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

8 years agoAdd a DiagnosticManager replace error streams in the expression parser.
Sean Callanan [Sat, 19 Mar 2016 00:03:59 +0000 (00:03 +0000)]
Add a DiagnosticManager replace error streams in the expression parser.

We want to do a better job presenting errors that occur when evaluating
expressions. Key to this effort is getting away from a model where all
errors are spat out onto a stream where the client has to take or leave
all of them.

To this end, this patch adds a new class, DiagnosticManager, which
contains errors produced by the compiler or by LLDB as an expression
is created. The DiagnosticManager can dump itself to a log as well as
to a string. Clients will (in the future) be able to filter out the
errors they're interested in by ID or present subsets of these errors
to the user.

This patch is not intended to change the *users* of errors - only to
thread DiagnosticManagers to all the places where streams are used. I
also attempt to standardize our use of errors a bit, removing trailing
newlines and making clients omit 'error:', 'warning:' etc. and instead
pass the Severity flag.

The patch is testsuite-neutral, with modifications to one part of the
MI tests because it relied on "error: error:" being erroneously
printed. This patch fixes the MI variable handling and the testcase.

<rdar://problem/22864976>

llvm-svn: 263859

8 years agoDelete the custom implementation of signal() on Windows.
Zachary Turner [Fri, 18 Mar 2016 23:47:48 +0000 (23:47 +0000)]
Delete the custom implementation of signal() on Windows.

The Windows SDK provides a version of signal() that is much more
limited compared to other platforms.  It only supports about 5-6
signal values.  LLDB uses signals for a number of things, most
notably to handle Ctrl+C so we can gracefully shut down.  The
portability solution to this on Windows has been to provide a
hand-rolled implementation of `signal` using the name `signal`
so that you could write code that simply calls signal directly
and it would work.

But this introduces a multiply defined symbol with the builtin
version and depending on how you included header files, you could
get yourself into a situation where you had linker errors.  To
make matters worse, it led to a ton of compiler warnings.  Worst
of all though is that this custom implementation of signal was,
in fact, identical for the purposes of handling Ctrl+C as the
builtin implementation of signal.  So it seems to have literally
not been serving any useful purpose.

This patch deletes all the custom signal() functions for Windows,
and includes the signal.h system header, so that any calls to
signal now go to the actual version provided by the Windows SDK.

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

llvm-svn: 263858

8 years ago[CXX_FAST_TLS] Fix issues in ARM.
Manman Ren [Fri, 18 Mar 2016 23:44:37 +0000 (23:44 +0000)]
[CXX_FAST_TLS] Fix issues in ARM.

We need to be careful on which registers can be explicitly handled
via copies. Prologue, Epilogue use physical registers and if one belongs
to the set of CSRsViaCopy, it will no longer be CSRed, since PEI overwrites
it after the explicit copies.

llvm-svn: 263857

8 years ago[CXX_FAST_TLS] Disable tail call when calling conventions are mismatched.
Manman Ren [Fri, 18 Mar 2016 23:41:51 +0000 (23:41 +0000)]
[CXX_FAST_TLS] Disable tail call when calling conventions are mismatched.

Since CXX_FAST_TLS has a bigger set of CSRs, we don't tail call when caller
and callee have mismatched calling conventions.

llvm-svn: 263856

8 years ago[CXX_FAST_TLS] fix issues with O0 on ARM, AArch64 and X86.
Manman Ren [Fri, 18 Mar 2016 23:38:49 +0000 (23:38 +0000)]
[CXX_FAST_TLS] fix issues with O0 on ARM, AArch64 and X86.

Since at O0, explicit copies via SplitCSR may not be removed even if
they are unnecessary, we choose not to use SplitCSR at O0.

llvm-svn: 263855

8 years ago[TLS on Darwin] use CXX_FAST_TLS calling convention for tls_init.
Manman Ren [Fri, 18 Mar 2016 23:35:21 +0000 (23:35 +0000)]
[TLS on Darwin] use CXX_FAST_TLS calling convention for tls_init.

This makes sure we don't generate a lot of code to spill/reload
CSRs when calling tls_init from the access functions.

This helps performance when tls_init is not inlined into the access
functions.

llvm-svn: 263854

8 years agoAArch64: Don't modify other modules in AArch64PromoteConstant
Duncan P. N. Exon Smith [Fri, 18 Mar 2016 23:30:54 +0000 (23:30 +0000)]
AArch64: Don't modify other modules in AArch64PromoteConstant

Avoid modifying other modules in `AArch64PromoteConstant` when the
constant is `ConstantData` (a horrible accident, I'm sure, caught by an
experimental follow-up to r261464).

Previously, this walked through all the users of a constant, but that
reaches into other modules when the constant doesn't depend transitively
on a `GlobalValue`!  Since we're walking instructions anyway, just
modify the instructions we actually see.

As a drive-by, instead of storing `Use` and getting the instructions
again via `Use::getUser()` (which is not a constantant time lookup),
store `std::pair<Instruction, unsigned>`.  Besides being cheaper, this
makes it easier to drop use-lists form `ConstantData` in the future.
(I threw this in because I was touching all the code anyway.)

Because the patch completely changes the traversal logic, it looks
like a rewrite of the pass, but the core logic is all the same (or
should be, minus the out-of-module changes).  In other words, there
should be NFC as long as the LLVMContext only has a single Module.

I didn't think of a good way to test this, but I hope to submit a patch
eventually that makes walking these use-lists illegal/impossible.

llvm-svn: 263853

8 years ago[sancov] clang-formatting SanitizerCoverage.cpp and fully pleasing clang-tidy.
Mike Aizatsky [Fri, 18 Mar 2016 23:29:29 +0000 (23:29 +0000)]
[sancov] clang-formatting SanitizerCoverage.cpp and fully pleasing clang-tidy.

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

llvm-svn: 263852

8 years ago[ELF] Refactor run of LTO passes into an helper. NFC.
Davide Italiano [Fri, 18 Mar 2016 23:22:40 +0000 (23:22 +0000)]
[ELF] Refactor run of LTO passes into an helper. NFC.

Requested by: Rui Ueyama.

llvm-svn: 263851

8 years agoHave DataLayout::isLegalInteger() accept uint64_t
Michael Kuperstein [Fri, 18 Mar 2016 23:19:29 +0000 (23:19 +0000)]
Have DataLayout::isLegalInteger() accept uint64_t

While not strictly necessary, since we don't support large integer
types, this avoids bugs due to silent truncation from uint64_t to a
32-bit unsigned (e.g. DL.isLegalInteger(DL.getTypeSizeInBits(Ty) )

This fixes PR26972.

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

llvm-svn: 263850

8 years ago[sancov] typo fix
Mike Aizatsky [Fri, 18 Mar 2016 22:46:10 +0000 (22:46 +0000)]
[sancov] typo fix

llvm-svn: 263849

8 years ago[Support] Update comment to match actual behavior.
Lang Hames [Fri, 18 Mar 2016 22:44:16 +0000 (22:44 +0000)]
[Support] Update comment to match actual behavior.

llvm-svn: 263848

8 years agoRevert "Revert "[sancov] specifying sanitizer coverage dependencies.""
Chandler Carruth [Fri, 18 Mar 2016 22:43:42 +0000 (22:43 +0000)]
Revert "Revert "[sancov] specifying sanitizer coverage dependencies.""

This reverts commit r263825, re-instating r263797.

llvm-svn: 263847

8 years ago[sancov] reformat & 1 clang-tidy warning.
Mike Aizatsky [Fri, 18 Mar 2016 22:40:52 +0000 (22:40 +0000)]
[sancov] reformat & 1 clang-tidy warning.

llvm-svn: 263846

8 years ago[sancov] Fix the sancov pass to initialize itself inside its
Chandler Carruth [Fri, 18 Mar 2016 22:35:58 +0000 (22:35 +0000)]
[sancov] Fix the sancov pass to initialize itself inside its
constructor. This should fix the recent crashes on certain
architectures.

llvm-svn: 263845

8 years agoFix a build issue where the python module could become stale.
Zachary Turner [Fri, 18 Mar 2016 22:33:59 +0000 (22:33 +0000)]
Fix a build issue where the python module could become stale.

We are using hardlinks instead of symlinks, and we attempted to
have some logic where we don't re-create the link if the target
file already exists.  This logic is faulty, however, when you
manually delete the source file (e.g. liblldb.dll) and then rebuild
lldb so that a brand new liblldb.dll gets written.  Now the two files
have different inodes, but the target exists, so we would not remake
the link and the target would become stale.

We fix this by only doing the optimization if they are really the
exact same file (by comparing inode numbers), and if they are not
the same file but the target exists, we delete it and re-create
the link.

llvm-svn: 263844

8 years agoFixing autocorrect changing cmake->make
Chris Bieneman [Fri, 18 Mar 2016 22:11:51 +0000 (22:11 +0000)]
Fixing autocorrect changing cmake->make

llvm-svn: 263843

8 years agoBPF: emit an error message for unsupported signed division operation
Alexei Starovoitov [Fri, 18 Mar 2016 22:02:47 +0000 (22:02 +0000)]
BPF: emit an error message for unsupported signed division operation

Signed-off-by: Yonghong Song <yhs@plumgrid.com>
Signed-off-by: Alexei Starovoitov <ast@fb.com>
llvm-svn: 263842

8 years agoMissed a few non-ascii characters
Chris Bieneman [Fri, 18 Mar 2016 21:59:33 +0000 (21:59 +0000)]
Missed a few non-ascii characters

llvm-svn: 263841

8 years agoUpdates based on post-commit review of r263834
Chris Bieneman [Fri, 18 Mar 2016 21:57:51 +0000 (21:57 +0000)]
Updates based on post-commit review of r263834

* Renamed to be camel case, consistent with other docs.
* Fixed non-ascii characters (this is what I get for writing docs on an iPad).

llvm-svn: 263840

8 years ago[obj2yaml, COFF] Assert that the alignment is not bogus
David Majnemer [Fri, 18 Mar 2016 21:51:14 +0000 (21:51 +0000)]
[obj2yaml, COFF] Assert that the alignment is not bogus

llvm-svn: 263839

8 years ago[COFF] Correct tests with bogus alignment
David Majnemer [Fri, 18 Mar 2016 21:47:12 +0000 (21:47 +0000)]
[COFF] Correct tests with bogus alignment

llvm-svn: 263838

8 years ago[OPENMP] Implementation of codegen for firstprivate clause of target directive
Carlo Bertolli [Fri, 18 Mar 2016 21:43:32 +0000 (21:43 +0000)]
[OPENMP] Implementation of codegen for firstprivate clause of target directive

This patch implements the following aspects:

It extends sema to check that a variable is not reference in both a map clause and firstprivate or private. This is needed to ensure correct functioning at codegen level, apart from being useful for the user.
It implements firstprivate for target in codegen. The implementation applies to both host and nvptx devices.
It adds regression tests for codegen of firstprivate, host and device side when using the host as device, and nvptx side.
Please note that the regression test for nvptx codegen is missing VLAs. This is because VLAs currently require saving and restoring the stack which appears not to be a supported operation by nvptx backend.

It adds a check in sema regression tests for target map, firstprivate, and private clauses.

http://reviews.llvm.org/D18203

llvm-svn: 263837

8 years agoFix printing of anonymous struct typedefs.
Steven Watanabe [Fri, 18 Mar 2016 21:35:59 +0000 (21:35 +0000)]
Fix printing of anonymous struct typedefs.

clang -cc1 -ast-print put the struct
definition in the wrong place, like this:

  struct {} typedef S;

The reason that this happens is that the printing code
first prints the struct definition, and then tells the next
declaration to leave out the type. This behavior
is correct for simple variable declarations, but fails for
typedefs (or extern, mutable, etc).

The patch address this problem by skipping the struct
declaration when we first see it, and then telling the first
subsequent declaration that it needs to print out the full
struct definition.

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

llvm-svn: 263836

8 years agoInterface to get/set profile summary metadata to module
Easwaran Raman [Fri, 18 Mar 2016 21:29:30 +0000 (21:29 +0000)]
Interface to get/set profile summary metadata to module

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

llvm-svn: 263835

8 years ago[Docs] New documentation for advanced build configurations
Chris Bieneman [Fri, 18 Mar 2016 21:16:26 +0000 (21:16 +0000)]
[Docs] New documentation for advanced build configurations

This document covers how to use some of the new complex build configurations CMake supports.

Feedback and improvements welcomed!

llvm-svn: 263834

8 years agobuiltins: make __clear_cache work on Linux-ARM
Saleem Abdulrasool [Fri, 18 Mar 2016 21:06:06 +0000 (21:06 +0000)]
builtins: make __clear_cache work on Linux-ARM

__clear_cache on Android is identical to the version on Linux.  Use __linux__
instead of __ANDROID__ as __linux__ is defined for Linux and Android.

llvm-svn: 263833

8 years agobuiltins: port __clear_cache to Windows ARM
Saleem Abdulrasool [Fri, 18 Mar 2016 21:06:03 +0000 (21:06 +0000)]
builtins: port __clear_cache to Windows ARM

Support __clear_cache on Windows on ARM using the `FlushInstructionCache`
library call.

llvm-svn: 263832

8 years ago[libFuzzer] add a flag close_fd_mask so that we can silence spammy targets by closing...
Kostya Serebryany [Fri, 18 Mar 2016 20:58:29 +0000 (20:58 +0000)]
[libFuzzer] add a flag close_fd_mask so that we can silence spammy targets by closing stderr/stdout

llvm-svn: 263831

8 years agoAdded a break statement that was needed. Caught by clang's unannotated case fall...
Greg Clayton [Fri, 18 Mar 2016 20:53:35 +0000 (20:53 +0000)]
Added a break statement that was needed. Caught by clang's unannotated case fall through warning.

llvm-svn: 263830

8 years agoMILexer: Add ErrorCallbackType typedef; NFC
Matthias Braun [Fri, 18 Mar 2016 20:41:11 +0000 (20:41 +0000)]
MILexer: Add ErrorCallbackType typedef; NFC

llvm-svn: 263829

8 years ago[IndVars] Make the fix for PR26973 more obvious; NFCI
Sanjoy Das [Fri, 18 Mar 2016 20:37:11 +0000 (20:37 +0000)]
[IndVars] Make the fix for PR26973 more obvious; NFCI

llvm-svn: 263828

8 years ago[IndVars] Pass the right loop to isLoopInvariantPredicate
Sanjoy Das [Fri, 18 Mar 2016 20:37:07 +0000 (20:37 +0000)]
[IndVars] Pass the right loop to isLoopInvariantPredicate

The loop on IVOperand's incoming values assumes IVOperand to be an
induction variable on the loop over which `S Pred X` is invariant;
otherwise loop invariant incoming values to IVOperand are not guaranteed
to dominate the comparision.

This fixes PR26973.

llvm-svn: 263827

8 years agoFixed an case fall through that wasn't meant to happen. Caught by clang's unannotated...
Greg Clayton [Fri, 18 Mar 2016 20:36:30 +0000 (20:36 +0000)]
Fixed an case fall through that wasn't meant to happen. Caught by clang's unannotated case fall through warning.

llvm-svn: 263826

8 years agoRevert "[sancov] specifying sanitizer coverage dependencies."
Mike Aizatsky [Fri, 18 Mar 2016 20:34:58 +0000 (20:34 +0000)]
Revert "[sancov] specifying sanitizer coverage dependencies."

This fails on arm.

This reverts commit 52c8e0f7119d1ea1050c0708565a8c92b73386d2.

llvm-svn: 263825