platform/upstream/llvm.git
2 years ago[libc++] Make to_chars base 10 header only.
Mark de Wever [Mon, 16 May 2022 15:12:18 +0000 (17:12 +0200)]
[libc++] Make to_chars base 10 header only.

The functions to_chars and from_chars should offer 128-bit support. This
is the first step to implement 128-bit version of to_chars. Before
implementing 128-bit support the current code will be polished.

This moves the code from the dylib to the header in prepartion of

P2291 "Add Constexpr Modifiers to Functions to_chars and from_chars for
Integral Types in <charconv> Header"

Note some more cleanups will be done in follow-up commits
- Remove the _LIBCPP_AVAILABILITY_TO_CHARS from to_chars. With all code
  in the header the availablilty macro is no longer needed. This
  requires enabling the unit tests for additional platforms.
- The code in the dylib can switch to using the header implementation.
  This allows removing the code duplicated in the header and the dylib.

Reviewed By: #libc, ldionne

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

2 years ago[clang-tidy] Reject invalid enum initializers in C files
Richard [Sat, 14 May 2022 23:57:10 +0000 (17:57 -0600)]
[clang-tidy] Reject invalid enum initializers in C files

C requires that enum values fit into an int.  Scan the macro tokens
present in an initializing expression and reject macros that contain
tokens that have suffixes making them larger than int.

C forbids the comma operator in enum initializing expressions, so
optionally reject comma operator.

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

Fixes #55467

2 years ago[LSR] Early exit for RateFormula when it is already losing. NFC
eopXD [Thu, 2 Jun 2022 03:39:38 +0000 (20:39 -0700)]
[LSR] Early exit for RateFormula when it is already losing. NFC

This patch does not effect any behavior of the current code.

The codebase implicitly implies that `Cost::RateFormula` is only called
when the `Cost` is not in losing status, or else there may be possible
to trigger the assertion of `Cost::isValid`.

The intention here is to prevent mis-use where future development
allow `Cost` that is already loser to call `Cost::RateFormula` - Early
exit when `Cost` is already losing.

Reviewed By: Meinersbur, #loopoptwg

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

2 years ago[mlir] Support convert token type from LLVM IR.
jacquesguan [Wed, 1 Jun 2022 06:29:09 +0000 (06:29 +0000)]
[mlir] Support convert token type from LLVM IR.

This patch supports the token type for converting from LLVM IR.

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

2 years ago[test] Fix LLVMgold.so tests after D125847
Fangrui Song [Thu, 2 Jun 2022 03:05:01 +0000 (20:05 -0700)]
[test] Fix LLVMgold.so tests after D125847

2 years ago[libunwind] Add more information to eh_frame_hdr version error
Florian Mayer [Wed, 1 Jun 2022 23:43:59 +0000 (16:43 -0700)]
[libunwind] Add more information to eh_frame_hdr version error

This makes it easier to find the offending ELF file.

Reviewed By: #libunwind, MaskRay

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

2 years agounbreak Modules/cxx20-export-import.cpp with LLVM_APPEND_VC_REV after 8c8a2679a20f
Nico Weber [Thu, 2 Jun 2022 02:33:36 +0000 (22:33 -0400)]
unbreak Modules/cxx20-export-import.cpp with LLVM_APPEND_VC_REV after 8c8a2679a20f

See revision b8b7a9dcdcbc for prior art.

2 years ago[memprof] Print out the segment information in YAML format.
Snehasish Kumar [Wed, 1 Jun 2022 22:20:53 +0000 (22:20 +0000)]
[memprof] Print out the segment information in YAML format.

This change prints out the segment information in the raw profile in
YAML format for testing. Since we don't capture build ids yet, we print
out <None> for now.

Reviewed By: tejohnson

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

2 years ago[LegalizeTypes][VP] Add widen and split support for VP_SIGN_EXTEND and VP_ZERO_EXTEND.
jacquesguan [Thu, 26 May 2022 03:14:27 +0000 (03:14 +0000)]
[LegalizeTypes][VP] Add widen and split support for VP_SIGN_EXTEND and VP_ZERO_EXTEND.

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

2 years ago[memprof] Update summary output.
Snehasish Kumar [Wed, 1 Jun 2022 22:20:53 +0000 (22:20 +0000)]
[memprof] Update summary output.

Update the YAML format print out of the profile to include a summary
instead of displaying the headers in the raw file buffer. This allows us
to release the raw buffer early saving memory.

Reviewed By: tejohnson

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

2 years agoFix compilation in gold-plugin triggered by D125847
Matthias Braun [Thu, 2 Jun 2022 01:51:35 +0000 (18:51 -0700)]
Fix compilation in gold-plugin triggered by D125847

2 years ago[libc] Add pthread_create and pthread_join functions.
Siva Chandra Reddy [Wed, 25 May 2022 21:07:23 +0000 (21:07 +0000)]
[libc] Add pthread_create and pthread_join functions.

They do not yet support all the feature/attributes in pthread_attr_t.
Future changes will add such support.

Reviewed By: lntue

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

2 years ago[libc++][test] Enable constexpr string comparison tests
Joe Loser [Tue, 31 May 2022 00:21:56 +0000 (18:21 -0600)]
[libc++][test] Enable constexpr string comparison tests

Some tests in `string.view.comparison` are not enabled due to previous lack of
support for `constexpr std::string`. Now that it is implemented, we can enable
these tests.

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

2 years agoFix DXContainer test on ppcbe
Chris Bieneman [Thu, 2 Jun 2022 01:18:41 +0000 (20:18 -0500)]
Fix DXContainer test on ppcbe

Silly mistake, the code here was byteswapping in-place which corrupts
the data structure that is used later to write the correct file.

2 years ago[BOLT][DWARF] Fix TU Index handling for DWARF4/5
Alexander Yermolovich [Thu, 2 Jun 2022 01:15:41 +0000 (18:15 -0700)]
[BOLT][DWARF] Fix TU Index handling for DWARF4/5

When we generate split dwarf with -fdebug-types-section we will have
.debug_types.dwo sections. These go into TU Index when we run llvm-dwp. BOLT was
not handling DWP input correctly with this section.

Added support for handling DWP with TU Index as an input and output for DWARF4.
Added support for handling DWP with TU Index as an input for DWARF5

Reviewed By: maksfb

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

2 years agoBranchFolder: Require NoPHIs
Matt Arsenault [Fri, 22 Apr 2022 23:15:58 +0000 (19:15 -0400)]
BranchFolder: Require NoPHIs

The pass doesn't handle SSA and breaks any phis.

2 years agoAMDGPU: Add release notes about atomic load and store
Matt Arsenault [Wed, 4 May 2022 12:12:51 +0000 (13:12 +0100)]
AMDGPU: Add release notes about atomic load and store

2 years agoAMDGPU: Fix missing c++ mode comment
Matt Arsenault [Wed, 18 May 2022 15:00:41 +0000 (16:00 +0100)]
AMDGPU: Fix missing c++ mode comment

2 years agoLTO: Decide upfront whether to use opaque/non-opaque pointer types
Matthias Braun [Wed, 18 May 2022 03:33:22 +0000 (20:33 -0700)]
LTO: Decide upfront whether to use opaque/non-opaque pointer types

LTO code may end up mixing bitcode files from various sources varying in
their use of opaque pointer types. The current strategy to decide
between opaque / typed pointers upon the first bitcode file loaded does
not work here, since we could be loading a non-opaque bitcode file first
and would then be unable to load any files with opaque pointer types
later.

So for LTO this:
- Adds an `lto::Config::OpaquePointer` option and enforces an upfront
  decision between the two modes.
- Adds `-opaque-pointers`/`-no-opaque-pointers` options to the gold
  plugin; disabled by default.
- `--opaque-pointers`/`--no-opaque-pointers` options with
  `-plugin-opt=-opaque-pointers`/`-plugin-opt=-no-opaque-pointers`
  aliases to lld; disabled by default.
- Adds an `-lto-opaque-pointers` option to the `llvm-lto2` tool.
- Changes the clang driver to pass `-plugin-opt=-opaque-pointers` to
  the linker in LTO modes when clang was configured with opaque
  pointers enabled by default.

This fixes https://github.com/llvm/llvm-project/issues/55377

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

2 years ago[ValueTypes] Define MVTs for v128i2/v64i4 as well as i2 and i4.
Hendrik Greving [Thu, 2 Jun 2022 00:46:50 +0000 (00:46 +0000)]
[ValueTypes] Define MVTs for v128i2/v64i4 as well as i2 and i4.

Adds MVT::v128i2, MVT::v64i4, and implied MVT::i2, MVT::i4.

Keeps MVT::i2, MVT::i4 lowering actions as expand, which should be
removed once targets set this explicitly.

Adjusts 11 lit tests to reflect slightly different behavior during
DAG combine.

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

2 years ago[Polly] Fix -Wreorder-ctor. NFC
Fangrui Song [Thu, 2 Jun 2022 00:33:14 +0000 (17:33 -0700)]
[Polly] Fix -Wreorder-ctor. NFC

2 years ago[RegisterClassInfo] Invalidate cached information if ignoreCSRForAllocationOrder...
Quentin Colombet [Thu, 2 Jun 2022 00:14:03 +0000 (17:14 -0700)]
[RegisterClassInfo] Invalidate cached information if ignoreCSRForAllocationOrder changes

Even if CSR list is same between functions, we could have had a different
allocation order if ignoreCSRForAllocationOrder is evaluated differently.
Hence invalidate cached register class information if
ignoreCSRForAllocationOrder changes.

Patch by Srividya Karumuri <srividya_karumuri@apple.com>

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

2 years ago[Object] Fix namespace style issues in D122069
Fangrui Song [Thu, 2 Jun 2022 00:04:58 +0000 (17:04 -0700)]
[Object] Fix namespace style issues in D122069

https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions

2 years ago[OMPIRBuilder] Add the support for compare capture
Shilei Tian [Wed, 1 Jun 2022 23:53:36 +0000 (19:53 -0400)]
[OMPIRBuilder] Add the support for compare capture

This patch adds the support for `compare capture` in `OMPIRBuilder`.

Reviewed By: jdoerfert

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

2 years ago[RISCV] Split fixed-vector-strided-load-store.ll so it can be autogened
Philip Reames [Wed, 1 Jun 2022 23:08:19 +0000 (16:08 -0700)]
[RISCV] Split fixed-vector-strided-load-store.ll so it can be autogened

I've gotten tired of updating register allocation changes by hand, let's just autogen this even if we have to duplicate it.

2 years agoRevert "[SLP]Improve shuffles cost estimation where possible."
Alexey Bataev [Wed, 1 Jun 2022 22:40:00 +0000 (15:40 -0700)]
Revert "[SLP]Improve shuffles cost estimation where possible."

This reverts commit fd5a6ce9dcb77b7821c95355d73af0b3b2020647 to fix
a crash detected by a buildbot
https://lab.llvm.org/buildbot/#/builders/179/builds/3805/steps/11/logs/stdio.

2 years ago[Binary] Promote OffloadBinary to inherit from Binary
Joseph Huber [Wed, 1 Jun 2022 19:28:34 +0000 (15:28 -0400)]
[Binary] Promote OffloadBinary to inherit from Binary

We use the `OffloadBinary` to create binary images of offloading files
and their corresonding metadata. This patch changes this to inherit from
the base `Binary` class. This allows us to create and insepect these
more generically. This patch includes all the necessary glue to
implement this as a new binary format, along with added the magic bytes
we use to distinguish the offloading binary to the `file_magic`
implementation.

Reviewed By: tra

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

2 years ago[RISCV] Use MachineRegisterInfo::use_instr_begin instead of use_begin+getParent....
Craig Topper [Wed, 1 Jun 2022 22:37:48 +0000 (15:37 -0700)]
[RISCV] Use MachineRegisterInfo::use_instr_begin instead of use_begin+getParent. NFCI

2 years ago[clang][AIX] add option mdefault-visibility-export-mapping
David Tenty [Tue, 10 May 2022 15:39:58 +0000 (11:39 -0400)]
[clang][AIX] add option mdefault-visibility-export-mapping

The option mdefault-visibility-export-mapping is created to allow
mapping default visibility to an explicit shared library export
(e.g. dllexport). Exactly how and if this is manifested is target
dependent (since it depends on how they map dllexport in the IR).

Three values are provided for the option:

* none: the default and behavior without the option, no additional export linkage information is created.
* explicit: add the export for entities with explict default visibility from the source, including RTTI
* all: add the export for all entities with default visibility

This option is useful for targets which do not export symbols as part of
their usual default linkage behaviour (e.g. AIX), such targets
traditionally specified such information in external files (e.g. export
lists), but this mapping allows them to use the visibility information
typically used for this purpose on other (e.g. ELF) platforms.

Reviewed By: MaskRay

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

2 years ago[mlir][sparse][NFC] Switch InitOp to bufferization::AllocTensorOp
Matthias Springer [Wed, 1 Jun 2022 21:59:58 +0000 (23:59 +0200)]
[mlir][sparse][NFC] Switch InitOp to bufferization::AllocTensorOp

Now that we have an AllocTensorOp (previously InitTensorOp) in the bufferization dialect, the InitOp in the sparse dialect is no longer needed.

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

2 years agoTemporarily disabling this test on arm
Chris Bieneman [Wed, 1 Jun 2022 21:45:49 +0000 (16:45 -0500)]
Temporarily disabling this test on arm

This is failing on an arm32 builder, and it is going to take me a while
to debug. To not block further progress I'm disabling this test on
arm32 configuraitons.

2 years ago[mlir][sparse] Using non-empty function name suffix for OverheadType::kIndex
wren romano [Tue, 31 May 2022 22:26:52 +0000 (15:26 -0700)]
[mlir][sparse] Using non-empty function name suffix for OverheadType::kIndex

The trick of using an empty token in the `FOREVERY_O` x-macro relies on preprocessor behavior which is only standard since C99 6.10.3/4 and C++11 N3290 16.3/4 (whereas it was undefined behavior up through C++03 16.3/10).  Since the `ExecutionEngine/SparseTensorUtils.cpp` file is required to be compile-able under C++98 compatibility mode (unlike the C++11 used elsewhere in MLIR), we shouldn't rely on that behavior.

Also, using a non-empty suffix helps improve uniformity of the API, since all other primary/overhead suffixes are also non-empty.  I'm using the suffix `0` since that's the value used by the `SparseTensorEncoding` attribute for indicating the index overhead-type.

Depends On D126720

Reviewed By: aartbik

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

2 years ago[LV] Update var name to Exiting, in line with terminology (NFC)
Florian Hahn [Wed, 1 Jun 2022 21:11:06 +0000 (22:11 +0100)]
[LV] Update var name to Exiting, in line with terminology (NFC)

Recently the terminology used has been changed from Exit->Exiting in
line with common LLVM loop terminology. Update a remaining use of the
old terminology.

2 years ago[BOLT][TEST] Replace cache+ option with ext-tsp
Huan Nguyen [Wed, 1 Jun 2022 20:59:28 +0000 (13:59 -0700)]
[BOLT][TEST] Replace cache+ option with ext-tsp

Replace "cache+" with "ext-tsp" in all BOLT tests

Test Plan:
```
ninja check-bolt
grep -rnw . -e "cache+"
```
no more tests containing "cache+"
"cache+" and "ext-tsp" are aliases

Reviewed By: rafauler

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

2 years agoupdate_mir_test_checks: Better handling of common prefixes
Nicolai Hähnle [Tue, 24 May 2022 23:57:14 +0000 (01:57 +0200)]
update_mir_test_checks: Better handling of common prefixes

Support the pattern where a test file uses multiple prefixes per run line:
one prefix that is unique to the run line, and additional prefixes that are
common with other run lines.

Decide on a per-function basis which prefix(es) to emit, based on which run
lines have the same output.

Move the renaming of vregs earlier, so that we can compare the output as it
would actually be printed in check lines.

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

2 years ago[bazel] Add a missing dependency after f3bdb56d61e3
Benjamin Kramer [Wed, 1 Jun 2022 20:49:34 +0000 (22:49 +0200)]
[bazel] Add a missing dependency after f3bdb56d61e3

2 years agoTemporarily disabling this test on arm
Chris Bieneman [Wed, 1 Jun 2022 20:50:20 +0000 (15:50 -0500)]
Temporarily disabling this test on arm

This is failing on an arm32 builder, and it is going to take me a while
to debug. To not block further progress I'm disabling this test on
arm32 configuraitons.

2 years ago[flang][NFC] Document intentional non-support for an extension
Peter Klausler [Wed, 1 Jun 2022 18:05:55 +0000 (11:05 -0700)]
[flang][NFC] Document intentional non-support for an extension

F18 doesn't accept INTEGER operands to the intrinsic LOGICAL operations;
some compilers do.  This usage is not portable, and not just because it's
non-conforming -- the bit representations of LOGICAL also vary between
compilers and options.  The "MIL-STD" bit intrinsics IAND() & al. have been
avaiable since the late 70's and should be used instead.

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

2 years ago[BOLT][NFC] Remove unused variable
Maksim Panchenko [Wed, 1 Jun 2022 19:29:34 +0000 (12:29 -0700)]
[BOLT][NFC] Remove unused variable

Reviewed By: Amir

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

2 years ago[gn build] Port 129c056d6269
LLVM GN Syncbot [Wed, 1 Jun 2022 20:34:21 +0000 (20:34 +0000)]
[gn build] Port 129c056d6269

2 years ago[ObjectYAML][DX] Support yaml2dxcontainer
Chris Bieneman [Wed, 1 Jun 2022 14:10:28 +0000 (09:10 -0500)]
[ObjectYAML][DX] Support yaml2dxcontainer

This patch adds a the first bits of support for a yaml representation
of dxcontainer files.

Since the YAML representation's primary purpose is testing
infrastructure, the yaml representation supports both verbose and a
more friendly format by making computable sizes and offsets optional.
If provided they are validated to be correct, otherwise they are
computed on the fly during emission.

As I expand the format I'll be able to make more size fields optional,
and I will continue to make the format easier to work with.

Depends on D124804

Reviewed By: lhames

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

2 years ago[PS5] Add PS5OSTargetInfo class, update affected tests
Paul Robinson [Wed, 1 Jun 2022 18:02:10 +0000 (11:02 -0700)]
[PS5] Add PS5OSTargetInfo class, update affected tests

2 years agoRefactor PS4OSTargetInfo into a base class and PS4 subclass; prep for PS5
Paul Robinson [Wed, 1 Jun 2022 15:53:26 +0000 (08:53 -0700)]
Refactor PS4OSTargetInfo into a base class and PS4 subclass; prep for PS5

2 years agoRevert "[ValueTypes] Define MVTs for v128i2/v64i4 as well as i2 and i4."
Hendrik Greving [Wed, 1 Jun 2022 20:26:34 +0000 (13:26 -0700)]
Revert "[ValueTypes] Define MVTs for v128i2/v64i4 as well as i2 and i4."

This reverts commit 430ac5c3029c52e391e584c6d4447e6e361fae99.

Due to failures in Clang tests.

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

2 years ago[LV] Add additional tests for pointer select support.
Florian Hahn [Wed, 1 Jun 2022 20:19:03 +0000 (21:19 +0100)]
[LV] Add additional tests for pointer select support.

Additional test cases for D114487.

2 years ago[Object][DX] Parse DXContainer Parts
Chris Bieneman [Mon, 2 May 2022 23:09:36 +0000 (18:09 -0500)]
[Object][DX] Parse DXContainer Parts

DXContainer files are structured as parts. This patch adds support for
parsing out the file part offsets and file part headers.

Reviewed By: kuhar

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

2 years ago[ValueTypes] Define MVTs for v128i2/v64i4 as well as i2 and i4.
Hendrik Greving [Fri, 6 May 2022 23:02:31 +0000 (16:02 -0700)]
[ValueTypes] Define MVTs for v128i2/v64i4 as well as i2 and i4.

Adds MVT::v128i2, MVT::v64i4, and implied MVT::i2, MVT::i4.

Keeps MVT::i2, MVT::i4 lowering actions as `expand`, which should be
removed once targets set this explicitly.

Adjusts 11 lit tests to reflect slightly different behavior during
DAG combine.

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

2 years agoRevert "[Driver] Enable to use C++20 standalne by -fcxx-modules"
Adrian Prantl [Wed, 1 Jun 2022 19:10:39 +0000 (12:10 -0700)]
Revert "[Driver] Enable to use C++20 standalne by -fcxx-modules"

This reverts commit a544710cd43ba9f7729a613c58729f146e792a8e.

See discussion in D120540.

This breaks C++ Clang modules on Darwin and also more than a dozen
tests in the LLDB testsuite.  I think we need to be more careful to
separate out the enabling of Clang C++ modules and C++20
modules. Either by having -fmodules-ts control the HaveModules flag,
or by adding a way to explicitly turn them off.

2 years agoRevert "[NFC] Use %clang instead of %clang++ in tests"
Adrian Prantl [Wed, 1 Jun 2022 19:10:30 +0000 (12:10 -0700)]
Revert "[NFC] Use %clang instead of %clang++ in tests"

This reverts commit 738c20e6df01217b6364c3b75d0ced6b6fb6277e as a dependency of D120540.

2 years agoRevert "[Driver][Modules] Remove dependence on linking support from clang/test/Driver...
Adrian Prantl [Wed, 1 Jun 2022 19:10:12 +0000 (12:10 -0700)]
Revert "[Driver][Modules] Remove dependence on linking support from clang/test/Driver/modules.cpp"

This reverts commit 35b1cfc76f08faabf3f27c0bd054acc7c854a6ca as a dependency of D120540.

2 years ago[NFC][libc++][format] Improves naming.
Mark de Wever [Sat, 14 May 2022 16:03:42 +0000 (18:03 +0200)]
[NFC][libc++][format] Improves naming.

Based on review comments in D110499.

Depends on D110499

Reviewed By: ldionne, #libc

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

2 years ago[lld/mac] clang-format after f5709066e3b
Nico Weber [Wed, 1 Jun 2022 18:53:08 +0000 (14:53 -0400)]
[lld/mac] clang-format after f5709066e3b

2 years ago[lld/mac] Cache file IDs of symbols in emitStabs for faster sorting
Michael Eisel [Wed, 1 Jun 2022 18:49:19 +0000 (14:49 -0400)]
[lld/mac] Cache file IDs of symbols in emitStabs for faster sorting

This reduces the time emitStabs() takes by about 275ms, or 3% of overall
linking time for the project I'm on. Although the parent function is run in
parallel, it's one of the slowest tasks in that concurrent batch (I have
another optimization for another slow task as well).

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

2 years ago[mlir][math] Add math.ctlz expansion to control flow + arith operations
Rob Suderman [Wed, 1 Jun 2022 18:35:26 +0000 (11:35 -0700)]
[mlir][math] Add math.ctlz expansion to control flow + arith operations

Ctlz is an intrinsic in LLVM but does not have equivalent operations in SPIR-V.
Including a decomposition gives an alternative path for these platforms.

Reviewed By: NatashaKnk

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

2 years ago[Polly] Migrate -polly-mse to the new pass manager.
Yang Keao [Wed, 1 Jun 2022 18:09:58 +0000 (13:09 -0500)]
[Polly] Migrate -polly-mse to the new pass manager.

This patch implements the `MaximalStaticExpansion` and its printer in NPM.

Reviewed By: Meinersbur

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

2 years ago[ccache] Add Windows support
Nathaniel McVicar [Wed, 1 Jun 2022 18:33:56 +0000 (11:33 -0700)]
[ccache] Add Windows support

Windows builds can't receive environment variables on the command line or make use of RULE_LAUNCH_COMPILE with ccache.

Reviewed By: stella.stamenova, Ericson2314

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

2 years ago[mlir] Add global_load and global_store ops to ml_program.
Stella Laurenzo [Tue, 31 May 2022 20:46:06 +0000 (13:46 -0700)]
[mlir] Add global_load and global_store ops to ml_program.

* Adds simple, non-atomic, non-volatile, non-synchronized direct load/store ops.

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

2 years agoFix an incorrect bit-width for storing attribute syntax information
Aaron Ballman [Wed, 1 Jun 2022 18:22:24 +0000 (14:22 -0400)]
Fix an incorrect bit-width for storing attribute syntax information

This field corresponds to the Syntax enumeration, and that gained
another entry in 1fdf952deeb9a02aa34794af3c1a7d13a30e068e. However,
the bit-field for storing the syntax used was not adjusted to handle
the extra field.

This turns out to be unobservable for HLSL attributes at the moment, so
there is no test coverage. But it's also not really an NFC change
either.

2 years ago[mlir] Add conversion and tests for complex.[sqrt|atan2] to Arith.
Alexander Belyaev [Wed, 1 Jun 2022 18:12:23 +0000 (20:12 +0200)]
[mlir] Add conversion and tests for complex.[sqrt|atan2] to Arith.

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

2 years ago[clang] Add tests for (const) weak variables
Anders Waldenborg [Fri, 27 May 2022 23:21:16 +0000 (01:21 +0200)]
[clang] Add tests for (const) weak variables

This adds tests checking the behavior of const variables declared with
weak attribute.

Both checking that they can not be used in places where a constant
expression is required and that a dynamic initializer is emitted when
used as an initializer expression.

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

2 years ago[mlir][sparse] Enable the test for operator expm1.
bixia1 [Tue, 31 May 2022 23:17:45 +0000 (16:17 -0700)]
[mlir][sparse] Enable the test for operator expm1.

Reviewed By: aartbik

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

2 years ago[AMDGPU] Change GISel error handling for TFE on GFX90A
Stanislav Mekhanoshin [Wed, 1 Jun 2022 17:44:19 +0000 (10:44 -0700)]
[AMDGPU] Change GISel error handling for TFE on GFX90A

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

2 years ago[SLP]Improve shuffles cost estimation where possible.
Alexey Bataev [Thu, 9 Dec 2021 18:34:08 +0000 (10:34 -0800)]
[SLP]Improve shuffles cost estimation where possible.

Improved/fixed cost modeling for shuffles by providing masks, improved
cost model for non-identity insertelements.

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

2 years ago[DFSan] Remove deprecated flag from build-libc-list.py
Andrew Browne [Wed, 25 May 2022 22:40:01 +0000 (15:40 -0700)]
[DFSan] Remove deprecated flag from build-libc-list.py

Reviewed By: vitalybuka

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

2 years ago[libc] Keep all thread state information separate from the thread structure.
Siva Chandra Reddy [Fri, 27 May 2022 05:25:36 +0000 (05:25 +0000)]
[libc] Keep all thread state information separate from the thread structure.

The state is now stored on the thread's stack memory. This enables
implementing pthread API like pthread_detach which takes the pthread_t
structure argument by value.

Reviewed By: lntue

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

2 years agoRevert "Adapt LLDB for D120540."
Adrian Prantl [Wed, 1 Jun 2022 17:33:25 +0000 (10:33 -0700)]
Revert "Adapt LLDB for D120540."

This reverts commit ca73de43744503a557b1f3709c0ff4751798702f.

That patch was just hiding the problem, instead of fixing it.

2 years ago[Libomptarget] Add basic support for dynamic shared memory on AMDGPU
Joseph Huber [Mon, 9 May 2022 18:26:01 +0000 (14:26 -0400)]
[Libomptarget] Add basic support for dynamic shared memory on AMDGPU

This patchs adds the arguments necessary to allocate the size of the
dynamic shared memory via the `LIBOMPTARGET_SHARED_MEMORY_SIZE`
environment variable. This patch only allocates the memory, AMDGPU has a
limitation that shared memory can only be accessed from the kernel
directly. So this will currently only work with optimizations to inline
the accessor function.

Reviewed By: JonChesterfield

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

2 years ago[BOLT] Add `-o` option to merge-fdata
Yi Kong [Wed, 1 Jun 2022 15:53:59 +0000 (23:53 +0800)]
[BOLT] Add `-o` option to merge-fdata

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

2 years agoar_to_bc.sh: Ignore non-bitcode files in archives
Fangrui Song [Wed, 1 Jun 2022 17:28:14 +0000 (10:28 -0700)]
ar_to_bc.sh: Ignore non-bitcode files in archives

The script uses llvm-link to link LLVM bitcode files.
5426da8ffa4a6d55adab21026ce6ebe8f1cc6ef2 used -DLLVM_DISABLE_ASSEMBLY_FILES=ON
to ignore object files compiled from lib/Support/BLAKE3/*.S.

A better approach (which fits Bazel better) is to ignore non-bitcode files.

Reviewed By: akyrtzi

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

2 years agosanitizers: Do not include crypt.h if SANITIZER_INTERCEPT_CRYPT_R is undef
Nico Weber [Tue, 31 May 2022 19:46:12 +0000 (15:46 -0400)]
sanitizers: Do not include crypt.h if SANITIZER_INTERCEPT_CRYPT_R is undef

sanitizer_intercept_overriders.h might override SANITIZER_INTERCEPT_CRYPT_R to
be undefined. There's no need to require crypt.h in that case.

(The motivation is that crypt() moved from glibc into its own package at some
point, which makes intercepting it and building with a single sysroot that
supports both pre-bullseye and post-bullseye a bit hairy.)

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

2 years ago[mlir][python][ctypes] fix ctype python binding complication for complex
Aart Bik [Thu, 26 May 2022 22:17:31 +0000 (15:17 -0700)]
[mlir][python][ctypes] fix ctype python binding complication for complex

There is no direct ctypes for MLIR's complex (and thus np.complex128
and np.complex64) yet, causing the mlir python binding methods for
memrefs to crash. This revision fixes this by passing complex arrays
as tuples of floats, correcting at the boundaries for the proper view.

NOTE: some of these changes (4 -> 2) were forced by the new "linting"

Reviewed By: mehdi_amini

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

2 years agocompiler-rt: Allow build without __c11_atomic_fetch_nand
Brooks Davis [Wed, 1 Jun 2022 16:56:37 +0000 (12:56 -0400)]
compiler-rt: Allow build without __c11_atomic_fetch_nand

Don't build atomic fetch nand libcall functions when the required
compiler builtin isn't available. Without this compiler-rt can't be
built with LLVM 13 or earlier.

Not building the libcall functions isn't optimal, but aligns with the
usecase in FreeBSD where compiler-rt from LLVM 14 is built with an LLVM
13 clang and no LLVM 14 clang is built.

Reviewed By: efriedma

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

2 years ago[analyzer][NFC] Add test for 3a07280290564e294c957c94c918a6680714b417
Balazs Benics [Wed, 1 Jun 2022 16:53:19 +0000 (18:53 +0200)]
[analyzer][NFC] Add test for 3a07280290564e294c957c94c918a6680714b417

I'm adding a test demonstraing that the issue reported by @mikaelholmen
is fixed.

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

2 years ago[SLP]Fix PR55796: insert point for extractelements from different basic blocks.
Alexey Bataev [Tue, 31 May 2022 20:51:27 +0000 (13:51 -0700)]
[SLP]Fix PR55796: insert point for extractelements from different basic blocks.

Extractelement instructions may come from different basic blocks, need
to take it into account when looking for a last instruction in the
bundle to prevent compiler crash.

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

2 years ago[MSVC] Fix pragma alloc_text failing for C files
Stephen Long [Wed, 1 Jun 2022 16:39:32 +0000 (09:39 -0700)]
[MSVC] Fix pragma alloc_text failing for C files

`isExternCContext()` is returning false for functions in C files

Reviewed By: rnk, aaron.ballman

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

2 years ago[Hexagon] Regenerate store-imm-amode.ll
Simon Pilgrim [Wed, 1 Jun 2022 16:39:07 +0000 (17:39 +0100)]
[Hexagon] Regenerate store-imm-amode.ll

2 years ago[AMDGPU] Regenerate fabs.f16.ll tests
Simon Pilgrim [Wed, 1 Jun 2022 15:29:05 +0000 (16:29 +0100)]
[AMDGPU] Regenerate fabs.f16.ll tests

2 years ago[AMDGPU][NFC] Refactor AMDGPUCallingConv.td
Scott Linder [Wed, 25 May 2022 17:17:53 +0000 (17:17 +0000)]
[AMDGPU][NFC] Refactor AMDGPUCallingConv.td

Rename CalleeSavedRegs defs to avoid being overly specific:

* CSR_AMDGPU_AGPRs_32_255 => CSR_AMDGPU_AGPRs
* CSR_AMDGPU_SGPRs_30_31 + CSR_AMDGPU_SGPRs_32_105 => CSR_AMDGPU_SGPRs
* CSR_AMDGPU_SI_Gfx_SGPRs_4_29 + CSR_AMDGPU_SI_Gfx_SGPRs_64_105 =>
  CSR_AMDGPU_SI_Gfx_SGPRs
* CSR_AMDGPU_HighRegs => CSR_AMDGPU
* CSR_AMDGPU_HighRegs_With_AGPRs => CSR_AMDGPU_GFX90AInsts
* CSR_AMDGPU_SI_Gfx_With_AGPRs => CSR_AMDGPU_SI_Gfx_GFX90AInsts

Introduce a class RegMask to mark the cases where we use the
CalleeSavedRegs class purely as an expedient way to produce a mask.
Update the names of these masks to not mention "CSR". Other targets also
seem to do this, so a reasonable alternative is to actually update
table-gen to include a new class to do this explicitly, but the current
approach seems harmless so I opted to just make it more explicit.

Reviewed By: arsenm, sebastian-ne

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

2 years ago[flang][OpenMP]Make omp.wsloop arguments appear in memory (#1277)
Mats Petersson [Mon, 17 Jan 2022 13:54:09 +0000 (13:54 +0000)]
[flang][OpenMP]Make omp.wsloop arguments appear in memory (#1277)

As per issue #1196, the loop induction variable, which is an argument
in the omp.wsloop operation, does not have a memory location, so when
passed to a function or subroutine, the reference to the value is not
a memory location, but the value of the induction variable. The callee
function/subroutine is then trying to dereference memory at address 1
or some other "not a good memory location".

This is fixed by creating a temporary memory location and storing the
value of the induction variable in that.

Test fixes as a consequence of the changed code generated.

Add checking for some of the omp-unstructured.f90 to check for alloca,
store and load operations, to ensure the correct flow. Add a test
for CYCLE inside a omp-do loop.

Also convert to use -emit-fir in the omp-unstructrued, and make
the symbol matching consistent in the omp-wsloop-variable test.

Reviewed By: peixin

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

2 years agoTensorFlowCompile: Add object file to list of sources rather than LINK_LIBS
Matthias Braun [Tue, 31 May 2022 23:49:24 +0000 (16:49 -0700)]
TensorFlowCompile: Add object file to list of sources rather than LINK_LIBS

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

2 years ago[MLIR][Presburger] Simplex: remove redundant zeroing out of row
Arjun P [Tue, 31 May 2022 17:17:46 +0000 (18:17 +0100)]
[MLIR][Presburger] Simplex: remove redundant zeroing out of row

This fillRow(..., 0) is redundant because when the size of the tableau is
consistent, the resize always creates a new row, which is zero-initialized.

Also added asserts throughout to ensure the dimensions of the tableau remain
consistent.

Reviewed By: Groverkss

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

2 years ago[MLIR][Presburger] Matrix: inline trivial accessors
Arjun P [Wed, 1 Jun 2022 15:53:51 +0000 (16:53 +0100)]
[MLIR][Presburger] Matrix: inline trivial accessors

This resolves a comment from https://reviews.llvm.org/D126708
that was previously missed.

2 years ago[MLIR][Presburger] Move Matrix accessors inline
Arjun P [Tue, 31 May 2022 16:48:05 +0000 (17:48 +0100)]
[MLIR][Presburger] Move Matrix accessors inline

This gives a 1.5x speedup on the Presburger unittests.

Reviewed By: Groverkss

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

2 years ago[libc++][format] Fixes string-literal formatting.
Mark de Wever [Mon, 30 May 2022 16:22:00 +0000 (18:22 +0200)]
[libc++][format] Fixes string-literal formatting.

Formatting a string-literal had an off-by-one issue where the NUL
terminator became part of the formatted output.

Reviewed By: #libc, ldionne

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

2 years ago[NFC][MLIR] Fix -Wtype-limits warning
PeixinQiao [Wed, 1 Jun 2022 15:42:07 +0000 (23:42 +0800)]
[NFC][MLIR] Fix -Wtype-limits warning

Fix the warning: comparison of unsigned expression in ‘>= 0’ is always
true.

Reviewed By: kiranchandramohan, shraiysh

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

2 years agoFix std::has_unique_object_representations for _BitInt types with padding bits
Mital Ashok [Wed, 1 Jun 2022 15:34:40 +0000 (11:34 -0400)]
Fix std::has_unique_object_representations for _BitInt types with padding bits

"std::has_unique_object_representations<_BitInt(N)>" was always true,
even if the type has padding bits (since the trait assumes all integer
types have no padding bits). The standard has an explicit note that
this should not hold for types with padding bits.

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

2 years agoExpand definition deprecation warning to include constexpr statements.
Luke Nihlen [Wed, 1 Jun 2022 15:29:48 +0000 (11:29 -0400)]
Expand definition deprecation warning to include constexpr statements.

Clang currently warns on definitions downgraded to declarations
with a const modifier, but not for a constexpr modifier. This patch
updates the warning logic to warn on both inputs, and adds a test to
check the additional case as well.

See also: https://bugs.chromium.org/p/chromium/issues/detail?id=1284718

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

2 years ago[RISCV] Fix i64<->f64 and i32<->f32 bitcasts with VLS vectors enabled.
Craig Topper [Wed, 1 Jun 2022 15:13:49 +0000 (08:13 -0700)]
[RISCV] Fix i64<->f64 and i32<->f32 bitcasts with VLS vectors enabled.

We enable a custom handler to optimize conversions between scalars
and fixed vectors. Unfortunately, the custom handler picks up scalar
to scalar conversions as well. If the scalar types are both legal,
we wouldn't match any of the fixed vector cases and would return SDValue()
causing the LegalizeDAG to expand the bitcast through memory.

This patch fixes this by checking if it's a scalar to scalar conversion
and returns `Op` if both types are legal.

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

2 years ago[flang] Add semantic checks for threadprivate and declare target directives
PeixinQiao [Wed, 1 Jun 2022 14:40:51 +0000 (22:40 +0800)]
[flang] Add semantic checks for threadprivate and declare target directives

This patch supports the following checks:
```
[5.1] 2.21.2 THREADPRIVATE Directive
The threadprivate directive must appear in the declaration section of
a scoping unit in which the common block or variable is declared.
[5.1] 2.14.7 Declare Target Directive
The directive must appear in the declaration section of a scoping unit
in which the common block or variable is declared.
```
Reviewed By: kiranchandramohan, shraiysh, NimishMishra

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

2 years ago[TwoAddressInstructionPass] Relax assert in statepoint processing.
Denis Antrushin [Wed, 1 Jun 2022 11:58:32 +0000 (18:58 +0700)]
[TwoAddressInstructionPass] Relax assert in statepoint processing.

D124631 added special processing for STATEPOINT instructions.
It appears that assertion added there is too strong. We can get two
tied operands with the same register tied to different defs. If we
hit such case, do not process it in statepoint-specific code and
delegate it to common case.

2 years ago[ARM] uxtb.ll - adjust armv6 triple so the update_llc_test_checks.py script can be...
Simon Pilgrim [Wed, 1 Jun 2022 14:28:11 +0000 (15:28 +0100)]
[ARM] uxtb.ll - adjust armv6 triple so the update_llc_test_checks.py script can be used to regenerate the tests

No need to specify armv6-apple-darwin in these UXTB codegen tests

2 years ago[ARM][Thumb2] Refresh UXTB16 tests to match optimized IR from instcombine
Simon Pilgrim [Wed, 1 Jun 2022 14:25:58 +0000 (15:25 +0100)]
[ARM][Thumb2] Refresh UXTB16 tests to match optimized IR from instcombine

As discussed on D77804, instcombine will have already performed a similar SimplifyMultipleUseDemandedBits call which will break the UXTB16 pattern that was being match in these DAG tests

I've updated the existing tests so that it match the instcombine IR (with a suitable FIXME) and added an equivalent test pattern suggested by @dmgreen

2 years ago[analyzer] Fix wrong annotation of PointerToMemberData
Balazs Benics [Wed, 1 Jun 2022 14:12:54 +0000 (16:12 +0200)]
[analyzer] Fix wrong annotation of PointerToMemberData

Unfortunately I don't have a reproducer for this.
Reported by @mikaelholmen!

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

2 years ago[X86] LowerVSETCC - merge getConstant() calls with flipped/unflipped sign masks....
Simon Pilgrim [Wed, 1 Jun 2022 14:09:37 +0000 (15:09 +0100)]
[X86] LowerVSETCC - merge getConstant() calls with flipped/unflipped sign masks. NFCI.

2 years ago[x86] fix miscompile from wrongly identified fneg
Sanjay Patel [Wed, 1 Jun 2022 13:46:29 +0000 (09:46 -0400)]
[x86] fix miscompile from wrongly identified fneg

We may need to peek through a bitcast when identifying an fneg idiom
via its pool constant, but we can't allow a different-sized constant
in that match.

This is noted in issue #55758 with an example that needs fast-math,
but as the test here shows, this has potential to miscompile more
generally (no fast-math required).

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

2 years ago[libc] fix typo in BUILD.bazel feature
Guillaume Chatelet [Wed, 1 Jun 2022 13:53:36 +0000 (13:53 +0000)]
[libc] fix typo in BUILD.bazel feature

2 years agoCodeGen: Move getAddressSpaceForPseudoSourceKind into TargetMachine
Matt Arsenault [Wed, 27 Apr 2022 00:35:01 +0000 (20:35 -0400)]
CodeGen: Move getAddressSpaceForPseudoSourceKind into TargetMachine

Avoid the dependency on TargetInstrInfo, which depends on the subtarget
and therefore the individual function.

Currently AMDGPU is constructing PseudoSourceValue instances in MachineFunctionInfo.
In order to facilitate copying MachineFunctionInfo, we need to stop allocating these
there. Alternatively we could allow targets to subclass PseudoSourceValueManager,
and allocate them similarly to MachineFunctionInfo.

2 years ago[x86] add test for mismatched fneg; NFC
Sanjay Patel [Wed, 1 Jun 2022 12:05:35 +0000 (08:05 -0400)]
[x86] add test for mismatched fneg; NFC

issue #55758

2 years ago[libc] Apply no-builtin everywhere, remove unnecessary flags
Guillaume Chatelet [Wed, 1 Jun 2022 11:57:11 +0000 (11:57 +0000)]
[libc] Apply no-builtin everywhere, remove unnecessary flags

Note, this is a re-submission of D125894 with `features = ["-header_modules"]`
added to the main BUILD.bazel file.

Some functions like `stpncpy` are implemented in terms of `memset` but are not
currently using `-fno-builtin-memset`. This is somewhat hidden by the fact that
we use `-ffreestanding` globally and that `-ffreestanding` implies
`-fno-builtin` for Clang.

This patch also removes `-mllvm -combiner-global-alias-analysis` that is Clang
specific and that does not bring substantial gains on modern processors.

Also we keep `-mllvm --tail-merge-threshold=0` for aarch64 in CMakeLists.txt
but we omit it in the Bazel config. This is because Bazel consumes the source
files directly and so it can use PGO to take optimal decisions locally.

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

2 years agoFix potentially uninitialized memory
Mikhail Goncharov [Wed, 1 Jun 2022 13:30:10 +0000 (15:30 +0200)]
Fix potentially uninitialized memory

For https://github.com/llvm/llvm-project/commit/7d76d6095880f34914d85d876b260cc4a4ea640d