platform/upstream/llvm.git
2 years ago[Orc] Only unmap shared memory in controller process destructor
Anubhab Ghosh [Sat, 20 Aug 2022 20:00:15 +0000 (01:30 +0530)]
[Orc] Only unmap shared memory in controller process destructor

By the time SharedMemoryMapper destructor is called, the RPC
connection is no longer available causing the release() call to
always fail. Instead at this point only shared memory regions
can be unmapped safely.

Deinitializers are called and mapped memory is released at the
executor side by ExecutorSharedMemoryMapperService::shutdown()
instead. Memory can also be released earlier by calling release()
earlier before RPC connection is closed.

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

2 years ago[Orc] Actually save the callback
Anubhab Ghosh [Sat, 20 Aug 2022 19:49:48 +0000 (01:19 +0530)]
[Orc] Actually save the callback

The callback function was captured by reference but it lived on the
stack and was in danger of being overwritten and could cause a crash.

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

2 years ago[CostModel][X86] Split int/fp arithmetic cost kinds tests
Simon Pilgrim [Sun, 21 Aug 2022 10:49:27 +0000 (11:49 +0100)]
[CostModel][X86] Split int/fp arithmetic cost kinds tests

It's going to be much easier to maintain these tests (and all the check prefix combinations) if we don't mix cost kinds in the same file.

2 years ago[mlir][normalize-memrefs] NFC Follow-up D125854
Tung D. Le [Sat, 20 Aug 2022 02:00:28 +0000 (07:30 +0530)]
[mlir][normalize-memrefs] NFC Follow-up D125854

NFC follow-up D125854 to reflect some remaining comments in D125854

Reviewed By: bondhugula

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

2 years ago[CostModel] Add CostKind argument to getShuffleCost
Simon Pilgrim [Sun, 21 Aug 2022 09:19:21 +0000 (10:19 +0100)]
[CostModel] Add CostKind argument to getShuffleCost

Defaults to TCK_RecipThroughput - as most explicit calls were assuming TCK_RecipThroughput (vectorizers) or was just doing a before-vs-after comparison (vectorcombiner). Calls via getInstructionCost were just dropping the CostKind, so again there should be no change at this time (as getShuffleCost and its expansions don't use CostKind yet) - but it will make it easier for us to better account for size/latency shuffle costs in inline/unroll passes in the future.

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

2 years ago[C++20][Modules] Improve handing of Private Module Fragment diagnostics.
Iain Sandoe [Wed, 22 Jun 2022 08:15:53 +0000 (09:15 +0100)]
[C++20][Modules] Improve handing of Private Module Fragment diagnostics.

This adds a check for exported inline functions, that there is a definition in
the definition domain (which, in practice, can only be the module purview but
before any PMF starts) since the PMF definition domain cannot contain exports.

This is:
[dcl.inline]/7
If an inline function or variable that is attached to a named module is declared in
a definition domain, it shall be defined in that domain.

The patch also amends diagnostic output by excluding the PMF sub-module from the
set considered as sources of missing decls.  There is no point in telling the user
that the import of a PMF object is missing - since such objects are never reachable
to an importer.  We still show the definition (as unreachable), to help point out
this.

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

2 years ago[mlir][Bazel] Fix Bazel build
Anlun Xu [Sun, 21 Aug 2022 08:01:04 +0000 (01:01 -0700)]
[mlir][Bazel] Fix Bazel build

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

2 years agoRevert "Use std::is_same_v instead of std::is_same (NFC)"
Kazu Hirata [Sun, 21 Aug 2022 06:00:39 +0000 (23:00 -0700)]
Revert "Use std::is_same_v instead of std::is_same (NFC)"

This reverts commit c5da37e42d388947a40654b7011f2a820ec51601.

This patch seems to break builds with some versions of MSVC.

2 years agoUse std::is_same_v instead of std::is_same (NFC)
Kazu Hirata [Sun, 21 Aug 2022 05:36:26 +0000 (22:36 -0700)]
Use std::is_same_v instead of std::is_same (NFC)

2 years agoUse range-based for loops (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:32 +0000 (21:18 -0700)]
Use range-based for loops (NFC)

2 years agoUse llvm::drop_begin (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:30 +0000 (21:18 -0700)]
Use llvm::drop_begin (NFC)

2 years agoRemove redundant initialization of Optional (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:28 +0000 (21:18 -0700)]
Remove redundant initialization of Optional (NFC)

2 years agoUse llvm::is_contained (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:27 +0000 (21:18 -0700)]
Use llvm::is_contained (NFC)

2 years ago[Scalar] Qualify auto in range-based for loops (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:25 +0000 (21:18 -0700)]
[Scalar] Qualify auto in range-based for loops (NFC)

Identified with readability-qualified-auto.

2 years agoEnsure newlines at the end of files (NFC)
Kazu Hirata [Sun, 21 Aug 2022 04:18:23 +0000 (21:18 -0700)]
Ensure newlines at the end of files (NFC)

2 years ago[libunwind] Fixed a number of typos
Gabriel Ravier [Sun, 21 Aug 2022 01:09:03 +0000 (18:09 -0700)]
[libunwind] Fixed a number of typos

I went over the output of the following mess of a command:

`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

Reviewed By: #libunwind, MaskRay

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

2 years ago[mlir] Use std::is_invocable instead of llvm::is_invocable
Joe Loser [Sat, 20 Aug 2022 23:30:14 +0000 (17:30 -0600)]
[mlir] Use std::is_invocable instead of llvm::is_invocable

Now that MLIR is built with C++17, use the standard library equivalent of
`llvm::is_invocable`: `std::is_invocable`.

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

2 years ago[llvm] Remove llvm::is_trivially_{copy/move}_constructible (NFC)
Kazu Hirata [Sat, 20 Aug 2022 21:06:42 +0000 (14:06 -0700)]
[llvm] Remove llvm::is_trivially_{copy/move}_constructible (NFC)

This patch removes llvm::is_trivially_{copy/move}_constructible in
favor of std::is_trivially_{copy/move}_constructible.

The previous attempt to remove them in Dec 2020,
c8d406c93c5bb01599990201f78d8428dd29d289, broke builds with "some
versions of GCC" according to
6cd9608fb37ca2418fb44b57ec955bb5efe10689.

It's been 20 months since then, and the minimum requirement for GCC
has been updated to 7.1 from 5.1.

FWIW, I was able to build llvm with gcc 8.4.0.

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

2 years ago[JITLink] Fix LinkGraph::makeAbsolute, add unit test.
Lang Hames [Sat, 20 Aug 2022 20:32:06 +0000 (13:32 -0700)]
[JITLink] Fix LinkGraph::makeAbsolute, add unit test.

makeAbsolute was not updating the symbol address when applied to external
symbols.

This commit adds a unit test for makeAbsolute, and updates the makeExternal unit
test to check that makeExternal works correctly for absolute symbols.

2 years ago[libc++][string] Removes obsolete constexpr.
Mark de Wever [Sun, 14 Aug 2022 12:14:09 +0000 (14:14 +0200)]
[libc++][string] Removes obsolete constexpr.

Addresses the final review comment of D131421.

Reviewed By: philnik, #libc

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

2 years ago[gn build] Fix oversight in 3adda398cef7f56d0
Nico Weber [Sat, 20 Aug 2022 17:39:45 +0000 (13:39 -0400)]
[gn build] Fix oversight in 3adda398cef7f56d0

2 years ago[bolt][llvm][cmake] Use `CMAKE_INSTALL_LIBDIR` too
John Ericson [Sat, 20 Aug 2022 14:33:21 +0000 (10:33 -0400)]
[bolt][llvm][cmake] Use `CMAKE_INSTALL_LIBDIR` too

Working back towards D130586.

Bolt didn't use `LLVM_LIBDIR_SUFFIX` before, and has no in-tree reverse
dependencies, it seems easier to add.

The change in LLVM itself is to prevent some unexpected `lib64` from
cropping up due to the `CMAKE_INSTALL_LIBDIR` defaulting logic.

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

2 years ago[clang][lldb][cmake] Use new `*_INSTALL_LIBDIR_BASENAME` CPP macro
John Ericson [Sat, 20 Aug 2022 15:20:12 +0000 (11:20 -0400)]
[clang][lldb][cmake] Use new `*_INSTALL_LIBDIR_BASENAME` CPP macro

Use this instead of `*_LIBDIR_SUFFIX`, from which it is computed.

This gets us ready for D130586, in which `*_LIBDIR_SUFFIX` is
deprecated.

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

2 years ago[ADT] Simplify llvm::sort with constexpr if (NFC)
Kazu Hirata [Sat, 20 Aug 2022 16:34:36 +0000 (09:34 -0700)]
[ADT] Simplify llvm::sort with constexpr if (NFC)

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

2 years ago[ADT] Deprecate Any::hasValue
Kazu Hirata [Sat, 20 Aug 2022 16:34:35 +0000 (09:34 -0700)]
[ADT] Deprecate Any::hasValue

This patch deprecates Any::hasValue as I've migrated all known uses of
it to Any::has_value.  I'm planning to remove the deprecated method in
3 months or so.

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

2 years ago[clang] Use Any::has_value instead of Any::hasValue (NFC)
Kazu Hirata [Sat, 20 Aug 2022 15:40:18 +0000 (08:40 -0700)]
[clang] Use Any::has_value instead of Any::hasValue (NFC)

2 years ago[flang] Add semantic checks for interoperability of derived type (C1806)
Peixin Qiao [Sat, 20 Aug 2022 15:34:47 +0000 (23:34 +0800)]
[flang] Add semantic checks for interoperability of derived type (C1806)

As Fortran 2018 C1806, each component of a derived type with the BIND
attribute shall be a nonpointer, nonallocatable data component with
interoperable type.

Reviewed By: klausler

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

2 years ago[flang][OpenMP] Handle the data race for firstprivate and lastprivate
Peixin Qiao [Sat, 20 Aug 2022 15:31:13 +0000 (23:31 +0800)]
[flang][OpenMP] Handle the data race for firstprivate and lastprivate

Remove barriers for firstprivate except if the variable is also
lastprivatized. Re-arrange code and put all last-privates inside a
single scf.if.

As OpenMP Spec 5.0, to avoid the data races, concurrent updates of the
original list item must be synchronized with the read of the original
list item that occurs as a result of the firstprivate clause. Adding
barrier(s) before and/or after the worksharing region would remove the
data races, and it is the application(user)'s job. However, when
one list item is in both firstprivate and lastprivate clauses, the
standard (https://www.openmp.org/spec-html/5.0/openmpsu105.html) states
the following:
```
If a list item appears in both firstprivate and lastprivate clauses, the
update required for the lastprivate clause occurs after all
initializations for the firstprivate clause.
```

So, the synchronization should be ensured by compiler such as emiting
one barrier since the lastprivate clause follows the reads of the
original list item performed for the initialization of each of the
firstprivate list item.

Add FIXME for two special cases, sections construct and linear clause.

The data race problem for single construct will be handled later.

This implementation is based on the discussion with OpenMP committee and
clang code (clang/lib/CodeGen/CGStmtOpenMP.cpp).

Reviewed By: kiranchandramohan, NimishMishra

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

2 years ago[lldb] Use Any::has_value instead of ANy::hasValue (NFC)
Kazu Hirata [Sat, 20 Aug 2022 14:28:06 +0000 (07:28 -0700)]
[lldb] Use Any::has_value instead of ANy::hasValue (NFC)

2 years ago[ADT] Implement Any::has_value
Kazu Hirata [Sat, 20 Aug 2022 14:28:04 +0000 (07:28 -0700)]
[ADT] Implement Any::has_value

This patch implements Any::has_value for consistency with std::any in
C++17.

My plan is to deprecate Any::hasValue after migrating all of its uses
to Any::has_value.  Since I am about to do so, this patch simply
replaces hasValue with has_value in the unit test instead of adding
tests for has_value.

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

2 years ago[ADT] Simplify llvm::reverse with constexpr if (NFC)
Kazu Hirata [Sat, 20 Aug 2022 14:28:03 +0000 (07:28 -0700)]
[ADT] Simplify llvm::reverse with constexpr if (NFC)

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

2 years ago[EarlyCSE][ConstantFolding] do not constant fold atan2(+/-0.0, +/-0.0), part 2
Sanjay Patel [Sat, 20 Aug 2022 12:33:46 +0000 (08:33 -0400)]
[EarlyCSE][ConstantFolding] do not constant fold atan2(+/-0.0, +/-0.0), part 2

Follow-up to 7f1262a322c0d80f3. That patch avoided removing the
call, but it still allowed the constant-folded result. This
makes the behavior consistent with 1-arg libm folding: if the
call potentially raises an exception, then we just bail out.

It seems likely that there are other corner-cases like this,
but the tests are incomplete, so we have lived with these
discrepancies for a long time. This was untested before the
the constant folding was expanded in D127964.

2 years ago[X86] Fold PMULUDQ(X,1) -> AND(X,(1<<32)-1) 'getZeroExtendInReg'
Simon Pilgrim [Sat, 20 Aug 2022 13:58:25 +0000 (14:58 +0100)]
[X86] Fold PMULUDQ(X,1) -> AND(X,(1<<32)-1) 'getZeroExtendInReg'

Fix cases where shl/srem/urem expansion results in a mulh/mul_lohi(x,1) 'pass through' that gets lowered to pmuludq.

Fixes #56684

2 years ago[X86] Add vector test coverage of 'one-bit-diff' and/or icmp ne/eq patterns
Simon Pilgrim [Sat, 20 Aug 2022 13:13:38 +0000 (14:13 +0100)]
[X86] Add vector test coverage of 'one-bit-diff' and/or icmp ne/eq patterns

2 years ago[libc++][doc] Updates status of P2291R3.
Mark de Wever [Sat, 20 Aug 2022 12:45:17 +0000 (14:45 +0200)]
[libc++][doc] Updates status of P2291R3.

Work on the paper has started but it's blocked by PR52954.
Updating the status to avoid duplicated effort implementing this paper.

2 years agoMore llvm-docs-sphinx buildbot fixes
Tom Stellard [Sat, 20 Aug 2022 08:42:48 +0000 (08:42 +0000)]
More llvm-docs-sphinx buildbot fixes

Broken by 7225c0bd0115c947f3c081599e6268cfa027722f and
662a11bd062ac7d938569212fe1c5dc01c1a1b34.

2 years agoFix llvm-docs-sphinx buildbot after 7225c0bd0115c947f3c081599e6268cfa027722f
Tom Stellard [Sat, 20 Aug 2022 08:31:32 +0000 (01:31 -0700)]
Fix llvm-docs-sphinx buildbot after 7225c0bd0115c947f3c081599e6268cfa027722f

2 years agoHowToReleaseLLVM: Add annual release schedule template
Tom Stellard [Sat, 20 Aug 2022 08:25:11 +0000 (01:25 -0700)]
HowToReleaseLLVM: Add annual release schedule template

Reviewed By: ldionne, thieta

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

2 years agoHowToReleaseLLVM: Add some more details about website updates
Tom Stellard [Sat, 20 Aug 2022 08:22:00 +0000 (01:22 -0700)]
HowToReleaseLLVM: Add some more details about website updates

Reviewed By: thieta

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

2 years agoworkflows/llvm-project-tests: Workaround an issue with lldb builds on Windows
Tom Stellard [Sat, 20 Aug 2022 07:15:14 +0000 (00:15 -0700)]
workflows/llvm-project-tests: Workaround an issue with lldb builds on Windows

For some reason cmake started selecting a 32-bit version of python on
Windows instead of the 64-bit version when building windows.  Explicitly
setting the default python to 3.10 fixes this problem.

Reviewed By: thieta

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

2 years agoFix unused variable warnings
Kazu Hirata [Sat, 20 Aug 2022 07:12:35 +0000 (00:12 -0700)]
Fix unused variable warnings

These warnings came up with gcc-11.3.0.

2 years agoReland "[lldb] [test] Disable new CommunicationTests on Windows"
Michał Górny [Fri, 19 Aug 2022 14:22:55 +0000 (16:22 +0200)]
Reland "[lldb] [test] Disable new CommunicationTests on Windows"

This change was wrongly reverted and re-broke the Windows buildbot.

Sponsored by: The FreeBSD Foundation

2 years ago[NFC][AMDGPU] Fix typo.
Thomas [Sat, 20 Aug 2022 06:30:04 +0000 (08:30 +0200)]
[NFC][AMDGPU] Fix typo.

2 years ago[mlir][docs] Migrate away from deprecated llvm::Optional methods
Fangrui Song [Sat, 20 Aug 2022 06:29:31 +0000 (23:29 -0700)]
[mlir][docs] Migrate away from deprecated llvm::Optional methods

2 years ago[lldb] [gdb-remote] Include PID in vCont packets if multiprocess
Michał Górny [Fri, 12 Aug 2022 10:37:18 +0000 (12:37 +0200)]
[lldb] [gdb-remote] Include PID in vCont packets if multiprocess

Try to always send vCont packets and include the PID in them if running
multiprocess.  This is necessary to ensure that with the upcoming full
multiprocess support always resumes the correct process without having
to resort to the legacy Hc packets.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D131758

2 years ago(Reland) [fastalloc] Support allocating specific register class in fastalloc
Luo, Yuanke [Thu, 18 Aug 2022 01:50:55 +0000 (09:50 +0800)]
(Reland) [fastalloc] Support allocating specific register class in fastalloc

This reverts commit 853bb192c407f5d9e75a5fd55cc089151530cbd3.

2 years agoworkflows/version-check: Fix check for release candidates
Tom Stellard [Sat, 20 Aug 2022 04:51:00 +0000 (21:51 -0700)]
workflows/version-check: Fix check for release candidates

Reviewed By: thieta

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

2 years ago[lldb] Use Optional::value instead of Optional::getValue (NFC)
Kazu Hirata [Sat, 20 Aug 2022 04:40:48 +0000 (21:40 -0700)]
[lldb] Use Optional::value instead of Optional::getValue (NFC)

2 years ago[lldb] Use Optional::transform instead of Optional::map (NFC)
Kazu Hirata [Sat, 20 Aug 2022 04:40:47 +0000 (21:40 -0700)]
[lldb] Use Optional::transform instead of Optional::map (NFC)

2 years ago[msan] Bump max allocation on aarch64
Vitaly Buka [Sat, 20 Aug 2022 04:16:02 +0000 (21:16 -0700)]
[msan] Bump max allocation on aarch64

2 years ago[MC][LoongArch] Make .reloc support arbitrary relocation types
wanglei [Sat, 20 Aug 2022 04:06:45 +0000 (12:06 +0800)]
[MC][LoongArch] Make .reloc support arbitrary relocation types

Similar to D76746 (ARM), D76754 (AArch64), D77018 (RISCV)  and
llvmorg-11-init-6967-g152d14da64c (x86)

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

2 years ago[LoongArch] Add some fixups and relocations
wanglei [Sat, 20 Aug 2022 02:13:29 +0000 (10:13 +0800)]
[LoongArch] Add some fixups and relocations

This patch only add %pc_hi20/%pc_lo12/%plt relocations in order
to be able to generate gnu ld linkable relocation file for the
`hello world` IR :
```
@.str = private unnamed_addr constant [14 x i8] c"Hello world!\0A\00", align 1

define dso_local signext i32 @main() nounwind {
entry:
  %call = call signext i32 (ptr, ...) @printf(ptr noundef @.str)
  ret i32 0
}

declare dso_local signext i32 @printf(ptr noundef, ...)
```

This patch also updates some test cases due to new modifiers introduced.
New test: test/MC/LoongArch/Relocations/relocations.s

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

2 years ago[LoongArch] Add codegen support for fsqrt
gonglingqin [Sat, 20 Aug 2022 02:20:30 +0000 (10:20 +0800)]
[LoongArch] Add codegen support for fsqrt

Reviewed By: xen0n, SixWeining

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

2 years ago[docs] Remove lld/ELF release note about --package-metadata= which is in release...
Fangrui Song [Sat, 20 Aug 2022 02:08:28 +0000 (19:08 -0700)]
[docs] Remove lld/ELF release note about --package-metadata= which is in release/15.x

2 years ago[VP] Add splitting for VP_STRIDED_STORE and VP_STRIDED_LOAD
Lorenzo Albano [Sat, 20 Aug 2022 01:15:56 +0000 (18:15 -0700)]
[VP] Add splitting for VP_STRIDED_STORE and VP_STRIDED_LOAD

Following the comment's thread of D117235, I added checks for the widening + splitting case, which also causes a split with one of the resulting vectors to be empty. Due to the same issues described in that same thread, the `fixed-vectors-strided-store.ll` test is missing the widening + splitting case, while the same case in the `strided-vpload.ll` test requires to manually split the loaded vector.

Reviewed By: craig.topper

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

2 years ago[libc++][NFC][spaceship] Update status doc
Adrian Vogelsgesang [Sat, 20 Aug 2022 00:31:19 +0000 (17:31 -0700)]
[libc++][NFC][spaceship] Update status doc

2 years ago[tti] Consolidate getOperandInfo without OperandValueProperties copies [nfc]
Philip Reames [Fri, 19 Aug 2022 23:21:14 +0000 (16:21 -0700)]
[tti] Consolidate getOperandInfo without OperandValueProperties copies [nfc]

2 years ago[AMDGPU] Add iglp_opt builtin and MFMA GEMM Opt strategy
Austin Kerbow [Wed, 17 Aug 2022 17:00:06 +0000 (10:00 -0700)]
[AMDGPU] Add iglp_opt builtin and MFMA GEMM Opt strategy

Adds a builtin that serves as an optimization hint to apply specific optimized
DAG mutations during scheduling. This also disables any other mutations or
clustering that may interfere with the desired pipeline. The first optimization
strategy that is added here is designed to improve the performance of small gemm
kernels on gfx90a.

Reviewed By: jrbyrnes

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

2 years ago[DWARF][BOLT] Fix handling of converting range accesss from ofset to index.
Alexander Yermolovich [Fri, 19 Aug 2022 22:27:55 +0000 (15:27 -0700)]
[DWARF][BOLT] Fix handling of converting range accesss from ofset to index.

Wasn't handling correctly creating DW_AT_rnglists_base in UnitDie when
converting access pattern for DW_AT_ranges from offset to index for DWARF5.

Reviewed By: rafauler

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

2 years ago[lldb] Support specifying a custom libcxx for the API tests
Jonas Devlieghere [Fri, 19 Aug 2022 22:14:15 +0000 (15:14 -0700)]
[lldb] Support specifying a custom libcxx for the API tests

This patch combines D129166 (to always pick the just-built libc++) and
D132257 (to allow customizing the libc++ for testing). The common goal
is to avoid picking up an unexpected libc++ for testing.

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

2 years ago[gn build] Port 57c9780d60b1
LLVM GN Syncbot [Fri, 19 Aug 2022 21:56:27 +0000 (21:56 +0000)]
[gn build] Port 57c9780d60b1

2 years ago[lld][ELF] Rename SymbolTable::symbols() to SymbolTable::getSymbols(). NFC
Sam Clegg [Fri, 29 Jul 2022 17:16:57 +0000 (10:16 -0700)]
[lld][ELF] Rename SymbolTable::symbols() to SymbolTable::getSymbols(). NFC

This change renames this method match its original name and the name
used in the wasm linker.

Back in d8f8abbd4a2823f223bd7bc56445541fb221b512 the ELF SymbolTable
method `getSymbols()` was replaced with `forEachSymbol`.

Then in a2fc96441788fba1e4709d63677f34ed8e321dae `forEachSymbol` was
replaced with a `llvm::iterator_range`.

Then in e9262edf0d11a907763098d8e101219ccd9c43e9 we came full circle
and the `llvm::iterator_range` was replaced with a `symbols()` accessor
that was identical the original `getSymbols()`.

`getSymbols` also matches the name used elsewhere in the ELF linker as
well as in both COFF and wasm backend (e.g. `InputFiles.h` and
`SyntheticSections.h`)

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

2 years ago[clang][ExtractAPI] Record availability information on all platforms
Daniel Grumberg [Mon, 1 Aug 2022 13:55:08 +0000 (14:55 +0100)]
[clang][ExtractAPI] Record availability information on all platforms

Currently ExtractAPI only emits availability information for the
current platform. This makes it easy for clients to get all availability
information for a given symbol in one invocation as opposed to having to invoke
clang once per-platform and then merge the symbol-graphs.

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

2 years agoRevert "[NFC] Precommit test for D132255."
Nico Weber [Fri, 19 Aug 2022 21:53:36 +0000 (17:53 -0400)]
Revert "[NFC] Precommit test for D132255."

This reverts commit 01e3a376955864be6c20fe1134107eb4aa5f2e9c.
Breaks tests on mac and win, see comments on https://reviews.llvm.org/D132255

2 years ago[libc][NFC] Move blockstore out of the CPP folder
Guillaume Chatelet [Fri, 19 Aug 2022 21:51:40 +0000 (21:51 +0000)]
[libc][NFC] Move blockstore out of the CPP folder

2 years ago[RISCV] Add test coverage for 64 bit splat constants
Philip Reames [Fri, 19 Aug 2022 21:39:19 +0000 (14:39 -0700)]
[RISCV] Add test coverage for 64 bit splat constants

2 years ago[libc][NFC] Use STL case for bitset and simplify implementation
Guillaume Chatelet [Fri, 19 Aug 2022 21:39:02 +0000 (21:39 +0000)]
[libc][NFC] Use STL case for bitset and simplify implementation

2 years ago[clang-tidy] Fix for bugprone-sizeof-expression PR57167
eahcmrh [Fri, 19 Aug 2022 20:26:38 +0000 (22:26 +0200)]
[clang-tidy] Fix for bugprone-sizeof-expression PR57167

This addresses a change in behavior of the bugprone-sizeof-expression
checker after upstream commit 15f3cd6bfc6, which cleaned up
ElaboratedType sugaring in the AST.  This restores (mostly) the
beahvior of the checker prior to that commit, which may or may not have
been consistent with the intent of the checker, but at least gave a
tolerable level of what users would consider false positives.

Bug: https://github.com/llvm/llvm-project/issues/57167

Reviewed By: mizvekov, aaron.ballman

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

Change-Id: Ibe5aad77ad00977134aa7fa67efbbd6bd725fd79

2 years ago[reland][libc][NFC] Use STL case for bit
Guillaume Chatelet [Fri, 19 Aug 2022 21:10:12 +0000 (21:10 +0000)]
[reland][libc][NFC] Use STL case for bit

2 years agoFix reverse-iteration buildbot.
Eli Friedman [Fri, 19 Aug 2022 21:19:24 +0000 (14:19 -0700)]
Fix reverse-iteration buildbot.

A couple of instances of iterating over maps snuck in while the bot was
down; fix them to use maps with deterministic iteration.

2 years agoRevert "[libc][NFC] Use STL case for bit"
Guillaume Chatelet [Fri, 19 Aug 2022 21:17:48 +0000 (21:17 +0000)]
Revert "[libc][NFC] Use STL case for bit"

This reverts commit 7ba14b8611df1172d92d60bf19870e98a92e7a3a.

2 years ago[libc][NFC] Use STL case for bit
Guillaume Chatelet [Fri, 19 Aug 2022 21:10:12 +0000 (21:10 +0000)]
[libc][NFC] Use STL case for bit

2 years ago[RISCV] Move xori creation for scalar setccs to lowering.
Craig Topper [Fri, 19 Aug 2022 18:42:40 +0000 (11:42 -0700)]
[RISCV] Move xori creation for scalar setccs to lowering.

This patch enables expansion or custom lowering for some integer
condition codes so that any xori that is needed is created before
the last DAG combine to enable optimization.

I've seen cases where we end up with
(or (xori (setcc), 1), (xori (setcc), 1)) which we would ideally
convert to (xori (and (setcc), (setcc)), 1). This patch doesn't
accomplish that yet, but it should allow us to add DAG
combines as follow ups. Example https://godbolt.org/z/Y4qnvsq1b

Reviewed By: reames

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

2 years ago[flang] Add a placeholder argument for a format descriptor on IO calls
Peter Klausler [Fri, 19 Aug 2022 20:33:50 +0000 (13:33 -0700)]
[flang] Add a placeholder argument for a format descriptor on IO calls

Author: vdonaldson

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

2 years ago[llvm-reduce] Move most debugging output behind --verbose
Arthur Eubanks [Mon, 15 Aug 2022 21:48:00 +0000 (14:48 -0700)]
[llvm-reduce] Move most debugging output behind --verbose

This should cut down on the visual noise when reducing. Still keep output when we run a pass or when we successfully reduce.

Notably, this also suppresses redirecting the test output to stdout/stderr.

Reviewed By: regehr

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

2 years ago[AArch64] Change aarch64_neon_pmull{,64} intrinsic ISel through a new
Mingming Liu [Wed, 3 Aug 2022 06:21:52 +0000 (23:21 -0700)]
[AArch64] Change aarch64_neon_pmull{,64} intrinsic ISel through a new
SDNode.

How:
1) Add AArch64ISD::PMULL SDNode, and extend aarch64_neon_pmull intrinsic
   tablegen pattern for this SDNode.
2) For aarch64_neon_pmull64, canonicalize i64 operands to v1i64 vectors
   during legalization.
3) For {aarch64_neon_pmull, aarch64_neon_pmull64}, combine intrinsic to
   SDNode.

Why
1) Adding the SDNode makes it easier to canonicalize i64 inputs (required by
   aarch64_neon_pmull64) to vector inputs. Vector inputs carries lane
   information, which helps dag-combiner to combine nodes (e.g. rewrite to a
   better node to prepare for instruction selection) and instruction-selection
   to emit instructions that use higher-half inputs in place
   (i.e., no need to move lane 1 content to lane 0).
2) Using the SDNode for aarch64_neon_pmull64 is NFC, yet without this we
   have to move the definition of {PMULLv1i64, PMULLv2i64} out of its
   current group of records without gains.

Test cases are commented with what is being tested in
`aarch64-pmull2.ll` and `pmull-ldr-merge.ll` under directory
`llvm/test/CodeGen/AArch64`.

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

2 years ago[NFC][AArch64] Precommit test to optimize instruction selection for aarch64_neon_pmul...
Mingming Liu [Wed, 3 Aug 2022 06:10:50 +0000 (23:10 -0700)]
[NFC][AArch64] Precommit test to optimize instruction selection for aarch64_neon_pmull64 intrinsic.

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

2 years ago[libc] Install startup files with the install-libc target.
Siva Chandra Reddy [Fri, 19 Aug 2022 08:15:50 +0000 (08:15 +0000)]
[libc] Install startup files with the install-libc target.

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

2 years ago[libcxx] [test] Fix the transitive_includes test on Windows
Martin Storsjö [Wed, 6 Jul 2022 21:51:19 +0000 (00:51 +0300)]
[libcxx] [test] Fix the transitive_includes test on Windows

Look for both kinds of slashes in include paths output from the
compiler.

Use "diff -w" to do a whitespace insensitive comparison, to ignore
differences in line endings (the python script writes to stdout
in text mode, with crlf newlines).

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

2 years ago[RISCV] Add cost model coverage of store of constant [nfc]
Philip Reames [Fri, 19 Aug 2022 20:07:12 +0000 (13:07 -0700)]
[RISCV] Add cost model coverage of store of constant [nfc]

2 years ago[clang][dataflow] Mark `getDeclCtx` function in dataflow `Environment` `const`.
Wei Yi Tee [Fri, 19 Aug 2022 13:37:33 +0000 (13:37 +0000)]
[clang][dataflow] Mark `getDeclCtx` function in dataflow `Environment` `const`.

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

2 years agoReland "[mlir][test] Fix IR/AttributeTest.cpp compilation on Solaris"
Rainer Orth [Fri, 19 Aug 2022 19:59:57 +0000 (21:59 +0200)]
Reland "[mlir][test] Fix IR/AttributeTest.cpp compilation on Solaris"

The `IR/AttributeTest.cpp` test fails to compile on Solaris:
```
/vol/llvm/src/llvm-project/local/mlir/unittests/IR/AttributeTest.cpp:223:36: error: no matching function for call to 'allocate'
      AttrT::get(type, "resource", UnmanagedAsmResourceBlob::allocate(data));
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/vol/llvm/src/llvm-project/local/mlir/unittests/IR/AttributeTest.cpp:237:3: note: in instantiation of function template specialization 'checkNativeAccess<mlir::detail::DenseResourceElementsAttrBase<int8_t>, char>' requested here
  checkNativeAccess<AttrT, T>(builder.getContext(), llvm::makeArrayRef(data),
  ^
/vol/llvm/src/llvm-project/local/mlir/unittests/IR/AttributeTest.cpp:258:3: note: in instantiation of function template specialization 'checkNativeIntAccess<mlir::detail::DenseResourceElementsAttrBase<int8_t>, char>' requested here
  checkNativeIntAccess<DenseI8ResourceElementsAttr, int8_t>(builder, 8);
  ^
/vol/llvm/src/llvm-project/local/mlir/include/mlir/IR/AsmState.h:221:3: note: candidate template ignored: requirement '!std::is_same<char, char>::value' was not satisfied [with T = char]
  allocate(ArrayRef<T> data, bool dataIsMutable = false) {
  ^
/vol/llvm/src/llvm-project/local/mlir/include/mlir/IR/AsmState.h:214:26: note: candidate function not viable: requires at least 2 arguments, but 1 was provided
  static AsmResourceBlob allocate(ArrayRef<char> data, size_t align,
                         ^
```
Because `char` is `signed` by default on Solaris and `int8_t` is
`char`. `std::is_same<int8_t, char>` is `true` unlike elsewhere, rejecting
the one-arg `allocate` overload.

Fixed by renaming the two overloads to avoid the ambiguity.

Tested on `amd64-pc-solaris2.11` ,`sparcv9-sun-solaris2.11`, and
`x86_64-pc-linux-gnu`.

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

2 years ago[RISCV] Factor out getVectorImmCost cost after 0e7ed3 [nfc]
Philip Reames [Fri, 19 Aug 2022 19:52:56 +0000 (12:52 -0700)]
[RISCV] Factor out getVectorImmCost cost after 0e7ed3 [nfc]

2 years agoUpdate coding standards for constexpr if statements; NFC
Aaron Ballman [Fri, 19 Aug 2022 19:51:53 +0000 (15:51 -0400)]
Update coding standards for constexpr if statements; NFC

We currently suggest that users not use an else clause after a return
statement in a prior if branch. e.g.,

if (foo)
  return 1;
else // Should remove this else clause
  return 10;

however, this suggestion is incorrect for a constexpr if statement
because one of the two branches will be a discarded statement and thus
can impact template instantiation behavior. This updates the coding
standard to make it clear that it's okay to have a return after an else
in a constexpr if statement.

I think this is an NFC change to the intent of the rule, which is why
I've not started an RFC for the changes.

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

2 years ago[MachineVerifier] add checks for INLINEASM_BR
Nick Desaulniers [Fri, 19 Aug 2022 19:40:24 +0000 (12:40 -0700)]
[MachineVerifier] add checks for INLINEASM_BR

Test for a case we observed after the initial implementation of D129997
landed, in which case we observed a crash while building the ppc64le
Linux kernel. In that case, we had one block with two exits, both to the
same successor. Removing one of the exits corrupted the
successor/predecessor lists.

So when we have an INLINEASM_BR, check a few things for each indirect
target:
1. that it exists.
2. that it is listed in our successors.
3. that its predecessor list contains the parent MBB of INLINEASM_BR.

This would have caught the regression discovered after D129997 landed,
after the pass that was problematic (early-tailduplication) rather than
getting a stack trace in a later pass (regalloc) that doesn't understand
the anomaly and crashes.

Reviewed By: efriedma

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

2 years agoRevert "Re-apply "Deferred Concept Instantiation Implementation"""
Erich Keane [Fri, 19 Aug 2022 19:37:04 +0000 (12:37 -0700)]
Revert "Re-apply "Deferred Concept Instantiation Implementation"""

This reverts commit d483730d8c3fa2e0d4192b2f3c61c761b124e6ad.

This allegedly breaks a significant part of facebooks internal build.
Reverting while we wait for them to provide a reproducer of this from
@wlei.

2 years ago[clang][RISCV] Fix incorrect ABI lowering for inherited structs under hard-float...
Alex Bradbury [Fri, 19 Aug 2022 17:16:24 +0000 (18:16 +0100)]
[clang][RISCV] Fix incorrect ABI lowering for inherited structs under hard-float ABIs

The hard float ABIs have a rule that if a flattened struct contains
either a single fp value, or an int+fp, or fp+fp then it may be passed
in a pair of registers (if sufficient GPRs+FPRs are available).
detectFPCCEligibleStruct and the helper it calls,
detectFPCCEligibleStructHelper examine the type of the argument/return
value to determine if it complies with the requirements for this ABI
rule.

As reported in bug #57084, this logic produces incorrect results for C++
structs that inherit from other structs. This is because only the fields
of the struct were examined, but enumerating RD->fields misses any
fields in inherited C++ structs. This patch corrects that issue by
adding appropriate logic to enumerate any included base structs.

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

2 years ago[X86][AArch64][NFC] Simplify querying used argument registers
Bill Wendling [Thu, 18 Aug 2022 21:52:49 +0000 (14:52 -0700)]
[X86][AArch64][NFC] Simplify querying used argument registers

Registers used for arguments are listed as "live-ins" into the starting
basic block. This means we don't have to go through a potentially
expensive search through all possible argument registers when we only
care about used argument registers.

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

2 years ago[InferAddressSpaces] [AMDGPU] Add inference for flat_atomic intrinsics
jeff [Thu, 28 Jul 2022 18:09:14 +0000 (11:09 -0700)]
[InferAddressSpaces] [AMDGPU] Add inference for flat_atomic intrinsics

Certain address space dependent optimizations, like SeperateConstOffsetFromGEP, assume agreement between the address space of the recursive uses and the address space of the def. If this assumption is invalid, then optimizations may or may not be correct depending on properties of an address space for a given target, the address spaces of recursive uses, and the optimization being done.

This patch infers the previous address space for flat_atomic ptr arguments. As a result, the address spaces of the uses in flat_atomic cases will agree with the address space in recursive defs. If this results in non-flat address space, then isel may infer a different intrinsic. For example, if the result is a flat_atomic using global address space, then it will be lowered to the corresponding global_atomic intrinsic.

Change-Id: Ifcd981709dc2ea94d4acbcb84efe7176593ec8c7

2 years ago[NFC] Precommit test for D132255.
Denis Antrushin [Fri, 19 Aug 2022 17:58:04 +0000 (00:58 +0700)]
[NFC] Precommit test for D132255.

2 years agoRevert "[lldb] [gdb-remote] Include PID in vCont packets if multiprocess" - Part 2
Michael Buch [Fri, 19 Aug 2022 18:31:14 +0000 (19:31 +0100)]
Revert "[lldb] [gdb-remote] Include PID in vCont packets if multiprocess" - Part 2

This reverts commit ccb9d4d4addc2fb2aa94cf776d43d8be35365272.

Reverts the associated tests

2 years ago[X86] Fix znver1 256-bit ALU/Logic/Blend uop counts
Simon Pilgrim [Fri, 19 Aug 2022 18:07:02 +0000 (19:07 +0100)]
[X86] Fix znver1 256-bit ALU/Logic/Blend uop counts

ymm instructions are double pumped on znver1 - noticed while trying to review size-latency costkinds numbers for D132216

Matches AMD 17h SOG / Agner / uops.info

2 years ago[Flang]Fix another way to crash SimplifyIntrinsics
Mats Petersson [Fri, 19 Aug 2022 12:34:48 +0000 (13:34 +0100)]
[Flang]Fix another way to crash SimplifyIntrinsics

Under some conditions, the defining op may be NULL, so
accept that rahter than try to use it and crash!

Adds test to prevent regression

Fixes github issue #57201

Reviewed By: vzakhari

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

2 years ago[NFC] Fix warning in asserts build
Chris Bieneman [Fri, 19 Aug 2022 22:21:49 +0000 (17:21 -0500)]
[NFC] Fix warning in asserts build

When asserts are enabled a warning for implicit conversion from 64-bit to
32-bit integer occurs here.

2 years ago[RISCV] Correct costs for vector ceil/floor/trunc/round
Philip Reames [Fri, 19 Aug 2022 17:37:39 +0000 (10:37 -0700)]
[RISCV] Correct costs for vector ceil/floor/trunc/round

Add vector costs for ceil/floor/trunc/round. As can be seen in the tests, the prior default costs were a significant under estimate of the actual code generated.

These costs are computed by simply generating code with the current backend, and then counting the number of instructions. I discount one vsetvli, and ignore the return.

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

2 years agoRevert "[lldb] [gdb-remote] Include PID in vCont packets if multiprocess"
Michael Buch [Fri, 19 Aug 2022 17:05:04 +0000 (18:05 +0100)]
Revert "[lldb] [gdb-remote] Include PID in vCont packets if multiprocess"

This reverts commit ccb9d4d4addc2fb2aa94cf776d43d8be35365272.

https://reviews.llvm.org/D131758

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

2 years agoMC: make section classification a bit more thorough
Saleem Abdulrasool [Fri, 5 Aug 2022 16:52:03 +0000 (16:52 +0000)]
MC: make section classification a bit more thorough

This does *NOT* change the emitted section flags in any way.  This only
impacts the internal classification of sections.

Extend the section classification in LLVM for ELF targets.  This has one
important change: we now classify sections as text by default rather
than readonly.  This matches the behaviour for GAS better.

Ensure that any section that has a writable attribute set is not treated
as readonly.  We also special case any section named `.debug_` which is
reserved for DWARF as metadata.  In the case none of the attributes are
set (or because no attributes were provided), consult the section name
for classification.  We match the well known names and classify the
section accordingly.  Any remaining section is now classified as text.

This change allows us to classify sections in the MC layer more
precisely which is needed for subsequent changes for handling target
specific behaviour.

Differential Revision: https://reviews.llvm.org/D131270
Reviewed By: @echristo

2 years agoFix MSVC "not all control paths return a value" warning
Simon Pilgrim [Fri, 19 Aug 2022 16:37:26 +0000 (17:37 +0100)]
Fix MSVC "not all control paths return a value" warning

2 years ago[EarlyCSE][ConstantFolding] do not constant fold atan2(+/-0.0, +/-0.0)
Sanjay Patel [Fri, 19 Aug 2022 16:21:11 +0000 (12:21 -0400)]
[EarlyCSE][ConstantFolding] do not constant fold atan2(+/-0.0, +/-0.0)

These may raise an error (set errno) as discussed in the post-commit
comments for D127964, so we can't fold away the call and potentially
alter that behavior.

2 years agoRevert "[lldb] [test] Add synchronization to TestContinue"
Adrian Prantl [Fri, 19 Aug 2022 16:22:19 +0000 (09:22 -0700)]
Revert "[lldb] [test] Add synchronization to TestContinue"

This reverts commit 7aadecae404b8d47aabdd874e9018a76fd4d1ffa.

I'm reverting this commit because it appears to break the green dragon
incremental LLDB bot.

https://reviews.llvm.org/D131758

See LLDB Incremental buildbot: https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/46215/execution/node/70/log/