platform/upstream/llvm.git
7 years agoRemove std:: from std::size_t.
Rui Ueyama [Thu, 20 Oct 2016 01:33:09 +0000 (01:33 +0000)]
Remove std:: from std::size_t.

llvm-svn: 284687

7 years agoX86: Deduplicate some lowering code. NFCI.
Peter Collingbourne [Thu, 20 Oct 2016 01:21:26 +0000 (01:21 +0000)]
X86: Deduplicate some lowering code. NFCI.

llvm-svn: 284686

7 years agoRefactor and simplify Sema::FindCompositePointerType. No functionality change intended.
Richard Smith [Thu, 20 Oct 2016 01:20:00 +0000 (01:20 +0000)]
Refactor and simplify Sema::FindCompositePointerType. No functionality change intended.

llvm-svn: 284685

7 years agoPR26276: Fix detection of non-cast-expressions as operands of fold-expressions.
Richard Smith [Thu, 20 Oct 2016 00:55:15 +0000 (00:55 +0000)]
PR26276: Fix detection of non-cast-expressions as operands of fold-expressions.

llvm-svn: 284684

7 years agoUpgrade debug-info-vla test: we do not pass default alignment now
Victor Leschuk [Thu, 20 Oct 2016 00:37:07 +0000 (00:37 +0000)]
Upgrade debug-info-vla test: we do not pass default alignment now

llvm-svn: 284683

7 years agoDebugInfo: remove broken bitcode upgrade test
Victor Leschuk [Thu, 20 Oct 2016 00:26:36 +0000 (00:26 +0000)]
DebugInfo: remove broken bitcode upgrade test

llvm-svn: 284682

7 years agoUse __func__ directly now that all supported compilers support it
Reid Kleckner [Thu, 20 Oct 2016 00:22:23 +0000 (00:22 +0000)]
Use __func__ directly now that all supported compilers support it

Remove the portability macro now that it is unused.

llvm-svn: 284681

7 years agoFix narrowing conversion error in 32-bit MSVC builds
Reid Kleckner [Thu, 20 Oct 2016 00:13:34 +0000 (00:13 +0000)]
Fix narrowing conversion error in 32-bit MSVC builds

Use size_t instead of ELFT::uint for the string table offset. If the
linker is built 32-bit, it can't write an output file larger than 2GB.
Other code in this area uses size_t as well.

llvm-svn: 284680

7 years agoDebugInfo: pass alignment value only if it was forced
Victor Leschuk [Thu, 20 Oct 2016 00:13:19 +0000 (00:13 +0000)]
DebugInfo: pass alignment value only if it was forced

Preparation to implement DW_AT_alignment support:
 - We pass non-zero align value to DIBuilder only when alignment was forced
 - Modify tests to match this change

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

llvm-svn: 284679

7 years agoDebugInfo: preparation to implement DW_AT_alignment
Victor Leschuk [Thu, 20 Oct 2016 00:13:12 +0000 (00:13 +0000)]
DebugInfo: preparation to implement DW_AT_alignment

 - Add alignment attribute to DIVariable family
 - Modify bitcode format to match new DIVariable representation
 - Update tests to match these changes (also add bitcode upgrade test)
 - Expect that frontend passes non-zero align value only when it is not default
   (was forcibly aligned by alignas()/_Alignas()/__atribute__(aligned())

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

llvm-svn: 284678

7 years ago[WebAssembly] Update extending load test for new i1 behavior
Derek Schuff [Thu, 20 Oct 2016 00:10:34 +0000 (00:10 +0000)]
[WebAssembly] Update extending load test for new i1 behavior

r284611 changed the behavior of the DAG legalizer for sign-extending i1
values. Update the wasm extending load test to match.

llvm-svn: 284677

7 years agoAllow linker-script-defined entry symbols.
Rui Ueyama [Thu, 20 Oct 2016 00:07:36 +0000 (00:07 +0000)]
Allow linker-script-defined entry symbols.

Previously, we were checking the existence of an entry symbol
too early. It was done before the linker script processor creates
symbols defined in scripts. Fixes bug 30743.

llvm-svn: 284676

7 years agoFix build failure.
Rui Ueyama [Thu, 20 Oct 2016 00:05:46 +0000 (00:05 +0000)]
Fix build failure.

llvm-svn: 284675

7 years agoAdded a decorator for the macOS version and switched over testcases that used platfor...
Sean Callanan [Thu, 20 Oct 2016 00:03:39 +0000 (00:03 +0000)]
Added a decorator for the macOS version and switched over testcases that used platform.release

llvm-svn: 284674

7 years agoFix crash on noreturn conversion in unprototyped function type. Thanks to Keith
Richard Smith [Thu, 20 Oct 2016 00:01:36 +0000 (00:01 +0000)]
Fix crash on noreturn conversion in unprototyped function type. Thanks to Keith
Walker for spotting the bug.

llvm-svn: 284673

7 years agoRemove LLVM_NOEXCEPT and replace it with noexcept
Reid Kleckner [Wed, 19 Oct 2016 23:52:38 +0000 (23:52 +0000)]
Remove LLVM_NOEXCEPT and replace it with noexcept

Now that we have dropped MSVC 2013, all supported compilers support
noexcept and we can drop this portability macro.

llvm-svn: 284672

7 years agoUse noexcept directly now that all compilers support it
Reid Kleckner [Wed, 19 Oct 2016 23:50:50 +0000 (23:50 +0000)]
Use noexcept directly now that all compilers support it

llvm-svn: 284671

7 years ago[ELF] Replace std::pair with a struct so we have proper names. NFC.
Michael J. Spencer [Wed, 19 Oct 2016 23:49:27 +0000 (23:49 +0000)]
[ELF] Replace std::pair with a struct so we have proper names. NFC.

llvm-svn: 284670

7 years agoExtend hack to work around bad exception specifications for 'swap' members to
Richard Smith [Wed, 19 Oct 2016 23:47:37 +0000 (23:47 +0000)]
Extend hack to work around bad exception specifications for 'swap' members to
also cover libstdc++'s std::__debug::array and std::__profile::array.

llvm-svn: 284669

7 years agoNext set of additional error checks for invalid Mach-O files for the
Kevin Enderby [Wed, 19 Oct 2016 23:44:34 +0000 (23:44 +0000)]
Next set of additional error checks for invalid Mach-O files for the
load commands that use the MachO::thread_command type
but are not used in llvm libObject code but used in llvm tool code.

This includes the LC_UNIXTHREAD and LC_THREAD
load commands.

A quick note about the philosophy of the error checking in
libObject for Mach-O files, the idea behind the checking is
that we never will return a Mach-O file out of libObject that
contains unknown things in the load commands.

To do this the 32-bit ARM and PPC general tread states
needed to be defined as two test case binaries contained
them.  If other thread states for other CPUs need to be
added we will do that as needed.

Going forward the LC_MAIN load command is used to
set the entry point in Mach-O executables these days
instead of an LC_UNIXTHREAD as was done in the past.
So today only in core files are LC_THREAD load commands
and thread states usually found.

Other thread states have not yet been defined in
include/Support/MachO.h at this time.  But that can be
added as needed with their corresponding checking also
added.

llvm-svn: 284668

7 years agoUse noexcept instead of LLVM_NOEXCEPT now that all compilers support it
Reid Kleckner [Wed, 19 Oct 2016 23:39:55 +0000 (23:39 +0000)]
Use noexcept instead of LLVM_NOEXCEPT now that all compilers support it

llvm-svn: 284667

7 years agoAdd lldb register definitions for w0-w28, s0-s31, and d0-d31 to
Jason Molenda [Wed, 19 Oct 2016 23:38:38 +0000 (23:38 +0000)]
Add lldb register definitions for w0-w28, s0-s31, and d0-d31 to
RegisterInfos_arm64.h.  These register definitions include the
offset into the register context, which will vary depending on the
endianness of the arm64 target system (e.g. s8 is at offset 0 in
v8 on little-endian, it is at offset 12 on big-endian) and I've
only added the little-endian definitions to the table.  If we want
to add a big-endian arm64 target, we'll need a separate table which
uses the big-endian offsets for these registers.  I changed the
name of the register table from g_register_infos_arm64 to
g_register_infos_arm64_le to make it explicit that this is the
little-endian version of that table, and updated users of the table
to use the new name.

I added support for the "w", "s", and "d" registers to
RegisterContextDarwin_arm64 but it was more an example than anything
useful -- this plugin is only used when working with core files and
darwin core files do not (today) include the floating point register
context, so it only added the support for the "w" pseudo registers.
When we're connected to a real arm64 device, we use the ProcessGDBRemote
code.

llvm-svn: 284666

7 years agoUpdate Compiler.h to fail fast when building with MSVC 2013
Reid Kleckner [Wed, 19 Oct 2016 23:34:58 +0000 (23:34 +0000)]
Update Compiler.h to fail fast when building with MSVC 2013

llvm-svn: 284665

7 years ago[PGO] Fix a use-after-move. NFC.
Rong Xu [Wed, 19 Oct 2016 23:31:59 +0000 (23:31 +0000)]
[PGO] Fix a use-after-move. NFC.

llvm-svn: 284664

7 years agoDon't call markLiveAt for non alloc sections.
Rafael Espindola [Wed, 19 Oct 2016 23:13:40 +0000 (23:13 +0000)]
Don't call markLiveAt for non alloc sections.

We don't gc them anyway, so just use an early return in Enqueue.

llvm-svn: 284663

7 years agoRead an expression in the form of "ABSOLUTE(<expr>) op <expr> ...".
Rui Ueyama [Wed, 19 Oct 2016 23:11:21 +0000 (23:11 +0000)]
Read an expression in the form of "ABSOLUTE(<expr>) op <expr> ...".

Fixes bug 30741.

llvm-svn: 284662

7 years agoRevert "DenseSet: Appease msc18 to define derived constructors explicitly."
Reid Kleckner [Wed, 19 Oct 2016 23:04:57 +0000 (23:04 +0000)]
Revert "DenseSet: Appease msc18 to define derived constructors explicitly."

This reverts commit r284570. MSVC 18 / 2013 is not supported anymore.

llvm-svn: 284661

7 years agoUpdate docs to reflect new minimum MSVC version requirement
Reid Kleckner [Wed, 19 Oct 2016 23:04:41 +0000 (23:04 +0000)]
Update docs to reflect new minimum MSVC version requirement

Mailing list discussion about this:
http://lists.llvm.org/pipermail/llvm-dev/2016-September/104631.html

Code changes to simplify the ifdefs will come next, and can be reverted
without affecting the policy if someone needs it.

llvm-svn: 284660

7 years ago[PGO] Fix bogus warning for merging empty llvm profile file
Rong Xu [Wed, 19 Oct 2016 22:51:17 +0000 (22:51 +0000)]
[PGO] Fix bogus warning for merging empty llvm profile file

Profile runtime can generate an empty raw profile (when there is no function in
the shared library). This empty profile is treated as a text format profile.  A
test format profile without the flag of "#IR" is thought to be a clang
generated profile.  So in llvm profile merging, we will get a bogus warning of
"Merge IR generated profile with Clang generated profile."

The fix here is to skip the empty profile (when the buffer size is 0) for
profile merge.

Reviewers: vsk, davidxl

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

llvm-svn: 284659

7 years ago[cmake] Follow LLVM's lead in creating exported tool targets for clang tools.
Michael Gottesman [Wed, 19 Oct 2016 22:46:06 +0000 (22:46 +0000)]
[cmake] Follow LLVM's lead in creating exported tool targets for clang tools.

This is needed by downstream projects such as swift to get proper cmake
dependency information for LLVM/Clang targets.

A few months ago I added support for exporting this information for Clang
libraries. In order to be incremental, I did not add support for exporting clang
tools as well at that time. Now such support is needed, so I am committing this
incremental code.

llvm-svn: 284658

7 years ago[BuildingAJIT] Use the remote target triple to construct the TargetMachine in
Lang Hames [Wed, 19 Oct 2016 22:41:03 +0000 (22:41 +0000)]
[BuildingAJIT] Use the remote target triple to construct the TargetMachine in
Chapter 5.

Chapter 5 demonstrates remote JITing: code is executed on the remote, not the
machine running the REPL, so it's the remote's triple (and TargetMachine) that
we need.

llvm-svn: 284657

7 years agoAdd computeHostNumPhysicalCores() implementation for Darwin
Mehdi Amini [Wed, 19 Oct 2016 22:36:07 +0000 (22:36 +0000)]
Add computeHostNumPhysicalCores() implementation for Darwin

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

llvm-svn: 284656

7 years agoAMDGPU : Add a function to enable and disable IEEEBit for SC and shader
Wei Ding [Wed, 19 Oct 2016 22:34:49 +0000 (22:34 +0000)]
AMDGPU : Add a function to enable and disable IEEEBit for SC and shader
respectively.

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

llvm-svn: 284655

7 years agoRemove the JIT EH/small code model tests for now.
Lang Hames [Wed, 19 Oct 2016 22:19:38 +0000 (22:19 +0000)]
Remove the JIT EH/small code model tests for now.

These tests rely on two sections being allocated with a limited displacement
from one to the other to work. We've never guaranteed this, and consequently
these tests usually fail. That led to them being XFAILed, but now they XPASS
whenever the sections do happen to be allocated nearby in memory. So I'm
removing these for now to get rid of the noise. We can re-instate them if/when
we take the time to implement a displacement-respecting allocator.

llvm-svn: 284654

7 years agoAdd optimization to sizeof...(X) handling: if none of parameter pack X's
Richard Smith [Wed, 19 Oct 2016 22:18:42 +0000 (22:18 +0000)]
Add optimization to sizeof...(X) handling: if none of parameter pack X's
corresponding arguments are unexpanded pack expansions, we can compute the
result without substituting them. This significantly improves the memory usage
and performance of make_integer_sequence implementations that do this kind of
thing:

  using result = integer_sequence<T, Ns ..., sizeof...(Ns) + Ns ...>;

... but note that such an implementation will still perform O(sizeof...(Ns)^2)
work while building the second pack expansion (we just have a somewhat lower
constant now).

In principle we could get this down to linear time by caching whether the
number of expansions of a pack is constant, or checking whether we're within an
alias template before scanning the pack for pack expansions (since that's the
only case in which we do substitutions within a dependent context at the
moment), but this patch doesn't attempt that.

llvm-svn: 284653

7 years agoDon't crash generating debug info for VLA in function prototype.
Eli Friedman [Wed, 19 Oct 2016 22:16:32 +0000 (22:16 +0000)]
Don't crash generating debug info for VLA in function prototype.

Fixes regression from r279445.

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

llvm-svn: 284652

7 years agoDebugInfo: use uint32_t for alignment variables.
Victor Leschuk [Wed, 19 Oct 2016 22:11:07 +0000 (22:11 +0000)]
DebugInfo: use uint32_t for alignment variables.

LLVM now uses uint32_t for DebugInfo alignment for space efficiency,
in this patch we change frontend DebugInfo-related variables to uint32_t too.

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

llvm-svn: 284651

7 years ago[CMake] Make the runtimes directory work with bootstrap builds
Chris Bieneman [Wed, 19 Oct 2016 21:50:25 +0000 (21:50 +0000)]
[CMake] Make the runtimes directory work with bootstrap builds

This patch builds on clang r284648, and allows the runtime directory to make the bootstrap builds depend on the builtin libraries.

This patch also make the bootstrap build depend on configuring the other runtimes because the libcxx headers are copied during configuration. I have left a TODO in the code to remove that once I come up with a better solution.

llvm-svn: 284650

7 years ago[InstSimplify] fold negation of sign-bit
Sanjay Patel [Wed, 19 Oct 2016 21:23:45 +0000 (21:23 +0000)]
[InstSimplify] fold negation of sign-bit

0 - X --> X, if X is 0 or the minimum signed value
0 - X --> 0, if X is 0 or the minimum signed value and the sub is NSW

I noticed this pattern might be created in the backend after the change from D25485,
so we'll want to add a similar fold for the DAG.

The use of computeKnownBits in InstSimplify may be something to investigate if the
compile time of InstSimplify is noticeable. We could replace computeKnownBits with
specific pattern matchers or limit the recursion.

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

llvm-svn: 284649

7 years ago[CMake] Add clang-bootstrap-deps target
Chris Bieneman [Wed, 19 Oct 2016 21:18:48 +0000 (21:18 +0000)]
[CMake] Add clang-bootstrap-deps target

Having this target allows other parts of the build system to add to the bootstrap dependencies without needing to be defined before the bootstrap targets are created.

This will specifically be used connect the builtins build from the LLVM runtimes directory as a dependency of the next build stage.

llvm-svn: 284648

7 years ago[CUDA] When we emit an error that might have been deferred, also print a callstack.
Justin Lebar [Wed, 19 Oct 2016 21:15:01 +0000 (21:15 +0000)]
[CUDA] When we emit an error that might have been deferred, also print a callstack.

Summary:
Previously, when you did something not allowed in a host+device function
and then caused it to be codegen'ed, we would print out an error telling
you that you did something bad, but we wouldn't tell you how we decided
that the function needed to be codegen'ed.

This change causes us to print out a callstack when emitting deferred
errors.  This is immensely helpful when debugging highly-templated code,
where it's often unclear how a function became known-emitted.

We only print the callstack once per function, after we print the all
deferred errors.

This patch also switches all of our hashtables to using canonical
FunctionDecls instead of regular FunctionDecls.  This prevents a number
of bugs, some of which are caught by tests added here, in which we
assume that two FDs for the same function have the same pointer value.

Reviewers: rnk

Subscribers: cfe-commits, tra

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

llvm-svn: 284647

7 years ago[CMake] Support thin LTO in PGO CMake cache
Chris Bieneman [Wed, 19 Oct 2016 21:12:04 +0000 (21:12 +0000)]
[CMake] Support thin LTO in PGO CMake cache

This allows you to set PGO_INSTRUMENT_LTO=Thin and have it work correctly.

llvm-svn: 284646

7 years agoAvoid using grep command in a test.
Rui Ueyama [Wed, 19 Oct 2016 21:07:29 +0000 (21:07 +0000)]
Avoid using grep command in a test.

This test is failing on FreeBSD bots. This is an attempt to fix it
by not using grep command.

llvm-svn: 284645

7 years ago[AST] Add CanonicalDeclPtr<T>.
Justin Lebar [Wed, 19 Oct 2016 21:03:42 +0000 (21:03 +0000)]
[AST] Add CanonicalDeclPtr<T>.

Summary:
CanonicalDeclPtr<T> is just like a T*, except it calls
T::getCanonicalDecl() on construction.

This is useful as the key in a "set of canonical Decls" -- it's much
less error-prone than calling getCanonicalDecl() every time you touch
the set.

Reviewers: rnk

Subscribers: cfe-commits, tra

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

llvm-svn: 284644

7 years ago[CUDA] Emit errors for wrong-side calls made on the same line as non-wrong-side calls.
Justin Lebar [Wed, 19 Oct 2016 21:03:38 +0000 (21:03 +0000)]
[CUDA] Emit errors for wrong-side calls made on the same line as non-wrong-side calls.

Summary:
This fixes two related bugs:

1) Previously, if you had a non-wrong side call at some source code
location L, we wouldn't emit errors for wrong-side calls that appeared
at L.

2) We'd only emit one wrong-side error per source code location, when we
actually want to emit it twice if we hit this line more than once due to
e.g. template instantiation.

Reviewers: tra

Subscribers: rnk, cfe-commits

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

llvm-svn: 284643

7 years ago[ubsan] Drop dependency on a 64-bit arch in a test (NFC)
Vedant Kumar [Wed, 19 Oct 2016 20:53:16 +0000 (20:53 +0000)]
[ubsan] Drop dependency on a 64-bit arch in a test (NFC)

This should fix:

    http://lab.llvm.org:8011/builders/clang-hexagon-elf/builds/46184

llvm-svn: 284642

7 years agoMove getVersionString to Core and simplify Version.cpp.
Rui Ueyama [Wed, 19 Oct 2016 20:53:07 +0000 (20:53 +0000)]
Move getVersionString to Core and simplify Version.cpp.

llvm-svn: 284641

7 years ago[ubsan] Re-work check lines to try to appease a bot (NFC)
Vedant Kumar [Wed, 19 Oct 2016 20:28:35 +0000 (20:28 +0000)]
[ubsan] Re-work check lines to try to appease a bot (NFC)

This bot does not produce the IR I expect -- it's missing some
'handler.dynamic_type_cache_miss:' labels. We don't need to rely on
those labels, so get rid of them in hopes of making the bot happy.

    http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/55493

llvm-svn: 284639

7 years agoNew clang option -mpie-copy-relocations to use copy relocations for PIE builds.
Sriraman Tallam [Wed, 19 Oct 2016 20:24:06 +0000 (20:24 +0000)]
New clang option -mpie-copy-relocations to use copy relocations for PIE builds.

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

llvm-svn: 284638

7 years ago[BuildingAJIT] Make the chapter 5 server export symbols.
Lang Hames [Wed, 19 Oct 2016 20:22:12 +0000 (20:22 +0000)]
[BuildingAJIT] Make the chapter 5 server export symbols.

This will allow chapter 5 to work on Linux.

llvm-svn: 284637

7 years ago[ubsan] Use the object pointer's type info for devirtualized calls
Vedant Kumar [Wed, 19 Oct 2016 20:21:16 +0000 (20:21 +0000)]
[ubsan] Use the object pointer's type info for devirtualized calls

ubsan reports a false positive 'invalid member call' diagnostic on the
following example (PR30478):

  struct Base1 {
    virtual int f1() { return 1; }
  };

  struct Base2 {
    virtual int f1() { return 2; }
  };

  struct Derived2 final : Base1, Base2 {
    int f1() override { return 3; }
  };

  int t1() {
    Derived2 d;
    return static_cast<Base2 *>(&d)->f1();
  }

Adding the "final" attribute to a most-derived class allows clang to
devirtualize member calls into an instance of that class. We should pass
along the type info of the object pointer to avoid the FP. In this case,
that means passing along the type info for 'Derived2' instead of 'Base2'
when checking the dynamic type of static_cast<Base2 *>(&d2).

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

llvm-svn: 284636

7 years agoTypo: nomed struct -> named struct
Hans Wennborg [Wed, 19 Oct 2016 20:10:03 +0000 (20:10 +0000)]
Typo: nomed struct -> named struct

llvm-svn: 284635

7 years agoInclude ARGV[0] in error messages.
Rui Ueyama [Wed, 19 Oct 2016 20:05:43 +0000 (20:05 +0000)]
Include ARGV[0] in error messages.

This is what other linkers and clang driver do.

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

llvm-svn: 284634

7 years ago[GlobalMerge] Handle non-landingpad EH pads
Reid Kleckner [Wed, 19 Oct 2016 19:56:22 +0000 (19:56 +0000)]
[GlobalMerge] Handle non-landingpad EH pads

This code crashed on funclet-style EH instructions such as catchpad,
catchswitch, and cleanuppad. Just treat all EH pad instructions
equivalently and avoid merging the globals they reference through any
use.

llvm-svn: 284633

7 years ago[IndVarSimplify] Teach calculatePostIncRange to take guards into account
Artur Pilipenko [Wed, 19 Oct 2016 19:43:54 +0000 (19:43 +0000)]
[IndVarSimplify] Teach calculatePostIncRange to take guards into account

Reviewed By: sanjoy

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

llvm-svn: 284632

7 years ago[LV] Avoid emitting trivially dead instructions
Matthew Simpson [Wed, 19 Oct 2016 19:22:02 +0000 (19:22 +0000)]
[LV] Avoid emitting trivially dead instructions

Some instructions from the original loop, when vectorized, can become trivially
dead. This happens because of the way we structure the new loop. For example,
we create new induction variables and induction variable "steps" in the new
loop. Thus, when we go to vectorize the original induction variable update, it
may no longer be needed due to the instructions we've already created. This
patch prevents us from creating these redundant instructions. This reduces code
size before simplification and allows greater flexibility in code generation
since we have fewer unnecessary instruction uses.

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

llvm-svn: 284631

7 years ago[AliasSetTracker] Add support for memcpy and memmove.
Chad Rosier [Wed, 19 Oct 2016 19:09:03 +0000 (19:09 +0000)]
[AliasSetTracker] Add support for memcpy and memmove.

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

llvm-svn: 284630

7 years ago[IndVarSimplify] Use control-dependent range information to prove non-negativity
Artur Pilipenko [Wed, 19 Oct 2016 18:59:03 +0000 (18:59 +0000)]
[IndVarSimplify] Use control-dependent range information to prove non-negativity

This change is motivated by the case when IndVarSimplify doesn't widen a comparison of IV increment because it can't prove IV increment being non-negative. We end up with a redundant trunc of the widened increment on this example.

for.body:
  %i = phi i32 [ %start, %for.body.lr.ph ], [ %i.inc, %for.inc ]
  %within_limits = icmp ult i32 %i, 64
  br i1 %within_limits, label %continue, label %for.end

continue:
  %i.i64 = zext i32 %i to i64
  %arrayidx = getelementptr inbounds i32, i32* %base, i64 %i.i64
  %val = load i32, i32* %arrayidx, align 4
  br label %for.inc

for.inc:
  %i.inc = add nsw nuw i32 %i, 1
  %cmp = icmp slt i32 %i.inc, %limit
  br i1 %cmp, label %for.body, label %for.end

There is a range check inside of the loop which guarantees the IV to be non-negative. NSW on the increment guarantees that the increment is also non-negative. Teach IndVarSimplify to use the range check to prove non-negativity of loop increments.

Reviewed By: sanjoy

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

llvm-svn: 284629

7 years ago[AliasSetTracker] Return void for add() functions. NFC.
Chad Rosier [Wed, 19 Oct 2016 18:50:32 +0000 (18:50 +0000)]
[AliasSetTracker] Return void for add() functions. NFC.

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

llvm-svn: 284628

7 years ago[InstSimplify] move one and add more tests for potential negation folds
Sanjay Patel [Wed, 19 Oct 2016 18:42:12 +0000 (18:42 +0000)]
[InstSimplify] move one and add more tests for potential negation folds

llvm-svn: 284627

7 years agoAdd a macro for prefetching data.
Rafael Espindola [Wed, 19 Oct 2016 18:34:32 +0000 (18:34 +0000)]
Add a macro for prefetching data.

It will be used in lld.

llvm-svn: 284626

7 years agoRemove ending "." from an error message.
Rui Ueyama [Wed, 19 Oct 2016 18:09:52 +0000 (18:09 +0000)]
Remove ending "." from an error message.

Other error messages don't end with ".".

llvm-svn: 284625

7 years agoMS ABI: Fix assert when generating virtual function call with virtual bases and ...
Hans Wennborg [Wed, 19 Oct 2016 18:04:27 +0000 (18:04 +0000)]
MS ABI: Fix assert when generating virtual function call with virtual bases and -flto (PR30731)

getClassAtVTableLocation() was calling
ASTRecordLayout::getBaseClassOffset() on a virtual base, causing an
assert.

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

llvm-svn: 284624

7 years ago[ADT] Zip range adapter
Mehdi Amini [Wed, 19 Oct 2016 18:02:21 +0000 (18:02 +0000)]
[ADT] Zip range adapter

This augments the STLExtras toolset with a zip iterator and range
adapter. Zip comes in two varieties: `zip`, which will zip to the
shortest of the input ranges, and `zip_first`, which limits its
`begin() == end()` checks to just the first range.

Recommit r284035 after MSVC2013 support has been dropped.

Patch by: Bryant Wong <github.com/bryant>

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

llvm-svn: 284623

7 years ago[polly] Fix non-determinism in polly BlockGenerators
Mandeep Singh Grang [Wed, 19 Oct 2016 17:56:49 +0000 (17:56 +0000)]
[polly] Fix non-determinism in polly BlockGenerators

Summary: Iterating over SeenBlocks which is a SmallPtrSet results in non-determinism in codegen

Reviewers: jdoerfert, zinob, grosser

Tags: #polly

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

llvm-svn: 284622

7 years ago[llvm-cov] Don't spawn a thread unless ThreadCount > 1
Vedant Kumar [Wed, 19 Oct 2016 17:55:44 +0000 (17:55 +0000)]
[llvm-cov] Don't spawn a thread unless ThreadCount > 1

Initializing a ThreadPool with ThreadCount = 1 spawns a thread even
though we don't need to. This is at least slower than it needs to be,
and at worst may somehow be exacerbating PR30735 (llvm-cov times out
on ARM bots).

As a follow-up, I'll try to add logic to llvm::ThreadPool to avoid
spawning a thread when ThreadCount = 1.

llvm-svn: 284621

7 years ago[mips][msa] Range check MSA intrinsics with immediates
Simon Dardis [Wed, 19 Oct 2016 17:50:52 +0000 (17:50 +0000)]
[mips][msa] Range check MSA intrinsics with immediates

This patch teaches clang to range check immediates for MIPS MSA instrinsics.
This checking is done strictly in comparison to some existing GCC
implementations. E.g. msa_andvi_b(var, 257) does not result in andvi $wX, 1.
Similarily msa_ldi_b takes a range of -128 to 127.

As part of this effort, correct the existing MSA test as it has both illegal
types and immediates.

Reviewers: vkalintiris

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

llvm-svn: 284620

7 years ago[AMDGPU] Stop using MCRegisterClass::getSize()
Krzysztof Parzyszek [Wed, 19 Oct 2016 17:40:36 +0000 (17:40 +0000)]
[AMDGPU] Stop using MCRegisterClass::getSize()

Differential Review: https://reviews.llvm.org/D24675

llvm-svn: 284619

7 years ago[ThinLTO] Default backend threads to heavyweight_hardware_concurrency
Teresa Johnson [Wed, 19 Oct 2016 17:35:01 +0000 (17:35 +0000)]
[ThinLTO] Default backend threads to heavyweight_hardware_concurrency

Summary:
Changes default backend parallelism from thread::hardware_concurrency to
the new llvm::heavyweight_hardware_concurrency, which for X86 Linux
defaults to the number of physical cores (and will fall back to
thread::hardware_concurrency otherwise). This avoid oversubscribing
the physical cores using hyperthreading.

Reviewers: mehdi_amini, pcc

Subscribers: llvm-commits

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

llvm-svn: 284618

7 years ago[Myriad] Find libc++ headers next to clang binary
Douglas Katzman [Wed, 19 Oct 2016 17:30:40 +0000 (17:30 +0000)]
[Myriad] Find libc++ headers next to clang binary

llvm-svn: 284617

7 years agoMerged nested ifs. NFCI.
Simon Pilgrim [Wed, 19 Oct 2016 17:30:24 +0000 (17:30 +0000)]
Merged nested ifs. NFCI.

llvm-svn: 284616

7 years agoRevert "Add Chrono.h - std::chrono support header"
Pavel Labath [Wed, 19 Oct 2016 17:17:53 +0000 (17:17 +0000)]
Revert "Add Chrono.h - std::chrono support header"

This reverts commit r284590 as it fails on the mingw buildbot. I think I know the
fix, but I cannot test it right now. Will reapply when I verify it works ok.

This reverts r284590.

llvm-svn: 284615

7 years ago[ELF] Add `const` qualifier to functions. NFC
Simon Atanasyan [Wed, 19 Oct 2016 17:13:43 +0000 (17:13 +0000)]
[ELF] Add `const` qualifier to functions. NFC

llvm-svn: 284614

7 years ago[DAGCombiner] Add general constant vector support to (shl (add x, c1), c2) -> (add...
Simon Pilgrim [Wed, 19 Oct 2016 17:12:22 +0000 (17:12 +0000)]
[DAGCombiner] Add general constant vector support to (shl (add x, c1), c2) -> (add (shl x, c2), c1 << c2)

We already supported scalar constant / splatted constant vector - now accepts any (non opaque) constant scalar / vector

llvm-svn: 284613

7 years ago[WinEH] Allow catchpads to reuse the same catch object
Reid Kleckner [Wed, 19 Oct 2016 17:08:23 +0000 (17:08 +0000)]
[WinEH] Allow catchpads to reuse the same catch object

This code used a regular when it should have used a multimap.

llvm-svn: 284612

7 years ago[DAG] optimize negation of bool
Sanjay Patel [Wed, 19 Oct 2016 16:58:59 +0000 (16:58 +0000)]
[DAG] optimize negation of bool

Use mask and negate for legalization of i1 source type with SIGN_EXTEND_INREG.
With the mask, this should be no worse than 2 shifts. The mask can be eliminated
in some cases, so that should be better than 2 shifts.

This change exposed some missing folds related to negation:
https://reviews.llvm.org/rL284239
https://reviews.llvm.org/rL284395

There may be others, so please let me know if you see any regressions.

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

llvm-svn: 284611

7 years ago[pdb] Improve error messages when DIA is not found.
Zachary Turner [Wed, 19 Oct 2016 16:42:20 +0000 (16:42 +0000)]
[pdb] Improve error messages when DIA is not found.

llvm-svn: 284610

7 years ago[RDF] Switch RefMap in liveness calculation to use lane masks
Krzysztof Parzyszek [Wed, 19 Oct 2016 16:30:56 +0000 (16:30 +0000)]
[RDF] Switch RefMap in liveness calculation to use lane masks

This required reengineering of some of the part of liveness calculation,
including fixing some issues caused by the limitations of the previous
approach. The current code is not necessarily the fastest, but it should
be functionally correct (at least more so than before). The compile-time
performance will be addressed in the future.

llvm-svn: 284609

7 years ago[DAGCombiner] Add general constant vector support to (shl (sra x, c1), c1) -> (and...
Simon Pilgrim [Wed, 19 Oct 2016 16:15:30 +0000 (16:15 +0000)]
[DAGCombiner] Add general constant vector support to (shl (sra x, c1), c1) -> (and x, (shl -1, c1))

We already supported scalar constant / splatted constant vector - now accepts any (non opaque) constant scalar / vector

llvm-svn: 284608

7 years ago[DAGCombiner] Add general constant vector support to (shl (mul x, c1), c2) -> (mul...
Simon Pilgrim [Wed, 19 Oct 2016 15:59:28 +0000 (15:59 +0000)]
[DAGCombiner] Add general constant vector support to (shl (mul x, c1), c2) -> (mul x, c1 << c2)

We already supported scalar constant / splatted constant vector - now accepts any (non opaque) constant scalar / vector

llvm-svn: 284607

7 years agoRevert r284604. A.K.A. "TMP"
Tim Northover [Wed, 19 Oct 2016 15:56:12 +0000 (15:56 +0000)]
Revert r284604. A.K.A. "TMP"

Committed by mistake.

llvm-svn: 284606

7 years agoSparc: fix test.
Tim Northover [Wed, 19 Oct 2016 15:55:11 +0000 (15:55 +0000)]
Sparc: fix test.

llvm-svn: 284605

7 years agoTMP
Tim Northover [Wed, 19 Oct 2016 15:55:09 +0000 (15:55 +0000)]
TMP

llvm-svn: 284604

7 years agoGlobalISel: support translating volatile loads and stores.
Tim Northover [Wed, 19 Oct 2016 15:55:06 +0000 (15:55 +0000)]
GlobalISel: support translating volatile loads and stores.

llvm-svn: 284603

7 years agoImplement constexpr support for reverse_iterator. Reviewed as https://reviews.llvm...
Marshall Clow [Wed, 19 Oct 2016 15:12:50 +0000 (15:12 +0000)]
Implement constexpr support for reverse_iterator. Reviewed as https://reviews.llvm.org/D25534

llvm-svn: 284602

7 years agoSimplify GetGlobalProperties functions of Thread/Process/Target
Pavel Labath [Wed, 19 Oct 2016 15:12:45 +0000 (15:12 +0000)]
Simplify GetGlobalProperties functions of Thread/Process/Target

Summary:
"Initialization of function-local statics is guaranteed to occur only once even when called from
multiple threads, and may be more efficient than the equivalent code using std::call_once."
<http://en.cppreference.com/w/cpp/thread/call_once>

I'd add that it's also more readable.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 284601

7 years ago[ELF] Choose default segment when it is not specified
Eugene Leviant [Wed, 19 Oct 2016 15:04:49 +0000 (15:04 +0000)]
[ELF] Choose default segment when it is not specified

Linker scripts may specify PHDRS, but not specify section to
segment assignments, i.e:

PHDRS { seg PT_LOAD; }
SECTIONS {
  .sec1 {} : seg
  .sec2 {}
}

In such case linker should still choose some segment for .sec2 section.
This patch will add .sec2 to previously opened segments (seg) or to the
very first PT_LOAD segment, if no section-to-segment assignments has been
made

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

llvm-svn: 284600

7 years agoRemove IntervalTimer class
Pavel Labath [Wed, 19 Oct 2016 15:01:22 +0000 (15:01 +0000)]
Remove IntervalTimer class

Summary:
it was added back in 2013, but there are no uses of it. I started refactoring
it, but then it occured to me it would better to delete it.

Reviewers: clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 284599

7 years agoDon't gc non-alloca non-string pieces.
Rafael Espindola [Wed, 19 Oct 2016 14:50:26 +0000 (14:50 +0000)]
Don't gc non-alloca non-string pieces.

We were already doing it for strings. This matches the behavior of
bfd and gold.

llvm-svn: 284598

7 years agoIntroduce ConstantRange.addWithNoSignedWrap
Artur Pilipenko [Wed, 19 Oct 2016 14:44:23 +0000 (14:44 +0000)]
Introduce ConstantRange.addWithNoSignedWrap

To be used by upcoming change to IndVarSimplify

Reviewed By: sanjoy

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

llvm-svn: 284597

7 years ago[clang-tidy] Add cert-err09-cpp check alias.
Marek Kurdej [Wed, 19 Oct 2016 14:28:19 +0000 (14:28 +0000)]
[clang-tidy] Add cert-err09-cpp check alias.

Summary: This adds cert-err09-cpp alias for completeness, similar to cert-err61-cpp.

Reviewers: alexfh, hokein

Subscribers: cfe-commits

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

llvm-svn: 284596

7 years agoRemove unused diagnostics. NFC.
Benjamin Kramer [Wed, 19 Oct 2016 14:22:38 +0000 (14:22 +0000)]
Remove unused diagnostics. NFC.

llvm-svn: 284595

7 years agoAdd a faster binary search.
Rafael Espindola [Wed, 19 Oct 2016 14:17:36 +0000 (14:17 +0000)]
Add a faster binary search.

Even with the hash table cache, binary search was still pretty
hot. This can be made even faster with prefetching.

Idea from http://cglab.ca/~morin/misc/arraylayout-v2/

I will suggest moving this to llvm.

llvm-svn: 284594

7 years agoMinidump plugin: functions parsing memory structures and filtering module list
Dimitar Vlahovski [Wed, 19 Oct 2016 14:14:18 +0000 (14:14 +0000)]
Minidump plugin: functions parsing memory structures and filtering module list

Summary:
Now the Minidump parser can parse the:
1) MemoryInfoList - containing region info about memory ranges (readable,
writable, executable)
2) Memory64List - this is the stuct used when the Minidump is a
full-memory one.
3) Adding filtering of the module list (shared libraries list) - there
can be mutliple records in the module list under the same name but with
different load address (e.g. when the binary has non contigious
sections). FilterModuleList eliminates the duplicated modules, leaving
the one with the lowest load addr.

Added unit tests for everything.

Reviewers: labath, zturner

Subscribers: beanz, mgorny, modocache, lldb-commits, amccarth

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

llvm-svn: 284593

7 years ago[clang-move] Move using-decl in old cc.
Haojian Wu [Wed, 19 Oct 2016 14:13:21 +0000 (14:13 +0000)]
[clang-move] Move using-decl in old cc.

Summary:
Another fix is to move the whole anonymous namespace declaration
completely instead of moving fun/var declarations only.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 284592

7 years ago[Sparc][LEON] Detects an erratum on UT699 LEON 3 processors involving rounding mode...
Chris Dewhurst [Wed, 19 Oct 2016 14:01:06 +0000 (14:01 +0000)]
[Sparc][LEON] Detects an erratum on UT699 LEON 3 processors involving rounding mode changes and issues an appropriate user error message.

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

llvm-svn: 284591

7 years agoAdd Chrono.h - std::chrono support header
Pavel Labath [Wed, 19 Oct 2016 13:58:55 +0000 (13:58 +0000)]
Add Chrono.h - std::chrono support header

Summary:
std::chrono mostly covers the functionality of llvm::sys::TimeValue and
lldb_private::TimeValue. This header adds a bit of utility functions and
typedefs, which make the usage of the library and porting code from TimeValues
easier.

Rationale:
- TimePoint typedef - precision of system_clock is implementation defined -
  using a well-defined precision helps maintain consistency between platforms,
  makes it interact better with existing TimeValue classes, and avoids cases
  there a time point is implicitly convertible to a specific precision on some
  platforms but not on others.
- system_clock::to_time_t only accepts time_points with the default system
  precision (even though time_t has only second precision on all platforms we
  support). To avoid the need for explicit casts, I have added a toTimeT()
  wrapper function. toTimePoint(time_t) was not strictly necessary, but I have
  added it for symmetry.

Reviewers: zturner, mehdi_amini

Subscribers: beanz, mgorny, llvm-commits, modocache

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

llvm-svn: 284590

7 years agoDon't copy replacements in for-range loop. NFC.
Benjamin Kramer [Wed, 19 Oct 2016 13:50:17 +0000 (13:50 +0000)]
Don't copy replacements in for-range loop. NFC.

llvm-svn: 284589

7 years agoReapply r284571 (with the new tests fixed).
Sjoerd Meijer [Wed, 19 Oct 2016 13:43:02 +0000 (13:43 +0000)]
Reapply r284571 (with the new tests fixed).

llvm-svn: 284588

7 years agollvm/test/MC/Mips/macro-ld-sd.s: Sweep a spurious character \xA0 in the test file.
NAKAMURA Takumi [Wed, 19 Oct 2016 13:41:12 +0000 (13:41 +0000)]
llvm/test/MC/Mips/macro-ld-sd.s: Sweep a spurious character \xA0 in the test file.

It might crash FileCheck.

llvm-svn: 284587