platform/upstream/llvm.git
3 years agoThis test includes a source that will produce basic blocks and hence sections with...
Sriraman Tallam [Sat, 17 Oct 2020 04:28:18 +0000 (21:28 -0700)]
This test includes a source that will produce basic blocks and hence sections with -fbasic-block-sections=all.

The test reorders the basic blocks to be dis-contiguous in the address space and checks if the back trace contains the right symbol.

Reviewed By: labath

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

3 years ago[LangRef] Rename the names of metadata in load/store's syntax (NFC)
Juneyoung Lee [Sat, 17 Oct 2020 04:29:58 +0000 (13:29 +0900)]
[LangRef] Rename the names of metadata in load/store's syntax (NFC)

Discussed in D89050

3 years ago[DebugInfo] Support for DWARF operator DW_OP_over
Alok Kumar Sharma [Sat, 17 Oct 2020 02:54:08 +0000 (08:24 +0530)]
[DebugInfo] Support for DWARF operator DW_OP_over

LLVM rejects DWARF operator DW_OP_over. This DWARF operator is needed
for Flang to support assumed rank array.

  Summary:
Currently LLVM rejects DWARF operator DW_OP_over. Below error is
produced when llvm finds this operator.
[..]
invalid expression
!DIExpression(151, 20, 16, 48, 30, 35, 80, 34, 6)
warning: ignoring invalid debug info in over.ll
[..]
There were some parts missing in support of this operator, which are
now completed.

  Testing
-added a unit testcase
-check-debuginfo
-check-llvm

Reviewed By: aprantl

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

3 years ago[TargetLowering] Extract simplifySetCCs ctpop into a separate function. NFCI
Craig Topper [Fri, 16 Oct 2020 22:42:49 +0000 (15:42 -0700)]
[TargetLowering] Extract simplifySetCCs ctpop into a separate function. NFCI

As requested in D89346. This allows us to add some early outs.

I reordered some checks a little bit to make the more common bail outs happen earlier. Like checking opcode before checking hasOneUse. And I moved the bit width check to make sure it was safe to look through a truncate to the spot where we look through truncates instead of after.

Reviewed By: spatel

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

3 years ago[MemorySSA] Verify clobbering within reachable blocks.
Alina Sbirlea [Sat, 17 Oct 2020 00:25:30 +0000 (17:25 -0700)]
[MemorySSA] Verify clobbering within reachable blocks.

Resolves PR45976.

3 years ago[NPM] Fix some PhaseOrdering tests under NPM
Arthur Eubanks [Fri, 16 Oct 2020 21:58:32 +0000 (14:58 -0700)]
[NPM] Fix some PhaseOrdering tests under NPM

These either already have corresponding NPM RUN lines,
or need to be fixed to not use -analyze.

3 years ago[AArch64][GlobalISel] Select csinc if a select has a 1 on RHS.
Amara Emerson [Thu, 15 Oct 2020 22:44:27 +0000 (15:44 -0700)]
[AArch64][GlobalISel] Select csinc if a select has a 1 on RHS.

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

3 years agoMake the check for whether we should memset(0) an aggregate
Richard Smith [Fri, 16 Oct 2020 23:46:49 +0000 (16:46 -0700)]
Make the check for whether we should memset(0) an aggregate
initialization a little smarter.

Look through casts that preserve zero-ness when determining if an
initializer is zero, so that we can handle cases like an {0} initializer
whose corresponding field is a type other than 'int'.

3 years ago[libomptarget] Fix copy-to motion for PTR_AND_OBJ entries where PTR is a struct member.
George Rokos [Fri, 16 Oct 2020 21:39:30 +0000 (14:39 -0700)]
[libomptarget] Fix copy-to motion for PTR_AND_OBJ entries where PTR is a struct member.

This patch fixes a problem whereby the pointee object of a PTR_AND_OBJ entry with a `map(to)` motion clause can be overwritten on the device even if its reference counter is >=1.

Currently, we check the reference counter of the parent struct in order to determine whether the motion clause should be respected, but since the pointee object is not part of the struct, it's got its own reference counter which should be used to enqueue the copy or discard it.

The same behavior has already been implemented in targetDataEnd (omptarget.cpp:539-540), but we somehow missed doing the same in targetDataBegin.

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

3 years agoFix accidental use of VLAs that causes these tests to fail after Clang
Richard Smith [Fri, 16 Oct 2020 22:13:23 +0000 (15:13 -0700)]
Fix accidental use of VLAs that causes these tests to fail after Clang
commit 552c6c2328723a248c2b4d2765f75d49129dff20.

3 years ago[PowerPC] Implementation of 128-bit Binary Vector Rotate builtins
Albion Fung [Fri, 16 Oct 2020 22:03:09 +0000 (18:03 -0400)]
[PowerPC] Implementation of 128-bit Binary Vector Rotate builtins

This patch implements 128-bit Binary Vector Rotate builtins for PowerPC10.

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

3 years agoFixed a failure when const matcher fails, added a test to catch
Rob Suderman [Fri, 16 Oct 2020 20:51:07 +0000 (13:51 -0700)]
Fixed a failure when const matcher fails, added a test to catch

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

3 years agoPR44406: Follow behavior of array bound constant folding in more recent versions...
Richard Smith [Fri, 16 Oct 2020 02:32:15 +0000 (19:32 -0700)]
PR44406: Follow behavior of array bound constant folding in more recent versions of GCC.

Old GCC used to aggressively fold VLAs to constant-bound arrays at block
scope in GNU mode. That's non-conforming, and more modern versions of
GCC only do this at file scope. Update Clang to do the same.

Also promote the warning for this from off-by-default to on-by-default
in all cases; more recent versions of GCC likewise warn on this by
default.

This is still slightly more permissive than GCC, as pointed out in
PR44406, as we still fold VLAs to constant arrays in structs, but that
seems justifiable given that we don't support VLA-in-struct (and don't
intend to ever support it), but GCC does.

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

3 years ago[objdump][macho] Check arch before formating reloc name as arm64 addend
Peng Guo [Fri, 16 Oct 2020 20:47:46 +0000 (13:47 -0700)]
[objdump][macho] Check arch before formating reloc name as arm64 addend

Before formating ARM64_RELOC_ADDEND relocation target name as a hex
number, the architecture need to be checked since other architectures
can define a different relocation type with the same integer as
ARM64_RELOC_ADDEND.

Reviewed By: MaskRay

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

3 years ago[lldb] Implement ObjCExceptionThrowFrameRecognizer::GetName()
Dave Lee [Fri, 16 Oct 2020 18:46:35 +0000 (11:46 -0700)]
[lldb] Implement ObjCExceptionThrowFrameRecognizer::GetName()

Implement `GetName` for `ObjCExceptionThrowFrameRecognizer`. Otherwise, `frame recognizer list` shows "(internal)" for the name.

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

3 years agoRevert "make the AsmPrinterHandler array public"
Jameson Nash [Fri, 16 Oct 2020 21:22:07 +0000 (17:22 -0400)]
Revert "make the AsmPrinterHandler array public"

I messed up one of the tests.

3 years ago[Format/ObjC] Correctly handle base class with lightweight generics and protocol
Ben Hamilton [Thu, 15 Oct 2020 21:00:00 +0000 (15:00 -0600)]
[Format/ObjC] Correctly handle base class with lightweight generics and protocol

ClangFormat does not correctly handle an Objective-C interface declaration
with both lightweight generics and a protocol conformance.

This simple example:

```
@interface Foo : Bar <Baz> <Blech>

@end
```

means `Foo` extends `Bar` (a lightweight generic class whose type
parameter is `Baz`) and also conforms to the protocol `Blech`.

ClangFormat should not apply any changes to the above example, but
instead it currently formats it quite poorly:

```
@interface Foo : Bar <Baz>
<Blech>

    @end
    ```

The bug is that `UnwrappedLineParser` assumes an open-angle bracket
after a base class name is a protocol list, but it can also be a
lightweight generic specification.

This diff fixes the bug by factoring out the logic to parse
lightweight generics so it can apply both to the declared class
as well as the base class.

Test Plan: New tests added. Ran tests with:
  % ninja FormatTests && ./tools/clang/unittests/Format/FormatTests
  Confirmed tests failed before diff and passed after diff.

Reviewed By: sammccall, MyDeveloperDay

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

3 years agoRevert "Fix Windows llvm-objdump tests"
Renato Golin [Fri, 16 Oct 2020 20:49:47 +0000 (21:49 +0100)]
Revert "Fix Windows llvm-objdump tests"

It had already been fixed in a different way.

3 years ago[AMDGPU] Fix gfx1032 description in AMDGPUUsage.rst. NFC.
Stanislav Mekhanoshin [Fri, 16 Oct 2020 17:18:47 +0000 (10:18 -0700)]
[AMDGPU] Fix gfx1032 description in AMDGPUUsage.rst. NFC.

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

3 years agoFix Windows llvm-objdump tests
Renato Golin [Fri, 16 Oct 2020 20:26:46 +0000 (21:26 +0100)]
Fix Windows llvm-objdump tests

Broken in e95f9a23fad with path issues.

3 years agomake the AsmPrinterHandler array public
Jameson Nash [Thu, 15 Oct 2020 21:19:10 +0000 (17:19 -0400)]
make the AsmPrinterHandler array public

This lets external consumers customize the output, similar to how
AssemblyAnnotationWriter lets the caller define callbacks when printing
IR. The array of handlers already existed, this just cleans up the code
so that it can be exposed publically.

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

3 years agoTreat constant contexts as being in the default rounding mode.
Richard Smith [Wed, 14 Oct 2020 02:14:13 +0000 (19:14 -0700)]
Treat constant contexts as being in the default rounding mode.

This addresses a regression where pretty much all C++ compilations using
-frounding-math now fail, due to rounding being performed in constexpr
function definitions in the standard library.

This follows the "manifestly constant evaluated" approach described in
https://reviews.llvm.org/D87528#2270676 -- evaluations that are required
to succeed at compile time are permitted even in regions with dynamic
rounding modes, as are (unfortunately) the evaluation of the
initializers of local variables of const integral types.

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

3 years agoExtend memset-to-zero optimization to C++11 aggregate functional casts
Richard Smith [Fri, 16 Oct 2020 20:18:52 +0000 (13:18 -0700)]
Extend memset-to-zero optimization to C++11 aggregate functional casts
Aggr{...}.

We previously missed these cases due to not stepping over the additional
AST nodes representing their syntactic form.

3 years ago[VectorCombine] Avoid crossing address space boundaries.
Artem Belevich [Fri, 16 Oct 2020 18:19:27 +0000 (11:19 -0700)]
[VectorCombine] Avoid crossing address space boundaries.

We can not bitcast pointers across different address spaces, and VectorCombine
should be careful when it attempts to find the original source of the loaded
data.

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

3 years ago[AMDGPU] Drop array size in AMDGCNGPUs and R600GPUs
Stanislav Mekhanoshin [Fri, 16 Oct 2020 17:44:03 +0000 (10:44 -0700)]
[AMDGPU] Drop array size in AMDGCNGPUs and R600GPUs

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

3 years agoRevert "Recommit "[SCEV] Use nw flag and symbolic iteration count to sharpen ranges...
Nikita Popov [Fri, 16 Oct 2020 19:13:41 +0000 (21:13 +0200)]
Revert "Recommit "[SCEV] Use nw flag and symbolic iteration count to sharpen ranges of AddRecs""

This reverts commit 32b72c3165bf65cca2e8e6197b59eb4c4b60392a.

While better than before, this change still introduces a large
compile-time regression (>3% on mafft):
https://llvm-compile-time-tracker.com/compare.php?from=fbd62fe60fb2281ca33da35dc25ca3c87ec0bb51&to=32b72c3165bf65cca2e8e6197b59eb4c4b60392a&stat=instructions

Additionally, the logic here doesn't look quite right to me,
I will comment in more detail on the differential revision.

3 years ago[SCEV] Add additional tests where the max BTC is limited by wrapping.
Florian Hahn [Fri, 16 Oct 2020 19:16:32 +0000 (20:16 +0100)]
[SCEV] Add additional tests where the max BTC is limited by wrapping.

3 years ago[CGSCC] Add -abort-on-max-devirt-iterations-reached option
Arthur Eubanks [Fri, 16 Oct 2020 00:46:10 +0000 (17:46 -0700)]
[CGSCC] Add -abort-on-max-devirt-iterations-reached option

Aborts if we hit the max devirtualization iteration.
Will be useful for testing that changes to devirtualization don't cause
devirtualization to repeat passes more times than necessary.

Reviewed By: rnk

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

3 years ago[flang] Disallow pointer constants
Peter Steinfeld [Fri, 16 Oct 2020 18:48:55 +0000 (11:48 -0700)]
[flang] Disallow pointer constants

None of the other Fortran compilers allow them.

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

3 years ago[AMDGPU] Run hazard recognizer pass later
Austin Kerbow [Thu, 8 Oct 2020 22:53:25 +0000 (15:53 -0700)]
[AMDGPU] Run hazard recognizer pass later

If instructions were removed in peephole passes after the hazard recognizer was
run it is possible that new hazards could be introduced.

Fixes: SWDEV-253090

Reviewed By: rampitec, arsenm

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

3 years ago[mlir] Update SCCP and the Inliner to use SymbolTableCollection for symbol lookups
River Riddle [Fri, 16 Oct 2020 18:57:10 +0000 (11:57 -0700)]
[mlir] Update SCCP and the Inliner to use SymbolTableCollection for symbol lookups

This transforms the symbol lookups to O(1) from O(NM), greatly speeding up both passes. For a large MLIR module this shaved seconds off of the compilation time.

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

3 years ago[mlir] Add a new SymbolUserOpInterface class
River Riddle [Fri, 16 Oct 2020 18:57:00 +0000 (11:57 -0700)]
[mlir] Add a new SymbolUserOpInterface class

The initial goal of this interface is to fix the current problems with verifying symbol user operations, but can extend beyond that in the future. The current problems with the verification of symbol uses are:
* Extremely inefficient:
Most current symbol users perform the symbol lookup using the slow O(N) string compare methods, which can lead to extremely long verification times in large modules.
* Invalid/break the constraints of verification pass
If the symbol reference is not-flat(and even if it is flat in some cases) a verifier for an operation is not permitted to touch the referenced operation because it may be in the process of being mutated by a different thread within the pass manager.

The new SymbolUserOpInterface exposes a method `verifySymbolUses` that will be invoked from the parent symbol table to allow for verifying the constraints of any referenced symbols. This method is passed a `SymbolTableCollection` to allow for O(1) lookups of any necessary symbol operation.

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

3 years ago[mlir] Optimize symbol related checks in SymbolDCE
River Riddle [Fri, 16 Oct 2020 18:56:52 +0000 (11:56 -0700)]
[mlir] Optimize symbol related checks in SymbolDCE

This revision contains two optimizations related to symbol checking:
* Optimize SymbolOpInterface to only check for a name attribute if the operation is an optional symbol.
This removes an otherwise unnecessary attribute lookup from a majority of symbols.
* Add a new SymbolTableCollection class to represent a collection of SymbolTables.
This allows for perfoming non-flat symbol lookups in O(1) time by caching SymbolTables for symbol table operations. This class is very useful for algorithms that operate on multiple symbol tables, either recursively or not.

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

3 years ago[mlir] Add a utility class, ThreadLocalCache, for storing non static thread local...
River Riddle [Fri, 16 Oct 2020 18:56:43 +0000 (11:56 -0700)]
[mlir] Add a utility class, ThreadLocalCache, for storing non static thread local objects.

(Note: This is a reland of D82597)

This class allows for defining thread local objects that have a set non-static lifetime. This internals of the cache use a static thread_local map between the various different non-static objects and the desired value type. When a non-static object destructs, it simply nulls out the entry in the static map. This will leave an entry in the map, but erase any of the data for the associated value. The current use cases for this are in the MLIRContext, meaning that the number of items in the static map is ~1-2 which aren't particularly costly enough to warrant the complexity of pruning. If a use case arises that requires pruning of the map, the functionality can be added.

This is especially useful in the context of MLIR for implementing thread-local caching of context level objects that would otherwise have very high lock contention. This revision adds a thread local cache in the MLIRContext for attributes, identifiers, and types to reduce some of the locking burden. This led to a speedup of several seconds when compiling a somewhat large mlir module.

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

3 years ago[docs] Fix some out-of-date / inaccurate text and missing formatting in the User...
Richard Smith [Fri, 16 Oct 2020 18:59:24 +0000 (11:59 -0700)]
[docs] Fix some out-of-date / inaccurate text and missing formatting in the User's Manual.

3 years ago[llvm-objdump][test] Unsupport system-windows for source-interleave-prefix.test
Fangrui Song [Fri, 16 Oct 2020 18:44:27 +0000 (11:44 -0700)]
[llvm-objdump][test] Unsupport system-windows for source-interleave-prefix.test

3 years agoAdd support for more OS types to AddClangModuleCompilationOptionsForSDKType()
Adrian Prantl [Fri, 16 Oct 2020 18:42:08 +0000 (11:42 -0700)]
Add support for more OS types to AddClangModuleCompilationOptionsForSDKType()

This patch also avoids hardcoding the clang options, which makes it
less likely for them to become out-of-date.

rdar://problem/63791367+66927829

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

3 years ago[llvm-objdump][test] Delete source-interleave-prefix-windows.test
Fangrui Song [Fri, 16 Oct 2020 18:42:12 +0000 (11:42 -0700)]
[llvm-objdump][test] Delete source-interleave-prefix-windows.test

It needs more work: http://45.33.8.238/win/25999/step_11.txt

3 years ago[AArch64][GlobalISel] Add selection support for v2s32 and v2s64 reductions for FADD...
Amara Emerson [Fri, 9 Oct 2020 19:38:39 +0000 (12:38 -0700)]
[AArch64][GlobalISel] Add selection support for v2s32 and v2s64 reductions for FADD/ADD.

We'll need legalizer lower() support for the other types to work.

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

3 years ago[test] Pin null-function.ll to legacy PM
Arthur Eubanks [Fri, 16 Oct 2020 18:23:26 +0000 (11:23 -0700)]
[test] Pin null-function.ll to legacy PM

The NPM prints CGSCCs in a different way.

3 years ago[gn build] Port 3d4bba302d2
LLVM GN Syncbot [Fri, 16 Oct 2020 18:13:18 +0000 (18:13 +0000)]
[gn build] Port 3d4bba302d2

3 years ago[gn build] (manually) port 3d4bba302d246
Nico Weber [Fri, 16 Oct 2020 18:12:38 +0000 (14:12 -0400)]
[gn build] (manually) port 3d4bba302d246

3 years ago[libcxx] [test] Fix string type handling in a few fairly trivial class.path tests
Martin Storsjö [Thu, 15 Oct 2020 08:55:10 +0000 (11:55 +0300)]
[libcxx] [test] Fix string type handling in a few fairly trivial class.path tests

Use string() for convenience for testing where possible, but keep using
native() for move tests where we want to check that no allocations are
made, constructing a reference fs::path::string_type instead.

Use the right value_type in a few places.

Make the synop test check for the right types and for the expected
preferred separator.

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

3 years ago[Indvars][NFCI] Simplify assertion.
Benjamin Kramer [Fri, 16 Oct 2020 17:58:05 +0000 (19:58 +0200)]
[Indvars][NFCI] Simplify assertion.

This should be semantically identical. Also avoids unused variable
warnings in Release builds.

3 years ago[AMDGPU][HIP] Switch default DWARF version to 5
Scott Linder [Fri, 16 Oct 2020 17:53:25 +0000 (17:53 +0000)]
[AMDGPU][HIP] Switch default DWARF version to 5

Another attempt at this, see D59008 for previous attempt.

Reviewed By: kzhuravl, t-tye

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

3 years ago[MemProf] Don't build memprof if sanitizer not being built
Teresa Johnson [Fri, 16 Oct 2020 17:35:09 +0000 (10:35 -0700)]
[MemProf] Don't build memprof if sanitizer not being built

This should fix a couple of debian bot failures:
http://lab.llvm.org:8011/#builders/14/builds/380
http://lab.llvm.org:8011/#builders/109/builds/533

They disable building of the sanitizer, which memprof relies on. So
disable building of memprof in that case.

3 years ago[AArch64][GlobalISel] Regbankselect reductions to use FPR bank for scalars.
Amara Emerson [Thu, 8 Oct 2020 21:11:55 +0000 (14:11 -0700)]
[AArch64][GlobalISel] Regbankselect reductions to use FPR bank for scalars.

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

3 years ago[AArch64][GlobalISel] Add basic legalizer rules for supported add/fadd reductions.
Amara Emerson [Thu, 8 Oct 2020 20:38:15 +0000 (13:38 -0700)]
[AArch64][GlobalISel] Add basic legalizer rules for supported add/fadd reductions.

NEON is pretty limited in it's reduction support. As a first step add some
basic rules for the legal types we can select.

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

3 years ago[GlobalISel] Add translation support for vector reduction intrinsics.
Amara Emerson [Thu, 8 Oct 2020 07:17:02 +0000 (00:17 -0700)]
[GlobalISel] Add translation support for vector reduction intrinsics.

In order to prevent the ExpandReductions pass from expanding some intrinsics
before they get to codegen, I had to add a -disable-expand-reductions flag
for testing purposes.

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

3 years ago[libc++] Avoid relying on `realpath` being installed on the system
Louis Dionne [Fri, 16 Oct 2020 16:57:30 +0000 (12:57 -0400)]
[libc++] Avoid relying on `realpath` being installed on the system

It doesn't appear to be a standard utility.

3 years ago[llvm-objdump] Implement --prefix option
Vinicius Tinti [Fri, 16 Oct 2020 14:35:19 +0000 (15:35 +0100)]
[llvm-objdump] Implement --prefix option

The prefix given to --prefix will be added to GNU absolute paths when
used with --source option (source interleaved with the disassembly).

This matches GNU's objdump behavior.

GNU and C++17 rules for absolute paths are different.

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

Fixes PR46368.

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

3 years ago[MemProf] Memory profiling runtime support
Teresa Johnson [Thu, 3 Sep 2020 22:21:20 +0000 (15:21 -0700)]
[MemProf] Memory profiling runtime support

See RFC for background:
http://lists.llvm.org/pipermail/llvm-dev/2020-June/142744.html

Follow on companion to the clang/llvm instrumentation support in D85948
and committed earlier.

This patch adds the compiler-rt runtime support for the memory
profiling.

Note that much of this support was cloned from asan (and then greatly
simplified and renamed). For example the interactions with the
sanitizer_common allocators, error handling, interception, etc.

The bulk of the memory profiling specific code can be found in the
MemInfoBlock, MemInfoBlockCache, and related classes defined and used
in memprof_allocator.cpp.

For now, the memory profile is dumped to text (stderr by default, but
honors the sanitizer_common log_path flag). It is dumped in either a
default verbose format, or an optional terse format.

This patch also adds a set of tests for the core functionality.

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

3 years ago[libc++] Move the oss-fuzz script to libcxx/utils/ci
Louis Dionne [Fri, 16 Oct 2020 16:40:43 +0000 (12:40 -0400)]
[libc++] Move the oss-fuzz script to libcxx/utils/ci

3 years ago[libc++] Move the oss-fuzz script to libc++
Louis Dionne [Fri, 16 Oct 2020 16:10:49 +0000 (12:10 -0400)]
[libc++] Move the oss-fuzz script to libc++

Instead of having this script be part of the OSS-Fuzz repository, I think
it makes more sense to have it alongside the rest of the fuzzing targets
in libc++.

3 years ago[AMDGPU] Add new llvm.amdgcn.fma.legacy intrinsic
Jay Foad [Thu, 15 Oct 2020 09:35:46 +0000 (10:35 +0100)]
[AMDGPU] Add new llvm.amdgcn.fma.legacy intrinsic

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

3 years ago[llc] Use -filetype=null to disable MIR printing
Jay Foad [Thu, 15 Oct 2020 15:45:50 +0000 (16:45 +0100)]
[llc] Use -filetype=null to disable MIR printing

If you use -stop-after or similar options, llc will normally print MIR.
This patch checks for -filetype=null as a special case to disable MIR
printing. As the comment says, "The Null output is intended for use for
performance analysis ...", and I found this useful for timing a subset
of the passes that llc runs without the significant overhead of printing
MIR just to send it to /dev/null.

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

3 years ago[MLIR] Add idempotent trait folding
ahmedsabie [Fri, 16 Oct 2020 15:49:38 +0000 (15:49 +0000)]
[MLIR] Add idempotent trait folding

This trait simply adds a fold of f(f(x)) = f(x) when an operation is labelled as idempotent

Reviewed By: rriddle, andyly

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

3 years agoReapply "OpaquePtr: Add type to sret attribute"
Matt Arsenault [Tue, 29 Sep 2020 13:33:55 +0000 (09:33 -0400)]
Reapply "OpaquePtr: Add type to sret attribute"

This reverts commit eb9f7c28e5fe6d75fed3587023e17f2997c8024b.

Previously this was incorrectly handling linking of the contained
type, so this merges the fixes from D88973.

3 years ago[Hexagon] Fix license headers in some .td files, NFC
Krzysztof Parzyszek [Thu, 15 Oct 2020 14:59:35 +0000 (09:59 -0500)]
[Hexagon] Fix license headers in some .td files, NFC

3 years agoDisable DynamicLibraryTests when using LLVM_INTEGRATED_CRT_ALLOC (PR47881)
Hans Wennborg [Fri, 16 Oct 2020 14:49:39 +0000 (16:49 +0200)]
Disable DynamicLibraryTests when using LLVM_INTEGRATED_CRT_ALLOC (PR47881)

3 years ago[InstCombine] visitAnd - pull out repeated I.getType() calls. NFCI.
Simon Pilgrim [Fri, 16 Oct 2020 14:16:31 +0000 (15:16 +0100)]
[InstCombine] visitAnd - pull out repeated I.getType() calls. NFCI.

3 years ago[InstCombine] visitAnd - add some ((val OP C1) & C2) vector test coverage
Simon Pilgrim [Fri, 16 Oct 2020 14:05:54 +0000 (15:05 +0100)]
[InstCombine] visitAnd - add some ((val OP C1) & C2) vector test coverage

3 years ago[InstCombine] Remove custom and(trunc(and(x,c1)),c2) fold
Simon Pilgrim [Fri, 16 Oct 2020 12:58:25 +0000 (13:58 +0100)]
[InstCombine] Remove custom and(trunc(and(x,c1)),c2) fold

This is more correctly handled by canEvaluateTruncated (one use checks etc.) and covers all the tests cases that were added for this fold.

3 years ago[libcxx] [test] Add (void) return casts on functions marked nodiscard in MS STL
Martin Storsjö [Wed, 14 Oct 2020 10:14:18 +0000 (13:14 +0300)]
[libcxx] [test] Add (void) return casts on functions marked nodiscard in MS STL

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

3 years ago[libcxx] [test] Mark tests for libcxx specific implementation details with LIBCPP_ONLY()
Martin Storsjö [Fri, 16 Oct 2020 08:22:33 +0000 (11:22 +0300)]
[libcxx] [test] Mark tests for libcxx specific implementation details with LIBCPP_ONLY()

This matches an existing marking in enum.path.format.pass.cpp.

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

3 years ago[libcxx] [test] Use fs::path::string_type instead of std::string in fs.op.relative
Martin Storsjö [Thu, 15 Oct 2020 11:25:31 +0000 (14:25 +0300)]
[libcxx] [test] Use fs::path::string_type instead of std::string in fs.op.relative

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

3 years ago[libcxx] [test] Use string() instead of native() as parameter to std::ifstream/ofstre...
Martin Storsjö [Fri, 16 Oct 2020 10:12:57 +0000 (13:12 +0300)]
[libcxx] [test] Use string() instead of native() as parameter to std::ifstream/ofstream in copy_file_large.pass.cpp

This fixes building with libstdc++ for windows. MS STL has got
ifstream/ofstream overloads that taken wide strings though.

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

3 years agoclang-format: Assert in-memory file created in createInMemoryFile, NFC
Duncan P. N. Exon Smith [Fri, 16 Oct 2020 14:03:11 +0000 (10:03 -0400)]
clang-format: Assert in-memory file created in createInMemoryFile, NFC

`SourceManager::createFileID` asserts that the given `FileEntry` is not
null, so remove the logic that passed in `nullptr`. Since we just added
the file to an in-memory FS via an API that cannot fail, use
`llvm_unreachable` on the error path. Didn't use an `assert` since it
seems cleaner semantically to check the error (and better,
hypothetically, for updating the API to use `Expected` instead of
`ErrorOr`).

I noticed this incidentally while auditing calls to `createFileID`.

3 years ago[flang] Failed call to CHECK() for call to ASSOCIATED(NULL())
Peter Steinfeld [Fri, 25 Sep 2020 16:03:17 +0000 (09:03 -0700)]
[flang] Failed call to CHECK() for call to ASSOCIATED(NULL())

Calling "ASSOCATED(NULL()) was causing an internal check of the compiler to
fail.

I fixed this by changing the entry for "ASSOCIATED" in the intrinsics table to
accept "AnyPointer" which contains a new "KindCode" of "pointerType".  I also
changed the function "FromActual()" to return a typeless intrinsic when called
on a pointer, which duplicates its behavior for BOZ literals.  This required
changing the analysis of procedure arguments.  While testing processing for
procedure arguments, I found another bad call to `CHECK()` which I fixed.

I made several other changes:
  -- I implemented constant folding for ASSOCIATED().
  -- I fixed handling of NULL() in relational operations.
  -- I implemented semantic analysis for ASSOCIATED().
    -- I noticed that the semantics for ASSOCIATED() are similar to those for
       pointer assignment.  So I extracted the code that pointer assignment uses
       for procedure pointer compatibility to a place where it could be used by
       the semantic analysis for ASSOCIATED().
    -- I couldn't figure out how to make the general semantic analysis for
       procedure arguments work with ASSOCIATED()'s second argument, which can
       be either a pointer or a target.  So I stopped using normal semantic
       analysis for arguments for ASSOCIATED().
  -- I added tests for all of this.

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

3 years agollvm-reduce: Don't replace intrinsic calls with undef
Matt Arsenault [Thu, 1 Oct 2020 17:44:59 +0000 (13:44 -0400)]
llvm-reduce: Don't replace intrinsic calls with undef

These don't really have function bodies to try to eliminate. This also
has a good chance of just producing invalid IR since intrinsics can
have special operand constraints (e.g. metadata arguments aren't valid
for an arbitrary call). This was wasting quite a bit of time producing
and failing on invalid IR when replacing dbg.values with undefs.

3 years agollvm-reduce: Fix typo in status message
Matt Arsenault [Wed, 14 Oct 2020 20:08:45 +0000 (16:08 -0400)]
llvm-reduce: Fix typo in status message

3 years agoAMDGPU: Don't kill super-register with overlapping copy
Matt Arsenault [Thu, 15 Oct 2020 18:19:51 +0000 (14:19 -0400)]
AMDGPU: Don't kill super-register with overlapping copy

This would end up killing part of the result super-register, resulting
in a verifier error on a later use of the overlapping registers.  We
could add kills of any non-aliasing registers, but we should be moving
away from relying on kill flags.

3 years ago[lldb] Minidump: check for .text hash match with directory
Joseph Tremoulet [Fri, 16 Oct 2020 13:32:08 +0000 (09:32 -0400)]
[lldb] Minidump: check for .text hash match with directory

When opening a minidump, we might discover that it reports a UUID for a
module that doesn't match the build ID, but rather a hash of the .text
section (according to either of two different hash functions, used by
breakpad and Facebook respectively).  The current logic searches for a
module by filename only to check the hash; this change updates it to
first search by directory+filename.  This is important when the
directory specified in the minidump must be interpreted relative to a
user-provided sysoort, as the leaf directory won't be in the search path
in that case.

Also add a regression test; without this change, module validation fails
because we have just the placeholder module which reports as its path
the platform path in the minidump.

Reviewed By: clayborg

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

3 years ago[lldb] Modernize PseudoTerminal::OpenSecondary
Pavel Labath [Wed, 7 Oct 2020 15:46:50 +0000 (17:46 +0200)]
[lldb] Modernize PseudoTerminal::OpenSecondary

3 years ago[clang-tidy] modernize-loop-convert reverse iteration support
Nathan James [Fri, 16 Oct 2020 13:16:28 +0000 (14:16 +0100)]
[clang-tidy] modernize-loop-convert reverse iteration support

Enables support for transforming loops of the form
```
for (auto I = Cont.rbegin(), E = Cont.rend(); I != E;++I)
```

This is done automatically in C++20 mode using `std::ranges::reverse_view` but there are options to specify a different function to reverse iterator over a container.
This is the first step, down the line I'd like to possibly extend this support for array based loops
```
for (unsigned I = Arr.size() - 1;I >=0;--I) Arr[I]...
```

Currently if you pass a reversing function with no header in the options it will just assume that the function exists, however as we have the ASTContext it may be as wise to check before applying, or at least lower the confidence level if we can't find it.

Reviewed By: alexfh

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

3 years ago[libcxxabi] Fix printf formats in a test.
Simon Tatham [Fri, 16 Oct 2020 12:59:10 +0000 (13:59 +0100)]
[libcxxabi] Fix printf formats in a test.

This is the libcxxabi counterpart of D89545, and would have been part
of that patch if I'd spotted it soon enough (oops). One test in
libcxxabi is using the `%lu` printf format to refer to `size_t`, which
should be `%zu`.

Reviewed By: ldionne, #libc_abi

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

3 years ago[libcxx] Fix printf formats in two tests.
Simon Tatham [Fri, 16 Oct 2020 12:47:00 +0000 (13:47 +0100)]
[libcxx] Fix printf formats in two tests.

rGcc69d211d0d65d7b introduced several uses of `printf` with format
directives `%lu` and `%ld` to format values of type `size_t` and
`ptrdiff_t` respectively.

That doesn't reliably work in all C implementations, because those
types aren't necessarily the same thing as 'long int': sometimes
they're not even the same size, and when they are the same size, they
might be officially defined as int rather than long (for example),
which causes clang to emit a diagnostic for the mismatch.

C has special-purpose printf modifier letters for these two types, so
it's safer to use them. Changed all `%lu` on `size_t` to `%zu`, and
all `%ld` on `ptrdiff_t` to `%td`.

Reviewed By: ldionne, #libc

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

3 years agoRevert "[llvm-cov] don't include all source files when provided source files are...
Jeremy Morse [Fri, 16 Oct 2020 12:41:14 +0000 (13:41 +0100)]
Revert "[llvm-cov] don't include all source files when provided source files are filtered out"

This reverts commit c2bd20ef652 and the follow up fix 16605bba6fb.

The tools/llvm-cov/warnings.h continues to fail on Windows platforms even
after the follow up, for example on the llvm-clang-win-x-armv7l builder:

    http://lab.llvm.org:8011/#/builders/60/builds/94

3 years ago[globalopt] Teach to look through `addrspacecast`.
Michael Liao [Thu, 8 Oct 2020 23:18:10 +0000 (19:18 -0400)]
[globalopt] Teach to look through `addrspacecast`.

- so that global variables in numbered address spaces could be properly
  analyzed.

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

3 years ago[libc++] NFCI: Use Lit features to disable tests instead of #if
Louis Dionne [Thu, 15 Oct 2020 21:51:43 +0000 (17:51 -0400)]
[libc++] NFCI: Use Lit features to disable tests instead of #if

3 years ago[libc++] NFC: Move iterator.range tests into the right place
Louis Dionne [Thu, 15 Oct 2020 20:58:35 +0000 (16:58 -0400)]
[libc++] NFC: Move iterator.range tests into the right place

They seem to have been placed under stream.iterators by mistake.
This is relevant for some upcoming UNSUPPORTED markup.

3 years ago[Indvars][NFC] Merge two functions together
Max Kazantsev [Fri, 16 Oct 2020 12:15:36 +0000 (19:15 +0700)]
[Indvars][NFC] Merge two functions together

Logic of widenWithVariantUse is split into check and transform
part, unlike any other transform in IndVars. We want to pass some
extra flags from analysis to transform part and standartize
the code at once, so merging them together.

3 years ago[InstCombine] foldSelectRotate - canonicalize to OR(SHL,LSHR). NFCI.
Simon Pilgrim [Fri, 16 Oct 2020 12:18:31 +0000 (13:18 +0100)]
[InstCombine] foldSelectRotate - canonicalize to OR(SHL,LSHR). NFCI.

Match the canonicalization code that was added to matchFunnelShift at rG02295e6d1a15

3 years ago[lldb] Fix FreeBSD build for ea3a547
Pavel Labath [Fri, 16 Oct 2020 11:50:53 +0000 (13:50 +0200)]
[lldb] Fix FreeBSD build for ea3a547

3 years ago[InstCombine] Fix typo in narrow funnel shift test
Simon Pilgrim [Fri, 16 Oct 2020 11:18:16 +0000 (12:18 +0100)]
[InstCombine] Fix typo in narrow funnel shift test

3 years ago[InstCombine] Add trunc+zext 'narrow' funnel shift tests (PR35155)
Simon Pilgrim [Fri, 16 Oct 2020 10:58:39 +0000 (11:58 +0100)]
[InstCombine] Add trunc+zext 'narrow' funnel shift tests (PR35155)

Based on the rotation equivalents in rotate.ll

3 years ago[Indvars][NFCI] Remove meaningless restrictive code in IndVars
Max Kazantsev [Fri, 16 Oct 2020 11:00:02 +0000 (18:00 +0700)]
[Indvars][NFCI] Remove meaningless restrictive code in IndVars

Variable ExtendOperExpr only exists to check whether it is a SCEV ext.
We create it as SCEV ext right here, so semantically this check is
trivially true. In theory, it may fail if SCEV is smart enough and can
simplify the expression. However, no matter whether it is an ext or not,
we never use this fact for further reasoning. So this code is currently
useless and in theory may become harmful with SCEV's development.

We do not expect any behavior changes with removing it. If it caused
negative changes, the patch should be reverted.

3 years ago[AMDGPU] Add a message to an assert
Sebastian Neubauer [Thu, 15 Oct 2020 14:23:36 +0000 (16:23 +0200)]
[AMDGPU] Add a message to an assert

3 years ago[Indvars][NFC] Remove duplicating checks
Max Kazantsev [Fri, 16 Oct 2020 10:33:42 +0000 (17:33 +0700)]
[Indvars][NFC] Remove duplicating checks

Some facts have already been checked in widenWithVariantUse and then
checked again in widenWithVariantUseCodegen. The latter is redundant,
we can replace it with asserts.

3 years agoRecommit "[SCEV] Use nw flag and symbolic iteration count to sharpen ranges of AddRecs"
Max Kazantsev [Fri, 16 Oct 2020 08:13:27 +0000 (15:13 +0700)]
Recommit "[SCEV] Use nw flag and symbolic iteration count to sharpen ranges of AddRecs"

It was reverted because of negative compile time impact. In this version,
less powerful proof methods are used (non-recursive reasoning only), and
scope limited to constant End values to avoid explision of complex proofs.

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

3 years ago[ValueTracking] Clarify TypeSize comparisons
Cullen Rhodes [Tue, 13 Oct 2020 12:26:47 +0000 (12:26 +0000)]
[ValueTracking] Clarify TypeSize comparisons

TypeSize comparisons using overloaded operators should be replaced by
the new isKnownXY comparators when the operands can be fixed-length or
scalable vectors.

In ValueTracking there are several uses of the overloaded operators in
`isKnownNonZero` and `ComputeMultiple`. In the former we already bail
out on scalable vectors since we currently have no way to represent
DemandedElts, and the latter is operating on scalar integers, so we can
assume fixed-size in both instances.

Reviewed By: david-arm

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

3 years ago[InstCombine] narrowRotate - minor refactoring for funnel shift support. NFC.
Simon Pilgrim [Fri, 16 Oct 2020 10:27:16 +0000 (11:27 +0100)]
[InstCombine] narrowRotate - minor refactoring for funnel shift support. NFC.

Prep work for PR35155 - renamed narrowRotate to narrowFunnelShift, rewrote some comments and adjusted code to collect separate shift values, although we bail if they don't match (still only rotations are only actually folded).

I'm trying to match matchFunnelShift as much as possible in case we finally get to merge these one day.

3 years ago[SVE][CodeGen]Use getFixedSize() function for TypeSize comparison in clang
Caroline Concatto [Mon, 12 Oct 2020 14:38:45 +0000 (15:38 +0100)]
[SVE][CodeGen]Use getFixedSize() function for TypeSize comparison in clang

This patch makes sure that the instance of TypeSize comparison operator
is done with a fixed type size.

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

3 years ago[InstCombine] foldAndOrOfICmpsOfAndWithPow2 - add vector support
Simon Pilgrim [Fri, 16 Oct 2020 09:41:25 +0000 (10:41 +0100)]
[InstCombine] foldAndOrOfICmpsOfAndWithPow2 - add vector support

Support vector cases for folding:

 (iszero(A & K1) | iszero(A & K2)) -> (A & (K1 | K2)) != (K1 | K2)
 (!iszero(A & K1) & !iszero(A & K2)) -> (A & (K1 | K2)) == (K1 | K2)

3 years ago[MemLoc] Support memchr/memccpy in MemoryLocation::getForArgument
Dávid Bolvanský [Fri, 16 Oct 2020 09:24:56 +0000 (11:24 +0200)]
[MemLoc] Support memchr/memccpy in MemoryLocation::getForArgument

Reviewed By: fhahn

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

3 years ago[SCEV] Add a few test cases where the max BTC is limited by wrapping.
Florian Hahn [Fri, 16 Oct 2020 08:52:43 +0000 (09:52 +0100)]
[SCEV] Add a few test cases where the max BTC is limited by wrapping.

3 years ago[AMDGPU] Correct comment typo in AMDGPUSubtarget.h
Tony [Fri, 16 Oct 2020 08:47:51 +0000 (08:47 +0000)]
[AMDGPU] Correct comment typo in AMDGPUSubtarget.h

3 years agoRecommit "[DSE] Switch to MemorySSA-backed DSE by default."
Florian Hahn [Fri, 16 Oct 2020 07:42:18 +0000 (08:42 +0100)]
Recommit "[DSE] Switch to MemorySSA-backed DSE by default."

After investigation by @asbirlea, the issue that caused the
revert appears to be an issue in the original source, rather
than a problem with the compiler.

This patch enables MemorySSA DSE again.

This reverts commit 915310bf14cbac58a81fd60e0fa9dc8d341108e2.

3 years agoFix hidden-redecls.m test for some environments
Konstantin Schwarz [Thu, 15 Oct 2020 09:57:19 +0000 (11:57 +0200)]
Fix hidden-redecls.m test for some environments

This test was failing in our CI environment, because Jenkins mounts the workspaces into Docker containers using their full path, i.e. /home/jenkins/workspaces/llvm-build.
We've seen permission denied errors because /home/jenkins is mounted with root permissions and the default cache directory under Linux is $HOME/.cache.

The fix is to explicitly provide the -fmodules-cache-path, which the other tests already seem to provide.

Reviewed By: akyrtzi

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

3 years agoRevert "[SCEV] Use nw flag and symbolic iteration count to sharpen ranges of AddRecs"
Nikita Popov [Fri, 16 Oct 2020 07:44:26 +0000 (09:44 +0200)]
Revert "[SCEV] Use nw flag and symbolic iteration count to sharpen ranges of AddRecs"

This reverts commit 905101c36025fe1c8ecdf9a20cd59db036676073.

This causes a large compile-time regression:
https://llvm-compile-time-tracker.com/compare.php?from=cc175c2cc8e638462bab74e0781e06f9b6eb5017&to=905101c36025fe1c8ecdf9a20cd59db036676073&stat=instructions