platform/upstream/llvm.git
7 years agoWhen optimizing for size, enable loop rerolling by default
Hal Finkel [Sun, 9 Oct 2016 03:06:31 +0000 (03:06 +0000)]
When optimizing for size, enable loop rerolling by default

We have a loop-rerolling optimization which can be enabled by using
-freroll-loops. While sometimes loops are hand-unrolled for performance
reasons, when optimizing for size, we should always undo this manual
optimization to produce smaller code (our optimizer's unroller will still
unroll the rerolled loops if it thinks that is a good idea).

llvm-svn: 283685

7 years ago[CMake] Fix in-tree libcxxabi build support after r283659
Hal Finkel [Sun, 9 Oct 2016 02:49:31 +0000 (02:49 +0000)]
[CMake] Fix in-tree libcxxabi build support after r283659

r283659 changed the argument to gen_link_script.py from SCRIPT_ABI_LIBNAME to
LIBCXX_LIBRARIES_PUBLIC, assuming that all of the items in the
LIBCXX_LIBRARIES_PUBLIC list were library names. This is not right, however,
for in-tree libcxxabi builds, we might have the target name in this list. There
was special logic to fixup SCRIPT_ABI_LIBNAME for this situation; change it to
apply a similar fixup for LIBCXX_LIBRARIES_PUBLIC.

llvm-svn: 283684

7 years ago[CUDA] Don't install cuda_wrappers/{algorithm,complex} into the main include dir.
Justin Lebar [Sun, 9 Oct 2016 00:27:39 +0000 (00:27 +0000)]
[CUDA] Don't install cuda_wrappers/{algorithm,complex} into the main include dir.

This is obviously wrong -- if we do this, then all compiles will pick up
these wrappers, which is not what we want.

llvm-svn: 283683

7 years ago[libFuzzer] when shrinking the corpus, delete evicted files previously created by...
Kostya Serebryany [Sat, 8 Oct 2016 23:24:45 +0000 (23:24 +0000)]
[libFuzzer] when shrinking the corpus, delete evicted files previously created by the current process

llvm-svn: 283682

7 years agoThinLTO: Fix Gold test after caching fix in r283655
Mehdi Amini [Sat, 8 Oct 2016 22:49:28 +0000 (22:49 +0000)]
ThinLTO: Fix Gold test after caching fix in r283655

(I don't have Gold available, so this is speculative)

llvm-svn: 283681

7 years ago[CUDA] Support <complex> and std::min/max on the device.
Justin Lebar [Sat, 8 Oct 2016 22:16:12 +0000 (22:16 +0000)]
[CUDA] Support <complex> and std::min/max on the device.

Summary:
We do this by wrapping <complex> and <algorithm>.

Tests are in the test-suite.

Reviewers: tra

Subscribers: jhen, beanz, cfe-commits, mgorny

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

llvm-svn: 283680

7 years ago[CUDA] Rename cuda_builtin_vars.h to __clang_cuda_builtin_vars.h.
Justin Lebar [Sat, 8 Oct 2016 22:16:08 +0000 (22:16 +0000)]
[CUDA] Rename cuda_builtin_vars.h to __clang_cuda_builtin_vars.h.

Summary: This matches the idiom we use for our other CUDA wrapper headers.

Reviewers: tra

Subscribers: beanz, mgorny, cfe-commits

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

llvm-svn: 283679

7 years ago[CUDA] Declare our __device__ math functions in the same inline namespace as our...
Justin Lebar [Sat, 8 Oct 2016 22:16:03 +0000 (22:16 +0000)]
[CUDA] Declare our __device__ math functions in the same inline namespace as our standard library.

Summary:
Currently we declare our inline __device__ math functions in namespace
std.  But libstdc++ and libc++ declare these functions in an inline
namespace inside namespace std.  We need to match this because, in a
later patch, we want to get e.g. <complex> to use our device overloads,
and it only will if those overloads are in the right inline namespace.

Reviewers: tra

Subscribers: cfe-commits, jhen

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

llvm-svn: 283678

7 years ago[CUDA] Add #pragma clang force_cuda_host_device_{begin,end} pragmas.
Justin Lebar [Sat, 8 Oct 2016 22:15:58 +0000 (22:15 +0000)]
[CUDA] Add #pragma clang force_cuda_host_device_{begin,end} pragmas.

Summary:
These cause us to consider all functions in-between to be __host__
__device__.

You can nest these pragmas; you just can't have more 'end's than
'begin's.

Reviewers: rsmith

Subscribers: tra, jhen, cfe-commits

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

llvm-svn: 283677

7 years ago[libFuzzer] control the reload interval by a flag, make it 10 seconds by default
Kostya Serebryany [Sat, 8 Oct 2016 22:12:14 +0000 (22:12 +0000)]
[libFuzzer] control the reload interval by a flag, make it 10 seconds by default

llvm-svn: 283676

7 years ago[libFuzzer] fix use-after-free in libFuzzer found by ... fuzzing.
Kostya Serebryany [Sat, 8 Oct 2016 21:57:48 +0000 (21:57 +0000)]
[libFuzzer] fix use-after-free in libFuzzer found by ... fuzzing.

llvm-svn: 283675

7 years ago[X86][SSE] Regenerate select tests
Simon Pilgrim [Sat, 8 Oct 2016 21:17:44 +0000 (21:17 +0000)]
[X86][SSE] Regenerate select tests

llvm-svn: 283674

7 years agoRevert "[X86] Apply the Update LLC Test Checks tool on the rotate tests."
Zvi Rackover [Sat, 8 Oct 2016 20:54:20 +0000 (20:54 +0000)]
Revert "[X86] Apply the Update LLC Test Checks tool on the rotate tests."

This reverts commit 283667.

llvm-svn: 283673

7 years ago[X86][SSE] Regenerate and add 32-bit tests to widening tests
Simon Pilgrim [Sat, 8 Oct 2016 19:54:28 +0000 (19:54 +0000)]
[X86][SSE] Regenerate and add 32-bit tests to widening tests

llvm-svn: 283672

7 years agoTurn cl::values() (for enum) from a vararg function to using C++ variadic template
Mehdi Amini [Sat, 8 Oct 2016 19:41:06 +0000 (19:41 +0000)]
Turn cl::values() (for enum) from a vararg function to using C++ variadic template

The core of the change is supposed to be NFC, however it also fixes
what I believe was an undefined behavior when calling:

 va_start(ValueArgs, Desc);

with Desc being a StringRef.

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

llvm-svn: 283671

7 years agoFix comment typos - full update script path in assertions note
Simon Pilgrim [Sat, 8 Oct 2016 18:51:55 +0000 (18:51 +0000)]
Fix comment typos - full update script path in assertions note

llvm-svn: 283670

7 years ago[AVX-512] Add test case for PR30430 that I should have added in r281959.
Craig Topper [Sat, 8 Oct 2016 18:50:00 +0000 (18:50 +0000)]
[AVX-512] Add test case for PR30430 that I should have added in r281959.

llvm-svn: 283669

7 years ago[AVX-512] Fix a bug in getLargestLegalSuperClass where we inflated to VR128X/VR256X...
Craig Topper [Sat, 8 Oct 2016 18:49:57 +0000 (18:49 +0000)]
[AVX-512] Fix a bug in getLargestLegalSuperClass where we inflated to VR128X/VR256X even when VLX isn't supported.

This seems to have been responsible for the XMM16-31 spills observed in PR29112. With this fixed the test case has been modified to no longer have a spill of XMM16.

llvm-svn: 283668

7 years ago[X86] Apply the Update LLC Test Checks tool on the rotate tests.
Zvi Rackover [Sat, 8 Oct 2016 18:44:47 +0000 (18:44 +0000)]
[X86] Apply the Update LLC Test Checks tool on the rotate tests.

Also added cases demonstrating pr30644.

llvm-svn: 283667

7 years ago[X86][AVX2] Regenerate and add 32-bit tests to core tests
Simon Pilgrim [Sat, 8 Oct 2016 18:36:57 +0000 (18:36 +0000)]
[X86][AVX2] Regenerate and add 32-bit tests to core tests

llvm-svn: 283666

7 years ago[Hexagon] Adding change of flow max 1 (cofMax1) TS flag for marking this restriction...
Colin LeMahieu [Sat, 8 Oct 2016 17:18:51 +0000 (17:18 +0000)]
[Hexagon] Adding change of flow max 1 (cofMax1) TS flag for marking this restriction rather than implying it from TypeJR.

llvm-svn: 283665

7 years ago[ThinLTO] Record calls to aliases
Teresa Johnson [Sat, 8 Oct 2016 16:11:42 +0000 (16:11 +0000)]
[ThinLTO] Record calls to aliases

Summary:
When there is a call to an alias in the same module, we were not
adding a call edge. So we could incorrectly think that the alias
was dead if it was inlined in that function, despite having a
reference imported elsewhere. This resulted in unsats at link time.

Add a call edge when the call is to an alias.

Reviewers: davide, mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 283664

7 years ago[AArch64] Avoid generating indexed vector instructions for Exynos
Sebastian Pop [Sat, 8 Oct 2016 12:30:07 +0000 (12:30 +0000)]
[AArch64] Avoid generating indexed vector instructions for Exynos

Avoid generating indexed vector instructions for Exynos. This is needed for
fmla/fmls/fmul/fmulx. For example, the instruction

  fmla v0.4s, v1.4s, v2.s[1]

is less efficient than the instructions

  dup v2.4s, v2.s[1]
  fmla v0.4s, v1.4s, v2.4s

Patch written by Abderrazek Zaafrani.

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

llvm-svn: 283663

7 years ago[analyzer] Fix build error after r283660 - remove constexpr strings.
Artem Dergachev [Sat, 8 Oct 2016 11:07:21 +0000 (11:07 +0000)]
[analyzer] Fix build error after r283660 - remove constexpr strings.

llvm-svn: 283662

7 years ago[analyzer] Re-apply r283094 "Improve CloneChecker diagnostics"
Artem Dergachev [Sat, 8 Oct 2016 10:54:30 +0000 (10:54 +0000)]
[analyzer] Re-apply r283094 "Improve CloneChecker diagnostics"

The parent commit (r283092) was reverted before and now finally landed.

llvm-svn: 283661

7 years ago[analyzer] Re-apply r283093 "Add extra notes to ObjCDeallocChecker"
Artem Dergachev [Sat, 8 Oct 2016 10:53:00 +0000 (10:53 +0000)]
[analyzer] Re-apply r283093 "Add extra notes to ObjCDeallocChecker"

The parent commit (r283092) was reverted before and now finally landed.

llvm-svn: 283660

7 years ago[cmake] Split linked libraries into private & public, for linker script
Michal Gorny [Sat, 8 Oct 2016 10:27:45 +0000 (10:27 +0000)]
[cmake] Split linked libraries into private & public, for linker script

Introduce LIBCXX_LIBRARIES_PUBLIC in addition to LIBCXX_LIBRARIES that
holds 'public' interface libraries -- that is, libraries that both
libc++ links to and programs linked against it need to link to.

Currently this includes the ABI library and optionally -lunwind (when
LIBCXXABI_USE_LLVM_UNWINDER is on). The libraries are included in the
linker script, in order to make it possible to link C++ programs using
clang with compiler-rt runtime out-of-the-box.

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

llvm-svn: 283659

7 years ago[compiler-rt] Exclude compiler-rt from using -fmodules when LLVM_ENABLE_MODULES=On
Kuba Brecka [Sat, 8 Oct 2016 09:01:27 +0000 (09:01 +0000)]
[compiler-rt] Exclude compiler-rt from using -fmodules when LLVM_ENABLE_MODULES=On

Sanitizers are intentionally not including system headers and often declare slightly different function prototypes, which is incompatible with -fmodules and -fcxx-modules. Let’s simply exclude compiler-rt from using -fmodules.

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

llvm-svn: 283658

7 years agoUn-tabify source files, NFC.
Yaron Keren [Sat, 8 Oct 2016 06:45:10 +0000 (06:45 +0000)]
Un-tabify source files, NFC.

llvm-svn: 283657

7 years ago[OptRemarks] Remove non-printable chars from function name
Adam Nemet [Sat, 8 Oct 2016 04:47:20 +0000 (04:47 +0000)]
[OptRemarks] Remove non-printable chars from function name

Value names may be prefixed with a binary '1' to indicate that the
backend should not modify the symbols due to any platform naming
convention.

This should not show up in the YAML opt record file because it breaks
the YAML parser.

llvm-svn: 283656

7 years agoThinLTO: don't perform incremental LTO on module without a hash
Mehdi Amini [Sat, 8 Oct 2016 04:44:23 +0000 (04:44 +0000)]
ThinLTO: don't perform incremental LTO on module without a hash

Clang always emit a hash for ThinLTO, but as other frontend are
starting to use ThinLTO, this could be a serious bug.

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

llvm-svn: 283655

7 years agoThinLTO: handles modules with empty summaries
Mehdi Amini [Sat, 8 Oct 2016 04:44:18 +0000 (04:44 +0000)]
ThinLTO: handles modules with empty summaries

We need to add an entry in the combined-index for modules that have
a hash but otherwise empty summary, this is needed so that we can
get the hash for the module.

Also, if no entry is present in the combined index for a module, we
need to skip it when trying to compute a cache entry.

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

llvm-svn: 283654

7 years agoRequires the AVR backend for running test/CodeGen/AVR
Mehdi Amini [Sat, 8 Oct 2016 04:39:34 +0000 (04:39 +0000)]
Requires the AVR backend for running test/CodeGen/AVR

llvm-svn: 283653

7 years agoFix compiler warnings in TestClangASTContext.cpp
Pavel Labath [Sat, 8 Oct 2016 04:03:19 +0000 (04:03 +0000)]
Fix compiler warnings in TestClangASTContext.cpp

llvm-svn: 283652

7 years agoFix compiler warnings in PlatformDarwinTest.cpp
Pavel Labath [Sat, 8 Oct 2016 04:03:15 +0000 (04:03 +0000)]
Fix compiler warnings in PlatformDarwinTest.cpp

llvm-svn: 283651

7 years agoRevert "Codegen: Tail-duplicate during placement."
Kyle Butt [Sat, 8 Oct 2016 01:47:05 +0000 (01:47 +0000)]
Revert "Codegen: Tail-duplicate during placement."

This reverts commit 71c312652c10f1855b28d06697c08d47e7a243e4.

llvm-svn: 283647

7 years agoUse StringRef in Command::printArg() instead of raw pointer (NFC)
Mehdi Amini [Sat, 8 Oct 2016 01:38:43 +0000 (01:38 +0000)]
Use StringRef in Command::printArg() instead of raw pointer (NFC)

llvm-svn: 283645

7 years agoRemove all _LIBCPP_VERSION tests from under test/std
Eric Fiselier [Sat, 8 Oct 2016 01:32:56 +0000 (01:32 +0000)]
Remove all _LIBCPP_VERSION tests from under test/std

llvm-svn: 283644

7 years agoPurge all usages of _LIBCPP_STD_VER under test/std/algorithm
Eric Fiselier [Sat, 8 Oct 2016 01:25:23 +0000 (01:25 +0000)]
Purge all usages of _LIBCPP_STD_VER under test/std/algorithm

llvm-svn: 283643

7 years ago[AVR] Add backend dependencies to MCTargetDesc/LLVMBuild.txt
Dylan McKay [Sat, 8 Oct 2016 01:14:23 +0000 (01:14 +0000)]
[AVR] Add backend dependencies to MCTargetDesc/LLVMBuild.txt

llvm-svn: 283642

7 years ago[pdb] Dump Module Symbols to Yaml.
Zachary Turner [Sat, 8 Oct 2016 01:12:01 +0000 (01:12 +0000)]
[pdb] Dump Module Symbols to Yaml.

This is the first step towards round-tripping symbol information,
and thusly being able to write symbol information to a PDB.

This patch writes the symbol information for each compiland to
the Yaml when running in pdb2yaml mode.  There's still some loose
ends, such as what to do about relocations (necessary in order to
print linkage names), how to print enums with friendly names, and
how to give the dumper access to the StringTable, but this is a
good first start.

llvm-svn: 283641

7 years agoFix incorrect assertion in AVRFrameLowering.cpp
Dylan McKay [Sat, 8 Oct 2016 01:10:36 +0000 (01:10 +0000)]
Fix incorrect assertion in AVRFrameLowering.cpp

This wasn't looking at the right instruction, and would always fail.

llvm-svn: 283640

7 years ago[AVR] Don't worry about call frame size when initializing frame pointer
Dylan McKay [Sat, 8 Oct 2016 01:10:31 +0000 (01:10 +0000)]
[AVR] Don't worry about call frame size when initializing frame pointer

We previously only used the frame pointer if the frame pointer was too
big. This was to work around a bug (described in this old commit)

https://sourceforge.net/p/avr-llvm/code/204/tree//llvm/trunk/AVR/AVRFrameLowering.cpp?diff=50d64d912718465cb887d17a:203

I mistakenly invered the condition assuming it was a typo. I am now
removing it because it doesn't seem to be a problem anymore (plus it's a
dirty hack).

llvm-svn: 283639

7 years ago[AVR] Don't shadow container while iterating in range-based loop
Dylan McKay [Sat, 8 Oct 2016 01:09:06 +0000 (01:09 +0000)]
[AVR] Don't shadow container while iterating in range-based loop

This works on clang, but fails on GCC 4.6

llvm-svn: 283638

7 years ago[CUDA] Do a better job at detecting wrong-side calls.
Justin Lebar [Sat, 8 Oct 2016 01:07:11 +0000 (01:07 +0000)]
[CUDA] Do a better job at detecting wrong-side calls.

Summary:
Move CheckCUDACall from ActOnCallExpr and BuildDeclRefExpr to
DiagnoseUseOfDecl.  This lets us catch some edge cases we were missing,
specifically around class operators.

This necessitates a few other changes:

 - Avoid emitting duplicate deferred diags in CheckCUDACall.

   Previously we'd carefully placed our call to CheckCUDACall such that
   it would only ever run once for a particular callsite.  But now this
   isn't the case.

 - Emit deferred diagnostics from a template
   specialization/instantiation's primary template, in addition to from
   the specialization/instantiation itself.  DiagnoseUseOfDecl ends up
   putting the deferred diagnostics on the template, rather than the
   specialization, so we need to check both.

Reviewers: rsmith

Subscribers: cfe-commits, tra

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

llvm-svn: 283637

7 years ago[AVR] Use references rather than pointers in AVRISelLowering
Dylan McKay [Sat, 8 Oct 2016 01:06:21 +0000 (01:06 +0000)]
[AVR] Use references rather than pointers in AVRISelLowering

llvm-svn: 283636

7 years agoAllow a maximum of 64 bits to be returned in registers
Dylan McKay [Sat, 8 Oct 2016 01:05:09 +0000 (01:05 +0000)]
Allow a maximum of 64 bits to be returned in registers

The rest spills to the stack

Authored by Jake Goulding

llvm-svn: 283635

7 years ago[AVR] Expand MULHS for all types
Dylan McKay [Sat, 8 Oct 2016 01:01:49 +0000 (01:01 +0000)]
[AVR] Expand MULHS for all types

Once MULHS was expanded, this exposed an issue where the condition
register was thought to be 16-bit. This caused an attempt to copy a
16-bit register to an 8-bit register.

Authored by Jake Goulding

llvm-svn: 283634

7 years agoAdd missing <memory> include in test
Eric Fiselier [Sat, 8 Oct 2016 00:59:16 +0000 (00:59 +0000)]
Add missing <memory> include in test

llvm-svn: 283633

7 years agoAdd missing include in test_allocator.h
Eric Fiselier [Sat, 8 Oct 2016 00:57:56 +0000 (00:57 +0000)]
Add missing include in test_allocator.h

llvm-svn: 283632

7 years ago[libc++] Fix stack_allocator
Eric Fiselier [Sat, 8 Oct 2016 00:56:22 +0000 (00:56 +0000)]
[libc++] Fix stack_allocator

Summary:
To quote STL the problems with stack allocator are"

>"stack_allocator<T, N> is seriously nonconformant to N4582 17.6.3.5 [allocator.requirements].
> First, it lacks a rebinding constructor. (The nested "struct rebind" isn't sufficient.)
> Second, it lacks templated equality/inequality.
> Third, it completely ignores alignment.
> Finally, and most severely, the Standard forbids its existence. Allocators are forbidden from returning memory "inside themselves". This requirement is implied by the Standard's requirements for rebinding and equality. It's permitted to return memory from a separate buffer object on the stack, though."

This patch attempts to address all of those issues.

First, instead of storing the buffer inside the allocator I've change `stack_allocator` to accept the buffer as an argument.

Second, in order to fix rebinding I changed the parameter list from `<class T, size_t NumElements>` to `<class T, size_t NumBytes>`. This allows allocator rebinding
between types that have different sizes.

Third, I added copy and rebinding constructors and assignment operators.

And finally I fixed the allocation logic to always return properly aligned storage.

Reviewers: mclow.lists, howard.hinnant, STL_MSFT

Subscribers: cfe-commits

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

llvm-svn: 283631

7 years ago[AVR] Add the 'SoftFail' field to all instruction formats
Dylan McKay [Sat, 8 Oct 2016 00:55:46 +0000 (00:55 +0000)]
[AVR] Add the 'SoftFail' field to all instruction formats

This will be used in the future for disassembly.

llvm-svn: 283630

7 years ago[AVR] Set up the instruction printer and the assembly backend
Dylan McKay [Sat, 8 Oct 2016 00:50:11 +0000 (00:50 +0000)]
[AVR] Set up the instruction printer and the assembly backend

llvm-svn: 283629

7 years ago[AVR] Add dependencies to AVR libraries in AVRCodeGen
Dylan McKay [Sat, 8 Oct 2016 00:45:24 +0000 (00:45 +0000)]
[AVR] Add dependencies to AVR libraries in AVRCodeGen

llvm-svn: 283628

7 years ago[AVR] Add missing subdirectories to LLVMBuild
Dylan McKay [Sat, 8 Oct 2016 00:42:58 +0000 (00:42 +0000)]
[AVR] Add missing subdirectories to LLVMBuild

llvm-svn: 283627

7 years ago[llvm-opt-report] Don't leave space for opts that never happen
Hal Finkel [Sat, 8 Oct 2016 00:26:54 +0000 (00:26 +0000)]
[llvm-opt-report] Don't leave space for opts that never happen

Because screen space is precious, if an optimization (vectorization, for
example) never happens, don't leave empty space for the associated markers on
every line of the output. This makes the output much more compact, and allows
for the later inclusion of markers for more (although perhaps rare)
optimizations.

llvm-svn: 283626

7 years ago[coroutines] Store an address of destroy OR cleanup part in the coroutine frame.
Gor Nishanov [Sat, 8 Oct 2016 00:22:50 +0000 (00:22 +0000)]
[coroutines] Store an address of destroy OR cleanup part in the coroutine frame.

Summary:
If heap allocation of a coroutine is elided, we need to make sure that we will update an address stored in the coroutine frame from f.destroy to f.cleanup.
Before this change, CoroSplit synthesized these stores after coro.begin:

```
    store void (%f.Frame*)* @f.resume, void (%f.Frame*)** %resume.addr
    store void (%f.Frame*)* @f.destroy, void (%f.Frame*)** %destroy.addr

```

In those cases where we did heap elision, but were not able to devirtualize all indirect calls, destroy call will attempt to "free" the coroutine frame stored on the stack. Oops.

Now we use select to put an appropriate coroutine subfunction in the destroy slot. As bellow:

```
    store void (%f.Frame*)* @f.resume, void (%f.Frame*)** %resume.addr
    %0 = select i1 %need.alloc, void (%f.Frame*)* @f.destroy, void (%f.Frame*)* @f.cleanup
    store void (%f.Frame*)* %0, void (%f.Frame*)** %destroy.addr
```

Reviewers: majnemer

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 283625

7 years ago[docs] Fix indentation bug in LangRef.
Lang Hames [Sat, 8 Oct 2016 00:20:42 +0000 (00:20 +0000)]
[docs] Fix indentation bug in LangRef.

llvm-svn: 283624

7 years ago[AVR] Add the assembly printer
Dylan McKay [Sat, 8 Oct 2016 00:02:36 +0000 (00:02 +0000)]
[AVR] Add the assembly printer

Summary: This adds the AVRAsmPrinter class.

Reviewers: arsenm, kparzysz

Subscribers: llvm-commits, wdng, beanz, japaric, mgorny

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

llvm-svn: 283623

7 years agoAMDGPU/SI: Handle div_fmas hazard in GCNHazardRecognizer
Tom Stellard [Fri, 7 Oct 2016 23:42:48 +0000 (23:42 +0000)]
AMDGPU/SI: Handle div_fmas hazard in GCNHazardRecognizer

Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, tony-tye, llvm-commits

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

llvm-svn: 283622

7 years agoDisable alignment support of 0x4000 for Win32. https://reviews.llvm.org/D25053
Marshall Clow [Fri, 7 Oct 2016 23:19:04 +0000 (23:19 +0000)]
Disable alignment support of 0x4000 for Win32. https://reviews.llvm.org/D25053

llvm-svn: 283621

7 years agoFix PR30642 - libc++ leaks always-visible symbols into programs
Eric Fiselier [Fri, 7 Oct 2016 23:07:59 +0000 (23:07 +0000)]
Fix PR30642 -  libc++ leaks always-visible symbols into programs

This was caused by r281673, specifically changing `_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS`
from `__attribute__((__type_visibility__("default")))` to
`__attribute__((__visibility("default")))`.

I made that change because I thought the external instantiations needed
their members to have default visibility. However since libc++ never builds
with -fvisibility=hidden this appears not to be needed. Instead this change
caused previously hidden inline methods to become un-hidden, which is a regression.

This patch reverts the problematic change and fixes PR30642.

llvm-svn: 283620

7 years agoCodegen: Tail-duplicate during placement.
Kyle Butt [Fri, 7 Oct 2016 22:33:20 +0000 (22:33 +0000)]
Codegen: Tail-duplicate during placement.

The tail duplication pass uses an assumed layout when making duplication
decisions. This is fine, but passes up duplication opportunities that
may arise when blocks are outlined. Because we want the updated CFG to
affect subsequent placement decisions, this change must occur during
placement.

In order to achieve this goal, TailDuplicationPass is split into a
utility class, TailDuplicator, and the pass itself. The pass delegates
nearly everything to the TailDuplicator object, except for looping over
the blocks in a function. This allows the same code to be used for tail
duplication in both places.

This change, in concert with outlining optional branches, allows
triangle shaped code to perform much better, esepecially when the
taken/untaken branches are correlated, as it creates a second spine when
the tests are small enough.

Issue from previous rollback fixed, and a new test was added for that
case as well. Issue was worklist/scheduling/taildup issue in layout.

Issue from 2nd rollback fixed, with 2 additional tests. Issue was
tail merging/loop info/tail-duplication causing issue with loops that share
a header block.

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

llvm-svn: 283619

7 years agoFix shadow warnings. Patch from STL@microsoft.com
Eric Fiselier [Fri, 7 Oct 2016 22:10:35 +0000 (22:10 +0000)]
Fix shadow warnings. Patch from STL@microsoft.com

llvm-svn: 283618

7 years agoswifterror: Don't compute swifterror vregs during instruction selection
Arnold Schwaighofer [Fri, 7 Oct 2016 22:06:55 +0000 (22:06 +0000)]
swifterror: Don't compute swifterror vregs during instruction selection

The code used llvm basic block predecessors to decided where to insert phi
nodes. Instruction selection can and will liberally insert new machine basic
block predecessors. There is not a guaranteed one-to-one mapping from pred.
llvm basic blocks and machine basic blocks.

Therefore the current approach does not work as it assumes we can mark
predecessor machine basic block as needing a copy, and needs to know the set of
all predecessor machine basic blocks to decide when to insert phis.

Instead of computing the swifterror vregs as we select instructions, propagate
them at the end of instruction selection when the MBB CFG is complete.

When an instruction needs a swifterror vreg and we don't know the value yet,
generate a new vreg and remember this "upward exposed" use, and reconcile this
at the end of instruction selection.

This will only happen if the target supports promoting swifterror parameters to
registers and the swifterror attribute is used.

rdar://28300923

llvm-svn: 283617

7 years agoRename variable to not use C++ reserved name (leading underscore + capital) (NFC)
Mehdi Amini [Fri, 7 Oct 2016 22:03:03 +0000 (22:03 +0000)]
Rename variable to not use C++ reserved name (leading underscore + capital) (NFC)

llvm-svn: 283616

7 years agoFix MSVC build: requires namespace in front of StringRef (NFC)
Mehdi Amini [Fri, 7 Oct 2016 22:02:59 +0000 (22:02 +0000)]
Fix MSVC build: requires namespace in front of StringRef (NFC)

llvm-svn: 283615

7 years ago[DAG] clean up foldSelectOfConstants(); NFCI
Sanjay Patel [Fri, 7 Oct 2016 21:55:42 +0000 (21:55 +0000)]
[DAG] clean up foldSelectOfConstants(); NFCI

Rename variables, simplify logic.
Not clear yet why we don't handle a target with ZeroOrNegativeOneBooleanContent too.

llvm-svn: 283613

7 years ago[InstCombine] Don't unpack arrays that are too large (part 2).
Davide Italiano [Fri, 7 Oct 2016 21:53:09 +0000 (21:53 +0000)]
[InstCombine] Don't unpack arrays that are too large (part 2).

This is similar to r283599, but for store instructions.
Thanks to David for pointing out!

llvm-svn: 283612

7 years agoDriver: use StringRef instead of raw pointer in lookupTypeForExtension() (NFC)
Mehdi Amini [Fri, 7 Oct 2016 21:41:00 +0000 (21:41 +0000)]
Driver: use StringRef instead of raw pointer in lookupTypeForExtension() (NFC)

llvm-svn: 283611

7 years agoAdd missing include.
Zachary Turner [Fri, 7 Oct 2016 21:40:06 +0000 (21:40 +0000)]
Add missing include.

llvm-svn: 283610

7 years agoRefactor Symbol visitor code.
Zachary Turner [Fri, 7 Oct 2016 21:34:46 +0000 (21:34 +0000)]
Refactor Symbol visitor code.

Type visitor code had already been refactored previously to
decouple the visitor and the visitor callback interface.  This
was necessary for having the flexibility to visit in different
ways (for example, dumping to yaml, reading from yaml, dumping
to ScopedPrinter, etc).

This patch merely implements the same visitation pattern for
symbol records that has already been implemented for type records.

llvm-svn: 283609

7 years ago[cmake] Treat polly as "in tree" if LLVM_EXTERNAL_POLLY_SOURCE_DIR is provided
Hongbin Zheng [Fri, 7 Oct 2016 21:32:47 +0000 (21:32 +0000)]
[cmake] Treat polly as "in tree" if LLVM_EXTERNAL_POLLY_SOURCE_DIR is provided

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

llvm-svn: 283608

7 years agoFix a few warnings caught by clang.
Zachary Turner [Fri, 7 Oct 2016 21:32:16 +0000 (21:32 +0000)]
Fix a few warnings caught by clang.

llvm-svn: 283607

7 years agoFix various issues in std::any and the related tests.
Eric Fiselier [Fri, 7 Oct 2016 21:27:45 +0000 (21:27 +0000)]
Fix various issues in std::any and the related tests.

* Fix self-swap. Patch from Casey Carter.

* Remove workarounds and tests for types with deleted move constructors. This
  was originally added as part of a LWG proposed resolution that has since
  changed.

* Re-apply most recent PR for LWG 2769.

* Re-apply most recent PR for LWG 2754. Specifically fix the SFINAE checks to
  use the decayed type.

* Fix tests to allow moved-from std::any's to have a non-empty state. This is
  the behavior of MSVC's std::any.

* Various whitespace and test fixes.

llvm-svn: 283606

7 years agoTurn ArchName/BoundArch in Driver from raw pointer to StringRef (NFC)
Mehdi Amini [Fri, 7 Oct 2016 21:27:26 +0000 (21:27 +0000)]
Turn ArchName/BoundArch in Driver from raw pointer to StringRef (NFC)

llvm-svn: 283605

7 years agoRemove a stray dump().
Sean Callanan [Fri, 7 Oct 2016 21:25:29 +0000 (21:25 +0000)]
Remove a stray dump().

<rdar://problem/28635530>

llvm-svn: 283604

7 years agoRemove unused variable.
Zachary Turner [Fri, 7 Oct 2016 21:23:31 +0000 (21:23 +0000)]
Remove unused variable.

llvm-svn: 283603

7 years agoVisually align table def with respective enum. NFC
Douglas Katzman [Fri, 7 Oct 2016 21:02:38 +0000 (21:02 +0000)]
Visually align table def with respective enum. NFC

'warn_attribute_wrong_decl_type' has to stay in sync with
'enum AttributeDeclKind' which is much easier when they line up.

llvm-svn: 283601

7 years agoDefine PATH_MAX on windows
Hongbin Zheng [Fri, 7 Oct 2016 20:58:20 +0000 (20:58 +0000)]
Define PATH_MAX on windows

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

llvm-svn: 283600

7 years ago[InstCombine] Don't unpack arrays that are too large
Davide Italiano [Fri, 7 Oct 2016 20:57:42 +0000 (20:57 +0000)]
[InstCombine] Don't unpack arrays that are too large

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

llvm-svn: 283599

7 years ago[esan] Fix ESan test failure on Debian Sid bot
Qin Zhao [Fri, 7 Oct 2016 20:53:35 +0000 (20:53 +0000)]
[esan] Fix ESan test failure on Debian Sid bot

Summary: Increase early allocation buffer size.

Reviewers: bruening

Subscribers: kubabrecka

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

llvm-svn: 283598

7 years ago[DAG] move fold (select C, 0, 1 -> xor C, 1) to a helper function; NFC
Sanjay Patel [Fri, 7 Oct 2016 20:47:51 +0000 (20:47 +0000)]
[DAG] move fold (select C, 0, 1 -> xor C, 1) to a helper function; NFC

We're missing at least 3 other similar folds based on what we have in InstCombine.

llvm-svn: 283596

7 years agoAMDGPU/SI: Add support for 8-byte relocations
Tom Stellard [Fri, 7 Oct 2016 20:36:58 +0000 (20:36 +0000)]
AMDGPU/SI: Add support for 8-byte relocations

Reviewers: arsenm, kzhuravl

Subscribers: wdng, nhaehnle, yaxunl, llvm-commits, tony-tye

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

llvm-svn: 283593

7 years ago[RS4GC] Strengthen coverage: add more tests
Anna Thomas [Fri, 7 Oct 2016 20:34:00 +0000 (20:34 +0000)]
[RS4GC] Strengthen coverage: add more tests

Summary: Add tests for cases where we have zero coverage in RS4GC.

Reviewers: sanjoy, reames

Subscribers: llvm-commits

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

llvm-svn: 283591

7 years agoRevert r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when...
Michal Gorny [Fri, 7 Oct 2016 20:04:00 +0000 (20:04 +0000)]
Revert r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when used

Revert the -print-libgcc-file-name change as the new test fails
on Darwin. It needs to be updated to run the libgcc part only on systems
supporting that rtlib.

llvm-svn: 283586

7 years agoImprove comments.
Rui Ueyama [Fri, 7 Oct 2016 19:54:57 +0000 (19:54 +0000)]
Improve comments.

Also use uint64_t instead of uintX_t so that you don't have to
think about two different cases to verify that the code is correct.

llvm-svn: 283585

7 years ago[analyzer] Re-apply r283092, attempt no.4, chunk no.4 (last)
Artem Dergachev [Fri, 7 Oct 2016 19:25:10 +0000 (19:25 +0000)]
[analyzer] Re-apply r283092, attempt no.4, chunk no.4 (last)

The problem that caused the msvc crash has been indentified and fixed
in the previous commit. This patch contains the rest of r283092.

llvm-svn: 283584

7 years agoSilence Warning. NFC.
Nirav Dave [Fri, 7 Oct 2016 19:11:33 +0000 (19:11 +0000)]
Silence Warning. NFC.

llvm-svn: 283583

7 years ago[Hexagon][NFC] Using documented instruction type name V4LDST instead of MEMOP.
Colin LeMahieu [Fri, 7 Oct 2016 19:11:28 +0000 (19:11 +0000)]
[Hexagon][NFC] Using documented instruction type name V4LDST instead of MEMOP.

llvm-svn: 283582

7 years agoRecommit "Use StringRef in LTOModule implementation (NFC)""
Mehdi Amini [Fri, 7 Oct 2016 19:05:14 +0000 (19:05 +0000)]
Recommit "Use StringRef in LTOModule implementation (NFC)""

This reverts commit r283456 and reapply r282997, with explicitly
zeroing the struct member to workaround a bug in MSVC2013 with
zero-initialization: https://connect.microsoft.com/VisualStudio/feedback/details/802160

llvm-svn: 283581

7 years agoRemove MSVC workarounds. Patch from STL@microsoft.com
Eric Fiselier [Fri, 7 Oct 2016 18:51:33 +0000 (18:51 +0000)]
Remove MSVC workarounds. Patch from STL@microsoft.com

llvm-svn: 283580

7 years ago[LoopIdiomRecognize] Merge two if conditions into one. NFCI.
Davide Italiano [Fri, 7 Oct 2016 18:39:43 +0000 (18:39 +0000)]
[LoopIdiomRecognize] Merge two if conditions into one. NFCI.

llvm-svn: 283579

7 years agoThe PR that caused this test ot fail was fixed in July, removing the XFAIL.
Jim Ingham [Fri, 7 Oct 2016 18:15:11 +0000 (18:15 +0000)]
The PR that caused this test ot fail was fixed in July, removing the XFAIL.

llvm-svn: 283578

7 years agoCode cleanup for the runtime without monitor thread
Jonathan Peyton [Fri, 7 Oct 2016 18:12:19 +0000 (18:12 +0000)]
Code cleanup for the runtime without monitor thread

This change removes/disables unnecessary code when monitor thread is not used.

Patch by Hansang Bae

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

llvm-svn: 283577

7 years agoEnable omp_get_schedule() to return static steal type.
Jonathan Peyton [Fri, 7 Oct 2016 18:01:35 +0000 (18:01 +0000)]
Enable omp_get_schedule() to return static steal type.

As the code is now, calling omp_get_schedule() when OMP_SCHEDULE=static_steal
will cause an assert.

llvm-svn: 283576

7 years ago[InstCombine] fold select X, (ext X), C
Sanjay Patel [Fri, 7 Oct 2016 17:53:07 +0000 (17:53 +0000)]
[InstCombine] fold select X, (ext X), C

If we're going to canonicalize IR towards select of constants, try harder to create those.
Also, don't lose the metadata.

This is actually 4 related transforms in one patch:
      // select X, (sext X), C --> select X, -1, C
      // select X, (zext X), C --> select X,  1, C
      // select X, C, (sext X) --> select X, C, 0
      // select X, C, (zext X) --> select X, C, 0

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

llvm-svn: 283575

7 years ago[analyzer] Re-apply r283092, attempt no.4, chunk no.3, fixup 1.
Artem Dergachev [Fri, 7 Oct 2016 17:24:06 +0000 (17:24 +0000)]
[analyzer] Re-apply r283092, attempt no.4, chunk no.3, fixup 1.

Remove the brace default initializer to see if this is what's causing
the msvc crash.

llvm-svn: 283574

7 years ago[analyzer] Re-apply r283092, attempt no.4, chunk no.3.
Artem Dergachev [Fri, 7 Oct 2016 17:12:05 +0000 (17:12 +0000)]
[analyzer] Re-apply r283092, attempt no.4, chunk no.3.

This is the primary suspect for causing the msvc crash, now that vector of
smart pointers was proven to be safe. Probably the default {}-initializer
is the problem.

llvm-svn: 283573

7 years ago[Driver] Make -print-libgcc-file-name print compiler-rt lib when used
Michal Gorny [Fri, 7 Oct 2016 17:08:06 +0000 (17:08 +0000)]
[Driver] Make -print-libgcc-file-name print compiler-rt lib when used

Make the -print-libgcc-file-name option print an appropriate compiler
runtime library, that is libgcc.a if gcc runtime is used
and an appropriate compiler-rt library if that runtime is used.

The main use for this is to allow linking executables built with
-nodefaultlibs (e.g. to avoid linking to the standard C++ library) to
the compiler runtime library, e.g. using:

  clang++ ... -nodefaultlibs $(clang++ ... -print-libgcc-file-name)

in which case currently a program built like this linked to the gcc
runtime unconditionally. The patch fixes it to use compiler-rt libraries
instead when compiler-rt is the active runtime.

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

llvm-svn: 283572