platform/upstream/llvm.git
7 years agoCodeGen: BlockPlacement: Clear ComputedEdges between functions.
Kyle Butt [Wed, 12 Apr 2017 03:18:20 +0000 (03:18 +0000)]
CodeGen: BlockPlacement: Clear ComputedEdges between functions.

Not clearing was causing non-deterministic compiles for large files. Addresses
for MachineBasicBlocks would end up colliding and we would lay out a block that
we assumed had been pre-computed when it had not been.

llvm-svn: 300022

7 years agoSerialization: Skip check in WritePragmaDiagnosticMappings, NFC
Duncan P. N. Exon Smith [Wed, 12 Apr 2017 02:31:17 +0000 (02:31 +0000)]
Serialization: Skip check in WritePragmaDiagnosticMappings, NFC

The record is never empty, since we always serialize the initial state.
Skip the check.

llvm-svn: 300021

7 years agoReland "[CMake][libunwind] Use -nodefaultlibs for CMake checks"
Petr Hosek [Wed, 12 Apr 2017 02:28:07 +0000 (02:28 +0000)]
Reland "[CMake][libunwind] Use -nodefaultlibs for CMake checks"

This is a reland of commit r299796.

Turned out that we need gcc_s or compiler-rt on ARM when checking
the support for -funwind-tables which creates a dependency on
__aeabi_unwind_cpp_pr0 symbol that's provided by the compiler
runtime.

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

llvm-svn: 300020

7 years agoThinLTOBitcodeWriter: keep comdats together, rename if leader is renamed
Bob Haarman [Wed, 12 Apr 2017 01:43:07 +0000 (01:43 +0000)]
ThinLTOBitcodeWriter: keep comdats together, rename if leader is renamed

Summary:
COFF requires that every comdat contain a symbol with the same name as
the comdat. ThinLTOBitcodeWriter renames symbols, which may cause this
requirement to be violated. This change avoids such violations by
renaming comdats if their leaders are renamed. It also keeps comdats
together when splitting modules.

Reviewers: pcc, mehdi_amini, tejohnson

Reviewed By: pcc

Subscribers: rnk, Prazek, llvm-commits

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

llvm-svn: 300019

7 years ago[XRay] [compiler-rt] Simplify FDR logging handler. [NFC]
Martin Pelikan [Wed, 12 Apr 2017 01:31:17 +0000 (01:31 +0000)]
[XRay] [compiler-rt] Simplify FDR logging handler. [NFC]

Summary:
Not repeating screamy failure paths makes the 300+ line function a bit shorter.
There's no need to overload the variable name "Buffer" if it only works on the
thread local buffer.  Fix some comments while there.

I plan to move the rewinding logic into a separate function too, but in this
diff it would be too much of a mess to comprehend.  This is trivially NFC.

Reviewers: kpw, dberris

Subscribers: llvm-commits

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

llvm-svn: 300018

7 years ago[XRay][compiler-rt] Add another work-around to XRay FDR tests when TSC emulation...
Douglas Yung [Wed, 12 Apr 2017 01:24:48 +0000 (01:24 +0000)]
[XRay][compiler-rt] Add another work-around to XRay FDR tests when TSC emulation is needed

This patch applies a work-around to the XRay FDR tests when TSC emulation is
needed because the processor frequency cannot be determined.

This fixes PR32620 using the suggestion given by Dean in comment 1.

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 300017

7 years agoRevert "[WebAssembly] Update use of Attributes after r299875"
Derek Schuff [Wed, 12 Apr 2017 01:17:31 +0000 (01:17 +0000)]
Revert "[WebAssembly] Update use of Attributes after r299875"

This reverts commit 2a0eb61dcccb15058d5b2a572bb3da0cf47fd550, r300015

I raced with rnk on the commit.

llvm-svn: 300016

7 years ago[WebAssembly] Update use of Attributes after r299875
Derek Schuff [Wed, 12 Apr 2017 01:09:34 +0000 (01:09 +0000)]
[WebAssembly] Update use of Attributes after r299875

This fixes the failing WebAssemblyLowerEmscriptenEHSjLj tests

llvm-svn: 300015

7 years ago[IR] Add AttributeSet to hide AttributeSetNode* again, NFC
Reid Kleckner [Wed, 12 Apr 2017 00:38:00 +0000 (00:38 +0000)]
[IR] Add AttributeSet to hide AttributeSetNode* again, NFC

Summary:
For now, it just wraps AttributeSetNode*. Eventually, it will hold
AvailableAttrs as an inline bitset, and adding and removing enum
attributes will be super cheap.

This sinks AttributeSetNode back down to lib/IR/AttributeImpl.h.

Reviewers: pete, chandlerc

Subscribers: llvm-commits, jfb

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

llvm-svn: 300014

7 years agoTeach SBFrame how to guess its language.
Jim Ingham [Wed, 12 Apr 2017 00:19:54 +0000 (00:19 +0000)]
Teach SBFrame how to guess its language.

<rdar://problem/31411646>

llvm-svn: 300012

7 years ago[lld] Keep full library path in DT_NEEDED.
Evgeniy Stepanov [Wed, 12 Apr 2017 00:13:48 +0000 (00:13 +0000)]
[lld] Keep full library path in DT_NEEDED.

Fixes PR32572.

When
    (a) a library has no soname
and (b) library is given on the command line with path (and not through -L/-l flags)
DT_NEEDED entry for such library keeps the path as given.

This behavior is consistent with gold and bfd, and is used in compiler-rt test suite.

This is a second attempt after r300007 got reverted. This time relro-omagic test is
changed in a way to avoid hardcoding the path to the test directory in the objdump'd
binary.

llvm-svn: 300011

7 years ago[msan] fix iconv interceptor. before the fix the interceptor failed to mark memory...
Kostya Serebryany [Wed, 12 Apr 2017 00:12:34 +0000 (00:12 +0000)]
[msan] fix iconv interceptor. before the fix the interceptor failed to mark memory as initialized if iconv returned -1. Found in a hard way while fuzzing libxml2 :(

llvm-svn: 300010

7 years agoAdd some FAIL constexpr tests for optional's copy/move ctors.
Marshall Clow [Wed, 12 Apr 2017 00:07:29 +0000 (00:07 +0000)]
Add some FAIL constexpr tests for optional's copy/move ctors.

llvm-svn: 300009

7 years agoRevert "[lld] Keep full library path in DT_NEEDED."
Evgeniy Stepanov [Wed, 12 Apr 2017 00:01:21 +0000 (00:01 +0000)]
Revert "[lld] Keep full library path in DT_NEEDED."

This reverts commit r300007. Reason: breaks all the bots.

llvm-svn: 300008

7 years ago[lld] Keep full library path in DT_NEEDED.
Evgeniy Stepanov [Tue, 11 Apr 2017 23:46:58 +0000 (23:46 +0000)]
[lld] Keep full library path in DT_NEEDED.

Fixes PR32572.

When
    (a) a library has no soname
and (b) library is given on the command line with path (and not through -L/-l flags)
DT_NEEDED entry for such library keeps the path as given.

This behavior is consistent with gold and bfd, and is used in compiler-rt test suite.

llvm-svn: 300007

7 years agoSilence unused variable warning in release builds.
Benjamin Kramer [Tue, 11 Apr 2017 23:06:49 +0000 (23:06 +0000)]
Silence unused variable warning in release builds.

llvm-svn: 300006

7 years agoRemove big-endianness from =<fillexp> code.
Rui Ueyama [Tue, 11 Apr 2017 22:45:57 +0000 (22:45 +0000)]
Remove big-endianness from =<fillexp> code.

llvm-svn: 300005

7 years agoCall getFiller only when filler is not zero.
Rui Ueyama [Tue, 11 Apr 2017 22:45:38 +0000 (22:45 +0000)]
Call getFiller only when filler is not zero.

llvm-svn: 300004

7 years agoRemove xgene1 from host detection
Yi Kong [Tue, 11 Apr 2017 22:39:55 +0000 (22:39 +0000)]
Remove xgene1 from host detection

This is not a supported mcpu tuning option. We should treat it as
"generic" variant.

Also, add record for cortex-a35.

llvm-svn: 300003

7 years ago[lld] --export-dynamic overrides --dynamic-list.
Evgeniy Stepanov [Tue, 11 Apr 2017 22:37:54 +0000 (22:37 +0000)]
[lld] --export-dynamic overrides --dynamic-list.

Fixes PR32573.

--export-dynamic exports everything, even in the presence of a --dynamic-list,
or --export-dynamic-symbol.

llvm-svn: 300002

7 years agoRevert r298824 & r298816, recommit r298742 & r298754
Richard Trieu [Tue, 11 Apr 2017 22:32:03 +0000 (22:32 +0000)]
Revert r298824 & r298816, recommit r298742 & r298754

r299989 fixes the underlying issue by waiting long enough to late parsed
arguments to be processed before doing an calculating the hash.

r298742
[ODRHash] Add error messages for mismatched parameters in methods.

r298754
[ODRHash] Add support for array and decayed types.

llvm-svn: 300001

7 years agoAMDGPU: Insert wait at start of callee functions
Matt Arsenault [Tue, 11 Apr 2017 22:29:31 +0000 (22:29 +0000)]
AMDGPU: Insert wait at start of callee functions

llvm-svn: 300000

7 years agoAMDGPU: Refactor SIMachineFunctionInfo slightly
Matt Arsenault [Tue, 11 Apr 2017 22:29:28 +0000 (22:29 +0000)]
AMDGPU: Refactor SIMachineFunctionInfo slightly

Prepare for handling non-entry functions.

llvm-svn: 299999

7 years agoAMDGPU: Refactor argument lowering
Matt Arsenault [Tue, 11 Apr 2017 22:29:24 +0000 (22:29 +0000)]
AMDGPU: Refactor argument lowering

Split into smaller functions and prepare for handling
non-entry functions.

llvm-svn: 299998

7 years agoAMDGPU: Fix folding reg_sequence into copy to phys reg
Matt Arsenault [Tue, 11 Apr 2017 22:29:19 +0000 (22:29 +0000)]
AMDGPU: Fix folding reg_sequence into copy to phys reg

This was producing an illegal reg_sequence defining
a physical register with virtual register inputs.

llvm-svn: 299997

7 years agoAMDGPU: Prune unecessary include
Matt Arsenault [Tue, 11 Apr 2017 22:29:16 +0000 (22:29 +0000)]
AMDGPU: Prune unecessary include

llvm-svn: 299996

7 years ago[asan] Give global metadata private linkage.
Evgeniy Stepanov [Tue, 11 Apr 2017 22:28:13 +0000 (22:28 +0000)]
[asan] Give global metadata private linkage.

Internal linkage preserves names like "__asan_global_foo" which may
account to 2% of unstripped binary size.

llvm-svn: 299995

7 years ago[AArch64] Fix scheduling info for INS(vector, general) instruction.
Balaram Makam [Tue, 11 Apr 2017 22:14:10 +0000 (22:14 +0000)]
[AArch64] Fix scheduling info for INS(vector, general) instruction.

llvm-svn: 299994

7 years agoAvoid some string copies, NFC
Vedant Kumar [Tue, 11 Apr 2017 22:11:46 +0000 (22:11 +0000)]
Avoid some string copies, NFC

llvm-svn: 299993

7 years ago[Sema][ObjC] Check whether a variable has a definition, rather than
Akira Hatanaka [Tue, 11 Apr 2017 22:01:33 +0000 (22:01 +0000)]
[Sema][ObjC] Check whether a variable has a definition, rather than
checking its storage class, when determining whether casting a C pointer
to an ObjC pointer is allowed.

This change allows casting variables whose declarations are directly
contained in a linkage specification to an ObjC pointer type. Those
variables are treated as if they contain the extern specifier for the
purpose of determining whether they are definitions or not.

rdar://problem/29249853

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

llvm-svn: 299992

7 years agoMinor updates to floating point intrinsic documentation
Andrew Kaylor [Tue, 11 Apr 2017 21:52:40 +0000 (21:52 +0000)]
Minor updates to floating point intrinsic documentation

llvm-svn: 299991

7 years agoInstSimplify: A shuffle of a splat is always the splat itself
Zvi Rackover [Tue, 11 Apr 2017 21:37:02 +0000 (21:37 +0000)]
InstSimplify:  A shuffle of a splat is always the splat itself

Summary:
Fold:
 shuffle (splat-shuffle), undef, M --> splat-shuffle

Reviewers: spatel, RKSimon, craig.topper

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 299990

7 years ago[ODRHash] Improve handling of hash values
Richard Trieu [Tue, 11 Apr 2017 21:31:00 +0000 (21:31 +0000)]
[ODRHash] Improve handling of hash values

Calculating the hash in Sema::ActOnTagFinishDefinition could happen before
all sub-Decls were parsed or processed, which would produce the wrong hash
value.  Change to calculating the hash on the first use and storing the value
instead.  Also, avoid using the macros that were only for Boolean fields and
use an explicit checker during the DefintionData merge.  No functional change,
but was this blocking other ODRHash patches.

llvm-svn: 299989

7 years ago[DAGCombine] Add more test cases for shuffle of splat. NFC.
Zvi Rackover [Tue, 11 Apr 2017 21:16:59 +0000 (21:16 +0000)]
[DAGCombine] Add more test cases for shuffle of splat. NFC.

Tests added contain splat-masks with undef elements.

llvm-svn: 299988

7 years agoModular Codegen: Support homing debug info for types in modular objects
David Blaikie [Tue, 11 Apr 2017 21:13:37 +0000 (21:13 +0000)]
Modular Codegen: Support homing debug info for types in modular objects

Matching the function-homing support for modular codegen. Any type
implicitly (implicit template specializations) or explicitly defined in
a module is attached to that module's object file and omitted elsewhere
(only a declaration used if necessary for references).

llvm-svn: 299987

7 years ago[x86] Relax the check in areLoadsFromSameBasePtr
Easwaran Raman [Tue, 11 Apr 2017 21:05:02 +0000 (21:05 +0000)]
[x86] Relax the check in areLoadsFromSameBasePtr

Check if the scale operand is identical (doesn't have to be 1) and
do not check the chaain operand.

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

llvm-svn: 299986

7 years ago[LV] Avoid vectorizing first order recurrence when phi uses are outside loop
Anna Thomas [Tue, 11 Apr 2017 21:02:00 +0000 (21:02 +0000)]
[LV] Avoid vectorizing first order recurrence when phi uses are outside loop

In the vectorization of first order recurrence, we vectorize such
that the last element in the vector will be the one extracted to pass into the
scalar remainder loop. However, this is not true when there is a phi (other
than the primary induction variable) is used outside the loop.
In such a case, we need the value from the second last iteration (i.e.
the phi value), not the last iteration (which would be the phi update).
I've added a test case for this. Also see PR32396.

A follow up patch would generate the correct code gen for such cases,
and turn this vectorization on.

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

Reviewers: mssimpso
llvm-svn: 299985

7 years ago[InstSimplify] add tests for chains of shuffles; NFC
Sanjay Patel [Tue, 11 Apr 2017 20:54:57 +0000 (20:54 +0000)]
[InstSimplify] add tests for chains of shuffles; NFC

llvm-svn: 299984

7 years ago[ExternalASTMerger] Removed a move constructor to address MSVC build failure
Sean Callanan [Tue, 11 Apr 2017 20:51:21 +0000 (20:51 +0000)]
[ExternalASTMerger] Removed a move constructor to address MSVC build failure

llvm-svn: 299983

7 years agoModular Codegen: Add/use a bit in serialized function definitions to track whether...
David Blaikie [Tue, 11 Apr 2017 20:46:34 +0000 (20:46 +0000)]
Modular Codegen: Add/use a bit in serialized function definitions to track whether they are the subject of modular codegen

Some decls are created not where they are written, but in other module
files/users (implicit special members and function template implicit
specializations). To correctly identify them, use a bit next to the definition
to track the modular codegen property.

Discussed whether the module file bit could be omitted in favor of
reconstituting from the modular codegen decls list - best guess today is that
the efficiency improvement of not having to deserialize the whole list whenever
any function is queried by a module user is worth it for the small size
increase of this redundant (list + bit-on-def) representation.

Reviewers: rsmith

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

llvm-svn: 299982

7 years agoAdd const children() accessors to match the existing non-const children() accessors.
Aaron Ballman [Tue, 11 Apr 2017 20:21:30 +0000 (20:21 +0000)]
Add const children() accessors to match the existing non-const children() accessors.

llvm-svn: 299981

7 years agoMemorySSA: Move to Analysis, from Transforms/Utils. It's used as
Daniel Berlin [Tue, 11 Apr 2017 20:06:36 +0000 (20:06 +0000)]
MemorySSA: Move to Analysis, from Transforms/Utils. It's used as
Analysis, it has Analysis passes, and once NewGVN is made an Analysis,
this removes the cross dependency from Analysis to Transform/Utils.
NFC.

llvm-svn: 299980

7 years agoImplement standalone lsan interceptors for OS X
Francis Ricci [Tue, 11 Apr 2017 20:05:02 +0000 (20:05 +0000)]
Implement standalone lsan interceptors for OS X

Summary:
Mimicks the existing tsan and asan implementations of
Darwin interception.

Reviewers: kubamracek, kcc, glider

Subscribers: llvm-commits, mgorny

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

llvm-svn: 299979

7 years agoDon't delete lsan thread-local data until it's no longer required
Francis Ricci [Tue, 11 Apr 2017 19:57:12 +0000 (19:57 +0000)]
Don't delete lsan thread-local data until it's no longer required

Summary:
The routines for thread destruction in the thread registry require
the lsan thread index, which is stored in pthread tls on OS X.
This means that we need to make sure that the lsan tls isn't destroyed
until after the thread registry tls. This change ensures that we
don't delete the lsan tls until we've finished destroying the thread
in the registry, ensuring that the destructor for the lsan tls runs
after the destructor for the thread registry tls.

This patch also adds a check to ensure that the thread ID is valid before
returning it in GetThreadID(), to ensure that the above behavior
is working correctly.

Reviewers: dvyukov, kubamracek, kcc

Subscribers: llvm-commits

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

llvm-svn: 299978

7 years ago[ExternalASTMerger] Fix the MSVC build
Sean Callanan [Tue, 11 Apr 2017 19:50:37 +0000 (19:50 +0000)]
[ExternalASTMerger] Fix the MSVC build

llvm-svn: 299977

7 years ago[clang-import-test] Lookup inside contexts
Sean Callanan [Tue, 11 Apr 2017 19:33:35 +0000 (19:33 +0000)]
[clang-import-test] Lookup inside contexts

clang-import-test has until now been only able to report top-level Decls.
This is clearly insufficient; we should be able to look inside structs
and namespaces also.  This patch adds new test cases for a variety of
lookups inside existing ASTContexts, and adds the functionality necessar
to make most of these testcases work.  (One testcase is known to fail
because of ASTImporter limitations when importing templates; I'll look
into that separately.)

This patch also separates the core functionality out into
ExternalASTMerger, an interface that allows clients like LLDB to make
use of it.  clang-import-test now only has the machinery necessary to
set up the tests.

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

llvm-svn: 299976

7 years agoMIR: Allow parsing of empty machine functions
Justin Bogner [Tue, 11 Apr 2017 19:32:41 +0000 (19:32 +0000)]
MIR: Allow parsing of empty machine functions

If you run llc -stop-after=codegenprepare and feed the resulting MIR
to llc -start-after=codegenprepare, you'll have an empty machine
function since we haven't run any isel yet. Of course, this only works
if the MIRParser believes you that this is okay.

This is essentially a revert of r241862 with a fix for the problem it
was papering over.

llvm-svn: 299975

7 years ago[AArch64] Simplify MacroFusion
Evandro Menezes [Tue, 11 Apr 2017 19:13:11 +0000 (19:13 +0000)]
[AArch64] Simplify MacroFusion

This patch assumes that the dependents to be scanned for the ExitSU are its
predecessors; otherwise, the successors of the instr are scanned.

Furthermore, sometimes the ExitSU was being fused twice, since it may be
fused once when scanning the successors from the beginning of the BB and
then again when scanning the predecessors of ExitSU.  Thus, when scanning
the successors of an instr, skip the ExitSU.

llvm-svn: 299974

7 years ago[X86] Create the correct ADC/SBB SDNode when lowering add.
Davide Italiano [Tue, 11 Apr 2017 19:11:20 +0000 (19:11 +0000)]
[X86] Create the correct ADC/SBB SDNode when lowering add.

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

llvm-svn: 299973

7 years ago[AddDiscriminators] Assign discriminators to MemIntrinsic calls.
Andrea Di Biagio [Tue, 11 Apr 2017 19:07:30 +0000 (19:07 +0000)]
[AddDiscriminators] Assign discriminators to MemIntrinsic calls.

Before this patch, pass AddDiscriminators always avoided to assign
discriminators to intrinsic calls. This was done mainly for two reasons:
 1) We wanted to minimize the number of based discriminators used.
 2) We wanted to avoid non-deterministic discriminator assignment for
    different debug levels.

Unfortunately, that approach was problematic for MemIntrinsic calls.
MemIntrinsic calls can be split by SROA into loads and stores, and each new
load/store instruction would obtain the debug location from the original
intrinsic call.
If we don't assign a discriminator to MemIntrinsic calls, then we cannot
correctly set the discriminator for the newly created loads and stores.
This may have a negative impact on the basic block weight computation
performed by the SampleLoader.

This patch fixes the issue by letting MemIntrinsic calls have a discriminator.

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

llvm-svn: 299972

7 years ago[InstCombine] Add testcases for (B&A)^A -> ~B & A and (B|A)^A -> B & ~A
Craig Topper [Tue, 11 Apr 2017 18:50:48 +0000 (18:50 +0000)]
[InstCombine] Add testcases for (B&A)^A -> ~B & A and (B|A)^A -> B & ~A

llvm-svn: 299971

7 years agoFix spelling compliment->complement. Mostly refering to 2s complement. NFC
Craig Topper [Tue, 11 Apr 2017 18:47:58 +0000 (18:47 +0000)]
Fix spelling compliment->complement. Mostly refering to 2s complement. NFC

llvm-svn: 299970

7 years ago[LV] Move first order recurrence test to common folder. NFC
Anna Thomas [Tue, 11 Apr 2017 18:31:42 +0000 (18:31 +0000)]
[LV] Move first order recurrence test to common folder. NFC

llvm-svn: 299969

7 years ago[libFuzzer] fix type in signal name.
Vitaly Buka [Tue, 11 Apr 2017 18:20:05 +0000 (18:20 +0000)]
[libFuzzer] fix type in signal name.

Fixes PR32576.

Patch by Jakub Zawadzki.

llvm-svn: 299968

7 years agollvm-lto2: Move the LTO::run() action behind a subcommand.
Peter Collingbourne [Tue, 11 Apr 2017 18:12:00 +0000 (18:12 +0000)]
llvm-lto2: Move the LTO::run() action behind a subcommand.

Move LTO::run() to a "run" subcommand so that we can introduce new subcommands
for testing different parts of the LTO implementation.

This doesn't use llvm::cl subcommands because it doesn't appear to be currently
possible to pass an argument not associated with a subcommand to a subcommand
(e.g. -lto-use-new-pm, -mcpu=yonah).

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

llvm-svn: 299967

7 years ago[InstCombine] Use ConstantExpr::getBinOpIdentity to implement getIdentityValue.
Craig Topper [Tue, 11 Apr 2017 17:42:40 +0000 (17:42 +0000)]
[InstCombine] Use ConstantExpr::getBinOpIdentity to implement getIdentityValue.

This removes a TODO in getIdentityValue and may allow some transforms to occur earlier. But I was unable to find any transforms we didn't already handle.

llvm-svn: 299966

7 years ago[OpenCL] Map default address space to alloca address space
Yaxun Liu [Tue, 11 Apr 2017 17:24:23 +0000 (17:24 +0000)]
[OpenCL] Map default address space to alloca address space

For OpenCL, the private address space qualifier is 0 in AST. Before this change, 0 address space qualifier
is always mapped to target address space 0. As now target private address space is specified by
alloca address space in data layout, address space qualifier 0 needs to be mapped to alloca addr space specified by the data layout.

This change has no impact on targets whose alloca addr space is 0.

With contributions from Matt Arsenault, Tony Tye and Wen-Heng (Jack) Chung

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

llvm-svn: 299965

7 years ago[AMDGPU] Add A5 to data layout for amdgiz environment
Yaxun Liu [Tue, 11 Apr 2017 17:18:13 +0000 (17:18 +0000)]
[AMDGPU] Add A5 to data layout for amdgiz environment

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

llvm-svn: 299964

7 years agoImplement LWG#2873: 'Add noexcept to several shared_ptr related functions' This issue...
Marshall Clow [Tue, 11 Apr 2017 17:08:53 +0000 (17:08 +0000)]
Implement LWG#2873: 'Add noexcept to several shared_ptr related functions' This issue missed a couple, so I added those as well (see LWG#2942)

llvm-svn: 299963

7 years ago[ASTPrinter] Print nested name specifiers for out-of-line functions
Alex Lorenz [Tue, 11 Apr 2017 16:46:03 +0000 (16:46 +0000)]
[ASTPrinter] Print nested name specifiers for out-of-line functions

rdar://31501863

llvm-svn: 299962

7 years agoAdd the definition of P in the clang tidy example
Sylvestre Ledru [Tue, 11 Apr 2017 16:28:15 +0000 (16:28 +0000)]
Add the definition of P in the clang tidy example

llvm-svn: 299961

7 years agoRevert 299954 : test failure needs to be fixed
Xinliang David Li [Tue, 11 Apr 2017 16:27:26 +0000 (16:27 +0000)]
Revert 299954 : test failure needs to be fixed

llvm-svn: 299960

7 years agoRevert 299953 : test failure needs to be fixed
Xinliang David Li [Tue, 11 Apr 2017 16:27:20 +0000 (16:27 +0000)]
Revert 299953 : test failure needs to be fixed

llvm-svn: 299959

7 years ago[PDB] Emit index/offset pairs for TPI and IPI streams
Reid Kleckner [Tue, 11 Apr 2017 16:26:15 +0000 (16:26 +0000)]
[PDB] Emit index/offset pairs for TPI and IPI streams

Summary:
This lets PDB readers lookup type record data by type index in O(log n)
time. It also enables makes `cvdump -t` work on PDBs produced by LLD.
cvdump will not dump a PDB that doesn't have an index-to-offset table.

The table is sorted by type index, and has an entry every 8KB. Looking
up a type record by index is a binary search of this table, followed by
a scan of at most 8KB.

Reviewers: ruiu, zturner, inglorion

Subscribers: llvm-commits

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

llvm-svn: 299958

7 years ago[lsan] Fix typo in test/lsan/lit.common.cfg
Maxim Ostapenko [Tue, 11 Apr 2017 16:22:19 +0000 (16:22 +0000)]
[lsan] Fix typo in test/lsan/lit.common.cfg

llvm-svn: 299957

7 years agoRevert temporarily D29877 "Warn about unused static file scope function template...
Vassil Vassilev [Tue, 11 Apr 2017 16:05:23 +0000 (16:05 +0000)]
Revert temporarily D29877 "Warn about unused static file scope function template declarations."

We need to address cases (breaking libc++) such as

template <class _Up> static int __test(...);

template<typename _Tp>
auto v = __test<_Tp>(0);

llvm-svn: 299956

7 years agorevert r299851 - [InstCombine] fix matching of or-of-icmps constants (PR32524)
Sanjay Patel [Tue, 11 Apr 2017 15:57:32 +0000 (15:57 +0000)]
revert r299851 - [InstCombine] fix matching of or-of-icmps constants (PR32524)

This is a candidate culprit for multiple bot fails, so reverting pending investigation.

llvm-svn: 299955

7 years ago[Profile] PE binary coverage bug fix
Xinliang David Li [Tue, 11 Apr 2017 15:51:39 +0000 (15:51 +0000)]
[Profile] PE binary coverage bug fix

PR/32584

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

llvm-svn: 299954

7 years ago[Profile] PE binary coverage bug fix
Xinliang David Li [Tue, 11 Apr 2017 15:51:32 +0000 (15:51 +0000)]
[Profile] PE binary coverage bug fix

PR/32584

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

llvm-svn: 299953

7 years ago[clang-format] Recognize Java logical shift assignment operator
Nico Weber [Tue, 11 Apr 2017 15:50:04 +0000 (15:50 +0000)]
[clang-format] Recognize Java logical shift assignment operator

At present, clang-format mangles Java containing logical right shift operators
('>>>=' or '>>>'), splitting them in two, resulting in invalid code:

 public class Minimal {
   public void func(String args) {
     int i = 42;
-    i >>>= 1;
+    i >> >= 1;
     return i;
   }
 }

This adds both forms of logical right shift to the FormatTokenLexer, so
clang-format won't attempt to split them and insert bogus whitespace.

https://reviews.llvm.org/D31652
Patch from Richard Bradfield <bradfier@fstab.me>!

llvm-svn: 299952

7 years agoFix PR13910: Don't warn that __builtin_unreachable() is unreachable
Alex Lorenz [Tue, 11 Apr 2017 15:36:06 +0000 (15:36 +0000)]
Fix PR13910: Don't warn that __builtin_unreachable() is unreachable

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

llvm-svn: 299951

7 years ago[Parser][ObjC++] Improve diagnostics and recovery when C++ keywords are used
Alex Lorenz [Tue, 11 Apr 2017 15:01:53 +0000 (15:01 +0000)]
[Parser][ObjC++] Improve diagnostics and recovery when C++ keywords are used
as identifiers in Objective-C++

This commit improves the 'expected identifier' errors that are presented when a
C++ keyword is used as an identifier in Objective-C++ by mentioning that this is
a C++ keyword in the diagnostic message. It also improves the error recovery:
the parser will now treat the C++ keywords as identifiers to prevent unrelated
parsing errors.

rdar://20626062

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

llvm-svn: 299950

7 years agoModule::getOrInsertFunction is using C-style vararg instead of variadic templates.
Serge Guelton [Tue, 11 Apr 2017 15:01:18 +0000 (15:01 +0000)]
Module::getOrInsertFunction is using C-style vararg instead of variadic templates.

From a user prospective, it forces the use of an annoying nullptr to mark the end of the vararg, and there's not type checking on the arguments.
The variadic template is an obvious solution to both issues.

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

llvm-svn: 299949

7 years agoReapply "Enable LSan for arm Linux"
Maxim Ostapenko [Tue, 11 Apr 2017 14:58:26 +0000 (14:58 +0000)]
Reapply "Enable LSan for arm Linux"

This patch reapplies r299923 with typo fixed in BLX macros.

llvm-svn: 299948

7 years agoRemove unused functions. Remove static qualifier from functions in header files....
Vassil Vassilev [Tue, 11 Apr 2017 14:55:32 +0000 (14:55 +0000)]
Remove unused functions. Remove static qualifier from functions in header files. NFC.

llvm-svn: 299947

7 years ago[AVR] Migrate to new MCAsmBackend applyFixup
Jonathan Roelofs [Tue, 11 Apr 2017 14:51:49 +0000 (14:51 +0000)]
[AVR] Migrate to new MCAsmBackend applyFixup

https://reviews.llvm.org/D31875

Patch by Leslie Zhai!

llvm-svn: 299946

7 years ago[ARM] Refactor Thumb2 sat instructions
Sam Parker [Tue, 11 Apr 2017 14:42:08 +0000 (14:42 +0000)]
[ARM] Refactor Thumb2 sat instructions

Refactor the USAT, SSAT, USAT16 and SSAT16 instruction descriptions
for Thumb2.

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

llvm-svn: 299945

7 years ago[GVNHoist] Re-enable GVNHoist by default
Geoff Berry [Tue, 11 Apr 2017 14:36:30 +0000 (14:36 +0000)]
[GVNHoist] Re-enable GVNHoist by default

Turn GVNHoist back on by default now that PR32153 has been fixed.

llvm-svn: 299944

7 years agoRevert r299923, it doesn't build in bootstrap builds.
Nico Weber [Tue, 11 Apr 2017 14:28:49 +0000 (14:28 +0000)]
Revert r299923, it doesn't build in bootstrap builds.

FAILED: lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.arm.dir/sanitizer_linux.cc.o
lib/sanitizer_common/sanitizer_linux.cc:1340:24: error: invalid instruction
                       BLX(ip)
                       ^
lib/sanitizer_common/sanitizer_linux.cc:1313:19: note: expanded from macro 'BLX'
#  define BLX(R) "mov lr, pc; bx" #R "\n"
                  ^
<inline asm>:6:13: note: instantiated into assembly here
mov lr, pc; bxip
            ^~~~

llvm-svn: 299943

7 years ago[libc++] Fix unknown pragma warning on MSVC
Ben Craig [Tue, 11 Apr 2017 14:06:39 +0000 (14:06 +0000)]
[libc++] Fix unknown pragma warning on MSVC

llvm-svn: 299942

7 years agoMark P0599 as complete. It was implemented in r298573
Marshall Clow [Tue, 11 Apr 2017 14:04:03 +0000 (14:04 +0000)]
Mark P0599 as complete. It was implemented in r298573

llvm-svn: 299941

7 years agoThis patch causes the installation of headers for the sanitizer and/or xray to be...
Catherine Moore [Tue, 11 Apr 2017 13:45:05 +0000 (13:45 +0000)]
This patch causes the installation of headers for the sanitizer and/or xray to be disabled when COMPILER_RT_BUILD_SANITIZERS=OFF and/or COMPILER_RT_BUILD_XRAY=OFF.

Reviewer: dberris

Subscribers: dberris, mgorny, llvm-commits, clm

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

llvm-svn: 299940

7 years ago[SDAG] Factor CandidateMatch check into lambda. NFC.
Nirav Dave [Tue, 11 Apr 2017 13:41:19 +0000 (13:41 +0000)]
[SDAG] Factor CandidateMatch check into lambda. NFC.

llvm-svn: 299939

7 years ago[SDAG] Factor ChainMerge into helper function NFCI.
Nirav Dave [Tue, 11 Apr 2017 13:41:17 +0000 (13:41 +0000)]
[SDAG] Factor ChainMerge into helper function NFCI.

llvm-svn: 299938

7 years ago[SDAG] Reorder expensive StoreMerge Check after cheaper one. NFC
Nirav Dave [Tue, 11 Apr 2017 13:41:16 +0000 (13:41 +0000)]
[SDAG] Reorder expensive StoreMerge Check after cheaper one. NFC

llvm-svn: 299937

7 years ago[StripDeadDebug/DIFinder] Track inlined SPs
Keno Fischer [Tue, 11 Apr 2017 13:32:11 +0000 (13:32 +0000)]
[StripDeadDebug/DIFinder] Track inlined SPs

Summary:
In rL299692 I improved strip-dead-debug-info's ability to drop CUs that are not
referenced from the current module. However, in doing so I neglected to realize
that some SPs could be referenced entirely from inlined functions. It appears
I was not the only one to make this mistake, because DebugInfoFinder, doesn't
find those SPs either. Fix this in DebugInfoFinder and then use that to make
sure not to drop those CUs in strip-dead-debug-info.

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: llvm-commits

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

llvm-svn: 299936

7 years ago[clangd] Implement item kind for completion results
Krasimir Georgiev [Tue, 11 Apr 2017 13:27:15 +0000 (13:27 +0000)]
[clangd] Implement item kind for completion results

Summary: The patch implements the conversion method from CXCursorKind to clangd::CompletionItemKind.
Contributed by stanionascu!

Reviewers: cfe-commits, bkramer, krasimir

Reviewed By: krasimir

Tags: #clang-tools-extra

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

llvm-svn: 299935

7 years agoAdd missing annotation to TestDataFormatterUnordered
Pavel Labath [Tue, 11 Apr 2017 12:26:33 +0000 (12:26 +0000)]
Add missing annotation to TestDataFormatterUnordered

llvm-svn: 299934

7 years agoRemove Plugins/Process/POSIX from include_directories
Pavel Labath [Tue, 11 Apr 2017 12:26:25 +0000 (12:26 +0000)]
Remove Plugins/Process/POSIX from include_directories

Summary:
The files there can always be referred to using their full path, which
is what most of the code has been doing already, so this makes the
situation more consistent. Also fix the the code in the FreeBSD plugin
to use the new paths.

Reviewers: eugene, emaste

Subscribers: lldb-commits, kettenis, mgorny, krytarowski

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

llvm-svn: 299933

7 years agoAdd MachineRegionInfoPassID to Passes.h.
Jan Sjodin [Tue, 11 Apr 2017 11:40:55 +0000 (11:40 +0000)]
Add MachineRegionInfoPassID to Passes.h.

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

llvm-svn: 299932

7 years agoGlobalISel: Allow legalizing G_FADD to a libcall
Diana Picus [Tue, 11 Apr 2017 10:52:34 +0000 (10:52 +0000)]
GlobalISel: Allow legalizing G_FADD to a libcall

Use the same handling in the generic legalizer code as for the other
libcalls (G_FREM, G_FPOW).

Enable it on ARM for float and double so we can test it.

llvm-svn: 299931

7 years agoWarn about unused static file scope function template declarations.
Vassil Vassilev [Tue, 11 Apr 2017 10:13:54 +0000 (10:13 +0000)]
Warn about unused static file scope function template declarations.

Reviewed by Richard Smith (D29877)!

llvm-svn: 299930

7 years ago[GlobalISel] LegalizerInfo: Enable legalization of non-power-of-2 types
Volkan Keles [Tue, 11 Apr 2017 10:10:14 +0000 (10:10 +0000)]
[GlobalISel] LegalizerInfo: Enable legalization of non-power-of-2 types

Summary: Legalize only if the type is marked as Legal or Custom. If not, return Unsupported as LegalizerHelper is not able to handle non-power-of-2 types right now.

Reviewers: qcolombet, aditya_nandakumar, dsanders, t.p.northover, kristof.beyls, javed.absar, ab

Reviewed By: kristof.beyls, ab

Subscribers: dberris, rovka, igorb, llvm-commits

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

llvm-svn: 299929

7 years agoRevert "Turn some C-style vararg into variadic templates"
Diana Picus [Tue, 11 Apr 2017 10:07:12 +0000 (10:07 +0000)]
Revert "Turn some C-style vararg into variadic templates"

This reverts commit r299925 because it broke the buildbots. See e.g.
http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15/builds/6008

llvm-svn: 299928

7 years ago[clang-format] Handle NSString literals by merging tokens.
Alexander Kornienko [Tue, 11 Apr 2017 09:55:00 +0000 (09:55 +0000)]
[clang-format] Handle NSString literals by merging tokens.

Summary:
This fixes a few outstanding bugs:
  * incorrect breaking of NSString literals containing double-width characters;
  * inconsistent formatting of ObjC dictionary literals containing NSString
    literals;
  * AlwaysBreakBeforeMultilineStrings ignoring implicitly-concatenated NSString
    literals.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 299927

7 years ago[SelectionDAG] Check CALLSEQ_BEGIN nodes in DelayForLiveRegs
Sam Parker [Tue, 11 Apr 2017 08:43:32 +0000 (08:43 +0000)]
[SelectionDAG] Check CALLSEQ_BEGIN nodes in DelayForLiveRegs

A fix for the bug reported in PR30911.

The issue arises when multiple CALLSEQ_BEGIN nodes are unscheduled as
the last node to be unscheduled will gain access to the CallResource
register. But when a node is being picked, only CALLSEQ_END nodes are
checked against the CallResource and have their chains evaluated.
This then means that other CALLSEQ_BEGIN nodes can be scheduled
before the existing call sequence has been finalised. This patch adds
a check against the FrameSetup nodes in DelayForLiveRegs to prevent
this from happening.

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

llvm-svn: 299926

7 years agoTurn some C-style vararg into variadic templates
Serge Guelton [Tue, 11 Apr 2017 08:36:52 +0000 (08:36 +0000)]
Turn some C-style vararg into variadic templates

Module::getOrInsertFunction is using C-style vararg instead of
variadic templates.

From a user prospective, it forces the use of an annoying nullptr
to mark the end of the vararg, and there's not type checking on the
arguments. The variadic template is an obvious solution to both
issues.

llvm-svn: 299925

7 years agoSimplify the code and remove dead code
Sylvestre Ledru [Tue, 11 Apr 2017 08:21:27 +0000 (08:21 +0000)]
Simplify the code and remove dead code

Summary: Fix coverity cid 1374240

Reviewers: dberlin

Reviewed By: dberlin

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

llvm-svn: 299924

7 years ago[lsan] Enable LSan for arm Linux
Maxim Ostapenko [Tue, 11 Apr 2017 08:13:38 +0000 (08:13 +0000)]
[lsan] Enable LSan for arm Linux

This patch enables LSan for arm Linux.

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

llvm-svn: 299923

7 years ago[XRay][compiler-rt] Add support for TSC emulation for x86_64 to xray_fdr_logging.cc
Douglas Yung [Tue, 11 Apr 2017 07:45:16 +0000 (07:45 +0000)]
[XRay][compiler-rt] Add support for TSC emulation for x86_64 to xray_fdr_logging.cc

Previously in r297800, a work-around was created to use TSC emulation on x86_64 when RDTSCP was not available on the host. A similar change was needed in the file xray_fdr_logging.cc which this patch ports over to that file.

Eventually the code should be refactored as there will be 3 locations with the same code, but that can be done as a separate step. This patch is just to keep the test from failing on my machine due to an illegal instruction since RDTSCP is not available on my x86_64 linux VM.

Reviewers: dberris

Subscribers: llvm-commits

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

llvm-svn: 299922