platform/upstream/llvm.git
7 years agoFix for the __kmpc_global_num_threads function to return the value of the __kmp_all_n...
Andrey Churbanov [Wed, 21 Dec 2016 21:20:20 +0000 (21:20 +0000)]
Fix for the __kmpc_global_num_threads function to return the value of the __kmp_all_nth global var.

Patch by Yonghong Yan.

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

llvm-svn: 290272

7 years agocmake: Don't build llvm-config and tblgen concurrently in cross builds
Justin Bogner [Wed, 21 Dec 2016 21:19:00 +0000 (21:19 +0000)]
cmake: Don't build llvm-config and tblgen concurrently in cross builds

This sets USES_TERMINAL for the native llvm-config build, so that it
doesn't run at the same time as builds of other native tools (namely,
tablegen). Without this, if you're very unlucky with the timing it's
possible to be relinking libSupport as one of the tools is linking,
causing a spurious failure.

The tablegen build adopted USES_TERMINAL for this same reason in
r280748.

llvm-svn: 290271

7 years agoUpdate mailing list post URL and add libunwind reference
Ed Maste [Wed, 21 Dec 2016 20:51:42 +0000 (20:51 +0000)]
Update mailing list post URL and add libunwind reference

RTDyldMemoryManager.cpp describes the differing __register_frame
API between libunwind and libgcc, with a mailing list posting URL.

The original link was 404; replace it with what I believe is the
intended post, as well as a reference to the "OS X" implementation in
libunwind.

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

llvm-svn: 290269

7 years agoARM: define a macro for the FPv5 FPU in ARM mode.
Tim Northover [Wed, 21 Dec 2016 20:49:43 +0000 (20:49 +0000)]
ARM: define a macro for the FPv5 FPU in ARM mode.

FPv5 is in Cortex-M7 and the 64-bit CPUs when running in 32-bit mode. The name
is from the Cortex-M7 TRM.

llvm-svn: 290268

7 years ago[X86][SSE] Improve lowering of vXi64 multiplies
Simon Pilgrim [Wed, 21 Dec 2016 20:00:10 +0000 (20:00 +0000)]
[X86][SSE] Improve lowering of vXi64 multiplies

As mentioned on PR30845, we were performing our vXi64 multiplication as:

AloBlo = pmuludq(a, b);
AloBhi = pmuludq(a, psrlqi(b, 32));
AhiBlo = pmuludq(psrlqi(a, 32), b);
return AloBlo + psllqi(AloBhi, 32)+ psllqi(AhiBlo, 32);

when we could avoid one of the upper shifts with:

AloBlo = pmuludq(a, b);
AloBhi = pmuludq(a, psrlqi(b, 32));
AhiBlo = pmuludq(psrlqi(a, 32), b);
return AloBlo + psllqi(AloBhi + AhiBlo, 32);

This matches the lowering on gcc/icc.

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

llvm-svn: 290267

7 years agoRevert "[InstCombine] New opportunities for FoldAndOfICmp and FoldXorOfICmp"
David Majnemer [Wed, 21 Dec 2016 19:21:59 +0000 (19:21 +0000)]
Revert "[InstCombine] New opportunities for FoldAndOfICmp and FoldXorOfICmp"

This reverts commit r289813, it caused PR31449.

llvm-svn: 290266

7 years agoAMDGPU/SI: Fix file header
Tom Stellard [Wed, 21 Dec 2016 19:06:24 +0000 (19:06 +0000)]
AMDGPU/SI: Fix file header

llvm-svn: 290265

7 years agoTypeMetadataUtils: Simplify; spotted by Mehdi.
Peter Collingbourne [Wed, 21 Dec 2016 19:00:47 +0000 (19:00 +0000)]
TypeMetadataUtils: Simplify; spotted by Mehdi.

llvm-svn: 290264

7 years agoAdd missing includes on Windows.
Zachary Turner [Wed, 21 Dec 2016 18:50:52 +0000 (18:50 +0000)]
Add missing includes on Windows.

Patch by Andrey Khalyavin
Differential Revision: https://reviews.llvm.org/D27915

llvm-svn: 290263

7 years agoMake some diagnostic tests C++11 clean.
Paul Robinson [Wed, 21 Dec 2016 18:33:17 +0000 (18:33 +0000)]
Make some diagnostic tests C++11 clean.

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

llvm-svn: 290262

7 years ago[LLParser] Parse vector GEP constant expression correctly
Michael Kuperstein [Wed, 21 Dec 2016 18:29:47 +0000 (18:29 +0000)]
[LLParser] Parse vector GEP constant expression correctly

The constantexpr parsing was too constrained and rejected legal vector GEPs.
This relaxes it to be similar to the ones for instruction parsing.

This fixes PR30816.

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

llvm-svn: 290261

7 years ago[ConstantFolding] Fix vector GEPs harder
Michael Kuperstein [Wed, 21 Dec 2016 17:34:21 +0000 (17:34 +0000)]
[ConstantFolding] Fix vector GEPs harder

For vector GEPs, CastGEPIndices can end up in an infinite recursion, because
we compare the vector type to the scalar pointer type, find them different,
and then try to cast a type to itself.

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

llvm-svn: 290260

7 years agoclang-format: Fix bug in handling of single-column lists.
Daniel Jasper [Wed, 21 Dec 2016 17:02:06 +0000 (17:02 +0000)]
clang-format: Fix bug in handling of single-column lists.

Members that are themselves wrapped in fake parentheses would lead to
AvoidBinPacking be set on the wrong ParenState.

After:
  vector<int> aaaa = {
      aaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
      aaaaaa.aaaaaaa,
      aaaaaa.aaaaaaa,
      aaaaaa.aaaaaaa,
      aaaaaa.aaaaaaa,
  };

Before we were falling back to bin-packing these.

llvm-svn: 290259

7 years agoWdocumentation fix
Simon Pilgrim [Wed, 21 Dec 2016 16:39:09 +0000 (16:39 +0000)]
Wdocumentation fix

llvm-svn: 290258

7 years ago[CostModel] Pass shuffle mask args with ArrayRef. NFCI.
Simon Pilgrim [Wed, 21 Dec 2016 15:49:01 +0000 (15:49 +0000)]
[CostModel] Pass shuffle mask args with ArrayRef. NFCI.

llvm-svn: 290257

7 years agoChange the determination of parameters of macro-kernel
Roman Gareev [Wed, 21 Dec 2016 12:51:12 +0000 (12:51 +0000)]
Change the determination of parameters of macro-kernel

Typically processor architectures do not include an L3 cache, which means that
Nc, the parameter of the micro-kernel, is, for all practical purposes,
redundant ([1]). However, its small values can cause the redundant packing of
the same elements of the matrix A, the first operand of the matrix
multiplication. At the same time, big values of the parameter Nc can cause
segmentation faults in case the available stack is exceeded.

This patch adds an option to specify the parameter Nc as a multiple of
the parameter of the micro-kernel Nr.

In case of Intel Core i7-3820 SandyBridge and the following options,

clang -O3 gemm.c -I utilities/ utilities/polybench.c -DPOLYBENCH_TIME
-march=native -mllvm -polly -mllvm -polly-pattern-matching-based-opts=true
-DPOLYBENCH_USE_SCALAR_LB -mllvm -polly-target-cache-level-associativity=8,8
-mllvm -polly-target-cache-level-sizes=32768,262144 -mllvm
-polly-target-latency-vector-fma=8

it helps to improve the performance from 11.303 GFlops/sec (39,247% of
theoretical peak) to 17.896 GFlops/sec (62,14% of theoretical peak).

Refs.:

[1] - http://www.cs.utexas.edu/users/flame/pubs/TOMS-BLIS-Analytical.pdf

Reviewed-by: Tobias Grosser <tobias@grosser.es>
Differential Revision: https://reviews.llvm.org/D28019

llvm-svn: 290256

7 years agorevert first commit . removing empty line in X86.h
Michael Zuckerman [Wed, 21 Dec 2016 12:48:01 +0000 (12:48 +0000)]
revert first commit . removing empty line in X86.h

llvm-svn: 290255

7 years agoFirst commit adding new line to X86.h
Michael Zuckerman [Wed, 21 Dec 2016 12:44:47 +0000 (12:44 +0000)]
First commit adding new line to X86.h

llvm-svn: 290254

7 years agoAlign newly created arrays to the first level cache line boundary
Roman Gareev [Wed, 21 Dec 2016 12:37:36 +0000 (12:37 +0000)]
Align newly created arrays to the first level cache line boundary

Aligning data to cache lines boundaries helps to avoid overheads related to
an access to it ([1]). This patch aligns newly created arrays and adds an
option to specify the first level cache line size. By default we use 64 bytes,
which is a typical cache-line size ([2]).

In case of Intel Core i7-3820 SandyBridge and the following options,

clang -O3 gemm.c -I utilities/ utilities/polybench.c -DPOLYBENCH_TIME
-march=native -mllvm -polly -mllvm -polly-pattern-matching-based-opts=true
-DPOLYBENCH_USE_SCALAR_LB -mllvm -polly-target-cache-level-associativity=8,8
-mllvm -polly-target-cache-level-sizes=32768,262144 -mllvm
-polly-target-latency-vector-fma=8

it helps to improve the performance from 11.303 GFlops/sec (39,247% of
theoretical peak) to 12.63 GFlops/sec (43,8542% of theoretical peak).

Refs.:

[1] - http://www.alexonlinux.com/aligned-vs-unaligned-memory-access
[2] - http://igoro.com/archive/gallery-of-processor-cache-effects/

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

Reviewed-by: Tobias Grosser <tobias@grosser.es>
llvm-svn: 290253

7 years ago[ELF/tests] Use cpio -it instead of cpio -t.
Davide Italiano [Wed, 21 Dec 2016 12:22:19 +0000 (12:22 +0000)]
[ELF/tests] Use cpio -it instead of cpio -t.

OpenBSD's cpio does not accept the -t option without -i.
Apparently some systems implement cpio -t as a shortcut
for cpio -it, the latter is the only thing that's documented.
This change avoids test failures on OpenBSD.

Patch by Mark Kettenis!

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

llvm-svn: 290252

7 years ago[Polly] Use three-dimensional arrays to store packed operands of the matrix
Roman Gareev [Wed, 21 Dec 2016 11:18:42 +0000 (11:18 +0000)]
[Polly] Use three-dimensional arrays to store packed operands of the matrix
multiplication

Previously we had two-dimensional accesses to store packed operands of
the matrix multiplication for the sake of simplicity of the packed arrays.
However, addition of the third dimension helps to simplify the corresponding
memory access, reduce the execution time of isl operations applied to it, and
consequently reduce the compile-time of Polly. For example, in case of
Intel Core i7-3820 SandyBridge and the following options,

clang -O3 gemm.c -I utilities/ utilities/polybench.c -DPOLYBENCH_TIME
-march=native -mllvm -polly -mllvm -polly-pattern-matching-based-opts=true
-DPOLYBENCH_USE_SCALAR_LB -mllvm -polly-target-cache-level-associativity=8,8
-mllvm -polly-target-cache-level-sizes=32768,262144 -mllvm
-polly-target-latency-vector-fma=7

it helps to reduce the compile-time from about 361.456 seconds to about 0.816
seconds.

Reviewed-by: Michael Kruse <llvm@meinersbur.de>,
             Tobias Grosser <tobias@grosser.es>

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

llvm-svn: 290251

7 years agoAdded a template for building target specific memory node in DAG.
Elena Demikhovsky [Wed, 21 Dec 2016 10:43:36 +0000 (10:43 +0000)]
Added a template for building target specific memory node in DAG.

I added API for creation a target specific memory node in DAG. Today, all memory nodes are common for all targets and their constructors are located in SelectionDAG.cpp.
There are some cases in X86 where we need to create a special node - truncation-with-saturation store, float-to-half-store.
In the current patch I added truncation-with-saturation nodes and I'm using them for intrinsics. In the future I plan to implement DAG lowering for truncation-with-saturation pattern.

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

llvm-svn: 290250

7 years ago[AMDGPU] Garbage collect dead code. NFCI.
Davide Italiano [Wed, 21 Dec 2016 10:19:00 +0000 (10:19 +0000)]
[AMDGPU] Garbage collect dead code. NFCI.

llvm-svn: 290249

7 years ago[X86] Vectorcall Calling Convention - Adding CodeGen Complete Support
Oren Ben Simhon [Wed, 21 Dec 2016 09:47:31 +0000 (09:47 +0000)]
[X86] Vectorcall Calling Convention - Adding CodeGen Complete Support

Fixing a warning.

llvm-svn: 290248

7 years ago[ELF] - Linkerscript: Fall back to search paths when INCLUDE not found
George Rimar [Wed, 21 Dec 2016 09:42:25 +0000 (09:42 +0000)]
[ELF] - Linkerscript: Fall back to search paths when INCLUDE not found

From https://sourceware.org/binutils/docs/ld/File-Commands.html:
The file will be searched for in the current directory, and in any
directory specified with the -L option.

Patch done by Alexander Richardson.

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

llvm-svn: 290247

7 years ago[X86] Vectorcall Calling Convention - Adding CodeGen Complete Support
Oren Ben Simhon [Wed, 21 Dec 2016 09:18:37 +0000 (09:18 +0000)]
[X86] Vectorcall Calling Convention - Adding CodeGen Complete Support

Fixing failing test.

llvm-svn: 290246

7 years agoReverting last change.
Oren Ben Simhon [Wed, 21 Dec 2016 09:04:08 +0000 (09:04 +0000)]
Reverting last change.

llvm-svn: 290245

7 years ago[X86] Vectorcall Calling Convention - Adding CodeGen Complete Support
Oren Ben Simhon [Wed, 21 Dec 2016 08:59:42 +0000 (08:59 +0000)]
[X86] Vectorcall Calling Convention - Adding CodeGen Complete Support

Fixing build issues.

llvm-svn: 290244

7 years ago[ELF] - Removed trailing whitespaces. NFC.
George Rimar [Wed, 21 Dec 2016 08:58:36 +0000 (08:58 +0000)]
[ELF] - Removed trailing whitespaces. NFC.

llvm-svn: 290243

7 years ago[X86] Vectorcall Calling Convention - Adding CodeGen Complete Support
Oren Ben Simhon [Wed, 21 Dec 2016 08:58:19 +0000 (08:58 +0000)]
[X86] Vectorcall Calling Convention - Adding CodeGen Complete Support

Fixing build issues.

llvm-svn: 290242

7 years agoDe-template DefinedSynthetic.
Rui Ueyama [Wed, 21 Dec 2016 08:40:09 +0000 (08:40 +0000)]
De-template DefinedSynthetic.

DefinedSynthetic is not created for a real ELF object, so it doesn't
have to be a template function. It has a virtual st_value, which is
either 32 bit or 64 bit, but we can simply use 64 bit.

llvm-svn: 290241

7 years ago[X86] Vectorcall Calling Convention - Adding CodeGen Complete Support
Oren Ben Simhon [Wed, 21 Dec 2016 08:31:45 +0000 (08:31 +0000)]
[X86] Vectorcall Calling Convention - Adding CodeGen Complete Support

The vectorcall calling convention specifies that arguments to functions are to be passed in registers, when possible.
vectorcall uses more registers for arguments than fastcall or the default x64 calling convention use.
The vectorcall calling convention is only supported in native code on x86 and x64 processors that include Streaming SIMD Extensions 2 (SSE2) and above.

The current implementation does not handle Homogeneous Vector Aggregates (HVAs) correctly and this review attempts to fix it.
This aubmit also includes additional lit tests to cover better HVAs corner cases.

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

llvm-svn: 290240

7 years ago[ELF] - Do not call fatal() in Target.cpp, call error() instead.
George Rimar [Wed, 21 Dec 2016 08:21:34 +0000 (08:21 +0000)]
[ELF] - Do not call fatal() in Target.cpp, call error() instead.

We probably would want to avoid fatal() if we can in context of librarification,
but for me reason of that patch is to help D27900 go.

D27900 changes errors reporting to something like
error: text1
note: text2
note: text3

where hint used to provide additional information about location. In that case
I can't just call fatal() because user will not see notes after that what adds additional complication to handle.
So It is good to switch fatal() to error() where it is possible.

Also it adds testcase with broken relocation number.
Previously we did not have any, It checks that error() instead of fatal() works fine.

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

llvm-svn: 290239

7 years ago[ELF] - Fix use of freed memory.
George Rimar [Wed, 21 Dec 2016 08:11:49 +0000 (08:11 +0000)]
[ELF] - Fix use of freed memory.

It was revealed by D27831.

If we have linkerscript that includes another one that sets OUTPUT for example:

RUN: echo "INCLUDE \"foo.script\"" > %t.script
RUN: echo "OUTPUT(\"%t.out\")" > %T/foo.script
then we do:

void ScriptParser::readInclude() {
...
  std::unique_ptr<MemoryBuffer> &MB = *MBOrErr;
  tokenize(MB->getMemBufferRef());
  OwningMBs.push_back(std::move(MB));
}

void ScriptParser::readOutput() {
...
    Config->OutputFile = unquote(Tok);
...
}
Problem is that OwningMBs are destroyed after script parser do its job.
So all Toks are dead and Config->OutputFile points to destroyed data.

Patch suggests to save all included scripts into using string Saver.

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

llvm-svn: 290238

7 years ago[ELF][MIPS] Allow .MIPS.abiflags larger than one Elf_Mips_ABIFlags struct
Simon Atanasyan [Wed, 21 Dec 2016 05:31:57 +0000 (05:31 +0000)]
[ELF][MIPS] Allow .MIPS.abiflags larger than one Elf_Mips_ABIFlags struct

Older versions of BFD generate libraries with .MIPS.abiflags that only
concatenate the individual .MIPS.abiflags sections instead of merging.

Patch by Alexander Richardson.

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

llvm-svn: 290237

7 years agoRename several methods on ASTRecordReader to follow LLVM style (lowerCamelCase).
David L. Jones [Wed, 21 Dec 2016 04:34:52 +0000 (04:34 +0000)]
Rename several methods on ASTRecordReader to follow LLVM style (lowerCamelCase).

Summary:
This follows up to r290217, and makes functions on ASTRecordReader consistent
and valid style.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 290236

7 years ago[LDist] Match behavior between invoking via optimization pipeline or opt -loop-distribute
Adam Nemet [Wed, 21 Dec 2016 04:07:40 +0000 (04:07 +0000)]
[LDist] Match behavior between invoking via optimization pipeline or opt -loop-distribute

In r267672, where the loop distribution pragma was introduced, I tried
it hard to keep the old behavior for opt: when opt is invoked
with -loop-distribute, it should distribute the loop (it's off by
default when ran via the optimization pipeline).

As MichaelZ has discovered this has the unintended consequence of
breaking a very common developer work-flow to reproduce compilations
using opt: First you print the pass pipeline of clang
with -debug-pass=Arguments and then invoking opt with the returned
arguments.

clang -debug-pass will include -loop-distribute but the pass is invoked
with default=off so nothing happens unless the loop carries the pragma.
While through opt (default=on) we will try to distribute all loops.

This changes opt's default to off as well to match clang.  The tests are
modified to explicitly enable the transformation.

llvm-svn: 290235

7 years agoremove pretty-print test that requires debug
Sebastian Pop [Wed, 21 Dec 2016 03:37:39 +0000 (03:37 +0000)]
remove pretty-print test that requires debug

There is no need to test the pretty printer. Remove the boggus test to make the
build bots happy.

llvm-svn: 290234

7 years agoFix windows build breakage in r290219. Unix path separators in testcase.
Graydon Hoare [Wed, 21 Dec 2016 03:00:11 +0000 (03:00 +0000)]
Fix windows build breakage in r290219. Unix path separators in testcase.

llvm-svn: 290233

7 years ago[APFloat] Remove 'else' after return. NFC
Tim Shen [Wed, 21 Dec 2016 02:39:21 +0000 (02:39 +0000)]
[APFloat] Remove 'else' after return. NFC

Reviewers: kbarton, iteratee, hfinkel, echristo

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 290232

7 years agoFix build broken by changes in StringMatcher interface r290213
Vitaly Buka [Wed, 21 Dec 2016 02:27:14 +0000 (02:27 +0000)]
Fix build broken by changes in StringMatcher interface r290213

llvm-svn: 290231

7 years ago[Orc][RPC] Actually specialize SerializationTraits and RPCTypeName in the right
Lang Hames [Wed, 21 Dec 2016 02:08:23 +0000 (02:08 +0000)]
[Orc][RPC] Actually specialize SerializationTraits and RPCTypeName in the right
namespace.

r290226 was a think-o - just qualifying the name doesn't count.

llvm-svn: 290230

7 years agoFix defaulted-functions-in-C++98 extension to give the functions the same
Richard Smith [Wed, 21 Dec 2016 01:57:02 +0000 (01:57 +0000)]
Fix defaulted-functions-in-C++98 extension to give the functions the same
effect they would have in C++11. In particular, they do not prevent
value-initialization from performing zero-initialization, nor do they prevent a
struct from being an aggregate.

llvm-svn: 290229

7 years agomachine combiner: fix pretty printer
Sebastian Pop [Wed, 21 Dec 2016 01:41:12 +0000 (01:41 +0000)]
machine combiner: fix pretty printer

we used to print UNKNOWN instructions when the instruction to be printer was not
yet inserted in any BB: in that case the pretty printer would not be able to
compute a TII as the instruction does not belong to any BB or function yet.
This patch explicitly passes the TII to the pretty-printer.

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

llvm-svn: 290228

7 years ago[c++1z] When initializing a const-qualified class type, don't forget to add on
Richard Smith [Wed, 21 Dec 2016 01:31:56 +0000 (01:31 +0000)]
[c++1z] When initializing a const-qualified class type, don't forget to add on
the requested cv-qualifiers after construction. This usually doesn't matter,
but it does matter within a ?: operator.

llvm-svn: 290227

7 years ago[Orc][RPC] Specialize RPCTypeName and SerializationTraits in the right namespace.
Lang Hames [Wed, 21 Dec 2016 01:17:19 +0000 (01:17 +0000)]
[Orc][RPC] Specialize RPCTypeName and SerializationTraits in the right namespace.

llvm-svn: 290226

7 years agoFactor out checking of template arguments after deduction into a separate
Richard Smith [Wed, 21 Dec 2016 01:10:31 +0000 (01:10 +0000)]
Factor out checking of template arguments after deduction into a separate
function. (This change would also allow us to handle default template arguments
in partial specializations if the standard ever permits them.)

llvm-svn: 290225

7 years agoImprove natvis for llvm::SmallString so that it correctly displays only the valid...
Antonio Maiorano [Wed, 21 Dec 2016 01:05:29 +0000 (01:05 +0000)]
Improve natvis for llvm::SmallString so that it correctly displays only the valid portion of the string

The usual method, and the one employed before my change, of displaying strings in natvis is to make use of the "<variable>,s" format specifier; however, this method only works for null-terminated strings. My fix here is to use the "<pointer>,[size]" format specifier to display a bounded array, and then cast it to "const char*", which in the MSVC debugger has the desired effect of rendering the character array as a string.

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

llvm-svn: 290224

7 years ago[Orc] Add some static-assert checks to improve the error messages for RPC calls
Lang Hames [Wed, 21 Dec 2016 00:59:33 +0000 (00:59 +0000)]
[Orc] Add some static-assert checks to improve the error messages for RPC calls
and handler registrations.

Also add a unit test for alternate-type serialization/deserialization.

llvm-svn: 290223

7 years agoIPO: Remove the ModuleSummary argument to the FunctionImport pass. NFCI.
Peter Collingbourne [Wed, 21 Dec 2016 00:50:12 +0000 (00:50 +0000)]
IPO: Remove the ModuleSummary argument to the FunctionImport pass. NFCI.

No existing client is passing a non-null value here. This will come back
in a slightly different form as part of the type identifier summary work.

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

llvm-svn: 290222

7 years agoFix build breakage in r290219. Notes should not be in diagnostic groups.
Graydon Hoare [Wed, 21 Dec 2016 00:48:14 +0000 (00:48 +0000)]
Fix build breakage in r290219. Notes should not be in diagnostic groups.

llvm-svn: 290221

7 years ago[modules] Handle modules with nonstandard names in module.private.modulemaps
Graydon Hoare [Wed, 21 Dec 2016 00:24:39 +0000 (00:24 +0000)]
[modules] Handle modules with nonstandard names in module.private.modulemaps

Summary:
The module system supports accompanying a primary module (say Foo) with
an auxiliary "private" module (defined in an adjacent module.private.modulemap
file) that augments the primary module when associated private headers are
available. The feature is intended to be used to augment the primary
module with a submodule (say Foo.Private), however some users in the wild
are choosing to augment the primary module with an additional top-level module
with a "similar" name (in all cases so far: FooPrivate).

This "works" when a user of the module initially imports a private header,
such as '#import "Foo/something_private.h"' since the Foo import winds up
importing FooPrivate in passing. But if the import is subsequently recorded
in a PCH file, reloading the PCH will fail to validate because of a cross-check
that attempts to find the module.modulemap (or module.private.modulemap) using
HeaderSearch algorithm, applied to the "FooPrivate" name. Since it's stored in
Foo.framework/Modules, not FooPrivate.framework/Modules, the check fails and
the PCH is rejected.

This patch adds a compensatory workaround in the HeaderSearch algorithm
when searching (and failing to find) a module of the form FooPrivate: the
name used to derive filesystem paths is decoupled from the module name
being searched for, and if the initial search fails and the module is
named "FooPrivate", the filesystem search name is altered to remove the
"Private" suffix, and the algorithm is run a second time (still looking for
a module named FooPrivate, but looking in directories derived from Foo).

Accompanying this change is a new warning that triggers when a user loads
a module.private.modulemap that defines a top-level module with a different
name from the top-level module defined in its adjacent module.modulemap.

Reviewers: doug.gregor, manmanren, bruno

Subscribers: bruno, cfe-commits

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

llvm-svn: 290219

7 years agoReduce the size of quarantine cache in ASAN_LOW_MEMORY configuration.
Evgeniy Stepanov [Wed, 21 Dec 2016 00:18:10 +0000 (00:18 +0000)]
Reduce the size of quarantine cache in ASAN_LOW_MEMORY configuration.

Summary:
Experiments show that on Android the current values result in too much
of the memory consumption for all quarantined chunks.

Reviewers: kcc, eugenis

Subscribers: mgorny, danalbert, srhines, llvm-commits, kubabrecka

Patch by Aleksey Shlyapnikov.

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

llvm-svn: 290218

7 years agoStore the "current position" index within the ASTRecordReader.
David L. Jones [Wed, 21 Dec 2016 00:17:49 +0000 (00:17 +0000)]
Store the "current position" index within the ASTRecordReader.

Summary:
For ASTDeclReader and ASTStmtReader, every parameter "unsigned &Idx" ultimately
comes from a variable that is defined on the stack, next to the RecordData. This
change moves that index into the ASTRecordReader.

TypeLocReader cannot be transitioned, due to TableGen-generated code which calls
ASTReader::GetTypeSourceInfo.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 290217

7 years agoIgnore SIGPIPE in the mini-driver used by these tests.
Jim Ingham [Wed, 21 Dec 2016 00:12:54 +0000 (00:12 +0000)]
Ignore SIGPIPE in the mini-driver used by these tests.

We're seeing some very occasional failures in these tests where the
mini-driver dies with a SIGPIPE.  We don't use SIGPIPE for anything, and
the main lldb driver program already ignores SIGPIPE, so ignoring it in
the mini-driver is a good way to remove these spurious failures.

<rdar://problem/29740488>

llvm-svn: 290216

7 years agoMove a function defintion to make it static.
Rui Ueyama [Wed, 21 Dec 2016 00:05:39 +0000 (00:05 +0000)]
Move a function defintion to make it static.

llvm-svn: 290215

7 years ago[Analysis] Centralize objectsize lowering logic.
George Burgess IV [Tue, 20 Dec 2016 23:46:36 +0000 (23:46 +0000)]
[Analysis] Centralize objectsize lowering logic.

We're currently doing nearly the same thing for @llvm.objectsize in
three different places: two of them are missing checks for overflow,
and one of them could subtly break if InstCombine gets much smarter
about removing alloc sites. Seems like a good idea to not do that.

llvm-svn: 290214

7 years agoUse ArrayRef instead of `const std::vector`.
Rui Ueyama [Tue, 20 Dec 2016 23:17:00 +0000 (23:17 +0000)]
Use ArrayRef instead of `const std::vector`.

llvm-svn: 290213

7 years agoMove GlobPattern class from LLD to llvm/Support.
Rui Ueyama [Tue, 20 Dec 2016 23:09:09 +0000 (23:09 +0000)]
Move GlobPattern class from LLD to llvm/Support.

GlobPattern is a class to handle glob pattern matching. Currently
only LLD is using that, but technically that feature is not specific
to linkers, so in this patch I move that file to LLVM.

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

llvm-svn: 290212

7 years ago[SCEV] Be less conservative when extending bitwidths for computing ranges.
Michael Zolotukhin [Tue, 20 Dec 2016 23:03:42 +0000 (23:03 +0000)]
[SCEV] Be less conservative when extending bitwidths for computing ranges.

Summary:
In getRangeForAffineAR we compute ranges for affine exprs E = A + B*C,
where ranges for A, B, and C are known. To avoid overflow, we need to
operate on a bigger bitwidth, and originally we chose 2*x+1 for this
(x being the original bitwidth). However, it is safe to use just 2*x:

A+B*C <= (2^x - 1) + (2^x - 1)*(2^x - 1) =
       =  2^x - 1 + 2^2x - 2^x - 2^x + 1 =
       = 2^2x - 2^x <= 2^2x - 1

Unnecessary extending of bitwidths results in noticeable slowdowns: ranges
perform arithmetic operations using APInt, which are much slower when bitwidths
are bigger than 64.

Reviewers: sanjoy, majnemer, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 290211

7 years agoComment out char16_t and char32_t tests
Malcolm Parsons [Tue, 20 Dec 2016 22:57:21 +0000 (22:57 +0000)]
Comment out char16_t and char32_t tests

llvm-svn: 290210

7 years agoRevert "[ObjectYAML] Support for DWARF debug_info section"
Chris Bieneman [Tue, 20 Dec 2016 22:36:42 +0000 (22:36 +0000)]
Revert "[ObjectYAML] Support for DWARF debug_info section"

This reverts commit r290204.

Still breaking bots... In a meeting now, so I can't fix it immediately.

Bot URL:
http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/2415

llvm-svn: 290209

7 years agoMake a test use a specific C++ dialect
Paul Robinson [Tue, 20 Dec 2016 22:30:44 +0000 (22:30 +0000)]
Make a test use a specific C++ dialect

In stack-reuse-miscompile.cpp, the allocas for the temps come out in
a different order depending on whether the dialect is C++03 or
C++11. Specify C++03 explicitly to avoid depending on the default.

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

llvm-svn: 290208

7 years agoC++11 test cleanup: nonthrowing destructors
Paul Robinson [Tue, 20 Dec 2016 22:26:11 +0000 (22:26 +0000)]
C++11 test cleanup: nonthrowing destructors

If a dtor has no interesting members, then it ends up being nothrow,
which affects the generated IR. Modify some tests to tolerate this
difference between C++03 and C++11.

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

llvm-svn: 290207

7 years ago[ELF] Do not warn about missed entry symbol in case of relocatable output
Simon Atanasyan [Tue, 20 Dec 2016 22:24:45 +0000 (22:24 +0000)]
[ELF] Do not warn about missed entry symbol in case of relocatable output

Relocatable file does not need to have an entry symbol so the warning is
useless in that case.

llvm-svn: 290206

7 years agoMake two vtable tests tolerate C++11.
Paul Robinson [Tue, 20 Dec 2016 22:22:24 +0000 (22:22 +0000)]
Make two vtable tests tolerate C++11.

In C++11 we don't emit vtables as eagerly as we do for C++03, so
fiddle the tests to emit them when the test expects them.

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

llvm-svn: 290205

7 years ago[ObjectYAML] Support for DWARF debug_info section
Chris Bieneman [Tue, 20 Dec 2016 21:35:31 +0000 (21:35 +0000)]
[ObjectYAML] Support for DWARF debug_info section

This patch adds support for YAML<->DWARF for debug_info sections.

This re-lands r290147, after fixing the issue that caused bots to fail (thank you UBSan!).

llvm-svn: 290204

7 years ago[c++1z] P0195R2: Support pack-expansion of using-declarations.
Richard Smith [Tue, 20 Dec 2016 21:35:28 +0000 (21:35 +0000)]
[c++1z] P0195R2: Support pack-expansion of using-declarations.

This change introduces UsingPackDecl as a marker for the set of UsingDecls
produced by pack expansion of a single (unresolved) using declaration. This is
not strictly necessary (we just need to be able to map from the original using
declaration to its expansions somehow), but it's useful to maintain the
invariant that each declaration reference instantiates to refer to one
declaration.

This is a re-commit of r290080 (reverted in r290092) with a fix for a
use-after-lifetime bug.

llvm-svn: 290203

7 years ago[clang-tidy] Add modernize-use-default-member-init check
Malcolm Parsons [Tue, 20 Dec 2016 21:26:07 +0000 (21:26 +0000)]
[clang-tidy] Add modernize-use-default-member-init check

Summary: Fixes PR18858

Reviewers: alexfh, hokein, aaron.ballman

Subscribers: JDevlieghere, Eugene.Zelenko, Prazek, mgorny, cfe-commits, modocache

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

llvm-svn: 290202

7 years ago[scudo] ARM32 support
Kostya Kortchinsky [Tue, 20 Dec 2016 21:17:58 +0000 (21:17 +0000)]
[scudo] ARM32 support

Summary:
With the previous modifications, the code works on ARM32. The random shuffle
test is unsupported on 32-bit platforms for the moment and being marked as
such. There is no hardware support for the checksum computation yet, this will
come at a later point.

Reviewers: kcc, alekseyshl

Subscribers: llvm-commits, aemerson, rengolin, mgorny

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

llvm-svn: 290201

7 years agoIR: Eliminate non-determinism in the module summary analysis.
Peter Collingbourne [Tue, 20 Dec 2016 21:12:28 +0000 (21:12 +0000)]
IR: Eliminate non-determinism in the module summary analysis.

Also make the summary ref and call graph vectors immutable. This means
a smaller API surface and fewer places to audit for non-determinism.

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

llvm-svn: 290200

7 years ago[LoopUnroll] Modify a comment to clarify the usage of TripCount. NFC.
Haicheng Wu [Tue, 20 Dec 2016 20:23:48 +0000 (20:23 +0000)]
[LoopUnroll] Modify a comment to clarify the usage of TripCount. NFC.

Make it clear that TripCount is the upper bound of the iteration on which
control exits LatchBlock.

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

llvm-svn: 290199

7 years ago[ARM] Implement isExtractSubvectorCheap.
Eli Friedman [Tue, 20 Dec 2016 20:05:07 +0000 (20:05 +0000)]
[ARM] Implement isExtractSubvectorCheap.

See https://reviews.llvm.org/D6678 for the history of
isExtractSubvectorCheap. Essentially the same considerations apply
to ARM.

This temporarily breaks the formation of vpadd/vpaddl in certain cases;
AddCombineToVPADDL essentially assumes that we won't form VUZP shuffles.
See https://reviews.llvm.org/D27779 for followup fix.

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

llvm-svn: 290198

7 years agoRollback my commit r290168 to fix linux tests failure. I'll be back!
Boris Ulasevich [Tue, 20 Dec 2016 20:00:58 +0000 (20:00 +0000)]
Rollback my commit r290168 to fix linux tests failure. I'll be back!

llvm-svn: 290197

7 years ago[ARM] Generate checks for shuffle tests using update_llc_test_checks.py.
Eli Friedman [Tue, 20 Dec 2016 19:33:24 +0000 (19:33 +0000)]
[ARM] Generate checks for shuffle tests using update_llc_test_checks.py.

llvm-svn: 290196

7 years agoUse MaxDepth instead of repeating its value
Matt Arsenault [Tue, 20 Dec 2016 19:06:15 +0000 (19:06 +0000)]
Use MaxDepth instead of repeating its value

llvm-svn: 290194

7 years agoAMDGPU: Allow 16-bit types in inline asm constraints
Matt Arsenault [Tue, 20 Dec 2016 19:06:12 +0000 (19:06 +0000)]
AMDGPU: Allow 16-bit types in inline asm constraints

llvm-svn: 290193

7 years agoAMDGPU: Run fp combine tests on VI
Matt Arsenault [Tue, 20 Dec 2016 18:55:11 +0000 (18:55 +0000)]
AMDGPU: Run fp combine tests on VI

llvm-svn: 290192

7 years agoAMDGPU: Don't add same instruction multiple times to worklist
Matt Arsenault [Tue, 20 Dec 2016 18:55:06 +0000 (18:55 +0000)]
AMDGPU: Don't add same instruction multiple times to worklist

When the instruction is processed the first time, it may be
deleted resulting in crashes. While the new test adds the same
user to the worklist twice, this particular case doesn't crash
but I'm not sure why.

llvm-svn: 290191

7 years agoReplace std::find_if with llvm::find_if. NFC.
George Burgess IV [Tue, 20 Dec 2016 18:46:27 +0000 (18:46 +0000)]
Replace std::find_if with llvm::find_if. NFC.

llvm-svn: 290190

7 years agoRevert "Re-add the assert to StringRef's const char *, length constructor."
Zachary Turner [Tue, 20 Dec 2016 18:05:47 +0000 (18:05 +0000)]
Revert "Re-add the assert to StringRef's const char *, length constructor."

This reverts commit r290188, which is causing internal compiler errors
on GCC 4.8

llvm-svn: 290189

7 years agoRe-add the assert to StringRef's const char *, length constructor.
Zachary Turner [Tue, 20 Dec 2016 17:57:56 +0000 (17:57 +0000)]
Re-add the assert to StringRef's const char *, length constructor.

By putting the assert behind a conditional in the initializer list
we can ensure that it will still work in a constexpr context as
the else branch of the ternary operator won't be examined unless
the condition fails.

llvm-svn: 290188

7 years agoFix missing '>' in docs (hopefully fixes bot error... )
David Blaikie [Tue, 20 Dec 2016 17:43:48 +0000 (17:43 +0000)]
Fix missing '>' in docs (hopefully fixes bot error... )

llvm-svn: 290187

7 years agoAdd some brief documentation about GDB pretty printers
David Blaikie [Tue, 20 Dec 2016 17:33:58 +0000 (17:33 +0000)]
Add some brief documentation about GDB pretty printers

llvm-svn: 290186

7 years agoAMDGPU/SI: Make a function const
Tom Stellard [Tue, 20 Dec 2016 17:26:34 +0000 (17:26 +0000)]
AMDGPU/SI: Make a function const

llvm-svn: 290185

7 years agoAMDGPU/SI: Add a MachineMemOperand when lowering llvm.amdgcn.buffer.load.*
Tom Stellard [Tue, 20 Dec 2016 17:19:44 +0000 (17:19 +0000)]
AMDGPU/SI: Add a MachineMemOperand when lowering llvm.amdgcn.buffer.load.*

Reviewers: arsenm, nhaehnle, mareko

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

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

llvm-svn: 290184

7 years ago[X86][SSE] Ensure we're only combining shuffles with legal mask types.
Simon Pilgrim [Tue, 20 Dec 2016 17:09:52 +0000 (17:09 +0000)]
[X86][SSE] Ensure we're only combining shuffles with legal mask types.

I haven't managed to get this to fail yet but its technically possible for the AND -> shuffle decomposition to result in illegal types.

llvm-svn: 290183

7 years ago[OPENMP] Fix for PR31416: Clang crashes on OMPCapturedExpr during source
Alexey Bataev [Tue, 20 Dec 2016 16:51:02 +0000 (16:51 +0000)]
[OPENMP] Fix for PR31416: Clang crashes on OMPCapturedExpr during source
based coverage compilation

Added source location info to captured expression declaration + fixed
source location info for loop based directives.

llvm-svn: 290181

7 years ago[CMake] [PR31433] Fix LLDB tool installation
Chris Bieneman [Tue, 20 Dec 2016 16:28:18 +0000 (16:28 +0000)]
[CMake] [PR31433] Fix LLDB tool installation

This resolves PR 31433.

llvm-svn: 290180

7 years agoAMDGPU/SI: Add a MachineMemOperand to MIMG instructions
Tom Stellard [Tue, 20 Dec 2016 15:52:17 +0000 (15:52 +0000)]
AMDGPU/SI: Add a MachineMemOperand to MIMG instructions

Summary:
Without a MachineMemOperand, the scheduler was assuming MIMG instructions
were ordered memory references, so no loads or stores could be reordered
across them.

Reviewers: arsenm

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye

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

llvm-svn: 290179

7 years agoclang-format: Fix bug in understanding string-label&value analysis.
Daniel Jasper [Tue, 20 Dec 2016 15:27:46 +0000 (15:27 +0000)]
clang-format: Fix bug in understanding string-label&value analysis.

While for <<-operators often used in log statments, a single key value
pair is always on the second operator, e.g.

  llvm::errs() << "aaaaa=" << aaaaa;

It is on the first operator for plus- or comma-concatenated strings:

  string s = "aaaaaaaaaa: " + aaaaaaaa;

(the "=" not counting because that's a different operator precedence)

llvm-svn: 290177

7 years ago[change-namespace] do not fix calls to overloaded operator functions.
Eric Liu [Tue, 20 Dec 2016 14:39:04 +0000 (14:39 +0000)]
[change-namespace] do not fix calls to overloaded operator functions.

Summary: Also make sure one function reference is only processed once.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 290176

7 years ago[OPENMP] Fix for PR31428: variable named like directive name modifier
Alexey Bataev [Tue, 20 Dec 2016 12:10:05 +0000 (12:10 +0000)]
[OPENMP] Fix for PR31428: variable named like directive name modifier

Directive name modifiers in 'if' clause are allowed only for OpenMP 4.5
and higher + in OpenMP 4.5 parsing procedure emits error message if ':'
is not found after directive name modifier.

llvm-svn: 290175

7 years ago[ELF] - Treat .openbsd.randomdata as relro section
George Rimar [Tue, 20 Dec 2016 11:28:54 +0000 (11:28 +0000)]
[ELF] - Treat .openbsd.randomdata as relro section

That was requested by Mark Kettenis in llvm-dev:

"It is the intention that .openbsd.randomdata sections are made
read-only after initialization. The native (ld.bfd based) OpenBSD
toolchain accomplishes this by including .openbsd.randomdata into the
PT_GNU_RELRO segment."

He suggested code change, I added testcase.

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

llvm-svn: 290174

7 years agoRevert "[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand."
Daniel Jasper [Tue, 20 Dec 2016 10:05:04 +0000 (10:05 +0000)]
Revert "[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand."

This reverts commit r290171. It triggers a bunch of warnings, because
the new enumerator isn't handled in all switches. We want a warning-free
build.

Replied on the commit with more details.

llvm-svn: 290173

7 years agoFix for clang_Cursor_getSpellingNameRange()
Kevin Funk [Tue, 20 Dec 2016 09:56:56 +0000 (09:56 +0000)]
Fix for clang_Cursor_getSpellingNameRange()

Summary:
Fixes spelling name ranges for user-defined string literal operators.

Example:
  constexpr int operator""_toint(unsigned long long val)
  { return int(val); }

Before this patch the spelling name range on consisted of 'operator'.

After this patch: 'operator""_toint'.

Related to http://reviews.llvm.org/D5041, which fixes the function for
other cursor kinds.

Reviewers: akyrtzi, craigt, skalinichev, klimek, milianw, bkramer

Subscribers: cfe-commits

Tags: #clang-c

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

llvm-svn: 290172

7 years ago[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand.
Egor Churaev [Tue, 20 Dec 2016 09:15:21 +0000 (09:15 +0000)]
[OpenCL] Enabling the usage of CLK_NULL_QUEUE as compare operand.

Summary: Enabling the compression of CLK_NULL_QUEUE to variable of type queue_t.

Reviewers: Anastasia

Subscribers: cfe-commits, yaxunl, bader

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

llvm-svn: 290171

7 years agoFix build with expensive checks enabled
Serge Pavlov [Tue, 20 Dec 2016 08:48:51 +0000 (08:48 +0000)]
Fix build with expensive checks enabled

Include of llvm/IR/Verifier.h was removed from HexagonCommonGEP.cpp in r289604
as unused. In fact it is required when expensive checks are enabled, because
it declared function `verifyFunction`, which is called in conditionally compiled
part of the file.

llvm-svn: 290170

7 years agoRevert r290149: Add the alloc_size attribute to clang.
Chandler Carruth [Tue, 20 Dec 2016 08:28:19 +0000 (08:28 +0000)]
Revert r290149: Add the alloc_size attribute to clang.

This commit fails MSan when running test/CodeGen/object-size.c in
a confusing way. After some discussion with George, it isn't really
clear what is going on here. We can make the MSan failure go away by
testing for the invalid bit, but *why* things are invalid isn't clear.
And yet, other code in the surrounding area is doing precisely this and
testing for invalid.

George is going to take a closer look at this to better understand the
nature of the failure and recommit it, for now backing it out to clean
up MSan builds.

llvm-svn: 290169

7 years agoBug 30863 - Step doesn't stop with coditional breakpoint on the next line
Boris Ulasevich [Tue, 20 Dec 2016 08:09:50 +0000 (08:09 +0000)]
Bug 30863 - Step doesn't stop with coditional breakpoint on the next line
Fixed by additional completed plans detection, and applying them on breakpoint condition fail.
Thread::GetStopInfo reworked. New test added.
Review https://reviews.llvm.org/D26497
Many thanks to Jim

llvm-svn: 290168