platform/upstream/llvm.git
4 years ago[Support] Try to fix bot failure after 8ddcd1dc26
Russell Gallop [Thu, 12 Dec 2019 12:18:12 +0000 (12:18 +0000)]
[Support] Try to fix bot failure after 8ddcd1dc26

http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/41755

4 years ago[clangd] Rename constructors and destructors in cross-file case
Kirill Bobyrev [Thu, 12 Dec 2019 12:10:59 +0000 (13:10 +0100)]
[clangd] Rename constructors and destructors in cross-file case

* Use ad-hoc Decl canonicalization from Clang-Rename to allow renaming
  constructors and destructors while using cross-file rename.
* Manually handle the destructor selection
* Add unit tests to prevent regressions and ensure the correct behaviour

Reviewed by: sammccall

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

4 years ago[Support] Extend TimeProfiler to support multiple threads
Russell Gallop [Thu, 5 Dec 2019 09:43:49 +0000 (09:43 +0000)]
[Support] Extend TimeProfiler to support multiple threads

This makes TimeTraceProfilerInstance thread local. Added
timeTraceProfilerFinishThread() which moves the thread local instance to
a global vector of instances. timeTraceProfilerWrite() then writes
recorded data from all instances.

Threads are identified based on their thread ids. Totals are reported
with artificial thread ids higher than the real ones.

Replaced raw pointer for TimeTraceProfilerInstance with unique_ptr.

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

4 years ago[Tooling/Syntax] Helpers to find spelled tokens touching a location.
Sam McCall [Wed, 11 Dec 2019 14:40:23 +0000 (15:40 +0100)]
[Tooling/Syntax] Helpers to find spelled tokens touching a location.

Summary: Useful when positions are used to target nodes, with before/after ambiguity.

Reviewers: ilya-biryukov, kbobyrev

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[clangd] Fix windows tests
Kadir Cetinkaya [Thu, 12 Dec 2019 11:53:58 +0000 (12:53 +0100)]
[clangd] Fix windows tests

4 years ago[NFC] - Partially revert 9c48c2f9c477007234c
Gabor Buella [Thu, 12 Dec 2019 11:46:17 +0000 (12:46 +0100)]
[NFC] - Partially revert 9c48c2f9c477007234c

4 years ago[llvm-readobj][test] - Add a test for testing regular section flags and cleanup flags...
Georgii Rymar [Wed, 11 Dec 2019 10:38:52 +0000 (13:38 +0300)]
[llvm-readobj][test] - Add a test for testing regular section flags and cleanup flags testing.

This:
1) Adds a test for testing all section flags (`section-flags.test`).
2) Renames `sec-flags.test`->`section-arch-flags.test`
   and performs a clean up.
3) Removes `compression.zlib.style.elf-x86-64` binary and a test case
   for SHF_COMPRESSED flag, because them are now excessive.
4) Adds missing MIPS flags and a test for SHF_ARM_PURECODE.

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

4 years ago[lldb] Remove ClangASTMetrics
Raphael Isemann [Thu, 12 Dec 2019 10:45:06 +0000 (11:45 +0100)]
[lldb] Remove ClangASTMetrics

Summary: Not once have I looked at these numbers in a log and considered them useful. Also this should not have been implemented via an unguarded list of globals.

Reviewers: martong, shafik

Reviewed By: shafik

Subscribers: rnkovacs, JDevlieghere, lldb-commits

Tags: #lldb

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

4 years ago[lldb] "See through" atomic types in ClangASTContext
Pavel Labath [Mon, 9 Dec 2019 17:24:45 +0000 (18:24 +0100)]
[lldb] "See through" atomic types in ClangASTContext

Summary:
This enables us to display the contents of atomic structs. Calling the
removal of _Atomic "desugaring" is not fully correct as it does more
than remove sugar, but it is the right thing to do for most of the
things that we care about. We can change this back once we decide to
support atomic types more comprehensively.

Reviewers: teemperor, shafik

Subscribers: jfb, lldb-commits

Tags: #lldb

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

4 years ago[clangd] Fix hover crashing on null types
Kadir Cetinkaya [Thu, 12 Dec 2019 09:41:27 +0000 (10:41 +0100)]
[clangd] Fix hover crashing on null types

Summary: Fixes https://github.com/clangd/clangd/issues/225

Reviewers: sammccall, ilya-biryukov

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

Tags: #clang

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

4 years ago[Mips] Add support for min/max/umin/umax atomics
Mirko Brkusanin [Thu, 12 Dec 2019 10:19:41 +0000 (11:19 +0100)]
[Mips] Add support for min/max/umin/umax atomics

In order to properly implement these atomic we need one register more than other
binary atomics. It is used for storing result from comparing values in addition
to the one that is used for actual result of operation.

https://reviews.llvm.org/D71028

4 years agoTemporarily Revert "[DataLayout] Fix occurrences that size and range of pointers...
Nicola Zaghen [Thu, 12 Dec 2019 10:25:14 +0000 (10:25 +0000)]
Temporarily Revert "[DataLayout] Fix occurrences that size and range of pointers are assumed to be the same."

This reverts commit 5f6208778ff92567c57d7c1e2e740c284d7e69a5.

This caused failures in Transforms/PhaseOrdering/scev-custom-dl.ll
const: Assertion `getBitWidth() == CR.getBitWidth() && "ConstantRange types don't agree!"' failed.

4 years ago[NFC] - Typo fix in test/CodeGenCXX/runtime-dllstorage.cpp
Gabor Buella [Thu, 12 Dec 2019 10:26:54 +0000 (11:26 +0100)]
[NFC] - Typo fix in test/CodeGenCXX/runtime-dllstorage.cpp

Reviewed By: Jim

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

4 years ago[lldb][NFC] Don't implement ClangASTContext::SetMetadata again as a static method
Raphael Isemann [Thu, 12 Dec 2019 09:53:16 +0000 (10:53 +0100)]
[lldb][NFC] Don't implement ClangASTContext::SetMetadata again as a static method

We always have an ClangASTContext when we call this method so we might as
well always call the non-static version.

4 years ago[DataLayout] Fix occurrences that size and range of pointers are assumed to be the...
Nicola Zaghen [Mon, 2 Dec 2019 11:13:43 +0000 (11:13 +0000)]
[DataLayout] Fix occurrences that size and range of pointers are assumed to be the same.

GEP index size can be specified in the DataLayout, introduced in D42123. However, there were still places
in which getIndexSizeInBits was used interchangeably with getPointerSizeInBits. This notably caused issues
with Instcombine's visitPtrToInt; but the unit tests was incorrect, so this remained undiscovered.

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

Patch by Joseph Faulls!

4 years ago[Tooling] Move raw string literal out of a macro call. NFC
Ilya Biryukov [Thu, 12 Dec 2019 09:50:32 +0000 (10:50 +0100)]
[Tooling] Move raw string literal out of a macro call. NFC

Should fix buildbots with some older gcc versions.

4 years ago[AArch64][SVE] Remove nxv1f32 and nxv1f64 as legal types
Cullen Rhodes [Wed, 11 Dec 2019 13:56:40 +0000 (13:56 +0000)]
[AArch64][SVE] Remove nxv1f32 and nxv1f64 as legal types

Summary: Also cleans up ZPR register class definition.

Reviewers: sdesmalen, cameron.mcinally, efriedma

Reviewed By: efriedma

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl,
llvm-commits

Tags: #llvm

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

4 years ago[libomptarget][nfc] Add missing header for amdgcn/target_impl
Jon Chesterfield [Thu, 12 Dec 2019 09:35:39 +0000 (09:35 +0000)]
[libomptarget][nfc] Add missing header for amdgcn/target_impl

4 years ago[llvm-readobj][test] - Cleanup and split tests in tools/llvm-readobj folder.
Georgii Rymar [Tue, 10 Dec 2019 14:06:16 +0000 (17:06 +0300)]
[llvm-readobj][test] - Cleanup and split tests in tools/llvm-readobj folder.

tools/llvm-readobj currently contains tests that are either general for
all file types or that mix file types inside. This patch refactors
these test and leaves only general tests in that folder. All other
tests were moved to ELF/COFF/MachO and wasm accordingly.

I tried to minimize amount of changes, so most of the test parts
remained unchanged. Any further refactorings and improvements for
particular tests should be done independently from this patch.

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

4 years ago[NFC][llvm][MIRVRegNamerUtils] Moving methods around. Making some private.
Puyan Lotfi [Thu, 12 Dec 2019 08:27:47 +0000 (03:27 -0500)]
[NFC][llvm][MIRVRegNamerUtils] Moving methods around. Making some private.

Making all externally unused methods private in MIRVRegNamerUtils.h.
Moving or deleting a couple other methods around.

4 years agoRevert unintentional change to compiler-rt as part of the __bit_reference revert.
Eric Christopher [Thu, 12 Dec 2019 08:31:23 +0000 (00:31 -0800)]
Revert unintentional change to compiler-rt as part of the __bit_reference revert.

4 years ago[compiler-rt] Add a critical section when flushing gcov counters
Calixte Denizet [Tue, 10 Dec 2019 12:22:33 +0000 (13:22 +0100)]
[compiler-rt] Add a critical section when flushing gcov counters

Summary:
Counters can be flushed in a multi-threaded context for example when the process is forked in different threads (https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp#L632-L663).
In order to avoid pretty bad things, a critical section is needed around the flush.
We had a lot of crashes in this code in Firefox CI when we switched to clang for linux ccov builds and those crashes disappeared with this patch.

Reviewers: marco-c, froydnj, dmajor, davidxl, vsk

Reviewed By: marco-c, dmajor

Subscribers: ahatanak, froydnj, dmajor, dberris, jfb, #sanitizers, llvm-commits, sylvestre.ledru

Tags: #sanitizers, #llvm

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

4 years agoTemporarily Revert "[libc++] Fix -Wdeprecated-copy warnings in __bit_reference"
Eric Christopher [Thu, 12 Dec 2019 08:22:07 +0000 (00:22 -0800)]
Temporarily Revert "[libc++] Fix -Wdeprecated-copy warnings in __bit_reference"
as it's causing test failures due to mismatched visibility.

This reverts commit 02bb20223bda5add729402962c70d0ebd0d98af2.

4 years ago[DWARF5][DWARFVerifier] Check that Skeleton compilation unit does not have children.
Alexey Lapshin [Tue, 10 Dec 2019 10:00:19 +0000 (13:00 +0300)]
[DWARF5][DWARFVerifier] Check that Skeleton compilation unit does not have children.

  That patch adds checking into DWARFVerifier that the Skeleton
compilation unit does not have children.

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

4 years agoRevert "[ARM][MVE] Sink vector shift operand"
Sam Parker [Thu, 12 Dec 2019 07:52:18 +0000 (07:52 +0000)]
Revert "[ARM][MVE] Sink vector shift operand"

This reverts commit e0b966643fc2030442ffbae9b677247be697673b.

Instruction selection is failing with expensive checks.

4 years ago[libc++] Fix -Wdeprecated-copy warnings in __bit_reference
Eric Christopher [Thu, 12 Dec 2019 07:49:07 +0000 (23:49 -0800)]
[libc++] Fix -Wdeprecated-copy warnings in __bit_reference

Add a couple of default copy constructors to fix the warning.

Reviewed By: dblaikie

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

4 years ago[ARM][MVE] Sink vector shift operand
Sam Parker [Thu, 12 Dec 2019 07:34:49 +0000 (07:34 +0000)]
[ARM][MVE] Sink vector shift operand

The shift amount operand can be provided in a general purpose
register so sink it. Flip the vdup and negate so the existing
patterns can be used for matching.

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

4 years agoFix an error in the block ABI documentation sample code
Akira Hatanaka [Thu, 12 Dec 2019 07:17:49 +0000 (23:17 -0800)]
Fix an error in the block ABI documentation sample code

rdar://problem/38663011

4 years ago[Syntax] Build nodes for simple cases of top level declarations
Ilya Biryukov [Thu, 12 Dec 2019 07:04:21 +0000 (08:04 +0100)]
[Syntax] Build nodes for simple cases of top level declarations

Summary:
More complicated nodes (e.g. template declarations) will be implemented
in the follow-up patches.

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: merge_guards_bot, cfe-commits

Tags: #clang

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

4 years ago[OpenMP][Docs] Mark 5.0 features worked on and list 5.1 features
Johannes Doerfert [Thu, 12 Dec 2019 05:59:46 +0000 (23:59 -0600)]
[OpenMP][Docs] Mark 5.0 features worked on and list 5.1 features

4 years ago[AutoFDO] Statistic for context sensitive profile guided inlining
Wenlei He [Fri, 22 Nov 2019 07:59:41 +0000 (23:59 -0800)]
[AutoFDO] Statistic for context sensitive profile guided inlining

Summary: AutoFDO compilation has two places that do inlining - the sample profile loader that does inlining with context sensitive profile, and the regular inliner as CGSCC pass. Ideally we want most inlining to come from sample profile loader as that is driven by context sensitive profile and also retains context sensitivity after inlining. However the reality is most of the inlining actually happens during regular inliner. To track the number of inline instances from sample profile loader and help move more inlining to sample profile loader, I'm adding statistics and optimization remarks for sample profile loader's inlining.

Reviewers: wmi, davidxl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agogn build: (manually) merge 5d986953c8b917bacfaa1f800fc1e242559f76be
Nico Weber [Thu, 12 Dec 2019 03:48:38 +0000 (22:48 -0500)]
gn build: (manually) merge 5d986953c8b917bacfaa1f800fc1e242559f76be

4 years ago[llvm][MIRVRegNamerUtils] Adding hashing on memoperands.
Puyan Lotfi [Wed, 11 Dec 2019 06:39:17 +0000 (01:39 -0500)]
[llvm][MIRVRegNamerUtils] Adding hashing on memoperands.

No more hash collisions for memoperands. Now the MIRCanonicalization
pass shouldn't hit hash collisions when dealing with nearly identical
memory accessing instructions when their memoperands are in fact different.

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

4 years ago[AArch64][SVE] Add patterns for scalable vselect
Cameron McInally [Wed, 11 Dec 2019 23:07:07 +0000 (17:07 -0600)]
[AArch64][SVE] Add patterns for scalable vselect

This patch matches scalable vector selects to predicated move instructions.

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

4 years ago[IR] Split out target specific intrinsic enums into separate headers
Reid Kleckner [Wed, 11 Dec 2019 15:55:26 +0000 (07:55 -0800)]
[IR] Split out target specific intrinsic enums into separate headers

This has two main effects:
- Optimizes debug info size by saving 221.86 MB of obj file size in a
  Windows optimized+debug build of 'all'. This is 3.03% of 7,332.7MB of
  object file size.
- Incremental step towards decoupling target intrinsics.

The enums are still compact, so adding and removing a single
target-specific intrinsic will trigger a rebuild of all of LLVM.
Assigning distinct target id spaces is potential future work.

Part of PR34259

Reviewers: efriedma, echristo, MaskRay

Reviewed By: echristo, MaskRay

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

4 years agoRename TTI::getIntImmCost for instructions and intrinsics
Reid Kleckner [Wed, 11 Dec 2019 19:54:58 +0000 (11:54 -0800)]
Rename TTI::getIntImmCost for instructions and intrinsics

Soon Intrinsic::ID will be a plain integer, so this overload will not be
possible.

Rename both overloads to ensure that downstream targets observe this as
a build failure instead of a runtime failure.

Split off from D71320

Reviewers: efriedma

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

4 years ago[Remarks][Driver] Ask for line tables when remarks are enabled
Francis Visoiu Mistrih [Tue, 10 Dec 2019 23:10:52 +0000 (15:10 -0800)]
[Remarks][Driver] Ask for line tables when remarks are enabled

Serialized remarks contain debug locations for each remark, by storing a
file path, a line, and a column.

Also, remarks support being embedded in a .dSYM bundle using a separate
section in object files, that is found by `dsymutil` through the debug
map.

In order for tools to map addresses to source and display remarks in the
source, we need line tables, and in order for `dsymutil` to find the
object files containing the remark section, we need to keep the debug
map around.

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

4 years agogn build: (manually) merge d23c61490c
Nico Weber [Thu, 12 Dec 2019 01:41:18 +0000 (20:41 -0500)]
gn build: (manually) merge d23c61490c

4 years ago[libc++abi] Fix non-constant initialization of default terminate
Eric Fiselier [Thu, 12 Dec 2019 01:32:14 +0000 (20:32 -0500)]
[libc++abi] Fix non-constant initialization of default terminate
handlers.

4 years ago[libc++] Require C++14 in all cases.
Eric Fiselier [Thu, 12 Dec 2019 01:26:30 +0000 (20:26 -0500)]
[libc++] Require C++14 in all cases.

LLVM has moved to C++14, and the libc++ build should too.
C++14 is needed to provide constant initialization for certain global
objects.

I suspect this change may break some older GCC buildbots, and I'll clean
those up as they fall.

4 years ago[analyzer] Do not cache out on some shared implicit AST nodes
Gabor Horvath [Wed, 11 Dec 2019 19:34:44 +0000 (11:34 -0800)]
[analyzer] Do not cache out on some shared implicit AST nodes

Some AST nodes which stands for implicit initialization is shared. The analyzer
will do the same evaluation on the same nodes resulting in the same state. The
analyzer will "cache out", i.e. it thinks that it visited an already existing
node in the exploded graph. This is not true in this case and we lose coverage.
Since these nodes do not really require any processing from the analyzer
we just omit them from the CFG.

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

4 years ago[AArch64][x86] add tests for possible infinite loops in DAGCombiner; NFC
Sanjay Patel [Thu, 12 Dec 2019 00:38:37 +0000 (19:38 -0500)]
[AArch64][x86] add tests for possible infinite loops in DAGCombiner; NFC

This is a reduction of a test that failed (infinite looped)
with rGd1f0bdf2d2df (subsequently reverted). I've duplicated
it for 2 targets to increase coverage - everything down here
is wobbly.

4 years agoRevert "[clang][clang-scan-deps] Aggregate the full dependency information."
Michael Spencer [Thu, 12 Dec 2019 00:34:31 +0000 (16:34 -0800)]
Revert "[clang][clang-scan-deps] Aggregate the full dependency information."

This reverts commit f978ea498309adaebab8fbf1cd6e520e7e0e11f1.

It broke clang-ppc64be-linux, but not sure why yet.

4 years agoRevert "[DWARF] Allow cross-CU references of subprogram definitions"
Vedant Kumar [Wed, 11 Dec 2019 23:55:48 +0000 (15:55 -0800)]
Revert "[DWARF] Allow cross-CU references of subprogram definitions"

This reverts commit 30038da15b18ac4e34b9ea7a648382ae481e4770. It causes
the stage2 thinLTO bot to fail with:

Assertion failed: (CU.getDIE(CalleeSP) && "Expected declaration subprogram DIE for callee")

rdar://57840415

4 years ago[OpenMP] Use the OpenMP-IR-Builder
Johannes Doerfert [Tue, 5 Nov 2019 05:00:36 +0000 (23:00 -0600)]
[OpenMP] Use the OpenMP-IR-Builder

This is a follow up patch to use the OpenMP-IR-Builder, as discussed on
the mailing list ([1] and later) and at the US Dev Meeting'19.

[1] http://lists.flang-compiler.org/pipermail/flang-dev_lists.flang-compiler.org/2019-May/000197.html

Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim

Subscribers: ppenzin, penzn, llvm-commits, cfe-commits, jfb, guansong, bollu, hiraditya, mgorny

Tags: #clang

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

4 years ago[clang][clang-scan-deps] Aggregate the full dependency information.
Michael Spencer [Mon, 28 Oct 2019 21:26:45 +0000 (14:26 -0700)]
[clang][clang-scan-deps] Aggregate the full dependency information.

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

4 years ago[lit] Improve formatting of error messages. NFC
Julian Lettner [Tue, 26 Feb 2019 06:41:52 +0000 (22:41 -0800)]
[lit] Improve formatting of error messages. NFC

4 years ago[lldb/CMake] Simplify linking against curses
Jonas Devlieghere [Wed, 11 Dec 2019 22:27:58 +0000 (14:27 -0800)]
[lldb/CMake] Simplify linking against curses

Centralize the logic to determine what libraries to link against for
curses in the CMake file where it is actually being used. Use
target_include_directories instead of include_directories.

4 years agoSuppress false-positive -Wuninitialized warnings in the constructor of a
Richard Smith [Wed, 11 Dec 2019 22:25:43 +0000 (14:25 -0800)]
Suppress false-positive -Wuninitialized warnings in the constructor of a
templated but non-template class.

4 years agoDon't call export_symbols.py with duplicate libs
David Tenty [Wed, 11 Dec 2019 22:21:54 +0000 (17:21 -0500)]
Don't call export_symbols.py with duplicate libs

Summary:
export_symbols.py discards duplicate symbols, assuming they have public definitions, so if we end
up calling it with duplicate libraries we will end up with an inaccurate export list.

Reviewers: jasonliu, stevewan, john.brawn

Reviewed By: john.brawn

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

4 years ago[lldb/Host] Use Host/Config.h for LibXML2 instead of a global define
Jonas Devlieghere [Wed, 11 Dec 2019 22:10:38 +0000 (14:10 -0800)]
[lldb/Host] Use Host/Config.h for LibXML2 instead of a global define

Rename LIBXML2_DEFINED to LLDB_ENABLE_LIBXML2 and pass it through
Config.h instead of a global define.

4 years ago[lldb][dotest] Add `#include <algorithm>` to libc++ detection
Jordan Rupprecht [Wed, 11 Dec 2019 22:02:22 +0000 (14:02 -0800)]
[lldb][dotest] Add `#include <algorithm>` to libc++ detection

Summary: Speculative fix after 34ef51b5f979 broke the lldb buildbot on libc++ tests.

Reviewers: echristo, EricWF

Subscribers: ldionne, lldb-commits

Tags: #lldb

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

4 years agoFix detection of __attribute__((may_alias)) to properly look through
Richard Smith [Wed, 11 Dec 2019 22:03:35 +0000 (14:03 -0800)]
Fix detection of __attribute__((may_alias)) to properly look through
type sugar.

We previously missed the attribute in a lot of cases in C++, because
there's often other type sugar there (eg, ElaboratedType).

4 years agoRevert "[SDAG] remove use restriction in isNegatibleForFree() when called from getNeg...
Sanjay Patel [Wed, 11 Dec 2019 21:56:18 +0000 (16:56 -0500)]
Revert "[SDAG] remove use restriction in isNegatibleForFree() when called from getNegatedExpression()"

This reverts commit d1f0bdf2d2df9bdf11ee2ddfff3df50e53f2f042.
The patch can cause infinite loops in DAGCombiner.

4 years ago[lldb][dotest] Improve libc++ detection
Jordan Rupprecht [Wed, 11 Dec 2019 00:48:33 +0000 (16:48 -0800)]
[lldb][dotest] Improve libc++ detection

Summary: The test logic for running libc++ tests only looks to see if `/usr/include/c++/v1` exists. This adds a fallback for including libc++ tests as long as `$(CC) -stdlib=libc++` works.

Reviewers: labath, EricWF

Subscribers: ldionne, lldb-commits

Tags: #lldb

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

4 years ago[libc++] Fix fuzzing tests with older GCC compilers.
Eric Fiselier [Wed, 11 Dec 2019 21:36:21 +0000 (16:36 -0500)]
[libc++] Fix fuzzing tests with older GCC compilers.

GCC 5 doesn't support `if constexpr`, so we need to do old-style tag
dispatching.

4 years agoAdd resurrecting Type Validators to projects.rst
Adrian Prantl [Wed, 11 Dec 2019 21:30:05 +0000 (13:30 -0800)]
Add resurrecting Type Validators to projects.rst

4 years ago[libc++] Fix fuzzing unit tests with exceptions disabled.
Eric Fiselier [Wed, 11 Dec 2019 21:21:23 +0000 (16:21 -0500)]
[libc++] Fix fuzzing unit tests with exceptions disabled.

We simply turn off the parts of the tests that require exceptions.

4 years ago[OPENMP50]Add if clause in teams distribute parallel for simd directive.
Alexey Bataev [Wed, 11 Dec 2019 20:26:38 +0000 (15:26 -0500)]
[OPENMP50]Add if clause in teams distribute parallel for simd directive.

According to OpenMP 5.0, if clause can be used in for simd directive. If
condition in the if clause if false, the non-vectorized version of the
loop must be executed.

4 years ago[TSan] Pacify flaky test on Darwin
Julian Lettner [Wed, 11 Dec 2019 20:49:19 +0000 (12:49 -0800)]
[TSan] Pacify flaky test on Darwin

This flaky test that I added really gives our CI a lot of headaches.
Although I was never able to reproduce this locally, it sporadically
hangs/fails on our bots.  I decided to silently pass the test whenever
we are unable to setup the proper test condition after 10 retries.  This
is of course suboptimal and a last recourse.  Please let me know if you
know how to test this better.

rdar://57844626

4 years ago[LegalizeTypes] In SoftenFloatRes_FP_EXTEND, move the check for input already being...
Craig Topper [Wed, 11 Dec 2019 20:45:54 +0000 (12:45 -0800)]
[LegalizeTypes] In SoftenFloatRes_FP_EXTEND, move the check for input already being promoted above the check for fp16 converting to something other than fp32.

The fp16 to larger than fp32 inserts an extend that need to
re-legalized if fp16 is promoted. But if we check for fp16
promotion first, then we can avoid emiting the fp_extend all
together.

4 years ago[libc++] Add fuzzing tests for parts of <random>.
Eric Fiselier [Wed, 11 Dec 2019 20:45:48 +0000 (15:45 -0500)]
[libc++] Add fuzzing tests for parts of <random>.

This patch also re-names the existing fuzzing unit tests so they
actually run.

4 years ago[ADT] Fix SmallDenseMap assertion with large InlineBuckets
Nikita Popov [Wed, 11 Dec 2019 20:17:29 +0000 (21:17 +0100)]
[ADT] Fix SmallDenseMap assertion with large InlineBuckets

Fixes issue encountered in D56362, where I tried to use a
SmallSetVector<Instruction*, 128> with an excessively large number
of inline elements. This triggers an "Must allocate more buckets
than are inline" assertion inside allocateBuckets() under certain
usage patterns.

The issue is as follows: The grow() method is used either to grow
the map, or to rehash it and remove tombstones. The latter is done
if the fraction of empty (non-used, non-tombstone) elements is
below 1/8. In this case grow() is invoked with the current number
of buckets.

This is currently incorrectly handled for dense maps using the small
rep. The current implementation will switch them over to the large
rep, which violates the invariant that the large rep is only used
if there are more than InlineBuckets buckets.

This patch fixes the issue by staying in the small rep and only
moving the buckets. An alternative, if we do want to switch to the
large rep in this case, would be to relax the assertion in
allocateBuckets().

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

4 years ago[OpenMP] Introduce the OpenMP-IR-Builder
Johannes Doerfert [Wed, 6 Nov 2019 00:57:44 +0000 (18:57 -0600)]
[OpenMP] Introduce the OpenMP-IR-Builder

This is the initial patch for the OpenMP-IR-Builder, as discussed on the
mailing list ([1] and later) and at the US Dev Meeting'19.

The design is similar to D61953 but:
  - in a non-WIP status, with proper documentation and working.
  - using a OpenMPKinds.def file to manage lists of directives, runtime
    functions, types, ..., similar to the current Clang implementation.
  - restricted to handle only (simple) barriers, to implement most
    `#pragma omp barrier` directives and most implicit barriers.
  - properly hooked into Clang to be used if possible (D69922).
  - compatible with the remaining code generation.

Parts have been extracted into D69853.

The plan is to have multiple people working on moving logic from Clang
here once the initial scaffolding (=this patch) landed.

[1] http://lists.flang-compiler.org/pipermail/flang-dev_lists.flang-compiler.org/2019-May/000197.html

Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim

Subscribers: mgorny, hiraditya, bollu, guansong, jfb, cfe-commits, llvm-commits, penzn, ppenzin

Tags: #clang, #llvm

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

4 years agoreturn-object-by-reference ("non trivial") xfail on arm64 in TestTrivialABI.py
Jason Molenda [Wed, 11 Dec 2019 19:43:35 +0000 (11:43 -0800)]
return-object-by-reference ("non trivial") xfail on arm64 in TestTrivialABI.py

I don't think this test case can be handled correctly on AAPCS64.
The ABI says that the caller passes the address of the return object
in x8.  x8 is a caller-spilled (aka "volatile") register, and the
function is not required to preserve x8 or to copy the address back
into x8 on function exit like the SysV x86_64 ABI does with rax.
(from aapcs64: "there is no requirement for the callee to preserve the
value stored in x8")

From my quick reading of ABISysV_arm64, I worry that it may actually be
using the value in x8 at function exit, assuming it still has the
address of the return object -

    if (is_return_value) {
      // We are assuming we are decoding this immediately after returning from
      // a function call and that the address of the structure is in x8
      reg_info = reg_ctx->GetRegisterInfoByName("x8", 0);

This will work on trivial test programs / examples, but if the function
does another function call, or overwrites x8 as a scratch register, lldb
will provide incorrect values to the user.

ABIMacOSX_arm64 doesn't do this, but it also doesn't flag the value
as unavailable so we're providing incorrect values to the user all
the time.  I expect my fix will be to make ABIMacOSX_arm64 flag
the return value as unretrievable, unless I've misread the ABI.

4 years ago[WebAssembly] Add new `export_name` clang attribute for controlling wasm export names
Sam Clegg [Tue, 5 Nov 2019 18:15:56 +0000 (10:15 -0800)]
[WebAssembly] Add new `export_name` clang attribute for controlling wasm export names

This is equivalent to the existing `import_name` and `import_module`
attributes which control the import names in the final wasm binary
produced by lld.

This maps the existing

This attribute currently requires a string rather than using the
symbol name for a couple of reasons:

1. Avoid confusion with static and dynamic linking which is
   based on symbol name.  Exporting a function from a wasm module using
   this directive is orthogonal to both static and dynamic linking.
2. Avoids name mangling.

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

4 years ago[InstCombine] Optimize overflow check base on uadd.with.overflow result
Nikita Popov [Sun, 3 Nov 2019 09:50:56 +0000 (10:50 +0100)]
[InstCombine] Optimize overflow check base on uadd.with.overflow result

Fix for https://bugs.llvm.org/show_bug.cgi?id=40846.

This adds a combine for cases where a (a + b) < a style overflow
check is performed, but with a + b being the result of
uadd.with.overflow, so the overflow result is also already available
and we can just use it. Subsequently GVN/CSE will deduplicate the extracts.

We can run into this situation if you have both a uadd.with.overflow
and a manual add + overflow check in the same function (on the same
operands), in which case GVN will rewrite the add to the with.overflow
result and leave you with this pattern.

The implementation is a bit ugly because I'm handling the various
canonicalization edge cases.

This does not yet handle the negated version of this pattern.

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

4 years ago[analyzer] Escape symbols conjured into specific regions during a conservative EvalCall
Gabor Horvath [Tue, 10 Dec 2019 00:26:38 +0000 (16:26 -0800)]
[analyzer] Escape symbols conjured into specific regions during a conservative EvalCall

This patch introduced additional PointerEscape callbacks after conservative
calls for output parameters. This should not really affect the current
checkers but the upcoming FuchsiaHandleChecker relies on this heavily.

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

4 years ago[ValueTracking] Pointer is known nonnull after load/store
Danila Kutenin [Wed, 11 Dec 2019 19:30:54 +0000 (20:30 +0100)]
[ValueTracking] Pointer is known nonnull after load/store

If the pointer was loaded/stored before the null check, the check
is redundant and can be removed. For now the optimizers do not
remove the nullptr check, see https://gcc.godbolt.org/z/H2r5GG.
The patch allows to use more nonnull constraints. Also, it found
one more optimization in some PowerPC test. This is my first llvm
review, I am free to any comments.

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

4 years ago[ValueTracking] Add tests for non-null check after load/store; NFC
Danila Kutenin [Wed, 11 Dec 2019 19:24:02 +0000 (20:24 +0100)]
[ValueTracking] Add tests for non-null check after load/store; NFC

Tests for D71177.

4 years ago[analyzer] LocalizationChecker: Fix a crash on synthesized accessor stubs.
Artem Dergachev [Wed, 11 Dec 2019 19:03:38 +0000 (11:03 -0800)]
[analyzer] LocalizationChecker: Fix a crash on synthesized accessor stubs.

The checker was trying to analyze the body of every method in Objective-C
@implementation clause but the sythesized accessor stubs that were introduced
into it by 2073dd2d have no bodies.

4 years ago[analyzer] CStringChecker: Fix overly eager assumption that memcmp args overlap.
Artem Dergachev [Wed, 11 Dec 2019 02:23:39 +0000 (18:23 -0800)]
[analyzer] CStringChecker: Fix overly eager assumption that memcmp args overlap.

While analyzing code `memcmp(a, NULL, n);', where `a' has an unconstrained
symbolic value, the analyzer was emitting a warning about the *first* argument
being a null pointer, even though we'd rather have it warn about the *second*
argument.

This happens because CStringChecker first checks whether the two argument
buffers are in fact the same buffer, in order to take the fast path.
This boils down to assuming `a == NULL' to true. Then the subsequent check
for null pointer argument "discovers" that `a' is null.

Don't take the fast path unless we are *sure* that the buffers are the same.
Otherwise proceed as normal.

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

4 years ago[analyzer] CStringChecker: Improve warning messages.
Artem Dergachev [Wed, 11 Dec 2019 00:48:17 +0000 (16:48 -0800)]
[analyzer] CStringChecker: Improve warning messages.

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

4 years ago[MergeFuncs] Remove incorrect attribute copying
Nikita Popov [Sun, 8 Dec 2019 11:13:52 +0000 (12:13 +0100)]
[MergeFuncs] Remove incorrect attribute copying

Fix for https://bugs.llvm.org/show_bug.cgi?id=44236. This code was
originally introduced in rG36512330041201e10f5429361bbd79b1afac1ea1.
However, the attribute copying was done in the wrong place (in general
call replacement, not thunk generation) and a proper fix was
implemented in D12581.

Previously this code was just unnecessary but harmless (because
FunctionComparator ensured that the attributes of the two functions
are exactly the same), but since byval was changed to accept a type
this copying is actively wrong and may result in malformed IR.

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

4 years agoFix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=Off builds after D65958 and D70450
Fangrui Song [Wed, 11 Dec 2019 18:59:45 +0000 (10:59 -0800)]
Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=Off builds after D65958 and D70450

4 years agoAdd intrinsics for unary narrowing operations
Andrzej Warzynski [Tue, 10 Dec 2019 14:32:34 +0000 (14:32 +0000)]
Add intrinsics for unary narrowing operations

Summary:
The following intrinsics for unary narrowing operations are added:
 * @llvm.aarch64.sve.sqxtnb
 * @llvm.aarch64.sve.uqxtnb
 * @llvm.aarch64.sve.sqxtunb
 * @llvm.aarch64.sve.sqxtnt
 * @llvm.aarch64.sve.uqxtnt
 * @llvm.aarch64.sve.sqxtunt

Reviewers: sdesmalen, rengolin, efriedma

Reviewed By: efriedma

Subscribers: tschuett, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[VFS] Disable check for ../foo on Windows
Jonas Devlieghere [Wed, 11 Dec 2019 18:52:37 +0000 (10:52 -0800)]
[VFS] Disable check for ../foo on Windows

I'm not sure how .. is resolved on Windows. Disable it for now to make
the bots happy again.

4 years ago[AArch64] Be more careful to skip debug operands in LdSt Optimizier.
Florian Hahn [Wed, 11 Dec 2019 17:17:29 +0000 (17:17 +0000)]
[AArch64] Be more careful to skip debug operands in LdSt Optimizier.

This fixes crashes with $noreg operands.

4 years ago[StringRef] Test all default characters in unit test
Jonas Devlieghere [Wed, 11 Dec 2019 18:43:31 +0000 (10:43 -0800)]
[StringRef] Test all default characters in unit test

The default characters for trim, ltrim and rtrim are " \t\n\v\f\r" but
only spaces were tested. Test that the others are trimmed as well.

4 years ago[SDAG] remove use restriction in isNegatibleForFree() when called from getNegatedExpr...
Sanjay Patel [Wed, 11 Dec 2019 16:18:09 +0000 (11:18 -0500)]
[SDAG] remove use restriction in isNegatibleForFree() when called from getNegatedExpression()

This is an alternate fix for the bug discussed in D70595.
This also includes minimal tests for other in-tree targets
to show the problem more generally.

We check the number of uses as a predicate for whether some
value is free to negate, but that use count can change as we
rewrite the expression in getNegatedExpression(). So something
that was marked free to negate during the cost evaluation
phase becomes not free to negate during the rewrite phase (or
the inverse - something that was not free becomes free).
This can lead to a crash/assert because we expect that
everything in an expression that is negatible to be handled
in the corresponding code within getNegatedExpression().

This patch skips the use check during the rewrite phase.
So we determine that some expression isNegatibleForFree
(identically to without this patch), but during the rewrite,
don't rely on use counts to decide how to create the optimal
expression.

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

4 years ago[OPENMP50]Fix capturing of if condition in target parallel for simd
Alexey Bataev [Wed, 11 Dec 2019 17:59:01 +0000 (12:59 -0500)]
[OPENMP50]Fix capturing of if condition in target parallel for simd
directive.

Fixed capturing of the if condition if no modifer was specified in this
condition. Previously could capture it only in outer region and it could
lead to a compiler crash.

4 years ago[profile] Avoid allocating a page on the stack, NFC
Vedant Kumar [Wed, 11 Dec 2019 02:17:28 +0000 (18:17 -0800)]
[profile] Avoid allocating a page on the stack, NFC

When writing out a profile, avoid allocating a page on the stack for the
purpose of writing out zeroes, as some embedded environments do not have
enough stack space to accomodate this.

Instead, use a small, fixed-size zero buffer that can be written
repeatedly.

For a synthetic file with >100,000 functions, I did not measure a
significant difference in profile write times. We are removing a
page-length zero-fill `memset()` in favor of several smaller buffered
`fwrite()` calls: in practice, I am not sure there is much of a
difference. The performance impact is only expected to affect the
continuous sync mode (%c) -- zero padding is less than 8 bytes in all
other cases.

rdar://57810014

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

4 years ago[profile] Delete stale profiles in test/profile/instrprof-value-prof.test, NFC
Vedant Kumar [Wed, 11 Dec 2019 02:16:59 +0000 (18:16 -0800)]
[profile] Delete stale profiles in test/profile/instrprof-value-prof.test, NFC

4 years ago[profile] Delete stale profile in test/profile/instrprof-set-filename.c, NFC
Vedant Kumar [Tue, 10 Dec 2019 23:47:31 +0000 (15:47 -0800)]
[profile] Delete stale profile in test/profile/instrprof-set-filename.c, NFC

4 years ago[VFS] Extend virtual working directory test
Jonas Devlieghere [Wed, 11 Dec 2019 17:50:00 +0000 (09:50 -0800)]
[VFS] Extend virtual working directory test

Extend the virtual working directory test with a few edge cases that are
not currently tested.

4 years ago[OPENMP50]Add if clause in teams distribute simd directive.
Alexey Bataev [Wed, 11 Dec 2019 16:20:47 +0000 (11:20 -0500)]
[OPENMP50]Add if clause in teams distribute simd directive.

According to OpenMP 5.0, if clause can be used in for simd directive. If
condition in the if clause if false, the non-vectorized version of the
loop must be executed.

4 years agoRemove TypeValidators (NFC in terms of the testsuite)
Adrian Prantl [Tue, 10 Dec 2019 23:32:57 +0000 (15:32 -0800)]
Remove TypeValidators (NFC in terms of the testsuite)

This is a half-implemented feature that as far as we can tell was
never used by anything since its original inclusion in 2014. This
patch removes it to make remaining the code easier to understand.

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

4 years ago[ELF][AArch64] Rename --force-bti to -z force-bti and --pac-plt to -z pac-plt
Fangrui Song [Wed, 11 Dec 2019 06:07:17 +0000 (22:07 -0800)]
[ELF][AArch64] Rename --force-bti to -z force-bti and --pac-plt to -z pac-plt

Summary:
The original design used --foo but the upstream complained that ELF only
options should be -z foo. See https://sourceware.org/ml/binutils/2019-04/msg00151.html
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=8bf6d176b0a442a8091d338d4af971591d19922c
made the rename.

Our --force-bti and --pac-plt implement the same functionality, so it
seems wise to be consistent with GNU ld.

Reviewed By: peter.smith

Subscribers: emaste, arichardson, kristof.beyls, llvm-commits

Tags: #llvm

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

4 years agoupdate TestThreadStepOut.py to expect correct source line on arm64.
Jason Molenda [Wed, 11 Dec 2019 17:14:52 +0000 (09:14 -0800)]
update TestThreadStepOut.py to expect correct source line on arm64.

4 years ago[DA] Improve dump to show source and sink of the dependence
Bardia Mahjour [Wed, 11 Dec 2019 16:48:16 +0000 (11:48 -0500)]
[DA] Improve dump to show source and sink of the dependence

Summary:
The current da printer shows the dependence without indicating
which instructions are being considered as the src vs dst. It
also silently ignores call instructions, despite the fact that
they create confused dependence edges to other memory
instructions. This patch addresses these two issues plus a
couple of minor non-functional improvements.

Authored By: bmahjour

Reviewer: dmgreen, fhahn, philip.pfaffe, chandlerc

Reviewed By: dmgreen, fhahn

Tags: #llvm

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

4 years agoDon't run expect based tests remotely.
Jason Molenda [Wed, 11 Dec 2019 16:29:18 +0000 (08:29 -0800)]
Don't run expect based tests remotely.

4 years ago[AArch64] Skip debug ops with regsOverlap in AArch64 LD/ST opt.
Florian Hahn [Wed, 11 Dec 2019 16:24:38 +0000 (16:24 +0000)]
[AArch64] Skip debug ops with regsOverlap in AArch64 LD/ST opt.

This fixes a crash when debug instructions are in between 2 stores.

4 years ago[SystemZ] Add llvm.minimum / llvm.maximum tests
Ulrich Weigand [Wed, 11 Dec 2019 15:59:54 +0000 (16:59 +0100)]
[SystemZ] Add llvm.minimum / llvm.maximum tests

The backend already supports the @llvm.minimum and @llvm.maximum
intrinsics, but we had no test cases for those.  Add tests.

4 years ago[X86] Erase dead LEA instruction after converting it to MOV in FixupLEAPass::processI...
Craig Topper [Wed, 11 Dec 2019 15:51:02 +0000 (07:51 -0800)]
[X86] Erase dead LEA instruction after converting it to MOV in FixupLEAPass::processInstrForSlow3OpLEA.

4 years ago[TableGen] Remove unused target intrinsic generation logic
Reid Kleckner [Wed, 11 Dec 2019 15:37:16 +0000 (07:37 -0800)]
[TableGen] Remove unused target intrinsic generation logic

AMDGPU was the last in tree target to use this tablegen mode. I plan to
split up the global intrinsic enum similar to the way that clang
diagnostics are split up today. I don't plan to build on this mode.

Reviewers: arsenm, echristo, efriedma

Reviewed By: echristo

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

4 years ago[SystemZ] Fix 128-bit strict FMA expansion pre-z14
Ulrich Weigand [Wed, 11 Dec 2019 15:28:14 +0000 (16:28 +0100)]
[SystemZ] Fix 128-bit strict FMA expansion pre-z14

Before z14, we did not have any FMA instruction for 128-bit
floating-point, so the @llvm.fma.f128 intrinsic needs to be
expanded to a libcall on those platforms.

This worked correctly for regular FMA, but was implemented
incorrectly for the strict version.  This was not noticed
because we did not have test coverage for this case.

This patch fixes that incorrect expansion and adds the
missing test cases.

4 years ago[Loop] Add isRotated method to Loop class.
Kit Barton [Tue, 3 Dec 2019 19:20:08 +0000 (14:20 -0500)]
[Loop] Add isRotated method to Loop class.

Summary:
This patch adds a method to determine if a loop is in rotated form (the latch is
an exiting block). It also modifies the getLoopGuardBranch method to use this
new method. This method can also be used in Loopfusion. Once this patch lands I
will make the corresponding changes there.

Reviewers: jdoerfert, Meinersbur, dmgreen, etiotto, Whitney, fhahn, hfinkel

Reviewed By: Meinersbur

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Support] Add TimeTraceScope constructor without detail arg
Russell Gallop [Wed, 11 Dec 2019 11:49:42 +0000 (11:49 +0000)]
[Support] Add TimeTraceScope constructor without detail arg

This simplifies code where no extra details are required
Also don't write out detail when it is empty.

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

4 years ago[ARM][NFC] Change test to use CHECK-NEXT
Diogo Sampaio [Wed, 11 Dec 2019 14:24:40 +0000 (14:24 +0000)]
[ARM][NFC] Change test to use CHECK-NEXT

4 years agoVerifier: Check frame-pointer attribute values
Matt Arsenault [Tue, 10 Dec 2019 11:12:48 +0000 (16:42 +0530)]
Verifier: Check frame-pointer attribute values

There are a few places that check specific string attributes have
particular values, and assert if they are something else. The verifier
should catch these kinds of cases.