platform/upstream/llvm.git
4 years ago[mlir] Use dynamic_tensor_from_elements in shape.broadcast conversion
Sean Silva [Mon, 19 Oct 2020 01:34:05 +0000 (18:34 -0700)]
[mlir] Use dynamic_tensor_from_elements in shape.broadcast conversion

Now, convert-shape-to-std doesn't internally create memrefs, which was
previously a bit of a layering violation. The conversion to memrefs
should logically happen as part of bufferization.

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

4 years ago[mlir][DialectConversion] Fix recursive `clone` calls.
Sean Silva [Mon, 19 Oct 2020 04:10:55 +0000 (21:10 -0700)]
[mlir][DialectConversion] Fix recursive `clone` calls.

The framework was not tracking ops created in any regions of the cloned
op.

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

4 years ago[mlir] Add std.dynamic_tensor_from_elements bufferization.
Sean Silva [Fri, 16 Oct 2020 22:57:27 +0000 (15:57 -0700)]
[mlir] Add std.dynamic_tensor_from_elements bufferization.

It's unfortunate that this requires adding a dependency on scf dialect
to std bufferization (and hence all of std transforms). This is a bit
perilous. We might want a lib/Transforms/Bufferize/ with a separate
bufferization library per dialect?

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

4 years ago[mlir] Add some more std bufferize patterns.
Sean Silva [Fri, 16 Oct 2020 20:50:34 +0000 (13:50 -0700)]
[mlir] Add some more std bufferize patterns.

Add bufferizations for extract_element and tensor_from_elements.

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

4 years agoReland "[Modules] Add stats to measure performance of building and loading modules."
Volodymyr Sapsai [Mon, 19 Oct 2020 20:39:47 +0000 (13:39 -0700)]
Reland "[Modules] Add stats to measure performance of building and loading modules."

Measure amount of high-level or fixed-cost operations performed during
building/loading modules and during header search. High-level operations
like building a module or processing a .pcm file are motivated by
previous issues where clang was re-building modules or re-reading .pcm
files unnecessarily. Fixed-cost operations like `stat` calls are tracked
because clang cannot change how long each operation takes but it can
perform fewer of such operations to improve the compile time.

Also tracking such stats over time can help us detect compile-time
regressions. Added stats are more stable than the actual measured
compilation time, so expect the detected regressions to be less noisy.

On relanding drop stats in MemoryBuffer.cpp as their value is pretty low
but affects a lot of clients and many of those aren't interested in
modules and header search.

rdar://problem/55715134

Reviewed By: aprantl, bruno

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

4 years ago[AMDGPU] flat scratch ST addressing mode on gfx10
Stanislav Mekhanoshin [Thu, 15 Oct 2020 21:57:34 +0000 (14:57 -0700)]
[AMDGPU] flat scratch ST addressing mode on gfx10

GFX10 enables third addressing mode for flat scratch instructions,
an ST mode. In that mode both register operands are omitted and
only swizzled offset is used in addition to flat_scratch base.

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

4 years ago[trace] rename ThreadIntelPT into TraceTrace
Walter Erquinigo [Wed, 14 Oct 2020 17:25:39 +0000 (10:25 -0700)]
[trace] rename ThreadIntelPT into TraceTrace

Renamed ThreadIntelPT to TreaceThread, making it a top-level class. I noticed that this class can and shuld work for any trace plugin and there's nothing intel-pt specific in it.
With that TraceThread change, I was able to move most of the json file parsing logic to the base class TraceSessionFileParser, which makes adding new plug-ins easier.

This originally was part of https://reviews.llvm.org/D89283

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

4 years ago[NFC] Inline assertion-only variable
Jordan Rupprecht [Mon, 19 Oct 2020 22:11:37 +0000 (15:11 -0700)]
[NFC] Inline assertion-only variable

4 years ago[VE] Fix initializer visibility
Sergei Trofimovich [Mon, 19 Oct 2020 21:51:12 +0000 (22:51 +0100)]
[VE] Fix initializer visibility

Before the change attempt to link libLTO.so against shared
LLVM library failed as:

```
[ 76%] Linking CXX shared library ../../lib/libLTO.so
... /usr/bin/cmake -E cmake_link_script CMakeFiles/LTO.dir/link.txt --verbose=1
c++ -o ...libLTO.so.12git ...ibLLVM-12git.so
ld: CMakeFiles/LTO.dir/lto.cpp.o: in function `llvm::InitializeAllTargetInfos()':
include/llvm/Config/Targets.def:31: undefined reference to `LLVMInitializeVETargetInfo'
```

It happens because on linux llvm build system sets default
symbol visibility to "hidden". The fix is to set visibility
back to "default" for exported APIs with LLVM_EXTERNAL_VISIBILITY.

Bug: https://bugs.llvm.org/show_bug.cgi?id=47847

Reviewed By: simoll

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

4 years agoRecommit "[CUDA][HIP] Defer overloading resolution diagnostics for host device functions"
Yaxun (Sam) Liu [Wed, 23 Sep 2020 22:00:23 +0000 (18:00 -0400)]
Recommit "[CUDA][HIP] Defer overloading resolution diagnostics for host device functions"

This recommits 7f1f89ec8d9944559042bb6d3b1132eabe3409de and
40df06cdafc010002fc9cfe1dda73d689b7d27a6 with bug fixes for
memory sanitizer failure and Tensile build failure.

4 years ago[NFC] Refactor DiagnosticBuilder and PartialDiagnostic
Yaxun (Sam) Liu [Wed, 23 Sep 2020 20:16:00 +0000 (16:16 -0400)]
[NFC] Refactor DiagnosticBuilder and PartialDiagnostic

PartialDiagnostic misses some functions compared to DiagnosticBuilder.

This patch refactors DiagnosticBuilder and PartialDiagnostic, extracts
the common functionality so that the streaming << operators are
shared.

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

4 years ago[NPM] Port module-debuginfo pass to the new pass manager
Amy Huang [Mon, 19 Oct 2020 21:31:17 +0000 (14:31 -0700)]
[NPM] Port module-debuginfo pass to the new pass manager

Port pass to NPM and update tests in DebugInfo/Generic.

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

4 years ago[NFCI][SCEV] Always refer to enum SCEVTypes as enum, not integer
Roman Lebedev [Mon, 19 Oct 2020 19:28:44 +0000 (22:28 +0300)]
[NFCI][SCEV] Always refer to enum SCEVTypes as enum, not integer

The main tricky thing here is forward-declaring the enum:
we have to specify it's underlying data type.

In particular, this avoids the danger of switching over the SCEVTypes,
but actually switching over an integer, and not being notified
when some case is not handled.

I have updated most of such switches to be exaustive and not have
a default case, where it's pretty obvious to be the intent,
however not all of them.

4 years ago[NFC][SCEV] BuildConstantFromSCEV(): reformat, NFC
Roman Lebedev [Mon, 19 Oct 2020 20:41:26 +0000 (23:41 +0300)]
[NFC][SCEV] BuildConstantFromSCEV(): reformat, NFC

Makes diff in next commit more readable

4 years ago[NFC][SCEVExpander] isHighCostExpansionHelper(): rewrite as a switch
Roman Lebedev [Mon, 19 Oct 2020 19:39:55 +0000 (22:39 +0300)]
[NFC][SCEVExpander] isHighCostExpansionHelper(): rewrite as a switch

If we switch over an enum, compiler can easily issue a diagnostic
if some case is not handled. However with an if cascade that isn't so.
Experimental evidence suggests new behavior to be superior.

4 years ago[Intrinsics] Added writeonly attribute to the first arg of llvm.memmove
Dávid Bolvanský [Mon, 19 Oct 2020 21:08:27 +0000 (23:08 +0200)]
[Intrinsics] Added writeonly attribute to the first arg of llvm.memmove

D18714 introduced writeonly attribute:

"Also start using the attribute for memset, memcpy, and memmove intrinsics,
and remove their special-casing in BasicAliasAnalysis."

But actually, writeonly was not attached to memmove - oversight, it seems.

So let's add it. As we can see, this helps DSE to eliminate redundant stores.

Reviewed By: jdoerfert

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

4 years ago[libcxx] [test] Use _putenv instead of setenv/unsetenv on windows
Martin Storsjö [Sun, 18 Oct 2020 20:19:29 +0000 (23:19 +0300)]
[libcxx] [test] Use _putenv instead of setenv/unsetenv on windows

Move the functions to the helper header and keep the arch specific
logic there.

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

4 years ago[libcxx] [test] Fix all remaining issues with fs::path::string_type being wstring
Martin Storsjö [Sun, 18 Oct 2020 19:47:50 +0000 (22:47 +0300)]
[libcxx] [test] Fix all remaining issues with fs::path::string_type being wstring

Use fs::path as variable type instead of std::string, when the input
potentially is a path, as they can't be implicitly converted back to
string.

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

4 years ago[libcxx] [test] Fix filesystem_test_helper.h to compile for windows
Martin Storsjö [Tue, 13 Oct 2020 18:42:31 +0000 (21:42 +0300)]
[libcxx] [test] Fix filesystem_test_helper.h to compile for windows

Use .string() instead of .native() in places where we want to combine
paths with std::string.

Convert some methods to take a fs::path as parameter instead of
std::string, for cases where they are called with paths as
parameters (which can't be implicitly converted to std::string if
the path's string_type is wstring).

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

4 years ago[libcxx] [test] Mark tests that require specific allocation behaviours as libcpp...
Martin Storsjö [Mon, 19 Oct 2020 08:44:19 +0000 (11:44 +0300)]
[libcxx] [test] Mark tests that require specific allocation behaviours as libcpp only

This fixes/silences a few failures on libstdc++ on linux.

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

4 years ago[libcxx] [test] Exclude domain socket tests on windows, like bsd/darwin
Martin Storsjö [Mon, 19 Oct 2020 08:07:31 +0000 (11:07 +0300)]
[libcxx] [test] Exclude domain socket tests on windows, like bsd/darwin

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

4 years ago[libcxx] [test] Add LIBCPP_ONLY() around another test for an implementation detail
Martin Storsjö [Mon, 19 Oct 2020 07:58:31 +0000 (10:58 +0300)]
[libcxx] [test] Add LIBCPP_ONLY() around another test for an implementation detail

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

4 years ago[libcxx] [test] Don't require fs::path::operator(string_type&&) to be noexcept
Martin Storsjö [Mon, 19 Oct 2020 08:46:08 +0000 (11:46 +0300)]
[libcxx] [test] Don't require fs::path::operator(string_type&&) to be noexcept

Mark this as a libcpp specific test; the standard doesn't say that
this method should be noexcept.

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

4 years ago[libcxx] [test] Allow fs::permissions(path, perms, perm_options, error_code) to be...
Martin Storsjö [Mon, 19 Oct 2020 08:46:58 +0000 (11:46 +0300)]
[libcxx] [test] Allow fs::permissions(path, perms, perm_options, error_code) to be noexcept

The standard doesn't declare this overload as noexcept, but doesn't
either say that it strictly cannot be noexcept either. The function
doesn't throw on errors that are signaled via error_code, but the
standard says that it may throw a bad_alloc.

This fixes an error with libstdc++ on linux.

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

4 years ago[libcxx] [test] Do error printfs to stderr in filesystems tests
Martin Storsjö [Mon, 19 Oct 2020 08:49:17 +0000 (11:49 +0300)]
[libcxx] [test] Do error printfs to stderr in filesystems tests

This makes them more readable in llvm-lit's output on failures.

This only applies the change on the filesystem test subdir.

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

4 years ago[clang] Automatically link against oldnames just as linking against libcmt
Martin Storsjö [Mon, 19 Oct 2020 13:10:18 +0000 (16:10 +0300)]
[clang] Automatically link against oldnames just as linking against libcmt

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

4 years agoclang/{Format,Rewrite}: Stop using SourceManager::getBuffer, NFC
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 16:58:19 +0000 (12:58 -0400)]
clang/{Format,Rewrite}: Stop using SourceManager::getBuffer, NFC

Update clang/lib/Format and clang/lib/Rewrite to use a `MemoryBufferRef`
from `getBufferOrFake` instead of `MemoryBuffer*` from `getBuffer`.

No functionality change here, since the call sites weren't checking if
the buffer was valid.

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

4 years agoAdd alloca size threshold for StackTagging initializer merging.
Evgenii Stepanov [Thu, 15 Oct 2020 23:10:42 +0000 (16:10 -0700)]
Add alloca size threshold for StackTagging initializer merging.

Summary:
Initializer merging generates pretty inefficient code for large allocas
that also happens to trigger an exponential algorithm somewhere in
Machine Instruction Scheduler. See https://bugs.llvm.org/show_bug.cgi?id=47867.

This change adds an upper limit for the alloca size. The default limit
is selected such that worst case size of memtag-generated code is
similar to non-memtag (but because of the ISA quirks, this case is
realized at the different value of alloca size, ex. memset inlining
triggers at sizes below 512, but stack tagging instructions are 2x
shorter, so limit is approx. 256).

We could try harder to emit more compact code with initializer merging,
but that would only affect large, sparsely initialized allocas, and
those are doing fine already.

Reviewers: vitalybuka, pcc

Subscribers: llvm-commits

4 years ago[test][NPM] Fix already-vectorized.ll under NPM
Arthur Eubanks [Mon, 19 Oct 2020 20:09:39 +0000 (13:09 -0700)]
[test][NPM] Fix already-vectorized.ll under NPM

The NPM runs SpeculateAroundPHIs which breaks critical edges, causing a
branch we check for to not directly jump back to the same block.

4 years ago[SelectionDAG][X86] Enable SimplifySetCC CTPOP transforms for vector splats
Craig Topper [Mon, 19 Oct 2020 19:03:04 +0000 (12:03 -0700)]
[SelectionDAG][X86] Enable SimplifySetCC CTPOP transforms for vector splats

This enables these transforms for vectors:
(ctpop x) u< 2 -> (x & x-1) == 0
(ctpop x) u> 1 -> (x & x-1) != 0
(ctpop x) == 1 --> (x != 0) && ((x & x-1) == 0)
(ctpop x) != 1 --> (x == 0) || ((x & x-1) != 0)

All enabled if CTPOP isn't Legal. This differs from the scalar
behavior where the first two are done unconditionally and the
last two are done if CTPOP isn't Legal or Custom. The Legal
check produced better results for vectors based on X86's
custom handling. Might be worth re-visiting scalars here.

I disabled the looking through truncate for vectors. The
code that creates new setcc can use the same result VT as the
original setcc even if we truncated the input. That may work
work for most scalars, but definitely wouldn't work for vectors
unless it was a vector of i1.

Fixes or at least improves PR47825

Reviewed By: spatel

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

4 years ago[X86] Add i32->float and i64->double bitcast pseudo instructions to store folding...
Craig Topper [Mon, 19 Oct 2020 18:50:47 +0000 (11:50 -0700)]
[X86] Add i32->float and i64->double bitcast pseudo instructions to store folding table.

We have pseudo instructions we use for bitcasts between these types.
We have them in the load folding table, but not the store folding
table. This adds them there so they can be used for stack spills.

I added an exact size check so that we don't fold when the stack slot
is larger than the GPR. Otherwise the upper bits in the stack slot
would be garbage. That would be fine for Eli's test case in PR47874,
but I'm not sure its safe in general.

A step towards fixing PR47874. Next steps are to change the ADDSSrr_Int
pseudo instructions to use FR32 as the second source register class
instead of VR128. That will keep the coalescer from promoting the
register class of the bitcast instruction which will make the stack
slot 4 bytes instead of 16 bytes.

Reviewed By: RKSimon

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

4 years agoFix typo
Matt Arsenault [Sat, 17 Oct 2020 14:12:30 +0000 (10:12 -0400)]
Fix typo

4 years ago[ORC] Fix a missing include.
Lang Hames [Mon, 19 Oct 2020 18:55:08 +0000 (11:55 -0700)]
[ORC] Fix a missing include.

4 years ago[NPM][test] Fix some LoopVectorize tests under NPM
Arthur Eubanks [Mon, 19 Oct 2020 19:04:31 +0000 (12:04 -0700)]
[NPM][test] Fix some LoopVectorize tests under NPM

4 years ago[BatchAA] Add test for incorrect phi cycle result (NFC)
Nikita Popov [Mon, 19 Oct 2020 18:51:37 +0000 (20:51 +0200)]
[BatchAA] Add test for incorrect phi cycle result (NFC)

AA computes the correct result for phi/a1 aliasing, while BatchAA
produces an incorrect result depening on which queries have been
performed beforehand.

4 years ago[AMDGPU] Correct comment typo in SIMemoryLegaliizer.cpp
Tony [Mon, 19 Oct 2020 17:19:30 +0000 (17:19 +0000)]
[AMDGPU] Correct comment typo in SIMemoryLegaliizer.cpp

4 years ago[NPM][opt] Run -O# after other passes in legacy PM compatibility mode
Arthur Eubanks [Mon, 19 Oct 2020 18:28:45 +0000 (11:28 -0700)]
[NPM][opt] Run -O# after other passes in legacy PM compatibility mode

Generally tests run -O# before other passes, not after.

4 years ago[flang][openacc] Switch to use TODO from D88909
Valentin Clement [Mon, 19 Oct 2020 18:47:12 +0000 (14:47 -0400)]
[flang][openacc] Switch to use TODO from D88909

Use the Todo.h header file introduce in D88909 to marke part of the lowering that are
not done yet.

Reviewed By: jeanPerier

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

4 years ago[LLDB][TestSuite] Improve skipIfWindowsAndNonEnglish in decorators.py
Alexandre Ganea [Mon, 19 Oct 2020 18:27:41 +0000 (14:27 -0400)]
[LLDB][TestSuite] Improve skipIfWindowsAndNonEnglish in decorators.py

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

4 years ago[SVE] Update vector reduction intrinsics in new tests.
Cameron McInally [Mon, 19 Oct 2020 18:26:29 +0000 (13:26 -0500)]
[SVE] Update vector reduction intrinsics in new tests.

Remove `experimental` from the intrinsic names.

4 years ago[libc] Add LLVM libc specific functions to llvm_libc_ext.td.
Michael Jones [Tue, 13 Oct 2020 23:20:50 +0000 (23:20 +0000)]
[libc] Add LLVM libc specific functions to llvm_libc_ext.td.

Also moved most of the common type definitions from libc/spec/stdc.td
to libc/spec/spec.td so that they can be used to list functions in llvm_libc_ext.td.

Reviewed By: sivachandra

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

4 years ago[AMDGPU] Remove MUL_LOHI_U24/MUL_LOHI_I24
Jay Foad [Mon, 19 Oct 2020 15:34:54 +0000 (16:34 +0100)]
[AMDGPU] Remove MUL_LOHI_U24/MUL_LOHI_I24

These were introduced in r279902 on the grounds that using separate
MUL_U24/MUL_I24 and MULHI_U24/MULHI_I24 nodes would introduce multiple
uses of the operands, which would prevent SimplifyDemandedBits from
simplifying the operands.

This has since been fixed by D24672 "AMDGPU/SI: Use new SimplifyDemandedBits helper for multi-use operations"

No functional change intended. At least it has no effect on lit tests.

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

4 years ago[OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts
Joseph Huber [Mon, 19 Oct 2020 13:07:02 +0000 (09:07 -0400)]
[OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts

The changes made in D88594 caused the test OpenMP/driver.c to fail on a 32-bit host becuase it was offloading to a 64-bit architecture by default. The offloading test was moved to a new file and a feature was added to the lit config to check for a 64-bit host.

Reviewed By: jdoerfert

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

4 years ago[LangRef] Define mustprogress attribute
Atmn Patel [Mon, 19 Oct 2020 17:29:10 +0000 (13:29 -0400)]
[LangRef] Define mustprogress attribute

LLVM IR currently assumes some form of forward progress. This form is
not explicitly defined anywhere, and is the cause of miscompilations
in most languages that are not C++11 or later. This implicit forward progress
guarantee can not be opted out of on a function level nor on a loop
level. Languages such as C (C11 and later), C++ (pre-C++11), and Rust
have different forward progress requirements and this needs to be
evident in the IR.

Specifically, C11 and onwards (6.8.5, Paragraph 6) states that "An
iteration statement whose controlling expression is not a constant
expression, that performs no input/output operations, does not access
volatile objects, and performs no synchronization or atomic operations
in its body, controlling expression, or (in the case of for statement)
its expression-3, may be assumed by the implementation to terminate."
C++11 and onwards does not have this assumption, and instead assumes
that every thread must make progress as defined in [intro.progress] when
it comes to scheduling.

This was initially brought up in [0] as a bug, a solution was presented
in [1] which is the current workaround, and the predecessor to this
change was [2].

After defining a notion of forward progress for IR, there are two
options to address this:
1) Set the default to assuming Forward Progress and provide an opt-out for functions and an opt-in for loops.
2) Set the default to not assuming Forward Progress and provide an opt-in for functions, and an opt-in for loops.

Option 2) has been selected because only C++11 and onwards have a
forward progress requirement and it makes sense for them to opt-into it
via the defined `mustprogress` function attribute.  The `mustprogress`
function attribute indicates that the function is required to make
forward progress as defined. This is sharply in contrast to the status
quo where this is implicitly assumed. In addition, `willreturn` implies `mustprogress`.

The background for why this definition was chosen is in [3] and for why
the option was chosen is in [4] and the corresponding thread(s). The implementation is in D85393, the
clang patch is in D86841, the LoopDeletion patch is in D86844, the
Inliner patches are in D87180 and D87262, and there will be more
incoming.

[0] https://bugs.llvm.org/show_bug.cgi?id=965#c25
[1] https://lists.llvm.org/pipermail/llvm-dev/2017-October/118558.html
[2] https://reviews.llvm.org/D65718
[3] https://lists.llvm.org/pipermail/llvm-dev/2020-September/144919.html
[4] https://lists.llvm.org/pipermail/llvm-dev/2020-September/145023.html

Reviewed By: jdoerfert, efriedma, nikic

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

4 years ago[clang] Use SourceLocation as key in std::map, NFCI
Mikhail Maltsev [Mon, 19 Oct 2020 17:30:51 +0000 (18:30 +0100)]
[clang] Use SourceLocation as key in std::map, NFCI

SourceLocation implements `operator<`, so `SourceLocation`-s can be used
as keys in `std::map` directly, there is no need to extract the internal
representation.

Since the `operator<` simply compares the internal representations of
its operands, this patch does not introduce any functional changes.

Reviewed By: dexonsmith

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

4 years ago[SCEV] Add tests where assumes can be used to improve tripe multiple.
Florian Hahn [Mon, 19 Oct 2020 16:25:34 +0000 (17:25 +0100)]
[SCEV] Add tests where assumes can be used to improve tripe multiple.

This patch adds a set of tests where information from assumes can be
used to improve the trip multiple.

See PR47904.

4 years ago[libc++] Add more tests for operator<< on std::complex
Louis Dionne [Fri, 16 Oct 2020 18:19:39 +0000 (14:19 -0400)]
[libc++] Add more tests for operator<< on std::complex

4 years ago[DAGCombiner][PowerPC] Remove isMulhCheaperThanMulShift TLI hook, Use isOperationLega...
Amy Kwan [Thu, 15 Oct 2020 16:24:21 +0000 (11:24 -0500)]
[DAGCombiner][PowerPC] Remove isMulhCheaperThanMulShift TLI hook, Use isOperationLegalOrCustom directly instead.

MULH is often expanded on targets.
This patch removes the isMulhCheaperThanMulShift hook and uses
isOperationLegalOrCustom instead.

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

4 years ago[llvm] Make obj2yaml and yaml2obj LLVM utilities instead of tools
Jonas Devlieghere [Mon, 19 Oct 2020 17:18:20 +0000 (10:18 -0700)]
[llvm] Make obj2yaml and yaml2obj LLVM utilities instead of tools

For testing purposes I need a way to build and install FileCheck and
yaml2obj. I had to choose between making FileCheck an LLVM tool and
making obj2yaml and yaml2obj utilities. I think the distinction is
rather arbitrary but my understanding is that tools are things meant for
the toolchain while utilities are more used for things like testing,
which is the case here.

The functional difference is that these tools now end up in the
${LLVM_UTILS_INSTALL_DIR}, which defaults to the ${LLVM_TOOLS_INSTALL_DIR}.
Unless you specified a different value or you added obj2yaml and
yaml2obj to ${LLVM_TOOLCHAIN_TOOLS}, this patch shouldn't change
anything.

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

4 years ago[AMDGPU] Simplify cumode handling in SIMemoryLegalizer
Tony [Mon, 19 Oct 2020 01:04:06 +0000 (01:04 +0000)]
[AMDGPU] Simplify cumode handling in SIMemoryLegalizer

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

4 years ago[AMDGPU] Extend hip-toolchin-features.hip test
Tony [Sat, 17 Oct 2020 22:38:04 +0000 (22:38 +0000)]
[AMDGPU] Extend hip-toolchin-features.hip test

- Extend hip-toolchin-features.hip to also check the lld attributes
  are passed correctly.

- Add check for cumode attributes.

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

4 years ago[AMDGPU] Correct hsa-diag-v3.s test
Tony [Sat, 17 Oct 2020 21:59:54 +0000 (21:59 +0000)]
[AMDGPU] Correct hsa-diag-v3.s test

- Use file_check -LABEL markers to prevent false positives being
  reported due to messages from different tests causing success to be
  reported.

- Add checks for all the run commands for more robust testing.

- Add checks for the absence of errors.

- Name and order tests more sensibly.

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

4 years ago[NFC][MC] Type [MC]Register uses in MachineTraceMetrics
Mircea Trofin [Mon, 19 Oct 2020 16:13:47 +0000 (09:13 -0700)]
[NFC][MC] Type [MC]Register uses in MachineTraceMetrics

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

4 years ago[libc++] Skip tests using constexpr destructors with older clang versions
Alex Richardson [Mon, 19 Oct 2020 16:22:54 +0000 (17:22 +0100)]
[libc++] Skip tests using constexpr destructors with older clang versions

It appears that the released version of clang that supports constexpr
destructors is clang 10 and the oldest one that accepts -std=c++2a is 5,
so mark these as UNSUPPORTED for clang-5 to clang-9.

Reviewed By: #libc, ldionne

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

4 years ago[Flang][OpenACC] Fix for branching out issue in OpenACC parallel construct.
sameeran joshi [Tue, 6 Oct 2020 04:51:06 +0000 (10:21 +0530)]
[Flang][OpenACC] Fix for branching out issue in OpenACC parallel construct.

From OpenACC 3.0 Standards document
840 • A program may not branch into or out of an OpenACC parallel construct.
Exits are allowed provided it does not cause an exit outside the parallel region.

Test case exits out of the inner do loop, but it is still inside the parallel region.
Patch tries to extract labels from block attached to a construct,
If the exit is to a label not in the collected list then flags an error.

Reviewed By: tskeith

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

4 years ago[libc++] Refactor the fuzzing tests
Louis Dionne [Fri, 16 Oct 2020 14:33:18 +0000 (10:33 -0400)]
[libc++] Refactor the fuzzing tests

Define all the fuzzing tests in libcxx/test/libcxx/fuzzing, and get
rid of the ad-hoc libcxx/fuzzing directory, which wasn't properly
integrated with the build system or test suite.

As a fly-by change, this also reduces the dependencies of fuzzing tests
on large library components like <iostream>, to make them work on more
platforms.

4 years ago[ORC] Fix unused variable warning.
Lang Hames [Mon, 19 Oct 2020 15:45:38 +0000 (08:45 -0700)]
[ORC] Fix unused variable warning.

4 years ago[InstCombine] foldOrOfICmps - only fold (icmp_eq B, 0) | (icmp_ult/gt A, B) for integ...
Simon Pilgrim [Mon, 19 Oct 2020 16:05:38 +0000 (17:05 +0100)]
[InstCombine] foldOrOfICmps - only fold (icmp_eq B, 0) | (icmp_ult/gt A, B) for integer types

Fixes a number of stage2 buildbots that were failing when I generalized the m_ConstantInt() logic - that didn't match for pointer types but m_Zero() does......

4 years ago[ML] Add final reward logging facility.
Mircea Trofin [Sat, 17 Oct 2020 15:40:44 +0000 (08:40 -0700)]
[ML] Add final reward logging facility.

Allow logging final rewards. A final reward is logged only once, and is
serialized as all-zero values, except for the last one.

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

4 years ago[Dexter][NFC] Add Missing Commands to Commands.md Contents
Nabeel Omer [Mon, 19 Oct 2020 15:38:49 +0000 (16:38 +0100)]
[Dexter][NFC] Add Missing Commands to Commands.md Contents

  NFC patch simply updates the commands.md documentation contents with missing
  links to the DexLimitSteps and DexLabel command documentation.

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

  Author:    Nabeel Omer <nabeel.omer@sony.com>

4 years ago[libc++] Define new/delete in libc++abi only by default
Louis Dionne [Tue, 1 Oct 2019 13:34:58 +0000 (09:34 -0400)]
[libc++] Define new/delete in libc++abi only by default

Previously, we would define new/delete in both libc++ and libc++abi.
Not only does this cause code bloat, but also it's technically an ODR
violation since we don't know which operator will be selected. Furthermore,
since those are weak definitions, we should strive to have as few of them
as possible (to improve load times).

My preferred choice would have been to put the operators in libc++ only
by default, however that would create a circular dependency between
libc++ and libc++abi, which GNU linkers don't handle.

Folks who want to ship new/delete in libc++ instead of libc++abi are
free to do so by turning on LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS at
CMake configure time.

On Apple platforms, this shouldn't be an ABI break because we re-export
the new/delete symbols from libc++abi. This change actually makes libc++
behave closer to the system libc++ shipped on Apple platforms.

On other platforms, this is an ABI break for people linking against libc++
but not libc++abi. However, vendors have been consulted in D68269 and no
objection was raised. Furthermore, the definitions can be controlled to
appear in libc++ instead with the CMake option.

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

4 years ago[libc++][test] Portably silence warnings
Casey Carter [Mon, 19 Oct 2020 15:33:58 +0000 (08:33 -0700)]
[libc++][test] Portably silence warnings

... in `<numbers>` tests with `[[maybe_unused]]`.

4 years ago[lit] Avoid calling realpath() for every printed message
Alex Richardson [Mon, 19 Oct 2020 15:21:10 +0000 (16:21 +0100)]
[lit] Avoid calling realpath() for every printed message

I did some profiling of lit while trying to optimize the libc++ test
startup for remote hosts and it turns out that there is a realpath() call
for every message printed and this shows up in the profile.
The inspect.getframeinfo() function calls realpath() internally and
moreover we don't need most of the other information returned from it.
This patch uses inspect.getsourcefile() and os.path.abspath() to remove
../ from the path instead. Not resolving symlinks reduces the startup time
for running a single test with lit by about 50ms for me.

Reviewed By: ldionne, yln
Differential Revision: https://reviews.llvm.org/D89186

4 years agoRevert rGa704d8238c86bac: "[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp...
Simon Pilgrim [Mon, 19 Oct 2020 15:03:21 +0000 (16:03 +0100)]
Revert rGa704d8238c86bac: "[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) uniform vector support"

This reverts commit a704d8238c86bac524f14adb6b04e0908a324e15.

Causing stage2 build failures on some bots.

4 years ago[clang-tidy] Add scoped enum constants to identifier naming check
Nathan James [Mon, 19 Oct 2020 14:57:46 +0000 (15:57 +0100)]
[clang-tidy] Add scoped enum constants to identifier naming check

Added option `ScopedEnumConstant(Prefix|Case|Suffix)` to readability-identitied-naming.
This controls the style for constants in scoped enums, declared as enum (class|struct).
If this option is unspecified the EnumConstant style will be used instead.

Reviewed By: aaron.ballman

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

4 years ago[flang] Add name match checks for interface procedures
Peter Steinfeld [Sat, 17 Oct 2020 01:27:51 +0000 (18:27 -0700)]
[flang] Add name match checks for interface procedures

We had neglected to check for name mismatches for procedure definitions that
appear in interfaces.

I also changed label11.f90 to an error test since I think they're better than
"FileCheck" tests.

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

4 years ago[clangd] Add test for structured-binding completion. NFC
Sam McCall [Mon, 19 Oct 2020 14:45:32 +0000 (16:45 +0200)]
[clangd] Add test for structured-binding completion. NFC

4 years ago[MLIR][SPIRVToLLVM] Updated documentation for composite ops
George Mitenkov [Mon, 19 Oct 2020 14:20:11 +0000 (17:20 +0300)]
[MLIR][SPIRVToLLVM] Updated documentation for composite ops

Added a section on composite ops (`spv.CompositeExtract` and
`spv.CompositeInsert`) conversion.

Reviewed By: antiagainst

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

4 years ago[InstCombine] Add (icmp ne A, 0) | (icmp ne B, 0) --> (icmp ne (A|B), 0) vector support
Simon Pilgrim [Mon, 19 Oct 2020 14:41:07 +0000 (15:41 +0100)]
[InstCombine] Add (icmp ne A, 0) | (icmp ne B, 0) --> (icmp ne (A|B), 0) vector support

Scalar cases were already being handled by foldLogOpOfMaskedICmps (so this was dead code), but refactoring to support non-uniform vectors will take some time, so tweak this fold in the meantime.

4 years agoRevert "Extend tests of run-clang-tidy"
Aaron Ballman [Mon, 19 Oct 2020 14:36:15 +0000 (10:36 -0400)]
Revert "Extend tests of run-clang-tidy"

This reverts commit 627c01bee0deb353b3e3e90c1b8d0b6d73464466.

Some failing build bots:
http://lab.llvm.org:8011/#/builders/109/builds/690
http://lab.llvm.org:8011/#/builders/14/builds/476

4 years ago[Aarch64] [TableGen] Clean up !if(!eq(boolean, 1) and related booleans.
Paul C. Anagnostopoulos [Thu, 15 Oct 2020 22:42:27 +0000 (18:42 -0400)]
[Aarch64] [TableGen] Clean up !if(!eq(boolean, 1) and related booleans.

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

4 years agoExtend tests of run-clang-tidy
Alexander Lanin [Mon, 19 Oct 2020 14:28:21 +0000 (10:28 -0400)]
Extend tests of run-clang-tidy

new test: parsing and using compile_commands
new test: export fixes to yaml file
old test extended with CHECK-MESSAGES in order to ensure that they "fail as intended"

4 years ago[InstCombine] Add (icmp eq B, 0) | (icmp ult/gt A, B) -> (icmp ule A, B-1) vector...
Simon Pilgrim [Mon, 19 Oct 2020 14:23:35 +0000 (15:23 +0100)]
[InstCombine] Add (icmp eq B, 0) | (icmp ult/gt A, B) -> (icmp ule A, B-1) vector support

4 years ago[clang-tidy] Better support for Override function in RenamerClangTidy based checks
Nathan James [Mon, 19 Oct 2020 14:21:05 +0000 (15:21 +0100)]
[clang-tidy] Better support for Override function in RenamerClangTidy based checks

Methods that override virtual methods will now get renamed if the initial virtual method has a name violation.
Addresses https://bugs.llvm.org/show_bug.cgi?id=34879

Reviewed By: alexfh

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

4 years ago[clangd] Rename edge name for filesymbols to slabs in memorytree
Kadir Cetinkaya [Mon, 19 Oct 2020 10:33:35 +0000 (12:33 +0200)]
[clangd] Rename edge name for filesymbols to slabs in memorytree

This was causing duplicate `symbols` components on the path as both the
edge from an index to filesymbols and filesymbols to symbolslabs were named
symbols.

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

4 years ago[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) unifor...
Simon Pilgrim [Mon, 19 Oct 2020 13:55:18 +0000 (14:55 +0100)]
[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) uniform vector support

4 years ago[InstCombine] foldOrOfICmps - pull out repeated getOperand() calls. NFCI.
Simon Pilgrim [Mon, 19 Oct 2020 13:05:29 +0000 (14:05 +0100)]
[InstCombine] foldOrOfICmps - pull out repeated getOperand() calls. NFCI.

4 years ago[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) vector...
Simon Pilgrim [Mon, 19 Oct 2020 12:55:33 +0000 (13:55 +0100)]
[InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) vector tests

4 years ago[TableGen] Enhance !empty and !size to handle strings and DAGs.
Paul C. Anagnostopoulos [Sun, 18 Oct 2020 14:47:07 +0000 (10:47 -0400)]
[TableGen] Enhance !empty and !size to handle strings and DAGs.
Fix bug in the type checking for !empty, !head, !size, !tail.

4 years ago[clang] update of the DragonFlyBSD's driver for the 5.8.x releases
David Carlier [Mon, 19 Oct 2020 13:04:49 +0000 (14:04 +0100)]
[clang] update of the DragonFlyBSD's driver for the 5.8.x releases

Reviewers: sepavloff, jyknight

Reviewed By: sepavloff

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

4 years ago[ADT] Avoid use of result_of_t in function_ref
Sam McCall [Mon, 19 Oct 2020 12:58:31 +0000 (14:58 +0200)]
[ADT] Avoid use of result_of_t in function_ref

It has bugs on some old libc++ versions and we don't need the power.
See https://reviews.llvm.org/D88977

4 years ago[AMDGPU] Do not generate S_CMP_LG_U64 on gfx7
Piotr Sobczak [Fri, 16 Oct 2020 07:11:01 +0000 (09:11 +0200)]
[AMDGPU] Do not generate S_CMP_LG_U64 on gfx7

S_CMP_LG_U64 was added in gfx8 and is guarded by hasScalarCompareEq64().

Rewrite S_CMP_LG_U64 to S_OR_B32 + S_CMP_LG_U32 for targets that
do not support 64-bit scalar compare.

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

4 years ago[InstCombine] Add (icmp ne A, 0) | (icmp ne B, 0) --> (icmp ne (A|B), 0) tests
Simon Pilgrim [Mon, 19 Oct 2020 12:42:41 +0000 (13:42 +0100)]
[InstCombine] Add (icmp ne A, 0) | (icmp ne B, 0) --> (icmp ne (A|B), 0) tests

4 years ago[RISCV][ASAN] Fix TLS offsets
Luís Marques [Mon, 19 Oct 2020 12:40:34 +0000 (13:40 +0100)]
[RISCV][ASAN] Fix TLS offsets

Fix a RISC-V ASan test failure: `TestCases/Linux/static_tls.cpp`.

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

4 years agoFix compiler-rt build on Windows after D89640
Hans Wennborg [Mon, 19 Oct 2020 12:38:53 +0000 (14:38 +0200)]
Fix compiler-rt build on Windows after D89640

It moved the cmake code from the else-branch to the if-branch
but forgot to flip the condition.

4 years ago[VE] Add setcc for fp128
Kazushi (Jam) Marukawa [Sun, 18 Oct 2020 00:20:34 +0000 (09:20 +0900)]
[VE] Add setcc for fp128

Add setcc for fp128 and clean existing ISel patterns.  Also add
a regression test.

Reviewed By: simoll

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

4 years ago[VE] Add cast to/from fp128 patterns
Kazushi (Jam) Marukawa [Sat, 17 Oct 2020 17:30:28 +0000 (02:30 +0900)]
[VE] Add cast to/from fp128 patterns

Add cast to/from fp128 patterns.  Clean other cast patterns too.
Update a regression test by adding missing tests.

Reviewed By: simoll

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

4 years ago[yaml2obj] - Fix comments. NFC.
Georgii Rymar [Mon, 19 Oct 2020 12:13:01 +0000 (15:13 +0300)]
[yaml2obj] - Fix comments. NFC.

This addressed post commit comments for D89391.

4 years ago[llvm-readobj/elf] - Change the behavior of handing DT_SONAME.
Georgii Rymar [Wed, 14 Oct 2020 11:20:38 +0000 (14:20 +0300)]
[llvm-readobj/elf] - Change the behavior of handing DT_SONAME.

The current situation/behavior is:
1) llvm-readelf doesn't need a string that is specified by `DT_SONAME`.
2) llvm-readobj/elf always tries to read it, even when there is no `DT_SONAME` tag.
3) Because of that both tools reports a warning for many our test cases.

This patch delays getting a SOName string and changes the behavior (llvm-readobj) to
only report a warning when there is a `DT_SONAME` and a string cab't be read.
Warning is not reported for llvm-readelf, as it never tries to dump it.

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

4 years ago[LangRef] Correct return type llvm.test.set.loop.iterations.*
Sam Parker [Mon, 19 Oct 2020 11:26:44 +0000 (12:26 +0100)]
[LangRef] Correct return type llvm.test.set.loop.iterations.*

The langref description for llvm.test.set.loop.iterations.* were
missing the i1 return type.

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

Patch by: Janek van Oirschot

4 years ago[nfc][clang-change-namespace] Remove unnecessary isScoped EnumDecl Matcher
Nathan James [Mon, 19 Oct 2020 11:53:51 +0000 (12:53 +0100)]
[nfc][clang-change-namespace] Remove unnecessary isScoped EnumDecl Matcher

4 years ago[mlir][nfc] Move BaseOpWithOffsetSizesAndStrides to the beginning of Ops.td.
Alexander Belyaev [Sat, 17 Oct 2020 11:15:31 +0000 (13:15 +0200)]
[mlir][nfc] Move BaseOpWithOffsetSizesAndStrides to the beginning of Ops.td.

Move the class to where all base classes are defined.
Also remove all the builders since they are definted in subclasses anyway.

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

4 years ago[mlir] Refactored BufferPlacement transformation.
Marcel Koester [Wed, 16 Sep 2020 10:31:08 +0000 (12:31 +0200)]
[mlir] Refactored BufferPlacement transformation.

The current BufferPlacement transformation contains several concepts for
hoisting allocations. However, more advanced hoisting techniques should not be
integrated into the BufferPlacement transformation. Hence, this CL refactors the
current BufferPlacement pass into three separate pieces: BufferDeallocation and
BufferAllocation(Loop)Hoisting. Moreover, it extends the hoisting functionality
by allowing to move allocations out of loops.

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

4 years ago[InstCombine] Add (icmp eq B, 0) | (icmp ult A, B) -> (icmp ule A, B-1) vector tests
Simon Pilgrim [Mon, 19 Oct 2020 10:46:21 +0000 (11:46 +0100)]
[InstCombine] Add (icmp eq B, 0) | (icmp ult A, B) -> (icmp ule A, B-1) vector tests

4 years agoFix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Mon, 19 Oct 2020 10:15:38 +0000 (11:15 +0100)]
Fix MSVC "not all control paths return a value" warning. NFCI.

4 years ago[nfc] [lldb] Move LookupAddress to DWARFCompileUnit
Jan Kratochvil [Mon, 19 Oct 2020 09:26:16 +0000 (11:26 +0200)]
[nfc] [lldb] Move LookupAddress to DWARFCompileUnit

LookupAddress makes no sense for DWARFTypeUnit.
Also make GetNonSkeletonUnit to preserve the called type.

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

4 years agoRevert "[PM/CC1] Add -f[no-]split-cold-code CC1 option to toggle splitting"
Hans Wennborg [Mon, 19 Oct 2020 10:23:22 +0000 (12:23 +0200)]
Revert "[PM/CC1] Add -f[no-]split-cold-code CC1 option to toggle splitting"

This broke Chromium's PGO build, it seems because hot-cold-splitting got turned
on unintentionally. See comment on the code review for repro etc.

> This patch adds -f[no-]split-cold-code CC1 options to clang. This allows
> the splitting pass to be toggled on/off. The current method of passing
> `-mllvm -hot-cold-split=true` to clang isn't ideal as it may not compose
> correctly (say, with `-O0` or `-Oz`).
>
> To implement the -fsplit-cold-code option, an attribute is applied to
> functions to indicate that they may be considered for splitting. This
> removes some complexity from the old/new PM pipeline builders, and
> behaves as expected when LTO is enabled.
>
> Co-authored by: Saleem Abdulrasool <compnerd@compnerd.org>
> Differential Revision: https://reviews.llvm.org/D57265
> Reviewed By: Aditya Kumar, Vedant Kumar
> Reviewers: Teresa Johnson, Aditya Kumar, Fedor Sergeev, Philip Pfaffe, Vedant Kumar

This reverts commit 273c299d5d649a0222fbde03c9a41e41913751b4.

4 years ago[clangd] Add $/memoryUsage LSP extension
Kadir Cetinkaya [Mon, 12 Oct 2020 22:10:04 +0000 (00:10 +0200)]
[clangd] Add $/memoryUsage LSP extension

Performs a detailed profiling of clangd lsp server and conveys the
result to the client as a json object. It is of the form:
   {
     "_self": 0,
     "_total": 8,
     "child1": {
       "_self": 4,
       "_total": 4,
     }
     "child2": {
       "_self": 2,
       "_total": 4,
       "child_deep": {
         "_self": 2,
         "_total": 2,
       }
     }
   }

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

4 years ago[InstCombine] Support vectors-with-undef in and(logicalshift(1,X),1) --> zext(X ...
Simon Pilgrim [Fri, 16 Oct 2020 15:06:14 +0000 (16:06 +0100)]
[InstCombine] Support vectors-with-undef in and(logicalshift(1,X),1) --> zext(X == 0) fold

4 years ago[InstCombine] Add vectors-with-undef tests for and(logicalshift(1,X),1) --> zext...
Simon Pilgrim [Fri, 16 Oct 2020 14:56:05 +0000 (15:56 +0100)]
[InstCombine] Add vectors-with-undef tests for and(logicalshift(1,X),1) --> zext(X == 0)