Lang Hames [Tue, 19 Oct 2021 05:11:16 +0000 (22:11 -0700)]
[ORC-RT] Avoid switching out-of-band error value into __orc_rt::Error and back.
WrapperFunctionResult can already convey serialization errors as out-of-band
error values, so there's no need to wrap it in an Expected here. Removing the
wrapper simplifies the plumbing and call sites.
Zhi An Ng [Wed, 20 Oct 2021 00:53:04 +0000 (17:53 -0700)]
[WebAssembly] Add prototype relaxed swizzle instructions
Add i8x16 relaxed_swizzle instructions. These are only
exposed as builtins, and require user opt-in.
Differential Revision: https://reviews.llvm.org/D112022
Shafik Yaghmour [Tue, 19 Oct 2021 23:52:36 +0000 (16:52 -0700)]
[LLDB][NFC] Remove parameter names from forward declarations from hand written expressions used in heap.py part 2
heap.py has a lot of large hand written expressions and each name in the
expression will be looked up by clang during expression parsing. For
function parameters this will be in Sema::ActOnParamDeclarator(...) in order to
catch redeclarations of parameters. The names are not needed and we have seen
some rare cases where since we don't have symbols we end up in
SymbolContext::FindBestGlobalDataSymbol(...) which may conflict with other global
symbols.
There may be a way to make this lookup smarter to avoid these cases but it is
not clear how well tested this path is and how much work it would be to fix it.
So we will go with this fix while we investigate more.
This is a second try at getting all the cases we care about.
Ref: rdar://
78265641
Yonghong Song [Tue, 19 Oct 2021 22:29:12 +0000 (15:29 -0700)]
BPF: set .BTF and .BTF.ext section alignment to 4
Currently, .BTF and .BTF.ext has default alignment of 1.
For example,
$ cat t.c
int foo() { return 0; }
$ clang -target bpf -O2 -c -g t.c
$ llvm-readelf -S t.o
...
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
...
[ 7] .BTF PROGBITS
0000000000000000 000167 00008b 00 0 0 1
[ 8] .BTF.ext PROGBITS
0000000000000000 0001f2 000050 00 0 0 1
But to have no misaligned data access, .BTF and .BTF.ext
actually requires alignment of 4. Misalignment is not an issue
for architecture like x64/arm64 as it can handle it well. But
some architectures like mips may incur a trap if .BTF/.BTF.ext
is not properly aligned.
This patch explicitly forced .BTF and .BTF.ext alignment to be 4.
For the above example, we will have
[ 7] .BTF PROGBITS
0000000000000000 000168 00008b 00 0 0 4
[ 8] .BTF.ext PROGBITS
0000000000000000 0001f4 000050 00 0 0 4
Differential Revision: https://reviews.llvm.org/D112106
Artem Belevich [Fri, 8 Oct 2021 23:16:25 +0000 (16:16 -0700)]
[NVPTX] Add a late SROA pass which allows optimizing away more allocas.
Fixes performance regression https://bugs.llvm.org/show_bug.cgi?id=52037
Differential Revision: https://reviews.llvm.org/D111471
Stella Laurenzo [Tue, 19 Oct 2021 19:22:56 +0000 (12:22 -0700)]
Add MLIR_INSTALL_AGGREGATE_OBJECTS and default it to ON.
* Package maintainers can opt to disable installation of these objects.
* Per discussion on https://reviews.llvm.org/D111504
Differential Revision: https://reviews.llvm.org/D112090
Kojo Acquah [Tue, 19 Oct 2021 22:49:49 +0000 (15:49 -0700)]
Implementation of `ReshapeNoopOptimization` canonicalizer.
This canonicalizer replaces reshapes of constant tensors that contain the updated shape (skipping the reshape operation).
Differential Revision: https://reviews.llvm.org/D112038
Yuta Saito [Tue, 19 Oct 2021 22:42:00 +0000 (15:42 -0700)]
[WebAssembly] Emit clangast in custom section aligned by 4 bytes
Emit __clangast in custom section instead of named data segment
to find it while iterating sections.
This could be avoided if all data segements (the wasm sense) were
represented as their own sections (in the llvm sense).
This can be resolved by https://github.com/WebAssembly/tool-conventions/issues/138
And the on-disk hashtable in clangast needs to be aligned by 4 bytes,
so add paddings in name length field in custom section header.
The length of clangast section name can be represented in 1 byte
by leb128, and possible maximum pads are 3 bytes, so the section
name length won't be invalid in theory.
Fixes https://bugs.llvm.org/show_bug.cgi?id=35928
Differential Revision: https://reviews.llvm.org/D74531
Arthur Eubanks [Wed, 13 Oct 2021 23:00:00 +0000 (16:00 -0700)]
[llvm-reduce] Add reduction passes to reduce operands to undef/1/0
Having non-undef constants in a final llvm-reduce output is nicer than
having undefs.
This splits the existing reduce-operands pass into three, one which does
the same as the current pass of reducing to undef, and two more to
reduce to the constant 1 and the constant 0. Do not reduce to undef if
the operand is a ConstantData, and do not reduce 0s to 1s.
Reducing GEP operands very frequently causes invalid IR (since types may
not match up if we index differently into a struct), so don't touch GEPs.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D111765
Fangrui Song [Tue, 19 Oct 2021 22:24:07 +0000 (15:24 -0700)]
[Driver][Gnu] Delete unneeded -Bstatic dispatch for arm/thumb
Historically -static and -Bstatic are synonym.
gold made the semantics of -static slightly stronger but that does not matter.
Sanjay Patel [Tue, 19 Oct 2021 21:12:02 +0000 (17:12 -0400)]
[x86] add special-case lowering for usubsat for pre-SSE4
usubsat X, SMIN --> (X ^ SMIN) & (X s>> BW-1)
This would be a regression with D112085 where we combine to
usubsat more aggressively, so avoid that by matching the
special-case where we are subtracting SMIN (signmask):
https://alive2.llvm.org/ce/z/4_3gBD
Differential Revision: https://reviews.llvm.org/D112095
Keith Smiley [Wed, 6 Oct 2021 19:43:40 +0000 (19:43 +0000)]
[clang][Driver] Make multiarch output file basenames reproducible
When building a multiarch MachO binary, previously the intermediate
output file names would contain random characters. On macOS this
filename, since it's used when linking, ended up being used as a
stable-ish identifier for the adhoc codesignature of the binary, leading
to non-reproducible binaries. This change uses the architecture, when
available, to create a stable, but unique, basename for the file.
Differential Revision: https://reviews.llvm.org/D111269
Sanjay Patel [Tue, 19 Oct 2021 17:58:06 +0000 (13:58 -0400)]
[x86] add tests for psubus; NFC
Valentin Clement [Tue, 19 Oct 2021 20:22:17 +0000 (22:22 +0200)]
[fir] Add character utility functions in FIRBuilder
Extract part of D111337 in order to mke it smaller
and easier to review. This patch add some utility
functions to the FIRBuilder.
Add the following utility functions:
- getCharacterLengthType
- createStringLiteral
- locationToFilename
- characterWithDynamicLen
- sequenceWithNonConstantShape
- hasDynamicSize
These bring up the BoxValue implementation together with it.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: AlexisPerry
Differential Revision: https://reviews.llvm.org/D112074
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Volodymyr Sapsai [Wed, 6 Oct 2021 02:37:32 +0000 (19:37 -0700)]
[driver] Explicitly specify `-fbuild-session-timestamp` in seconds.
Representation of the file's last modification time depends on the file
system and isn't guaranteed to be in seconds. Cast to seconds explicitly
and tighten the test case to check the magnitude of the calculated
value, so we can catch passing milliseconds or nanoseconds.
rdar://
83915615
Differential Revision: https://reviews.llvm.org/D111205
Vedant Kumar [Mon, 18 Oct 2021 21:39:10 +0000 (14:39 -0700)]
[lldb/test] Update test/API/functionalities/load_lazy to macOS 12
In macOS 12, dyld switched to using chained fixups. As a result, all symbols
are bound at launch and there are no lazy pointers any more. Since we wish to
import/dlopen() a dylib with missing symbols, we need to use a weak import.
This applies to all macOS 12-aligned OS releases, e.g. iOS 15, etc.
rdar://
81295101
Differential Revision: https://reviews.llvm.org/D112034
Michael Liao [Wed, 6 Oct 2021 20:02:41 +0000 (16:02 -0400)]
[cuda] Add address space predicate funuctions.
- Add the missing NVVM predicate builtins on address space checking
- Redefine them as pure functions so that they could be used in
__builtin_assume.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D112053
Lawrence D'Anna [Tue, 19 Oct 2021 20:08:13 +0000 (13:08 -0700)]
[lldb] improve the help strings for gdb-remote and kdp-remote
The help string can be more helpful by explaining these are
aliases for 'process connect'
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D111965
Bjorn Pettersson [Tue, 19 Oct 2021 19:43:50 +0000 (21:43 +0200)]
[SCEV] Fix formatting error introduced by D112080
Accidentally pushed D112080 without this clang-format cleanup.
Zequan Wu [Tue, 19 Oct 2021 19:38:05 +0000 (12:38 -0700)]
Revert "Reland [clang] Pass -clear-ast-before-backend in Clang::ConstructJob()"
This reverts commit
1fb24fe85a19ae71b00875ff6c96ef1831dcf7e3.
This causes clang crash on chromium. See repro at https://bugs.chromium.org/p/chromium/issues/detail?id=1261551#c1.
Bjorn Pettersson [Tue, 19 Oct 2021 15:05:11 +0000 (17:05 +0200)]
[SCEV] Avoid compile time explosion in ScalarEvolution::isImpliedCond
As seen in PR51869 the ScalarEvolution::isImpliedCond function might
end up spending lots of time when doing the isKnownPredicate checks.
Calling isKnownPredicate for example result in isKnownViaInduction
being called, which might result in isLoopBackedgeGuardedByCond being
called, and then we might get one or more new calls to isImpliedCond.
Even if the scenario described here isn't an infinite loop, using
some random generated C programs as input indicates that those
isKnownPredicate checks quite often returns true. On the other hand,
the third condition that needs to be fulfilled in order to "prove
implications via truncation", i.e. the isImpliedCondBalancedTypes
check, is rarely fulfilled.
I also made some similar experiments to look at how often we would
get the same result when using isKnownViaNonRecursiveReasoning instead
of isKnownPredicate. So far I haven't seen a single case when codegen
is negatively impacted by using isKnownViaNonRecursiveReasoning. On
the other hand, it seems like we get rid of the compile time explosion
seen in PR51869 that way. Hence this patch.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D112080
Philip Reames [Tue, 19 Oct 2021 19:12:19 +0000 (12:12 -0700)]
Extend transform introduced in D111896 to multiple exits
This is trivial. It was left out of the original review only because we had multiple copies of the same code in review at the same time, and keeping them in sync was easiest if the structure was kept in sync.
Philip Reames [Tue, 19 Oct 2021 18:47:15 +0000 (11:47 -0700)]
[indvars] Canonicalize exit conditions to unsigned using range info
This patch duplicates a bit of logic we apply to comparisons encountered during the IV users walk to conditions which feed exit conditions. Why? simplifyAndExtend has a very limited list of users it walks. In particular, in the examples is stops at the zext and never visits the icmp. (Because we can't fold the zext to an addrec yet in SCEV.) Being willing to visit when we haven't simplified regresses multiple tests (seemingly because of less optimal results when computing trip counts).
Note that this can be trivially extended to multiple exiting blocks. I'm leaving that to a future patch (solely to cut down on the number of versions of the same code in review at once.)
Differential Revision: https://reviews.llvm.org/D111896
Craig Topper [Tue, 19 Oct 2021 18:37:36 +0000 (11:37 -0700)]
[RISCV] Use llvm::stable_sort instead of std::stable_sort. NFC
Anna Thomas [Tue, 12 Oct 2021 19:04:26 +0000 (15:04 -0400)]
[LoopPredication] Calculate profitability without BPI
Using BPI within loop predication is non-trivial because BPI is only
preserved lossily in loop pass manager (one fix exposed by lossy
preservation is up for review at D111448). However, since loop
predication is only used in downstream pipelines, it is hard to keep BPI
from breaking for incomplete state with upstream changes in BPI.
Also, correctly preserving BPI for all loop passes is a non-trivial
undertaking (D110438 does this lossily), while the benefit of using it
in loop predication isn't clear.
In this patch, we rely on profile metadata to get almost similar benefit as
BPI, without actually using the complete heuristics provided by BPI.
This avoids the compile time explosion we tried to fix with D110438 and
also avoids fragile bugs because BPI can be lossy in loop passes
(D111448).
Reviewed-By: asbirlea, apilipenko
Differential Revision: https://reviews.llvm.org/D111668
Joe Loser [Tue, 19 Oct 2021 18:21:25 +0000 (14:21 -0400)]
[libc++] Make __weekday_from_days private in weekday
`weekday` has a static member function `__weekday_from_days` which is
not part of the mandated public interface of `weeekday` according to the
standard. Since it is only used internally in the constructors of
`weekday`, let's make it private.
Reviewed By: ldionne, Mordante, #libc
Differential Revision: https://reviews.llvm.org/D112072
Joe Loser [Tue, 19 Oct 2021 18:18:36 +0000 (14:18 -0400)]
[libc++][NFC] Mark LWG3573 as complete
Mark LWG3573 as complete. It involves a change in wording around when
`basic_string_view`'s constructor for iterator/sentinel can throw. The
current implementation is not marked conditionally `noexcept`, so there
is nothing to do here. Add a test that binds this behavior to verify the
constructor is not marked `noexcept(true)` when `end - begin` throws.
Reviewed By: ldionne, Mordante, #libc
Differential Revision: https://reviews.llvm.org/D111925
Louis Dionne [Tue, 19 Oct 2021 17:16:24 +0000 (13:16 -0400)]
[runtimes] Trigger CI on changes to libunwind
Mehdi Amini [Tue, 19 Oct 2021 17:13:54 +0000 (17:13 +0000)]
Fix clang-tidy warnings in MLIR Python bindings (NFC)
Sanjay Patel [Tue, 19 Oct 2021 16:13:49 +0000 (12:13 -0400)]
[AMDGPU] add test for usubsat; NFC
Sanjay Patel [Tue, 19 Oct 2021 15:20:03 +0000 (11:20 -0400)]
[x86] add tests for psubus; NFC
Konstantin Varlamov [Tue, 19 Oct 2021 17:02:21 +0000 (13:02 -0400)]
[libc++] [test] Add tests for converting array types in shared_ptr.
The only possible kind of a conversion in initialization of a shared
pointer to an array is a qualification conversion (i.e., adding
cv-qualifiers). This patch adds tests for converting from `A[]` to
`const A[]` to the following functions:
```
template<class Y> explicit shared_ptr(Y* p);
template<class Y> shared_ptr(const shared_ptr<Y>& r);
template<class Y> shared_ptr(shared_ptr<Y>&& r);
template<class Y> shared_ptr& operator=(const shared_ptr<Y>& r);
template<class Y> shared_ptr& operator=(shared_ptr<Y>&& r);
template<class Y> void reset(Y* p);
template<class Y, class D> void reset(Y* p, D d);
template<class Y, class D, class A> void reset(Y* p, D d, A a);
```
Similar tests for converting functions that involve a `weak_ptr` should
be added once LWG issue [3001](https://cplusplus.github.io/LWG/issue3001)
is implemented.
Differential Revision: https://reviews.llvm.org/D112048
Jim Ingham [Tue, 19 Oct 2021 16:56:34 +0000 (09:56 -0700)]
Remove unneeded variable num_found.
Jonas Devlieghere [Tue, 19 Oct 2021 16:24:31 +0000 (09:24 -0700)]
[debugserver] Fix BUILDING_FOR_ARM64_OSX
Check for TARGET_CPU_ARM64 (ARM instructions for 64-bit mode) rather
than TARGET_CPU_ARM (instructions for 32-bit mode).
Arthur Eubanks [Tue, 19 Oct 2021 16:52:04 +0000 (09:52 -0700)]
[Verifier] Add context for assume operand bundles verifier errors
And fix a typo.
Carlos Galvez [Tue, 19 Oct 2021 16:37:37 +0000 (16:37 +0000)]
Use reference type in for loop
To fix failing build job.
Carlos Galvez [Wed, 6 Oct 2021 06:17:13 +0000 (06:17 +0000)]
[clang-tidy] Support globbing in NOLINT* expressions
To simplify suppressing warnings (for example, for
when multiple check aliases are enabled).
The globbing format reuses the same code as for
globbing when enabling checks, so the semantics
and behavior is identical.
Differential Revision: https://reviews.llvm.org/D111208
Joseph Huber [Tue, 19 Oct 2021 16:13:04 +0000 (12:13 -0400)]
[OpenMP] Remove macro guards for device debugging
The plugin currently uses a macro to check if this is a debug built
before assigning the debug kind variable to the device environment
struct. This is being deprecated because the new device runtime does not
maintain separate debug builds and should always be availible.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D112083
Louis Dionne [Tue, 12 Oct 2021 16:46:21 +0000 (12:46 -0400)]
[libunwind] Add a from-scratch config for running libunwind tests
Running tests for libunwind is a lot simpler than running tests for
libc++, so a simple Lit config file is sufficient. The benefit is that
we disentangle the libunwind test configuration from the libc++ and
libc++abi test configuration. The setup was too complicated, which led
to some bugs (notably we were running against the system libunwind on
Apple platforms).
Differential Revision: https://reviews.llvm.org/D111664
Kazu Hirata [Tue, 19 Oct 2021 15:54:02 +0000 (08:54 -0700)]
[Driver, Frontend] Use StringRef::contains (NFC)
Michał Górny [Tue, 19 Oct 2021 13:54:22 +0000 (15:54 +0200)]
[lldb] [Process/Utility] Define dN regs on ARM via helper macro
Use FPU_REG macro to define dN registers, removing the wrong value_regs
while at it. This is a piece-wise attempt of reconstructing D112066
with the goal of figuring out which part of the larger change breaks
the buildbot.
Differential Revision: https://reviews.llvm.org/D112066
Jamie Schmeiser [Tue, 19 Oct 2021 14:57:54 +0000 (10:57 -0400)]
Changes to print-changed classes in preparation for DotCfg change printer
Summary:
Break out non-functional changes to the print-changed classes that are needed
for reuse with the DotCfg change printer in https://reviews.llvm.org/D87202.
Various changes to the change printers to facilitate reuse with the
upcoming DotCfg change printer. This includes changing several of
the classes and their support classes to being templates. Also,
some template parameter names were simplified to avoid confusion
with planned identifiers in the DotCfg change printer to come. A
virtual function in the class for comparing functions was changed
to a lambda. The virtual function same was replaced with calls to
operator==. The only intentional functional change was to add the exe name
as the first parameter to llvm::sys::ExecuteAndWait
Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: aeubanks (Arthur Eubanks)
Differential Revision: https://reviews.llvm.org/D110737
David Sherwood [Thu, 30 Sep 2021 08:17:16 +0000 (09:17 +0100)]
[AArch64] Split out processor/tuning features
Following on from an earlier patch that introduced support for -mtune
for AArch64 backends, this patch splits out the tuning features
from the processor features. This gives us the ability to enable
architectural feature set A for a given processor with "-mcpu=A"
and define the set of tuning features B with "-mtune=B".
It's quite difficult to write a test that proves we select the
right features according to the tuning attribute because most
of these relate to scheduling. I have created a test here:
CodeGen/AArch64/misched-fusion-addr-tune.ll
that demonstrates the different scheduling choices based upon
the tuning.
Differential Revision: https://reviews.llvm.org/D111551
David Sherwood [Tue, 19 Oct 2021 14:11:05 +0000 (15:11 +0100)]
Shraiysh Vaishay [Tue, 19 Oct 2021 13:38:29 +0000 (19:08 +0530)]
[MLIR][OpenMP][NFC] Moved Synchronization Hint related functions
The functions are moved above the parseClauses function as they
will be used inside it to parse `hint` clause
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D112071
Amy Kwan [Mon, 18 Oct 2021 21:40:31 +0000 (16:40 -0500)]
[PowerPC] Restrict various P10 options to P10 only.
This patch attempts to restrict the following P10 options:
```
-mprefixed
-mpcrel
-mpaired-vector-memops
```
To P10 only. This will prevent the use of these options on P9 and earlier.
The behaviour of this patch looks like the following on pre-P10:
```
$ clang -mcpu=pwr9 -mpaired-vector-memops test.c -o test
error: option '-mpaired-vector-memops' cannot be specified without '-mcpu=pwr10'
$ clang -mcpu=pwr9 -mprefixed test.c -o test
error: option '-mprefixed' cannot be specified without '-mcpu=pwr10'
$ clang -mcpu=pwr9 -mprefixed -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mcpu=pwr10 -mprefixed'
$ clang -mcpu=pwr9 -mpcrel -mprefixed test.c -o test
error: option '-mpcrel' cannot be specified without '-mcpu=pwr10 -mprefixed'
$ clang -mcpu=pwr9 -mpcrel test.c -o test
error: option '-mpcrel' cannot be specified without '-mcpu=pwr10 -mprefixed'
```
Differential Revision: https://reviews.llvm.org/D109652
David Sherwood [Wed, 22 Sep 2021 13:56:30 +0000 (14:56 +0100)]
[AArch64] Always add -tune-cpu argument to -cc1 driver
This patch ensures that we always tune for a given CPU on AArch64
targets when the user specifies the "-mtune=xyz" flag. In the
AArch64Subtarget if the tune flag is unset we use the CPU value
instead.
I've updated the release notes here:
llvm/docs/ReleaseNotes.rst
and added tests here:
clang/test/Driver/aarch64-mtune.c
Differential Revision: https://reviews.llvm.org/D110258
Joe Loser [Tue, 19 Oct 2021 13:51:08 +0000 (09:51 -0400)]
[libc++][docs] Mark LWG3420 complete
Mark LWG3420 as complete. Currently, the `cpp17_iterator` concept
checks that the type looks like an iterator first before checking if it
is copyable.
Reviewed By: ldionne, Quuxplusone, #libc
Differential Revision: https://reviews.llvm.org/D111598
Michał Górny [Tue, 19 Oct 2021 13:41:40 +0000 (15:41 +0200)]
[lldb] [Process/Utility] Define sN regs on ARM via helper macro
This is a piece-wise attempt of reconstructing D112066 with the goal
of figuring out which part of the larger change breaks the buildbot.
Differential Revision: https://reviews.llvm.org/D112066
Michał Górny [Tue, 19 Oct 2021 13:35:57 +0000 (15:35 +0200)]
[lldb] [Process/Utility] clang-format RegisterInfos_arm.h
Simon Pilgrim [Tue, 19 Oct 2021 13:37:34 +0000 (14:37 +0100)]
[ADT] Add APInt::isNegatedPowerOf2() helper
Inspired by D111968, provide a isNegatedPowerOf2() wrapper instead of obfuscating code with (-Value).isPowerOf2() patterns, which I'm sure are likely avenues for typos.....
Differential Revision: https://reviews.llvm.org/D111998
Michał Górny [Tue, 19 Oct 2021 13:33:27 +0000 (15:33 +0200)]
Revert "[lldb] [Process/Utility] Fix value_regs/invalidate_regs for ARM"
This reverts commit
1c2c67b46b55a2a81ebc988c829e2eee13a4fec6.
Something's still wrong.
Matt Morehouse [Mon, 18 Oct 2021 20:34:16 +0000 (13:34 -0700)]
[HWASan] Use tagged-globals feature on x86.
Allows us to use the small code model when we disable relocation
relaxation.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D111344
Michał Górny [Tue, 19 Oct 2021 12:17:20 +0000 (14:17 +0200)]
[lldb] [Process/Utility] Fix value_regs/invalidate_regs for ARM
Fix incorrect values for value_regs, and incomplete values for
invalidate_regs in RegisterInfos_arm. The value_regs entry needs
to list only one base (i.e. larger) register that needs to be read
to get the value for this register, while invalidate_regs needs to list
all other registers (including pseudo-register) whose values would
change when this register is written to.
While at it, introduce helper macros for the definitions.
7a8ba4ffbeecb5070926b80bb839a4d80539f1ac fixed a similar problem
for ARM64.
Differential Revision: https://reviews.llvm.org/D112066
bakhtiyar [Tue, 19 Oct 2021 12:20:29 +0000 (05:20 -0700)]
Canonicalize max/min operations on integers.
Reviewed By: ezhulenev
Differential Revision: https://reviews.llvm.org/D112051
Louis Dionne [Mon, 18 Oct 2021 21:54:05 +0000 (17:54 -0400)]
[runtimes] Make sure LLVM_LIT_ARGS is set before including individual runtimes
Otherwise, the individual `check-cxx`, `check-cxxabi` and similar targets
will not know about `LLVM_LIT_ARGS`, and we'll end up running lit without
any argument.
Differential Revision: https://reviews.llvm.org/D112035
Valentin Clement [Tue, 19 Oct 2021 12:16:10 +0000 (14:16 +0200)]
[fir] Add FIRBuilder utility functions
Extract some code from the big ptach D111337. This patch
contains some utility functions from the FIRBuidler.
List of utility functions added:
- getRegion
- getModule
- getKindMap
- getRefType
- getVarLenSeqTy
- getRealType
- createNullConstant
- createRealConstant
- createRealZeroConstant
- createGlobal
- createGlobalConstant
- createStringLitOp
- getNamedFunction
- getNamedGlobal
- createFunction
- addNamedFunction
- createBool
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D112057
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Shraiysh Vaishay [Tue, 19 Oct 2021 11:48:51 +0000 (17:18 +0530)]
[MLIR][OpenMP] Added parseClauses
Code reorganized in OpenMPDialect.cpp to have all functions corresponding to an operation together.
Added parseClauses function to avoid code duplication while parsing clauses in OpenMP operations. Also added printers and verifiers for clauses, which are being used for multiple operations.
Reviewed By: kiranchandramohan, peixin
Differential Revision: https://reviews.llvm.org/D110903
Michał Górny [Tue, 19 Oct 2021 11:32:41 +0000 (13:32 +0200)]
[lldb] [ABI/X86] Refactor ABIX86::AugmentRegisterInfo()
Refactor ABIX86::AugmentRegisterInfo() and helper functions for better
readability. This also fixes listing eax & co. as potential subregs
on 32-bit systems.
Differential Revision: https://reviews.llvm.org/D108937
Michał Górny [Fri, 15 Oct 2021 14:38:09 +0000 (16:38 +0200)]
[lldb] [Host] Make Terminal methods return llvm::Error
Differential Revision: https://reviews.llvm.org/D111890
Adam Czachorowski [Thu, 30 Sep 2021 13:11:29 +0000 (15:11 +0200)]
[clangd] Add code completion of param name on /* inside function calls.
For example, if you have:
void foo(int bar);
foo(/*^
it should auto-complete to "bar=".
Because Sema callbacks for code completion in comments happen before we
have an AST we need to cheat in clangd by detecting completion on /*
before, moving cursor back by two characters, then running a simplified
verion of SignatureHelp to extract argument name(s) from possible
overloads.
Differential Revision: https://reviews.llvm.org/D110823
Raphael Isemann [Tue, 19 Oct 2021 10:43:23 +0000 (12:43 +0200)]
[lldb] Adjust udt-layout.test after MS mangling change
The demangled name no longer contains the redundant name since D111715.
Michał Górny [Tue, 19 Oct 2021 10:31:25 +0000 (12:31 +0200)]
Revert "[lldb] [ABI/X86] Support combining xmm* and ymm*h regs into ymm*"
This reverts commit
5352ea4a721ef252129994111b83dc350ecc71da. It seems
to have broken the arm buildbot.
Jeremy Morse [Tue, 19 Oct 2021 10:07:49 +0000 (11:07 +0100)]
[DebugInfo][InstrRef] Avoid un-necessary densemap copies and comparisons
This is purely a performance patch: InstrRefBasedLDV used to use three
DenseMaps to store variable values, two for long term storage and one as a
working set. This patch eliminates the working set, and updates the long
term storage in place, thus avoiding two DenseMap comparisons and two
DenseMap assignments, which can be expensive.
Differential Revision: https://reviews.llvm.org/D111716
Pavel Labath [Mon, 18 Oct 2021 12:45:57 +0000 (14:45 +0200)]
[lldb] Reduce code duplication around inferior building
We had two sets of build<flavour> methods, whose bodies were largely
identical. This makes any kind of modification in their vicinity
repetitive and error-prone.
Replace each set with a single method taking an optional debug_info
parameter.
Differential Revision: https://reviews.llvm.org/D111989
Raphael Isemann [Tue, 19 Oct 2021 09:51:10 +0000 (11:51 +0200)]
[lldb] Allow dumping the state of all scratch TypeSystems
This adds the `target dump typesystem'`command which dumps the TypeSystem of the
target itself (aka the 'scratch TypeSystem'). This is similar to `target modules
dump ast` which dumps the AST of lldb::Modules associated with a selected
target.
Unlike `target modules dump ast`, the new command is not a subcommand of `target
modules dump` as it's not touching the modules of a target at all. Also unlike
`target modules dump ast` I tried to keep the implementation language-neutral,
so this patch moves our Clang `Dump` to the `TypeSystem` interface so it will
also dump the state of any future/downstream scratch TypeSystems (e.g., Swift).
That's also why the command just refers to a 'typesystem' instead of an 'ast'
(which is only how Clang is necessarily modelling the internal TypeSystem
state).
The main motivation for this patch is that I need to write some tests that check
for duplicates in the ScratchTypeSystemClang of a target. There is currently no
way to check for this at the moment (beside measuring memory consumption of
course). It's probably also useful for debugging LLDB itself.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D111936
Lasse Folger [Tue, 19 Oct 2021 10:03:19 +0000 (12:03 +0200)]
[lldb] change name demangling to be consistent between windows and linx
When printing names in lldb on windows these names contain the full type information while on linux only the name is contained.
This change introduces a flag in the Microsoft demangler to control if the type information should be included.
With the flag enabled demangled name contains only the qualified name, e.g:
without flag -> with flag
int (*array2d)[10] -> array2d
int (*abc::array2d)[10] -> abc::array2d
const int *x -> x
For globals there is a second inconsistency which is not yet addressed by this change. On linux globals (in global namespace) are prefixed with :: while on windows they are not.
Reviewed By: teemperor, rnk
Differential Revision: https://reviews.llvm.org/D111715
Raphael Isemann [Tue, 19 Oct 2021 09:34:08 +0000 (11:34 +0200)]
[lldb] Filter duplicates in Target::GetScratchTypeSystems
`Target::GetScratchTypeSystems` returns the list of scratch TypeSystems. The
current implementation is iterating over all LanguageType values and retrieves
the respective TypeSystem for each LanguageType.
All C/C++/Obj-C LanguageTypes are however mapped to the same
ScratchTypeSystemClang instance, so the current implementation adds this single
TypeSystem instance several times to the list of TypeSystems (once for every
LanguageType that we support).
The only observable effect of this is that `SBTarget.FindTypes` for builtin
types currently queries the ScratchTypeSystemClang several times (and also adds
the same result several times).
Reviewed By: bulbazord, labath
Differential Revision: https://reviews.llvm.org/D111931
Vladislav Vinogradov [Mon, 11 Oct 2021 15:25:14 +0000 (18:25 +0300)]
[mlir][RFC] Refactor layout representation in MemRefType
The change is based on the proposal from the following discussion:
https://llvm.discourse.group/t/rfc-memreftype-affine-maps-list-vs-single-item/3968
* Introduce `MemRefLayoutAttr` interface to get `AffineMap` from an `Attribute`
(`AffineMapAttr` implements this interface).
* Store layout as a single generic `MemRefLayoutAttr`.
This change removes the affine map composition feature and related API.
Actually, while the `MemRefType` itself supported it, almost none of the upstream
can work with more than 1 affine map in `MemRefType`.
The introduced `MemRefLayoutAttr` allows to re-implement this feature
in a more stable way - via separate attribute class.
Also the interface allows to use different layout representations rather than affine maps.
For example, the described "stride + offset" form, which is currently supported in ASM parser only,
can now be expressed as separate attribute.
Reviewed By: ftynse, bondhugula
Differential Revision: https://reviews.llvm.org/D111553
Jeremy Morse [Tue, 19 Oct 2021 09:24:12 +0000 (10:24 +0100)]
[DebugInfo][NFC] Zero-initialize a class field
This field gets assigned when the relevant object starts being used; but it
remains uninitialized beforehand. This risks introducing hard-to-detect
bugs if something changes, so zero-initialize the field.
Luke Benes [Tue, 19 Oct 2021 09:12:18 +0000 (10:12 +0100)]
[DebugInfo][InstrRef] Fix Wdangling-else warning in InstrRefLDVTest
Fix a dangling else that gcc-11 warned about. The EXPECT_EQ macro
expands to an if-else, so the whole construction contains a hidden
dangling else.
Differential Revision: https://reviews.llvm.org/D112044
Michał Górny [Fri, 27 Aug 2021 16:55:37 +0000 (18:55 +0200)]
[lldb] [ABI/X86] Support combining xmm* and ymm*h regs into ymm*
gdbserver does not expose combined ymm* registers but rather XSAVE-style
split xmm* and ymm*h portions. Extend value_regs to support combining
multiple registers and use it to create user-friendly ymm* registers
that are combined from split xmm* and ymm*h portions.
Differential Revision: https://reviews.llvm.org/D108937
Qiaojin.Bao [Mon, 18 Oct 2021 09:34:30 +0000 (17:34 +0800)]
[llvm-shlib] Fix windows build failed while llvm non-standalone building.
While build llvm-project as a sub-project on windows, met a build error:
libllvm-c.exports /llvm/bin\llvm-nm.exe: error: ...builds/rel64ninja/./lib/LLVMDemangle.lib: no such file or directory
The libllvm-c.exports, libllvm-c.args, and lib/*.lib should under LLVM_BINARY_DIR, using CMAKE_BINARY_DIR will cause 'no such file' error while llvm-project built as a sub-project.
Fangrui Song [Tue, 19 Oct 2021 08:09:40 +0000 (01:09 -0700)]
[Driver][Gnu] Support -shared -static: pass -shared to ld and use crtbeginS.o
This mode never works (mismatching crtbeginT.o and crtendS.o) and probably
unsupported by GCC on glibc based Linux distro (incorrect crtbeginT.o causes
linker error) but makes sense (-shared means building a shared object, -static
means avoid shared object dependencies) and can be used on musl based Linux
distro.
mingw supports this mode as well.
Christian Kühnel [Wed, 13 Oct 2021 15:14:57 +0000 (15:14 +0000)]
first draft of a written policy around git repos
This is a frist draft of a set of policies around new git repos and how we grant write access to our GitHub organisation.
This proposal is based on the discussions in:
https://github.com/llvm/llvm-iwg/issues/40
https://github.com/llvm/llvm-iwg/issues/51
Differential Revision: https://reviews.llvm.org/D111723
Jon Chesterfield [Tue, 19 Oct 2021 07:05:05 +0000 (08:05 +0100)]
[libomptarget] Refactor DeviceRTL prior to AMDGPU bringup
Subset of D111993. Fix typos, rename read to load.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D111999
Jonas Devlieghere [Tue, 19 Oct 2021 06:21:06 +0000 (23:21 -0700)]
[lldb] Fix nullptr dereference in AppleObjCRuntimeV2
Fix a potential nullptr dereference in AppleObjCRuntimeV2 by checking
the result of GetClassInfoUtilityFunction and returning a failure if
it's null.
The DynamicClassInfoExtractor was already doign the right thing, but the
SharedCacheClassInfoExtractor was missing this check.
Fangrui Song [Tue, 19 Oct 2021 05:38:41 +0000 (22:38 -0700)]
[tools] Delete redundant 'static' from namespace scope 'static const'. NFC
Fangrui Song [Tue, 19 Oct 2021 05:21:54 +0000 (22:21 -0700)]
[llvm-readobj] Delete redundant 'static' from namespace scope 'static const'. NFC
By default, such a non-template variable of non-volatile const-qualified type
having namespace-scope has internal linkage ([basic.link]), so no need for `static`.
Lang Hames [Tue, 19 Oct 2021 04:41:08 +0000 (21:41 -0700)]
[JITLink][x86-64] Lift GOT, PLT table managers into x86_64.h; reuse for MachO.
This lifts the global offset table and procedure linkage table builders out of
ELF_x86_64.h and into x86_64.h, renaming them with generic names
x86_64::GOTTableBuilder and x86_64::PLTTableBuilder. MachO_x86_64.cpp is updated
to use these classes instead of the older PerGraphGOTAndStubsBuilder tool.
Craig Topper [Tue, 19 Oct 2021 04:34:01 +0000 (21:34 -0700)]
[RISCV] Remove the HasSideEffects property from riscv_vector.td
It was being used to control the nothrow attribute on the builtins. The
nothrow attribute is for C++ exceptions. Even if the vector builtins
have side effects in IR, that's different than the nothrow attribute.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D112028
Craig Topper [Tue, 19 Oct 2021 04:26:17 +0000 (21:26 -0700)]
[RISCV] Split RISCV vector builtins into their own file and namespace.
Similar to SVE, this separates the RVV builtlins into their own
region of builtin IDs. Only those IDs are allowed to be used by
the builtin_alias attribute now.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D111923
Dave MacLachlan [Tue, 19 Oct 2021 04:01:40 +0000 (09:31 +0530)]
Fix small typo in Block ABI docs
I think the C++ code example had the wrong name for the block copy function.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D91815
Lang Hames [Tue, 19 Oct 2021 01:53:05 +0000 (18:53 -0700)]
[JITLink] Use DEBUG_WITH_TYPE, rather than defining DEBUG_TYPE.
This avoids defining DEBUG_TYPE in a public header.
Noah Shutty [Tue, 19 Oct 2021 01:40:57 +0000 (18:40 -0700)]
[Support][ThinLTO] Move ThinLTO caching to LLVM Support library
We would like to move ThinLTO’s battle-tested file caching mechanism to
the LLVM Support library so that we can use it elsewhere in LLVM.
Patch By: noajshu
Differential Revision: https://reviews.llvm.org/D111371
Hsiangkai Wang [Thu, 7 Oct 2021 11:30:33 +0000 (19:30 +0800)]
[RISCV] Reorder the vector register allocation order.
GPR uses argument registers as the first group of registers to allocate.
This patch uses vector argument registers, v8 to v23, as the first group
to allocate.
Differential Revision: https://reviews.llvm.org/D111304
Mogball [Tue, 19 Oct 2021 00:48:24 +0000 (00:48 +0000)]
[mlir] fix bugs with NamedAttrList
- `assign` with ArrayRef was calling `append`
- `assign` with empty ArrayRef was not clearing storage
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D112043
Lang Hames [Tue, 19 Oct 2021 01:11:48 +0000 (18:11 -0700)]
Simplify the TableManager class and move it into a public header.
Moves visitEdge into the TableManager derivatives, replacing the fixEdgeKind
methods in those classes. The visitEdge method takes on responsibility for
updating the edge target, as well as its kind.
Matthias Springer [Tue, 19 Oct 2021 00:08:38 +0000 (09:08 +0900)]
[mlir][scf] Add insideMutuallyExclusiveBranches helper
This helper function checks if two given ops are in mutually exclusive branches of the same scf::IfOp.
Differential Revision: https://reviews.llvm.org/D111957
Matthias Springer [Mon, 18 Oct 2021 23:59:32 +0000 (08:59 +0900)]
[mlir] Add enclosingOpOk parameter to properlyDominates
Differential Revision: https://reviews.llvm.org/D111959
Jim Ingham [Mon, 18 Oct 2021 23:52:15 +0000 (16:52 -0700)]
Follow-on to fix a test from
c5011aed9c297d6ddd8ee4f77453b215aa27554a.
I need to set a fake default platform for the UnitTest test to run on other
systems.
Arthur Eubanks [Mon, 18 Oct 2021 22:43:08 +0000 (15:43 -0700)]
[opt] Directly translate -O# to -passes='default<O#>'
Right now when we see -O# we add the corresponding 'default<O#>' into
the list of passes to run when translating legacy -pass-name. This has
the side effect of not using the default AA pipeline.
Instead, treat -O# as -passes='default<O#>', but don't allow any other
-passes or -pass-name. I think we can keep `opt -O#` as shorthand for
`opt -passes='default<O#>` but disallow anything more than just -O#.
Tests need to be updated to not use `opt -O# -pass-name`.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D112036
Arthur Eubanks [Mon, 18 Oct 2021 23:35:20 +0000 (16:35 -0700)]
[test] Remove tests pinned to the legacy PM
Now that the legacy PM is deprecated for the optimization pipeline, we
can start deleting legacy PM tests.
For tests that test both PMs, merge the RUN lines.
Delete tests specific to the legacy PM.
not-jenni [Mon, 18 Oct 2021 23:22:01 +0000 (16:22 -0700)]
[mlir][tosa] Adds a canonicalization to the transpose op if the perms are a no op
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D112037
Michael Jones [Wed, 1 Sep 2021 23:51:05 +0000 (23:51 +0000)]
[libc] add atof, strtof and strtod
Add the string to floating point conversion functions.
Long doubles aren't supported yet, but floats and doubles are. The
primary algorithm used is the Eisel-Lemire ParseNumberF64 algorithm,
with the Simple Decimal Conversion algorithm as backup.
Links for more information on the algorithms:
Number Parsing at a Gigabyte per Second, Software: Practice and
Experience 51 (8), 2021 (https://arxiv.org/abs/2101.11408)
https://nigeltao.github.io/blog/2020/eisel-lemire.html
https://nigeltao.github.io/blog/2020/parse-number-f64-simple.html
Differential Revision: https://reviews.llvm.org/D109261
Craig Topper [Mon, 18 Oct 2021 22:56:03 +0000 (15:56 -0700)]
[RISCV][TableGen] Remove HasMaskedOffOperand as a member of RVVIntrinsic. NFC
This value is only used by the RVVIntrinsic constructor. We don't
need it to be a member.
Anshil Gandhi [Mon, 18 Oct 2021 22:51:20 +0000 (16:51 -0600)]
[HIP] [AlwaysInliner] Disable AlwaysInliner to eliminate undefined symbols
By default clang emits complete contructors as alias of base constructors if they are the same.
The backend is supposed to emit symbols for the alias, otherwise it causes undefined symbols.
@yaxunl observed that this issue is related to the llvm options `-amdgpu-early-inline-all=true`
and `-amdgpu-function-calls=false`. This issue is resolved by only inlining global values
with internal linkage. The `getCalleeFunction()` in AMDGPUResourceUsageAnalysis also had
to be extended to support aliases to functions. inline-calls.ll was corrected appropriately.
Reviewed By: yaxunl, #amdgpu
Differential Revision: https://reviews.llvm.org/D109707
Craig Topper [Mon, 18 Oct 2021 18:47:15 +0000 (11:47 -0700)]
[RISCV] Fix typo in comment. NFC
Jim Ingham [Tue, 12 Oct 2021 17:55:24 +0000 (10:55 -0700)]
Add a "command container" hierarchy to allow users to add container nodes.
The point is to allow users with a related set of script based commands
to organize their commands in a hierarchy in the command set, rather than
having to have only top-level commands.
Differential Revision: https://reviews.llvm.org/D110298
modimo [Mon, 18 Oct 2021 22:26:01 +0000 (15:26 -0700)]
[InlineAdvisor][NFC] Fix tests added in D110658 V2
On Windows there's an *.exe suffix to opt that isn't present in Linux.
Remove the check for opt in the string