platform/upstream/llvm.git
3 years ago[NFC][Asan] Reorder bitfields
Vitaly Buka [Tue, 15 Sep 2020 07:07:56 +0000 (00:07 -0700)]
[NFC][Asan] Reorder bitfields

Depends on D87644.

Reviewed By: morehouse

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

3 years agoRevert "[Sema] Address-space sensitive index check for unbounded arrays"
Chris Hamilton [Tue, 15 Sep 2020 06:54:41 +0000 (01:54 -0500)]
Revert "[Sema] Address-space sensitive index check for unbounded arrays"

This reverts commit da55e9ba1273284f1af61bceeaeb25e487838034.

Build bots uncovered coverage gap in testing.  Change not ready.

3 years ago[NFC][Asan] Remove from_memalign and rz_log
Vitaly Buka [Tue, 15 Sep 2020 06:54:48 +0000 (23:54 -0700)]
[NFC][Asan] Remove from_memalign and rz_log

Before D87643 they where used to optimize UsedSize(). Which was
called frequently from leak scanner.
It was also used for calls from QuarantineCallback
but we have heavy get_allocator().Deallocate call there anyway.

Depends on D87643.

Reviewed By: morehouse

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

3 years ago[NFC][Asan] Don't use MetaData for size
Vitaly Buka [Tue, 15 Sep 2020 06:53:58 +0000 (23:53 -0700)]
[NFC][Asan] Don't use MetaData for size

Now we have enough space in the ChunkHeader.
45 bit is enough for kMaxAllowedMallocSize.

Depends on D87642.

Reviewed By: morehouse

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

3 years ago[X86] Pre-commit test cases for D87593
Craig Topper [Tue, 15 Sep 2020 05:41:39 +0000 (22:41 -0700)]
[X86] Pre-commit test cases for D87593

The memory operand for these is incorrect.

3 years ago[NFC][lsan][fuzzer] Relax fuzzer-leak.test
Vitaly Buka [Tue, 15 Sep 2020 02:44:27 +0000 (19:44 -0700)]
[NFC][lsan][fuzzer] Relax fuzzer-leak.test

With lsan we can't guarantee to catch leak on the same iteration.

3 years ago[Windows][Polly] Disable LLVMPolly module for all compilers on Windows
Mateusz Mikuła [Tue, 15 Sep 2020 06:12:02 +0000 (09:12 +0300)]
[Windows][Polly] Disable LLVMPolly module for all compilers on Windows

Before this patch, the cmake disabled loadable modules when compiling
with Visual Studio. However, the reason for this is a limitation of the
Windows DLLs, thus this restriction should apply to any compiler for the
Windows platform, such as MinGW, Cygwin, icc, etc.

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

3 years ago[LLD] Allow configuring default ld.lld backend
Mateusz Mikuła [Tue, 15 Sep 2020 05:39:15 +0000 (08:39 +0300)]
[LLD] Allow configuring default ld.lld backend

The motivation for this is ld.lld --help targeting MinGW which
currently prints help for the ELF backend unless -m i386pe{,p} is
added. This confuses build systems that grep through linker help to
find supported flags.

This matches LD from Binutils which always prints help for MinGW
when configured to target it.

After this change, the backend can still be overridden to any
supported ELF/MinGW target by using correct -m <arch>.

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

3 years ago[llvm-readobj] [ARMWinEH] Print ARM64 packed unwind info
Martin Storsjö [Fri, 4 Sep 2020 20:42:22 +0000 (23:42 +0300)]
[llvm-readobj] [ARMWinEH] Print ARM64 packed unwind info

In addition to printing the individual fields, synthesize and
print the corresponding prolog for the unwind info (in reverse
order, to match how it's printed for non-packed unwind info).

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

3 years ago[BinaryFormat/MachO] Add a missing constant.
Davide Italiano [Tue, 15 Sep 2020 05:29:53 +0000 (22:29 -0700)]
[BinaryFormat/MachO] Add a missing constant.

Reference:
https://opensource.apple.com/source/cctools/cctools-949.0.1/include/mach-o/loader.h.auto.html

3 years ago[DebugInfo] Make offsets of dwarf units 64-bit (19/19).
Igor Kudrin [Tue, 15 Sep 2020 04:32:08 +0000 (11:32 +0700)]
[DebugInfo] Make offsets of dwarf units 64-bit (19/19).

In the case of LTO, several DWARF units can be emitted in one section.
For an extremely large application, they may exceed the limit of 4GiB
for 32-bit offsets. As it is now possible to emit 64-bit debugging info,
the patch enables storing the larger offsets.

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

3 years ago[DebugInfo] Make the offset of string pool entries 64-bit (18/19).
Igor Kudrin [Tue, 15 Sep 2020 04:32:01 +0000 (11:32 +0700)]
[DebugInfo] Make the offset of string pool entries 64-bit (18/19).

The string pool is shared among several units in the case of LTO,
and it potentially can exceed the limit of 4GiB for an extremely
large application. As it is now possible to emit 64-bit debugging
info, the limitation can be removed.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_macro[.dwo] sections (17/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:55 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_macro[.dwo] sections (17/19).

The patch fixes emitting flags and the debug_line_offset field in
the header, as well as the reference to the macro string for
a pre-standard GNU .debug_macro extension.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_names sections (16/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:49 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_names sections (16/19).

The patch fixes emitting the unit length field in the header of
the table and offsets to the entry pool. Note that while the patch
changes the common method to emit offsets, in fact, nothing is changed
for Apple accelerator tables, because we do not yet support DWARF64 for
those targets.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_addr sections (15/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:41 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_addr sections (15/19).

The patch fixes emitting the header of the table. The content is
independent of the DWARF format.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_loclists sections (14/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:34 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_loclists sections (14/19).

The size of the offsets in the table depends on the DWARF format.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_rnglists sections (13/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:28 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_rnglists sections (13/19).

The size of the offsets in the table depends on the DWARF format.

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

3 years ago[DebugInfo] Fix emitting pre-v5 name lookup tables in the DWARF64 format (12/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:20 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting pre-v5 name lookup tables in the DWARF64 format (12/19).

The transition is done by using methods of AsmPrinter which
automatically emit values in compliance with the selected DWARF format.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_aranges sections (11/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:14 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_aranges sections (11/19).

The patch fixes calculating the size of the table and emitting
the fields which depend on the DWARF format by using methods that
choose appropriate sizes automatically.

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

3 years ago[DebugInfo] Fix emitting DWARF64 type units (10/19).
Igor Kudrin [Tue, 15 Sep 2020 04:31:07 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 type units (10/19).

The patch fixes emitting the offset to the type DIE. All other fields
are already fixed in previous patches.

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

3 years ago[DebugInfo] Fix emitting DWARF64 DWO compilation units and string offset tables ...
Igor Kudrin [Tue, 15 Sep 2020 04:31:00 +0000 (11:31 +0700)]
[DebugInfo] Fix emitting DWARF64 DWO compilation units and string offset tables (9/19).

These two fixes are better to go together because llvm-dwarfdump is
unable to dump a table when another one is malformed.

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

3 years ago[DebugInfo] Fix emitting DWARF64 .debug_str_offsets sections (8/19).
Igor Kudrin [Tue, 15 Sep 2020 04:30:53 +0000 (11:30 +0700)]
[DebugInfo] Fix emitting DWARF64 .debug_str_offsets sections (8/19).

The patch fixes calculating the size of the table and emitting the unit
length field.

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

3 years ago[DebugInfo] Fix emitting the DW_AT_location attribute for 64-bit DWARFv3 (7/19).
Igor Kudrin [Tue, 15 Sep 2020 04:30:46 +0000 (11:30 +0700)]
[DebugInfo] Fix emitting the DW_AT_location attribute for 64-bit DWARFv3 (7/19).

The patch uses a common method to determine the appropriate form for
the value of the attribute.

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

3 years ago[DebugInfo] Use a common method to determine a suitable form for section offsts ...
Igor Kudrin [Tue, 15 Sep 2020 04:30:38 +0000 (11:30 +0700)]
[DebugInfo] Use a common method to determine a suitable form for section offsts (6/19).

This is mostly an NFC patch because the involved methods are used when
emitting DWO files, which is incompatible with DWARFv3, or for platforms
where DWARF64 is not supported yet.

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

3 years ago[DebugInfo] Fix emitting DWARF64 compilation units (5/19).
Igor Kudrin [Tue, 15 Sep 2020 04:30:30 +0000 (11:30 +0700)]
[DebugInfo] Fix emitting DWARF64 compilation units (5/19).

The patch also adds a method to choose an appropriate DWARF form
to represent section offsets according to the version and the format
of producing debug info.

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

3 years ago[DebugInfo] Add the -dwarf64 switch to llc and other internal tools (4/19).
Igor Kudrin [Tue, 15 Sep 2020 04:30:18 +0000 (11:30 +0700)]
[DebugInfo] Add the -dwarf64 switch to llc and other internal tools (4/19).

The patch adds a switch to enable emitting debug info in the 64-bit
DWARF format. Most emitter for sections will be updated in the subsequent
patches, whereas for .debug_line and .debug_frame the emitters are in
the MC library, which is already updated.

For now, the switch is enabled only for 64-bit ELF targets.

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

3 years ago[DebugInfo] Add new emitting methods for values which depend on the DWARF format...
Igor Kudrin [Tue, 15 Sep 2020 04:30:10 +0000 (11:30 +0700)]
[DebugInfo] Add new emitting methods for values which depend on the DWARF format (3/19).

These methods are going to be used in subsequent patches.

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

3 years ago[DebugInfo] Fix DIE value emitters to be compatible with DWARF64 (2/19).
Igor Kudrin [Tue, 15 Sep 2020 04:30:02 +0000 (11:30 +0700)]
[DebugInfo] Fix DIE value emitters to be compatible with DWARF64 (2/19).

DW_FORM_sec_offset and DW_FORM_strp imply values of different sizes with
DWARF32 and DWARF64. The patch fixes DIE value classes to use correct
sizes when emitting their values. For DIELocList it ensures that the
requested DWARF form matches the current DWARF format because that class
uses a method that selects the size automatically.

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

3 years ago[DebugInfo] Fix methods of AsmPrinter to emit values corresponding to the DWARF forma...
Igor Kudrin [Tue, 15 Sep 2020 04:29:48 +0000 (11:29 +0700)]
[DebugInfo] Fix methods of AsmPrinter to emit values corresponding to the DWARF format (1/19).

These methods are used to emit values which are 32-bit in DWARF32 and
64-bit in DWARF64. The patch fixes them so that they choose the length
automatically, depending on the DWARF format set in the Context.

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

3 years ago[lld][WebAssembly] Allow globals imports via import_name/import_module
Sam Clegg [Tue, 15 Sep 2020 02:20:25 +0000 (19:20 -0700)]
[lld][WebAssembly] Allow globals imports via import_name/import_module

This feature already exists but was limited to function
symbols.

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

3 years ago[DebugInfo] Remove dots from getFilenameByIndex return value
Petr Hosek [Tue, 15 Sep 2020 00:44:12 +0000 (17:44 -0700)]
[DebugInfo] Remove dots from getFilenameByIndex return value

When concatenating directory with filename in getFilenameByIndex, we
might end up with a path that contains extra dots. For example, if the
input is /path and ./example, we would return /path/./example. Run
sys::path::remove_dots on the output to eliminate unnecessary dots.

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

3 years ago[Coroutines] Fix a typo in documentation
Xun Li [Tue, 15 Sep 2020 01:56:31 +0000 (18:56 -0700)]
[Coroutines] Fix a typo in documentation

In the example, the variable that's crossing suspend point was referred wrongly, fix it.

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

3 years ago[GlobalISel] Add a `X, Y = G_UNMERGE(G_ZEXT Z)` -> X = G_ZEXT Z; Y = 0 combine
Quentin Colombet [Thu, 10 Sep 2020 01:03:00 +0000 (18:03 -0700)]
[GlobalISel] Add a `X, Y = G_UNMERGE(G_ZEXT Z)` -> X = G_ZEXT Z; Y = 0 combine

Add a combiner helper to transform unmerge of zext into one zext and
a constant 0

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

3 years ago[GlobalISel] Add `X,Y<dead> = G_UNMERGE Z` -> X = G_TRUNC Z
Quentin Colombet [Sat, 5 Sep 2020 00:09:38 +0000 (17:09 -0700)]
[GlobalISel] Add `X,Y<dead> = G_UNMERGE Z` -> X = G_TRUNC Z

Add a combiner helper that replaces G_UNMERGE where all the destination lanes
are dead except the first one with a G_TRUNC.

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

3 years ago[libc++abi] Do not declare __cxa_finalize and __cxa_atexit in <cxxabi.h>
Louis Dionne [Mon, 14 Sep 2020 21:16:46 +0000 (17:16 -0400)]
[libc++abi] Do not declare __cxa_finalize and __cxa_atexit in <cxxabi.h>

These functions are not defined by libc++abi, so they don't belong in <cxxabi.h>.

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

3 years ago[flang] Respect BZ mode in exponent parts, too
peter klausler [Mon, 14 Sep 2020 23:11:45 +0000 (16:11 -0700)]
[flang] Respect BZ mode in exponent parts, too

The Fortran standard discusses BZ mode (treat blanks as zero digits)
explicitly in its effect on the editing of the digits prior to the
exponent part, but doesn't mention it in description of the
exponent part.  Other compilers honor BZ mode in the exponent,
so we should do so too.  So "1 e 1 " is 1.E11 in BZ mode.

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

3 years ago[X86] Place new constant node in topological order in X86DAGToDAGISel::matchBitExtract
Craig Topper [Mon, 14 Sep 2020 23:33:23 +0000 (16:33 -0700)]
[X86] Place new constant node in topological order in X86DAGToDAGISel::matchBitExtract

Fixes PR47482

3 years agoRevert "[X86] Place new constant node in topological order in X86DAGToDAGISel::matchB...
Craig Topper [Mon, 14 Sep 2020 23:33:08 +0000 (16:33 -0700)]
Revert "[X86] Place new constant node in topological order in X86DAGToDAGISel::matchBitExtract."

I got the bug number wrong.

This reverts commit 32515938901685bcbc438d5f5bb03cb8a9f4c637.

3 years ago[flang] Allow Fortran comments after #include path
peter klausler [Mon, 14 Sep 2020 21:09:01 +0000 (14:09 -0700)]
[flang] Allow Fortran comments after #include path

C-style /*comments*/ are removed during preprocessing directive
tokenization, but Fortran !comments need to be specifically
allowed.

Fixes LLVM bugzilla 47466.

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

3 years ago[AArch64] Statepoint support for AArch64.
Philip Reames [Mon, 14 Sep 2020 23:38:48 +0000 (16:38 -0700)]
[AArch64] Statepoint support for AArch64.

Differential Revision: https://reviews.llvm.org/D66012
Patch By: loicottet (with major rebase by me)

3 years ago[Asan] Accept __lsan_ignore_object for redzone pointer
Vitaly Buka [Mon, 14 Sep 2020 23:32:25 +0000 (16:32 -0700)]
[Asan] Accept __lsan_ignore_object for redzone pointer

The check that the pointer inside of the user part of the chunk does not
adds any value, but it's the last user of AddrIsInside.

I'd like to simplify AsanChunk in followup patches.

Reviewed By: morehouse

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

3 years ago[GlobalISel] Add G_UNMERGE(Cst) -> Cst1, Cst2, ... combine
Quentin Colombet [Fri, 4 Sep 2020 21:27:42 +0000 (14:27 -0700)]
[GlobalISel] Add G_UNMERGE(Cst) -> Cst1, Cst2, ... combine

Add a combiner helper that replaces G_UNMERGE of big constants into direct
use of smaller constants.

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

3 years ago[X86] Place new constant node in topological order in X86DAGToDAGISel::matchBitExtract.
Craig Topper [Mon, 14 Sep 2020 23:28:11 +0000 (16:28 -0700)]
[X86] Place new constant node in topological order in X86DAGToDAGISel::matchBitExtract.

Fixes PR47525

3 years ago[Sema] Address-space sensitive index check for unbounded arrays
Chris Hamilton [Mon, 14 Sep 2020 23:12:12 +0000 (18:12 -0500)]
[Sema] Address-space sensitive index check for unbounded arrays

Check applied to unbounded (incomplete) arrays and pointers
to spot cases where the computed address is beyond the
largest possible addressable extent of the array, based
on the address space in which the array is delcared, or
which the pointer refers to.

Check helps to avoid cases of nonsense pointer math and
array indexing which could lead to linker failures or
runtime exceptions.  Of particular interest when building
for embedded systems with small address spaces.

Reviewed By: aaron.ballman

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

3 years ago[Hexagon] Add more detailed testcase for widening truncates
Krzysztof Parzyszek [Mon, 14 Sep 2020 21:37:41 +0000 (16:37 -0500)]
[Hexagon] Add more detailed testcase for widening truncates

3 years ago[Hexagon] Widen loads and handle any-/sign-/zero-extensions
Krzysztof Parzyszek [Mon, 14 Sep 2020 19:04:54 +0000 (14:04 -0500)]
[Hexagon] Widen loads and handle any-/sign-/zero-extensions

3 years ago[Hexagon] Some HVX DAG combines
Krzysztof Parzyszek [Mon, 14 Sep 2020 21:06:10 +0000 (16:06 -0500)]
[Hexagon] Some HVX DAG combines

1. VINSERTW0 x, undef -> x
2. VROR (VROR x, a), b) -> VROR x, a+b

3 years agoReland [docs][NewPM] Add docs for writing NPM passes
Arthur Eubanks [Tue, 1 Sep 2020 01:36:11 +0000 (18:36 -0700)]
Reland [docs][NewPM] Add docs for writing NPM passes

As to not conflict with the legacy PM example passes under
llvm/lib/Transforms/Hello, this is under HelloNew. This makes the
CMakeLists.txt and general directory structure less confusing for people
following the example.

Much of the doc structure was taken from WritinAnLLVMPass.rst.

This adds a HelloWorld pass which simply prints out each function name.

More will follow after this, e.g. passes over different units of IR, analyses.
https://llvm.org/docs/WritingAnLLVMPass.html contains a lot more.

Relanded with missing "Support" dependency in LLVMBuild.txt.

Reviewed By: ychen, asbirlea

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

3 years ago[GISel]: Add combine for G_FABS to G_FABS
Aditya Nandakumar [Mon, 14 Sep 2020 22:43:52 +0000 (15:43 -0700)]
[GISel]: Add combine for G_FABS to G_FABS

https://reviews.llvm.org/D87554

Patch adds one new GICombinerRule for G_FABS. The combine rule folds G_FABS(G_FABS(X)) to G_FABS(X).
Patch additionally adds new combiner tests for the AArch64 target to test this new combiner rule.

Patch by mkitzan.

3 years agoRevert "[docs][NewPM] Add docs for writing NPM passes"
Arthur Eubanks [Mon, 14 Sep 2020 22:55:17 +0000 (15:55 -0700)]
Revert "[docs][NewPM] Add docs for writing NPM passes"

This reverts commit c2590de30df23ef0db39b496cdec62a83a61fbfa.

Breaks shared libs build

3 years ago[GlobalISel] Add G_UNMERGE_VALUES(G_MERGE_VALUES) combine
Quentin Colombet [Thu, 3 Sep 2020 23:06:14 +0000 (16:06 -0700)]
[GlobalISel] Add G_UNMERGE_VALUES(G_MERGE_VALUES) combine

Add the matching and applying function to the combiner helper for
G_UNMERGE_VALUES(G_MERGE_VALUES).

This combine also supports any merge-like input nodes, like G_BUILD_VECTORS
and is robust against bitcasts in between int unmerge and merge nodes.

When the input type of the merge node and the output type of the unmerge
node are not the same, but the sizes are, the combine still applies but
creates bitcasts between the sources and the destinations instead of
reusing the destinations directly.

Long term, the artifact combiner should probably reuse that helper, but
as of today, it doesn't use any outside helper, so I kept it this way.

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

3 years ago[flang] Fix bug for forward referenced type
Peter Steinfeld [Fri, 11 Sep 2020 18:02:04 +0000 (11:02 -0700)]
[flang] Fix bug for forward referenced type

A type name in an IMPLICIT declaration that was later used in a PARAMETER
statement caused problems because the default symbol scope had not yet been
initialized.  I avoided dereferencing in the situation where the default scope
was uninitialized and added a test that triggers the problem.

Also, once I corrected the bad dereference, the compiler was putting out
misleading error messages.  The underlying error us due to violating section
7.5.10, paragraph 4, which states:
  A structure constructor shall not appear before the referenced type is
  defined.

I fixed this by testing to see if a type that is used in a structure
constructor is forward referenced.

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

3 years ago[Take 2] [libc++] Make rotate a constexpr.
zoecarver [Mon, 14 Sep 2020 22:11:08 +0000 (18:11 -0400)]
[Take 2] [libc++] Make rotate a constexpr.

This patch makes `std::rotate` a constexpr. In doing so, this patch also
updates the internal `__move` and `__move_backward` funtions to be
constexpr.

This patch was previously reverted in ed653184ac63 because it was missing
some UNSUPPORTED markup for older compilers. This commit adds it.

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

3 years agoRevert "[libc++] Make rotate a constexpr."
zoecarver [Mon, 14 Sep 2020 21:47:43 +0000 (14:47 -0700)]
Revert "[libc++] Make rotate a constexpr."

This reverts commit 1ec02efee9b1d01cde89f31ca9ba6a46b7662ac5.

3 years ago[flang] More clean-up of CookedSource API
peter klausler [Mon, 14 Sep 2020 20:39:52 +0000 (13:39 -0700)]
[flang] More clean-up of CookedSource API

The std::string holding the content of a CookedSource no longer
needs to be exposed in its API after the recent work that allows
the parsing context to hold multiple instances of a CookedSource.
So clean the API.  These changes were extracted from some work in
progress that was made easier by the API changes.

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

3 years ago[PruneEH][NFC] Use CallGraphUpdater in PruneEH
Arthur Eubanks [Mon, 14 Sep 2020 19:07:17 +0000 (12:07 -0700)]
[PruneEH][NFC] Use CallGraphUpdater in PruneEH

In preparation for porting the pass to NPM.

Reviewed By: asbirlea

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

3 years ago[docs] Update OrcV1 removal timeline.
Lang Hames [Mon, 14 Sep 2020 21:23:20 +0000 (14:23 -0700)]
[docs] Update OrcV1 removal timeline.

3 years ago[libc++][test] Portability fix of std::strstreambuf constructor test
Louis Dionne [Mon, 14 Sep 2020 21:05:49 +0000 (17:05 -0400)]
[libc++][test] Portability fix of std::strstreambuf constructor test

The standard does not require the constructor `strstreambuf(streamsize alsize_arg = 0)`
leave the stream array unallocated when called with parameter `alsize_arg > 0`.
Conformant implementations of this constructor may allocate minimal `alsize_arg`
number of bytes forcing `str()` method to return non-null pointer.

Thanks to Andrey Maksimov for the patch.

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

3 years agoFix MLIR standalone example to properly handle namespace
Mehdi Amini [Mon, 14 Sep 2020 21:02:33 +0000 (21:02 +0000)]
Fix MLIR standalone example to properly handle namespace

ODS TableGen backend now requires to spell out which namespace they have
to be nested in, in an absolute way.

3 years ago[libc++] Finish implementing P0202R3
Nicholas-Baron [Mon, 14 Sep 2020 20:37:41 +0000 (16:37 -0400)]
[libc++] Finish implementing P0202R3

cppreference lists the support for this paper as partial.
I found 4 functions which the paper marks as `constexpr`,
but did not use the appropriate macro.

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

3 years ago[libc++] Make rotate a constexpr.
zoecarver [Mon, 14 Sep 2020 20:52:42 +0000 (13:52 -0700)]
[libc++] Make rotate a constexpr.

This patch makes `std::rotate` a constexpr. In doing so, this patch also
updates the internal `__move` and `__move_backward` funtions to be
constexpr.

Reviewed By: ldionne

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

3 years ago[SelectionDAG] Use Align/MaybeAlign in calls to getLoad/getStore/getExtLoad/getTruncS...
Craig Topper [Mon, 14 Sep 2020 20:54:50 +0000 (13:54 -0700)]
[SelectionDAG] Use Align/MaybeAlign in calls to getLoad/getStore/getExtLoad/getTruncStore.

The versions that take 'unsigned' will be removed in the future.

I tried to use getOriginalAlign instead of getAlign in some
places. getAlign factors in the minimum alignment implied by
the offset in the pointer info. Since we're also passing the
pointer info we can use the original alignment.

Reviewed By: arsenm

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

3 years ago[AMDGPU] Add XDL resource to scheduling model
Austin Kerbow [Mon, 14 Sep 2020 05:32:48 +0000 (22:32 -0700)]
[AMDGPU] Add XDL resource to scheduling model

Reviewed By: rampitec

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

3 years agoUpdate PowerPC backend ownership in CODE_OWNERS.TXT
Nemanja Ivanovic [Mon, 14 Sep 2020 20:45:57 +0000 (15:45 -0500)]
Update PowerPC backend ownership in CODE_OWNERS.TXT

3 years agoMake namespace handling uniform across dialect backends.
Federico Lebrón [Mon, 14 Sep 2020 20:01:07 +0000 (20:01 +0000)]
Make namespace handling uniform across dialect backends.

Now backends spell out which namespace they want to be in, instead of relying on
clients #including them inside already-opened namespaces. This also means that
cppNamespaces should be fully qualified, and there's no implicit "::mlir::"
prepended to them anymore.

Reviewed By: mehdi_amini

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

3 years ago[Asan] Fix false leak report
Vitaly Buka [Mon, 14 Sep 2020 20:32:14 +0000 (13:32 -0700)]
[Asan] Fix false leak report

If user thread is in the allocator, the allocator
may have no pointer into future user's part of
the allocated block. AddrIsInside ignores such
pointers and lsan reports a false memory leak.

Reviewed By: morehouse

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

3 years ago[docs][NewPM] Add docs for writing NPM passes
Arthur Eubanks [Tue, 1 Sep 2020 01:36:11 +0000 (18:36 -0700)]
[docs][NewPM] Add docs for writing NPM passes

As to not conflict with the legacy PM example passes under
llvm/lib/Transforms/Hello, this is under HelloNew. This makes the
CMakeLists.txt and general directory structure less confusing for people
following the example.

Much of the doc structure was taken from WritinAnLLVMPass.rst.

This adds a HelloWorld pass which simply prints out each function name.

More will follow after this, e.g. passes over different units of IR, analyses.
https://llvm.org/docs/WritingAnLLVMPass.html contains a lot more.

Reviewed By: ychen, asbirlea

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

3 years ago[gn build] Port 226d80ebe20
LLVM GN Syncbot [Mon, 14 Sep 2020 20:16:21 +0000 (20:16 +0000)]
[gn build] Port 226d80ebe20

3 years ago[MemProf] Rename HeapProfiler to MemProfiler for consistency
Teresa Johnson [Mon, 14 Sep 2020 16:12:13 +0000 (09:12 -0700)]
[MemProf] Rename HeapProfiler to MemProfiler for consistency

This is consistent with the clang option added in
7ed8124d46f94601d5f1364becee9cee8538265e, and the comments on the
runtime patch in D87120.

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

3 years ago[libc++] Add comment in atomic test to explain why part of it is disabled on Apple
Louis Dionne [Mon, 14 Sep 2020 20:12:47 +0000 (16:12 -0400)]
[libc++] Add comment in atomic test to explain why part of it is disabled on Apple

3 years ago[FastISel] Bail out of selectGetElementPtr for vector GEPs.
Craig Topper [Mon, 14 Sep 2020 19:52:54 +0000 (12:52 -0700)]
[FastISel] Bail out of selectGetElementPtr for vector GEPs.

The code that decomposes the GEP into ADD/MUL doesn't work properly
for vector GEPs. It can create bad COPY instructions or possibly
assert.

For now just bail out to SelectionDAG.

Fixes PR45906

3 years ago[ELF] Add documentation for --warn-backrefs: a GNU ld compatibility checking tool...
Fangrui Song [Tue, 8 Sep 2020 18:37:03 +0000 (11:37 -0700)]
[ELF] Add documentation for --warn-backrefs: a GNU ld compatibility checking tool (and lesser of layering detection)

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

3 years ago[PowerPC] Implement Thread Local Storage Support for Local Exec
Kamau Bridgeman [Fri, 11 Sep 2020 14:33:33 +0000 (10:33 -0400)]
[PowerPC] Implement Thread Local Storage Support for Local Exec

This patch is the initial support for the Local Exec Thread Local
Storage model to produce code sequence and relocations correct
to the ABI for the model when using PC relative memory operations.

Patch by: Kamau Bridgeman

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

3 years ago[AArch64] Add additional vecreduce fmax/fmin legalization tests (NFC)
Nikita Popov [Mon, 14 Sep 2020 19:11:56 +0000 (21:11 +0200)]
[AArch64] Add additional vecreduce fmax/fmin legalization tests (NFC)

Add a vector widening test with ninf flag to the existing fmax
tests, and mirror them over into fmin tests.

3 years ago[libc++] Use LLVM 11 instead of trunk on build bots
Louis Dionne [Mon, 14 Sep 2020 19:12:13 +0000 (15:12 -0400)]
[libc++] Use LLVM 11 instead of trunk on build bots

Somehow the snapshot of LLVM trunk we use was seeing failures.

3 years ago[libc] Extend MPFRMatcher to handle 2-input-1-output and support hypot function.
Tue Ly [Fri, 11 Sep 2020 14:33:33 +0000 (10:33 -0400)]
[libc] Extend MPFRMatcher to handle 2-input-1-output and support hypot function.

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

3 years ago[Legalize][ARM][X86] Add float legalization for VECREDUCE
Nikita Popov [Sat, 12 Sep 2020 20:38:51 +0000 (22:38 +0200)]
[Legalize][ARM][X86] Add float legalization for VECREDUCE

This adds SoftenFloatRes, PromoteFloatRes and SoftPromoteHalfRes
legalizations for VECREDUCE, to fill the remaining hole in the SDAG
legalization. These legalizations simply expand the reduction and
let it be recursively legalized. For the PromoteFloatRes case at
least it is possible to do better than that, but it's pretty tricky
(because we need to consider the interaction of three different
vector legalizations and the type promotion) and probably not
really worthwhile.

I haven't added ExpandFloatRes support, as I am not familiar with
ppc_fp128.

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

3 years ago[ARM] Add more tests for vecreduce soft float legalization (NFC)
Nikita Popov [Mon, 14 Sep 2020 18:37:28 +0000 (20:37 +0200)]
[ARM] Add more tests for vecreduce soft float legalization (NFC)

This mirrors the existing fadd tests to fmul, fmin and fmax.

3 years ago[ms] [llvm-ml] Add basic support for SEH, including PROC FRAME
Eric Astor [Mon, 14 Sep 2020 18:32:33 +0000 (14:32 -0400)]
[ms] [llvm-ml] Add basic support for SEH, including PROC FRAME

Add basic support for SEH, including PROC FRAME

Reviewed By: thakis

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

3 years ago[ms] [llvm-ml] Add support for size queries in MASM
Eric Astor [Mon, 14 Sep 2020 18:25:39 +0000 (14:25 -0400)]
[ms] [llvm-ml] Add support for size queries in MASM

Add support for size inference, sizeof, typeof, and lengthof.

Reviewed By: thakis

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

3 years ago[ms] [llvm-ml] Fix struct padding logic
Eric Astor [Mon, 14 Sep 2020 18:11:29 +0000 (14:11 -0400)]
[ms] [llvm-ml] Fix struct padding logic

MASM structs are end-padded to have size a multiple of the smaller of the requested alignment and the size of their largest field (taken recursively, if they have a field of STRUCT type).

This matches the behavior of ml.exe and ml64.exe. Our original implementation followed the MASM 6.0 documentation, which instead specified that MASM structs were padded to a multiple of their requested alignment.

Reviewed By: thakis

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

3 years ago[ms] [llvm-ml] Add missing built-in type aliases
Eric Astor [Mon, 14 Sep 2020 18:07:33 +0000 (14:07 -0400)]
[ms] [llvm-ml] Add missing built-in type aliases

Add signed aliases for integral types, as well as the "DF" abbreviation for the FWORD type.

Reviewed By: thakis

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

3 years ago[InstCombine] Simplify select operand based on equality condition
Nikita Popov [Thu, 10 Sep 2020 16:45:53 +0000 (18:45 +0200)]
[InstCombine] Simplify select operand based on equality condition

For selects of the type X == Y ? A : B, check if we can simplify A
by using the X == Y equality and replace the operand if that's
possible. We already try to do this in InstSimplify, but will only
fold if the result of the simplification is the same as B, in which
case the select can be dropped entirely. Here the select will be
retained, just one operand simplified.

As we are performing an actual replacement here, we don't have
problems with refinement / poison values.

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

3 years ago[DAGCombiner] Fold fmin/fmax with INF / FLT_MAX
Nikita Popov [Sat, 12 Sep 2020 22:12:30 +0000 (00:12 +0200)]
[DAGCombiner] Fold fmin/fmax with INF / FLT_MAX

Similar to D87415, this folds the various float min/max opcodes
with a constant INF or -INF operand, or FLT_MAX / -FLT_MAX operand
if the ninf flag is set. Some of the folds are only possible under
nnan.

The fminnum(X, INF) with nnan and fmaxnum(X, -INF) with nnan cases
are needed to improve the VECREDUCE_FMIN/FMAX lowerings on X86,
the rest is here for the sake of completeness.

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

3 years agoFix 132e57bc597bd3f50174b7d286c43f76b47f11c1
Walter Erquinigo [Mon, 14 Sep 2020 17:53:48 +0000 (10:53 -0700)]
Fix 132e57bc597bd3f50174b7d286c43f76b47f11c1

Compile error found in
http://lab.llvm.org:8011/builders/lldb-x86_64-debian/builds/17403/steps/build/logs/stdio

Simple fix

3 years ago[libc++] Upgrade the Clang on build bots
Louis Dionne [Mon, 14 Sep 2020 17:51:23 +0000 (13:51 -0400)]
[libc++] Upgrade the Clang on build bots

3 years agoRetry of D84974
Walter Erquinigo [Wed, 2 Sep 2020 01:52:14 +0000 (18:52 -0700)]
Retry of D84974

- Fix a small issue caused by a conflicting name (GetObject) on Windows.
  The fix was to rename the internal GetObject function to
  GetNextFunction.

3 years agocollectBitParts - use const references. NFCI.
Simon Pilgrim [Mon, 14 Sep 2020 17:16:17 +0000 (18:16 +0100)]
collectBitParts - use const references. NFCI.

Fixes clang-tidy warnings first noticed on D87452.

3 years agoLet -basic-block-sections=labels emit basicblock metadata in a new .bb_addr_map secti...
Rahman Lavaee [Mon, 14 Sep 2020 17:16:44 +0000 (10:16 -0700)]
Let -basic-block-sections=labels emit basicblock metadata in a new .bb_addr_map section, instead of emitting special unary-encoded symbols.

This patch introduces the new .bb_addr_map section feature which allows us to emit the bits needed for mapping binary profiles to basic blocks into a separate section.
The format of the emitted data is represented as follows. It includes a header for every function:

|  Address of the function                      |  -> 8 bytes (pointer size)
|  Number of basic blocks in this function (>0) |  -> ULEB128

The header is followed by a BB record for every basic block. These records are ordered in the same order as MachineBasicBlocks are placed in the function. Each BB Info is structured as follows:

|  Offset of the basic block relative to function begin |  -> ULEB128
|  Binary size of the basic block                       |  -> ULEB128
|  BB metadata                                          |  -> ULEB128  [ MBB.isReturn() OR MBB.hasTailCall() << 1  OR  MBB.isEHPad() << 2 ]

The new feature will replace the existing "BB labels" functionality with -basic-block-sections=labels.
The .bb_addr_map section scrubs the specially-encoded BB symbols from the binary and makes it friendly to profilers and debuggers.
Furthermore, the new feature reduces the binary size overhead from 70% bloat to only 12%.

For more information and results please refer to the RFC: https://lists.llvm.org/pipermail/llvm-dev/2020-July/143512.html

Reviewed By: MaskRay, snehasish

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

3 years ago[flang] Fix analyzed form of type-bound assignment
Tim Keith [Mon, 14 Sep 2020 16:59:49 +0000 (09:59 -0700)]
[flang] Fix analyzed form of type-bound assignment

Change the analyzed form of type-bound assignment to match that of call
statements. Resolve the binding name to a specific subprogram when
possible by using `GetBindingResolution`. Otherwise leave it as a
type-bound procedure call.

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

3 years ago[ELF] Define a reportRangeError() overload for thunks and tidy up recent PPC64 thunk...
Fangrui Song [Fri, 11 Sep 2020 16:31:37 +0000 (09:31 -0700)]
[ELF] Define a reportRangeError() overload for thunks and tidy up recent PPC64 thunk range errors

Prefer `errorOrWarn` to `fatal` for recoverable errors and graceful degradation
when --noinhibit-exec is specified.

Mention the destination symbol, otherwise the diagnostic is not really actionable.
Two errors are not tested but the patch does not intend to add the coverage.

Reviewed By: grimar

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

3 years ago[libc] Decouple string functions.
cgyurgyik [Mon, 14 Sep 2020 16:20:58 +0000 (12:20 -0400)]
[libc] Decouple string functions.

This revision removes dependencies that exist between different string functions. This allows for the libc user to use a specific function X of this library without also depending on Y and Z.

Reviewed By: sivachandra

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

3 years ago[flang] Correctly detect overlapping integer cases
Tim Keith [Mon, 14 Sep 2020 16:10:45 +0000 (09:10 -0700)]
[flang] Correctly detect overlapping integer cases

Integer case values were being compared as unsigned by operator<
on evaluate::value::Integer. Change that to signed so that overlap
can be detected correctly.

Explicit CompareUnsigned and BLT are still available if unsigned
comparison is needed.

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

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

3 years ago[InstSimplify] add folds for fmin/fmax with 'nnan'
Sanjay Patel [Mon, 14 Sep 2020 15:42:34 +0000 (11:42 -0400)]
[InstSimplify] add folds for fmin/fmax with 'nnan'

maximum(nnan X, +INF) --> +INF
minimum(nnan X, -INF) --> -INF

This is based on the similar codegen transform proposed in:
D87571

3 years agoSema: add support for `__attribute__((__swift_objc_members__))`
Saleem Abdulrasool [Tue, 8 Sep 2020 22:33:02 +0000 (22:33 +0000)]
Sema: add support for `__attribute__((__swift_objc_members__))`

This adds the `__swift_objc_members__` attribute to the semantic
analysis.  It allows for annotating ObjC interfaces to provide Swift
semantics indicating that the types derived from this interface will be
back-bridged to Objective-C to allow interoperability with Objective-C
and Swift.

This is based on the work of the original changes in
https://github.com/llvm/llvm-project-staging/commit/8afaf3aad2af43cfedca7a24cd817848c4e95c0c

Differential Revision: https://reviews.llvm.org/D87395
Reviewed By: Aaron Ballman, Dmitri Gribenko

3 years ago[InstSimplify] allow folds for fmin/fmax with 'ninf'
Sanjay Patel [Mon, 14 Sep 2020 15:13:09 +0000 (11:13 -0400)]
[InstSimplify] allow folds for fmin/fmax with 'ninf'

maxnum(ninf X, +FLT_MAX) --> +FLT_MAX
minnum(ninf X, -FLT_MAX) --> -FLT_MAX

This is based on the similar codegen transform proposed in:
D87571

3 years ago[MemorySSA] Make sure PerformedPhiTrans is updated for each visited def.
Florian Hahn [Mon, 14 Sep 2020 14:51:17 +0000 (15:51 +0100)]
[MemorySSA] Make sure PerformedPhiTrans is updated for each visited def.

1ce82015f6d0 added a fix to restrict phi optimizations after phi
translations. But the current use of performedPhiTranslation only
checked whether phi translation happened for the first iterator and
missed cases where phi translations happens at subsequent
iterators/upwards defs.

This patch changes upward_defs_iteartor to take a pointer to a bool, so
we can easily ensure the final value includes all visited defs, while
still being able to conveniently use it with make_range & co.

3 years ago[MemorySSA] Precommit test case for PR47498.
Florian Hahn [Mon, 14 Sep 2020 14:33:50 +0000 (15:33 +0100)]
[MemorySSA] Precommit test case for PR47498.

3 years agoAssert we've found the size of each (non-overlapping) structure. NFCI.
Simon Pilgrim [Mon, 14 Sep 2020 14:37:47 +0000 (15:37 +0100)]
Assert we've found the size of each (non-overlapping) structure. NFCI.

Fixes clang static analyzer warning.

3 years ago[libcxx] ostream{,buf}_iterator::difference_type changes in C++20
Louis Dionne [Fri, 11 Sep 2020 14:15:56 +0000 (10:15 -0400)]
[libcxx] ostream{,buf}_iterator::difference_type changes in C++20

In C++20, since P0896R4, std::ostream_iterator and std::ostreambuf_iterator
must have std::ptrdiff_t instead of void as a difference_type.

Tests by Casey Carter (thanks!).

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