platform/upstream/llvm.git
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

7 years ago[ORC] Fix some missing fields in OrcRemoteTargetClient's move constructor.
Lang Hames [Fri, 2 Sep 2016 03:45:44 +0000 (03:45 +0000)]
[ORC] Fix some missing fields in OrcRemoteTargetClient's move constructor.

llvm-svn: 280459

7 years agoAdd missing &. NFC.
George Burgess IV [Fri, 2 Sep 2016 03:38:43 +0000 (03:38 +0000)]
Add missing &. NFC.

llvm-svn: 280458

7 years ago[PowerPC] hasAndNotCompare should return true
Hal Finkel [Fri, 2 Sep 2016 02:58:25 +0000 (02:58 +0000)]
[PowerPC] hasAndNotCompare should return true

As Sanjay suggested when he added the hook, PPC should return true from
hasAndNotCompare. We have an efficient negated 'and' on PPC (which can feed a
compare).

Fixes PR27203.

llvm-svn: 280457

7 years agoAdd clang-reorder-fields to clang-tools-extra
Alexander Shaposhnikov [Fri, 2 Sep 2016 02:56:07 +0000 (02:56 +0000)]
Add clang-reorder-fields to clang-tools-extra

This diff adds v0 of clang-reorder-fields tool to clang/tools/extra.
The main idea behind this tool is to simplify and make less error-prone refactoring of large codebases when
someone needs to change the order fields of a struct/class (for example to remove excessive padding).

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

llvm-svn: 280456

7 years ago[lit] Fail testing if a googletest executable crashes during test discovery
Greg Parker [Fri, 2 Sep 2016 02:44:07 +0000 (02:44 +0000)]
[lit] Fail testing if a googletest executable crashes during test discovery

googletest formatted tests are discovered by running the test executable.
Previously testing would silently succeed if the test executable crashed
during the discovery process. Now testing fails with "error: unable to
discover google-tests ..." if the test executable exits with a non-zero status.

llvm-svn: 280455

7 years ago[PowerPC] Add a pattern for a runtime bit check
Hal Finkel [Fri, 2 Sep 2016 02:34:44 +0000 (02:34 +0000)]
[PowerPC] Add a pattern for a runtime bit check

Following a suggestion by Sanjay, we should lower:

  %shl = shl i32 1, %y
  %and = and i32 %x, %shl
  %cmp = icmp eq i32 %and, %shl
  ret i1 %cmp

into:

  subfic r4, r4, 32
  rlwnm r3, r3, r4, 31, 31

Add this pattern and some associated patterns for the 64-bit case and the
not-equal case. Fixes PR27356.

llvm-svn: 280454

7 years agorevert r280429 and r280425:
Dehao Chen [Fri, 2 Sep 2016 01:59:27 +0000 (01:59 +0000)]
revert r280429 and r280425:

r280425 | dehao | 2016-09-01 16:15:50 -0700 (Thu, 01 Sep 2016) | 9 lines

Refactor LICM pass in preparation for LoopSink pass.

Summary: LoopSink pass uses some common function in LICM. This patch refactor the LICM code to make it usable by LoopSink pass (https://reviews.llvm.org/D22778).

r280429 | dehao | 2016-09-01 16:31:25 -0700 (Thu, 01 Sep 2016) | 9 lines

Refactor LICM to expose canSinkOrHoistInst to LoopSink pass.

Summary: LoopSink pass shares the same canSinkOrHoistInst functionality with LICM pass. This patch exposes this function in preparation of https://reviews.llvm.org/D22778
llvm-svn: 280453

7 years agorevert r280432:
Dehao Chen [Fri, 2 Sep 2016 01:47:13 +0000 (01:47 +0000)]
revert r280432:

r280432 | dehao | 2016-09-01 16:51:37 -0700 (Thu, 01 Sep 2016) | 9 lines

Explicitly require DominatorTreeAnalysis pass for instsimplify pass.

Summary: DominatorTreeAnalysis is always required by instsimplify.
llvm-svn: 280452

7 years agollvm/test/Transforms/GCOVProfiling/three-element-mdnode.ll: Use %/T instead of %T...
NAKAMURA Takumi [Fri, 2 Sep 2016 01:33:00 +0000 (01:33 +0000)]
llvm/test/Transforms/GCOVProfiling/three-element-mdnode.ll: Use %/T instead of %T, not to emit backslashes.

llvm-svn: 280451

7 years agobugpoint: clang-format all of bugpoint. NFC
Justin Bogner [Fri, 2 Sep 2016 01:21:37 +0000 (01:21 +0000)]
bugpoint: clang-format all of bugpoint. NFC

I'm going to clean up the APIs here a bit and touch many many lines
anyway.

llvm-svn: 280450

7 years agoraw_pwrite_stream_test.cpp: _putenv_s() may be assumed as win32-generic.
NAKAMURA Takumi [Fri, 2 Sep 2016 01:20:18 +0000 (01:20 +0000)]
raw_pwrite_stream_test.cpp: _putenv_s() may be assumed as win32-generic.

llvm-svn: 280449

7 years agoIfConversion: Don't count branches in # of duplicates.
Kyle Butt [Fri, 2 Sep 2016 01:20:06 +0000 (01:20 +0000)]
IfConversion: Don't count branches in # of duplicates.

If the entire blocks match, we would count the branch instructions
toward the number of duplicated instructions. This doesn't match what we
do elsewhere, and was causing a bug.

llvm-svn: 280448

7 years ago[PM] Add a unittest for invalidating module analyses with an SCC pass.
Chandler Carruth [Fri, 2 Sep 2016 01:16:27 +0000 (01:16 +0000)]
[PM] Add a unittest for invalidating module analyses with an SCC pass.

This wasn't really well explicitly tested with a nice unittest before.
It seems good to have reasonably broken out unittests for this kind of
functionality as I'm workin go other invalidation features to make sure
none of the existing ones regress.

This still has too much duplicated code, I plan to factor that out in
a subsequent commit to use common helpers for repeated parts of this.

llvm-svn: 280447

7 years ago[PM] (NFC) Split the IR parsing into a fixture so that I can split out
Chandler Carruth [Fri, 2 Sep 2016 01:14:05 +0000 (01:14 +0000)]
[PM] (NFC) Split the IR parsing into a fixture so that I can split out
more testing into other test routines while using the same core module.

llvm-svn: 280446

7 years agoFix a real temp file leak in FileOutputBuffer
Reid Kleckner [Fri, 2 Sep 2016 01:10:53 +0000 (01:10 +0000)]
Fix a real temp file leak in FileOutputBuffer

If we failed to commit the buffer but did not die to a signal, the temp
file would remain on disk on Windows. Having an open file mapping and
file handle prevents the file from being deleted. I am choosing not to
add an assertion of success on the temp file removal, since virus
scanners and other environmental things can often cause removal to fail
in real world tools.

Also fix more temp file leaks in unit tests.

llvm-svn: 280445

7 years ago[PM] (NFC) Refactor the CGSCC pass manager tests to use lambda-based
Chandler Carruth [Fri, 2 Sep 2016 01:08:04 +0000 (01:08 +0000)]
[PM] (NFC) Refactor the CGSCC pass manager tests to use lambda-based
passes.

This simplifies the test some and makes it more focused and clear what
is being tested. It will also make it much easier to extend with further
testing of different pass behaviors.

I've also replaced a pointless module pass with running the requires
pass directly as that is all that it was really doing.

llvm-svn: 280444

7 years agoTry to fix some temp file leaks in SupportTests, PR18335
Reid Kleckner [Fri, 2 Sep 2016 00:51:34 +0000 (00:51 +0000)]
Try to fix some temp file leaks in SupportTests, PR18335

llvm-svn: 280443

7 years ago[CFGPrinter] Display branch weight on the edges
Adam Nemet [Fri, 2 Sep 2016 00:28:26 +0000 (00:28 +0000)]
[CFGPrinter] Display branch weight on the edges

Summary:
This is pretty useful especially in connection with
BFI's -view-block-freq-propagation-dags.  It helped me to track down the
bug that is being fixed in D24118.

While -view-block-freq-propagation-dags displays the high-level
information with static heuristics included (and block frequencies), the
new thing only shows the raw weight as presented by PGO without any of
the static estimates.  This helps to distinguished what has been
measured vs. estimated.

For the sample loop in D24118, -view-block-freq-propagation-dags=integer
looks like this:

https://reviews.llvm.org/F2381352

While with -view-cfg-only you can see the underlying branch weights:

https://reviews.llvm.org/F2392296

Reviewers: dexonsmith, bogner, davidxl

Subscribers: llvm-commits

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

llvm-svn: 280442

7 years ago[PowerPC] Don't apply the PPC64 address-formation peephole for offsets greater than 7
Hal Finkel [Fri, 2 Sep 2016 00:28:20 +0000 (00:28 +0000)]
[PowerPC] Don't apply the PPC64 address-formation peephole for offsets greater than 7

When applying our address-formation PPC64 peephole, we are reusing the @ha TOC
addis value with the low parts associated with different offsets (i.e.
different effective symbol addends). We were assuming this was okay so long as
the offsets were less than the alignment of the global variable being accessed.
This ignored the fact, however, that the TOC base pointer itself need only be
8-byte aligned. As a result, what we were doing is legal only for offsets less
than 8 regardless of the alignment of the object being accessed.

Fixes PR28727.

llvm-svn: 280441

7 years ago[PowerPC] Don't consider fusion in PPC64 address-formation peephole
Hal Finkel [Fri, 2 Sep 2016 00:27:50 +0000 (00:27 +0000)]
[PowerPC] Don't consider fusion in PPC64 address-formation peephole

The logic in this function assumes that the P8 supports fusion of addis/addi,
but it does not. As a result, there is no advantage to restricting our peephole
application, merging addi instructions into dependent memory accesses, even
when the addi has multiple users, regardless of whether or not we're optimizing
for size.

We might need something like this again for the P9; I suspect we'll revisit
this code when we work on P9 tuning.

llvm-svn: 280440

7 years ago[StreamExecutor] Pass device memory by ref
Jason Henline [Fri, 2 Sep 2016 00:25:52 +0000 (00:25 +0000)]
[StreamExecutor] Pass device memory by ref

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

Since GlobalDeviceMemory will no longer by copy-constructible, we must
pass instances by reference rather than by value.

Reviewers: jlebar

Subscribers: jprice, parallel_libs-commits

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

llvm-svn: 280439

7 years agoRevert https://reviews.llvm.org/D23279 because the tests have failed on several platforms
Alexander Shaposhnikov [Fri, 2 Sep 2016 00:24:06 +0000 (00:24 +0000)]
Revert https://reviews.llvm.org/D23279 because the tests have failed on several platforms

llvm-svn: 280438

7 years ago[SE] Make Kernel movable
Jason Henline [Fri, 2 Sep 2016 00:22:05 +0000 (00:22 +0000)]
[SE] Make Kernel movable

Summary:
Kernel is basically just a smart pointer to the underlying
implementation, so making it movable prevents having to store a
std::unique_ptr to it.

Reviewers: jlebar

Subscribers: jprice, parallel_libs-commits

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

llvm-svn: 280437

7 years agoClean up handling of reading module files from stdin. Don't bother trying to
Richard Smith [Fri, 2 Sep 2016 00:18:05 +0000 (00:18 +0000)]
Clean up handling of reading module files from stdin. Don't bother trying to
look for a corresponding file, since we're not going to read it anyway.

No observable behavior change (though we now avoid pointlessly trying to stat
or open a file named "-").

llvm-svn: 280436

7 years agoRefactor to avoid holding a reference to a container element that could go away
Richard Smith [Fri, 2 Sep 2016 00:10:28 +0000 (00:10 +0000)]
Refactor to avoid holding a reference to a container element that could go away
during this function, and to avoid rolling back changes to the module manager's
data structures. Instead, we defer registering the module file until after we
have successfully finished loading it.

llvm-svn: 280434

7 years agoExplicitly require DominatorTreeAnalysis pass for instsimplify pass.
Dehao Chen [Thu, 1 Sep 2016 23:51:37 +0000 (23:51 +0000)]
Explicitly require DominatorTreeAnalysis pass for instsimplify pass.

Summary: DominatorTreeAnalysis is always required by instsimplify.

Reviewers: davidxl, danielcdh

Subscribers: llvm-commits

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

llvm-svn: 280432

7 years agoAdd clang-reorder-fields to clang-tools-extra
Alexander Shaposhnikov [Thu, 1 Sep 2016 23:49:48 +0000 (23:49 +0000)]
Add clang-reorder-fields to clang-tools-extra

This diff adds v0 of clang-reorder-fields tool to clang/tools/extra.
The main idea behind this tool is to simplify and make less error-prone refactoring of large codebases when
someone needs to change the order fields of a struct/class (for example to remove excess padding).

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

llvm-svn: 280431

7 years ago[SelectionDAGBuilder] Add const to relevant places
Aditya Kumar [Thu, 1 Sep 2016 23:35:26 +0000 (23:35 +0000)]
[SelectionDAGBuilder] Add const to relevant places

Reviewers: hans, evandro, sebpop

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

llvm-svn: 280430

7 years agoRefactor LICM to expose canSinkOrHoistInst to LoopSink pass.
Dehao Chen [Thu, 1 Sep 2016 23:31:25 +0000 (23:31 +0000)]
Refactor LICM to expose canSinkOrHoistInst to LoopSink pass.

Summary: LoopSink pass shares the same canSinkOrHoistInst functionality with LICM pass. This patch exposes this function in preparation of https://reviews.llvm.org/D22778

Reviewers: chandlerc, davidxl, danielcdh

Subscribers: llvm-commits

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

llvm-svn: 280429

7 years ago[StreamExecutor] Read dev array directly in test
Jason Henline [Thu, 1 Sep 2016 23:27:39 +0000 (23:27 +0000)]
[StreamExecutor] Read dev array directly in test

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

Use the SimpleHostPlatformDevice allocate methods to create device
arrays for tests, and check for successful copies by dereferncing the
device array handle directly because we know it is really a host
pointer.

Reviewers: jlebar

Subscribers: jprice, parallel_libs-commits

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

llvm-svn: 280428

7 years agoRefactor replaceDominatedUsesWith to have a flag to control whether to replace uses...
Dehao Chen [Thu, 1 Sep 2016 23:26:48 +0000 (23:26 +0000)]
Refactor replaceDominatedUsesWith to have a flag to control whether to replace uses in BB itself.

Summary: This is in preparation for LoopSink pass which calls replaceDominatedUsesWith to update after sinking.

Reviewers: chandlerc, davidxl, danielcdh

Subscribers: llvm-commits

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

llvm-svn: 280427