platform/upstream/llvm.git
6 years agonative_exp2: Switch implementation to llvm intrinsic
Jan Vesely [Fri, 10 Nov 2017 22:16:31 +0000 (22:16 +0000)]
native_exp2: Switch implementation to llvm intrinsic

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 317937

6 years agonative_exp: Switch implementation to llvm intrinsic
Jan Vesely [Fri, 10 Nov 2017 22:16:28 +0000 (22:16 +0000)]
native_exp: Switch implementation to llvm intrinsic

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 317936

6 years agoamdgpu: Add workaround for unimplemented llvm.exp intrinsic
Jan Vesely [Fri, 10 Nov 2017 22:16:25 +0000 (22:16 +0000)]
amdgpu: Add workaround for unimplemented llvm.exp intrinsic

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 317935

6 years agonative_log10: Switch to generic native intrinsic inc file
Jan Vesely [Fri, 10 Nov 2017 22:16:22 +0000 (22:16 +0000)]
native_log10: Switch to generic native intrinsic inc file

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 317934

6 years agonative_log: Switch to generic native intrinsic inc file
Jan Vesely [Fri, 10 Nov 2017 22:16:20 +0000 (22:16 +0000)]
native_log: Switch to generic native intrinsic inc file

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 317933

6 years agonative_log2: Switch to generic native intrinsic inc file
Jan Vesely [Fri, 10 Nov 2017 22:16:15 +0000 (22:16 +0000)]
native_log2: Switch to generic native intrinsic inc file

v2: Add __CLC_XCONCAT instead of function name redirection
    Use __CLC_XCONCAT for intrinsic functions as well

Reviewer: Jeroen Ketema
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 317932

6 years agoFix for skipped CMake configuration on debuginfo-tests.
Zachary Turner [Fri, 10 Nov 2017 22:12:04 +0000 (22:12 +0000)]
Fix for skipped CMake configuration on debuginfo-tests.

This should have been part of the change to debuginfo-tests, but
it was left out.  This should get the buildbots green.

llvm-svn: 317931

6 years agosanitizer_common: Try looking up symbols with RTLD_DEFAULT if RTLD_NEXT does not...
Peter Collingbourne [Fri, 10 Nov 2017 22:09:37 +0000 (22:09 +0000)]
sanitizer_common: Try looking up symbols with RTLD_DEFAULT if RTLD_NEXT does not work.

If the lookup using RTLD_NEXT failed, the sanitizer runtime library
is later in the library search order than the DSO that we are trying
to intercept, which means that we cannot intercept this function. We
still want the address of the real definition, though, so look it up
using RTLD_DEFAULT.

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

llvm-svn: 317930

6 years ago[compiler-rt] Fix const and volatile qualifier warnings
Kuba Mracek [Fri, 10 Nov 2017 21:19:20 +0000 (21:19 +0000)]
[compiler-rt] Fix const and volatile qualifier warnings

Building with a new clang produces a bunch of warnings about dropped 'const' and 'volatile' qualifiers on pointers. Let's fix them.

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

llvm-svn: 317929

6 years ago[OMPT] Fix assertion for OpenMP code generated with outdated compilers
Joachim Protze [Fri, 10 Nov 2017 21:07:01 +0000 (21:07 +0000)]
[OMPT] Fix assertion for OpenMP code generated with outdated compilers

For up-to-date compilers, this assertion is reasonable, but it breaks
compatibility with the typical compiler installed on most systems.
This patch changes the default value to what we had when there was no
compiler support. A warning about the outdated compiler is printed during
runtime, when this point is reached.

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

llvm-svn: 317928

6 years ago[cfi-verify] Made FileAnalysis operate on a GraphResult rather than build one and...
Mitch Phillips [Fri, 10 Nov 2017 21:00:22 +0000 (21:00 +0000)]
[cfi-verify] Made FileAnalysis operate on a GraphResult rather than build one and validate it.

Refactors the behaviour of building graphs out of FileAnalysis, allowing for analysis of the GraphResult by the callee without having to rebuild the graph. Means when we want to analyse the constructed graph (planned for later revisions), we don't do repeated work.

Also makes CFI verification in FileAnalysis now return an enum that allows us to differentiate why something failed, not just that it did/didn't fail.

Reviewers: vlad.tsyrklevich

Subscribers: kcc, pcc, llvm-commits

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

llvm-svn: 317927

6 years ago[DAGcombine] Do not replace truncate node by itself when doing constant folding,...
Amaury Sechet [Fri, 10 Nov 2017 20:59:53 +0000 (20:59 +0000)]
[DAGcombine] Do not replace truncate node by itself when doing constant folding, this trigger needless extra rounds of combine for nothing. NFC

llvm-svn: 317926

6 years ago[debuginfo-tests] Make debuginfo-tests work in a standard configuration.
Zachary Turner [Fri, 10 Nov 2017 20:57:57 +0000 (20:57 +0000)]
[debuginfo-tests] Make debuginfo-tests work in a standard configuration.

Previously, debuginfo-tests was expected to be checked out into
clang/test and then the tests would automatically run as part of
check-clang.  This is not a standard workflow for handling
external projects, and it brings with it some serious drawbacks
such as the inability to depend on things other than clang, which
we will need going forward.

The goal of this patch is to migrate towards a more standard
workflow.  To ease the transition for build bot maintainers,
this patch tries not to break the existing workflow, but instead
simply deprecate it to give maintainers a chance to update
the build infrastructure.

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

llvm-svn: 317925

6 years ago[AMDGPU] AMDGPUUsage.rst minor corrections
Tony Tye [Fri, 10 Nov 2017 20:51:43 +0000 (20:51 +0000)]
[AMDGPU] AMDGPUUsage.rst minor corrections

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

llvm-svn: 317924

6 years ago[SimplifyCFG] Use auto * when the type is obvious. NFCI.
Davide Italiano [Fri, 10 Nov 2017 20:46:21 +0000 (20:46 +0000)]
[SimplifyCFG] Use auto * when the type is obvious. NFCI.

llvm-svn: 317923

6 years ago[polly] Remove redundant return [NFC]
Mandeep Singh Grang [Fri, 10 Nov 2017 20:33:08 +0000 (20:33 +0000)]
[polly] Remove redundant return [NFC]

Reviewers: grosser, bollu

Reviewed By: grosser

Subscribers: nemanjai, kbarton, llvm-commits

Tags: #polly

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

llvm-svn: 317922

6 years agoRecommit r317904: [Hexagon] Create HexagonISelDAGToDAG.h, NFC
Krzysztof Parzyszek [Fri, 10 Nov 2017 20:09:46 +0000 (20:09 +0000)]
Recommit r317904: [Hexagon] Create HexagonISelDAGToDAG.h, NFC

The Windows builder did not reconstruct the HexagonGenDAGISel.inc file
after the TableGen binary has changed.

llvm-svn: 317921

6 years agoAMDGPU/NFC: Split Processors.td into GCNProcessors.td and R600Processors.td
Konstantin Zhuravlyov [Fri, 10 Nov 2017 20:01:58 +0000 (20:01 +0000)]
AMDGPU/NFC: Split Processors.td into GCNProcessors.td and R600Processors.td

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

llvm-svn: 317920

6 years ago[lldb] Remove unused method declaration
Alexander Shaposhnikov [Fri, 10 Nov 2017 19:40:53 +0000 (19:40 +0000)]
[lldb] Remove unused method declaration

FindCompleteObjCDefinitionType is not used anywhere and there is no implementation of it, only a declaration.

Test plan: make check-lldb

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

llvm-svn: 317919

6 years agoExpand IRBuilder interface for atomic memcpy to require pointer alignments. (NFC)
Daniel Neilson [Fri, 10 Nov 2017 19:38:12 +0000 (19:38 +0000)]
Expand IRBuilder interface for atomic memcpy to require pointer alignments. (NFC)

Summary:
 The specification of the @llvm.memcpy.element.unordered.atomic intrinsic requires
that the pointer arguments have alignments of at least the element size. The existing
IRBuilder interface to create a call to this intrinsic does not allow for providing
the alignment of these pointer args. Having an interface that makes it easy to
construct invalid intrinsic calls doesn't seem sensible, so this patch simply
adds the requirement that one provide the argument alignments when using IRBuilder
to create atomic memcpy calls.

llvm-svn: 317918

6 years agoAMDGPU: Add -mxnack/-mno-xnack options that set +/-xnack feature
Konstantin Zhuravlyov [Fri, 10 Nov 2017 19:28:25 +0000 (19:28 +0000)]
AMDGPU: Add -mxnack/-mno-xnack options that set +/-xnack feature

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

llvm-svn: 317917

6 years agoRevert "[Hexagon] Create HexagonISelDAGToDAG.h, NFC"
Krzysztof Parzyszek [Fri, 10 Nov 2017 19:27:18 +0000 (19:27 +0000)]
Revert "[Hexagon] Create HexagonISelDAGToDAG.h, NFC"

This reverts r317904: broke Windows build.

llvm-svn: 317916

6 years ago[X86] Merge the template method selectAddrOfGatherScatterNode into selectVectorAddr...
Craig Topper [Fri, 10 Nov 2017 19:26:04 +0000 (19:26 +0000)]
[X86] Merge the template method selectAddrOfGatherScatterNode into selectVectorAddr. NFCI

Just need to initialize a couple variables differently based on the node type. No need for a whole separate template method.

llvm-svn: 317915

6 years ago[tsan] Move code of sigaction_impl and signal_impl
Vitaly Buka [Fri, 10 Nov 2017 19:23:02 +0000 (19:23 +0000)]
[tsan] Move code of sigaction_impl and signal_impl

They need to be after sanitizer_signal_interceptors.inc to use READ function

Part of https://github.com/google/sanitizers/issues/637

llvm-svn: 317914

6 years ago[tsan] Extract sigaction_impl and signal_impl
Vitaly Buka [Fri, 10 Nov 2017 19:22:51 +0000 (19:22 +0000)]
[tsan] Extract sigaction_impl and signal_impl

Preparation for switching to sanitizer_signal_interceptors.inc

Part of https://github.com/google/sanitizers/issues/637

llvm-svn: 317913

6 years agoAdd back target triple to test which I accidentally removed.
Adrian Prantl [Fri, 10 Nov 2017 19:22:02 +0000 (19:22 +0000)]
Add back target triple to test which I accidentally removed.

llvm-svn: 317912

6 years ago[CVP] Remove some {s|u}add.with.overflow checks.
Sanjoy Das [Fri, 10 Nov 2017 19:13:35 +0000 (19:13 +0000)]
[CVP] Remove some {s|u}add.with.overflow checks.

Summary:
This adds logic to CVP to remove some overflow checks.  It uses LVI to remove
operations with at least one constant.  Specifically, this can remove many
overflow intrinsics immediately following an overflow check in the source code,
such as:

if (x < INT_MAX)
    ... x + 1 ...

Patch by Joel Galenson!

Reviewers: sanjoy, regehr

Reviewed By: sanjoy

Subscribers: fhahn, pirama, srhines, llvm-commits

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

llvm-svn: 317911

6 years agoUse DenseMap instead of std::map in fixupExports
Reid Kleckner [Fri, 10 Nov 2017 19:12:01 +0000 (19:12 +0000)]
Use DenseMap instead of std::map in fixupExports

Some DLLs have many exports, and this data structure shows up in the
profile of linking content.dll.

llvm-svn: 317910

6 years agoAMDGPU/NFC: Move getAMDGPUTargetFeatures to AMDGPU toolchain
Konstantin Zhuravlyov [Fri, 10 Nov 2017 19:09:57 +0000 (19:09 +0000)]
AMDGPU/NFC: Move getAMDGPUTargetFeatures to AMDGPU toolchain

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

llvm-svn: 317909

6 years ago[RISCV] Silence an unused variable warning in release builds [NFC]
Mandeep Singh Grang [Fri, 10 Nov 2017 19:09:28 +0000 (19:09 +0000)]
[RISCV] Silence an unused variable warning in release builds [NFC]

Summary:
Also minor cleanups:
1. Avoided multiple calls to Fixup.getKind()
2. Avoided multiple calls to getFixupKindInfo()
3. Removed a redundant return.

Reviewers: asb, apazos

Reviewed By: asb

Subscribers: rbar, johnrusso, llvm-commits

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

llvm-svn: 317908

6 years ago[scudo] Bump the Android API level requirement to 21 for getauxval
Kostya Kortchinsky [Fri, 10 Nov 2017 19:01:17 +0000 (19:01 +0000)]
[scudo] Bump the Android API level requirement to 21 for getauxval

Summary:
`getauxval` was introduced in 18 & 21 depending on the architecture. Bump the
requirement to 21.

It also turns out that the NDK is finicky: NDK r13b doesn't include sys/auxv.h
when creating a standalone toolchain at API level 19 for ARM. So 18 didn't work
well with older NDKs.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: aemerson, srhines, llvm-commits, kristof.beyls

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

llvm-svn: 317907

6 years ago[msan] Remove INTERCEPT_FUNCTION for sigaction and signal
Vitaly Buka [Fri, 10 Nov 2017 18:58:59 +0000 (18:58 +0000)]
[msan] Remove INTERCEPT_FUNCTION for sigaction and signal

Already done in InitializeSignalInterceptors()

llvm-svn: 317906

6 years ago[X86] Add test case to demonstrate failure to fold the address computation of a simpl...
Craig Topper [Fri, 10 Nov 2017 18:48:18 +0000 (18:48 +0000)]
[X86] Add test case to demonstrate failure to fold the address computation of a simple gather from a global array. NFC

llvm-svn: 317905

6 years ago[Hexagon] Create HexagonISelDAGToDAG.h, NFC
Krzysztof Parzyszek [Fri, 10 Nov 2017 18:39:45 +0000 (18:39 +0000)]
[Hexagon] Create HexagonISelDAGToDAG.h, NFC

llvm-svn: 317904

6 years agoAllow separation of declarations and definitions in <Target>ISelDAGToDAG.inc
Krzysztof Parzyszek [Fri, 10 Nov 2017 18:36:04 +0000 (18:36 +0000)]
Allow separation of declarations and definitions in <Target>ISelDAGToDAG.inc

This patch adds the ability to include the member function declarations
in the instruction selector class separately from the member bodies.

Defining GET_DAGISEL_DECL macro to any value will only include the member
declarations. To include bodies, define GET_DAGISEL_BODY macro to be the
selector class name. Example:

  class FooDAGToDAGISel : public SelectionDAGISel {
    // Pull in declarations only.
    #define GET_DAGISEL_DECL
    #include "FooISelDAGToDAG.inc"
  };

  // Include the function bodies (with names qualified with the provided
  // class name).
  #define GET_DAGISEL_BODY FooDAGToDAGISel
  #include "FooISelDAGToDAG.inc"

When neither of the two macros are defined, the function bodies are emitted
inline (in the same way as before this patch).

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

llvm-svn: 317903

6 years ago[ADT] Rewrite mapped_iterator in terms of iterator_adaptor_base.
Lang Hames [Fri, 10 Nov 2017 17:41:28 +0000 (17:41 +0000)]
[ADT] Rewrite mapped_iterator in terms of iterator_adaptor_base.

Summary:
This eliminates the boilerplate implementation of the iterator interface in
mapped_iterator.

This patch also adds unit tests that verify that the mapped function is applied
by operator* and operator->, and that references returned by the map function
are returned via operator*.

Reviewers: dblaikie, chandlerc

Subscribers: llvm-commits, mgorny

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

llvm-svn: 317902

6 years ago[clang-format] Handle leading comments in using declaration
Daniel Jasper [Fri, 10 Nov 2017 17:11:18 +0000 (17:11 +0000)]
[clang-format] Handle leading comments in using declaration

This fixes clang-format internal assertion for the following code:

  /* override */ using std::string;

Patch by Igor Sugak. Thank you.

llvm-svn: 317901

6 years ago[X86] Add a def file to CPU vendor, type, and subtype encodings used by Host.cpp
Craig Topper [Fri, 10 Nov 2017 17:10:57 +0000 (17:10 +0000)]
[X86] Add a def file to CPU vendor, type, and subtype encodings used by Host.cpp

Summary:
I want to leverage this to clean up some of the code in clang. This will allow us to simplify D39521 which was trying to do some of the same.

If we accurately keep the code in Host.cpp synced with new CPUs added to compile-rt/libgcc we should be able to use this file as a proxy for what's implemented in the libraries.

The entries for the CPUs recognized by the libraries use separate macros that define additional parameters like the name for __builtin_cpu_is and an alias string for the couple cases where __builtin_cpu_is accepts two different names.

All of the macros contain an ARCHNAME that is usually the same as the __builtin_cpu_is string, but sometimes isn't. This represents the name recognized by X86.td and -march.

I'm following the precedent set by ARM and AArch64 and adding this information to lib/Support/TargetParser.cpp

Reviewers: erichkeane, echristo, asbirlea

Reviewed By: echristo

Subscribers: llvm-commits, aemerson, kristof.beyls

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

llvm-svn: 317900

6 years agoLTO: don't fatal when value for cache key already exists
Bob Haarman [Fri, 10 Nov 2017 17:08:21 +0000 (17:08 +0000)]
LTO: don't fatal when value for cache key already exists

Summary:
LTO/Caching.cpp uses file rename to atomically set the value for a
cache key. On Windows, this fails when the destination file already
exists. Previously, LLVM would report_fatal_error in such
cases. However, because the old and the new value for the cache key
are supposed to be equivalent, it actually doesn't matter which one we
keep. This change makes it so that failing the rename when an openable
file with the desired name already exists causes us to report success
instead of fataling.

Reviewers: pcc, hans

Subscribers: mehdi_amini, llvm-commits, hiraditya

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

llvm-svn: 317899

6 years ago[NFC] Pacify bbot for OpenMP 'teams distribute parallel for'
Carlo Bertolli [Fri, 10 Nov 2017 16:49:09 +0000 (16:49 +0000)]
[NFC] Pacify bbot for OpenMP 'teams distribute parallel for'

llvm-svn: 317898

6 years ago[python] [tests] Rewrite to use standard unittest module
Michal Gorny [Fri, 10 Nov 2017 16:44:12 +0000 (16:44 +0000)]
[python] [tests] Rewrite to use standard unittest module

Rewrite the tests from using plain 'assert' mixed with some nosetests
methods to the standard unittest module layout. Improve the code
to use the most canonical assertion methods whenever possible.

This has a few major advantages:

- the code uses standard methods now, resulting in a reduced number
of WTFs whenever someone with basic Python knowledge gets to read it,

- completely unnecessary dependency on nosetests is removed since
the standard library supplies all that is necessary for the tests
to run,

- the tests can be run via any test runner, including the one built-in
in Python,

- the failure output for most of the tests is improved from 'assertion
x == y failed' to actually telling the values.

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

llvm-svn: 317897

6 years agoMove test into X86 subdirectory.
Adrian Prantl [Fri, 10 Nov 2017 16:36:04 +0000 (16:36 +0000)]
Move test into X86 subdirectory.

llvm-svn: 317896

6 years ago[WebAssembly] Fix stack offsets of return values from call lowering.
Jatin Bhateja [Fri, 10 Nov 2017 16:26:04 +0000 (16:26 +0000)]
[WebAssembly] Fix stack offsets of return values from call lowering.

Summary: Fixes PR35220

Reviewers: vadimcn, alexcrichton

Reviewed By: alexcrichton

Subscribers: pepyakin, alexcrichton, jfb, dschuff, sbc100, jgravelle-google, llvm-commits, aheejin

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

llvm-svn: 317895

6 years ago[AArch64][SVE] Asm: More concise test format
Florian Hahn [Fri, 10 Nov 2017 16:25:16 +0000 (16:25 +0000)]
[AArch64][SVE] Asm: More concise test format

Change the test format for SVE assembler/disassembler tests to be less verbose and have both tests in the same file.

The tests check the following:

 * All instructions are assembled correctly into the right encoding.
 * All instructions are disassembled correctly (into the preferred assembly format)
 * Without -mattr=+sve the instructions are not assembled.
 * Without -mattr=+sve the instructions are not disassembled.

This patch also adds several negative tests for SVE add/sub.

Patch by Sander De Smalen.

Reviewed by: rengolin, fhahn

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

llvm-svn: 317894

6 years ago[OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for'
Carlo Bertolli [Fri, 10 Nov 2017 16:05:00 +0000 (16:05 +0000)]
[OpenMP] Parse+Sema for copyin clause of 'teams distribute parallel for'

https://reviews.llvm.org/D39902

Simply leverage existing implementation and verify correct functioning with two regression tests.

llvm-svn: 317893

6 years ago[X86] Add scheduling tests for DAA/DAS
Simon Pilgrim [Fri, 10 Nov 2017 15:49:41 +0000 (15:49 +0000)]
[X86] Add scheduling tests for DAA/DAS

llvm-svn: 317892

6 years ago[OpenMP] diagnose assign to firstprivate const, patch by Joel E. Denny
Alexey Bataev [Fri, 10 Nov 2017 15:39:50 +0000 (15:39 +0000)]
[OpenMP] diagnose assign to firstprivate const, patch by Joel E. Denny

Summary:
[OpenMP] diagnose assign to firstprivate const

Clang does not diagnose assignments to const variables declared
firstprivate.  Furthermore, codegen is broken such that, at run time,
such assignments simply have no effect.  For example, the following
prints 0 not 1:

int main() {
  const int i = 0;
  #pragma omp parallel firstprivate(i)
  { i=1; printf("%d\n", i); }
  return 0;
}

This commit makes these assignments a compile error, which is
consistent with other OpenMP compilers I've tried (pgcc 17.4-0, gcc
6.3.0).

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: cfe-commits

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

llvm-svn: 317891

6 years ago[OMPT] Purge OMPT_BLAME and OMPT_TRACE
Jonas Hahnfeld [Fri, 10 Nov 2017 15:17:57 +0000 (15:17 +0000)]
[OMPT] Purge OMPT_BLAME and OMPT_TRACE

This was replace by OMPT_OPTIONAL.

llvm-svn: 317890

6 years ago[llvm-opt-fuzzer] Add missed library dependence. Fir for rL317883
Igor Laevsky [Fri, 10 Nov 2017 15:08:14 +0000 (15:08 +0000)]
[llvm-opt-fuzzer] Add missed library dependence. Fir for rL317883

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

llvm-svn: 317889

6 years ago[X86] Test non-i64 shld/shll tests on x86_64 targets as well as i686
Simon Pilgrim [Fri, 10 Nov 2017 13:43:04 +0000 (13:43 +0000)]
[X86] Test non-i64 shld/shll tests on x86_64 targets as well as i686

llvm-svn: 317888

6 years ago[llvm-opt-fuzzer] Fix unused variable warning after rL317883
Igor Laevsky [Fri, 10 Nov 2017 13:19:14 +0000 (13:19 +0000)]
[llvm-opt-fuzzer] Fix unused variable warning after rL317883

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

llvm-svn: 317887

6 years ago[clang-format] Support python-style comments in text protos
Krasimir Georgiev [Fri, 10 Nov 2017 12:50:09 +0000 (12:50 +0000)]
[clang-format] Support python-style comments in text protos

Summary: This patch adds support for python-style comments in text protos.

Reviewers: djasper

Reviewed By: djasper

Subscribers: bkramer, cfe-commits, klimek

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

llvm-svn: 317886

6 years ago[X86] Add scheduling tests
Simon Pilgrim [Fri, 10 Nov 2017 12:32:34 +0000 (12:32 +0000)]
[X86] Add scheduling tests
 - CBW etc sign extensions
 - CLC/CLD/CMC flag modifiers
 - CPUID

llvm-svn: 317885

6 years ago[AMDGPU] Prevent Machine Copy Propagation from replacing live copy with the dead one
Alexander Timofeev [Fri, 10 Nov 2017 12:21:10 +0000 (12:21 +0000)]
[AMDGPU] Prevent Machine Copy Propagation from replacing live copy with the dead one

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

llvm-svn: 317884

6 years ago[llvm-opt-fuzzer] Introduce llvm-opt-fuzzer for fuzzing optimization passes
Igor Laevsky [Fri, 10 Nov 2017 12:19:08 +0000 (12:19 +0000)]
[llvm-opt-fuzzer] Introduce llvm-opt-fuzzer for fuzzing optimization passes

This change adds generic fuzzing tools capable of running libFuzzer tests on
any optimization pass or combination of them.

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

llvm-svn: 317883

6 years ago[X86] Added TODO list for missing generic x86 instruction scheduling tests.
Simon Pilgrim [Fri, 10 Nov 2017 12:04:39 +0000 (12:04 +0000)]
[X86] Added TODO list for missing generic x86 instruction scheduling tests.

Not sure if we want to add the more exotic system instructions (IRET etc.) as well?

llvm-svn: 317882

6 years agoClean up NativeRegisterContext
Pavel Labath [Fri, 10 Nov 2017 11:05:49 +0000 (11:05 +0000)]
Clean up NativeRegisterContext

Summary:
This commit removes the concrete_frame_idx member from
NativeRegisterContext and related functions, which was always set to
zero and never used.

I also change the native thread class to store a NativeRegisterContext
as a unique_ptr (documenting the ownership) and make sure it is always
initialized (most of the code was already blindly dereferencing the
register context pointer, assuming it would always be present -- this
makes its treatment consistent).

Reviewers: eugene, clayborg, krytarowski

Subscribers: aemerson, sdardis, nemanjai, javed.absar, arichardson, kristof.beyls, kbarton, uweigand, alexandreyy, lldb-commits

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

llvm-svn: 317881

6 years ago[RegisterCoalescer] Move debug value after rematerialize trivial def
Karl-Johan Karlsson [Fri, 10 Nov 2017 09:48:40 +0000 (09:48 +0000)]
[RegisterCoalescer] Move debug value after rematerialize trivial def

Summary:
The associated debug value is updated when the virtual source register
of a copy is completely eliminated and replaced with a rematerialize
value in the defed register of the copy. As the debug value now is
associated with another register it also need to be moved, otherwise
the debug value isn't valid.

Reviewers: aprantl

Reviewed By: aprantl

Subscribers: MatzeB, llvm-commits, qcolombet

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

llvm-svn: 317880

6 years ago[RegAlloc, SystemZ] Increase number of LOCRs by passing "hard" regalloc hints.
Jonas Paulsson [Fri, 10 Nov 2017 08:46:26 +0000 (08:46 +0000)]
[RegAlloc, SystemZ] Increase number of LOCRs by passing "hard" regalloc hints.

* The method getRegAllocationHints() is now of bool type instead of void. If
true is returned, regalloc (AllocationOrder) will *only* try to allocate the
hints, as opposed to merely trying them before non-hinted registers.

* TargetRegisterInfo::getRegAllocationHints() is implemented for SystemZ with
an increase in number of LOCRs.

In this case, it is desired to force the hints even though there is a slight
increase in spilling, because if a non-hinted register would be allocated,
the LOCRMux pseudo would have to be expanded with a jump sequence. The LOCR
(Load On Condition) SystemZ instruction must have both operands in either the
low or high part of the 64 bit register.

Reviewers: Quentin Colombet and Ulrich Weigand
https://reviews.llvm.org/D36795

llvm-svn: 317879

6 years ago[X86] Add support for combining FMADDSUB(A, B, FNEG(C))->FMSUBADD(A, B, C)
Craig Topper [Fri, 10 Nov 2017 08:22:37 +0000 (08:22 +0000)]
[X86] Add support for combining FMADDSUB(A, B, FNEG(C))->FMSUBADD(A, B, C)

Support the opposite direction as well. Also add a TODO for not being able to combine FMSUB/FNMADD/FNMSUB with FNEG.

llvm-svn: 317878

6 years agoRevert "[XRay][darwin] Initial XRay in Darwin Support"
Dean Michael Berris [Fri, 10 Nov 2017 07:00:55 +0000 (07:00 +0000)]
Revert "[XRay][darwin] Initial XRay in Darwin Support"

This reverts r317875.

llvm-svn: 317877

6 years ago[X86] Remove GCCBuiltin from intrinsics that are no longer used by clang.
Craig Topper [Fri, 10 Nov 2017 06:07:37 +0000 (06:07 +0000)]
[X86] Remove GCCBuiltin from intrinsics that are no longer used by clang.

I've also added TODOs for intrinsic removal.

llvm-svn: 317876

6 years ago[XRay][darwin] Initial XRay in Darwin Support
Dean Michael Berris [Fri, 10 Nov 2017 05:50:13 +0000 (05:50 +0000)]
[XRay][darwin] Initial XRay in Darwin Support

Summary:
This change implements the changes required in both clang and
compiler-rt to allow building XRay-instrumented binaries in Darwin. For
now we limit this to x86_64. We also start building the XRay runtime
library in compiler-rt for osx.

A caveat to this is that we don't have the tests set up and running
yet, which we'll do in a set of follow-on changes.

This patch uses the monorepo layout for the coordinated change across
multiple projects.

Reviewers: kubamracek

Subscribers: mgorny, cfe-commits, llvm-commits

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

llvm-svn: 317875

6 years ago[esan] Fix compilation of signal handlers
Vitaly Buka [Fri, 10 Nov 2017 05:41:13 +0000 (05:41 +0000)]
[esan] Fix compilation of signal handlers

llvm-svn: 317874

6 years ago[X86] Reduce the number of FMA builtins needed by the frontend by adding negates...
Craig Topper [Fri, 10 Nov 2017 05:20:32 +0000 (05:20 +0000)]
[X86] Reduce the number of FMA builtins needed by the frontend by adding negates to operands of the fmadd and fmaddsub builtins.

The backend should be able to combine the negates to create fmsub, fnmadd, and fnmsub. faddsub converting to fsubadd still needs work I think, but should be very doable.

This matches what we already do for the masked builtins.

This only covers the packed builtins. Scalar builtins will be done after FMA4 is fixed.

llvm-svn: 317873

6 years ago[tsan] Use __sanitizer_siginfo from sanitizer_common
Vitaly Buka [Fri, 10 Nov 2017 04:27:47 +0000 (04:27 +0000)]
[tsan] Use __sanitizer_siginfo from sanitizer_common

llvm-svn: 317872

6 years ago[sanitizer] Remove unused <signal.h> which conflicts with asan declarations
Vitaly Buka [Fri, 10 Nov 2017 04:12:35 +0000 (04:12 +0000)]
[sanitizer] Remove unused <signal.h> which conflicts with asan declarations

llvm-svn: 317871

6 years ago[sanitizer] Forward declaration of __sanitizer_sigaction without signal interceptors
Vitaly Buka [Fri, 10 Nov 2017 04:05:38 +0000 (04:05 +0000)]
[sanitizer] Forward declaration of __sanitizer_sigaction without signal interceptors

llvm-svn: 317870

6 years ago[sanitizer] Remove unneeded forward declaration of real_sigaction
Vitaly Buka [Fri, 10 Nov 2017 04:00:58 +0000 (04:00 +0000)]
[sanitizer] Remove unneeded forward declaration of real_sigaction

llvm-svn: 317869

6 years ago[sanitizer] Remove unneeded forward declarations
Vitaly Buka [Fri, 10 Nov 2017 03:35:26 +0000 (03:35 +0000)]
[sanitizer] Remove unneeded forward declarations

llvm-svn: 317868

6 years ago[sanitizer] Remove unused <signal.h> which conflicts with asan declarations
Vitaly Buka [Fri, 10 Nov 2017 03:18:53 +0000 (03:18 +0000)]
[sanitizer] Remove unused <signal.h> which conflicts with asan declarations

llvm-svn: 317867

6 years ago[sanitizer] Fix "cast from 'const void *' to 'sigaction *'" on Darwin
Vitaly Buka [Fri, 10 Nov 2017 03:13:42 +0000 (03:13 +0000)]
[sanitizer] Fix "cast from 'const void *' to 'sigaction *'" on Darwin

llvm-svn: 317866

6 years ago[sanitizer] Remove references and hide CommonSanitizerReportMutex
Vitaly Buka [Fri, 10 Nov 2017 02:07:11 +0000 (02:07 +0000)]
[sanitizer] Remove references and hide CommonSanitizerReportMutex

llvm-svn: 317865

6 years ago[msan] Deadly signal handler for msan
Vitaly Buka [Fri, 10 Nov 2017 02:06:59 +0000 (02:06 +0000)]
[msan] Deadly signal handler for msan

Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 317864

6 years ago[msan] Move sigaction_impl and signal_impl
Vitaly Buka [Fri, 10 Nov 2017 02:06:50 +0000 (02:06 +0000)]
[msan] Move sigaction_impl and signal_impl

llvm-svn: 317863

6 years ago[AMDGPU] Fix pointer info for lowering load/store for r600 for amdgiz environment
Yaxun Liu [Fri, 10 Nov 2017 02:03:28 +0000 (02:03 +0000)]
[AMDGPU] Fix pointer info for lowering load/store for r600 for amdgiz environment

r600 uses dummy pointer info for lowering load/store. Since dummy pointer info
assumes address space 0, this causes isel failure when temporary load/store SDNodes
are generated for amdgiz environment.

Since the offest is not constant, FixedStack pseudo source value cannot be used
to create the pointer info. This patch creates pointer info using llvm undef value.
At least this provides correct address space so that isel can be done correctly.

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

llvm-svn: 317862

6 years ago[AMDGPU] Fix pointer info for pseudo source for r600
Yaxun Liu [Fri, 10 Nov 2017 01:53:24 +0000 (01:53 +0000)]
[AMDGPU] Fix pointer info for pseudo source for r600

The pointer info for pseudo source for r600 is not correct when
alloca addr space is not 0, which causes invalid SDNode for r600---amdgiz.

This patch fixes that.

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

llvm-svn: 317861

6 years ago[Driver] Make clang/cc conforms to UNIX standard
Steven Wu [Fri, 10 Nov 2017 01:32:47 +0000 (01:32 +0000)]
[Driver] Make clang/cc conforms to UNIX standard

Summary:
This is basically reverting r261774 with a tweak for clang-cl. UNIX
standard states:
When c99 encounters a compilation error that causes an object file not
to be created, it shall write a diagnostic to standard error and
continue to compile other source code operands, but it shall not perform
the link phase and it shall return a non-zero exit status

The same goes for c89 or cc. And they are all alias or shims pointing to
clang on Darwin.

The original commit was intended for CUDA so the error message doesn't
get emit twice for both host and device. It seems that the clang driver
has been changed to model the CUDA dependency differently. Now the
driver behaves the same without this commit.

rdar://problem/32223263

Reviewers: thakis, dexonsmith, tra

Reviewed By: tra

Subscribers: jlebar, cfe-commits

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

llvm-svn: 317860

6 years ago[AMDGPU] Update code object description
Tony Tye [Fri, 10 Nov 2017 01:00:54 +0000 (01:00 +0000)]
[AMDGPU] Update code object description

 - Use ELF header flags to identify processor.
 - Remove isa note record.
 - Add target feature section.
 - Make metadata for NumVGPRs, NumSGPRs and MaxFlatWorkGroupSize required.
 - Add FixedWorkGroupSize to CodeProps metadata.
 - Add ReqdWorkGroupSize* to kernel descriptor and move MaxFlatWorkGroupSize to be adjacent.
 - Move IsXNACKEnabled in the kernel descriptor to be at the end of the unused flags.
 - Remove IsDynamicCallStack from the metadata and kernel descriptor.
 - Remove legacy debugger metadata.
 - Remove old XNACK enabled processor names.

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

llvm-svn: 317855

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Fri, 10 Nov 2017 00:59:22 +0000 (00:59 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 317854

6 years ago[ThinLTO] Fix missing call graph edges for calls with bitcasts.
Volodymyr Sapsai [Fri, 10 Nov 2017 00:47:47 +0000 (00:47 +0000)]
[ThinLTO] Fix missing call graph edges for calls with bitcasts.

This change doesn't fix the root cause of the miscompile PR34966 as the root
cause is in the linker ld64. This change makes call graph more complete
allowing to have better module imports/exports.

rdar://problem/35344706

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: mehdi_amini, inglorion, eraman, llvm-commits, hiraditya

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

llvm-svn: 317853

6 years ago[libFuzzer] trying to make sigusr tests more reliable
Kostya Serebryany [Fri, 10 Nov 2017 00:26:23 +0000 (00:26 +0000)]
[libFuzzer] trying to make sigusr tests more reliable

llvm-svn: 317852

6 years ago[libFuzzer] split a test into two
Kostya Serebryany [Fri, 10 Nov 2017 00:18:13 +0000 (00:18 +0000)]
[libFuzzer] split a test into two

llvm-svn: 317851

6 years ago[support] allocate exact size required for mapping in Support/Windws/Path.inc
Bob Haarman [Fri, 10 Nov 2017 00:17:31 +0000 (00:17 +0000)]
[support] allocate exact size required for mapping in Support/Windws/Path.inc

Summary:
zturner suggested that mapped_file_region::init() on Windows seems to
create mappings that are larger than they need to be: Offset+Size
instead of Size. Indeed, that appears to be the case. I confirmed that
tests pass with mappings of just Size bytes, and fail with Size-1
bytes, suggesting that Size is indeed the correct value.

Reviewers: amccarth, zturner

Reviewed By: zturner

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 317850

6 years ago[analyzer] [NFC] Minor ExprEngineC refactoring
George Karpenkov [Thu, 9 Nov 2017 23:33:37 +0000 (23:33 +0000)]
[analyzer] [NFC] Minor ExprEngineC refactoring

Move a repeated block of code into a function.

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

llvm-svn: 317849

6 years ago[SimplifyCFG] Fix a test case.
Easwaran Raman [Thu, 9 Nov 2017 23:17:52 +0000 (23:17 +0000)]
[SimplifyCFG] Fix a test case.

This was first committed in r317845, but had the order of branch weights
wrong and didn't properly check the output.

llvm-svn: 317848

6 years ago[sanitizer] Remove unneeded "struct"
Vitaly Buka [Thu, 9 Nov 2017 23:06:59 +0000 (23:06 +0000)]
[sanitizer] Remove unneeded "struct"

llvm-svn: 317847

6 years ago[sanitizer] Fix signal interceptors build on Windows
Vitaly Buka [Thu, 9 Nov 2017 23:05:01 +0000 (23:05 +0000)]
[sanitizer] Fix signal interceptors build on Windows

llvm-svn: 317846

6 years agoAdd a wrapper function to set branch weights metadata.
Easwaran Raman [Thu, 9 Nov 2017 22:52:20 +0000 (22:52 +0000)]
Add a wrapper function to set branch weights metadata.

Summary:
This wrapper checks if there is at least one non-zero weight before
setting the metadata.

Reviewers: davidxl

Subscribers: llvm-commits

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

llvm-svn: 317845

6 years ago[msan] Extract signal_impl and sigaction_impl
Vitaly Buka [Thu, 9 Nov 2017 22:52:15 +0000 (22:52 +0000)]
[msan] Extract signal_impl and sigaction_impl

Summary: Preparation for using interceptor from sanitizer_common.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 317844

6 years ago[sanitizer] Allow sanitizers to redefine implementation of signal interceptors
Vitaly Buka [Thu, 9 Nov 2017 22:48:54 +0000 (22:48 +0000)]
[sanitizer] Allow sanitizers to redefine implementation of signal interceptors

Reviewers: eugenis

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 317843

6 years ago[msan] Replace CommonSanitizerReportMutex with ScopedErrorReportLock
Vitaly Buka [Thu, 9 Nov 2017 22:48:45 +0000 (22:48 +0000)]
[msan] Replace CommonSanitizerReportMutex with ScopedErrorReportLock

llvm-svn: 317842

6 years ago[Reassociate] regenerate test checks; NFC
Sanjay Patel [Thu, 9 Nov 2017 22:41:39 +0000 (22:41 +0000)]
[Reassociate] regenerate test checks; NFC

llvm-svn: 317841

6 years ago[libFuzzer] use pkill instead of killall in a test since the bots don't have killall
Kostya Serebryany [Thu, 9 Nov 2017 22:01:06 +0000 (22:01 +0000)]
[libFuzzer] use pkill instead of killall in a test since the bots don't have killall

llvm-svn: 317840

6 years ago[analyzer] do not crash when trying to convert an APSInt to an unexpected type
George Karpenkov [Thu, 9 Nov 2017 21:49:38 +0000 (21:49 +0000)]
[analyzer] do not crash when trying to convert an APSInt to an unexpected type

This is the issue breaking the postgresql bot, purely by chance exposed
through taint checker, somehow appearing after
https://reviews.llvm.org/D38358 got committed.

The backstory is that the taint checker requests SVal for the value of
the pointer, and analyzer has a "fast path" in the getter to return a
constant when we know that the value is constant.
Unfortunately, the getter requires a cast to get signedness correctly,
and for the pointer `void *` the cast crashes.

This is more of a band-aid patch, as I am not sure what could be done
here "correctly", but it should be applied in any case to avoid the
crash.

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

llvm-svn: 317839

6 years ago[clangd] Fix compilation database detection
Sam McCall [Thu, 9 Nov 2017 21:45:27 +0000 (21:45 +0000)]
[clangd] Fix compilation database detection

llvm-svn: 317838

6 years ago[libFuzzer] update links in the docs
Kostya Serebryany [Thu, 9 Nov 2017 21:35:28 +0000 (21:35 +0000)]
[libFuzzer] update links in the docs

llvm-svn: 317837

6 years ago[libFuzzer] update the docs, document how to resume the merge
Kostya Serebryany [Thu, 9 Nov 2017 21:32:02 +0000 (21:32 +0000)]
[libFuzzer] update the docs, document how to resume the merge

llvm-svn: 317836

6 years ago[libFuzzer] make sure to flush IO when done merging one file
Kostya Serebryany [Thu, 9 Nov 2017 21:30:33 +0000 (21:30 +0000)]
[libFuzzer] make sure to flush IO when done merging one file

llvm-svn: 317835

6 years ago[sanitizer] Revert rL317822
Kostya Kortchinsky [Thu, 9 Nov 2017 21:26:07 +0000 (21:26 +0000)]
[sanitizer] Revert rL317822

Summary:
This reverts D39490.

For toolchains generated with older NDKs (<=r13b as far as we tested),
`cpu_set_t` doesn't exist in `sched.h`.
We have to figure out another way to get the number of CPUs without this.

Reviewers: rnk

Reviewed By: rnk

Subscribers: kubamracek, llvm-commits, krytarowski

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

llvm-svn: 317834