platform/upstream/llvm.git
7 years ago[AArch64] Support stackmap/patchpoint in getInstSizeInBytes
Diana Picus [Tue, 13 Sep 2016 07:45:17 +0000 (07:45 +0000)]
[AArch64] Support stackmap/patchpoint in getInstSizeInBytes

We currently return 4 for stackmaps and patchpoints, which is very optimistic
and can in rare cases cause the branch relaxation pass to fail to relax certain
branches.

This patch causes getInstSizeInBytes to return a pessimistic estimate of the
size as the number of bytes requested in the stackmap/patchpoint. In the future,
we could provide a more accurate estimate by sharing some of the logic in
AArch64::LowerSTACKMAP/PATCHPOINT.

Fixes part of https://llvm.org/bugs/show_bug.cgi?id=28750

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

llvm-svn: 281301

7 years ago[X86] Remove masked shufpd/shufps intrinsics and autoupgrade to native vector shuffle...
Craig Topper [Tue, 13 Sep 2016 07:40:53 +0000 (07:40 +0000)]
[X86] Remove masked shufpd/shufps intrinsics and autoupgrade to native vector shuffles. They were removed from clang previously but accidentally left in the backend.

llvm-svn: 281300

7 years ago[X86] Remove some dead intrinsics. They aren't implemented and clang doesn't referenc...
Craig Topper [Tue, 13 Sep 2016 07:40:48 +0000 (07:40 +0000)]
[X86] Remove some dead intrinsics. They aren't implemented and clang doesn't reference them.

llvm-svn: 281299

7 years agoAllow register variables in naked functions.
Nikola Smiljanic [Tue, 13 Sep 2016 07:02:02 +0000 (07:02 +0000)]
Allow register variables in naked functions.

llvm-svn: 281298

7 years ago[Docs] Fix a broken link in the Kaleidoscope tutorial.
Davide Italiano [Tue, 13 Sep 2016 06:31:37 +0000 (06:31 +0000)]
[Docs] Fix a broken link in the Kaleidoscope tutorial.

Patch by: Alfred Perlstein <alfred@FreeBSD.org>

llvm-svn: 281297

7 years ago[LTO] Only expose the dataLayout string instead of the whole module.
Davide Italiano [Tue, 13 Sep 2016 06:29:17 +0000 (06:29 +0000)]
[LTO] Only expose the dataLayout string instead of the whole module.

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

llvm-svn: 281296

7 years agoAdapt test case to recent change in Global Variable Definition
Tobias Grosser [Tue, 13 Sep 2016 05:19:26 +0000 (05:19 +0000)]
Adapt test case to recent change in Global Variable Definition

llvm-svn: 281295

7 years agoclang-format: Add Java detection to git-clang-format.
Stephen Hines [Tue, 13 Sep 2016 05:00:20 +0000 (05:00 +0000)]
clang-format: Add Java detection to git-clang-format.

Summary: This change adds "java" to the list of known extensions that clang-format supports.

Patch by Luis Hector Chavez

Reviewers: djasper

Subscribers: srhines, cfe-commits

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

llvm-svn: 281294

7 years agoReapply r281276 with passing -emit-llvm in one of the tests
Adam Nemet [Tue, 13 Sep 2016 04:32:40 +0000 (04:32 +0000)]
Reapply r281276 with passing -emit-llvm in one of the tests

Original commit message:

Add -fdiagnostics-show-hotness

Summary:
I've recently added the ability for optimization remarks to include the
hotness of the corresponding code region.  This uses PGO and allows
filtering of the optimization remarks by relevance.  The idea was first
discussed here:
http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334

The general goal is to produce a YAML file with the remarks.  Then, an
external tool could dynamically filter these by hotness and perhaps by
other things.

That said it makes sense to also expose this at the more basic level
where we just include the hotness info with each optimization remark.
For example, in D22694, the clang flag was pretty useful to measure the
overhead of the additional analyses required to include hotness.
(Without the flag we don't even run the analyses.)

For the record, Hal has already expressed support for the idea of this
patch on IRC.

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

llvm-svn: 281293

7 years agoRevert "[Support][CommandLine] Add cl::getRegisteredSubcommands()"
Zachary Turner [Tue, 13 Sep 2016 04:11:57 +0000 (04:11 +0000)]
Revert "[Support][CommandLine] Add cl::getRegisteredSubcommands()"

This reverts r281290, as it breaks unit tests.
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/303

llvm-svn: 281292

7 years agoReduce the number of simultaneous debug sessions to 10 and remove
Jason Molenda [Tue, 13 Sep 2016 02:45:45 +0000 (02:45 +0000)]
Reduce the number of simultaneous debug sessions to 10 and remove
the expectedFlakeyDarwin annotation.

I've been running this test in isolation on my macOS Sierra system
and haven't seen a failure in 20-30 runs.  The number of simultaneous
debug sessions that it spins up could be a problem when the testbots
are running under load, so I'm reducing this from 20 simultaneous
debug sessions to see if we can get enough stability to leave this
enabled.

llvm-svn: 281291

7 years ago[Support][CommandLine] Add cl::getRegisteredSubcommands()
Dean Michael Berris [Tue, 13 Sep 2016 02:35:00 +0000 (02:35 +0000)]
[Support][CommandLine] Add cl::getRegisteredSubcommands()

This should allow users of the library to get a range to iterate through
all the subcommands that are registered to the global parser. This
allows users to define subcommands in libraries that self-register to
have dispatch done at a different stage (like main). It allows for
writing code like the following:

    for (auto *S : cl::getRegisteredSubcommands()) {
      if (*S) {
// Dispatch on S->getName().
      }
    }

This change also contains tests that show this usage pattern.

Reviewers: zturner, dblaikie, echristo

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 281290

7 years ago[lib/LTO] Expose getModule() in lto::InputFile.
Davide Italiano [Tue, 13 Sep 2016 02:22:02 +0000 (02:22 +0000)]
[lib/LTO] Expose getModule() in lto::InputFile.

lld will use this to get the datalayout string and emit a
diagnostic if empty.

llvm-svn: 281289

7 years agoAdd a few const's (thanks Zachary) and return shared or unique pointers
Jim Ingham [Tue, 13 Sep 2016 01:58:08 +0000 (01:58 +0000)]
Add a few const's (thanks Zachary) and return shared or unique pointers
in places where they help prevent leaks.

llvm-svn: 281288

7 years agoHandle empty message in static_asserts.
Richard Trieu [Tue, 13 Sep 2016 01:37:01 +0000 (01:37 +0000)]
Handle empty message in static_asserts.

llvm-svn: 281287

7 years agoFix interaction between serialization and c++1z feature.
Richard Trieu [Tue, 13 Sep 2016 01:20:40 +0000 (01:20 +0000)]
Fix interaction between serialization and c++1z feature.

In c++1z, static_assert is not required to have a StringLiteral message, where
previously it was required.  Update the AST Reader to be able to handle a
null StringLiteral.

llvm-svn: 281286

7 years agoUpdate Clang for D20147 ("DebugInfo: New metadata representation for global variables.")
Peter Collingbourne [Tue, 13 Sep 2016 01:13:19 +0000 (01:13 +0000)]
Update Clang for D20147 ("DebugInfo: New metadata representation for global variables.")

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

llvm-svn: 281285

7 years agoDebugInfo: New metadata representation for global variables.
Peter Collingbourne [Tue, 13 Sep 2016 01:12:59 +0000 (01:12 +0000)]
DebugInfo: New metadata representation for global variables.

This patch reverses the edge from DIGlobalVariable to GlobalVariable.
This will allow us to more easily preserve debug info metadata when
manipulating global variables.

Fixes PR30362. A program for upgrading test cases is attached to that
bug.

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

llvm-svn: 281284

7 years ago[DAG] Refactor BUILD_VECTOR combine to make it easier to extend. NFCI.
Michael Kuperstein [Tue, 13 Sep 2016 00:57:43 +0000 (00:57 +0000)]
[DAG] Refactor BUILD_VECTOR combine to make it easier to extend. NFCI.

This should make it easier to add cases that we currently don't cover,
like supporting more kinds of type mismatches and more than 2 input vectors.

llvm-svn: 281283

7 years agoFix an issue where LLDB was not masking enough bits off of objc classes data() pointe...
Enrico Granata [Tue, 13 Sep 2016 00:22:49 +0000 (00:22 +0000)]
Fix an issue where LLDB was not masking enough bits off of objc classes data() pointers, effectively rendering us unable to generate descriptors for some classes

Fixes rdar://27758358

llvm-svn: 281282

7 years agoX86: Conditional tail calls should not have isBarrier = 1
Hans Wennborg [Tue, 13 Sep 2016 00:21:32 +0000 (00:21 +0000)]
X86: Conditional tail calls should not have isBarrier = 1

That confuses e.g. machine basic block placement, which then doesn't
realize that control can fall through a block that ends with a conditional
tail call. Instead, isBranch=1 should be set.

Also, mark EFLAGS as used by these instructions.

llvm-svn: 281281

7 years agoTemporarily Revert "[MC] Defer asm errors to post-statement failure" as it's causing...
Eric Christopher [Tue, 13 Sep 2016 00:19:29 +0000 (00:19 +0000)]
Temporarily Revert "[MC] Defer asm errors to post-statement failure" as it's causing errors on the sanitizer bots.

This reverts commit r281249.

llvm-svn: 281280

7 years agoRevert "Add -fdiagnostics-show-hotness"
Adam Nemet [Tue, 13 Sep 2016 00:16:49 +0000 (00:16 +0000)]
Revert "Add -fdiagnostics-show-hotness"

This reverts commit r281276.

Many bots are failing.

llvm-svn: 281279

7 years ago[DebugInfo] Deduplicate debug info limiting logic
Reid Kleckner [Tue, 13 Sep 2016 00:01:23 +0000 (00:01 +0000)]
[DebugInfo] Deduplicate debug info limiting logic

We should be doing the same checks when a type is completed as we do
when a complete type is used during emission. Previously, we duplicated
the logic, and it got out of sync. This could be observed with
dllimported classes.

Also reduce a test case for this slightly.

Implementing review feedback from David Blaikie on r281057.

llvm-svn: 281278

7 years ago[Sema] Fix PR30346: relax __builtin_object_size checks.
George Burgess IV [Mon, 12 Sep 2016 23:50:35 +0000 (23:50 +0000)]
[Sema] Fix PR30346: relax __builtin_object_size checks.

This patch makes us act more conservatively when trying to determine
the objectsize for an array at the end of an object. This is in
response to code like the following:

```
struct sockaddr {
  /* snip */
  char sa_data[14];
};

void foo(const char *s) {
  size_t slen = strlen(s) + 1;
  size_t added_len = slen <= 14 ? 0 : slen - 14;
  struct sockaddr *sa = malloc(sizeof(struct sockaddr) + added_len);
  strcpy(sa->sa_data, s);
  // ...
}
```

`__builtin_object_size(sa->sa_data, 1)` would return 14, when there
could be more than 14 bytes at `sa->sa_data`.

Code like this is apparently not uncommon. FreeBSD's manual even
explicitly mentions this pattern:
https://www.freebsd.org/doc/en/books/developers-handbook/sockets-essential-functions.html
(section 7.5.1.1.2).

In light of this, we now just give up on any array at the end of an
object if we can't find the object's initial allocation.

I lack numbers for how much more conservative we actually become as a
result of this change, so I chose the fix that would make us as
compatible with GCC as possible. If we want to be more aggressive, I'm
happy to consider some kind of whitelist or something instead.

llvm-svn: 281277

7 years agoAdd -fdiagnostics-show-hotness
Adam Nemet [Mon, 12 Sep 2016 23:48:16 +0000 (23:48 +0000)]
Add -fdiagnostics-show-hotness

Summary:
I've recently added the ability for optimization remarks to include the
hotness of the corresponding code region.  This uses PGO and allows
filtering of the optimization remarks by relevance.  The idea was first
discussed here:
http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334

The general goal is to produce a YAML file with the remarks.  Then, an
external tool could dynamically filter these by hotness and perhaps by
other things.

That said it makes sense to also expose this at the more basic level
where we just include the hotness info with each optimization remark.
For example, in D22694, the clang flag was pretty useful to measure the
overhead of the additional analyses required to include hotness.
(Without the flag we don't even run the analyses.)

For the record, Hal has already expressed support for the idea of this
patch on IRC.

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

llvm-svn: 281276

7 years agoFix a long comment line
Adam Nemet [Mon, 12 Sep 2016 23:48:11 +0000 (23:48 +0000)]
Fix a long comment line

llvm-svn: 281275

7 years ago[OptDiag] Add getHotness accessor
Adam Nemet [Mon, 12 Sep 2016 23:46:34 +0000 (23:46 +0000)]
[OptDiag] Add getHotness accessor

llvm-svn: 281274

7 years agoThis is the main part of a change to add breakpoint save and restore to lldb.
Jim Ingham [Mon, 12 Sep 2016 23:10:56 +0000 (23:10 +0000)]
This is the main part of a change to add breakpoint save and restore to lldb.

Still to come:
1) SB API's
2) Testcases
3) Loose ends:
   a) serialize Thread options
   b) serialize Exception resolvers
4) "break list --file" should list breakpoints contained in a file and
   "break read -f 1 3 5" should then read in only those breakpoints.

<rdar://problem/12611863>

llvm-svn: 281273

7 years ago[LVI] Complete the abstract of the cache layer [NFCI]
Philip Reames [Mon, 12 Sep 2016 22:38:44 +0000 (22:38 +0000)]
[LVI] Complete the abstract of the cache layer [NFCI]

Convert the previous introduced is-a relationship between the LVICache and LVIImple clases into a has-a relationship and hide all the implementation details of the cache from the lazy query layer.

The only slightly concerning change here is removing the addition of a queried block into the SeenBlock set in LVIImpl::getBlockValue.  As far as I can tell, this was effectively dead code.  I think it *used* to be the case that getCachedValueInfo wasn't const and might end up inserting elements in the cache during lookup.  That's no longer true and hasn't been for a while.  I did fixup the const usage to make that more obvious.

llvm-svn: 281272

7 years ago[CMake] Fix linker-as-ld to symlink instead of copy lld
Chris Bieneman [Mon, 12 Sep 2016 22:38:43 +0000 (22:38 +0000)]
[CMake] Fix linker-as-ld to symlink instead of copy lld

Summary: This test fails if you're building with BUILD_SHARED_LIBS because the LLVM libraries are found via @rpath. Symlinking instead of copying should be sufficiently robust for the test case.

Reviewers: llvm-commits

Subscribers: davide

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

llvm-svn: 281271

7 years agoadd more tests for PR30273
Sanjay Patel [Mon, 12 Sep 2016 22:28:29 +0000 (22:28 +0000)]
add more tests for PR30273

llvm-svn: 281270

7 years ago[ORC] Clang-format RPCSerialization.h.
Lang Hames [Mon, 12 Sep 2016 22:05:14 +0000 (22:05 +0000)]
[ORC] Clang-format RPCSerialization.h.

llvm-svn: 281269

7 years ago[ORC] Add some more documentation to RPCSerialization.h.
Lang Hames [Mon, 12 Sep 2016 22:05:12 +0000 (22:05 +0000)]
[ORC] Add some more documentation to RPCSerialization.h.

llvm-svn: 281268

7 years ago[LVI] Sink a couple more cache manipulation routines into the cache itself [NFCI]
Philip Reames [Mon, 12 Sep 2016 22:03:36 +0000 (22:03 +0000)]
[LVI] Sink a couple more cache manipulation routines into the cache itself [NFCI]

The only interesting bit here is the refactor of the handle callback and even that's pretty straight-forward.

llvm-svn: 281267

7 years ago[LVI] Abstract out the actual cache logic [NFCI]
Philip Reames [Mon, 12 Sep 2016 21:46:58 +0000 (21:46 +0000)]
[LVI] Abstract out the actual cache logic [NFCI]

Seperate the caching logic from the implementation of the lazy analysis.  For the moment, the lazy analysis impl has a is-a relationship with the cache; this will change to a has-a relationship shortly.  This was done as two steps merely to keep the changes simple and the diff understandable.

llvm-svn: 281266

7 years agoAdd comments.
Rui Ueyama [Mon, 12 Sep 2016 21:44:29 +0000 (21:44 +0000)]
Add comments.

llvm-svn: 281265

7 years agoconfig: Use _LIBCPP_TYPE_VIS_ONLY with enum class
Shoaib Meenai [Mon, 12 Sep 2016 21:41:12 +0000 (21:41 +0000)]
config: Use _LIBCPP_TYPE_VIS_ONLY with enum class

An enum class has associated type info. In the Microsoft ABI, type info
is emitted in the COMDAT section and isn't exported, so clang rightfully
complains about __declspec(dllexport) being unused for an enum class.
On other platforms, we still want to export the type info.

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

llvm-svn: 281264

7 years agoRevert r281215, it caused PR30358.
Nico Weber [Mon, 12 Sep 2016 21:40:50 +0000 (21:40 +0000)]
Revert r281215, it caused PR30358.

llvm-svn: 281263

7 years agoattempt to unbreak build after r281254
Nico Weber [Mon, 12 Sep 2016 21:15:44 +0000 (21:15 +0000)]
attempt to unbreak build after r281254

llvm-svn: 281262

7 years agoCodeGen: use some range-based for loops
Saleem Abdulrasool [Mon, 12 Sep 2016 21:15:23 +0000 (21:15 +0000)]
CodeGen: use some range-based for loops

Use range-based for loops to simplify the logic.  Add an explicit check for
MachO as the inline asm uses MachO specific directives.

llvm-svn: 281261

7 years ago[MachO] Factor out a fair amount of duplicated code. NFCI.
Davide Italiano [Mon, 12 Sep 2016 21:07:26 +0000 (21:07 +0000)]
[MachO] Factor out a fair amount of duplicated code. NFCI.

llvm-svn: 281260

7 years agoAdd a couple of test files missed in r281258.
Richard Smith [Mon, 12 Sep 2016 21:07:09 +0000 (21:07 +0000)]
Add a couple of test files missed in r281258.

llvm-svn: 281259

7 years ago[modules] When we merge two definitions of a function, mark the retained
Richard Smith [Mon, 12 Sep 2016 21:06:40 +0000 (21:06 +0000)]
[modules] When we merge two definitions of a function, mark the retained
definition as visible in the discarded definition's module, as we do for
other kinds of definition.

llvm-svn: 281258

7 years ago[ORC] Add missing <thread> header to RPCSerialization.h.
Lang Hames [Mon, 12 Sep 2016 20:45:01 +0000 (20:45 +0000)]
[ORC] Add missing <thread> header to RPCSerialization.h.

llvm-svn: 281257

7 years ago[Cmake] Use Cmake's default RPATH for unittest.
Davide Italiano [Mon, 12 Sep 2016 20:44:53 +0000 (20:44 +0000)]
[Cmake] Use Cmake's default RPATH for unittest.

Similarly to what was done in r280791 for llvm/.
This should fix a bunch of failures I saw while
trying a BUILD_SHARED_LIBS build on MacOS.
Still there are some failures, but this is a step
forward.

Thanks a lot to Chris Bieneman for the suggested
fix (in PR30345)

llvm-svn: 281256

7 years ago[sanitizer] replace CHECK with CHECK_XY in two places for better diagnostics
Kostya Serebryany [Mon, 12 Sep 2016 20:39:13 +0000 (20:39 +0000)]
[sanitizer] replace CHECK with CHECK_XY in two places for better diagnostics

llvm-svn: 281255

7 years ago[ORC] Replace the serialize/deserialize function pair with a SerializationTraits
Lang Hames [Mon, 12 Sep 2016 20:34:41 +0000 (20:34 +0000)]
[ORC] Replace the serialize/deserialize function pair with a SerializationTraits
class.

SerializationTraits provides serialize and deserialize methods corresponding to
the earlier functions, but also provides a name for the type. In future, this
name will be used to render function signatures as strings, which will in turn
be used to negotiate and verify API support between RPC clients and servers.

llvm-svn: 281254

7 years agoFix the bug introduced in r281252.
Dehao Chen [Mon, 12 Sep 2016 20:29:54 +0000 (20:29 +0000)]
Fix the bug introduced in r281252.

llvm-svn: 281253

7 years agoLower consecutive select instructions correctly.
Dehao Chen [Mon, 12 Sep 2016 20:23:28 +0000 (20:23 +0000)]
Lower consecutive select instructions correctly.

Summary: If consecutive select instructions are lowered separately in CGP, it will introduce redundant condition check and branches that cannot be removed by later optimization phases. This patch lowers all consecutive select instructions at the same to to avoid inefficent code as demonstrated in https://llvm.org/bugs/show_bug.cgi?id=29095

Reviewers: davidxl

Subscribers: vsk, llvm-commits

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

llvm-svn: 281252

7 years agoxfail TestQueues.py and TestDarwinLogFilterMatchMessage.py
Todd Fiala [Mon, 12 Sep 2016 20:23:13 +0000 (20:23 +0000)]
xfail TestQueues.py and TestDarwinLogFilterMatchMessage.py

It looks like the message-content-retrieval aspect of DarwinLog
support is flaky, not just the regex match against it.  Slightly
less frequently than the regex matching, I am seeing the
direct string-match variant of log-message-content matching
also fail.

Tracked by:
llvm.org/pr30299
rdar://28237450

llvm-svn: 281251

7 years agoconfig: Fix typo in comment
Shoaib Meenai [Mon, 12 Sep 2016 20:14:44 +0000 (20:14 +0000)]
config: Fix typo in comment

Testing commit access. NFC.

llvm-svn: 281250

7 years ago[MC] Defer asm errors to post-statement failure
Nirav Dave [Mon, 12 Sep 2016 20:03:02 +0000 (20:03 +0000)]
[MC] Defer asm errors to post-statement failure

Allow errors to be deferred and emitted as part of clean up to simplify
and shorten Assembly parser code. This will allow error messages to be
emitted in helper functions and be modified by the caller which has
better context.

As part of this many minor cleanups to the Parser:

* Unify parser cleanup on error
* Add Workaround for incorrect return values in ParseDirective instances
* Tighten checks on error-signifying return values for parser functions
  and fix in-tree TargetParsers to be more consistent with the changes.
* Fix AArch64 test cases checking for spurious error messages that are
  now fixed.

These changes should be backwards compatible with current Target Parsers
so long as the error status are correctly returned in appropriate
functions.

Reviewers: rnk, majnemer

Subscribers: aemerson, jyknight, llvm-commits

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

llvm-svn: 281249

7 years ago[InstCombine] add test for PR30327
Sanjay Patel [Mon, 12 Sep 2016 19:50:08 +0000 (19:50 +0000)]
[InstCombine] add test for PR30327

llvm-svn: 281248

7 years ago[InstCombine] regenerate checks
Sanjay Patel [Mon, 12 Sep 2016 19:29:26 +0000 (19:29 +0000)]
[InstCombine] regenerate checks

llvm-svn: 281247

7 years agoAVX-512: Added a test for -O0 mode. NFC.
Elena Demikhovsky [Mon, 12 Sep 2016 19:03:21 +0000 (19:03 +0000)]
AVX-512: Added a test for -O0 mode. NFC.

llvm-svn: 281246

7 years agoFix bitmask upper bounds check
Jonathan Peyton [Mon, 12 Sep 2016 19:02:53 +0000 (19:02 +0000)]
Fix bitmask upper bounds check

Rather than checking KMP_CPU_SETSIZE, which doesn't exist when using Hwloc, we
use the get_max_proc() function which can vary based on the operating system.
For example on Windows with multiple processor groups, it might be the case that
the highest bit possible in the bitmask is not equal to the number of hardware
threads on the machine but something higher than that.

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

llvm-svn: 281245

7 years agoAVX-512: Simplified masked_gather_scatter test. NFC.
Elena Demikhovsky [Mon, 12 Sep 2016 18:50:47 +0000 (18:50 +0000)]
AVX-512: Simplified masked_gather_scatter test. NFC.

llvm-svn: 281244

7 years agofix Xcode build after r281226
Todd Fiala [Mon, 12 Sep 2016 18:49:22 +0000 (18:49 +0000)]
fix Xcode build after r281226

llvm-svn: 281243

7 years agoRemove -fvisibility=hidden and FORCE_STATIC.
Michael Kruse [Mon, 12 Sep 2016 18:25:00 +0000 (18:25 +0000)]
Remove -fvisibility=hidden and FORCE_STATIC.

The flag -fvisibility=hidden flag was used for the integrated Integer
Set Library (and PPCG) to keep their definitions local to Polly. The
motivation was the be loaded into a DragonEgg-powered GCC, where GCC
might itself use ISL for its Graphite extension. The symbols of Polly's
ISL and GCC's ISL would clash.

The DragonEgg project is not actively developed anymore, but Polly's
unittests need to call ISL functions to set up a testing environment.
Unfortunately, the -fvisibility=hidden flag means that the ISL symbols
are not available to the gtest executable as it resides outside of
libPolly when linked dynamically. Currently, CMake links a second copy
of ISL into the unittests which leads to subtle bugs. What got observed
is that two isl_ids for isl_id_none exist, one for each library
instance. Because isl_id's are compared by address, isl_id_none could
happen to be different from isl_id_none, depending on which library
instance set the address and does the comparison.

Also remove the FORCE_STATIC flag which was introduced to keep the ISL
symbols visible inside the same libPolly shared object, even when build
with BUILD_SHARED_LIBS.

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

llvm-svn: 281242

7 years agoDiagnostics reference: "error:" should be red, not orange.
Richard Smith [Mon, 12 Sep 2016 17:55:49 +0000 (17:55 +0000)]
Diagnostics reference: "error:" should be red, not orange.

llvm-svn: 281241

7 years agoFix test failure in r281232
Hemant Kulkarni [Mon, 12 Sep 2016 17:40:10 +0000 (17:40 +0000)]
Fix test failure in r281232

llvm-svn: 281240

7 years ago[SE] Clean up device and host memory slices
Jason Henline [Mon, 12 Sep 2016 17:20:43 +0000 (17:20 +0000)]
[SE] Clean up device and host memory slices

Summary:
* Add LLVM_ATTRIBUTE_UNUSED_RESULT used to slicing methods in order to
  emphasize that the slicing is not done in place.
* Change device memory slice function name from `drop_front` to `slice`
  in order to match the naming convention of `llvm::ArrayRef` and host
  memory slice.
* Change the parameter names of host memory slice functions to
  `DropCount` and `TakeCount` to match device memory slice declarations.

Reviewers: jlebar

Subscribers: jprice, parallel_libs-commits

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

llvm-svn: 281239

7 years ago[MCJIT] Fix some inconsistent handling of name mangling inside MCJIT.
Lang Hames [Mon, 12 Sep 2016 17:19:24 +0000 (17:19 +0000)]
[MCJIT] Fix some inconsistent handling of name mangling inside MCJIT.

This patch moves symbol mangling from findSymbol to getSymbolAddress. The
findSymbol, findExistingSymbol and findModuleForSymbol methods now always take
a mangled name, allowing the 'demangle-and-retry' cruft to be removed from
findSymbol. See http://llvm.org/PR28699 for details.

Patch by James Holderness. Thanks very much James!

llvm-svn: 281238

7 years ago[asan] Ease dealing with tagged enum ErrorDescription with some macros.
Filipe Cabecinhas [Mon, 12 Sep 2016 17:12:02 +0000 (17:12 +0000)]
[asan] Ease dealing with tagged enum ErrorDescription with some macros.

Summary:
Added a macro to enumerate the (error name, error member name) pairs. This way,
when adding an error, we only need to add the pair to one place (plus add its
implementation, or course).

Reviewers: kcc, samsonov

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 281237

7 years ago[asan] Cleanup: Move tid into ErrorBase, add const to BufferedStackTrace, be consiste...
Filipe Cabecinhas [Mon, 12 Sep 2016 17:10:44 +0000 (17:10 +0000)]
[asan] Cleanup: Move tid into ErrorBase, add const to BufferedStackTrace, be consistent in constructor arguments and member order.

Summary: As mentioned in D24394, I'm moving tid to ErrorBase, since basically all errors need it.
Also mentioned in the same review are other cleanups like adding const
to BufferedStackTrace and make sure constructor orders are consistent.

Reviewers: vitalybuka, kcc, eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 281236

7 years agoStore the size of the outermost dimension in case of newly created arrays that requir...
Roman Gareev [Mon, 12 Sep 2016 17:08:31 +0000 (17:08 +0000)]
Store the size of the outermost dimension in case of newly created arrays that require memory allocation.

We do not need the size of the outermost dimension in most cases, but if we
allocate memory for newly created arrays, that size is needed.

Reviewed-by: Michael Kruse <llvm@meinersbur.de>
Differential Revision: https://reviews.llvm.org/D23991

llvm-svn: 281234

7 years agollvm-size: Add --totals option
Hemant Kulkarni [Mon, 12 Sep 2016 17:08:28 +0000 (17:08 +0000)]
llvm-size: Add --totals option

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

llvm-svn: 281233

7 years agollvm-objdump: Add --start-address and --stop-address options
Hemant Kulkarni [Mon, 12 Sep 2016 17:08:22 +0000 (17:08 +0000)]
llvm-objdump: Add --start-address and --stop-address options

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

llvm-svn: 281232

7 years ago[InstCombine] use m_APInt to allow icmp X, C folds for splat constant vectors
Sanjay Patel [Mon, 12 Sep 2016 16:25:41 +0000 (16:25 +0000)]
[InstCombine] use m_APInt to allow icmp X, C folds for splat constant vectors

isSignBitCheck could be changed to take a pointer param to avoid the 'UnusedBit' ugliness.

llvm-svn: 281231

7 years agoAMDGPU: Do not clobber SCC in SIWholeQuadMode
Nicolai Haehnle [Mon, 12 Sep 2016 16:25:20 +0000 (16:25 +0000)]
AMDGPU: Do not clobber SCC in SIWholeQuadMode

Reviewers: arsenm, tstellarAMD, mareko

Subscribers: arsenm, llvm-commits, kzhuravl

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

llvm-svn: 281230

7 years ago[GlobalISel] Fix mismatched "<..)" in intrinsic MO printing. NFC.
Ahmed Bougacha [Mon, 12 Sep 2016 16:21:49 +0000 (16:21 +0000)]
[GlobalISel] Fix mismatched "<..)" in intrinsic MO printing. NFC.

llvm-svn: 281229

7 years agoRevert "[ARM] Promote small global constants to constant pools"
James Molloy [Mon, 12 Sep 2016 16:18:23 +0000 (16:18 +0000)]
Revert "[ARM] Promote small global constants to constant pools"

This reverts commit r281213. It made a bot go bang: http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/14625

llvm-svn: 281228

7 years agoTrivial documentation fix regarding Obj-C ARC objc_arc_weak_reference_unavailable
Jonathan Roelofs [Mon, 12 Sep 2016 16:14:52 +0000 (16:14 +0000)]
Trivial documentation fix regarding Obj-C ARC objc_arc_weak_reference_unavailable

Fixed incorrect docs that referred to:
  objc_arc_weak_unavailable
when it should be:
  objc_arc_weak_reference_unavailable

Patch by: Sean McBride!

llvm-svn: 281227

7 years agoMove StdStringExtractor to tools/debugserver
Pavel Labath [Mon, 12 Sep 2016 16:13:05 +0000 (16:13 +0000)]
Move StdStringExtractor to tools/debugserver

The class is only used in the debugserver. The rest of lldb has the StringExtractor class.

Xcode project will need to be updated after this.

llvm-svn: 281226

7 years ago[SE] RegisteredHostMemory for async device copies
Jason Henline [Mon, 12 Sep 2016 16:09:41 +0000 (16:09 +0000)]
[SE] RegisteredHostMemory for async device copies

Summary:
Improve the error-prone interface that allows users to pass host
pointers that haven't been registered to asynchronous copy methods. In
CUDA, this is an extremely easy error to make, and instead of failing at
runtime, it succeeds and gives the right answers by turning the async
copy into a sync copy. So, you silently get a huge performance
degradation if you misuse the old interface. This new interface should
prevent that.

Reviewers: jlebar

Subscribers: jprice, beanz, parallel_libs-commits

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

llvm-svn: 281225

7 years ago[BranchFolding] Unique added live-ins after hoisting code.
Ahmed Bougacha [Mon, 12 Sep 2016 16:05:31 +0000 (16:05 +0000)]
[BranchFolding] Unique added live-ins after hoisting code.

We're not supposed to have duplicate live-ins.

llvm-svn: 281224

7 years ago[X86] Copy imp-uses when folding tailcall into conditional branch.
Ahmed Bougacha [Mon, 12 Sep 2016 16:05:27 +0000 (16:05 +0000)]
[X86] Copy imp-uses when folding tailcall into conditional branch.

r280832 added 32-bit support for emitting conditional tail-calls, but
dropped imp-used parameter registers.  This went unnoticed until
r281113, which added 64-bit support, as this is only exposed with
parameter passing via registers.

Don't drop the imp-used parameters.

llvm-svn: 281223

7 years agoSimplify handling of /DISCARD/. NFC.
Rafael Espindola [Mon, 12 Sep 2016 16:05:16 +0000 (16:05 +0000)]
Simplify handling of /DISCARD/. NFC.

llvm-svn: 281222

7 years ago[FunctionAttrs] Don't try to infer returned if it is already on an argument
David Majnemer [Mon, 12 Sep 2016 16:04:59 +0000 (16:04 +0000)]
[FunctionAttrs] Don't try to infer returned if it is already on an argument

Trying to infer the 'returned' attribute if an argument is already
'returned' can lead to verification failure: inference might determine
that a different argument is passed through which would result in two
different arguments marked as 'returned'.

This fixes PR30350.

llvm-svn: 281221

7 years agofix formatting; NFC
Sanjay Patel [Mon, 12 Sep 2016 15:52:28 +0000 (15:52 +0000)]
fix formatting; NFC

llvm-svn: 281220

7 years ago[InstCombine] add tests to show missing vector folds
Sanjay Patel [Mon, 12 Sep 2016 15:51:42 +0000 (15:51 +0000)]
[InstCombine] add tests to show missing vector folds

llvm-svn: 281219

7 years agoadd select i1 test, reproduser pr30249.
Igor Breger [Mon, 12 Sep 2016 15:27:02 +0000 (15:27 +0000)]
add select i1 test, reproduser pr30249.

llvm-svn: 281218

7 years ago[InstCombine] add helper function for foldICmpUsingKnownBits; NFCI
Sanjay Patel [Mon, 12 Sep 2016 15:24:31 +0000 (15:24 +0000)]
[InstCombine] add helper function for foldICmpUsingKnownBits; NFCI

llvm-svn: 281217

7 years ago[AMDGPU] Assembler: Move disabled SDWA and DPP instruction into Disable asm variant
Sam Kolton [Mon, 12 Sep 2016 14:42:43 +0000 (14:42 +0000)]
[AMDGPU] Assembler: Move disabled SDWA and DPP instruction into Disable asm variant

Summary: This removes disabled instructions from match tables so we will not match them at all.

Reviewers: tstellarAMD, vpykhtin, artem.tamazov

Subscribers: wdng, nhaehnle, arsenm

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

llvm-svn: 281216

7 years ago[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently
James Molloy [Mon, 12 Sep 2016 14:30:48 +0000 (14:30 +0000)]
[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently

For the common pattern (CMPZ (AND x, #bitmask), #0), we can do some more efficient instruction selection if the bitmask is one consecutive sequence of set bits (32 - clz(bm) - ctz(bm) == popcount(bm)).

1) If the bitmask touches the LSB, then we can remove all the upper bits and set the flags by doing one LSLS.
2) If the bitmask touches the MSB, then we can remove all the lower bits and set the flags with one LSRS.
3) If the bitmask has popcount == 1 (only one set bit), we can shift that bit into the sign bit with one LSLS and change the condition query from NE/EQ to MI/PL (we could also implement this by shifting into the carry bit and branching on BCC/BCS).
4) Otherwise, we can emit a sequence of LSLS+LSRS to remove the upper and lower zero bits of the mask.

1-3 require only one 16-bit instruction and can elide the CMP. 4 requires two 16-bit instructions but can elide the CMP and doesn't require materializing a complex immediate, so is also a win.

llvm-svn: 281215

7 years agofix formatting/typos; NFC
Sanjay Patel [Mon, 12 Sep 2016 14:25:46 +0000 (14:25 +0000)]
fix formatting/typos; NFC

llvm-svn: 281214

7 years ago[ARM] Promote small global constants to constant pools
James Molloy [Mon, 12 Sep 2016 13:42:16 +0000 (13:42 +0000)]
[ARM] Promote small global constants to constant pools

If a constant is unamed_addr and is only used within one function, we can save
on the code size and runtime cost of an indirection by changing the global's storage
to inside the constant pool. For example, instead of:

      ldr r0, .CPI0
      bl printf
      bx lr
    .CPI0: &format_string
    format_string: .asciz "hello, world!\n"

We can emit:

      adr r0, .CPI0
      bl printf
      bx lr
    .CPI0: .asciz "hello, world!\n"

This can cause significant code size savings when many small strings are used in one
function (4 bytes per string).

llvm-svn: 281213

7 years ago[LoopInterchange] Improve debug output. NFC.
Chad Rosier [Mon, 12 Sep 2016 13:24:47 +0000 (13:24 +0000)]
[LoopInterchange] Improve debug output. NFC.

llvm-svn: 281212

7 years agoFix the Thumb test for vfloat intrinsics
Pablo Barrio [Mon, 12 Sep 2016 13:14:14 +0000 (13:14 +0000)]
Fix the Thumb test for vfloat intrinsics

Summary:
This test was not testing the intrinsics. A function like this:

define %v4f32 @test_v4f32.floor(%v4f32 %a){
...
        %1 = call %v4f32 @llvm.floor.v4f32(%v4f32 %a)
...
}

is transformed into the following assembly:

_test_v4f32.floor:              @ @test_v4f32.floor
...
        bl _floorf
...

In each function tested, there are two CHECK: one that checked
for the label and another one for the intrinsic that should be used
inside the function (in our case, "floor"). However, although the
first CHECK was matching the label, the second was not matching the
intrinsic, but the second "floor" in the same line as the label.

This is fixed by making the first CHECK match the entire line.

Reviewers: jmolloy, rengolin

Subscribers: rengolin, llvm-commits

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

llvm-svn: 281211

7 years agoStore an ArrayRef for Data in InputSectionData.
Rafael Espindola [Mon, 12 Sep 2016 13:13:53 +0000 (13:13 +0000)]
Store an ArrayRef for Data in InputSectionData.

llvm-svn: 281210

7 years agoRevert "Revert "Compact InputSectionData from 64 to 48 bytes. NFC.""
Rafael Espindola [Mon, 12 Sep 2016 13:06:10 +0000 (13:06 +0000)]
Revert "Revert "Compact InputSectionData from 64 to 48 bytes. NFC.""

This reverts commit r281096.

The previous link errors should be fixed by r281208.

llvm-svn: 281209

7 years agoDefine a dummy zlib::uncompress when zlib is not available.
Rafael Espindola [Mon, 12 Sep 2016 13:00:51 +0000 (13:00 +0000)]
Define a dummy zlib::uncompress when zlib is not available.

Should fix link errors in some bots when it is used.

llvm-svn: 281208

7 years agoGlobalISel: support translation of global addresses.
Tim Northover [Mon, 12 Sep 2016 12:10:41 +0000 (12:10 +0000)]
GlobalISel: support translation of global addresses.

llvm-svn: 281207

7 years ago[clang-tidy] readability-misplaced-array-index: add new check that warns when array...
Daniel Marjamaki [Mon, 12 Sep 2016 12:04:13 +0000 (12:04 +0000)]
[clang-tidy] readability-misplaced-array-index: add new check that warns when array index is misplaced.

Reviewers: alexfh

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

llvm-svn: 281206

7 years agoGlobalISel: translate GEP instructions.
Tim Northover [Mon, 12 Sep 2016 11:20:22 +0000 (11:20 +0000)]
GlobalISel: translate GEP instructions.

Unlike SDag, we use a separate G_GEP instruction (much simplified, only taking
a single byte offset) to preserve the pointer type information through
selection.

llvm-svn: 281205

7 years agoGlobalISel: disambiguate types when printing MIR
Tim Northover [Mon, 12 Sep 2016 11:20:10 +0000 (11:20 +0000)]
GlobalISel: disambiguate types when printing MIR

Some generic instructions have multiple types. While in theory these always be
discovered by inspecting the single definition of each generic vreg, in
practice those definitions won't always be local and traipsing through a big
function to find them will not be fun.

So this changes MIRPrinter to print out the type of uses as well as defs, if
they're known to be different or not known to be the same.

On the parsing side, we're a little more flexible: provided each register is
given a type in at least one place it's mentioned (and all types are
consistent) we accept the MIR. This doesn't introduce ambiguity but makes
writing tests manually a bit less painful.

llvm-svn: 281204

7 years agoclang-format: Make emacs integration work with narrowed buffers.
Daniel Jasper [Mon, 12 Sep 2016 10:02:46 +0000 (10:02 +0000)]
clang-format: Make emacs integration work with narrowed buffers.

Use (call-process region nil ...) instead of (point-min) so that the
call works in narrowed buffers.

Patch by Philipp Stephani, thank you!

llvm-svn: 281203

7 years ago[ELF/AArch64] Implement some UABS relocs
Eugene Leviant [Mon, 12 Sep 2016 10:02:41 +0000 (10:02 +0000)]
[ELF/AArch64] Implement some UABS relocs

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

llvm-svn: 281202

7 years agoFix WebAssembly broken build related to interface change in r281172.
Eric Liu [Mon, 12 Sep 2016 09:35:59 +0000 (09:35 +0000)]
Fix WebAssembly broken build related to interface change in r281172.

Reviewers: bkramer

Subscribers: jfb, llvm-commits, dschuff

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

llvm-svn: 281201