platform/upstream/llvm.git
7 years agoTurn LLVM_ENABLE_ABI_BREAKING_CHECKS into a 0/1 definition like
Joerg Sonnenberger [Fri, 30 Sep 2016 19:52:27 +0000 (19:52 +0000)]
Turn LLVM_ENABLE_ABI_BREAKING_CHECKS into a 0/1 definition like
LLVM_ENABLE_THREADS. Include llvm-config.h explicitly in headers to make
sure that the definition is available.

llvm-svn: 282907

7 years ago[InstCombine] allow non-splat folds of select cond (ext X), C
Sanjay Patel [Fri, 30 Sep 2016 19:49:22 +0000 (19:49 +0000)]
[InstCombine] allow non-splat folds of select cond (ext X), C

llvm-svn: 282906

7 years ago[compiler-rt] Fix interception of crt atoll on win10 CRT.
Etienne Bergeron [Fri, 30 Sep 2016 19:37:11 +0000 (19:37 +0000)]
[compiler-rt] Fix interception of crt atoll on win10 CRT.

Summary:
The check-asan-dynamic tests were broken on win10 because the interception
library was not able to hook on some functions.

credits: thanks sebastian marchand to help debugging this on win10.

Reviewers: rnk

Subscribers: chrisha, llvm-commits, dberris

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

llvm-svn: 282904

7 years agoRevert test change in r282894 as it's broken in some platforms.
Dehao Chen [Fri, 30 Sep 2016 19:25:23 +0000 (19:25 +0000)]
Revert test change in r282894 as it's broken in some platforms.

llvm-svn: 282903

7 years ago[Coroutines] Part15c: Fix coro-split to correctly handle definitions between coro...
Gor Nishanov [Fri, 30 Sep 2016 19:24:19 +0000 (19:24 +0000)]
[Coroutines] Part15c: Fix coro-split to correctly handle definitions between coro.save and coro.suspend

Summary:
In the case below, %Result.i19 is defined between coro.save and coro.suspend and used after coro.suspend. We need to correctly place such a value into the coroutine frame.

```
  %save = call token @llvm.coro.save(i8* null)
  %Result.i19 = getelementptr inbounds %"struct.lean_future<int>::Awaiter", %"struct.lean_future<int>::Awaiter"* %ref.tmp7, i64 0, i32 0
  %suspend = call i8 @llvm.coro.suspend(token %save, i1 false)
  switch i8 %suspend, label %exit [
    i8 0, label %await.ready
    i8 1, label %exit
  ]
await.ready:
  %val = load i32, i32* %Result.i19

```

Reviewers: majnemer

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 282902

7 years ago[InstCombine] add tests for non-splat select(ext)
Sanjay Patel [Fri, 30 Sep 2016 19:15:41 +0000 (19:15 +0000)]
[InstCombine] add tests for non-splat select(ext)

llvm-svn: 282901

7 years ago[MS] Implement __iso_volatile loads/stores as builtins
Martin Storsjo [Fri, 30 Sep 2016 19:13:46 +0000 (19:13 +0000)]
[MS] Implement __iso_volatile loads/stores as builtins

These are supposed to produce the same as normal volatile
pointer loads/stores. When -volatile:ms is specified,
normal volatile pointers are forced to have atomic semantics
(as is the default on x86 in MSVC mode). In that case,
these builtins should still produce non-atomic volatile
loads/stores without acquire/release semantics, which
the new test verifies.

These are only available on ARM (and on AArch64,
although clang doesn't support AArch64/Windows yet).

This implements what is missing for PR30394, making it possible
to compile C++ for ARM in MSVC mode with MSVC headers.

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

llvm-svn: 282900

7 years ago[Coroutines] Part15b: Fix dbg information handling in coro-split.
Gor Nishanov [Fri, 30 Sep 2016 19:05:06 +0000 (19:05 +0000)]
[Coroutines] Part15b: Fix dbg information handling in coro-split.

Summary:
Without the fix, if there was a function inlined into the coroutine with debug information, CloneFunctionInto(NewF, &F, VMap, /*ModuleLevelChanges=*/true, Returns); would duplicate all of the debug information including the DICompileUnit.

We know use VMap to indicate that debug metadata for a File, Unit and FunctionType should not be duplicated when we creating clones that will become f.resume, f.destroy and f.cleanup.

Reviewers: majnemer

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 282899

7 years agoFixed several i386 Objective-C tests by completing objects, not their pointers.
Sean Callanan [Fri, 30 Sep 2016 18:44:43 +0000 (18:44 +0000)]
Fixed several i386 Objective-C tests by completing objects, not their pointers.

llvm-svn: 282898

7 years ago[Coroutines] Part 15a: Lower coro.subfn.addr in CoroCleanup
Gor Nishanov [Fri, 30 Sep 2016 18:41:35 +0000 (18:41 +0000)]
[Coroutines] Part 15a: Lower coro.subfn.addr in CoroCleanup

Summary: Not all coro.subfn.addr intrinsics can be eliminated in CoroElide through devirtualization. Those that remain need to be lowered in CoroCleanup.

Reviewers: majnemer

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 282897

7 years agoclean up tests and auto-generate checks
Sanjay Patel [Fri, 30 Sep 2016 18:37:34 +0000 (18:37 +0000)]
clean up tests and auto-generate checks

llvm-svn: 282896

7 years agocmake: Install the OCaml libraries into a more correct path
Michal Gorny [Fri, 30 Sep 2016 18:34:23 +0000 (18:34 +0000)]
cmake: Install the OCaml libraries into a more correct path

Add a OCAML_INSTALL_PATH variable that can be used to control
the install path for OCaml libraries. The new variable defaults to
${OCAML_STDLIB_PATH}, i.e. the OCaml library path obtained from
the OCaml compiler. Install libraries into "llvm" subdirectory.

This fixes two issues:

1. OCaml library directories differ between systems, and 'lib/ocaml' is
incorrect e.g. on amd64 Gentoo where OCaml is installed
in 'lib64/ocaml'. Therefore, obtain the library path from the OCaml
compiler using 'ocamlc -where' (which is already used to set
OCAML_STDLIB_PATH), which is the method used commonly in OCaml packages.

2. The top-level directory is reserved for the standard library, and has
precedence over local directory in search path. As a result, OCaml
preferred the files installed along with previous LLVM version over the
source tree when building a new version, resulting in two versions being
mixed during the build. The new layout is used commonly by other OCaml
packages, and findlib is able to find the LLVM libraries successfully.

Bug: https://bugs.gentoo.org/559134
Bug: https://bugs.gentoo.org/559624

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

llvm-svn: 282895

7 years agoUpdate loop unroller cost model to make sure debug info does not affect optimization...
Dehao Chen [Fri, 30 Sep 2016 18:30:04 +0000 (18:30 +0000)]
Update loop unroller cost model to make sure debug info does not affect optimization decisions.

Summary: Debug info should *not* affect optimization decisions. This patch updates loop unroller cost model to make it not affected by debug info.

Reviewers: davidxl, mzolotukhin

Subscribers: haicheng, llvm-commits, mzolotukhin

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

llvm-svn: 282894

7 years ago[CodeGen] Add assertion for indirect array index expression generation. NFC.
Michael Kruse [Fri, 30 Sep 2016 18:29:37 +0000 (18:29 +0000)]
[CodeGen] Add assertion for indirect array index expression generation. NFC.

Currently Polly cannot generate code for index expressions if the base pointer
is computed within the scop. The base pointer must be generated as well, but
there is no code that triggers that.

Add an assertion to detect when this would occur and miscompile. The IR verifier
should catch it as well.

llvm-svn: 282893

7 years ago[libFuzzer] add a fuzzer test that finds CVE-2015-3193
Kostya Serebryany [Fri, 30 Sep 2016 18:16:16 +0000 (18:16 +0000)]
[libFuzzer] add a fuzzer test that finds CVE-2015-3193

llvm-svn: 282892

7 years ago[InstCombine] add tests for select X, (ext X), C
Sanjay Patel [Fri, 30 Sep 2016 18:10:14 +0000 (18:10 +0000)]
[InstCombine] add tests for select X, (ext X), C

llvm-svn: 282891

7 years ago[WebAssembly] Make register stackification more conservative
Derek Schuff [Fri, 30 Sep 2016 18:02:54 +0000 (18:02 +0000)]
[WebAssembly] Make register stackification more conservative

Register stackification currently checks VNInfo for changes. Make that
more accurate by testing each intervening instruction for any other defs
to the same virtual register.

Patch by Jacob Gravelle

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

llvm-svn: 282886

7 years agoImprove error check for an empty archive.
Rui Ueyama [Fri, 30 Sep 2016 17:56:20 +0000 (17:56 +0000)]
Improve error check for an empty archive.

Previously, it warned on any archive file that has no symbol.
It turned out that that is too noisy.

With this patch, it warns on such archive file that contains no file.

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

llvm-svn: 282885

7 years ago[Object] Define Archive::isEmpty().
Rui Ueyama [Fri, 30 Sep 2016 17:54:31 +0000 (17:54 +0000)]
[Object] Define Archive::isEmpty().

llvm-svn: 282884

7 years ago[Support] Complete ISL annotations to IslPtr<>. NFC.
Michael Kruse [Fri, 30 Sep 2016 17:47:39 +0000 (17:47 +0000)]
[Support] Complete ISL annotations to IslPtr<>. NFC.

Add missing __isl_(give/take/keep) annotations to IslPtr<> and NonowningIslPtr<>
methods.

Because IslPtr's constructor's annotation would depend on the TakeOwnership
parameter, the parameter has been removed. Caller must copy the object
themselves if the do not want to take ownership.

llvm-svn: 282883

7 years ago[compiler-rt] Add support for the dynamic shadow allocation
Etienne Bergeron [Fri, 30 Sep 2016 17:47:34 +0000 (17:47 +0000)]
[compiler-rt] Add support for the dynamic shadow allocation

Summary:
This patch is adding support for dynamic shadow allocation.

This is a merge and re-commit of the following patches.

```
[compiler-rt] Fix Asan build on Android
  https://reviews.llvm.org/D24768
[compiler-rt] Add support for the dynamic shadow allocation
  https://reviews.llvm.org/D23363
```

This patch needed to re-land at the same time:
```
[asan] Support dynamic shadow address instrumentation
  https://reviews.llvm.org/D23354
```

Reviewers: rnk, zaks.anna

Subscribers: tberghammer, danalbert, kubabrecka, dberris, chrisha, llvm-commits

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

llvm-svn: 282882

7 years ago[asan] Support dynamic shadow address instrumentation
Etienne Bergeron [Fri, 30 Sep 2016 17:46:32 +0000 (17:46 +0000)]
[asan] Support dynamic shadow address instrumentation

Summary:
This patch is adding the support for a shadow memory with
dynamically allocated address range.

The compiler-rt needs to export a symbol containing the shadow
memory range.

This is required to support ASAN on windows 64-bits.

Reviewers: kcc, rnk, vitalybuka

Subscribers: zaks.anna, kubabrecka, dberris, llvm-commits, chrisha

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

llvm-svn: 282881

7 years ago[CUDA] Make lambdas inherit __host__ and __device__ attributes from the scope in...
Justin Lebar [Fri, 30 Sep 2016 17:14:53 +0000 (17:14 +0000)]
[CUDA] Make lambdas inherit __host__ and __device__ attributes from the scope in which they're created.

Summary: NVCC compat.  Fixes bug 30567.

Reviewers: tra

Subscribers: cfe-commits, rnk

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

llvm-svn: 282880

7 years ago[CUDA] Handle attributes on CUDA lambdas appearing between [...] and (...).
Justin Lebar [Fri, 30 Sep 2016 17:14:48 +0000 (17:14 +0000)]
[CUDA] Handle attributes on CUDA lambdas appearing between [...] and (...).

Summary: This is ugh, but it makes us compatible with NVCC.  Fixes bug 26341.

Reviewers: rnk

Subscribers: cfe-commits, tra

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

llvm-svn: 282879

7 years ago[CUDA] Add missing comment on Sema::CheckCUDAVLA.
Justin Lebar [Fri, 30 Sep 2016 17:14:44 +0000 (17:14 +0000)]
[CUDA] Add missing comment on Sema::CheckCUDAVLA.

llvm-svn: 282878

7 years ago[AMDGPU] Choose VMCNT, EXPCNT, LGKMCNT masks and shifts based on the isa version
Konstantin Zhuravlyov [Fri, 30 Sep 2016 17:01:40 +0000 (17:01 +0000)]
[AMDGPU] Choose VMCNT, EXPCNT, LGKMCNT masks and shifts based on the isa version

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

llvm-svn: 282877

7 years ago[test] Support 'lit' executable name
Michal Gorny [Fri, 30 Sep 2016 16:56:16 +0000 (16:56 +0000)]
[test] Support 'lit' executable name

Support finding lit as plain 'lit', which is the name used by setup.py
in LLVM's utils/lit.

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

llvm-svn: 282876

7 years ago[AMDGPU] Ask subtarget if waitcnt instruction is needed before barrier instruction
Konstantin Zhuravlyov [Fri, 30 Sep 2016 16:50:36 +0000 (16:50 +0000)]
[AMDGPU] Ask subtarget if waitcnt instruction is needed before barrier instruction

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

llvm-svn: 282875

7 years ago[Support] Compile fix for gcc. NFC.
Michael Kruse [Fri, 30 Sep 2016 16:47:43 +0000 (16:47 +0000)]
[Support] Compile fix for gcc. NFC.

gcc 5.4 insists on template specialization to be in a namespace polly { ... }
block, instead of being prefixed with 'polly::'. Error message:

root/src/llvm/tools/polly/lib/Support/GICHelper.cpp:203:54: error: specialization of â€˜template<class T> void polly::IslPtr<T>::dump() const’ in different namespace [-fpermissive]
   template <> void polly::IslPtr<isl_##TYPE>::dump() const {                   \
                                                      ^
msvc14 and clang 3.8 did not complain.

llvm-svn: 282874

7 years ago[AMDGPU] Do not run scalar optimization passes at "-O0"
Konstantin Zhuravlyov [Fri, 30 Sep 2016 16:39:24 +0000 (16:39 +0000)]
[AMDGPU] Do not run scalar optimization passes at "-O0"

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

llvm-svn: 282873

7 years agoCVP. Turn marking adds as no wrap on by default (was turned off by 279082)
Artur Pilipenko [Fri, 30 Sep 2016 16:20:08 +0000 (16:20 +0000)]
CVP. Turn marking adds as no wrap on by default (was turned off by 279082)

With 282650 in tree extra no wrap on adds doesn't cause regressions anymore. Reenable the optimzation.

llvm-svn: 282872

7 years agoAdd namespace qualifiers for UTF functions that just moved.
Adrian McCarthy [Fri, 30 Sep 2016 16:11:42 +0000 (16:11 +0000)]
Add namespace qualifiers for UTF functions that just moved.

llvm-svn: 282871

7 years ago[Support] Add (Nonowning-)IslPtr::dump(). NFC.
Michael Kruse [Fri, 30 Sep 2016 16:10:19 +0000 (16:10 +0000)]
[Support] Add (Nonowning-)IslPtr::dump(). NFC.

The dump() methods can be called from a debugger instead of e.g.

    isl_*_dump(Var.Obj)

where Var is a variable of type IslPtr/NonowningIslPtr. To ensure that the
existence of the function pointers do not depdend on whether the methods are
used somwhere, they are declared with external linkage.

llvm-svn: 282870

7 years agoSkip TestRuntimeIvars on i386; the Objective-C V1 runtime doesn't list ivars.
Sean Callanan [Fri, 30 Sep 2016 16:02:28 +0000 (16:02 +0000)]
Skip TestRuntimeIvars on i386; the Objective-C V1 runtime doesn't list ivars.

llvm-svn: 282869

7 years agoFix incorrect OpenMP version in Fortran module.
Jonathan Peyton [Fri, 30 Sep 2016 15:50:14 +0000 (15:50 +0000)]
Fix incorrect OpenMP version in Fortran module.

Add check for "45" version to use "201511" string for OpenMP 4.5,
otherwise "200505" is used in Fortran module. Also, fix kmp_openmp_version
variable (used for the debugger, e.g.) and kmp_version_omp_api that is used
in KMP_VERSION=1 output.

Patch by Olga Malysheva

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

llvm-svn: 282868

7 years agoResubmit "Add llvm::enumerate() to STLExtras."
Zachary Turner [Fri, 30 Sep 2016 15:43:59 +0000 (15:43 +0000)]
Resubmit "Add llvm::enumerate() to STLExtras."

The CL was originally failing due to the use of some C++14
specific features, so I've removed those.  Hopefully this will
satisfy the bots.

llvm-svn: 282867

7 years agoAgain fixing windows build breakage like in rL282862
Dimitar Vlahovski [Fri, 30 Sep 2016 15:41:33 +0000 (15:41 +0000)]
Again fixing windows build breakage like in rL282862

llvm-svn: 282866

7 years ago[CUDA][OpenMP] Add a generic offload action builder
Samuel Antao [Fri, 30 Sep 2016 15:34:19 +0000 (15:34 +0000)]
[CUDA][OpenMP] Add a generic offload action builder

Summary:
This patch proposes a new class to generate and record action dependences related with offloading. The builder provides three main functionalities:
- Add device dependences to host actions.
- Add host dependence to device actions.
- Register device top-level actions.

The constructor of the builder detect the programming models that should be supported, and generates a specialized builder for each. If a new programming model is to be added in the future, only a new specialized builder has to be implemented.

When the specialized builder is generated, it produces programming-model-specific diagnostics.

A CUDA specialized builder is proposed in the patch that mostly consists of the partition of the current  `buildCudaAction` by the three different functionalities.

Reviewers: tra, echristo, ABataev, jlebar, hfinkel

Subscribers: Hahnfeld, whchung, guansong, jlebar, mehdi_amini, andreybokhanko, tcramer, mkuron, cfe-commits, arpith-jacob, carlo.bertolli, caomhin

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

llvm-svn: 282865

7 years ago[Support] Call isl_*_free() only on non-null pointers. NFC.
Michael Kruse [Fri, 30 Sep 2016 15:29:43 +0000 (15:29 +0000)]
[Support] Call isl_*_free() only on non-null pointers. NFC.

Add a non-NULL check before calling the free function into functions that are
supposed to be inlined. First, this is a form of partial inlining of the free
function, namely the nullptr test that free has to do. Secondly, and more
importantly, it allows the compiler to remove the call to isl_*_free() when it
knows that the object is nullptr, for instance because the last call is a
take(). "Consuming" the last use of an ISL object using take()
(instead of copy()) is a common pattern.

llvm-svn: 282864

7 years ago[LV] Build all scalar steps for non-uniform induction variables
Matthew Simpson [Fri, 30 Sep 2016 15:13:52 +0000 (15:13 +0000)]
[LV] Build all scalar steps for non-uniform induction variables

When building the steps for scalar induction variables, we previously attempted
to determine if all the scalar users of the induction variable were uniform. If
they were, we would only emit the step corresponding to vector lane zero. This
optimization was too aggressive. We generally don't know the entire set of
induction variable users that will be scalar. We have
isScalarAfterVectorization, but this is only a conservative estimate of the
instructions that will be scalarized. Thus, an induction variable may have
scalar users that aren't already known to be scalar. To avoid emitting unused
steps, we can only check that the induction variable is uniform. This should
fix PR30542.

Reference: https://llvm.org/bugs/show_bug.cgi?id=30542
llvm-svn: 282863

7 years agoFixing windows build breakage caused by rL282822
Dimitar Vlahovski [Fri, 30 Sep 2016 14:36:17 +0000 (14:36 +0000)]
Fixing windows build breakage caused by rL282822

The breakage was because of the moving of the UTF functions to the llvm
namespace

llvm-svn: 282862

7 years ago[CodeGen] Change 'Scalar' to 'Array' in method names. NFC.
Michael Kruse [Fri, 30 Sep 2016 14:34:05 +0000 (14:34 +0000)]
[CodeGen] Change 'Scalar' to 'Array' in method names. NFC.

generateScalarLoad() and generateScalarStore() are used for explicit (MK_Array)
memory accesses, therefore the method names were misleading. The names also
were similar to generateScalarLoads() and generateScalarStores() (plural forms)
which indeed handle scalar accesses. Presumbly, they were originally named to
contrast VectorBlockGenerator::generateLoad().

Rename the two methods to generateArrayLoad(),
respectively generateArrayStore().

llvm-svn: 282861

7 years ago[compiler-rt][asan] Disable a broken test on windows 64-bits
Etienne Bergeron [Fri, 30 Sep 2016 14:31:39 +0000 (14:31 +0000)]
[compiler-rt][asan] Disable a broken test on windows 64-bits

Summary:
This test is broken on wndows 64-bit.

The interception library is not able to hook on the memchr functions.

Snippet of the function that is not hookable:
```
--- No source file -------------------------------------------------------------
000007FEFA1A18CD CC                   int         3
000007FEFA1A18CE CC                   int         3
000007FEFA1A18CF CC                   int         3
--- f:\dd\vctools\crt\vcruntime\src\string\amd64_arm_arm64\memchr.c ------------
        while ( cnt && (*(unsigned char *)buf != (unsigned char)chr) ) {
000007FEFA1A18D0 4D 85 C0             test        r8,r8
000007FEFA1A18D3 74 0D                je          memchr+12h (07FEFA1A18E2h)
000007FEFA1A18D5 38 11                cmp         byte ptr [rcx],dl
000007FEFA1A18D7 74 09                je          memchr+12h (07FEFA1A18E2h)
                buf = (unsigned char *)buf + 1;
000007FEFA1A18D9 48 FF C1             inc         rcx
                cnt--;
000007FEFA1A18DC 49 83 E8 01          sub         r8,1
000007FEFA1A18E0 75 F3                jne         memchr+5h (07FEFA1A18D5h)
        }
```

Reviewers: rnk

Subscribers: kubabrecka, dberris, llvm-commits, chrisha

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

llvm-svn: 282860

7 years ago[compiler-rt][asan] Fix incorrect regexp breaking an asan unittest on win64
Etienne Bergeron [Fri, 30 Sep 2016 14:29:43 +0000 (14:29 +0000)]
[compiler-rt][asan] Fix incorrect regexp breaking an asan unittest on win64

Summary:
On windows, the memcpy and memmove function can be the same.
This is correcly detected when hooking, but it's not possible
to report the right function name when doing symbolisation.

The same fix was applied for the static asan unittest.
We forgot to apply the fix for the dynamic asan tests.
```
lvm\projects\compiler-rt\test\asan/TestCases/Windows/.svn/text-base/intercept_memcpy.cc.svn-base:// CHECK-NEXT:  __asan_{{.*}}mem{{.*}}
```

This patch is fixing this test (win64):
```
ddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_intercept_memcpy_indirect.cc
```

Reviewers: rnk, vitalybuka

Subscribers: llvm-commits, kubabrecka, chrisha, dberris

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

llvm-svn: 282859

7 years agoStrip trailing whitespace (NFCI)
Simon Pilgrim [Fri, 30 Sep 2016 14:25:09 +0000 (14:25 +0000)]
Strip trailing whitespace (NFCI)

llvm-svn: 282858

7 years agoFix int <= bool comparison warning on MSVC
Simon Pilgrim [Fri, 30 Sep 2016 14:18:06 +0000 (14:18 +0000)]
Fix int <= bool comparison warning on MSVC

llvm-svn: 282857

7 years ago[AVR] Add the ELF object file writer
Dylan McKay [Fri, 30 Sep 2016 14:09:20 +0000 (14:09 +0000)]
[AVR] Add the ELF object file writer

Summary: This adds the ELF32 writer for AVR.

Reviewers: kparzysz

Subscribers: beanz, mgorny

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

llvm-svn: 282856

7 years agoRevert "[RegAllocGreedy] Attempt to split unspillable live intervals"
Dylan McKay [Fri, 30 Sep 2016 14:05:15 +0000 (14:05 +0000)]
Revert "[RegAllocGreedy] Attempt to split unspillable live intervals"

It was accidentally committed.

llvm-svn: 282855

7 years ago[AVR] Add the assembly instruction printer
Dylan McKay [Fri, 30 Sep 2016 14:01:50 +0000 (14:01 +0000)]
[AVR] Add the assembly instruction printer

Summary:
This change adds the AVR assembly instruction printer.

No tests are included in this patch. I have left them downstream so we can
add them once `llc` successfully runs (there's very few components left
to upstream until this).

Reviewers: arsenm, kparzysz

Subscribers: wdng, beanz, mgorny

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

llvm-svn: 282854

7 years ago[CodeGen] Add assertion for partial scalar accesses. NFC.
Michael Kruse [Fri, 30 Sep 2016 14:01:46 +0000 (14:01 +0000)]
[CodeGen] Add assertion for partial scalar accesses. NFC.

The code generator always adds unconditional LoadInst and StoreInst, hence the
MemoryAccess must be defined over all statement instances.

llvm-svn: 282853

7 years ago[RegAllocGreedy] Attempt to split unspillable live intervals
Dylan McKay [Fri, 30 Sep 2016 13:59:20 +0000 (13:59 +0000)]
[RegAllocGreedy] Attempt to split unspillable live intervals

Summary:
Previously, when allocating unspillable live ranges, we would never
attempt to split. We would always bail out and try last ditch graph
recoloring.

This patch changes this by attempting to split all live intervals before
performing recoloring.

This fixes LLVM bug PR14879.

I can't add test cases for any backends other than AVR because none of
them have small enough register classes to trigger the bug.

Reviewers: qcolombet

Subscribers: MatzeB

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

llvm-svn: 282852

7 years ago[ELF] - Inlined template argument variable. NFC.
George Rimar [Fri, 30 Sep 2016 13:46:34 +0000 (13:46 +0000)]
[ELF] - Inlined template argument variable. NFC.

llvm-svn: 282851

7 years ago[ELF] - Removed excessive variables. NFC.
George Rimar [Fri, 30 Sep 2016 13:44:02 +0000 (13:44 +0000)]
[ELF] - Removed excessive variables. NFC.

llvm-svn: 282850

7 years agoXFAIL TestSBData for gcc-4.9 i386
Pavel Labath [Fri, 30 Sep 2016 12:12:15 +0000 (12:12 +0000)]
XFAIL TestSBData for gcc-4.9 i386

test broken in r282659.

llvm-svn: 282849

7 years agoFix PDB unittests on non-windows platforms
Pavel Labath [Fri, 30 Sep 2016 11:47:54 +0000 (11:47 +0000)]
Fix PDB unittests on non-windows platforms

llvm r282788 changed how the presence of windows DIA SDK is signalled. Adjust to
that.

llvm-svn: 282848

7 years agoFix another --gc-sections crash.
Rafael Espindola [Fri, 30 Sep 2016 06:48:09 +0000 (06:48 +0000)]
Fix another --gc-sections crash.

The missing case was when a merge section was only referenced from
non-alloca sections.

llvm-svn: 282847

7 years agoCosmetic fix: deleted unnecessary line break in comment.
Victor Leschuk [Fri, 30 Sep 2016 06:39:48 +0000 (06:39 +0000)]
Cosmetic fix: deleted unnecessary line break in comment.

llvm-svn: 282846

7 years agoFix --gc-sections crash.
Rafael Espindola [Fri, 30 Sep 2016 06:37:29 +0000 (06:37 +0000)]
Fix --gc-sections crash.

We would crash when a non-alloca section pointed to a gced part of a
merge section.

That can happen when a C/c++ constant in put in a merge section and
debug info is present.

llvm-svn: 282845

7 years ago[CMake] Support symlinks even with LLVM_INSTALL_TOOLCHAIN_ONLY
Petr Hosek [Fri, 30 Sep 2016 06:29:28 +0000 (06:29 +0000)]
[CMake] Support symlinks even with LLVM_INSTALL_TOOLCHAIN_ONLY

When LLVM_INSTALL_TOOLCHAIN_ONLY is used and LLVM_TOOLCHAIN_TOOLS
contains a tool which is a symlink, it would be ignored. This already
worked before but got broken in r282510.

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

llvm-svn: 282844

7 years ago[AVX-512] Store address operand should be an input operand for the special stack...
Craig Topper [Fri, 30 Sep 2016 05:35:47 +0000 (05:35 +0000)]
[AVX-512] Store address operand should be an input operand for the special stack spilling pseudos for XMM16-31 and YMM16-31 without VLX.

llvm-svn: 282843

7 years ago[AVX-512] Add the special stack spilling pseudos for XMM16-31 and YMM16-31 without...
Craig Topper [Fri, 30 Sep 2016 05:35:45 +0000 (05:35 +0000)]
[AVX-512] Add the special stack spilling pseudos for XMM16-31 and YMM16-31 without VLX to teh isFrameLoadOpcode and isFrameStoreOpcode.

llvm-svn: 282842

7 years agoRevert r282835 "[AVX-512] Always use the full 32 register vector classes for addRegis...
Craig Topper [Fri, 30 Sep 2016 05:35:42 +0000 (05:35 +0000)]
Revert r282835 "[AVX-512] Always use the full 32 register vector classes for addRegisterClass regardless of whether AVX512/VLX is enabled or not."

Turns out this doesn't pass verify-machineinstrs.

llvm-svn: 282841

7 years ago[libfuzzer] test for c-ares CVE-2016-5180
Kostya Serebryany [Fri, 30 Sep 2016 05:15:45 +0000 (05:15 +0000)]
[libfuzzer] test for c-ares CVE-2016-5180

llvm-svn: 282839

7 years ago[LDist] Port to new streaming API for opt remarks
Adam Nemet [Fri, 30 Sep 2016 04:56:25 +0000 (04:56 +0000)]
[LDist] Port to new streaming API for opt remarks

llvm-svn: 282838

7 years ago[change-namespace] fix namespace specifier of global variables.
Eric Liu [Fri, 30 Sep 2016 04:32:39 +0000 (04:32 +0000)]
[change-namespace] fix namespace specifier of global variables.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 282837

7 years ago[X86] Add AVX-512 VTs to findRepresentativeClass as well as v16i16 which was also...
Craig Topper [Fri, 30 Sep 2016 04:31:37 +0000 (04:31 +0000)]
[X86] Add AVX-512 VTs to findRepresentativeClass as well as v16i16 which was also missing. Change register class to include the extra 16 AVX512 registers.

I'm not completely sure what this method does or why all the 256-bit VTs returned VR128RegClass when the comments on the method definiton say it should return the largest super register class. I just figured AVX-512 should be similar.

llvm-svn: 282836

7 years ago[AVX-512] Always use the full 32 register vector classes for addRegisterClass regardl...
Craig Topper [Fri, 30 Sep 2016 04:31:33 +0000 (04:31 +0000)]
[AVX-512] Always use the full 32 register vector classes for addRegisterClass regardless of whether AVX512/VLX is enabled or not.

If AVX512 is disabled, the registers should already be marked reserved. Pattern predicates and register classes on instructions should take care of most of the rest. Loads/stores and physical register copies for XMM16-31 and YMM16-31 without VLX have already been taken care of.

I'm a little unclear why this changed the register allocation of the SSE2 run of the sad.ll test, but the registers selected appear to be valid after this change.

llvm-svn: 282835

7 years ago[LoopUnroll] Port to the new streaming interface for opt remarks.
Adam Nemet [Fri, 30 Sep 2016 03:44:16 +0000 (03:44 +0000)]
[LoopUnroll] Port to the new streaming interface for opt remarks.

llvm-svn: 282834

7 years ago[thinlto] Don't decay threshold for hot callsites
Piotr Padlewski [Fri, 30 Sep 2016 03:01:17 +0000 (03:01 +0000)]
[thinlto] Don't decay threshold for hot callsites

Summary:
We don't want to decay hot callsites to import chains of hot
callsites. The same mechanism is used in LIPO.

Reviewers: tejohnson, eraman, mehdi_amini

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 282833

7 years agoAMDGPU: Use unsigned compare for eq/ne
Matt Arsenault [Fri, 30 Sep 2016 01:50:20 +0000 (01:50 +0000)]
AMDGPU: Use unsigned compare for eq/ne

For some reason there are both of these available, except
for scalar 64-bit compares which only has u64. I'm not sure
why there are both (I'm guessing it's for the one bit inputs we
don't use), but for consistency always using the
unsigned one.

llvm-svn: 282832

7 years ago[libFuzzer] remove the code for -print_pcs=1 with the old coverage. It still works...
Kostya Serebryany [Fri, 30 Sep 2016 01:24:57 +0000 (01:24 +0000)]
[libFuzzer] remove the code for -print_pcs=1 with the old coverage. It still works with the new one (trace-pc-guard)

llvm-svn: 282831

7 years agoAdd the tracking radar on our end.
Jim Ingham [Fri, 30 Sep 2016 01:23:46 +0000 (01:23 +0000)]
Add the tracking radar on our end.

llvm-svn: 282830

7 years ago[libFuzzer] more the feature set to InputCorpus; on feature update, change the featur...
Kostya Serebryany [Fri, 30 Sep 2016 01:19:56 +0000 (01:19 +0000)]
[libFuzzer] more the feature set to InputCorpus; on feature update, change the feature counter of the old best input

llvm-svn: 282829

7 years ago[LoopDataPrefetch] Port to new streaming API for opt remarks
Adam Nemet [Fri, 30 Sep 2016 00:42:43 +0000 (00:42 +0000)]
[LoopDataPrefetch] Port to new streaming API for opt remarks

llvm-svn: 282826

7 years agoAdd unit tests for simple frameless i386 and x86_64 function
Jason Molenda [Fri, 30 Sep 2016 00:41:15 +0000 (00:41 +0000)]
Add unit tests for simple frameless i386 and x86_64 function
instruction inspection to UnwindPlans.

llvm-svn: 282825

7 years agoPrefer skipping over x-failing
Enrico Granata [Fri, 30 Sep 2016 00:41:07 +0000 (00:41 +0000)]
Prefer skipping over x-failing

llvm-svn: 282824

7 years agoDo not assume we will be able to discover the return type of this selector call,...
Enrico Granata [Fri, 30 Sep 2016 00:40:04 +0000 (00:40 +0000)]
Do not assume we will be able to discover the return type of this selector call, for that is not true in i386 mode

llvm-svn: 282823

7 years agoMove UTF functions into namespace llvm.
Justin Lebar [Fri, 30 Sep 2016 00:38:45 +0000 (00:38 +0000)]
Move UTF functions into namespace llvm.

Summary:
This lets people link against LLVM and their own version of the UTF
library.

I determined this only affects llvm, clang, lld, and lldb by running

$ git grep -wl 'UTF[0-9]\+\|\bConvertUTF\bisLegalUTF\|getNumBytesFor' | cut -f 1 -d '/' | sort | uniq
  clang
  lld
  lldb
  llvm

Tested with

  ninja lldb
  ninja check-clang check-llvm check-lld

(ninja check-lldb doesn't complete for me with or without this patch.)

Reviewers: rnk

Subscribers: klimek, beanz, mgorny, llvm-commits

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

llvm-svn: 282822

7 years ago[LV] Port the remarks in processLoop to the new streaming API
Adam Nemet [Fri, 30 Sep 2016 00:29:30 +0000 (00:29 +0000)]
[LV] Port the remarks in processLoop to the new streaming API

This completes LV.

llvm-svn: 282821

7 years ago[LV] Port the last opt remark in Hints to the new streaming interface
Adam Nemet [Fri, 30 Sep 2016 00:29:25 +0000 (00:29 +0000)]
[LV] Port the last opt remark in Hints to the new streaming interface

llvm-svn: 282820

7 years ago[X86] Don't preserve Win64 SSE CSRs when SSE is disabled
Reid Kleckner [Fri, 30 Sep 2016 00:17:49 +0000 (00:17 +0000)]
[X86] Don't preserve Win64 SSE CSRs when SSE is disabled

Code that doesn't use floating point and doesn't use SSE (kernel code)
shouldn't save and restore SSE registers.

Fixes PR30503

llvm-svn: 282819

7 years agoStart linker scripts at 0.
Rafael Espindola [Fri, 30 Sep 2016 00:16:11 +0000 (00:16 +0000)]
Start linker scripts at 0.

We were implicitly creating space for the headers. That is not the
behaviour of bfd, which requires the script to use SIZEOF_HEADERS. The
difference is important for scripts that don't use SIZEOF_HEADERS and
expect the first section to be at 0.

llvm-svn: 282818

7 years ago[AArch64][RegisterBankInfo] Use static mapping for 3-operands instrs.
Quentin Colombet [Fri, 30 Sep 2016 00:10:00 +0000 (00:10 +0000)]
[AArch64][RegisterBankInfo] Use static mapping for 3-operands instrs.

This uses a TableGen'ed like structure for all 3-operands instrs.
The output of the RegBankSelect pass should be identical but the
RegisterBankInfo will do less dynamic allocations.

llvm-svn: 282817

7 years ago[AArch64][RegisterBankInfo] Add static value mapping for 3-op instrs.
Quentin Colombet [Fri, 30 Sep 2016 00:09:58 +0000 (00:09 +0000)]
[AArch64][RegisterBankInfo] Add static value mapping for 3-op instrs.

This is the kind of input TableGen should generate at some point.
NFC.

llvm-svn: 282816

7 years ago[AArch64][RegisterBankInfo] Check the statically created ValueMapping.
Quentin Colombet [Fri, 30 Sep 2016 00:09:43 +0000 (00:09 +0000)]
[AArch64][RegisterBankInfo] Check the statically created ValueMapping.

Make sure that the ValueMappings contain the value we expect at the
indices we expect.

NFC.

llvm-svn: 282815

7 years agoDon't depend on lld creating space for the headers.
Rafael Espindola [Fri, 30 Sep 2016 00:06:24 +0000 (00:06 +0000)]
Don't depend on lld creating space for the headers.

Currently lld will implicitly reserve space for the headers. This is
not the case is bfd, where it is the script responsibility to use
SIZEOF_HEADERS. This means that a script not using SIZEOF_HEADERS and
expecting the address of the first section to be 0 would fail with lld.

I am fixing that is the next commit. This one just makes the tests
explicitly use SIZEOF_HEADERS to avoid the dependency on the current
behaviour.

llvm-svn: 282814

7 years ago[LAA, LV] Port to new streaming interface for opt remarks. Update LV
Adam Nemet [Fri, 30 Sep 2016 00:01:30 +0000 (00:01 +0000)]
[LAA, LV] Port to new streaming interface for opt remarks.  Update LV

(Recommit after making sure IsVerbose gets properly initialized in
DiagnosticInfoOptimizationBase.  See previous commit that takes care of
this.)

OptimizationRemarkAnalysis directly takes the role of the report that is
generated by LAA.

Then we need the magic to be able to turn an LAA remark into an LV
remark.  This is done via a new OptimizationRemark ctor.

llvm-svn: 282813

7 years ago[Diag] Use non-static member initializer for IsVerbose. NFC
Adam Nemet [Fri, 30 Sep 2016 00:01:27 +0000 (00:01 +0000)]
[Diag] Use non-static member initializer for IsVerbose. NFC

llvm-svn: 282812

7 years agoSwitch to using TEST_EQ, TEST_FALSE where appropriate.
Jason Molenda [Thu, 29 Sep 2016 23:57:33 +0000 (23:57 +0000)]
Switch to using TEST_EQ, TEST_FALSE where appropriate.

llvm-svn: 282811

7 years agoAdd some logging when trace is on. We're getting a bot failure on i386 that doesn't
Jim Ingham [Thu, 29 Sep 2016 23:48:21 +0000 (23:48 +0000)]
Add some logging when trace is on.  We're getting a bot failure on i386 that doesn't
I can't reproduce locally.  Hopefully this will help us catch the reason.

llvm-svn: 282810

7 years agoRevert "Add llvm::enumerate() to STLExtras."
Zachary Turner [Thu, 29 Sep 2016 23:05:41 +0000 (23:05 +0000)]
Revert "Add llvm::enumerate() to STLExtras."

This reverts commit r282804 as it seems to use some C++ features
that not all compilers support.

llvm-svn: 282809

7 years agoRemove Google specific code.
Vitaly Buka [Thu, 29 Sep 2016 23:05:35 +0000 (23:05 +0000)]
Remove Google specific code.

llvm-svn: 282808

7 years agoAdd comments.
Rui Ueyama [Thu, 29 Sep 2016 23:04:50 +0000 (23:04 +0000)]
Add comments.

llvm-svn: 282807

7 years agoBreak long line. NFC.
Rafael Espindola [Thu, 29 Sep 2016 23:02:57 +0000 (23:02 +0000)]
Break long line. NFC.

llvm-svn: 282806

7 years agoDon't use internal symbolizer if we are in process of reporting Out-of-Memory.
Vitaly Buka [Thu, 29 Sep 2016 23:00:54 +0000 (23:00 +0000)]
Don't use internal symbolizer if we are in process of reporting Out-of-Memory.

Reviewed by eugenis offline, as reviews.llvm.org is down.

llvm-svn: 282805

7 years agoAdd llvm::enumerate() to STLExtras.
Zachary Turner [Thu, 29 Sep 2016 22:59:30 +0000 (22:59 +0000)]
Add llvm::enumerate() to STLExtras.

enumerate allows you to iterate over a range by pairing the
iterator's value with its index in the enumeration.  This gives
you most of the benefits of using a for loop while still allowing
the range syntax.

llvm-svn: 282804

7 years ago[CMake] LLDB/Expression needs to depend on intrinsics_gen
Chris Bieneman [Thu, 29 Sep 2016 22:55:09 +0000 (22:55 +0000)]
[CMake] LLDB/Expression needs to depend on intrinsics_gen

IRExecutionUnit.h includes Module.h, which through a long chain of includes eventually includes Attributes.gen.

This fixes a build issue reported to lldb-dev by Hal. Thanks Hal!

llvm-svn: 282803

7 years agoUse StringSwitch::Cases. NFC.
Rui Ueyama [Thu, 29 Sep 2016 22:54:31 +0000 (22:54 +0000)]
Use StringSwitch::Cases. NFC.

llvm-svn: 282802

7 years agoRemove HasError check after lto::LTO::run.
Rui Ueyama [Thu, 29 Sep 2016 22:50:37 +0000 (22:50 +0000)]
Remove HasError check after lto::LTO::run.

Because LTO::run doesn't change HasError, it doesn't make
sense to check that value.

llvm-svn: 282801

7 years agoP0035R4: add std::align_val_t overloads of operator new/delete in C++17 mode.
Richard Smith [Thu, 29 Sep 2016 22:49:46 +0000 (22:49 +0000)]
P0035R4: add std::align_val_t overloads of operator new/delete in C++17 mode.

llvm-svn: 282800