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
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
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
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
Krzysztof Parzyszek [Sat, 3 Dec 2022 19:11:42 +0000 (13:11 -0600)]
IRBuilder: convert Optional to std::optional
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
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
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
LLVM GN Syncbot [Sat, 3 Dec 2022 20:23:49 +0000 (20:23 +0000)]
[gn build] Port
17db0de330f9
Fangrui Song [Sat, 3 Dec 2022 20:23:39 +0000 (20:23 +0000)]
[COFF] 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
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.
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
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
Krzysztof Parzyszek [Sat, 3 Dec 2022 19:54:35 +0000 (13:54 -0600)]
FPEnv: convert Optional to std::optional
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
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
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
Fangrui Song [Sat, 3 Dec 2022 19:43:25 +0000 (19:43 +0000)]
[Driver] llvm::None => std::nullopt. 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
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
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
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.
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
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
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
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
Fangrui Song [Sat, 3 Dec 2022 18:49:51 +0000 (18:49 +0000)]
[lldb] Convert Optional<llvm::Reloc::Model> to std::optional
Fangrui Song [Sat, 3 Dec 2022 18:38:12 +0000 (18:38 +0000)]
CodeGen/CommandFlags: Convert Optional to std::optional
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
Fangrui Song [Sat, 3 Dec 2022 18:11:34 +0000 (18:11 +0000)]
[ELF] Add final to some SyntheticSection derived classes
Krzysztof Parzyszek [Sat, 3 Dec 2022 17:06:12 +0000 (11:06 -0600)]
Convert Optional<CodeModel> to std::optional<CodeModel>
Fangrui Song [Sat, 3 Dec 2022 18:00:51 +0000 (18:00 +0000)]
[ELF] Fix TimeTraceScope for "Finalize .eh_frame"
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
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
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
qfrost [Sat, 3 Dec 2022 14:30:13 +0000 (22:30 +0800)]
[clang][Windows]Ignore Options '/d1'
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
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
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.
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
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.
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
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
Ramkumar Ramachandra [Sat, 3 Dec 2022 08:52:57 +0000 (09:52 +0100)]
.mailmap: add entry for myself
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.
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.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Xiaodong Liu [Sat, 3 Dec 2022 03:00:18 +0000 (11:00 +0800)]
[LoongArch] Use tablegen size for getInstSizeInBytes
Correct the pseudo atomic instruction size for branch
relaxation and branch folding passes.
Inspired by D118175, D118009 and D117970.
Depends on D138481
Reviewed By: SixWeining, gonglingqin, xen0n
Differential Revision: https://reviews.llvm.org/D138469
Kazu Hirata [Sat, 3 Dec 2022 02:53:00 +0000 (18:53 -0800)]
[llvm] Add support for hashing std::optional
The credit for the hashing code, taken from D138934, goes to Ramkumar
Ramachandra. The test comes from OptionalTest.cpp and updated for
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/D139240
Peter Klausler [Fri, 4 Nov 2022 23:39:52 +0000 (16:39 -0700)]
[flang] Warn about more continuation lines than the standard permits
f18 doesn't have any limit on continuation lines in fixed or free form
source (other than available memory), but the standard does. Emit
a portability warning when it is exceeded.
Differential Revision: https://reviews.llvm.org/D139055
Guilhem [Sat, 3 Dec 2022 00:48:27 +0000 (16:48 -0800)]
[llvm-objcopy] Fix --section-add when section contain empty bytes
Implicit cast between char* and StringRef when writing sections.
Reproduce:
```
$> llvm-objcopy --dump-section=name=name.data out.wasm
$> llvm-objcopy --remove-section=name out.wasm out_no_name.wasm
$> llvm-objcopy --add-section=name=name.data out_no_name.wasm out_new_name.wasm
# With wasm-objdump -h we can see that the name section is not totally copied in the new wasm file (if it actually contain empty bytes)
```
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D139210
Kazu Hirata [Sat, 3 Dec 2022 00:25:07 +0000 (16:25 -0800)]
[mlir] Fix an unused variable warning
This patch fixes:
mlir/lib/ExecutionEngine/SparseTensorRuntime.cpp:646:18: error:
unused variable 'dimRank' [-Werror,-Wunused-variable]
Peter Klausler [Sat, 3 Dec 2022 00:13:09 +0000 (16:13 -0800)]
[flang][examples] Fix build of flang/examples/FlangOmpReport/FlangOmpReportVisitor.cpp (take 2)
Need to add casts to std::string.
Jan Svoboda [Fri, 2 Dec 2022 23:52:21 +0000 (15:52 -0800)]
[clang][modules][deps] Serialize inputs into PCMs using the "as requested" name
This patch changes the PCM serialization logic to refer to input files by their "requested" name. This fixes a bug where the dependency scanner reports the "final" file paths, which can result in failed explicit compiles due to the `module.modulemap` file not being surrounded by the expected framework directory structure.
Depends on D135634.
Reviewed By: benlangmuir, Bigcheese
Differential Revision: https://reviews.llvm.org/D135636
Jan Svoboda [Fri, 2 Dec 2022 23:43:48 +0000 (15:43 -0800)]
[clang][modules] Serialize VFS overlay paths into PCMs
With implicitly built modules, the importing `CompilerInstance` assumes PCMs were built in a "compatible way" (i.e. with similarly set up instance). Either because their context hash matches, or because this instance has just built them.
There are some use-cases, however, where this assumption doesn't hold, libclang/c-index-test being one of them. There, the importing instance (or `ASTUnit`) is being set up while the PCM file is being deserialized. Until now, we've assumed the serialized paths to input files are the actual on-disk files, meaning the default physical VFS was always able to resolve them. This won't be the case after D135636. Therefore, this patch makes sure `ASTUnit` is initialized with the same VFS as the PCM it's deserializing - by storing paths to the VFS overlay files into the PCM itself.
For the VFS overlay files to be adopted at the very start of PCM deserialization, they are stored in a new section in the unhashed control block, together with header search paths and system header prefixes. The move to the unhashed control block should be safe: if two modules were built with different header search paths and they produced different results, the hashed part of the PCM file will reflect that.
Reviewed By: akyrtzi, benlangmuir
Differential Revision: https://reviews.llvm.org/D135634
Peter Klausler [Wed, 30 Nov 2022 23:20:49 +0000 (15:20 -0800)]
[flang] Enforce more restrictions on I/O data list items
12.6.3p5 requires an I/O data list item to have a defined I/O procedure
if it is polymorphic. (We could defer this checking to the runtime,
but no other Fortran compiler does so, and we would also have to be
able to catch the case of an allocatable or pointer direct component
in the absence of a defined I/O subroutine.)
Also includes a patch to name resolution that ensures that a
SELECT TYPE construct entity is polymorphic in the domain of a
CLASS IS guard.
Also ensures that non-defined I/O of types with PRIVATE components
is caught.
Differential Revision: https://reviews.llvm.org/D139050
Vasileios Porpodas [Fri, 2 Dec 2022 23:03:38 +0000 (15:03 -0800)]
[NFC] Cleanup: Replace BB->InstList.splice() with BB->splice()
Differential Revision: https://reviews.llvm.org/D139236
chenglin.bi [Fri, 2 Dec 2022 23:54:49 +0000 (07:54 +0800)]
[InstCombine] fold icmp + select pattern by distributive laws
`C ? (Y != X) : (Z != X) --> (C ? Y : Z) != X`
`C ? (Y == X) : (Z == X) --> (C ? Y : Z) == X`
https://alive2.llvm.org/ce/z/-frXfs
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D139076
Matt Arsenault [Fri, 2 Dec 2022 22:25:57 +0000 (17:25 -0500)]
Analysis: Update some tests for opaque pointers
StackSafetyAnalysis/lifetime.ll had one bitcast removed that may have
mattered. The concluded lifetime is longer based on the underlying
alloca, instead of the bitcasted pointer so left that as a pointless
cast.
local.ll memintrin.ll needed some manual fixes
Matt Arsenault [Fri, 2 Dec 2022 22:28:07 +0000 (17:28 -0500)]
StackSafetyAnalysis: Don't use anonymous values in test
Matt Arsenault [Thu, 1 Dec 2022 14:42:20 +0000 (09:42 -0500)]
APFloat: Simplify makeSmallestNormalized implementation
Jan Svoboda [Fri, 2 Dec 2022 21:36:04 +0000 (13:36 -0800)]
Use CTAD on llvm::SaveAndRestore
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D139229
Peter Klausler [Fri, 4 Nov 2022 21:29:49 +0000 (14:29 -0700)]
[flang] Enforce restrictions on intrinsic assignment
When the left-hand side of an intrinsic assignment statement is
polymorphic, the LHS must be a whole allocatable variable or
component and may not be a coarray (10.2.2.1p1(1)).
Differential Revision: https://reviews.llvm.org/D139049
Tue Ly [Fri, 2 Dec 2022 23:12:17 +0000 (18:12 -0500)]
[libc][Obvious] Update error bounds for uint_test.QuickMulHiTests.
Bill Wendling [Fri, 2 Dec 2022 23:03:41 +0000 (15:03 -0800)]
[NFC] Remove unneeded #include files.
Peiming Liu [Fri, 2 Dec 2022 23:00:52 +0000 (23:00 +0000)]
[mlir][sparse][bufferization] cleanup bufferization attributes after SparsificationAndBufferizationPass
Reviewed By: aartbik, springerm
Differential Revision: https://reviews.llvm.org/D139218
Tue Ly [Wed, 23 Nov 2022 04:39:17 +0000 (23:39 -0500)]
[libc][math] Implement full multiplication and quick_mul_hi for UInt class.
Implement full multiplication `UInt<A> * UInt<B> -> UInt<A + B>` and
`quick_mul_hi` that returns the higher half of the product `UInt<A> * UInt<A>`.
These 2 functions will be used for dyadic floating point class.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D138541
Jason Molenda [Fri, 2 Dec 2022 22:39:41 +0000 (14:39 -0800)]
Leave DW_OP_addr addresses as load addresses in DWARFExpression
DWARFExpression::Evaluate will convert DW_OP_addr addresses in
a DWARF expression into load addresses on the expression stack
when there is a StackFrame in the ExecutionContext, this from
a change in 2018 in https://reviews.llvm.org/D46362. At the
time this was handling a case that came up in swift programs,
and is no longer necessary. I generalized this conversion to
a load address when a Target is available in
https://reviews.llvm.org/D137682 to make a test case possible;
this change broke a use case that Ted reported.
This change removes my test case, and removes this conversion
of a DW_OP_addr into a load address in some instances.
Differential Revision: https://reviews.llvm.org/D139226
Joseph Huber [Fri, 2 Dec 2022 19:30:35 +0000 (13:30 -0600)]
[libc] Skip tests that depend on undefined targets
When we search through the dependencies for a test we somtimes query
`get_target_property` on a target that has not been defined. This is the
case for targets that have minimal entrypoints defined such as the WIP
GPU target. This patch changes all tests whose dependencies are
undefined to be skipped entirely.
Reviewed By: sivachandra, lntue, michaelrj
Differential Revision: https://reviews.llvm.org/D139216
Peter Klausler [Thu, 3 Nov 2022 23:17:00 +0000 (16:17 -0700)]
[flang] Disallow NULL() as an expression where it cannot appear
A NULL() pointer is generally not a valid expression (as opposed to
a variable) apart from some initialization contexts and some actual
arguments.
Differential Revision: https://reviews.llvm.org/D139047
Volodymyr Sapsai [Fri, 2 Dec 2022 22:30:41 +0000 (14:30 -0800)]
Reland "[clang][deps] During scanning don't emit warnings-as-errors that are ignored with diagnostic pragmas."
This reverts commit
2f8ac1804827026b44f429dce02730da18a73c50.
After committing a fix for previous buildbot failures in D138970,
re-landing the original change.
Kazu Hirata [Fri, 2 Dec 2022 22:25:13 +0000 (14:25 -0800)]
[ModuleInliner] Add MLPriority
This patch adds MLPriority as the first step toward the ML-based
function inlining with the module inliner.
For now, MLPriority is completely identical to CostPriority.
Once this patch lands, I'm planning to:
- integrate NoInferenceModelRunner,
- memoize the priority computation so that the priority remains the
same for given values of metrics even with the noise injected during
training, and
- port/take more features into account.
Differential Revision: https://reviews.llvm.org/D139140
Matt Arsenault [Fri, 2 Dec 2022 21:45:18 +0000 (16:45 -0500)]
Fix some test files with executable permissions
Peter Klausler [Wed, 2 Nov 2022 22:32:17 +0000 (15:32 -0700)]
[flang] Change error to portability warning
The standard does *not* require that a real or imaginary part of a complex
literal constant be a scalar if it is a named constant. Downgrade a
recently installed check to a portability warning, and document it.
Differential Revision: https://reviews.llvm.org/D139046
River Riddle [Mon, 7 Nov 2022 23:35:43 +0000 (15:35 -0800)]
[mlir][docs] Group the docs for defining dialect components
This moves the documentation for defining dialects, attributes/types,
and operations into a new `DefiningDialects` folder. This helps to
keep the documentation grouped together, making it easier to find
related documentation.
Differential Revision: https://reviews.llvm.org/D137594
Kazu Hirata [Fri, 2 Dec 2022 21:37:57 +0000 (13:37 -0800)]
[Inline] Add a basic test for the module inliner
The new test ensures that the module inliner works with all currently
supported priority modes.
Different priority modes result in no difference in terms of the
output for these simple cases, so this is more of a "better than
nothing" test.
Differential Revision: https://reviews.llvm.org/D139222
River Riddle [Wed, 26 Oct 2022 01:29:53 +0000 (18:29 -0700)]
[mlir] Remove support for non-prefixed accessors
This finishes off a year long pursuit to LLVMify the generated
operation accessors, prefixing them with get/set. Support for
any other accessor naming is fully removed after this commit.
https://discourse.llvm.org/t/psa-raw-accessors-are-being-removed/65629
Differential Revision: https://reviews.llvm.org/D136727
Krzysztof Parzyszek [Fri, 2 Dec 2022 21:30:14 +0000 (13:30 -0800)]
[Hexagon] Remove most Optionals in favor of std::optional
Kazu Hirata [Fri, 2 Dec 2022 21:31:13 +0000 (13:31 -0800)]
[ModuleInliner] Initialize variables (NFC)
This patch initializes all class variables in InlineOrder.cpp for
safety just in case we miss them in constructors. Currently, all
these variables are properly initialized in their respective
constructors.
Differential Revision: https://reviews.llvm.org/D139225
Hanhan Wang [Fri, 2 Dec 2022 01:04:09 +0000 (17:04 -0800)]
[mlir] Factor more common utils to IndexingUtils
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D139159
Matt Arsenault [Fri, 2 Dec 2022 20:45:38 +0000 (15:45 -0500)]
AArch64/GlobalISel: Convert tests to opaque pointers
inttoptr_add.ll had a mangled bitcast constantexpr.
translate-gep.ll: Restored a 0 GEP
Matt Arsenault [Fri, 2 Dec 2022 20:46:37 +0000 (15:46 -0500)]
GlobalISel: Replace bitcast test pointer usage
This won't be meaningful with opaque pointers (I guess we could leave
a ptr to ptr bitcast, or allow same sized address space bitcasts).
Matt Arsenault [Fri, 2 Dec 2022 20:39:59 +0000 (15:39 -0500)]
AArch64/GlobalISel: Regenerate test checks
Try to shrink the diff in the opaque pointer conversion. Had to work
around some update_mir_test_checks bugs. It seems to struggle when the
successor list is empty around the blank line checks it inserts.