platform/upstream/llvm.git
5 years ago[sanitizer] Remove spurious semi-colon
Kostya Kortchinsky [Wed, 19 Dec 2018 19:05:29 +0000 (19:05 +0000)]
[sanitizer] Remove spurious semi-colon

Summary:
An extra ';' at the end of a namespace triggers a pedantic warning:
```
.../sanitizer_common/sanitizer_type_traits.h:42:2: warning: extra ‘;’ [-Wpedantic]
 };  // namespace __sanitizer
```

Reviewers: eugenis, delcypher

Reviewed By: eugenis

Subscribers: kubamracek, #sanitizers, llvm-commits

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

llvm-svn: 349666

5 years ago[lldbsuite] Un-xfail tests on Windows that are now passing
Stella Stamenova [Wed, 19 Dec 2018 19:04:01 +0000 (19:04 +0000)]
[lldbsuite] Un-xfail tests on Windows that are now passing

This is a set of tests that were all marked as failing becuse of pr24489. The bug is not fixed (as in more of the tests that were marked this way are failing), but this set is passing. It is possible that some of them are false positives, but there's a large number of unexpectedly passing tests on Windows, so I am doing a bulk un-xfail to get the buildbot to green.

llvm-svn: 349665

5 years ago[GlobalISel][AArch64] Add support for @llvm.ceil
Jessica Paquette [Wed, 19 Dec 2018 19:01:36 +0000 (19:01 +0000)]
[GlobalISel][AArch64] Add support for @llvm.ceil

This adds a G_FCEIL generic instruction and uses it in AArch64. This adds
selection for floating point ceil where it has a supported, dedicated
instruction. Other cases aren't handled here.

It updates the relevant gisel tests and adds a select-ceil test. It also adds a
check to arm64-vcvt.ll which ensures that we don't fall back when we run into
one of the relevant cases.

llvm-svn: 349664

5 years agoWork around GCC 9.0 regression
Eric Fiselier [Wed, 19 Dec 2018 18:58:22 +0000 (18:58 +0000)]
Work around GCC 9.0 regression

llvm-svn: 349663

5 years ago[llvm-mca] Rename an error variable.
Matt Davis [Wed, 19 Dec 2018 18:57:43 +0000 (18:57 +0000)]
[llvm-mca] Rename an error variable.

llvm-svn: 349662

5 years ago[X86] Don't match TESTrr from (cmp (and X, Y), 0) during isel. Defer to post processing
Craig Topper [Wed, 19 Dec 2018 18:49:13 +0000 (18:49 +0000)]
[X86] Don't match TESTrr from (cmp (and X, Y), 0) during isel. Defer to post processing

The (cmp (and X, Y) 0) pattern is greedy and ends up forming a TESTrr and consuming the and when it might be better to use one of the BMI/TBM like BLSR or BLSI.

This patch moves removes the pattern from isel and adds a post processing check to combine TESTrr+ANDrr into just a TESTrr. With this patch we are able to select the BMI/TBM instructions, but we'll also emit a TESTrr when the result is compared to 0. In many cases the peephole pass will be able to use optimizeCompareInstr to remove the TEST, but its probably not perfect.

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

llvm-svn: 349661

5 years ago[X86] Fix assert fails in pass X86AvoidSFBPass
Craig Topper [Wed, 19 Dec 2018 18:45:57 +0000 (18:45 +0000)]
[X86] Fix assert fails in pass X86AvoidSFBPass

Fixes https://bugs.llvm.org/show_bug.cgi?id=38743

The function removeRedundantBlockingStores is supposed to remove any blocking stores contained in each other in lockingStoresDispSizeMap.
But it currently looks only at the previous one, which will miss some cases that result in assert.

This patch refine the function to check all previous layouts until find the uncontained one. So all redundant stores will be removed.

Patch by Pengfei Wang

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

llvm-svn: 349660

5 years ago [llvm-mca] Add an error handler for error from parseCodeRegions
Matt Davis [Wed, 19 Dec 2018 18:27:05 +0000 (18:27 +0000)]
 [llvm-mca] Add an error handler for error from parseCodeRegions

Summary:
It's a bit tricky to add a test for the failing path right now, binary support will have an easier path to exercise the path here.

* Ran clang-format.

Reviewers: andreadb

Reviewed By: andreadb

Subscribers: tschuett, gbedwell, llvm-commits

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

llvm-svn: 349659

5 years agoShow the memory region name if there is one in the output of the "memory region"...
Greg Clayton [Wed, 19 Dec 2018 18:16:52 +0000 (18:16 +0000)]
Show the memory region name if there is one in the output of the "memory region" command

Prior to this change we would show the name of the section that a memory region belonged to but not its actual region name. Now we show this,. Added a test that reuses the regions-linux-map.dmp minidump file to test this and verify the correct region names for various memory regions.

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

llvm-svn: 349658

5 years ago[OPENMP]Mark the loop as started when initialized.
Alexey Bataev [Wed, 19 Dec 2018 18:16:37 +0000 (18:16 +0000)]
[OPENMP]Mark the loop as started when initialized.

Need to mark the loop as started when the initialization statement is
found. It is required to prevent possible incorrect loop iteraton
variable detection during template instantiation and fix the compiler
crash during the codegen.

llvm-svn: 349657

5 years agoRevert r349517 "[CMake] Default options for faster executables on MSVC"
Alexandre Ganea [Wed, 19 Dec 2018 18:01:42 +0000 (18:01 +0000)]
Revert r349517 "[CMake] Default options for faster executables on MSVC"

llvm-svn: 349656

5 years ago[CodeComplete] Properly determine qualifiers of 'this' in a lambda
Ilya Biryukov [Wed, 19 Dec 2018 18:01:24 +0000 (18:01 +0000)]
[CodeComplete] Properly determine qualifiers of 'this' in a lambda

Summary:
The clang used to pick up the qualifiers of the lamba's call operator
(which is always const) and fail to show non-const methods of 'this' in
completion results.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

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

llvm-svn: 349655

5 years agoRevert r349517 "[CMake] Default options for faster executables on MSVC"
Alexandre Ganea [Wed, 19 Dec 2018 17:57:31 +0000 (17:57 +0000)]
Revert r349517 "[CMake] Default options for faster executables on MSVC"

llvm-svn: 349654

5 years agoInitial PSTL commit
JF Bastien [Wed, 19 Dec 2018 17:45:32 +0000 (17:45 +0000)]
Initial PSTL commit

The initial commit of the Parallel STL upstream (under LLVM umbrella) based on
Parallel STL 20181204 open source release, which is available by
https://github.com/intel/parallelstl

Author: Mikhail Dvorskiy <mikhail.dvorskiy@intel.com>

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

llvm-svn: 349653

5 years ago[AArch64] Improve the Exynos M3 pipeline model
Evandro Menezes [Wed, 19 Dec 2018 17:37:51 +0000 (17:37 +0000)]
[AArch64] Improve the Exynos M3 pipeline model

llvm-svn: 349652

5 years ago[llvm-mca] Split test (NFC)
Evandro Menezes [Wed, 19 Dec 2018 17:37:14 +0000 (17:37 +0000)]
[llvm-mca] Split test (NFC)

Split the Exynos test of the register offset addressing mode into separate
loads and stores tests.

llvm-svn: 349651

5 years ago[Driver] [NetBSD] Add -D_REENTRANT when using sanitizers
Michal Gorny [Wed, 19 Dec 2018 17:25:59 +0000 (17:25 +0000)]
[Driver] [NetBSD] Add -D_REENTRANT when using sanitizers

NetBSD intends to support only reentrant interfaces in interceptors.
When -lpthread is used without _REENTRANT defined, things are
not guaranteed to work.

This is especially important for <stdio.h> and sanitization of
interfaces around FILE.  Some APIs have alternative modes depending
on the _REENTRANT definition, and NetBSD intends to support sanitization
of the _REENTRANT ones.

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

llvm-svn: 349650

5 years ago[Driver] Add .hasAnySanitizer() to SanitizerArgs
Michal Gorny [Wed, 19 Dec 2018 17:25:55 +0000 (17:25 +0000)]
[Driver] Add .hasAnySanitizer() to SanitizerArgs

Add a simple method to query whether any sanitizer was enabled,
via SanitizerArgs.  This will be used in the NetBSD driver to pass
additional definitions that are required by all sanitizers.

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

llvm-svn: 349649

5 years ago[Basic] Correct description of SanitizerSet.empty()
Michal Gorny [Wed, 19 Dec 2018 17:25:51 +0000 (17:25 +0000)]
[Basic] Correct description of SanitizerSet.empty()

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

llvm-svn: 349648

5 years ago[Driver] Disable -faddrsig by default on NetBSD
Michal Gorny [Wed, 19 Dec 2018 17:25:46 +0000 (17:25 +0000)]
[Driver] Disable -faddrsig by default on NetBSD

Avoid passing -faddrsig by default on NetBSD.  This platform is still
using old GNU binutils that crashes on executables containing those
sections.

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

llvm-svn: 349647

5 years agoRegenerate test
Simon Pilgrim [Wed, 19 Dec 2018 17:24:34 +0000 (17:24 +0000)]
Regenerate test

llvm-svn: 349646

5 years ago[sanitizer_common] Fix sha2 interceptors not to use vars in array len
Michal Gorny [Wed, 19 Dec 2018 17:22:14 +0000 (17:22 +0000)]
[sanitizer_common] Fix sha2 interceptors not to use vars in array len

Fix the sha2 interceptor macros to use a constant for array parameter
length rather than referencing the extern variable.  Since the digest
length is provided in hash name, reuse the macro parameter for it.
Verify that the calculated value matches the one provided by system
headers.

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

llvm-svn: 349645

5 years agoTest commit
Anton Afanasyev [Wed, 19 Dec 2018 17:18:40 +0000 (17:18 +0000)]
Test commit

Fix typos.

llvm-svn: 349644

5 years ago[X86] Remove already upgraded llvm.x86.avx512.mask.padds/psubs tests
Simon Pilgrim [Wed, 19 Dec 2018 17:18:27 +0000 (17:18 +0000)]
[X86] Remove already upgraded llvm.x86.avx512.mask.padds/psubs tests

Duplicate tests have already been moved to avx512bw-intrinsics-upgrade.ll

llvm-svn: 349643

5 years ago[lit] Make TestConvenienceVariables a cpp file
Jonas Devlieghere [Wed, 19 Dec 2018 17:10:21 +0000 (17:10 +0000)]
[lit] Make TestConvenienceVariables a cpp file

The build.py script always runs the compiler in C++ mode, regardless of
the file extension. This results in mangled names presented to the
linker which in turn cannot find the printf symbol.

While we figure out how to solve this issue I've turned the source file
into a cpp file and added extern c. This should unbreak the bots.

llvm-svn: 349642

5 years ago[ValueTracking] remove unused parameters from helper functions; NFC
Sanjay Patel [Wed, 19 Dec 2018 16:49:18 +0000 (16:49 +0000)]
[ValueTracking] remove unused parameters from helper functions; NFC

llvm-svn: 349641

5 years ago[BPF] Generate BTF DebugInfo under BPF target
Yonghong Song [Wed, 19 Dec 2018 16:40:25 +0000 (16:40 +0000)]
[BPF] Generate BTF DebugInfo under BPF target

This patch implements BTF (BPF Type Format).
The BTF is the debug info format for BPF, introduced
in the below linux patch:
  https://github.com/torvalds/linux/commit/69b693f0aefa0ed521e8bd02260523b5ae446ad7#diff-06fb1c8825f653d7e539058b72c83332
and further extended several times, e.g.,
  https://www.spinics.net/lists/netdev/msg534640.html
  https://www.spinics.net/lists/netdev/msg538464.html
  https://www.spinics.net/lists/netdev/msg540246.html

The main advantage of implementing in LLVM is:
   . better integration/deployment as no extra tools are needed.
   . bpf JIT based compilation (like bcc, bpftrace, etc.) can get
     BTF without much extra effort.
   . BTF line_info needs selective source codes, which can be
     easily retrieved when inside the compiler.

This patch implemented BTF generation by registering a BPF
specific DebugHandler in BPFAsmPrinter.

Signed-off-by: Yonghong Song <yhs@fb.com>
Differential Revision: https://reviews.llvm.org/D55752

llvm-svn: 349640

5 years agoAdd missing include to test. NFC
Marshall Clow [Wed, 19 Dec 2018 16:39:04 +0000 (16:39 +0000)]
Add missing include to test. NFC

llvm-svn: 349639

5 years ago[gn build] Merge r349605
Nico Weber [Wed, 19 Dec 2018 16:38:16 +0000 (16:38 +0000)]
[gn build] Merge r349605

llvm-svn: 349638

5 years ago[Object] Deduplicate long archive member names
Peter Wu [Wed, 19 Dec 2018 16:15:05 +0000 (16:15 +0000)]
[Object] Deduplicate long archive member names

Summary:
Import libraries as created by llvm-dlltool always use the same archive
member name for every object file (namely, the DLL library name). Ensure
that long names are not repeatedly stored in the string table.

Reviewed By: ruiu

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

llvm-svn: 349637

5 years ago[clang-tidy] Diagnose abseil-duration-comparison on macro arguments
Hyrum Wright [Wed, 19 Dec 2018 16:03:34 +0000 (16:03 +0000)]
[clang-tidy] Diagnose abseil-duration-comparison on macro arguments

Summary:
This change relaxes the requirements on the utility
`rewriteExprFromNumberToDuration` function, and introduces new checking
inside of the `abseil-duration-comparison` check to allow macro argument
expression transformation.

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

llvm-svn: 349636

5 years ago[OpenMP] Fix data sharing analysis in nested clause
Joel E. Denny [Wed, 19 Dec 2018 15:59:47 +0000 (15:59 +0000)]
[OpenMP] Fix data sharing analysis in nested clause

Without this patch, clang doesn't complain that X needs explicit data
sharing attributes in the following:

```
 #pragma omp target teams default(none)
 {
   #pragma omp parallel num_threads(X)
     ;
 }
```

However, clang does produce that complaint after the braces are
removed.  With this patch, clang complains in both cases.

Reviewed By: ABataev

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

llvm-svn: 349635

5 years ago[compiler-rt][builtins][PowerPC] Enable builtins tests on PowerPC 64 bit LE
Amy Kwan [Wed, 19 Dec 2018 15:52:41 +0000 (15:52 +0000)]
[compiler-rt][builtins][PowerPC] Enable builtins tests on PowerPC 64 bit LE

This patch aims to enable the tests for the compiler-rt builtin functions (that
currently already exist within compiler-rt) for PowerPC 64bit LE (ppc64le).
Previously when unit tests are run, these tests would be reported as
UNSUPPORTED. This patch updates the REQUIRES line for each test (to enable for
ppc64le), and each test is linked against compiler-rt when running.

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

llvm-svn: 349634

5 years agoTest commit
Amy Kwan [Wed, 19 Dec 2018 15:21:07 +0000 (15:21 +0000)]
Test commit

llvm-svn: 349633

5 years ago[clangd] Fix a syntax error on the test.
Haojian Wu [Wed, 19 Dec 2018 14:51:07 +0000 (14:51 +0000)]
[clangd] Fix a syntax error on the test.

llvm-svn: 349632

5 years ago[X86][SSE] Auto upgrade PADDUS/PSUBUS intrinsics to UADD_SAT/USUB_SAT generic intrins...
Simon Pilgrim [Wed, 19 Dec 2018 14:43:47 +0000 (14:43 +0000)]
[X86][SSE] Auto upgrade PADDUS/PSUBUS intrinsics to UADD_SAT/USUB_SAT generic intrinsics (clang)

Sibling patch to D55855, this emits UADD_SAT/USUB_SAT generic intrinsics for the SSE saturated math intrinsics instead of expanding to a IR code sequence that could be difficult to reassemble.

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

llvm-svn: 349631

5 years ago[X86][SSE] Auto upgrade PADDUS/PSUBUS intrinsics to UADD_SAT/USUB_SAT generic intrins...
Simon Pilgrim [Wed, 19 Dec 2018 14:43:36 +0000 (14:43 +0000)]
[X86][SSE] Auto upgrade PADDUS/PSUBUS intrinsics to UADD_SAT/USUB_SAT generic intrinsics (llvm)

Now that we use the generic ISD opcodes, we can use the generic intrinsics directly as well. This fixes the poor fast-isel codegen by not expanding to an easily broken IR code sequence.

I'm intending to deal with the signed saturation equivalents as well.

Clang counterpart: https://reviews.llvm.org/D55879

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

llvm-svn: 349630

5 years ago[SelectionDAG] Optional handling of UNDEF elements in matchBinaryPredicate (part...
Simon Pilgrim [Wed, 19 Dec 2018 14:09:38 +0000 (14:09 +0000)]
[SelectionDAG] Optional handling of UNDEF elements in matchBinaryPredicate (part 2 of 2)

Now that SimplifyDemandedBits/SimplifyDemandedVectorElts is simplifying vector elements, we're seeing more constant BUILD_VECTOR containing undefs.

This patch provides opt-in support for UNDEF elements in matchBinaryPredicate, passing NULL instead of the result ConstantSDNode* argument.

I've updated the (or (and X, c1), c2) -> (and (or X, c2), c1|c2) fold to demonstrate its use, which I believe is safe for undef cases.

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

llvm-svn: 349629

5 years ago[SelectionDAG] Optional handling of UNDEF elements in matchBinaryPredicate (part...
Simon Pilgrim [Wed, 19 Dec 2018 14:09:09 +0000 (14:09 +0000)]
[SelectionDAG] Optional handling of UNDEF elements in matchBinaryPredicate (part 1 of 2)

Now that SimplifyDemandedBits/SimplifyDemandedVectorElts is simplifying vector elements, we're seeing more constant BUILD_VECTOR containing undefs.

This patch provides opt-in support for UNDEF elements in matchBinaryPredicate, passing NULL instead of the result ConstantSDNode* argument.

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

llvm-svn: 349628

5 years agoPortable Python script across Python version
Serge Guelton [Wed, 19 Dec 2018 13:46:13 +0000 (13:46 +0000)]
Portable Python script across Python version

urllib2 as been renamed into urllib and the library layout has changed.
Workaround that in a consistent manner.

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

llvm-svn: 349627

5 years ago[Index] Index paremeters in lambda expressions.
Haojian Wu [Wed, 19 Dec 2018 13:44:41 +0000 (13:44 +0000)]
[Index] Index paremeters in lambda expressions.

Summary: This fixes clangd couldn't find references for lambda parameters.

Reviewers: ilya-biryukov

Subscribers: ioeric, arphaman, kadircet, cfe-commits

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

llvm-svn: 349626

5 years ago[TargetLowering] Fix propagation of undefs in zero extension ops (PR40091)
Simon Pilgrim [Wed, 19 Dec 2018 13:37:59 +0000 (13:37 +0000)]
[TargetLowering] Fix propagation of undefs in zero extension ops (PR40091)

As described on PR40091, we have several places where zext (and zext_vector_inreg) fold an undef input into an undef output. For zero extensions this is incorrect as the output should guarantee to least have the new upper bits set to zero.

SimplifyDemandedVectorElts is the worst offender (and its the most likely to cause new undefs to appear) but DAGCombiner's tryToFoldExtendOfConstant has a similar issue.

Thanks to @dmgreen for catching this.

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

llvm-svn: 349625

5 years agoLet TableGen write output only if it changed, instead of doing so in cmake, attempt 2
Nico Weber [Wed, 19 Dec 2018 13:35:53 +0000 (13:35 +0000)]
Let TableGen write output only if it changed, instead of doing so in cmake, attempt 2

This relands r330742:
"""
Let TableGen write output only if it changed, instead of doing so in cmake.

Removes one subprocess and one temp file from the build for each tablegen
invocation.

No intended behavior change.
"""

In particular, if you see rebuilds after this change that you didn't see
before this change, that's unintended and it's fine to revert this change
again (but let me know).

r330742 got reverted because some people reported that llvm-tblgen ran on every
build after it.  This could happen if the depfile output got deleted without
deleting the main .inc output. To fix, make TableGen always write the depfile,
but keep writing the main .inc output only if it has changed. This matches what
we did in cmake before.

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

llvm-svn: 349624

5 years ago[clang-tidy] use "const SourceManager&" parameter, NFC.
Haojian Wu [Wed, 19 Dec 2018 13:25:08 +0000 (13:25 +0000)]
[clang-tidy] use "const SourceManager&" parameter, NFC.

llvm-svn: 349623

5 years agoFix test MC/AMDGPU/reloc.s
Nicolai Haehnle [Wed, 19 Dec 2018 12:13:21 +0000 (12:13 +0000)]
Fix test MC/AMDGPU/reloc.s

Missed this change in r349620

Change-Id: I5123e31ed4bb99ad6903b9ede4de4dbe2cc6d453
llvm-svn: 349622

5 years ago[X86][SSE] Remove use of SSE ADDS/SUBS saturation intrinsics from schedule/stack...
Simon Pilgrim [Wed, 19 Dec 2018 12:00:25 +0000 (12:00 +0000)]
[X86][SSE] Remove use of SSE ADDS/SUBS saturation intrinsics from schedule/stack tests

These are due to be upgraded soon, but good to replace them with generic llvm sadd_sat/ssub_sat intrinsics now.

The avx512 masked cases need doing as well but require a bit of tidyup first.

llvm-svn: 349621

5 years agoAMDGPU: Use an ABS32_LO relocation for SCRATCH_RSRC_DWORD1
Nicolai Haehnle [Wed, 19 Dec 2018 11:55:03 +0000 (11:55 +0000)]
AMDGPU: Use an ABS32_LO relocation for SCRATCH_RSRC_DWORD1

Summary:
Using HI here makes no logical sense, since the dword is only
32 bits to begin with.

Current Mesa master does not look at the relocation type at all,
so this change is fine. Future Mesa will rely on this, however.

Change-Id: I91085707834c4ac0370926602b93c94b90e44cb1

Reviewers: arsenm, rampitec, mareko

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 349620

5 years agoReimplement Thread Static Data ASan routines with TLS
Kamil Rytarowski [Wed, 19 Dec 2018 11:11:29 +0000 (11:11 +0000)]
Reimplement Thread Static Data ASan routines with TLS

Summary:
Thread Static Data cannot be used in early init on NetBSD
and FreeBSD. Reuse the ASan TSD API for compatibility with
existing code with an alternative implementation using Thread
Local Storage.

New version uses Thread Local Storage to store a pointer
with thread specific data. The destructor from TSD has been
replaced with a TLS destrucutor that is called upon thread
exit.

Reviewers: joerg, vitalybuka, jfb

Reviewed By: vitalybuka

Subscribers: dim, emaste, ro, jfb, devnexen, kubamracek, mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 349619

5 years ago[clangd] Unify path canonicalizations in the codebase
Kadir Cetinkaya [Wed, 19 Dec 2018 10:46:21 +0000 (10:46 +0000)]
[clangd] Unify path canonicalizations in the codebase

Summary:
There were a few different places where we canonicalized paths, each
one had its own flavor. This patch tries to unify them all under one place.

Reviewers: ilya-biryukov

Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 349618

5 years ago[llvm-objdump] - Fix one more BB.
George Rimar [Wed, 19 Dec 2018 10:44:49 +0000 (10:44 +0000)]
[llvm-objdump] - Fix one more BB.

Should fix the http://lab.llvm.org:8011/builders/polly-amd64-linux/builds/25876/steps/build/logs/stdio:

/home/grosser/buildslave/polly-amd64-linux/llvm.src/tools/llvm-objdump/llvm-objdump.cpp:539:25: error: conditional expression is ambiguous; 'std::string' (aka 'basic_string<char>') can be converted to 'typename std::remove_reference<StringRef>::type' (aka 'llvm::StringRef') and vice versa
      Target = Demangle ? demangle(*SymName) : *SymName;

llvm-svn: 349617

5 years ago[SelectionDAG] Optional handling of UNDEF elements in matchUnaryPredicate
Simon Pilgrim [Wed, 19 Dec 2018 10:41:06 +0000 (10:41 +0000)]
[SelectionDAG] Optional handling of UNDEF elements in matchUnaryPredicate

Now that SimplifyDemandedBits/SimplifyDemandedVectorElts are simplifying vector elements, we're seeing more constant BUILD_VECTOR containing UNDEFs.

This patch provides opt-in handling of UNDEF elements in matchUnaryPredicate, passing NULL instead of the ConstantSDNode* argument.

I've updated SelectionDAG::simplifyShift to demonstrate its use.

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

llvm-svn: 349616

5 years ago[X86][SSE] Remove SSE ADDUS/SUBUS saturation intrinsics from schedule/stack tests
Simon Pilgrim [Wed, 19 Dec 2018 10:39:14 +0000 (10:39 +0000)]
[X86][SSE] Remove SSE ADDUS/SUBUS saturation intrinsics from schedule/stack tests

These are already being autoupgraded, currently to an IR sequence, but best to replace them with generic llvm uadd_sat/usub_sat intrinsics (which D55855 will be doing shortly anyhow).

The avx512 masked cases need doing as well but require a bit of tidyup first.

llvm-svn: 349615

5 years ago[llvm-objdump] - Fix BB.
George Rimar [Wed, 19 Dec 2018 10:29:35 +0000 (10:29 +0000)]
[llvm-objdump] - Fix BB.

Move the helper method before the first incocation in the file.

llvm-svn: 349614

5 years ago[llvm-objdump] - Demangle the symbols when printing symbol table and relocations.
George Rimar [Wed, 19 Dec 2018 10:21:45 +0000 (10:21 +0000)]
[llvm-objdump] - Demangle the symbols when printing symbol table and relocations.

This is https://bugs.llvm.org/show_bug.cgi?id=40009,

llvm-objdump does not demangle the symbols when prints symbol
table and/or relocations.

Patch teaches it to do that.

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

llvm-svn: 349613

5 years ago[LLD][ELF] - Report a location for symbols from the linker script when reporting...
George Rimar [Wed, 19 Dec 2018 10:19:40 +0000 (10:19 +0000)]
[LLD][ELF] - Report a location for symbols from the linker script when reporting an error.

When we report an error for symbols defined in the linker script,
we do not report the location properly.

For example:

ld.lld: error: relocation R_AARCH64_CALL26 cannot refer to absolute symbol: aliasto__text
>>> defined in <internal>
>>> referenced by rtoabs.o:(.text+0x4)

This patch fixes that.

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

llvm-svn: 349612

5 years agoAMDGPU/InsertWaitcnts: Update VGPR/SGPR bounds when brackets are merged
Carl Ritson [Wed, 19 Dec 2018 10:17:49 +0000 (10:17 +0000)]
AMDGPU/InsertWaitcnts: Update VGPR/SGPR bounds when brackets are merged

Summary:
Fix an issue where VGPR/SGPR bounds are not properly extended when brackets are merged.
This manifests as missing waitcnt insertions when multiple brackets are forwarded to a successor block and the first forward has lower VGPR/SGPR bounds.

Irreducible loop test has been extended based on a CTS failure detected for GFX9.

Reviewers: nhaehnle

Reviewed By: nhaehnle

Subscribers: arsenm, kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, jfb, llvm-commits

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

llvm-svn: 349611

5 years ago[ARM GlobalISel] Support G_CONSTANT for Thumb2
Diana Picus [Wed, 19 Dec 2018 09:55:10 +0000 (09:55 +0000)]
[ARM GlobalISel] Support G_CONSTANT for Thumb2

All we have to do is mark it as legal.

This allows us to select a lot of new patterns handled by TableGen. This
patch adds tests for them and splits up the existing test file for
binary operators into 2 files, one for arithmetic ops and one for
logical ones.

llvm-svn: 349610

5 years agotsan: align default value of detect_deadlocks flag with actual behavior
Dmitry Vyukov [Wed, 19 Dec 2018 09:34:13 +0000 (09:34 +0000)]
tsan: align default value of detect_deadlocks flag with actual behavior

I tricked myself into thinking that deadlock detection is off by default in TSan by looking at the default value of the detect_deadlocks flag and outdated docs. (Created a pull request to update docs.)
I even managed to confuse others: https://groups.google.com/forum/#!topic/thread-sanitizer/xYvnAYwtoDk

However, the default value is overwritten in code (TSan_flags.cc:InitializeFlags). The TSan/deadlock tests also rely on this

This changes aligns the default value of the flag with the actual default behavior.

Author: yln (Julian Lettner)
Reviewed in: https://reviews.llvm.org/D55846

llvm-svn: 349609

5 years agoAMDGPU/GlobalISel: Regbankselect for fsub
Matt Arsenault [Wed, 19 Dec 2018 09:07:58 +0000 (09:07 +0000)]
AMDGPU/GlobalISel: Regbankselect for fsub

llvm-svn: 349608

5 years agorefactor testsuite spawnLldbMi args->exe+args
Jan Kratochvil [Wed, 19 Dec 2018 08:57:10 +0000 (08:57 +0000)]
refactor testsuite spawnLldbMi args->exe+args

Currently spawnLldbMi accepts both lldb-mi options and executable to debug as
a single parameter. Split them.

As in D55859 we will need to execute one lldb-mi command before loading the
exe. Therefore we can no longer use the exe as lldb-mi command-line parameter
as then there is no way to execute a command before loading exe specified as
lldb-mi command-line parameter.

LocateExecutableSymbolFileDsym should be static, that is also a little
refactorization.

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

llvm-svn: 349607

5 years ago[llvm-objcopy] [COFF] Fix the Object forward declaration
Martin Storsjo [Wed, 19 Dec 2018 07:45:06 +0000 (07:45 +0000)]
[llvm-objcopy] [COFF] Fix the Object forward declaration

This fixes build warnings with clang, and linker errors with MSVC.

llvm-svn: 349606

5 years ago[llvm-objcopy] Initial COFF support
Martin Storsjo [Wed, 19 Dec 2018 07:24:38 +0000 (07:24 +0000)]
[llvm-objcopy] Initial COFF support

This is an initial implementation of no-op passthrough copying of COFF
with objcopy.

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

llvm-svn: 349605

5 years agoUse "EvaluateAsRValue" instead of as a known int, because if it's not a known
Bill Wendling [Wed, 19 Dec 2018 04:54:29 +0000 (04:54 +0000)]
Use "EvaluateAsRValue" instead of as a known int, because if it's not a known
integer we want to emit a diagnostic instead of asserting.

llvm-svn: 349604

5 years agoRevert accidentally included code.
Bill Wendling [Wed, 19 Dec 2018 04:36:42 +0000 (04:36 +0000)]
Revert accidentally included code.

llvm-svn: 349603

5 years ago[DebugInfo] Make AsmPrinter struct HandlerInfo and Handlers protected
Yonghong Song [Wed, 19 Dec 2018 04:07:47 +0000 (04:07 +0000)]
[DebugInfo] Make AsmPrinter struct HandlerInfo and Handlers protected

In AsmPrinter, make struct HandlerInfo and SmallVector
Handlers protected, so target extended AsmPrinter will
be able to add their own handlers.

Signed-off-by: Yonghong Song <yhs@fb.com>
Differential Revision: https://reviews.llvm.org/D55756

llvm-svn: 349602

5 years ago[bugpoint][PR29027] Reduce function attributes
Brian Gesiak [Wed, 19 Dec 2018 03:42:19 +0000 (03:42 +0000)]
[bugpoint][PR29027] Reduce function attributes

Summary:
In addition to reducing the functions in an LLVM module, bugpoint now
reduces the function attributes associated with each of the remaining
functions.

To test this, add a -bugpoint-crashfuncattr test pass, which crashes if
a function in the module has a "bugpoint-crash" attribute. A test case
demonstrates that the IR is reduced to just that one attribute.

Reviewers: MatzeB, silvas, davide, reames

Reviewed By: reames

Subscribers: reames, llvm-commits

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

llvm-svn: 349601

5 years agoFix use-after-free with profile remapping.
Richard Smith [Wed, 19 Dec 2018 03:24:03 +0000 (03:24 +0000)]
Fix use-after-free with profile remapping.

We need to keep the underlying profile reader alive as long as the
profile data, because the profile data may contain StringRefs referring
to strings in the reader's name table.

llvm-svn: 349600

5 years ago[PowerPC]Exploit P9 vabsdu for unsigned vselect patterns
Kewen Lin [Wed, 19 Dec 2018 03:04:07 +0000 (03:04 +0000)]
[PowerPC]Exploit P9 vabsdu for unsigned vselect patterns

For type v4i32/v8ii16/v16i8, do following transforms:
  (vselect (setcc a, b, setugt), (sub a, b), (sub b, a)) -> (vabsd a, b)
  (vselect (setcc a, b, setuge), (sub a, b), (sub b, a)) -> (vabsd a, b)
  (vselect (setcc a, b, setult), (sub b, a), (sub a, b)) -> (vabsd a, b)
  (vselect (setcc a, b, setule), (sub b, a), (sub a, b)) -> (vabsd a, b)

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

llvm-svn: 349599

5 years ago[gn build] Add build file for llvm-objcopy
Nico Weber [Wed, 19 Dec 2018 02:48:01 +0000 (02:48 +0000)]
[gn build] Add build file for llvm-objcopy

Needed by check-lld.

This should've been part of r349486 but I messed up.

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

llvm-svn: 349598

5 years agoRe-land "Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen"
Alexandre Ganea [Wed, 19 Dec 2018 01:30:29 +0000 (01:30 +0000)]
Re-land "Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen"

Previously, when compiling Visual Studio targets, one could see random build errors. This was caused by tablegen projects using the same build folders.
This workaround simply chains tablegen projects.

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

llvm-svn: 349596

5 years agoAdd llvm-objdump man page
Ed Maste [Wed, 19 Dec 2018 01:26:55 +0000 (01:26 +0000)]
Add llvm-objdump man page

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

llvm-svn: 349595

5 years ago[asan] Disable ODR test on Android
Vitaly Buka [Wed, 19 Dec 2018 00:07:25 +0000 (00:07 +0000)]
[asan] Disable ODR test on Android

llvm-svn: 349585

5 years agoUse unique_ptr to manage a TarWriter instance. NFC.
Rui Ueyama [Tue, 18 Dec 2018 23:50:37 +0000 (23:50 +0000)]
Use unique_ptr to manage a TarWriter instance. NFC.

llvm-svn: 349581

5 years agoDon't forget to free the libcompression scratch buffer in the dtor.
Jason Molenda [Tue, 18 Dec 2018 23:45:45 +0000 (23:45 +0000)]
Don't forget to free the libcompression scratch buffer in the dtor.

llvm-svn: 349580

5 years ago[lit] Rather than including stdio.h, forward-declare printf in TestConvenienceVariabl...
Stella Stamenova [Tue, 18 Dec 2018 23:36:35 +0000 (23:36 +0000)]
[lit] Rather than including stdio.h, forward-declare printf in TestConvenienceVariables.test

llvm-svn: 349573

5 years agoRemove the zlib CFLAGS and LDFLAGS settings from the xcode project file.
Jason Molenda [Tue, 18 Dec 2018 23:33:42 +0000 (23:33 +0000)]
Remove the zlib CFLAGS and LDFLAGS settings from the xcode project file.
We're linking against libcompression all the time now, we don't need to
fall back to zlib.  zlib support will still be used when lldb is built on
linux et al systems, so I'm not removing any of the source support, but
when built on darwin with xcode, we'll be using libcompression.

llvm-svn: 349572

5 years agoFix error message.
Rui Ueyama [Tue, 18 Dec 2018 23:33:10 +0000 (23:33 +0000)]
Fix error message.

Previously, this code printed out an error message like this

  ld.lld: error: --reproduce: failed to open /foo: cannot open /foo

Apparently "failed to open /foo:" part is redundant.

llvm-svn: 349571

5 years ago[Driver] Also obey -nostdlib++ when rewriting -lstdc++.
Dan Albert [Tue, 18 Dec 2018 23:29:35 +0000 (23:29 +0000)]
[Driver] Also obey -nostdlib++ when rewriting -lstdc++.

Reviewers: pirama

Reviewed By: pirama

Subscribers: cfe-commits

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

llvm-svn: 349570

5 years ago[AArch64] Simplify the Exynos M3 pipeline model
Evandro Menezes [Tue, 18 Dec 2018 23:19:57 +0000 (23:19 +0000)]
[AArch64] Simplify the Exynos M3 pipeline model

llvm-svn: 349569

5 years ago[AArch64] Fix instructions order (NFC)
Evandro Menezes [Tue, 18 Dec 2018 23:19:55 +0000 (23:19 +0000)]
[AArch64] Fix instructions order (NFC)

llvm-svn: 349568

5 years ago[llvm-mca] Improve test (NFC)
Evandro Menezes [Tue, 18 Dec 2018 23:19:52 +0000 (23:19 +0000)]
[llvm-mca] Improve test (NFC)

Add more instruction variations for Exynos.

llvm-svn: 349567

5 years agoPortability fix: add missing includes and static_casts. Reviewed as https://reviews...
Marshall Clow [Tue, 18 Dec 2018 23:19:00 +0000 (23:19 +0000)]
Portability fix: add missing includes and static_casts. Reviewed as https://reviews.llvm.org/D55777. Thanks to Andrey Maksimov for the patch.

llvm-svn: 349566

5 years ago[NativePDB] Correctly reconstruct DeclContext for nested enums.
Zachary Turner [Tue, 18 Dec 2018 23:12:08 +0000 (23:12 +0000)]
[NativePDB] Correctly reconstruct DeclContext for nested enums.

We reconstruct the AST hierarchy by trying to hack up a mangled
name for the parent type using the child type's mangled name.
This was failing for enums because their tag type is represented
with two letters ("W4") instead of one letter ("T", "U", etc) as
it is with classes, structs, and unions.  After accounting for
this we can now correctly determine when an enum is nested
inside of a namespace or a class.

llvm-svn: 349565

5 years ago[DebugInfo] Move several private headers to include directory
Yonghong Song [Tue, 18 Dec 2018 23:10:17 +0000 (23:10 +0000)]
[DebugInfo] Move several private headers to include directory

This patch moved the following files in lib/CodeGen/AsmPrinter/
  AsmPrinterHandler.h
  DbgEntityHistoryCalculator.h
  DebugHandlerBase.h
to include/llvm/CodeGen directory.

Such a change will enable Target to extend DebugHandlerBase
and emit Target specific debug info sections.

Signed-off-by: Yonghong Song <yhs@fb.com>
Differential Revision: https://reviews.llvm.org/D55755

llvm-svn: 349564

5 years agoForce libcompression calls to be enabled when building on Darwin
Jason Molenda [Tue, 18 Dec 2018 23:02:50 +0000 (23:02 +0000)]
Force libcompression calls to be enabled when building on Darwin
systems.  It has been available in the OS over over three years
now.  If lldb doesn't link against -lcompression, it should be an
error.

Allocate a scratch buffer for libcompression to use when decoding
packets, instead of it having to allocate & free one on every call.

Fix a typeo with the size of the buffer that compression_decode_buffer()
is expanding into.

<rdar://problem/41601084>

llvm-svn: 349563

5 years ago[lit] Use the new build.py script in the lldb-mi tests
Stella Stamenova [Tue, 18 Dec 2018 22:54:17 +0000 (22:54 +0000)]
[lit] Use the new build.py script in the lldb-mi tests

This allows the tests to pass on Windows as well

llvm-svn: 349562

5 years agoEmit ASM input in a constant context
Bill Wendling [Tue, 18 Dec 2018 22:54:03 +0000 (22:54 +0000)]
Emit ASM input in a constant context

Summary:
Some ASM input constraints (e.g., "i" and "n") require immediate values. At O0,
very few code transformations are performed. So if we cannot resolve to an
immediate when emitting the ASM input we shouldn't delay its processing.

Reviewers: rsmith, efriedma

Reviewed By: efriedma

Subscribers: rehana, efriedma, craig.topper, jyknight, cfe-commits

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

llvm-svn: 349561

5 years ago[InstCombine] add tests for extract of vector load; NFC
Sanjay Patel [Tue, 18 Dec 2018 22:51:06 +0000 (22:51 +0000)]
[InstCombine] add tests for extract of vector load; NFC

There's a mismatch internally about how we are handling these patterns.
We count loads as cheapToScalarize(), but then we don't actually
scalarize them, so that can leave extra instructions compared to where
we started when scalarizing other ops. If it's cheapToScalarize, then
we should be scalarizing.

llvm-svn: 349560

5 years agoPreserve the linkage for objc* intrinsics as clang will set them to weak_external...
Pete Cooper [Tue, 18 Dec 2018 22:42:08 +0000 (22:42 +0000)]
Preserve the linkage for objc* intrinsics as clang will set them to weak_external in some cases

Clang uses weak linkage for objc runtime functions when they are not available on the platform.

The intrinsic has this linkage so we just need to pass that on to the runtime call.

llvm-svn: 349559

5 years agoAdd nonlazybind to objc_retain/objc_release when converting from intrinsics.
Pete Cooper [Tue, 18 Dec 2018 22:31:34 +0000 (22:31 +0000)]
Add nonlazybind to objc_retain/objc_release when converting from intrinsics.

For performance reasons, clang set nonlazybind on these functions.  Now that we
are using intrinsics instead of runtime calls, we should set this attribute when
creating the runtime functions.

llvm-svn: 349558

5 years agoReject .so files if -static is given.
Rui Ueyama [Tue, 18 Dec 2018 22:30:23 +0000 (22:30 +0000)]
Reject .so files if -static is given.

Previously, if you pass -static to lld, lld searches for only foo.a
and skips foo.so for -lfoo option. However, it didn't reject .so files
if you directly pass their pathnames via the command line, which is a bug.

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

llvm-svn: 349557

5 years ago[LAA] Introduce enum for vectorization safety status (NFC).
Florian Hahn [Tue, 18 Dec 2018 22:25:11 +0000 (22:25 +0000)]
[LAA] Introduce enum for vectorization safety status (NFC).

This patch adds a VectorizationSafetyStatus enum, which will be extended
in a follow up patch to distinguish between 'safe with runtime checks'
and 'known unsafe' dependences.

Reviewers: anemet, anna, Ayal, hsaito

Reviewed By: Ayal

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

llvm-svn: 349556

5 years ago[asan] Restore ODR-violation detection on vtables
Vitaly Buka [Tue, 18 Dec 2018 22:23:30 +0000 (22:23 +0000)]
[asan] Restore ODR-violation detection on vtables

Summary:
unnamed_addr is still useful for detecting of ODR violations on vtables

Still unnamed_addr with lld and --icf=safe or --icf=all can trigger false
reports which can be avoided with --icf=none or by using private aliases
with -fsanitize-address-use-odr-indicator

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: kubamracek, hiraditya, llvm-commits

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

llvm-svn: 349555

5 years ago[LoopVectorize] auto-generate complete checks; NFC
Sanjay Patel [Tue, 18 Dec 2018 22:23:04 +0000 (22:23 +0000)]
[LoopVectorize] auto-generate complete checks; NFC

The first test claims to show that the vectorizer will
generate a vector load/loop, but then this file runs
other passes which might scalarize that op. I'm removing
instcombine from the RUN line here to break that dependency.
Also, I'm generating full checks to make it clear exactly
what the vectorizer has done.

llvm-svn: 349554

5 years agoUn-conditionalize use of libcompression. debugserver only builds
Jason Molenda [Tue, 18 Dec 2018 22:21:48 +0000 (22:21 +0000)]
Un-conditionalize use of libcompression.  debugserver only builds
on Darwin systems and libcompression has been in the OS for over
three years.

Remove use of / linking to zlib.  We'll always have libcompression
available now.

Create a scratch buffer via compression_encode_scratch_buffer_size()
and use it in calls to compression_encode_buffer() to avoid
compression_encode_buffer having to malloc & free a scratch buffer
on each call.

Tested by forcing compression to be enabled on macos native (normally
only enabled on iOS et al devices), running the testsuite.

<rdar://problem/41601084>

llvm-svn: 349553

5 years agoRewrite objc intrinsics to runtime methods in PreISelIntrinsicLowering instead of...
Pete Cooper [Tue, 18 Dec 2018 22:20:03 +0000 (22:20 +0000)]
Rewrite objc intrinsics to runtime methods in PreISelIntrinsicLowering instead of SDAG.

SelectionDAG currently changes these intrinsics to function calls, but that won't work
for other ISel's.  Also we want to eventually support nonlazybind and weak linkage coming
from the front-end which we can't do in SelectionDAG.

llvm-svn: 349552

5 years ago[OPENMP] parsing and sema support for 'close' map-type-modifier
Kelvin Li [Tue, 18 Dec 2018 22:18:41 +0000 (22:18 +0000)]
[OPENMP] parsing and sema support for 'close' map-type-modifier

A map clause with the close map-type-modifier is a hint to
prefer that the variables are mapped using a copy into faster
memory.

Patch by Ahsan Saghir (saghir)

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

llvm-svn: 349551

5 years agoTestHelloWorld: Use a file on the target platform for synchronisation.
Adrian Prantl [Tue, 18 Dec 2018 22:17:38 +0000 (22:17 +0000)]
TestHelloWorld: Use a file on the target platform for synchronisation.

Thanks to Pavel Labath for the idea!

llvm-svn: 349550

5 years ago[AArch64] Avoid crashing on .seh directives in assembly
Martin Storsjo [Tue, 18 Dec 2018 22:10:17 +0000 (22:10 +0000)]
[AArch64] Avoid crashing on .seh directives in assembly

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

llvm-svn: 349549

5 years ago[InstCombine] auto-generate complete checks; NFC
Sanjay Patel [Tue, 18 Dec 2018 22:09:15 +0000 (22:09 +0000)]
[InstCombine] auto-generate complete checks; NFC

llvm-svn: 349548