platform/upstream/llvm.git
19 months ago[test] Fix CodeGen/M68k/pipeline.ll after D123394 MachineLateInstrsCleanupPass
Fangrui Song [Sun, 4 Dec 2022 19:08:37 +0000 (19:08 +0000)]
[test] Fix CodeGen/M68k/pipeline.ll after D123394 MachineLateInstrsCleanupPass

19 months agoIR: HotnessThreshold llvm::Optional => std::optional
Fangrui Song [Sun, 4 Dec 2022 19:06:47 +0000 (19:06 +0000)]
IR: HotnessThreshold llvm::Optional => std::optional

19 months ago[BOLT] Fix after DebugInfoMetadata change 0ca43d44888885d6caf7636db91fe810e822263c
Fangrui Song [Sun, 4 Dec 2022 18:57:52 +0000 (18:57 +0000)]
[BOLT] Fix after DebugInfoMetadata change 0ca43d44888885d6caf7636db91fe810e822263c

19 months ago[flang] Check constraint C834 on INTENT(OUT) assumed-size dummy arrays
Peter Klausler [Tue, 15 Nov 2022 20:14:51 +0000 (12:14 -0800)]
[flang] Check constraint C834 on INTENT(OUT) assumed-size dummy arrays

An assumed-size dummy array argument with INTENT(OUT) can't have a type
that might require any runtime (re)initialization, since the size of the
array is not known.

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

19 months ago[NFC][SimplifyCFG] Add some tests with PHI's for fold-branch-to-common-dest xform
Roman Lebedev [Sun, 4 Dec 2022 15:51:57 +0000 (18:51 +0300)]
[NFC][SimplifyCFG] Add some tests with PHI's for fold-branch-to-common-dest xform

19 months ago[NFC] Re-autogenerate checklines in a few tests being affected
Roman Lebedev [Sun, 4 Dec 2022 17:50:26 +0000 (20:50 +0300)]
[NFC] Re-autogenerate checklines in a few tests being affected

19 months ago[NFC][SimplifyCFG] `shouldFoldCondBranchesToCommonDestination()`: report the common...
Roman Lebedev [Sun, 4 Dec 2022 16:29:16 +0000 (19:29 +0300)]
[NFC][SimplifyCFG] `shouldFoldCondBranchesToCommonDestination()`: report the common succ

19 months agoDebugInfoMetadata: convert Optional to std::optional
Krzysztof Parzyszek [Sat, 3 Dec 2022 22:01:15 +0000 (16:01 -0600)]
DebugInfoMetadata: convert Optional to std::optional

19 months agoIterate over StringMaps using structured bindings. NFCI.
Benjamin Kramer [Sun, 4 Dec 2022 17:36:41 +0000 (18:36 +0100)]
Iterate over StringMaps using structured bindings. NFCI.

19 months ago[ADT] Enable structured bindings for iterating StringMap
Benjamin Kramer [Sun, 4 Dec 2022 16:30:33 +0000 (17:30 +0100)]
[ADT] Enable structured bindings for iterating StringMap

const references only for now, we can add overloads to have a mutable or
movable `second` if the need arises.

19 months agoCompress a few pairs using PointerIntPairs
Benjamin Kramer [Sun, 4 Dec 2022 15:15:39 +0000 (16:15 +0100)]
Compress a few pairs using PointerIntPairs

Use the uniform structured bindings interface where possible. NFCI.

19 months agoDebugInfo: convert Optional to std::optional
Krzysztof Parzyszek [Sat, 3 Dec 2022 21:55:23 +0000 (15:55 -0600)]
DebugInfo: convert Optional to std::optional

19 months ago[ADT] Allow structured bindings on PointerIntPair
Benjamin Kramer [Sun, 4 Dec 2022 15:10:00 +0000 (16:10 +0100)]
[ADT] Allow structured bindings on PointerIntPair

Apart from simplifying code, this has the advantage of making the
interface between std::pair and PointerIntPair more uniform.

19 months ago[NFC][clang] Strengthen checks in avx512fp16-builtins.c
John McIver [Sun, 4 Dec 2022 14:57:34 +0000 (14:57 +0000)]
[NFC][clang] Strengthen checks in avx512fp16-builtins.c

* Add end-of-line check to load instructions

19 months ago[NFC][clang] Strengthen checks in avx512f-builtins.c
John McIver [Sun, 4 Dec 2022 14:55:03 +0000 (14:55 +0000)]
[NFC][clang] Strengthen checks in avx512f-builtins.c

* Add check to unnamed portion of nontemporal attribute
* Add end-of-line check to load instructions

19 months ago[VPlan] Mark VPScalarIVStepsRecipe as not reading/writing memory.
Florian Hahn [Sun, 4 Dec 2022 12:58:46 +0000 (12:58 +0000)]
[VPlan] Mark VPScalarIVStepsRecipe as not reading/writing memory.

The recipe only computes the inductions steps using its operands. It
does neither read nor write memory.

Split of from D133760.

19 months ago[VPlan] Add sideeffect/memory unit test for VPScalarIVStepsRecipe. (NFC)
Florian Hahn [Sun, 4 Dec 2022 12:50:09 +0000 (12:50 +0000)]
[VPlan] Add sideeffect/memory unit test for VPScalarIVStepsRecipe. (NFC)

19 months ago[OpenMP][libomptarget] Add hasQueue() function in NextGen plugin's AsyncInfoWrapperTy
Kevin Sala [Sun, 4 Dec 2022 00:40:39 +0000 (01:40 +0100)]
[OpenMP][libomptarget] Add hasQueue() function in NextGen plugin's AsyncInfoWrapperTy

This patch prepares the PluginInterface for the new AMDGPU NextGen plugin.

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

19 months ago[LV] Update test to use use variables in CHECK lines.
Florian Hahn [Sun, 4 Dec 2022 11:59:00 +0000 (11:59 +0000)]
[LV] Update test to use use variables in CHECK lines.

This makes the test more robust with respect to value numbering which
will change with future changes.

19 months ago[mlir][affine] Support affine.parallel in the index set analysis
Kai Sasaki [Sun, 4 Dec 2022 11:09:01 +0000 (20:09 +0900)]
[mlir][affine] Support affine.parallel in the index set analysis

Support affine.parallel in the index set analysis. It allows us to do dependence analysis containing affine.parallel in addition to affine.for and affine.if. This change only supports the constant lower/upper bound in affine.parallel. Other complicated affine map bounds will be supported in further commits.

See https://github.com/llvm/llvm-project/issues/57327

Reviewed By: bondhugula

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

19 months agoRevert "[AArch64] Make ArchInfo copyable again"
Tomas Matheson [Sun, 4 Dec 2022 11:00:01 +0000 (11:00 +0000)]
Revert "[AArch64] Make ArchInfo copyable again"

This reverts commit 6272f87ba06132a1b479068759d72178e5fe4472.

19 months ago[DWARFLinker][NFC] Change interface of DWARFLinker to specify accel table kinds expli...
Alexey Lapshin [Sun, 20 Nov 2022 19:03:51 +0000 (20:03 +0100)]
[DWARFLinker][NFC] Change interface of DWARFLinker to specify accel table kinds explicitly.

Currently, DWARFLinker receives kind of accel tables as predefined sets:

```
  Apple,   ///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.
  Dwarf,   ///< DWARF v5 .debug_names.
  Default, ///< Dwarf for DWARF5 or later, Apple otherwise.
  Pub,     ///< .debug_pubnames, .debug_pubtypes
```

This patch removes implicit sets of tables(Default, Dwarf) and allows to ask for several sets:

```
  Apple,     ///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.
  Pub,       ///< .debug_pubnames, .debug_pubtypes
  DebugNames ///< .debug_names.
```

It allows seamlessness adding more accel tables in the future: .gdb_index, .debug_cu_index...
Doing things that way, DWARFLinker will be independent of consumers' requirements.
f.e. dsymutil and llvm-dwarfutil may have different variants for Default set
(so, instead of implementing these differencies inside DWARFLinker it could be
implemented in the corresponding module).

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

19 months ago[Object] llvm::Optional => std::optional
Fangrui Song [Sun, 4 Dec 2022 09:11:11 +0000 (09:11 +0000)]
[Object] llvm::Optional => std::optional

19 months agoCorrect typo introduced in f607884a04b0ca06951227a01d00bc59b948d337
serge-sans-paille [Sat, 3 Dec 2022 21:23:44 +0000 (22:23 +0100)]
Correct typo introduced in f607884a04b0ca06951227a01d00bc59b948d337

Fix #59321

19 months ago[flang/unittests] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 03:08:01 +0000 (19:08 -0800)]
[flang/unittests] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[mlir/unittests] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 03:07:59 +0000 (19:07 -0800)]
[mlir/unittests] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[polly] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 02:50:29 +0000 (18:50 -0800)]
[polly] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[mlir] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 02:50:27 +0000 (18:50 -0800)]
[mlir] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[MLIR] Fix typo in `add_mlir_library` docs. NFC.
Joe Loser [Sun, 4 Dec 2022 02:27:37 +0000 (19:27 -0700)]
[MLIR] Fix typo in `add_mlir_library` docs. NFC.

`s/librar/library` in `llvm_add_library`.

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

19 months ago[MLIR] Use `if constexpr` in `StorageUniquer` and `IR/AffineExpr`
Joe Loser [Sun, 4 Dec 2022 01:01:53 +0000 (18:01 -0700)]
[MLIR] Use `if constexpr` in `StorageUniquer` and `IR/AffineExpr`

Querying the type trait is something that can be done at compile time. So,
replace the runtime `if` with `if constexpr`.

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

19 months ago[flang] Warn about local names that are the same as their enclosing program unit
Peter Klausler [Mon, 14 Nov 2022 22:38:03 +0000 (14:38 -0800)]
[flang] Warn about local names that are the same as their enclosing program unit

Modules, submodules, main programs, and BLOCK DATA subprograms have names
that cannot be used within their scope, so we allow those names to be
used for other entities in the scope.  This might not be entirely
conformant with the language standard, so warn about it.

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

19 months ago[flang] More error checking for ASSOCIATED()
Peter Klausler [Mon, 14 Nov 2022 18:29:32 +0000 (10:29 -0800)]
[flang] More error checking for ASSOCIATED()

The TARGET= argument of the ASSOCIATED() intrinsic function must be a valid
pointer assignment statement target.  Ensure that it does not contain a vector
subscript or any coindexing, either of which would imply a data copy into
temporary storage.

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

19 months ago[flang] Emit portability warning for assigned FORMAT use
Peter Klausler [Mon, 14 Nov 2022 17:42:12 +0000 (09:42 -0800)]
[flang] Emit portability warning for assigned FORMAT use

Emit a portability warning about usage of a deprecated feature
when an I/O data transfer statement uses a scalar integer
variable as an assigned format.

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

19 months ago[flang] INTENT(IN) pointer may not be forwarded to INTENT(IN OUT) or (OUT) dummy
Peter Klausler [Mon, 14 Nov 2022 01:08:01 +0000 (17:08 -0800)]
[flang] INTENT(IN) pointer may not be forwarded to INTENT(IN OUT) or (OUT) dummy

19.6.8 forbids using an INTENT(IN) pointer dummy argument in a pointer association
context, and associated such a pointer with a dummy argument of INTENT(IN OUT) or
INTENT(OUT) is a circumstance that needs to be caught as an error.

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

19 months ago[MLIR] Simplify key construction/hashing in StorageUniquer
Joe Loser [Sat, 3 Dec 2022 05:18:24 +0000 (22:18 -0700)]
[MLIR] Simplify key construction/hashing in StorageUniquer

`getKey` and `getHash` use mutually exclusive overloads based on existence of
methods to determine how to compute get the key or hash, respectively.  This is
a bit verbose with `std::enable_if_t`.  Simplify it a bit by using
`if constexpr` directly.  As an added bonus, this is slightly quicker to
compile.

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

19 months ago[flang] Check constraint C1577 for statement functions
Peter Klausler [Thu, 10 Nov 2022 18:24:38 +0000 (10:24 -0800)]
[flang] Check constraint C1577 for statement functions

Check most of the requiremens of constraint C1577 for statement functions.
The restrictions that prevent recursion are hard errors; the others seem
to be benign legacies and are caught as portability warnings.

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

19 months agoRemove a useless temporary of a base class type.
Alexander Kornienko [Sat, 3 Dec 2022 22:58:37 +0000 (23:58 +0100)]
Remove a useless temporary of a base class type.

This was found by clang-tidy bugprone-undelegated-constructor check.
Was there since the very first commit back in 2016.

Reviewed By: clayborg, labath, srhines

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

19 months ago[flang] Don't repeat module procedure interface from ancestor in *.mod file
Peter Klausler [Thu, 1 Dec 2022 19:41:40 +0000 (11:41 -0800)]
[flang] Don't repeat module procedure interface from ancestor in *.mod file

When a submodule defines a module procedure whose interface was declared
in an ancestor (sub)module, don't repeat the definition of that interface
in the submodule's *.mod file output.

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

19 months ago[OpenMP][libomptarget] Simplify resource managers in NextGen plugins
Kevin Sala [Sun, 27 Nov 2022 22:12:41 +0000 (23:12 +0100)]
[OpenMP][libomptarget] Simplify resource managers in NextGen plugins

This patch removes the classes GenericStreamManagerTy and GenericEventManagerTy
from the PluginInterface header.

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

19 months ago[OpenMP][libomptarget] Improve NextGen plugin interface for initialization
Kevin Sala [Wed, 23 Nov 2022 23:24:12 +0000 (00:24 +0100)]
[OpenMP][libomptarget] Improve NextGen plugin interface for initialization

This patch modifies the PluginInterface to define functions for initializing
and deinitializing GenericPluginTy instances instead of using the constructor
and destructor. This way, we can return errors from these functions. Also, it
defines some functions that each plugin should implement for creating
plugin-specific objects.

This patch prepares the PluginInterface for the new AMDGPU NextGen plugin.

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

19 months agoIRBuilder: convert Optional to std::optional
Krzysztof Parzyszek [Sat, 3 Dec 2022 19:11:42 +0000 (13:11 -0600)]
IRBuilder: convert Optional to std::optional

19 months ago[OpenMP][libomptarget] Add minor fixes to NextGen plugins
Kevin Sala [Wed, 23 Nov 2022 22:27:53 +0000 (23:27 +0100)]
[OpenMP][libomptarget] Add minor fixes to NextGen plugins

List of fixes:
  - omptarget_device_environment symbol is not mandatory in device images
  - Do not synchronize in ~AsyncInfoWrapperTy() if the async info's queue is null
  - GenericDeviceResourceRef's create() and destroy() require the device as parameter

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

19 months ago[OpenMP][libomptarget] Allow overriding function that gets ELF symbol info
Kevin Sala [Wed, 23 Nov 2022 21:15:14 +0000 (22:15 +0100)]
[OpenMP][libomptarget] Allow overriding function that gets ELF symbol info

The OpenMP target's NextGen plugins retrieve symbol information in the ELF image
(i.e., address and size) through the ELF section and ELF symbol objects. However,
the images of CUDA programs compute the address differently from the images of
AMDGPU programs:

  - Address for CUDA symbols: image begin + section's offset + symbol's st_value
  - Address for AMDGPU symbols: image + begin + symbol's st_value

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

19 months ago[flang] Take character function length into account when testing compatibility
Peter Klausler [Wed, 9 Nov 2022 22:20:32 +0000 (14:20 -0800)]
[flang] Take character function length into account when testing compatibility

When a character-valued function is passed as an actual argument, and both
the actual function and the dummy argument have explicit result lengths, take them
into account when testing for compatibility.

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

19 months ago[gn build] Port 17db0de330f9
LLVM GN Syncbot [Sat, 3 Dec 2022 20:23:49 +0000 (20:23 +0000)]
[gn build] Port 17db0de330f9

19 months ago[COFF] llvm::Optional => std::optional
Fangrui Song [Sat, 3 Dec 2022 20:23:39 +0000 (20:23 +0000)]
[COFF] llvm::Optional => std::optional

19 months ago[Driver] llvm::Optional => std::optional
Fangrui Song [Sat, 3 Dec 2022 20:17:05 +0000 (20:17 +0000)]
[Driver] llvm::Optional => std::optional

and change a few referenced Basic and llvm/lib/WindowsDriver API

19 months agoReapply "[CodeGen] Add new pass for late cleanup of redundant definitions."
Jonas Paulsson [Thu, 1 Dec 2022 18:33:11 +0000 (19:33 +0100)]
Reapply "[CodeGen] Add new pass for late cleanup of redundant definitions."

Init captures added in processBlock() to avoid capturing structured bindings,
which caused the build problems (with clang).

RISCV has this disabled for now until problems relating to post RA pseudo
expansions are resolved.

19 months ago[flang] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 20:14:21 +0000 (12:14 -0800)]
[flang] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[clang/unittests] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 20:14:19 +0000 (12:14 -0800)]
[clang/unittests] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months agoFPEnv: convert Optional to std::optional
Krzysztof Parzyszek [Sat, 3 Dec 2022 19:54:35 +0000 (13:54 -0600)]
FPEnv: convert Optional to std::optional

19 months ago[clang-tools-extra] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 19:54:50 +0000 (11:54 -0800)]
[clang-tools-extra] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[clang-tidy] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 19:54:48 +0000 (11:54 -0800)]
[clang-tidy] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[clang] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 19:54:46 +0000 (11:54 -0800)]
[clang] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[Driver] llvm::None => std::nullopt. NFC
Fangrui Song [Sat, 3 Dec 2022 19:43:25 +0000 (19:43 +0000)]
[Driver] llvm::None => std::nullopt. NFC

19 months ago[Basic] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 19:34:27 +0000 (11:34 -0800)]
[Basic] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[Analysis] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 19:34:25 +0000 (11:34 -0800)]
[Analysis] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[StaticAnalyzer] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 19:34:24 +0000 (11:34 -0800)]
[StaticAnalyzer] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[flang] Disable flang/test/Semantics/resolve110.f90 on Windows
Peter Klausler [Sat, 3 Dec 2022 19:21:54 +0000 (11:21 -0800)]
[flang] Disable flang/test/Semantics/resolve110.f90 on Windows

This test crashes Semantics (infinite recursion?) only when built with MSVC;
need to investigate further, disabling test for now.

19 months ago[CodeGen] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 19:13:43 +0000 (11:13 -0800)]
[CodeGen] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[AST] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 19:13:41 +0000 (11:13 -0800)]
[AST] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[Sema] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 19:13:39 +0000 (11:13 -0800)]
[Sema] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[flang] Document and warn about an extension
Peter Klausler [Thu, 1 Dec 2022 18:13:57 +0000 (10:13 -0800)]
[flang] Document and warn about an extension

Standard Fortran allows type-bound procedure bindings to only
be called, and disallows them from being used in other contexts
where a procedure name can be: as the target of a procedure pointer
assignment statement, and as an actual argument that corresponds
to a dummy procedure.  So long as the interfaces match, there's
no good reason for these uses to be errors, and there some obvious
use cases in polymorphic programming.  So emit portability warnings
rather than errors, and document this usage as an extension.

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

19 months ago[lldb] Convert Optional<llvm::Reloc::Model> to std::optional
Fangrui Song [Sat, 3 Dec 2022 18:49:51 +0000 (18:49 +0000)]
[lldb] Convert Optional<llvm::Reloc::Model> to std::optional

19 months agoCodeGen/CommandFlags: Convert Optional to std::optional
Fangrui Song [Sat, 3 Dec 2022 18:38:12 +0000 (18:38 +0000)]
CodeGen/CommandFlags: Convert Optional to std::optional

19 months ago[flang] Enforce accessibility requirement on type-bound generic operators, &c.
Peter Klausler [Thu, 1 Dec 2022 01:40:48 +0000 (17:40 -0800)]
[flang] Enforce accessibility requirement on type-bound generic operators, &c.

Type-bound generics like operator(+) and assignment(=) need to not be
PRIVATE if they are used outside the module in which they are declared.

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

19 months ago[ELF] Add final to some SyntheticSection derived classes
Fangrui Song [Sat, 3 Dec 2022 18:11:34 +0000 (18:11 +0000)]
[ELF] Add final to some SyntheticSection derived classes

19 months agoConvert Optional<CodeModel> to std::optional<CodeModel>
Krzysztof Parzyszek [Sat, 3 Dec 2022 17:06:12 +0000 (11:06 -0600)]
Convert Optional<CodeModel> to std::optional<CodeModel>

19 months ago[ELF] Fix TimeTraceScope for "Finalize .eh_frame"
Fangrui Song [Sat, 3 Dec 2022 18:00:51 +0000 (18:00 +0000)]
[ELF] Fix TimeTraceScope for "Finalize .eh_frame"

19 months ago[flang] Warn on missing colons (C768)
Peter Klausler [Mon, 7 Nov 2022 23:51:03 +0000 (15:51 -0800)]
[flang] Warn on missing colons (C768)

In a derived type definition, a type bound procedure declaration
statement with neither interface nor attributes is required by constraint
C768 to have the optional "::" between the PROCEDURE keyword and the
bindings if any binding has a renaming with "=>".  The colons are
not actually necessary for a correct and unambiguous parse, so
emit a warning when they are missing.

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

19 months ago[AArch64] Enable the select optimize pass for AArch64
David Green [Sat, 3 Dec 2022 16:08:58 +0000 (16:08 +0000)]
[AArch64] Enable the select optimize pass for AArch64

This enabled the select optimize patch for ARM Out of order AArch64
cores. It is trying to solve a problem that is difficult for the
compiler to fix. The criteria for when a csel is better or worse than a
branch depends heavily on whether the branch is well predicted and the
amount of ILP in the loop (as well as other criteria like the core in
question and the relative performance of the branch predictor).  The
pass seems to do a decent job though, with the inner loop heuristics
being well implemented and doing a better job than I had expected in
general, even without PGO information.

I've been doing quite a bit of benchmarking. The headline numbers are
these for SPEC2017 on a Neoverse N1:
  500.perlbench_r   -0.12%
  502.gcc_r         0.02%
  505.mcf_r         6.02%
  520.omnetpp_r     0.32%
  523.xalancbmk_r   0.20%
  525.x264_r        0.02%
  531.deepsjeng_r   0.00%
  541.leela_r       -0.09%
  548.exchange2_r   0.00%
  557.xz_r          -0.20%

Running benchmarks with a combination of the llvm-test-suite plus
several versions of SPEC gave between a 0.2% and 0.4% geomean
improvement depending on the core/run. The instruction count went down
by 0.1% too, which is a good sign, but the results can be a little
noisy.  Some issues from other benchmarks I had ran were improved in
rGca78b5601466f8515f5f958ef8e63d787d9d812e. In summary well predicted
branches will see in improvement, badly predicted branches may get
worse, and on average performance seems to be a little better overall.

This patch enables the pass for AArch64 under -O3 for cores that will
benefit for it. i.e. not in-order cores that do not fit into the "Assume
infinite resources that allow to fully exploit the available
instruction-level parallelism" cost model. It uses a subtarget feature
for specifying when the pass will be enabled, which I have enabled under
cpu=generic as the performance increases for out of order cores seems
larger than any decreases for inorder, which were minor.

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

19 months ago[flang] Respect function vs subroutine distinction in generic matching
Peter Klausler [Sun, 6 Nov 2022 19:37:12 +0000 (11:37 -0800)]
[flang] Respect function vs subroutine distinction in generic matching

When checking the specific procedures of a generic interface for a
match against a given set of actual arguments, be sure to not match
a function against a subroutine call or vice versa.  (We generally
catch and warn about attempts to declare mixed interfaces, but they
are usually conforming and can be inadvertently created when generics
are merged due to USE and host association.)

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

19 months ago[clang][Windows]Ignore Options '/d1'
qfrost [Sat, 3 Dec 2022 14:30:13 +0000 (22:30 +0800)]
[clang][Windows]Ignore Options '/d1'

19 months ago[clang-format] Add .inc extension to git-clang-format
Alexandre Ganea [Sat, 3 Dec 2022 14:24:03 +0000 (09:24 -0500)]
[clang-format] Add .inc extension to git-clang-format

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

19 months agoRevert "[LoongArch] Use tablegen size for getInstSizeInBytes"
Nico Weber [Sat, 3 Dec 2022 13:02:41 +0000 (08:02 -0500)]
Revert "[LoongArch] Use tablegen size for getInstSizeInBytes"

This reverts commit d62480c1995b32eea8b9ed5a92829ee5615c4750.
Added test fails, see https://reviews.llvm.org/D138469#3968539

19 months ago[loongarch] fix syntax error in script
Nico Weber [Sat, 3 Dec 2022 12:49:41 +0000 (07:49 -0500)]
[loongarch] fix syntax error in script

At least on macOS with zsh, the test failed with

    line 1: syntax error near unexpected token `&'

previously.

19 months agoImprove type conversion error propagation/failure during LLVM lowering
Uday Bondhugula [Sat, 3 Dec 2022 10:59:07 +0000 (16:29 +0530)]
Improve type conversion error propagation/failure during LLVM lowering

Improve type conversion error propagation/failure during LLVM lowering.

BEFORE

```
llvm-mlir/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp:304: SmallVector<mlir::Type, 5> mlir::LLVMTypeConverter::getMemRefDescriptorFields(mlir::MemRefType, bool): Assertion `isStrided(type) && "Non-strided layout maps must have been normalized away"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
...
```

AFTER
```
<unknown>:0: error: integer overflow during size computation
<unknown>:0: error: Conversion to strided form failed either due to non-strided layout maps (which should have been normalized away) or other reasons
<unknown>:0: error: failed to legalize operation 'gpu.func' that was explicitly marked illegal
<unknown>:0: note: see current operation:
"gpu.func"() ( {
...
```

Reviewed By: ftynse

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

19 months ago[AArch64] Make ArchInfo copyable again
Benjamin Kramer [Sat, 3 Dec 2022 10:47:50 +0000 (11:47 +0100)]
[AArch64] Make ArchInfo copyable again

I don't see the point of disallowing copying an aggregate, and C++20
makes aggregate initializing a class with a deleted copy ctor
ill-formed.

19 months agomlir/TosaToTensor: fix typos in test
Ramkumar Ramachandra [Thu, 1 Dec 2022 09:45:34 +0000 (10:45 +0100)]
mlir/TosaToTensor: fix typos in test

This patch fixes a misspelt CHECK-LABEL in tosa-to-tensor.mlir.

Signed-off-by: Ramkumar Ramachandra <r@artagnon.com>
Differential Revision: https://reviews.llvm.org/D139085

19 months agomlir/linalg: improve debugging in LinalgTransformOps
Ramkumar Ramachandra [Fri, 2 Dec 2022 11:29:58 +0000 (12:29 +0100)]
mlir/linalg: improve debugging in LinalgTransformOps

Make use of notifyMatchFailure in one place.

Signed-off-by: Ramkumar Ramachandra <r@artagnon.com>
Differential Revision: https://reviews.llvm.org/D139191

19 months ago.mailmap: add entry for myself
Ramkumar Ramachandra [Sat, 3 Dec 2022 08:52:57 +0000 (09:52 +0100)]
.mailmap: add entry for myself

19 months ago[clang-repl] Fix ambiguous initializer list.
Vassil Vassilev [Sat, 3 Dec 2022 08:05:39 +0000 (08:05 +0000)]
[clang-repl] Fix ambiguous initializer list.

Some platforms report that GlobalTopLevelStmtBlockInFlight cannot be initalized
with '{}' due to operator '=' being ambiguous.

This patch is a follow up to https://reviews.llvm.org/D127284 trying to appease
the bots.

19 months ago[clang][modules] Serialize the new RecordID
Jan Svoboda [Sat, 3 Dec 2022 07:22:18 +0000 (23:22 -0800)]
[clang][modules] Serialize the new RecordID

This is a follow-up to commit 40472ef14cd3bbed665789825b47d055e0a83402 that introduced new record but didn't serialize its ID.

19 months ago[clang-repl] Support statements on global scope in incremental mode.
Vassil Vassilev [Wed, 8 Jun 2022 09:59:40 +0000 (09:59 +0000)]
[clang-repl] Support statements on global scope in incremental mode.

This patch teaches clang to parse statements on the global scope to allow:
```
./bin/clang-repl
clang-repl> int i = 12;
clang-repl> ++i;
clang-repl> extern "C" int printf(const char*,...);
clang-repl> printf("%d\n", i);
13
clang-repl> %quit
```

Generally, disambiguating between statements and declarations is a non-trivial
task for a C++ parser. The challenge is to allow both standard C++ to be
translated as if this patch does not exist and in the cases where the user typed
a statement to be executed as if it were in a function body.

Clang's Parser does pretty well in disambiguating between declarations and
expressions. We have added DisambiguatingWithExpression flag which allows us to
preserve the existing and optimized behavior where needed and implement the
extra rules for disambiguating. Only few cases require additional attention:
  * Constructors/destructors -- Parser::isConstructorDeclarator was used in to
    disambiguate between ctor-looking declarations and statements on the global
    scope(eg. `Ns::f()`).
  * The template keyword -- the template keyword can appear in both declarations
    and statements. This patch considers the template keyword to be a declaration
    starter which breaks a few cases in incremental mode which will be tackled
    later.
  * The inline (and similar) keyword -- looking at the first token in many cases
    allows us to classify what is a declaration.
  * Other language keywords and specifiers -- ObjC/ObjC++/OpenCL/OpenMP rely on
    pragmas or special tokens which will be handled in subsequent patches.

The patch conceptually models a "top-level" statement into a TopLevelStmtDecl.
The TopLevelStmtDecl is lowered into a void function with no arguments.
We attach this function to the global initializer list to execute the statement
blocks in the correct order.

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

19 months ago[BOLT] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 07:12:38 +0000 (23:12 -0800)]
[BOLT] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[lld] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 07:12:36 +0000 (23:12 -0800)]
[lld] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months agoRevert "[llvm-objcopy] Fix --section-add when section contain empty bytes"
Douglas Yung [Sat, 3 Dec 2022 06:40:32 +0000 (22:40 -0800)]
Revert "[llvm-objcopy] Fix --section-add when section contain empty bytes"

This reverts commit 0041382198f20fe51d8574363bc91c317c7f3c71.

The test added is failing on Windows:
  - https://lab.llvm.org/buildbot/#/builders/216/builds/13762
  - https://lab.llvm.org/buildbot/#/builders/123/builds/14447

19 months ago[llvm/unittests] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 06:10:37 +0000 (22:10 -0800)]
[llvm/unittests] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[mlir][spirv] Clean up test-availability pass. NFC.
Jakub Kuderski [Sat, 3 Dec 2022 05:23:40 +0000 (00:23 -0500)]
[mlir][spirv] Clean up test-availability pass. NFC.

Define rewrite patterns in-line so that we don't have to jump around so
much when editing this file.

Reviewed By: antiagainst

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

19 months ago[llvm] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 05:11:44 +0000 (21:11 -0800)]
[llvm] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[utils] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 05:11:42 +0000 (21:11 -0800)]
[utils] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from
llvm::Optional to std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[tools] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 05:11:40 +0000 (21:11 -0800)]
[tools] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[DebugInfo] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 05:11:39 +0000 (21:11 -0800)]
[DebugInfo] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[Transforms] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 05:11:37 +0000 (21:11 -0800)]
[Transforms] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[CodeGen] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 04:36:08 +0000 (20:36 -0800)]
[CodeGen] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[Target] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 04:36:06 +0000 (20:36 -0800)]
[Target] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[Bitcode] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 04:36:04 +0000 (20:36 -0800)]
[Bitcode] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[IR] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 04:05:20 +0000 (20:05 -0800)]
[IR] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[Analysis] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 03:43:04 +0000 (19:43 -0800)]
[Analysis] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

19 months ago[ADT, Support] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 03:04:57 +0000 (19:04 -0800)]
[ADT, Support] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

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