platform/upstream/llvm.git
7 years agoADT: Remove external uses of ilist_iterator, NFC
Duncan P. N. Exon Smith [Sat, 3 Sep 2016 01:22:56 +0000 (01:22 +0000)]
ADT: Remove external uses of ilist_iterator, NFC

Delete the dead code for Write(ilist_iterator) in the IR Verifier,
inline report(ilist_iterator) at its call sites in the MachineVerifier,
and use simple_ilist<>::iterator in SymbolTableListTraits.

The only remaining reference to ilist_iterator outside of the ilist
implementation is from MachineInstrBundleIterator.  I'll get rid of that
in a follow-up.

llvm-svn: 280565

7 years agoADT: Fix up IListTest.privateNode and get it passing
Duncan P. N. Exon Smith [Sat, 3 Sep 2016 01:06:08 +0000 (01:06 +0000)]
ADT: Fix up IListTest.privateNode and get it passing

This test was using the wrong type, and so not actually testing much.
ilist_iterator constructors weren't going through ilist_node_access, so
they didn't actually work with private inheritance.

llvm-svn: 280564

7 years ago[SE] Add getByteCount methods for device memory
Jason Henline [Sat, 3 Sep 2016 00:32:07 +0000 (00:32 +0000)]
[SE] Add getByteCount methods for device memory

Summary:
Simple utility methods will prevent users from making mistakes when
converting element counts to byte counts.

Reviewers: jlebar

Subscribers: jprice, parallel_libs-commits

Differential Revision: https://reviews.llvm.org/D24197

llvm-svn: 280563

7 years ago[Sema] Fix how we set implicit conversion kinds.
George Burgess IV [Sat, 3 Sep 2016 00:28:25 +0000 (00:28 +0000)]
[Sema] Fix how we set implicit conversion kinds.

We have invariants we like to guarantee for the
`ImplicitConversionKind`s in a `StandardConversionSequence`. These
weren't being upheld in code that r280553 touched, so Richard suggested
that we should fix that. See D24113.

I'm not entirely sure how to go about testing this, so no test case is
included. Suggestions welcome.

llvm-svn: 280562

7 years agoDefine _LIBCPP_SAFE_STATIC __attribute__((require_constant_initialization)), and...
Eric Fiselier [Sat, 3 Sep 2016 00:11:33 +0000 (00:11 +0000)]
Define _LIBCPP_SAFE_STATIC  __attribute__((require_constant_initialization)), and apply it to memory_resource

llvm-svn: 280561

7 years ago[PowerPC] Add asm parser/disassembler support for hrfid,nap,slbmfev
Hal Finkel [Fri, 2 Sep 2016 23:42:01 +0000 (23:42 +0000)]
[PowerPC] Add asm parser/disassembler support for hrfid,nap,slbmfev

These few book-III instructions are used by the Linux kernel.

Partially fixes PR24796.

llvm-svn: 280560

7 years ago[PowerPC] Add support for the extended dcbf form and mnemonics
Hal Finkel [Fri, 2 Sep 2016 23:41:54 +0000 (23:41 +0000)]
[PowerPC] Add support for the extended dcbf form and mnemonics

dcbf has an optional hint-like field, add support for the extended form and the
associated mnemonics (dcbfl and dcbflp).

Partially fixes PR24796.

llvm-svn: 280559

7 years agoDependences: Only create flat StmtSchedule in presence of reductions
Tobias Grosser [Fri, 2 Sep 2016 23:40:15 +0000 (23:40 +0000)]
Dependences: Only create flat StmtSchedule in presence of reductions

Without reductions we do not need a flat union_map schedule describing
the computation we want to perform, but can work purely on the schedule
tree. This reduces the dependence computation and scheduling time from 33ms
to 25ms. Another 30% reduction.

llvm-svn: 280558

7 years agoDependences: Exit early, if no reduction dependences are needed.
Tobias Grosser [Fri, 2 Sep 2016 23:29:38 +0000 (23:29 +0000)]
Dependences: Exit early, if no reduction dependences are needed.

In case we do not compute reduction dependences or dependences that are more
fine-grained than statement level dependences, we can avoid the corresponding
part of the dependence analysis all together. For the 3mm benchmark, this
reduces scheduling + dependence analysis time from 62ms to 33ms for a no-asserts
build.  The majority of the compile time is anyhow spent in the LLVM backends,
when doing code generation. Nevertheless, there is no need to waste compile time
either.

llvm-svn: 280557

7 years ago(clang part) Implement MASM-flavor intel syntax behavior for inline MS asm block.
Yunzhong Gao [Fri, 2 Sep 2016 23:16:06 +0000 (23:16 +0000)]
(clang part) Implement MASM-flavor intel syntax behavior for inline MS asm block.
Clang tests for verifying the following syntaxes:
1. 0xNN and NNh are accepted as valid hexadecimal numbers, but 0xNNh is not.
   0xNN and NNh may come with optional U or L suffix.
2. NNb is accepted as a valid binary (base-2) number, but 0bNN is not.
   NNb may come with optional U or L suffix.

Differential Revision: https://reviews.llvm.org/D22112

llvm-svn: 280556

7 years ago(LLVM part) Implement MASM-flavor intel syntax behavior for inline MS asm block:
Yunzhong Gao [Fri, 2 Sep 2016 23:15:29 +0000 (23:15 +0000)]
(LLVM part) Implement MASM-flavor intel syntax behavior for inline MS asm block:
1. 0xNN and NNh are accepted as valid hexadecimal numbers, but 0xNNh is not.
   0xNN and NNh may come with optional U or L suffix.
2. NNb is accepted as a valid binary (base-2) number, but 0bNN is not.
   NNb may come with optional U or L suffix.

Differential Revision: https://reviews.llvm.org/D22112

llvm-svn: 280555

7 years agoIntroduce option to run isl AST generation, but no IR generation.
Tobias Grosser [Fri, 2 Sep 2016 23:05:42 +0000 (23:05 +0000)]
Introduce option to run isl AST generation, but no IR generation.

We replace the options

  -polly-code-generator=none
                       =isl

with the options

  -polly-code-generation=none
                        =ast
                        =full

This allows us to measure the overhead of Polly itself, versus the compile
time increases due to us generating more IR and consequently the LLVM backends
spending more time on this IR.

We also use this opportunity to rename the option. The original name was
introduced at a point where we still had two code generators. CLooG and the
isl AST generator. Since we only have one AST generator left, there is no need
to distinguish between 'isl' and something else. However, being able to disable
code generation all together has been shown useful for debugging. Hence, we
rename and extend this option to make it a good fit for its new use case.

llvm-svn: 280554

7 years ago[Sema] Relax overloading restrictions in C.
George Burgess IV [Fri, 2 Sep 2016 22:59:57 +0000 (22:59 +0000)]
[Sema] Relax overloading restrictions in C.

This patch allows us to perform incompatible pointer conversions when
resolving overloads in C. So, the following code will no longer fail to
compile (though it will still emit warnings, assuming the user hasn't
opted out of them):

```
void foo(char *) __attribute__((overloadable));
void foo(int) __attribute__((overloadable));

void callFoo() {
  unsigned char bar[128];
  foo(bar); // selects the char* overload.
}
```

These conversions are ranked below all others, so:

  A. Any other viable conversion will win out
  B. If we had another incompatible pointer conversion in the example
     above (e.g. `void foo(int *)`), we would complain about
     an ambiguity.

Differential Revision: https://reviews.llvm.org/D24113

llvm-svn: 280553

7 years agoMake sure to maintain register liveness when generating predicated instructions.
Ron Lieberman [Fri, 2 Sep 2016 22:56:24 +0000 (22:56 +0000)]
Make sure to maintain register liveness when generating predicated instructions.

Author: Krzysztof Parzyszek <kparzysz@codeaurora.org>

Differential Revision: https://reviews.llvm.org/D24209

llvm-svn: 280552

7 years agogitignore: ignore VS Code editor files
Gor Nishanov [Fri, 2 Sep 2016 22:54:26 +0000 (22:54 +0000)]
gitignore: ignore VS Code editor files

Summary: VS code creates .vscode folder to keep its stuff that we really don't need in git.

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D24211

llvm-svn: 280551

7 years agolit: print process output, if getting the list of google-tests failed.
Ivan Krasin [Fri, 2 Sep 2016 22:31:24 +0000 (22:31 +0000)]
lit: print process output, if getting the list of google-tests failed.

Summary:
This is a follow up to r280455, where a check for the process exit code
was introduced. Some ASAN bots throw this error now, but it's impossible
to understand what's wrong with them, and the issue is not reproducible.

Reviewers: vitalybuka

Differential Revision: https://reviews.llvm.org/D24210

llvm-svn: 280550

7 years ago[codeview] Make FieldList records print as a yaml sequence.
Zachary Turner [Fri, 2 Sep 2016 22:19:01 +0000 (22:19 +0000)]
[codeview] Make FieldList records print as a yaml sequence.

Before we were kind of imitating the behavior of a Yaml sequence
by outputting each record one after the other.  This makes it a
little cumbersome when we want to go the other direction -- from
Yaml to Pdb.  So this treats FieldList records as no different than
any other list of records, by printing them as a Yaml sequence with
the exact same format.

llvm-svn: 280549

7 years agoUpdate comments.
Rui Ueyama [Fri, 2 Sep 2016 22:15:08 +0000 (22:15 +0000)]
Update comments.

llvm-svn: 280548

7 years ago[Profile] handle select instruction in 'expect' lowering
Xinliang David Li [Fri, 2 Sep 2016 22:03:40 +0000 (22:03 +0000)]
[Profile] handle select instruction in 'expect' lowering

Builtin expect lowering currently ignores select. This patch
fixes the issue

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

llvm-svn: 280547

7 years ago[ELF] PR30221 - linker script expression parser does not accept '~'
Simon Atanasyan [Fri, 2 Sep 2016 21:54:35 +0000 (21:54 +0000)]
[ELF] PR30221 - linker script expression parser does not accept '~'

The patch adds support for both '-' and '~' unary expressions. Also it
brings support for signed numbers is expressions.

https://llvm.org/bugs/show_bug.cgi?id=30221

Differential revision: https://reviews.llvm.org/D24128

llvm-svn: 280546

7 years ago[PowerPC] For larger offsets, when possible, fold offset into addis toc@ha
Hal Finkel [Fri, 2 Sep 2016 21:37:07 +0000 (21:37 +0000)]
[PowerPC] For larger offsets, when possible, fold offset into addis toc@ha

When we have an offset into a global, etc. that is accessed relative to the TOC
base pointer, and the offset is larger than the minimum alignment of the global
itself and the TOC base pointer (which is 8-byte aligned), we can still fold
the @toc@ha into the memory access, but we must update the addis instruction's
symbol reference with the offset as the symbol addend. When there is only one
use of the addi to be folded and only one use of the addis that would need its
symbol's offset adjusted, then we can make the adjustment and fold the @toc@l
into the memory access.

llvm-svn: 280545

7 years ago[ELF] - Use std::regex instead of hand written logic in elf::globMatch()
George Rimar [Fri, 2 Sep 2016 21:17:20 +0000 (21:17 +0000)]
[ELF] - Use std::regex instead of hand written logic in elf::globMatch()

Use std::regex instead of hand written matcher.

Patch based on code and ideas of Rui Ueyama.

Differential revision: https://reviews.llvm.org/D23829

llvm-svn: 280544

7 years agoAvoid narrowing warnings in __bitset constructor
Dimitry Andric [Fri, 2 Sep 2016 21:02:11 +0000 (21:02 +0000)]
Avoid narrowing warnings in __bitset constructor

When <bitset> is compiled with warnings enabled, on a platform where
size_t is 4 bytes, it results in errors similar to:

    bitset:265:16: error: non-constant-expression cannot be narrowed
    from type 'unsigned long long' to '__storage_type' (aka 'unsigned
    int') in initializer list [-Wc++11-narrowing]
        : __first_{__v, __v >> __bits_per_word}
                   ^~~
    bitset:676:52: note: in instantiation of member function
    'std::__1::__bitset<2, 53>::__bitset' requested here
            bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
                                                       ^

Fix these by casting the initializer list elements to __storage_type.

Reviewers: mclow.lists, EricWF
Differential Revision: https://reviews.llvm.org/D23960

llvm-svn: 280543

7 years agoMove function into cpp file under KMP_AFFINITY_SUPPORTED guard.
Jonathan Peyton [Fri, 2 Sep 2016 20:54:58 +0000 (20:54 +0000)]
Move function into cpp file under KMP_AFFINITY_SUPPORTED guard.

When affinity isn't supported, __kmp_affinity_compact doesn't exist.  The
problem is that in kmp_affinity.h there is a function which uses it without the
proper KMP_AFFINITY_SUPPORTED guard around it.  The compiler was smart enough to
ignore it and the function __kmp_affinity_cmp_Address_child_num which relies on
it, but I think it is cleaner to have it under the proper guard.  Since the
function is only used in the kmp_affinity.cpp file and there aren't any plans to
have it elsewhere.  I have moved it there.

llvm-svn: 280542

7 years agoMove a test file to the right place.
Rui Ueyama [Fri, 2 Sep 2016 20:46:06 +0000 (20:46 +0000)]
Move a test file to the right place.

llvm-svn: 280541

7 years agoRemove useless file prefix.
Rui Ueyama [Fri, 2 Sep 2016 20:40:53 +0000 (20:40 +0000)]
Remove useless file prefix.

Differential Revision: https://reviews.llvm.org/D24207

llvm-svn: 280540

7 years agoRemove link to clang's release notes; keeping it up-to-date is hard
Hans Wennborg [Fri, 2 Sep 2016 20:39:46 +0000 (20:39 +0000)]
Remove link to clang's release notes; keeping it up-to-date is hard

llvm-svn: 280539

7 years agoDecouple the kmp_affin_mask_t type from determining if affinity is capable
Jonathan Peyton [Fri, 2 Sep 2016 20:35:47 +0000 (20:35 +0000)]
Decouple the kmp_affin_mask_t type from determining if affinity is capable

the __kmp_affinity_determine_capable() functions are highly operating system
specific.  This change has the functions use the type they expect explicitly.

llvm-svn: 280538

7 years ago[Sparc] Mark i128 shift libcalls unavailable in 32-bit mode.
James Y Knight [Fri, 2 Sep 2016 20:29:11 +0000 (20:29 +0000)]
[Sparc] Mark i128 shift libcalls unavailable in 32-bit mode.

Recently, llvm wants to emit calls to these functions, while it didn't
seem to be an issue before. Not sure why. Nor do I know why only these
three are important to disable, out of all of the i128 libcalls.

Nevertheless, many other targets have this snippet of code, so, just
copying it to sparc as well, to unbreak things.

llvm-svn: 280537

7 years agoUse od instead of hexdump.
Rui Ueyama [Fri, 2 Sep 2016 20:20:04 +0000 (20:20 +0000)]
Use od instead of hexdump.

od is defined by POSIX and exists since version 1 AT&T Unix.
hexdump is not part of any standard as far as I know.
So od is a better choice than hexdump.

Differential Revision: https://reviews.llvm.org/D24205

llvm-svn: 280536

7 years agoAMDGPU/R600: EXTRACT_VECT_ELT should only bypass BUILD_VECTOR if the vectors have...
Jan Vesely [Fri, 2 Sep 2016 20:13:19 +0000 (20:13 +0000)]
AMDGPU/R600: EXTRACT_VECT_ELT should only bypass BUILD_VECTOR if the vectors have the same number of elements.

Fixes R600 piglit regressions since r280298

Differential Revision: https://reviews.llvm.org/D24174

llvm-svn: 280535

7 years agoSetting fp trapping mode and denormal type: this an improvement of
Sjoerd Meijer [Fri, 2 Sep 2016 19:51:34 +0000 (19:51 +0000)]
Setting fp trapping mode and denormal type: this an improvement of
r280246 and calculates compatibility of functions attributes in
a better way.

Differential Revision: https://reviews.llvm.org/D24070

llvm-svn: 280534

7 years agoSimplify. NFC.
Rui Ueyama [Fri, 2 Sep 2016 19:49:27 +0000 (19:49 +0000)]
Simplify. NFC.

llvm-svn: 280533

7 years agoDo not consider subreg defs as reads when computing subrange liveness
Krzysztof Parzyszek [Fri, 2 Sep 2016 19:48:55 +0000 (19:48 +0000)]
Do not consider subreg defs as reads when computing subrange liveness

Subregister definitions are considered uses for the purpose of tracking
liveness of the whole register. At the same time, when calculating live
interval subranges, subregister defs should not be treated as uses.

Differential Revision: https://reviews.llvm.org/D24190

llvm-svn: 280532

7 years ago[InstCombine] auto-generate assertions for tighter checking
Sanjay Patel [Fri, 2 Sep 2016 19:38:37 +0000 (19:38 +0000)]
[InstCombine] auto-generate assertions for tighter checking

llvm-svn: 280531

7 years agoReplace a bad instance of __kmp_free() with KMP_CPU_FREE_ARRAY() macro.
Jonathan Peyton [Fri, 2 Sep 2016 19:37:12 +0000 (19:37 +0000)]
Replace a bad instance of __kmp_free() with KMP_CPU_FREE_ARRAY() macro.

llvm-svn: 280530

7 years agoRename UnresolvedPolicy::Error -> UnresolvedPolicy::ReportError.
Rui Ueyama [Fri, 2 Sep 2016 19:36:29 +0000 (19:36 +0000)]
Rename UnresolvedPolicy::Error -> UnresolvedPolicy::ReportError.

"Error" looks like it is indicating a parse error. "Error" actually
instructs the later process to report an error if there's an error
condition. Thus the new name.

llvm-svn: 280529

7 years agoAdd -nostdlib.
Rui Ueyama [Fri, 2 Sep 2016 19:20:33 +0000 (19:20 +0000)]
Add -nostdlib.

llvm-svn: 280528

7 years ago[SLP] Don't pass a global CL option as an argument. NFC.
Chad Rosier [Fri, 2 Sep 2016 19:09:50 +0000 (19:09 +0000)]
[SLP] Don't pass a global CL option as an argument. NFC.

Differential Revision: https://reviews.llvm.org/D24199

llvm-svn: 280527

7 years agoAMDGPU/R600: Expand unaligned writes to local and global AS
Jan Vesely [Fri, 2 Sep 2016 19:07:06 +0000 (19:07 +0000)]
AMDGPU/R600: Expand unaligned writes to local and global AS

LOCAL and GLOBAL AS only
PRIVATE needs special treatment

Differential Revision: https://reviews.llvm.org/D23971

llvm-svn: 280526

7 years agoImplement __attribute__((require_constant_initialization)) for safe static initializa...
Eric Fiselier [Fri, 2 Sep 2016 18:53:31 +0000 (18:53 +0000)]
Implement __attribute__((require_constant_initialization)) for safe static initialization.

Summary:
This attribute specifies expectations about the initialization of static and
thread local variables. Specifically that the variable has a
[constant initializer](http://en.cppreference.com/w/cpp/language/constant_initialization)
according to the rules of [basic.start.static]. Failure to meet this expectation
will result in an error.

Static objects with constant initializers avoid hard-to-find bugs caused by
the indeterminate order of dynamic initialization. They can also be safely
used by other static constructors across translation units.

This attribute acts as a compile time assertion that the requirements
for constant initialization have been met. Since these requirements change
between dialects and have subtle pitfalls it's important to fail fast instead
of silently falling back on dynamic initialization.

```c++
  // -std=c++14
  #define SAFE_STATIC __attribute__((require_constant_initialization)) static
  struct T {
    constexpr T(int) {}
    ~T();
  };
  SAFE_STATIC T x = {42}; // OK.
  SAFE_STATIC T y = 42; // error: variable does not have a constant initializer
  // copy initialization is not a constant expression on a non-literal type.
```
This attribute can only be applied to objects with static or thread-local storage
duration.

Reviewers: majnemer, rsmith, aaron.ballman

Subscribers: jroelofs, cfe-commits

Differential Revision: https://reviews.llvm.org/D23385

llvm-svn: 280525

7 years agoDispatch without hash table lookup.
Rui Ueyama [Fri, 2 Sep 2016 18:52:41 +0000 (18:52 +0000)]
Dispatch without hash table lookup.

Cmd used to be the single central place to dispatch. It is not longer
the case because we have a logic for readProvideOrAssignment().
This patch removes the hash table so that evrything is in a single
function. This is slightly verbose but should improve readability.

Differential Revision: https://reviews.llvm.org/D24200

llvm-svn: 280524

7 years agoAMDGPU: Reorganize store tests
Jan Vesely [Fri, 2 Sep 2016 18:52:28 +0000 (18:52 +0000)]
AMDGPU: Reorganize store tests

Split by AS.
Merge with some prviously failing tests.

Differential Revision: https://reviews.llvm.org/D23969

llvm-svn: 280523

7 years ago[codeview] Use the correct max CV record length of 0xFF00
Reid Kleckner [Fri, 2 Sep 2016 18:43:27 +0000 (18:43 +0000)]
[codeview] Use the correct max CV record length of 0xFF00

Previously we were splitting our records at 0xFFFF bytes, which the
Microsoft tools don't like.

Should fix failure on the new Windows self-host buildbot.

This length appears in microsoft-pdb/PDB/dbi/dbiimpl.h

llvm-svn: 280522

7 years agoRevert r280516 since it contained accidental changes.
Eric Fiselier [Fri, 2 Sep 2016 18:43:25 +0000 (18:43 +0000)]
Revert r280516 since it contained accidental changes.

llvm-svn: 280521

7 years agoBased on post-commit feedback over IRC with dblaikie, ideally, we should have a Small...
Aaron Ballman [Fri, 2 Sep 2016 18:31:31 +0000 (18:31 +0000)]
Based on post-commit feedback over IRC with dblaikie, ideally, we should have a SmallVector constructor that accepts anything which can supply a range via ADL begin()/end() calls so that we can construct the SmallVector directly from anything range-like.

Since that doesn't exist right now, use a local variable instead of calling getAssocExprs() twice; NFC.

llvm-svn: 280520

7 years agoUse 'critical' reduction method when 'atomic' is not available but requested.
Jonathan Peyton [Fri, 2 Sep 2016 18:29:45 +0000 (18:29 +0000)]
Use 'critical' reduction method when 'atomic' is not available but requested.

In case atomic reduction method is not available (the compiler can't generate
it) the assertion failure occurred if KMP_FORCE_REDUCTION=atomic was specified.
This change replaces the assertion with a warning and sets the reduction method
to the default one - 'critical'.

Patch by Olga Malysheva

Differential Revision: https://reviews.llvm.org/D23990

llvm-svn: 280519

7 years agoIfConversion: Add assertions that both sides of a diamond don't pred-clobber.
Kyle Butt [Fri, 2 Sep 2016 18:29:28 +0000 (18:29 +0000)]
IfConversion: Add assertions that both sides of a diamond don't pred-clobber.

One side of a diamond may end with a predicate clobbering instruction.
That side of the diamond has to be if-converted second. Both sides can't
clobber the predicate or the ifconversion is invalid. This is checked
elsewhere, but add an assert as a safety check. NFC

llvm-svn: 280518

7 years agoIfConversion: Fix bug introduced by rescanning diamonds.
Kyle Butt [Fri, 2 Sep 2016 18:29:26 +0000 (18:29 +0000)]
IfConversion: Fix bug introduced by rescanning diamonds.

Passing the wrong values for predicate-clobbering. Simple to miss.
Added an assert to make this easier to catch in the future.

llvm-svn: 280517

7 years agoImplement __attribute__((require_constant_initialization)) for safe static initializa...
Eric Fiselier [Fri, 2 Sep 2016 18:25:29 +0000 (18:25 +0000)]
Implement __attribute__((require_constant_initialization)) for safe static initialization.

Summary:
This attribute specifies expectations about the initialization of static and
thread local variables. Specifically that the variable has a
[constant initializer](http://en.cppreference.com/w/cpp/language/constant_initialization)
according to the rules of [basic.start.static]. Failure to meet this expectation
will result in an error.

Static objects with constant initializers avoid hard-to-find bugs caused by
the indeterminate order of dynamic initialization. They can also be safely
used by other static constructors across translation units.

This attribute acts as a compile time assertion that the requirements
for constant initialization have been met. Since these requirements change
between dialects and have subtle pitfalls it's important to fail fast instead
of silently falling back on dynamic initialization.

```c++
  // -std=c++14
  #define SAFE_STATIC __attribute__((require_constant_initialization)) static
  struct T {
    constexpr T(int) {}
    ~T();
  };
  SAFE_STATIC T x = {42}; // OK.
  SAFE_STATIC T y = 42; // error: variable does not have a constant initializer
  // copy initialization is not a constant expression on a non-literal type.
```
This attribute can only be applied to objects with static or thread-local storage
duration.

Reviewers: majnemer, rsmith, aaron.ballman

Subscribers: jroelofs, cfe-commits

Differential Revision: https://reviews.llvm.org/D23385

llvm-svn: 280516

7 years agoAdd comments.
Rui Ueyama [Fri, 2 Sep 2016 18:19:00 +0000 (18:19 +0000)]
Add comments.

llvm-svn: 280515

7 years agoCheck for null
Enrico Granata [Fri, 2 Sep 2016 18:15:48 +0000 (18:15 +0000)]
Check for null

llvm-svn: 280513

7 years ago[SE] Remove broken doc ref
Jason Henline [Fri, 2 Sep 2016 18:07:48 +0000 (18:07 +0000)]
[SE] Remove broken doc ref

llvm-svn: 280512

7 years ago[SE] Doc tweaks
Jason Henline [Fri, 2 Sep 2016 17:59:12 +0000 (17:59 +0000)]
[SE] Doc tweaks

Summary:
* Sections on main page.
* Use std algorithm for equality check in example.
* Add tree view on left side.
* Add extra CSS sheet to restrict content width.
* Add mild background color.
* Restrict alphabetic indexes to 1 column.
* Round corners of content boxes.
* Rename example to CUDASaxpy.cpp.
* Add CUDASaxpy.cpp to "Examples" section.

Reviewers: jprice

Subscribers: parallel_libs-commits

Differential Revision: https://reviews.llvm.org/D24198

llvm-svn: 280511

7 years agoRemove temoprary files.
Rui Ueyama [Fri, 2 Sep 2016 17:34:17 +0000 (17:34 +0000)]
Remove temoprary files.

Previously, we created temporary files using llvm::sys::fs::createTemporaryFile
and removed them using llvm::FileRemover. This is error-prone as it is easy to
forget creating FileRemover instances after creating temporary files.
There is actually a temporary file leak bug.

This patch introduces a new class, TemporaryFile, to manage temporary files
in the RAII style.

Differential Revision: https://reviews.llvm.org/D24176

llvm-svn: 280510

7 years ago[SE] GlobalDeviceMemory owns its handle
Jason Henline [Fri, 2 Sep 2016 17:22:42 +0000 (17:22 +0000)]
[SE] GlobalDeviceMemory owns its handle

Summary:
Final step in getting GlobalDeviceMemory to own its handle.

* Make GlobalDeviceMemory movable, but no longer copyable.
* Make Device::freeDeviceMemory function private and make
  GlobalDeviceMemoryBase a friend of Device so GlobalDeviceMemoryBase
  can free its memory in its destructor.
* Make GlobalDeviceMemory constructor private and make Device a friend
  so it can construct GlobalDeviceMemory.
* Remove SharedDeviceMemoryBase class because it is never used.
* Remove explicit memory freeing from example code.

This change just consumes any errors generated during device memory freeing.
The real error handling will be added in a future patch.

Reviewers: jlebar

Subscribers: jprice, parallel_libs-commits

Differential Revision: https://reviews.llvm.org/D24195

llvm-svn: 280509

7 years agoFix up comment from r280442, noticed by Justin.
Adam Nemet [Fri, 2 Sep 2016 17:20:32 +0000 (17:20 +0000)]
Fix up comment from r280442, noticed by Justin.

llvm-svn: 280508

7 years agoFix potential test failures.
Rui Ueyama [Fri, 2 Sep 2016 17:19:28 +0000 (17:19 +0000)]
Fix potential test failures.

Windows does not allow opened files to be removed. This patch
fixes two types of errors.

 - Output file being the same as input file. Because LLD itself
   holds a file descriptor of the input file, it cannot create an
   output file with the same name as a new file.

 - Removing files before releasing MemoryBuffer objects.

These tests are not failing no because MemoryBuffer happens to
decide not to use mmap on these files. But we shouldn't rely on
that behavior.

llvm-svn: 280507

7 years ago[SE] Add "install" actions to cmake build
Jason Henline [Fri, 2 Sep 2016 17:19:19 +0000 (17:19 +0000)]
[SE] Add "install" actions to cmake build

The "install" build target will now copy the StreamExecutor library and
headers to the appropriate subdirectories of CMAKE_INSTALL_PREFIX.

llvm-svn: 280506

7 years agoSplit the store of a wide value merged from an int-fp pair into multiple stores.
Wei Mi [Fri, 2 Sep 2016 17:17:04 +0000 (17:17 +0000)]
Split the store of a wide value merged from an int-fp pair into multiple stores.

For the store of a wide value merged from a pair of values, especially int-fp pair,
sometimes it is more efficent to split it into separate narrow stores, which can
remove the bitwise instructions or sink them to colder places.

Now the feature is only enabled on x86 target, and only store of int-fp pair is
splitted. It is possible that the application scope gets extended with perf evidence
support in the future.

Differential Revision: https://reviews.llvm.org/D22840

llvm-svn: 280505

7 years ago[InsttCombine] fold insertelement of constant into shuffle with constant operand...
Sanjay Patel [Fri, 2 Sep 2016 17:05:43 +0000 (17:05 +0000)]
[InsttCombine] fold insertelement of constant into shuffle with constant operand (PR29126)

The motivating case occurs with SSE/AVX scalar intrinsics, so this is a first step towards
shrinking that to a single shufflevector.

Note that the transform is intentionally limited to shuffles that are equivalent to vector
selects to avoid creating arbitrary shuffle masks that may not lower well.

This should solve PR29126:
https://llvm.org/bugs/show_bug.cgi?id=29126

Differential Revision: https://reviews.llvm.org/D23886

llvm-svn: 280504

7 years ago[lib/LTO] Simplify. No functional change intended.
Davide Italiano [Fri, 2 Sep 2016 16:37:31 +0000 (16:37 +0000)]
[lib/LTO] Simplify. No functional change intended.

llvm-svn: 280503

7 years agoQuick fix to make LIT_PRESERVES_TMP work again
Reid Kleckner [Fri, 2 Sep 2016 16:33:15 +0000 (16:33 +0000)]
Quick fix to make LIT_PRESERVES_TMP work again

llvm-svn: 280502

7 years ago[lit] Clean up temporary files created by tests
Reid Kleckner [Fri, 2 Sep 2016 16:29:24 +0000 (16:29 +0000)]
[lit] Clean up temporary files created by tests

Do this by creating a temp directory in the normal system temp
directory, and cleaning it up on exit.

It is still possible for this temp directory to leak if Python exits
abnormally, but this is probably good enough for now.

Fixes PR18335

llvm-svn: 280501

7 years ago[WebAssembly] Update known test failures
Derek Schuff [Fri, 2 Sep 2016 16:26:24 +0000 (16:26 +0000)]
[WebAssembly] Update known test failures

Fixed an issue with the experimental C headers

llvm-svn: 280498

7 years ago[LV] Ensure reverse interleaved group GEPs remain uniform
Matthew Simpson [Fri, 2 Sep 2016 16:19:22 +0000 (16:19 +0000)]
[LV] Ensure reverse interleaved group GEPs remain uniform

For uniform instructions, we're only required to generate a scalar value for
the first vector lane of each unroll iteration. Thus, if we have a reverse
interleaved group, computing the member index off the scalar GEP corresponding
to the last vector lane of its pointer operand technically makes the GEP
non-uniform. We should compute the member index off the first scalar GEP
instead.

I've added the updated member index computation to the existing reverse
interleaved group test.

llvm-svn: 280497

7 years ago[SE] Don't pack raw device mem args
Jason Henline [Fri, 2 Sep 2016 16:10:51 +0000 (16:10 +0000)]
[SE] Don't pack raw device mem args

Summary:
Step 4 of getting GlobalDeviceMemory to own its handle.

Take out code to pack untyped device memory types as kernel arguments.
When GlobalDeviceMemory owns its handle, users will never touch untyped
device memory types, so they will never pass them as kernel args.

Reviewers: jlebar

Subscribers: jprice, parallel_libs-commits

Differential Revision: https://reviews.llvm.org/D24177

llvm-svn: 280496

7 years ago[ELF] - Linkerscript: add support for suffixes in numbers.
George Rimar [Fri, 2 Sep 2016 16:01:42 +0000 (16:01 +0000)]
[ELF] - Linkerscript: add support for suffixes in numbers.

Both bfd and gold accept:
foo = 1K;
bar = 1M;
zed = 1H;

And lowercase forms: k, m, h.
Patch adds support for that.

Differential revision: https://reviews.llvm.org/D24194

llvm-svn: 280494

7 years agoFix build breakage caused by r280490
Tamas Berghammer [Fri, 2 Sep 2016 15:56:33 +0000 (15:56 +0000)]
Fix build breakage caused by r280490

llvm-svn: 280492

7 years agoSimplify code a bit. No functional change intended.
Andrea Di Biagio [Fri, 2 Sep 2016 15:55:25 +0000 (15:55 +0000)]
Simplify code a bit. No functional change intended.

We don't need to call `GetCompareTy(LHS)' every single time true or false is
returned from function SimplifyFCmpInst as suggested by Sanjay in review D24142.

llvm-svn: 280491

7 years agoFix 2 waring in the OCaml AST context
Tamas Berghammer [Fri, 2 Sep 2016 15:52:19 +0000 (15:52 +0000)]
Fix 2 waring in the OCaml AST context

llvm-svn: 280490

7 years agofix documentation comments; NFC
Sanjay Patel [Fri, 2 Sep 2016 15:43:25 +0000 (15:43 +0000)]
fix documentation comments; NFC

llvm-svn: 280489

7 years ago[instsimplify] Fix incorrect folding of an ordered fcmp with a vector of all NaN.
Andrea Di Biagio [Fri, 2 Sep 2016 14:47:43 +0000 (14:47 +0000)]
[instsimplify] Fix incorrect folding of an ordered fcmp with a vector of all NaN.

This patch fixes a crash caused by an incorrect folding of an ordered comparison
between a packed floating point vector and a splat vector of NaN.

An ordered comparison between a vector and a constant vector of NaN, should
always be folded into a constant vector where each element is i1 false.

Since revision 266175, SimplifyFCmpInst folds the ordered fcmp into a scalar
'false'. Later on, this would cause an assertion failure, since the value type
of the folded value doesn't match the expected value type of the uses of the
original instruction: "Assertion failed: New->getType() == getType() &&
"replaceAllUses of value with new value of different type!".

This patch fixes the issue and adds a test case to the already existing test
InstSimplify/floating-point-compares.ll.

Differential Revision: https://reviews.llvm.org/D24143

llvm-svn: 280488

7 years agoclang-format: [JS] merge requoting replacements.
Martin Probst [Fri, 2 Sep 2016 14:29:48 +0000 (14:29 +0000)]
clang-format: [JS] merge requoting replacements.

Summary:
When formatting source code that needs both requoting and reindentation,
merge the replacements to avoid erroring out for conflicting replacements.

Also removes the misleading Replacements parameter from the
TokenAnalyzer API.

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D24155

llvm-svn: 280487

7 years agoclang-format: [JS] handle default bindings in imports.
Martin Probst [Fri, 2 Sep 2016 14:06:32 +0000 (14:06 +0000)]
clang-format: [JS] handle default bindings in imports.

Summary:
Default imports appear outside of named bindings in curly braces:

  import A from 'a';
  import A, {symbol} from 'a';

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D23973

llvm-svn: 280486

7 years agoclang-format: [JS] Sort all JavaScript imports if any changed.
Martin Probst [Fri, 2 Sep 2016 14:01:17 +0000 (14:01 +0000)]
clang-format: [JS] Sort all JavaScript imports if any changed.

Summary:
User feedback is that they expect *all* imports to be sorted if any import was
affected by a change, not just imports up to the first non-affected line, as
clang-format currently does.

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D23972

llvm-svn: 280485

7 years ago[lit] Replace print with lit_config.note().
Logan Chien [Fri, 2 Sep 2016 13:56:05 +0000 (13:56 +0000)]
[lit] Replace print with lit_config.note().

This commit replaces print statement with lit_config.note().  This fixes
python3 support for check-libcxxabi.

llvm-svn: 280484

7 years agoAllow a C11 generic selection expression to select a function with the overloadable...
Aaron Ballman [Fri, 2 Sep 2016 13:45:40 +0000 (13:45 +0000)]
Allow a C11 generic selection expression to select a function with the overloadable attribute as the result expression without crashing. This fixes PR30201.

llvm-svn: 280483

7 years ago[DAGcombiner] Fix incorrect sinking of a truncate into the operand of a shift.
Andrea Di Biagio [Fri, 2 Sep 2016 11:29:09 +0000 (11:29 +0000)]
[DAGcombiner] Fix incorrect sinking of a truncate into the operand of a shift.

This fixes a regression introduced by revision 268094.
Revision 268094 added the following dag combine rule:
// trunc (shl x, K) -> shl (trunc x), K => K < vt.size / 2

That rule converts a truncate of a shift-by-constant into a shift of a truncated
value. We do this only if the shift count is less than half the size in bits of
the truncated value (K < vt.size / 2).

The problem is that the constraint on the shift count is incorrect, so the rule
doesn't work well in some cases involving vector types. The combine rule should
have been written instead like this:
// trunc (shl x, K) -> shl (trunc x), K => K < vt.getScalarSizeInBits()

Basically, if K is smaller than the "scalar size in bits" of the truncated value
then we know that by "sinking" the truncate into the operand of the shift we
would never accidentally make the shift undefined.

This patch fixes the check on the shift count, and adds test cases to make sure
that we don't regress the behavior.

Differential Revision: https://reviews.llvm.org/D24154

llvm-svn: 280482

7 years agoFixed a typo (LLVM/Support/CFG.h -> LLVM/IR/CFG.h)
Andrey Bokhanko [Fri, 2 Sep 2016 11:13:35 +0000 (11:13 +0000)]
Fixed a typo (LLVM/Support/CFG.h -> LLVM/IR/CFG.h)

llvm-svn: 280481

7 years agoReapply "Make Scalar::GetValue more consistent"
Pavel Labath [Fri, 2 Sep 2016 10:58:52 +0000 (10:58 +0000)]
Reapply "Make Scalar::GetValue more consistent"

this is a resubmission of r280476. The problem with the original commit was that it was printing
out all numbers as signed, which was wrong for unsigned numbers with the MSB set. Fix that and
add a unit test covering that case.

llvm-svn: 280480

7 years ago[PM] Try to fix an MSVC2013 failure due to finding a template
Chandler Carruth [Fri, 2 Sep 2016 10:49:58 +0000 (10:49 +0000)]
[PM] Try to fix an MSVC2013 failure due to finding a template
constructor when trying to do copy construction by adding an explicit
move constructor.

Will watch the bots to discover if this is sufficient.

llvm-svn: 280479

7 years agoRevert "Make Scalar::GetValue more consistent"
Pavel Labath [Fri, 2 Sep 2016 09:52:18 +0000 (09:52 +0000)]
Revert "Make Scalar::GetValue more consistent"

This reverts commit r280476 as it breaks several tests on i386. I was fixing an 32-bit
breakage, and I did not run the 32-bit test suite before submitting, oops.

llvm-svn: 280478

7 years agoBump up TestCallWithTimeout timeout
Pavel Labath [Fri, 2 Sep 2016 09:25:42 +0000 (09:25 +0000)]
Bump up TestCallWithTimeout timeout

Still a bit flaky on remote targets. Trying a larger bump this time. :/

llvm-svn: 280477

7 years agoMake Scalar::GetValue more consistent
Pavel Labath [Fri, 2 Sep 2016 09:25:36 +0000 (09:25 +0000)]
Make Scalar::GetValue more consistent

Summary:
It seems the original intention of the function was printing signed values in decimal format, and
unsigned values in hex (without the leading "0x"). However, signed and unsigned long were
exchanged, which lead to amusing test failures in TestMemoryFind.py.

Instead of just switching the two, I think we should just print everything in decimal here, as
the current behaviour is very confusing (especially when one does not request printing of types).
Nothing seems to depend on this behaviour except and we already have a way for the user to
request the format he wants when printing values for most commands (which presumably does not go
through this function).

I also add a unit tests for the function in question.

Reviewers: clayborg, granata.enrico

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D24126

llvm-svn: 280476

7 years ago[ELF] - Fix for: bug 30237 - lld does not implement -f option
George Rimar [Fri, 2 Sep 2016 09:13:05 +0000 (09:13 +0000)]
[ELF] - Fix for: bug 30237 - lld does not implement -f option

FreeBSD's libstdc++ build (used on tier-2 architectures) uses GNU ld's
-f <name> option, which sets the DT_AUXILIARY field to the specified name.
Multiple -f options may be specified and the DT_AUXILIARY entries
will be added in the order in which they appear.

Patch implements that option.

Differential revision: https://reviews.llvm.org/D24139

llvm-svn: 280475

7 years ago[InstCombine] Add test for insertelementinsts with constants.
Alexey Bataev [Fri, 2 Sep 2016 09:00:53 +0000 (09:00 +0000)]
[InstCombine] Add test for insertelementinsts with constants.

Added a tests that shows that several insertelementinsts with constant
indexes/data are not folded into a single shuffleinst.

llvm-svn: 280474

7 years ago[Support] - Fix possible crash in match() of llvm::Regex.
George Rimar [Fri, 2 Sep 2016 08:44:46 +0000 (08:44 +0000)]
[Support] - Fix possible crash in match() of llvm::Regex.

Crash was possible if match() method
was called on object that was moved or object
created with empty constructor.

Testcases updated.

DIfferential revision: https://reviews.llvm.org/D24123

llvm-svn: 280473

7 years ago[llvm-readobj] - Teach readobj to print DT_AUXILIARY dynamic tag in human readable...
George Rimar [Fri, 2 Sep 2016 07:35:19 +0000 (07:35 +0000)]
[llvm-readobj] - Teach readobj to print DT_AUXILIARY dynamic tag in human readable form.

Previously DT_AUXILIARY was unknown, patch fixes that.

Differential revision: https://reviews.llvm.org/D24138

llvm-svn: 280471

7 years ago[SimplifyCFG] Add a workaround to fix PR30188
James Molloy [Fri, 2 Sep 2016 07:29:00 +0000 (07:29 +0000)]
[SimplifyCFG] Add a workaround to fix PR30188

We're sinking stores, which is a good thing, but in the process creating selects for the store address operand, which SROA/Mem2Reg can't look through, which caused serious regressions.

The real fix is in SROA, which I'll be looking into.

llvm-svn: 280470

7 years ago[asan] Move scariness_score_test.cc to a common subdirectory
Filipe Cabecinhas [Fri, 2 Sep 2016 07:18:35 +0000 (07:18 +0000)]
[asan] Move scariness_score_test.cc to a common subdirectory

Summary:
Only one of the tests in it doesn't work on OS X.
On Windows it seems that everything that is being moved is also
supported.

The abort() test wasn't copied over (original case 22). This is because
it doesn't work on OS X.

Reviewers: kcc, eugenis, vitalybuka

Subscribers: kubabrecka, llvm-commits
llvm-svn: 280469

7 years agoDrop '@brief' from doxygen comments
Tobias Grosser [Fri, 2 Sep 2016 06:33:33 +0000 (06:33 +0000)]
Drop '@brief' from doxygen comments

LLVM's coding guideline suggests to not use @brief for one-sentence doxygen
comments to improve readability. Switch this once and for all to ensure people
do not copy @brief comments from other parts of Polly, when writing new code.

llvm-svn: 280468

7 years ago[AVX-512] Move tests for masked floating point logical operations to avx512dqvl-intri...
Craig Topper [Fri, 2 Sep 2016 06:11:31 +0000 (06:11 +0000)]
[AVX-512] Move tests for masked floating point logical operations to avx512dqvl-intrinsics-upgrade.ll since they have now been autoupgraded.

llvm-svn: 280467

7 years ago[AVX-512] Remove floating point logical operation instrinsics and replace them with...
Craig Topper [Fri, 2 Sep 2016 05:29:17 +0000 (05:29 +0000)]
[AVX-512] Remove floating point logical operation instrinsics and replace them with native IR.

llvm-svn: 280466

7 years ago[AVX-512] Add more patterns for masked and broadcasted logical operations where the...
Craig Topper [Fri, 2 Sep 2016 05:29:13 +0000 (05:29 +0000)]
[AVX-512] Add more patterns for masked and broadcasted logical operations where the select or broadcast has a floating point type.

These are needed in order to remove the masked floating point logical operation intrinsics and use native IR.

llvm-svn: 280465

7 years ago[AVX-512] Add execution domain fixing for logical operations with broadcast loads...
Craig Topper [Fri, 2 Sep 2016 05:29:09 +0000 (05:29 +0000)]
[AVX-512] Add execution domain fixing for logical operations with broadcast loads. This builds on the handling of masked ops since we need to keep element size the same.

llvm-svn: 280464

7 years ago[X86] Strengthen some SDNode type constraints.
Craig Topper [Fri, 2 Sep 2016 04:25:33 +0000 (04:25 +0000)]
[X86] Strengthen some SDNode type constraints.

llvm-svn: 280463

7 years ago[AVX-512] Add NoVLX Predicates to some patterns so they don't rely on pattern orderin...
Craig Topper [Fri, 2 Sep 2016 04:25:30 +0000 (04:25 +0000)]
[AVX-512] Add NoVLX Predicates to some patterns so they don't rely on pattern ordering to be lower priority than their equivalent VLX pattern.

llvm-svn: 280462

7 years ago[Docs] Fix another typo in the Error/Expected docs.
Lang Hames [Fri, 2 Sep 2016 03:50:50 +0000 (03:50 +0000)]
[Docs] Fix another typo in the Error/Expected docs.

llvm-svn: 280461

7 years ago[Docs] Fix a couple of typos in the Error/Expected docs.
Lang Hames [Fri, 2 Sep 2016 03:46:08 +0000 (03:46 +0000)]
[Docs] Fix a couple of typos in the Error/Expected docs.

llvm-svn: 280460