platform/upstream/llvm.git
7 years ago[OpenCL] Add intel_reqd_sub_group_size attribute support
Xiuli Pan [Thu, 4 May 2017 07:31:20 +0000 (07:31 +0000)]
[OpenCL] Add intel_reqd_sub_group_size attribute support

Summary:
Add intel_reqd_sub_group_size attribute support as intel extension  cl_intel_required_subgroup_size from
https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_required_subgroup_size.txt

Reviewers: Anastasia, bader, hfinkel, pxli168

Reviewed By: Anastasia, bader, pxli168

Subscribers: cfe-commits, yaxunl

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

llvm-svn: 302125

7 years ago[X86] Disabling PLT in Regcall CC Functions
Oren Ben Simhon [Thu, 4 May 2017 07:22:49 +0000 (07:22 +0000)]
[X86] Disabling PLT in Regcall CC Functions

According to psABI, PLT stub clobbers XMM8-XMM15.
In Regcall calling convention those registers are used for passing parameters.
Thus we need to prevent lazy binding in Regcall.

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

llvm-svn: 302124

7 years ago[AVX-512VL] Autogenerate checks. Add --show-mc-encoding to check instruction predicate.
Igor Breger [Thu, 4 May 2017 06:53:31 +0000 (06:53 +0000)]
[AVX-512VL] Autogenerate checks. Add --show-mc-encoding to check instruction predicate.

llvm-svn: 302123

7 years agotest commit
Eric Fiselier [Thu, 4 May 2017 06:28:34 +0000 (06:28 +0000)]
test commit

llvm-svn: 302122

7 years ago[XRay][compiler-rt][NFC] Update comments to doxygen format; group functions better.
Dean Michael Berris [Thu, 4 May 2017 06:27:51 +0000 (06:27 +0000)]
[XRay][compiler-rt][NFC] Update comments to doxygen format; group functions better.

llvm-svn: 302121

7 years agotest commit
Eric Fiselier [Thu, 4 May 2017 06:27:06 +0000 (06:27 +0000)]
test commit

llvm-svn: 302120

7 years ago[AVX] Fix vpcmpeqq predicate.
Igor Breger [Thu, 4 May 2017 06:24:52 +0000 (06:24 +0000)]
[AVX] Fix vpcmpeqq predicate.

Summary:
Fix vpcmpeqq predicate. AVX512 version of vpcmpeqq is not equivalent to AVX one.
Split from https://reviews.llvm.org/D32679

Reviewers: craig.topper, zvi, aymanmus

Reviewed By: craig.topper

Subscribers: llvm-commits

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

llvm-svn: 302119

7 years ago[libcxxabi][CMake] Set library dir when built under runtimes/
Jonas Hahnfeld [Thu, 4 May 2017 06:04:49 +0000 (06:04 +0000)]
[libcxxabi][CMake] Set library dir when built under runtimes/

This will put libraries into the build root's lib/ directory by default.

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

llvm-svn: 302118

7 years ago[libcxx][CMake] Set library dir when built under runtimes/
Jonas Hahnfeld [Thu, 4 May 2017 06:02:50 +0000 (06:02 +0000)]
[libcxx][CMake] Set library dir when built under runtimes/

This will put libraries into the build root's lib/ directory by default.

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

llvm-svn: 302117

7 years agoupdate buildbot doc to link to the new Appveyor builders
Eric Fiselier [Thu, 4 May 2017 05:58:59 +0000 (05:58 +0000)]
update buildbot doc to link to the new Appveyor builders

llvm-svn: 302116

7 years agoAttempt to enable the LIT progress bar on Appveyor
Eric Fiselier [Thu, 4 May 2017 05:32:54 +0000 (05:32 +0000)]
Attempt to enable the LIT progress bar on Appveyor

llvm-svn: 302115

7 years agoUse right function in LoopVectorize.
Jonas Paulsson [Thu, 4 May 2017 05:31:56 +0000 (05:31 +0000)]
Use right function in LoopVectorize.

-    unsigned AS = getMemInstAlignment(I);
+    unsigned AS = getMemInstAddressSpace(I);

Review: Hal Finkel
llvm-svn: 302114

7 years agoSetup Appveyor bot for MSVC 2017 and MSVC 2015
Eric Fiselier [Thu, 4 May 2017 05:16:48 +0000 (05:16 +0000)]
Setup Appveyor bot for MSVC 2017 and MSVC 2015

llvm-svn: 302113

7 years ago[XRay][compiler-rt] Support patching/unpatching specific functions
Dean Michael Berris [Thu, 4 May 2017 04:59:20 +0000 (04:59 +0000)]
[XRay][compiler-rt] Support patching/unpatching specific functions

Summary:
This change allows us to patch/unpatch specific functions using the
function ID. This is useful in cases where implementations might want to
do coverage-style, or more fine-grained control of which functions to
patch or un-patch at runtime.

Depends on D32693.

Reviewers: dblaikie, echristo, kpw

Subscribers: llvm-commits

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

llvm-svn: 302112

7 years ago[XRay] Use wordsize-dependent alignment for index
Dean Michael Berris [Thu, 4 May 2017 04:55:46 +0000 (04:55 +0000)]
[XRay] Use wordsize-dependent alignment for index

This makes it simpler for the runtime to consistently handle the entries
in the function sled index in both 32 and 64 bit platforms where the
XRay runtime works.

Follow-up on D32693.

llvm-svn: 302111

7 years ago[SelectionDAG] Improve known bits support for CTPOP.
Craig Topper [Thu, 4 May 2017 04:33:27 +0000 (04:33 +0000)]
[SelectionDAG] Improve known bits support for CTPOP.

This is based on the same concept from ValueTracking's version of computeKnownBits.

llvm-svn: 302110

7 years ago[XRay] Create an Index of sleds per function
Dean Michael Berris [Thu, 4 May 2017 03:37:57 +0000 (03:37 +0000)]
[XRay] Create an Index of sleds per function

Summary:
This change adds a new section to the xray-instrumented binary that
stores an index into ranges of the instrumentation map, where sleds
associated with the same function can be accessed as an array. At
runtime, we can get access to this index by function ID offset allowing
for selective patching and unpatching by function ID.

Each entry in this new section (xray_fn_idx) will include two pointers
indicating the start and one past the end of the sleds associated with
the same function. These entries will be 16 bytes long on x86 and
aarch64. On arm, we align to 16 bytes anyway so the runtime has to take
that into consideration.

__{start,stop}_xray_fn_idx will be the symbols that the runtime will
look for when we implement the selective patching/unpatching by function
id APIs. Because XRay synthesizes the function id's in a monotonically
increasing manner at runtime now, implementations (and users) can use
this table to look up the sleds associated with a specific function.
This is useful in implementations that want to do things like:

  - Implement coverage mode for functions by patching everything
    pre-main, then as functions are encountered, the installed handler
    can unpatch the function that's been encountered after recording
    that it's been called.
  - Do "learning mode", so that the implementation can figure out some
    statistical information about function calls by function id for a
    time being, and then determine which functions are worth
    uninstrumenting at runtime.
  - Do "selective instrumentation" where an implementation can
    specifically instrument only certain function id's at runtime
    (either based on some external data, or through some other
    heuristics) instead of patching all the instrumented functions at
    runtime.

Reviewers: dblaikie, echristo, chandlerc, javed.absar

Subscribers: pelikan, aemerson, kpw, llvm-commits, rengolin

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

llvm-svn: 302109

7 years agoIR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI.
Peter Collingbourne [Thu, 4 May 2017 03:36:16 +0000 (03:36 +0000)]
IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI.

When profiling a no-op incremental link of Chromium I found that the functions
computeImportForFunction and computeDeadSymbols were consuming roughly 10% of
the profile. The goal of this change is to improve the performance of those
functions by changing the map lookups that they were previously doing into
pointer dereferences.

This is achieved by changing the ValueInfo data structure to be a pointer to
an element of the global value map owned by ModuleSummaryIndex, and changing
reference lists in the GlobalValueSummary to hold ValueInfos instead of GUIDs.
This means that a ValueInfo will take a client directly to the summary list
for a given GUID.

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

llvm-svn: 302108

7 years agoFix accounting of tbss.
Rafael Espindola [Thu, 4 May 2017 03:00:27 +0000 (03:00 +0000)]
Fix accounting of tbss.

We were correctly computing the size contribution of a .tbss input
section (it is none), but we were incorrectly considering the
alignment of the output section: it was advancing Dot instead of
ThreadBssOffset.

As far as I can tell this was always wrong in our linkerscript
implementation, but that became more visible now that the code is
shared with the non linker script case.

llvm-svn: 302107

7 years agollvm/IR/Function.h: Prune an obsolete @param in r302060. [-Wdocumentation]
NAKAMURA Takumi [Thu, 4 May 2017 02:01:18 +0000 (02:01 +0000)]
llvm/IR/Function.h: Prune an obsolete @param in r302060. [-Wdocumentation]

llvm-svn: 302106

7 years ago[libcxx] [test] Strip trailing whitespace. NFC.
Stephan T. Lavavej [Thu, 4 May 2017 01:43:58 +0000 (01:43 +0000)]
[libcxx] [test] Strip trailing whitespace. NFC.

llvm-svn: 302105

7 years ago[libcxx] [test] In msvc_stdlib_force_include.hpp, use _HAS_CXX17 to set TEST_STD_VER.
Stephan T. Lavavej [Thu, 4 May 2017 01:35:11 +0000 (01:35 +0000)]
[libcxx] [test] In msvc_stdlib_force_include.hpp, use _HAS_CXX17 to set TEST_STD_VER.

_HAS_CXX17 indicates whether MSVC's STL is in C++17 mode.

In MSVC there's a distinction between CRT headers like stdlib.h and STL headers
like cstdlib. Only the STL headers drag in yvals.h, our internal STL-wide header
that defines internal macros like _HAS_CXX17.

_HAS_CXX17 is an MSVC STL library macro, unconditionally defined. We centralize
everything on this, because we have to ask different questions to determine
whether C1XX, EDG, or Clang is in 14 or 17 mode, and we additionally permit
users to override the detection in one way (it's okay to ask for 17 from the
compiler, but only 14 from the libs, at least for the moment; only noexcept
in the type system will give us a headache).

As this header is for testing MSVC's STL, we can assume _HAS_CXX17 is defined.

Fixes D32726.

llvm-svn: 302104

7 years ago[XRay] Detect loops in functions being lowered
Dean Michael Berris [Thu, 4 May 2017 01:24:26 +0000 (01:24 +0000)]
[XRay] Detect loops in functions being lowered

Summary:
This is an implementation of the loop detection logic that XRay needs to
determine whether a function might take time at runtime. Without this
heuristic, XRay will tend to not instrument short functions that have
loops that might have runtime dependent on inputs or external values.

While this implementation doesn't do any further analysis than just
figuring out whether there is a loop in the MachineFunction being
code-gen'ed, we're paving the way for being able to perform more
sophisticated analysis of the function in the future (for example to
determine whether the trip count for the loop might be constant, and
make a decision on that instead). This enables us to cover more
functions with the default heuristics, and potentially identify ones
that have variable runtime latency just by looking for the presence of
loops.

Reviewers: chandlerc, rnk, pelikan

Subscribers: llvm-commits

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

llvm-svn: 302103

7 years agoAttempt to escape paths correctly
Eric Fiselier [Thu, 4 May 2017 01:17:22 +0000 (01:17 +0000)]
Attempt to escape paths correctly

llvm-svn: 302102

7 years agoAttempt to setup MSVC 2017
Eric Fiselier [Thu, 4 May 2017 01:17:21 +0000 (01:17 +0000)]
Attempt to setup MSVC 2017

llvm-svn: 302101

7 years agoUse nullptr instead of the literal 0
Eric Fiselier [Thu, 4 May 2017 01:06:56 +0000 (01:06 +0000)]
Use nullptr instead of the literal 0

llvm-svn: 302100

7 years agoFix macro redefinition warnings for _LIBCPP_NO_RTTI
Eric Fiselier [Thu, 4 May 2017 01:06:54 +0000 (01:06 +0000)]
Fix macro redefinition warnings for _LIBCPP_NO_RTTI

llvm-svn: 302099

7 years agoAdd #pragma clang module begin/end pragmas and generate them when preprocessing a...
Richard Smith [Thu, 4 May 2017 00:29:54 +0000 (00:29 +0000)]
Add #pragma clang module begin/end pragmas and generate them when preprocessing a module.

These pragmas are intended to simulate the effect of entering or leaving a file
with an associated module. This is not completely implemented yet: declarations
between the pragmas will not be attributed to the correct module, but macro
visibility is already functional.

Modules named by #pragma clang module begin must already be known to clang (in
some module map that's either loaded or on the search path).

llvm-svn: 302098

7 years agoTest commit for Appveyor - Remove incorrect caching logic
Eric Fiselier [Thu, 4 May 2017 00:16:35 +0000 (00:16 +0000)]
Test commit for Appveyor - Remove incorrect caching logic

llvm-svn: 302097

7 years ago[SCEV] createAddRecFromPHI: Optimize for the most common case.
Michael Zolotukhin [Wed, 3 May 2017 23:53:38 +0000 (23:53 +0000)]
[SCEV] createAddRecFromPHI: Optimize for the most common case.

Summary:
The existing implementation creates a symbolic SCEV expression every
time we analyze a phi node and then has to remove it, when the analysis
is finished. This is very expensive, and in most of the cases it's also
unnecessary. According to the data I collected, ~60-70% of analyzed phi
nodes (measured on SPEC) have the following form:
  PN = phi(Start, OP(Self, Constant))
Handling such cases separately significantly speeds this up.

Reviewers: sanjoy, pete

Subscribers: llvm-commits

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

llvm-svn: 302096

7 years agoCMake: Only add test/ subdirectory when it exists
Duncan P. N. Exon Smith [Wed, 3 May 2017 23:33:54 +0000 (23:33 +0000)]
CMake: Only add test/ subdirectory when it exists

r296685 started adding the test/ subdirectory even when
LIBCXX_INCLUDE_TESTS=OFF.  This is great for testing libcxx standalone,
but it also breaks the build when the test/ subdirectory is removed
(and our submission system strips all test/ directories).

This patch updates the logic to check for test/ before adding it.

rdar://problem/31931366

llvm-svn: 302095

7 years agostrlen-1.ll: Fix test
Matthias Braun [Wed, 3 May 2017 23:32:51 +0000 (23:32 +0000)]
strlen-1.ll: Fix test

Change test for `strlen(x) == 0 --> *x == 0` to actually test the
pattern.

llvm-svn: 302094

7 years ago[InstCombine][KnownBits] Use KnownBits better to detect nsw adds
Craig Topper [Wed, 3 May 2017 23:22:46 +0000 (23:22 +0000)]
[InstCombine][KnownBits] Use KnownBits better to detect nsw adds

Change checkRippleForAdd from a heuristic to a full check -
if it is provable that the add does not overflow return true, otherwise false.

Patch by Yoav Ben-Shalom

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

llvm-svn: 302093

7 years agoMark functions as not having CFI once we finalize an x86 stack frame
Reid Kleckner [Wed, 3 May 2017 23:13:42 +0000 (23:13 +0000)]
Mark functions as not having CFI once we finalize an x86 stack frame

We'll set it back to true in emitPrologue if it gets called. It doesn't
get called for naked functions.

Fixes PR32912

llvm-svn: 302092

7 years ago[KnownBits] Add methods for determining if KnownBits is a constant value
Craig Topper [Wed, 3 May 2017 23:12:29 +0000 (23:12 +0000)]
[KnownBits] Add methods for determining if KnownBits is a constant value

This patch adds isConstant and getConstant for determining if KnownBits represents a constant value and to retrieve the value. Use them to simplify code.

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

llvm-svn: 302091

7 years agoRemove a comment that is no longer true.
Rui Ueyama [Wed, 3 May 2017 23:10:33 +0000 (23:10 +0000)]
Remove a comment that is no longer true.

llvm-svn: 302090

7 years ago[ValueTracking] Remove handling for BitWidth being 0 in ComputeSignBit and isKnownNon...
Craig Topper [Wed, 3 May 2017 22:25:19 +0000 (22:25 +0000)]
[ValueTracking] Remove handling for BitWidth being 0 in ComputeSignBit and isKnownNonZero.

I don't believe its possible to have non-zero values here since DataLayout became required. The APInt constructor inside of the KnownBits object will assert if this ever happens.

llvm-svn: 302089

7 years ago[KnownBits] Add zext, sext, and trunc methods to KnownBits
Craig Topper [Wed, 3 May 2017 22:07:25 +0000 (22:07 +0000)]
[KnownBits] Add zext, sext, and trunc methods to KnownBits

This patch adds zext, sext, and trunc methods to KnownBits and uses them where possible.

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

llvm-svn: 302088

7 years ago[TargetLowering] use isSubsetOf in SimplifyDemandedBits; NFCI
Sanjay Patel [Wed, 3 May 2017 21:55:34 +0000 (21:55 +0000)]
[TargetLowering] use isSubsetOf in SimplifyDemandedBits; NFCI

This is the DAG equivalent of https://reviews.llvm.org/D32255 ,
which will hopefully be committed again. The functionality
(preferring a 'not' op) is already here in the DAG, so this is
just intended to be a clean-up and performance improvement.

llvm-svn: 302087

7 years agoclang-format and restyle DWARFFormValue before working on it. NFC
Paul Robinson [Wed, 3 May 2017 21:53:21 +0000 (21:53 +0000)]
clang-format and restyle DWARFFormValue before working on it. NFC

llvm-svn: 302086

7 years agoDebugInfo: elide type index entries for synthetic types
Saleem Abdulrasool [Wed, 3 May 2017 21:39:01 +0000 (21:39 +0000)]
DebugInfo: elide type index entries for synthetic types

Compiler emitted synthetic types may not have an associated DIFile
(translation unit).  In such a case, when generating CodeView debug type
information, we would attempt to compute an absolute filepath which
would result in a segfault due to a NULL DIFile*.  If there is no source
file associated with the type, elide the type index entry for the type
and record the type information.  This actually results in higher
fidelity debug information than clang/C2 as of this writing.

Resolves PR32668!

llvm-svn: 302085

7 years agoAttempt to fix appveyor build
Eric Fiselier [Wed, 3 May 2017 21:14:26 +0000 (21:14 +0000)]
Attempt to fix appveyor build

llvm-svn: 302084

7 years agoAccept archive files with no symbol table instad of warning on them.
Rui Ueyama [Wed, 3 May 2017 21:03:08 +0000 (21:03 +0000)]
Accept archive files with no symbol table instad of warning on them.

It seems virtually everyone who tries to do LTO build with Clang and
LLD was hit by a mistake to forget using llvm-ar command to create
archive files. I wasn't an exception. Since this is an annoying common
issue, it is probably better to handle that gracefully rather than
reporting an error and tell the user to redo build with different
configuration.

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

llvm-svn: 302083

7 years agoQualify calls to __invoke, __apply_fuctor, and __mu
Eric Fiselier [Wed, 3 May 2017 21:02:19 +0000 (21:02 +0000)]
Qualify calls to __invoke, __apply_fuctor, and __mu

llvm-svn: 302082

7 years ago[AArch64] Fix variable name ambiguity in r302078.
Ahmed Bougacha [Wed, 3 May 2017 20:51:34 +0000 (20:51 +0000)]
[AArch64] Fix variable name ambiguity in r302078.

ArchKind is passed to the function, but it's also a type.

llvm-svn: 302081

7 years ago[TailCallElim] Remove an unused argument. NFCI
Xin Tong [Wed, 3 May 2017 20:37:07 +0000 (20:37 +0000)]
[TailCallElim] Remove an unused argument. NFCI

llvm-svn: 302080

7 years ago[Driver] Update AArch64 testcase to match llvm r302078.
Ahmed Bougacha [Wed, 3 May 2017 20:34:32 +0000 (20:34 +0000)]
[Driver] Update AArch64 testcase to match llvm r302078.

llvm-svn: 302079

7 years ago[AArch64] Make the TargetParser add CPU exts provided by the arch.
Ahmed Bougacha [Wed, 3 May 2017 20:33:58 +0000 (20:33 +0000)]
[AArch64] Make the TargetParser add CPU exts provided by the arch.

Otherwise, each CPU has to manually specify the extensions it supports,
even though they have to be a superset of the base arch extensions.
And when there's redundant data there's stale data, so most of the CPUs
lie about the features they support (almost none lists AEK_FP).

Instead, do the saner thing: add the optional extensions on top of the
base extensions provided by the architecture.

The ARM TargetParser has the same behavior.

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

llvm-svn: 302078

7 years ago[AArch64] armv8-A doesn't have CRC.
Ahmed Bougacha [Wed, 3 May 2017 20:33:52 +0000 (20:33 +0000)]
[AArch64] armv8-A doesn't have CRC.

That's only a required extension as of v8.1a.

Remove it from the "generic" CPU as well: it should only support the
base ISA (and binutils agrees).

Also unify the MC tests into crc.s and arm64-crc32.s

llvm-svn: 302077

7 years ago[libFuzzer] exit without running atexit handlers in libfuzzer's crash handler
Vitaly Buka [Wed, 3 May 2017 20:31:19 +0000 (20:31 +0000)]
[libFuzzer] exit without running atexit handlers in libfuzzer's crash handler

Summary:
It's not safe to assume that atexit handlers can be run once the app crashed.

Patch by Jochen Eisinger.

Reviewers: kcc, vitalybuka

Subscribers: llvm-commits

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

llvm-svn: 302076

7 years ago[Hexagon] Use automatically-generated scheduling information for HVX
Krzysztof Parzyszek [Wed, 3 May 2017 20:10:36 +0000 (20:10 +0000)]
[Hexagon] Use automatically-generated scheduling information for HVX

Patch by Jyotsna Verma.

llvm-svn: 302073

7 years ago[ScopInfo] Do not use LLVM names to identify statements, arrays, and parameters
Tobias Grosser [Wed, 3 May 2017 20:08:52 +0000 (20:08 +0000)]
[ScopInfo] Do not use LLVM names to identify statements, arrays, and parameters

LLVM-IR names are commonly available in debug builds, but often not in release
builds. Hence, using LLVM-IR names to identify statements or memory reference
results makes the behavior of Polly depend on the compile mode. This is
undesirable. Hence, we now just number the statements instead of using LLVM-IR
names to identify them (this issue has previously been brought up by Zino
Benaissa).

However, as LLVM-IR names help in making test cases more readable, we add an
option '-polly-use-llvm-names' to still use LLVM-IR names. This flag is by
default set in the polly tests to make test cases more readable.

This change reduces the time in ScopInfo from 32 seconds to 2 seconds for the
following test case provided by Eli Friedman <efriedma@codeaurora.org> (already
used in one of the previous commits):

  struct X { int x; };
  void a();
  #define SIG (int x, X **y, X **z)
  typedef void (*fn)SIG;
  #define FN { for (int i = 0; i < x; ++i) { (*y)[i].x += (*z)[i].x; } a(); }
  #define FN5 FN FN FN FN FN
  #define FN25 FN5 FN5 FN5 FN5
  #define FN125 FN25 FN25 FN25 FN25 FN25
  #define FN250 FN125 FN125
  #define FN1250 FN250 FN250 FN250 FN250 FN250
  void x SIG { FN1250 }

For a larger benchmark I have on-hand (10000 loops), this reduces the time for
running -polly-scops from 5 minutes to 4 minutes, a reduction by 20%.

The reason for this large speedup is that our previous use of printAsOperand
had a quadratic cost, as for each printed and unnamed operand the full function
was scanned to find the instruction number that identifies the operand.

We do not need to adjust the way memory reference ids are constructured, as
they do not use LLVM values.

Reviewed by: efriedma

Tags: #polly

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

llvm-svn: 302072

7 years agoRemove unused private field.
Zachary Turner [Wed, 3 May 2017 19:42:06 +0000 (19:42 +0000)]
Remove unused private field.

llvm-svn: 302069

7 years agoAvoid warning of unused variable in release builds. NFC
Anna Thomas [Wed, 3 May 2017 19:25:04 +0000 (19:25 +0000)]
Avoid warning of unused variable in release builds. NFC

llvm-svn: 302068

7 years agoRevert r301897, "ELF: Set symbol binding to STB_GLOBAL when undefining symbols during...
Peter Collingbourne [Wed, 3 May 2017 19:23:30 +0000 (19:23 +0000)]
Revert r301897, "ELF: Set symbol binding to STB_GLOBAL when undefining symbols during LTO."

It doesn't matter what binding we store in a non-UsedInRegularObj undefined
symbol because we should reset it when we see a real undefined symbol in
a combined LTO object. The fact that we weren't doing so before is a bug
(PR32899) which is now fixed.

llvm-svn: 302067

7 years agoTests: strengthen CHECK line to avoid picking up stray path.
Tim Northover [Wed, 3 May 2017 19:20:45 +0000 (19:20 +0000)]
Tests: strengthen CHECK line to avoid picking up stray path.

A bot had "-LTO" in its working directory, which matched the regex used in this
test. Since the arg is quoted, we can exploit that instead. Still broken if
there's a path with a quote in, but I think that's pretty niche.

llvm-svn: 302066

7 years agoHandle mixed strong and weak undefined symbols.
Rafael Espindola [Wed, 3 May 2017 18:40:27 +0000 (18:40 +0000)]
Handle mixed strong and weak undefined symbols.

We were ignoring strong undefined symbols if they followed weak ones.

Fixes pr32899.

llvm-svn: 302065

7 years ago[asan] print the 'unexpected format specifier in printf interceptor' warning just...
Kostya Serebryany [Wed, 3 May 2017 18:38:34 +0000 (18:38 +0000)]
[asan] print the 'unexpected format specifier in printf interceptor' warning just once (came up in https://github.com/google/oss-fuzz/pull/562). Not touching a similar scanf warning -- for some reason it does not fire for me.

llvm-svn: 302064

7 years agoFix typos in comment
Sanjoy Das [Wed, 3 May 2017 18:29:34 +0000 (18:29 +0000)]
Fix typos in comment

llvm-svn: 302063

7 years agoBreak verification down into smaller functions to keep code clean.
Greg Clayton [Wed, 3 May 2017 18:25:46 +0000 (18:25 +0000)]
Break verification down into smaller functions to keep code clean.

Adrian requested that we break things down to make things clean in the DWARFVerifier. This patch breaks everything down into nice individual functions and cleans up the code quite a bit and prepares us for the next round of verifiers.

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

llvm-svn: 302062

7 years agoFix PPC64 warning for missing parantheses. NFC.
Anna Thomas [Wed, 3 May 2017 18:25:43 +0000 (18:25 +0000)]
Fix PPC64 warning for missing parantheses. NFC.

llvm-svn: 302061

7 years ago[IR] Abstract away ArgNo+1 attribute indexing as much as possible
Reid Kleckner [Wed, 3 May 2017 18:17:31 +0000 (18:17 +0000)]
[IR] Abstract away ArgNo+1 attribute indexing as much as possible

Summary:
Do three things to help with that:
- Add AttributeList::FirstArgIndex, which is an enumerator currently set
  to 1. It allows us to change the indexing scheme with fewer changes.
- Add addParamAttr/removeParamAttr. This just shortens addAttribute call
  sites that would otherwise need to spell out FirstArgIndex.
- Remove some attribute-specific getters and setters from Function that
  take attribute list indices.  Most of these were only used from
  BuildLibCalls, and doesNotAlias was only used to test or set if the
  return value is malloc-like.

I'm happy to split the patch, but I think they are probably easier to
review when taken together.

This patch should be NFC, but it sets the stage to change the indexing
scheme to this, which is more convenient when indexing into an array:
  0: func attrs
  1: retattrs
  2...: arg attrs

Reviewers: chandlerc, pete, javed.absar

Subscribers: david2050, llvm-commits

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

llvm-svn: 302060

7 years ago[CodeView] Remove constructor initialization of a removed field.
Davide Italiano [Wed, 3 May 2017 18:02:46 +0000 (18:02 +0000)]
[CodeView] Remove constructor initialization of a removed field.

I should've staged this with my last commit.

llvm-svn: 302059

7 years ago[RuntimeLoopUnroller] Add assert that we dont unroll non-rotated loops
Anna Thomas [Wed, 3 May 2017 17:43:59 +0000 (17:43 +0000)]
[RuntimeLoopUnroller] Add assert that we dont unroll non-rotated loops

Summary:
Cloning basic blocks in the loop for runtime loop unroller depends on loop being
in rotated form (i.e. loop latch target is the exit block).
Assert that this is true, so that callers of runtime loop unroller pass in
canonical loops.
The single caller of this function has that check recently added:
https://reviews.llvm.org/rL301239

Reviewers: davide

Subscribers: llvm-commits

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

llvm-svn: 302058

7 years agoDelete dead function causing compilation failure.
Zachary Turner [Wed, 3 May 2017 17:38:49 +0000 (17:38 +0000)]
Delete dead function causing compilation failure.

llvm-svn: 302057

7 years ago[CodeView] Remove unused private field. NFCI.
Davide Italiano [Wed, 3 May 2017 17:37:35 +0000 (17:37 +0000)]
[CodeView] Remove unused private field. NFCI.

llvm-svn: 302056

7 years ago[bpf] add relocation support
Alexei Starovoitov [Wed, 3 May 2017 17:30:56 +0000 (17:30 +0000)]
[bpf] add relocation support

  . there should be no runtime relocation inside the bpf function.
  . relocation supported here mostly for debugging.
  . a test case is added.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 302055

7 years agoRevert "CMake: Move sphinx detection into AddSphinxTarget.cmake"
Tom Stellard [Wed, 3 May 2017 17:22:23 +0000 (17:22 +0000)]
Revert "CMake: Move sphinx detection into AddSphinxTarget.cmake"

This reverts commit r302025.

clang and lld need to be updated too so they don't break with this patch.

llvm-svn: 302054

7 years ago[CodeView] Use actual strings for dealing with checksums and lines.
Zachary Turner [Wed, 3 May 2017 17:11:40 +0000 (17:11 +0000)]
[CodeView] Use actual strings for dealing with checksums and lines.

The raw CodeView format references strings by "offsets", but it's
confusing what table the offset refers to.  In the case of line
number information, it's an offset into a buffer of records,
and an indirection is required to get another offset into a
different table to find the final string.  And in the case of
checksum information, there is no indirection, and the offset
refers directly to the location of the string in another buffer.

This would be less confusing if we always just referred to the
strings by their value, and have the library be smart enough
to correctly resolve the offsets on its own from the right
location.

This patch makes that possible.  When either reading or writing,
all the user deals with are strings, and the library does the
appropriate translations behind the scenes.

llvm-svn: 302053

7 years ago[llvm-readobj] Update readobj to re-use parsing code.
Zachary Turner [Wed, 3 May 2017 17:11:11 +0000 (17:11 +0000)]
[llvm-readobj] Update readobj to re-use parsing code.

llvm-readobj hand rolls some CodeView parsing code for string
tables, so this patch updates it to re-use some of the newly
introduced parsing code in LLVMDebugInfoCodeView.

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

llvm-svn: 302052

7 years agoARM: add extra test for addrmode folding.
Tim Northover [Wed, 3 May 2017 16:54:30 +0000 (16:54 +0000)]
ARM: add extra test for addrmode folding.

I was worried we might replace a mul with a mul+shift even if there were later
uses. Turns out to be unfounded but I'd just as well add an actual test for it.

llvm-svn: 302051

7 years ago[tsan] Detect races on modifying accesses in Swift code
Kuba Mracek [Wed, 3 May 2017 16:51:01 +0000 (16:51 +0000)]
[tsan] Detect races on modifying accesses in Swift code

This patch allows the Swift compiler to emit calls to `__tsan_external_write` before starting any modifying access, which will cause TSan to detect races on arrays, dictionaries and other classes defined in non-instrumented modules. Races on collections from the Swift standard library and user-defined structs and a frequent cause of subtle bugs and it's important that TSan detects those on top of existing LLVM IR instrumentation, which already detects races in direct memory accesses.

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

llvm-svn: 302050

7 years ago[X86][LWP] Add stack folding mappings and tests for LWPINS/LWPVAL instructions
Simon Pilgrim [Wed, 3 May 2017 16:46:30 +0000 (16:46 +0000)]
[X86][LWP] Add stack folding mappings and tests for LWPINS/LWPVAL instructions

llvm-svn: 302049

7 years agoSilence a 'enum and non-enum used in conditional' warning.
Simon Pilgrim [Wed, 3 May 2017 16:43:57 +0000 (16:43 +0000)]
Silence a 'enum and non-enum used in conditional' warning.

llvm-svn: 302048

7 years ago[DAGCombine] (addcarry (add|uaddo X, Y), 0, Carry) -> (addcarry X, Y, Carry)
Amaury Sechet [Wed, 3 May 2017 16:28:10 +0000 (16:28 +0000)]
[DAGCombine] (addcarry (add|uaddo X, Y), 0, Carry) -> (addcarry X, Y, Carry)

Summary: Do the transform when the carry isn't used. It's a pattern exposed when legalizing large integers.

Reviewers: jyknight, nemanjai, mkuper, spatel, RKSimon, zvi, bkramer

Subscribers: llvm-commits

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

llvm-svn: 302047

7 years agoRevert r302037
Alex Lorenz [Wed, 3 May 2017 16:22:16 +0000 (16:22 +0000)]
Revert r302037

The commit caused the following two buildbot failures:

    Clang :: Misc/error-limit-multiple-notes.cpp
    Clang :: Misc/error-limit.c

llvm-svn: 302046

7 years agoRevert my bad winasan coverage test fix and apply one that actually works
Reid Kleckner [Wed, 3 May 2017 16:11:01 +0000 (16:11 +0000)]
Revert my bad winasan coverage test fix and apply one that actually works

trace-pc doesn't work, but trace-pc-guard does. *shrug*

llvm-svn: 302045

7 years agoCreate DWARFVerifier.cpp and .h and move all DWARF verification code over into it.
Greg Clayton [Wed, 3 May 2017 16:02:29 +0000 (16:02 +0000)]
Create DWARFVerifier.cpp and .h and move all DWARF verification code over into it.

Adrian requested we create a DWARFVerifier.cpp file to contain all of the DWARF verification stuff. This change simply moves the functionality over into DWARFVerifier.h and DWARFVerifier.cpp, renames the DWARFVerifier methods to start with lower case, and switches DWARFContext.cpp over to using the new functionality.

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

llvm-svn: 302044

7 years agoSpeculative fix for WinASan after r301994
Reid Kleckner [Wed, 3 May 2017 15:59:07 +0000 (15:59 +0000)]
Speculative fix for WinASan after r301994

llvm-svn: 302043

7 years agoResubmit r301986 and r301987 "Add codeview::StringTable"
Zachary Turner [Wed, 3 May 2017 15:58:37 +0000 (15:58 +0000)]
Resubmit r301986 and r301987 "Add codeview::StringTable"

This was reverted due to a "missing" file, but in reality
what happened was that I renamed a file, and then due to
a merge conflict both the old file and the new file got
added to the repository.  This led to an unused cpp file
being in the repo and not referenced by any CMakeLists.txt
but #including a .h file that wasn't in the repo.  In an
even more unfortunate coincidence, CMake didn't report the
unused cpp file because it was in a subdirectory of the
folder with the CMakeLists.txt, and not in the same directory
as any CMakeLists.txt.

The presence of the unused file was then breaking certain
tools that determine file lists by globbing rather than
by what's specified in CMakeLists.txt

In any case, the fix is to just remove the unused file from
the patch set.

llvm-svn: 302042

7 years ago[X86][LWP] Add llvm support for LWP instructions (reapplied).
Simon Pilgrim [Wed, 3 May 2017 15:51:39 +0000 (15:51 +0000)]
[X86][LWP] Add llvm support for LWP instructions (reapplied).

This patch adds support for the the LightWeight Profiling (LWP) instructions which are available on all AMD Bulldozer class CPUs (bdver1 to bdver4).

Reapplied - this time without changing line endings of existing files.

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

llvm-svn: 302041

7 years ago[APInt] Give the value union a name so we can remove assumptions on VAL being the...
Craig Topper [Wed, 3 May 2017 15:46:24 +0000 (15:46 +0000)]
[APInt] Give the value union a name so we can remove assumptions on VAL being the larger member

Currently several places assume the VAL member is always at least the same size as pVal. In particular for a memcpy in the move assignment operator. While this is a true assumption, it isn't good practice to assume this.

This patch gives the union a name so we can write the memcpy in terms of the union itself. This also adds a similar memcpy to the move constructor where we previously just copied using VAL directly.

This patch is mostly just a mechanical addition of the U in front of VAL and pVAL everywhere. But several constructors had to be modified since we can't directly initializer a field of named union from the initializer list.

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

llvm-svn: 302040

7 years agoVerify that no compile units share the same line table in "llvm-dwarfdump --verify"
Greg Clayton [Wed, 3 May 2017 15:45:31 +0000 (15:45 +0000)]
Verify that no compile units share the same line table in "llvm-dwarfdump --verify"

Check to make sure no compile units have the same DW_AT_stmt_list values. Report a verification error if they do.

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

llvm-svn: 302039

7 years agoRevert rL302028 due to accidental line ending changes.
Simon Pilgrim [Wed, 3 May 2017 15:42:29 +0000 (15:42 +0000)]
Revert rL302028 due to accidental line ending changes.

llvm-svn: 302038

7 years agoDiagnosticsEngine should clear DelayedDiagID before reporting the
Alex Lorenz [Wed, 3 May 2017 15:41:16 +0000 (15:41 +0000)]
DiagnosticsEngine should clear DelayedDiagID before reporting the
delayed diagnostic

This avoids an infinite loop that was uncovered in one of our internal tests
by r301992. The testcase is the most reduced version of that auto-generated
test.

rdar://31962618

llvm-svn: 302037

7 years ago[Hexagon] Handle S2_storerf_io in HexagonInstrInfo
Krzysztof Parzyszek [Wed, 3 May 2017 15:36:51 +0000 (15:36 +0000)]
[Hexagon] Handle S2_storerf_io in HexagonInstrInfo

llvm-svn: 302036

7 years ago[Hexagon] Misc fixes in HexagonInstrInfo, NFC
Krzysztof Parzyszek [Wed, 3 May 2017 15:34:52 +0000 (15:34 +0000)]
[Hexagon] Misc fixes in HexagonInstrInfo, NFC

Formatting changes + remove unused function.

llvm-svn: 302035

7 years ago[Hexagon] Adjust latency between allocframe and the first store on stack
Krzysztof Parzyszek [Wed, 3 May 2017 15:33:09 +0000 (15:33 +0000)]
[Hexagon] Adjust latency between allocframe and the first store on stack

Allocframe and the following stores on the stack have a latency of 2 cycles
when not in the same packet. This happens because R29 is needed early by the
store instruction. Since one of such stores can be packetized along with
allocframe and use old value of R29, we can assign it 0 cycle latency
while leaving latency of other stores to the default value of 2 cycles.

Patch by Jyotsna Verma.

llvm-svn: 302034

7 years ago[Hexagon] Handle J2_jumptpt and J2_jumpfpt in HexagonInstrInfo
Krzysztof Parzyszek [Wed, 3 May 2017 15:30:46 +0000 (15:30 +0000)]
[Hexagon] Handle J2_jumptpt and J2_jumpfpt in HexagonInstrInfo

llvm-svn: 302033

7 years ago[Hexagon] Implement undoing .cur instructions in packetizer
Krzysztof Parzyszek [Wed, 3 May 2017 15:28:56 +0000 (15:28 +0000)]
[Hexagon] Implement undoing .cur instructions in packetizer

The packetizer needs to convert .cur instruction to its regular form if
the use is not in the same packet as the .cur. The code in the packetizer
handles one type of .cur, which is the vector load case. This patch
updates the packetizer so that it can undo all the .cur instructions.
In the test case, the .cur is the 128B version, but there are also the
post-increment versions.

Patch by Brendon Cahoon.

llvm-svn: 302032

7 years ago[OpenMP] Extended parse for 'always' map modifier
Carlo Bertolli [Wed, 3 May 2017 15:28:48 +0000 (15:28 +0000)]
[OpenMP] Extended parse for 'always' map modifier

https://reviews.llvm.org/D32807

This patch allows the map modifier 'always' to be separated by the map type (to, from, tofrom) only by a whitespace, rather than strictly by a comma as in current trunk.

llvm-svn: 302031

7 years ago[Hexagon] Add memory operands to a rewritten load
Krzysztof Parzyszek [Wed, 3 May 2017 15:26:13 +0000 (15:26 +0000)]
[Hexagon] Add memory operands to a rewritten load

llvm-svn: 302030

7 years ago[Hexagon] Reset spill alignment when variable-sized objects are present
Krzysztof Parzyszek [Wed, 3 May 2017 15:23:53 +0000 (15:23 +0000)]
[Hexagon] Reset spill alignment when variable-sized objects are present

llvm-svn: 302029

7 years ago[X86][LWP] Add llvm support for LWP instructions.
Simon Pilgrim [Wed, 3 May 2017 15:18:34 +0000 (15:18 +0000)]
[X86][LWP] Add llvm support for LWP instructions.

This patch adds support for the the LightWeight Profiling (LWP) instructions which are available on all AMD Bulldozer class CPUs (bdver1 to bdver4).

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

llvm-svn: 302028

7 years agoDon't attempt to use mpx registers on unsupported platforms
Francis Ricci [Wed, 3 May 2017 15:00:04 +0000 (15:00 +0000)]
Don't attempt to use mpx registers on unsupported platforms

Summary:
The existing cpp-level checks using PR_MPX_ENABLE_MANAGEMENT aren't sufficient,
as this isn't defined for linux kernel versions below 3.19.

Reviewers: valentinagiusti, zturner, labath

Subscribers: lldb-commits

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

llvm-svn: 302027

7 years agoCMake: Add LLVM_DYLIB_SYMBOL_VERSIONING option
Tom Stellard [Wed, 3 May 2017 14:43:44 +0000 (14:43 +0000)]
CMake: Add LLVM_DYLIB_SYMBOL_VERSIONING option

Summary:
When apps or other libraries link against a library with symbol
versions, the version string is recorded in the import table, and used
at runtime to resolve the symbol back to a library that provides that
version (vaguely like how two-level namespaces work in Mach-O).  ld's
--default-symver flag tags every exported symbol with a symbol version
string equal to the library's soname.  Using --default-symver means
multiple versions of libLLVM can coexist within the same process, at
least to the extent that they don't try to pass data between each
other's llvms.

As an example, imagine a language like Rust using llvm for CPU codegen,
binding to OpenGL, with Mesa as the OpenGL implementation using llvm for
R600 codegen.  With --default-symver Rust and Mesa will resolve their
llvm usage to the version each was linked against, which need not match.

(Other ELF platforms like BSD and Solaris might have similar semantics,
I've not checked.)

This is based on an autoconf version of this patch by Adam Jackson.

This new option can be used to add --default-symver to the linker flags
for libLLVM.so.

Reviewers: beanz

Reviewed By: beanz

Subscribers: mgorny, llvm-commits

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

llvm-svn: 302026

7 years agoCMake: Move sphinx detection into AddSphinxTarget.cmake
Tom Stellard [Wed, 3 May 2017 14:29:56 +0000 (14:29 +0000)]
CMake: Move sphinx detection into AddSphinxTarget.cmake

Reviewers: chandlerc, beanz, mgorny

Reviewed By: beanz

Subscribers: llvm-commits

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

llvm-svn: 302025

7 years agoReusing an existing attribute diagnostic
Oren Ben Simhon [Wed, 3 May 2017 14:05:00 +0000 (14:05 +0000)]
Reusing an existing attribute diagnostic

In a previous patch, a new generic error diagnostic for inconsistent attributes was added.
In this commit I reuse this diagnostic for ns_returns_retained attribute check.

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

llvm-svn: 302024

7 years ago[X86][AVX512] remove unnecessary case. NFC
Guy Blank [Wed, 3 May 2017 13:34:05 +0000 (13:34 +0000)]
[X86][AVX512] remove unnecessary case. NFC

VFPCLASS is for vector types and not scalar, so it cannot get here.

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

llvm-svn: 302023

7 years ago[SystemZ] Properly check number of operands in getCmpOpsType()
Jonas Paulsson [Wed, 3 May 2017 13:33:45 +0000 (13:33 +0000)]
[SystemZ]  Properly check number of operands in getCmpOpsType()

It is needed to check that the number of operands are 2 when
finding the case of a logic combination, e.g. 'and' of two compares.

Review: Ulrich Weigand
llvm-svn: 302022