Maksim Panchenko [Wed, 28 Jun 2023 05:56:47 +0000 (22:56 -0700)]
[BOLT][NFCI] Use MetadataRewriter interface to update SDT markers
Migrate SDT markers processing to the new MetadataRewriter interface.
Depends on D154020
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D154021
Maksim Panchenko [Wed, 28 Jun 2023 05:55:53 +0000 (22:55 -0700)]
[BOLT] Introduce MetadataRewriter interface
Introduce the MetadataRewriter interface to handle updates for various
types of auxiliary data stored in a binary file.
To implement metadata processing using this new interface, all metadata
rewriters should derive from the RewriterBase class and implement
one or more of the following methods, depending on the timing of metadata
read and write operations:
* preCFGInitializer()
* postCFGInitializer() // TBD
* preEmitFinalizer() // TBD
* postEmitFinalizer()
By adopting this approach, we aim to simplify the RewriteInstance class
and improve its scalability to accommodate new extensions of file formats,
including various metadata types of the Linux Kernel.
Differential Revision: https://reviews.llvm.org/D154020
Arthur Eubanks [Thu, 6 Jul 2023 18:07:48 +0000 (11:07 -0700)]
[gn build] Manually port
015dabd7
Liam Fitzpatrick [Tue, 4 Jul 2023 16:00:57 +0000 (17:00 +0100)]
[MLIR][Tosa] Turn reshape(const()) from canonicalization into fold; fix dynamic shape case
1) Turns the canonicalization into a fold, so it can cleanup IR within other passes.
2) When the output of the reshape is a dynamic shaped tensor,
we cannot apply the fold to the constant, because constants are required to have
static shape.
Differential Revision: https://reviews.llvm.org/D154615
Thurston Dang [Thu, 6 Jul 2023 17:58:04 +0000 (17:58 +0000)]
[msan] Fix -Wcast-qual error in msan_dl.cpp
Attempt 2 at fixing a buildbot error https://lab.llvm.org/buildbot#builders/57/builds/28143
that I had introduced in D154272
Paul Robinson [Mon, 3 Jul 2023 18:41:09 +0000 (11:41 -0700)]
[UTC] Add do-not-autogenerate capability
Differential Revision: https://reviews.llvm.org/D154383
Chia-hung Duan [Wed, 5 Jul 2023 20:39:21 +0000 (20:39 +0000)]
[scudo] Try to release pages after unlocking the TSDs
This increases the parallelism and the usage of TSDs
Reviewed By: cferris
Differential Revision: https://reviews.llvm.org/D152988
Chia-hung Duan [Wed, 5 Jul 2023 20:36:41 +0000 (20:36 +0000)]
[scudo] Verify the size of free blocks in primary allocator
When all the blocks (local caches are included) are freed, the size of
free blocks should be equal to `AllocatedUser`.
Reviewed By: cferris
Differential Revision: https://reviews.llvm.org/D152769
Jonathan Peyton [Thu, 6 Jul 2023 17:31:47 +0000 (12:31 -0500)]
[OpenMP] Ensure socket layer is not first in CPUID topology detection
* Return 0 length topology if socket layer is detected first
* Fix DEBUG ASSERT
Fangrui Song [Thu, 6 Jul 2023 17:31:45 +0000 (10:31 -0700)]
[ELF] Use compression::getReasonIfUnsupported for zlib/zstd unavailable error
The error message now matches llvm-objcopy --compress-debug-sections=[zlib|zstd].
Tom Stellard [Thu, 6 Jul 2023 03:21:04 +0000 (20:21 -0700)]
[Support] Use C++11 attribute syntax for visibility attributes
The gnu extension __attribute syntax cannot be mixed with the
C++11 alignas specifier, so in order to use visibility attributes on
classes that also use alignas, we need to use the C++11 standard syntax.
Also fix a few warnings introduced by this change.
Reviewed By: compnerd
Differential Revision: https://reviews.llvm.org/D152043
Nicole Rabjohn [Thu, 6 Jul 2023 17:12:05 +0000 (17:12 +0000)]
Fixing conflicting macro definitions between curses.h and the standard library.
POSIX allows certain macros to exist with generic names (i.e. refresh(), move(), and erase()) to exist in `curses.h` which conflict with functions found in std::filesystem, among others. This patch undefs the macros in question and adds them to LIBCPP_PUSH_MACROS and LIBCPP_POP_MACROS.
Reviewed By: #libc, philnik, ldionne
Differential Revision: https://reviews.llvm.org/D147356
varconst [Thu, 6 Jul 2023 17:17:02 +0000 (10:17 -0700)]
[libc++][hardening][NFC] Rename the `has-debug-mode` feature to `has-legacy-debug-mode`.
This will allow reusing the `has-debug-mode` feature for the new debug
mode without accidentally reenabling old debug mode tests. The
`has-legacy-debug-mode` feature is deliberately never set -- the old
tests are left checked in to have a point of reference for the level of
checking that was supported by the legacy debug mode, making it easier
to verify we've reached feature parity in the future.
Amir Ayupov [Thu, 6 Jul 2023 17:16:20 +0000 (10:16 -0700)]
[YAML][NFC] Replace if-else with switch in createHNodes
BOLT YAML profile reading time gets marginally faster (14.1572->13.9207 s) for
a large YAML profile (121MB/31K functions). Not claiming stat significance
though.
Reviewed By: hintonda
Differential Revision: https://reviews.llvm.org/D154553
Matt Arsenault [Thu, 2 Feb 2023 14:28:05 +0000 (10:28 -0400)]
CodeGen: Optimize lowering of is.fpclass fcZero|fcSubnormal
Combine the two checks into a check if the exponent bits are 0. The
inverted case isn't reachable until a future change, and GlobalISel
currently doesn't attempt the inversion optimization.
https://reviews.llvm.org/D143182
Leonard Grey [Fri, 23 Jun 2023 17:26:32 +0000 (13:26 -0400)]
[gn] Add check-lsan target for Mac
Only supports ASAN mode right now. Standalone requires a some more plumbing so it will be a follow-up.
Mac-only but I suspect this will be fine on Linux also since it's based on the check-asan file, will follow up after testing.
Differential Revision: https://reviews.llvm.org/D153651
Matt Arsenault [Sun, 4 Jun 2023 10:55:04 +0000 (06:55 -0400)]
DAG: Check isCondCodeLegal in is_fpclass expansion to fcmp eq 0
Results in some x86 codegen diffs. Some look better, some look worse.
https://reviews.llvm.org/D152094
Aart Bik [Thu, 6 Jul 2023 05:17:52 +0000 (22:17 -0700)]
[mlir][sparse][gpu] fix missing dealloc
This dealloc was incorrectly removed in
https://reviews.llvm.org/D153173
Reviewed By: K-Wu
Differential Revision: https://reviews.llvm.org/D154564
Jonathan Peyton [Thu, 6 Jul 2023 16:45:58 +0000 (11:45 -0500)]
[OpenMP] Remove gcc-12 warnings from libomp
Joseph Huber [Thu, 6 Jul 2023 16:40:13 +0000 (11:40 -0500)]
[Libomptarget] Disable the 'mapping/prelock.cpp' test on AMDGPU
Summary:
This test was not functional on the new plugins, now that the old ones
have been deleted it doesn't work. Disable until we get a fix.
Thurston Dang [Wed, 5 Jul 2023 20:49:42 +0000 (20:49 +0000)]
Reland '[msan] Intercept dladdr1, and refactor dladdr'
Reland with -Wcast-qual issue fixed
Original commit message:
This patch adds an msan interceptor for dladdr1 (with support for RTLD_DL_LINKMAP and RTLD_DL_SYMENT) and an accompanying test. It also adds a helper file, msan_dl.cpp, that contains UnpoisonDllAddrInfo (refactored out of the dladdr interceptor) and UnpoisonDllAddr1ExtraInfo.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D154272
Matt Arsenault [Thu, 6 Jul 2023 15:58:35 +0000 (11:58 -0400)]
AMDGPU: Fix not applying the correct default memcpy expansion threshold
Fixes
3c848194f28decca41b7362f9dd35d4939797724. The TTI hook name got
renamed at some point in the process and the target implementation was
left behind.
Fixes: SWDEV-407329
Yusra Syeda [Thu, 6 Jul 2023 16:01:53 +0000 (12:01 -0400)]
[SystemZ][z/OS] Address single comment in ADA patch for EmittedBytes unused in -Asserts
Jeremy Furtek [Thu, 6 Jul 2023 15:56:05 +0000 (08:56 -0700)]
[mlir] Add support for TF32 as a Builtin FloatType
This diff adds support for TF32 as a Builtin floating point type. This
supplements the recent addition of the TF32 semantic to the LLVM APFloat class
by extending usage to MLIR.
https://reviews.llvm.org/D151923
More information on the TF32 type can be found here:
https://blogs.nvidia.com/blog/2020/05/14/tensorfloat-32-precision-format/
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D153705
Alex Langford [Wed, 5 Jul 2023 18:18:23 +0000 (11:18 -0700)]
[lldb][NFCI] Minor cleanups to StructuredData::GetObjectForDotSeparatedPath
This accomplishes a few minor things:
- Removed unnecessary uses of `this->`
- Removed an unnecessary std::string allocation.
- Removed some nesting to improve readability using early returns where
it makes sense.
- Replaced `strtoul` with `llvm::to_integer` which avoids another
std::string allocation.
- Removed braces from single statement conditions, removed
else-after-returns.
Differential Revision: https://reviews.llvm.org/D154534
Alex Langford [Mon, 3 Jul 2023 19:55:29 +0000 (12:55 -0700)]
[lldb][NFCI] Remove use of ConstString from OptionValue
Summary: No need to create a ConstString, `GetName` already returns a StringRef.
Reviewers: JDevlieghere, mib, jasonmolenda
Subscribers:
Differential Revision: https://reviews.llvm.org/D154386
zhijian [Thu, 6 Jul 2023 15:47:08 +0000 (11:47 -0400)]
[AIX][XCOFF] print out the traceback info
Summary:
Adding a new option -traceback-table to print out the traceback info of xcoff ojbect file.
Reviewers: James Henderson, Fangrui Song, Stephen Peckham, Xing Xue
Differential Revision: https://reviews.llvm.org/D89049
Joseph Huber [Thu, 6 Jul 2023 15:38:18 +0000 (10:38 -0500)]
[Libomptarget] Fix tests after deleting the next-gen plugins
The next-gen plugins didn't correctly configure tests and were never
actually being run. Since deleting the old plugin we stopped getting
`libomptarget` tests. This patch fixes the issue and allows the targets
to be built
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D154619
Doru Bercea [Thu, 22 Jun 2023 22:25:05 +0000 (18:25 -0400)]
Enable dynamic-sized VLAs for data sharing in OpenMP offloaded target regions.
Review: https://reviews.llvm.org/D153883
Craig Topper [Thu, 6 Jul 2023 14:53:31 +0000 (07:53 -0700)]
[RISCV] Use ClangBuiltin in IntrinsicsRISCV.td to map some scalar crypto builtins to IR intrinsic.
This is the way most targets do it for a simple mapping.
We can't do this for all builtins due to type overloading of the IR intrinsics.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D154567
Nikita Popov [Thu, 29 Jun 2023 08:04:46 +0000 (10:04 +0200)]
[CaptureTracking] Don't consider comparison of inbounds GEP with nonnull non-capturing
This is required to bring CaptureTracking in line with the new
semantics from D154051, as gep inbounds p, 0 is now always non-poison.
There are many ways in which the inbounds special case could be
preserved: If the index is known non-zero, or there is an inbounds
chain down to an identified object, etc. However, I have opted to
drop the special case entirely, as it appears to be low value:
In cases where we can determine such things (e.g. the affected test
cases) we would end up removing the compare via isGEPKnownNonNull()
logic anyway.
Differential Revision: https://reviews.llvm.org/D154054
David Spickett [Thu, 6 Jul 2023 08:49:33 +0000 (08:49 +0000)]
[libcxx] Only add -GR- option to MSVC or clang-cl builds
Previously we added both `-GR-` and `-fno-rtti` if RTTI was disabled.
When building with clang 16.x, that caused this error in part of the build:
```
clang-16: error: argument unused during compilation: '-G R-' [-Werror,-Wunused-command-line-argument]
```
I think the strange message is because clang is seeing `R-` as the argument
to `-G`, which is a valid clang option.
`-GR-` is an alternate syntax for the `/GR-` option for MSVC
(the dash means disable RTTI):
https://learn.microsoft.com/en-us/cpp/build/reference/gr-enable-run-time-type-information?view=msvc-170
This error is sort of fixed by
cd18efb61d759405956dbd30e4b5f2720d8e1783
but not intentionally. Also, we'd have to wait for 17.x to benefit from that.
The proper fix here is to only add `-GR-` if we are building with MSVC
or the MSVC-like clang-cl, and add `-fno-rtti` if not.
Reviewed By: #libc, simon_tatham, michaelplatings, ldionne
Differential Revision: https://reviews.llvm.org/D154582
Leandro Lupori [Tue, 4 Jul 2023 15:50:32 +0000 (15:50 +0000)]
[flang] Force the use of intrinsic builtins in type_info
This ensures that the __Fortran_builtins module is always used
as an intrinsic module by __Fortran_type_info, which avoids issues
when, for instance, the intrinsic modules dir is present in the
include paths.
Fixes https://github.com/llvm/llvm-project/issues/63592
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D154452
Simon Pilgrim [Thu, 6 Jul 2023 14:35:52 +0000 (15:35 +0100)]
[X86] isTargetShuffleEquivalent - ensure the reference operands are vector types
Fixes #63700
Craig Topper [Thu, 6 Jul 2023 14:37:19 +0000 (07:37 -0700)]
[RISCV] Use 'long' in sha512 builtin tests. NFC
This matches the data type of the intrinsics. This case be seen
from the removal of sext and trunc instructions from the IR.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D154577
songruiwang [Thu, 6 Jul 2023 14:34:10 +0000 (22:34 +0800)]
[analyzer] Fix false negative when pass implicit cast nil to nonnull
We should look through implicit casts before determining the type of the arguments, and only allow explicit cast to _Nonnull to suppress warning
```
void foo(NSString *_Nonnull);
foo((NSString * _Nonnull)nil); // no-warning
id obj = nil;
foo(obj); // should warning here (implicit cast id to NSString *_Nonnull)
```
Reviewed By: xazax.hun, steakhal
Differential Revision: https://reviews.llvm.org/D154221
Sergei Barannikov [Mon, 3 Jul 2023 04:06:33 +0000 (07:06 +0300)]
[Mips] Replace OperandMatchResultTy with ParseStatus (NFC)
ParseStatus is slightly more convenient to use due to implicit
conversion from bool, which allows to do something like:
```
return Error(L, "msg");
```
when with MatchOperandResultTy it had to be:
```
Error(L, "msg");
return MatchOperand_ParseFail;
```
It also has more appropriate name since parse* methods are not only for
parsing operands.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D154319
David Tenty [Wed, 29 Mar 2023 13:25:37 +0000 (09:25 -0400)]
[clang][CodeGenCXX] Improve handling of itanium ABI member function alignment requirements
The itanium ABI for certain platforms requires a minimum alignments for
member function pointers to reserve certain bits for distinguishing
virtual and non-virtual functions.
Our implementation of this however depends on the alignment of the
function involved, which may however not reflect the true alignment of
function pointers on certain targets for which the alignment is
independent of the function (e.g. AIX). Worse, the 2-byte alignment
we use may be less than the ABI minimum for the target, and in the case
we are using explicit sections will result in invalid codegen.
This patch attempts to correct this situation by considering the target
alignment of function pointers as part of making the decision about
whether we need to adjust the function alignment to conform to the ABI.
Targets which do not provide the function ptr alignment information
will return a value of 1 when queried and will conservatively retain
the old alignment.
Differential Revision: https://reviews.llvm.org/D147184
Konrad Kleine [Thu, 6 Jul 2023 12:05:02 +0000 (14:05 +0200)]
[lld] respect LLVM_EXTERNAL_LIT
Consider a setup without a system-wide installation of lit.
Instead you pass the path to lit like this:
```
cmake ...
-DLLVM_EXTERNAL_LIT=<PATH_TO_LIT_BINARY> ...
```
Then you will run into this error:
```
ninja: error: unknown target 'check-lld'
```
I have a buildbot builder that fails with this message. Here's the
passage that triggers this error:
https://github.com/llvm/llvm-zorg/blob/
d3bfd5ccbceb542098c350e4d071ceceac6854cb/zorg/buildbot/builders/annotated/standalone-build.sh#L194-L239
By using `LLVM_EXTERNAL_LIT` instead of `LLVM_LIT` we fix this problem.
See
[here](https://llvm.org/docs/GettingStarted.html#stand-alone-builds) for
a description:
> Both the LLVM_ROOT and LLVM_EXTERNAL_LIT options are required to do stand-alone builds for all sub-projects. Additional required options for each sub-project can be found in the table below.
Differential Revision: https://reviews.llvm.org/D154599
Jens Massberg [Thu, 6 Jul 2023 08:31:57 +0000 (10:31 +0200)]
Add missing semantic highlighing for concepts.
Differential Revision: https://reviews.llvm.org/D154580
Matt Arsenault [Sat, 1 Jul 2023 12:34:02 +0000 (08:34 -0400)]
AMDGPU: Make SIFixVGPRCopies preserve everything
All this does is add uses of reserved registers, which
aren't tracked by anything. Saves a loop info computation.
Matt Arsenault [Mon, 3 Jul 2023 14:38:04 +0000 (10:38 -0400)]
AMDGPU: Fold out sign bit ops on frexp_exp
The sign bit has no impact on the exponent, so strip these away. Saves
on the source modifier encoding cost. I left the GlobalISel handling
until there's a resolution to issue #62628.
We should do this in instcombine too, but legalization should be
introducing more frexps than it currently is where this would occur.
Paul Walker [Mon, 3 Jul 2023 14:00:15 +0000 (15:00 +0100)]
[SVE] Add isel for 32-bit add/sub(cntp()) -> incp/decp.
Patterns already exist for 64-bit that I've simply copied and
converted to include the necessary truncation.
Differential Revision: https://reviews.llvm.org/D154350
Matthias Springer [Thu, 6 Jul 2023 14:20:30 +0000 (16:20 +0200)]
[mlir][linalg][transform] Add verifier to MaskedVectorizeOp
Verify that the correct number of `scalable_sizes` was provided.
Differential Revision: https://reviews.llvm.org/D154600
Florian Hahn [Thu, 6 Jul 2023 14:23:16 +0000 (15:23 +0100)]
[LV] Add test case for incorrect shift truncation.
Test for https://github.com/llvm/llvm-project/issues/47927
Matthias Springer [Thu, 6 Jul 2023 14:12:52 +0000 (16:12 +0200)]
[mlir][bufferization] Fix insertion point issue in EliminateEmptyTensors
The replacement op insertion point was off by one.
Differential Revision: https://reviews.llvm.org/D154608
Haohai Wen [Thu, 6 Jul 2023 14:18:35 +0000 (22:18 +0800)]
[Driver][MSVC] Support DWARF fission when using LTO on Windows
D154070 has added /dwodir to lld/COFF to tells LTO backend to create dwo
directory and files. This patch makes clang to emit /dwodir to lld when
user specify -gsplit-dwarf with LTO. This behavior is simiar to DWARF
fission with LTO for ELF.
A simple use case:
$clang-cl -c -flto -gdwarf main.c -o main.o
$clang-cl -c -flto -gdwarf a.c -o a.o
$clang-cl -flto -fuse-ld=lld -gdwarf -gsplit-dwarf main.o a.o
This'll generate a dwo file: main.exe_dwo/0.dwo
Reviewed By: mstorsjo, MaskRay, hans
Differential Revision: https://reviews.llvm.org/D154295
LLVM GN Syncbot [Thu, 6 Jul 2023 14:01:11 +0000 (14:01 +0000)]
[gn build] Port
7aafea001282
LLVM GN Syncbot [Thu, 6 Jul 2023 14:01:10 +0000 (14:01 +0000)]
[gn build] Port
4ade8b7ed997
LLVM GN Syncbot [Thu, 6 Jul 2023 14:01:10 +0000 (14:01 +0000)]
[gn build] Port
2d8cd1951202
LLVM GN Syncbot [Thu, 6 Jul 2023 14:01:09 +0000 (14:01 +0000)]
[gn build] Port
163aad6bcbff
Nico Weber [Thu, 6 Jul 2023 14:00:33 +0000 (10:00 -0400)]
Markus Böck [Thu, 6 Jul 2023 08:59:40 +0000 (10:59 +0200)]
[mlir][LLVM] Make `SplitIntegerStores` capable of splitting vectors as well
The original plan was to turn this into its own pattern, but one of the difficulties was deeming when splitting the vector is required.
`SplitIntegerStores` essentially already did that by checking for field overlap.
Therefore, it was renamed to `SplitStores` and extended to splitting stores with values of vector and integer type.
The vector splitting is done in a simple manner by simply using `extractelement` to get each vector element. Subsequent pattern applications are responsible for further cleaning up the output and making it type-consistent.
Worst case, if the code cannot be transformed into a type-consistent form (due to e.g. the code explicitly doing partial writes to elements or similar), we might needlessly do a vector split.
Differential Revision: https://reviews.llvm.org/D154583
Markus Böck [Wed, 5 Jul 2023 07:15:50 +0000 (09:15 +0200)]
[mlir][LLVM] Use `undef` operand instead of removing `llvm.intr.dbg.value`
Jeremy Morse noted in D154451 that LLVM doesn't drop a `dbg.value` when its value is being removed, but rather sets the operand to `undef`. This preserves the debug info and gives allows the debugger to instead inform the user that the variable has been optimized out, rather than not displaying the variable at all.
This patch fixes that mistake done in the previous revision by mirroring that behaviour in MLIR as well.
Differential Revision: https://reviews.llvm.org/D154476
Florian Hahn [Thu, 6 Jul 2023 13:33:11 +0000 (14:33 +0100)]
[DemandedBits] Add tests for shl.
Add test coverage for demanded bit analysis of shl.
Aleksandr Popov [Thu, 6 Jul 2023 13:29:55 +0000 (15:29 +0200)]
[IRCE][Tests] Add more tests with range checks in the form of 'iv + offset vs limit'
Added tests on range checks with non-strick predicate:
* N - IV > limit
* IV - N < limit
* IV + N < limit
Also added tests with known to be non-negative N
Differential Revision: https://reviews.llvm.org/D154593
Eduard Zingerman [Tue, 11 Apr 2023 03:31:27 +0000 (06:31 +0300)]
[BPF] Undo transformation for LICM.cpp:hoistMinMax()
Extended BPFCheckAndAdjustIR pass with sinkMinMax() transformation
that undoes LICM hoistMinMax pass.
The undo transformation converts the following patterns:
x < min(a, b) -> x < a && x < b
x > min(a, b) -> x > a || x > b
x < max(a, b) -> x < a || x < b
x > max(a, b) -> x > a && x > b
Where 'a' or 'b' is a constant.
Also supports `sext min(...) ...` and `zext min(...) ...`.
Differential Revision: https://reviews.llvm.org/D147990
Florian Hahn [Thu, 6 Jul 2023 13:17:20 +0000 (14:17 +0100)]
[DemandedBits] Print function name when printing analysis.
Include the function name + analysis when printing the analysis for
testing.
Hans Wennborg [Thu, 6 Jul 2023 13:12:42 +0000 (15:12 +0200)]
[docs] Update 'please file a bug' link for clang-cl
Simon Pilgrim [Thu, 6 Jul 2023 11:24:05 +0000 (12:24 +0100)]
[GlobalISel][X86] Regenerate add/sub legalization tests
Nikita Popov [Fri, 30 Jun 2023 13:31:47 +0000 (15:31 +0200)]
[InstSimplify] Fold gep inbounds undef to undef instead of poison
With the semantics change from D154051, it is no longer valid to
fold gep inbounds undef to poison (unless we know the index is
non-zero). Fold it to undef instead.
Differential Revision: https://reviews.llvm.org/D154215
Renato Golin [Thu, 6 Jul 2023 11:03:16 +0000 (12:03 +0100)]
[MLIR][Linalg] Add more arith named ops to linalg (take 2)
Re-apply
eda47fdd258c after implementing __truediv__ for TensorUse.
[MLIR][Linalg] Add more arith named ops to linalg
Following up the 'add' named op, here are the remaining basic arithmetic
and maths, including a 'div_unsigned' for integer unsigned values. In the
same pattern as 'matmul_unsigned', the simply named 'div' assumes signed
values and the '_unsigned' variation handles the unsigned values.
It's a bit odd, but there doesn't seem to be a easy way to restrict to
specific types to make 'div_unsigned' only work with integers in the
structured ops framework.
Same as 'add', these have strict semantics regarding casts.
Unary math ops will need some massaging, so I split these ones for now
as I continue working on them.
Differential Revision: https://reviews.llvm.org/D154524
Amy Kwan [Fri, 30 Jun 2023 16:01:02 +0000 (11:01 -0500)]
[AIX][TLS] Generate optimized local-exec access code sequence using X-Form loads/stores
This patch is a follow up to D149722, D152669 and D153645, where a slightly more
optimized code sequence is generated for 64-bit and 32-bit local-exec accesses
when optimizations are turned on.
Handling is added PPCISelDAGToDAG.cpp in order to check if any D-form loads or
stores that follow an PPCISD::ADD_TLS can be optimized to use an X-Form load or
store. In this particular situation, this allows the ADD_TLS node to be removed
completely.
Differential Revision: https://reviews.llvm.org/D150367
Timm Bäder [Thu, 6 Jul 2023 06:19:38 +0000 (08:19 +0200)]
[clang][Interp][NFC] Move some declarations into the if condition
Timm Bäder [Thu, 6 Jul 2023 06:57:23 +0000 (08:57 +0200)]
[clang][Interp][NFC] Fix some doc comment confusion
These are supposed to be regular comments.
Timm Bäder [Thu, 6 Jul 2023 07:11:17 +0000 (09:11 +0200)]
[clang][Interp][NFC] Take a const Function pointer in Context::Run()
Timm Bäder [Thu, 6 Jul 2023 07:24:13 +0000 (09:24 +0200)]
[clang][Interp][NFC] Make a local variable const
And add some assertions.
Timm Bäder [Thu, 6 Jul 2023 07:37:45 +0000 (09:37 +0200)]
[clang][Interp][NFC] Return a const Descriptor from a getter
They are generally immutable anyway. Also fix some doc comments.
Nikita Popov [Thu, 29 Jun 2023 08:46:44 +0000 (10:46 +0200)]
[LangRef] Always allow getelementptr inbounds with zero offset
Currently, our GEP specification has a special case that makes
gep inbounds (null, 0) legal. This patch proposes to expand this
special case to all gep inbounds (ptr, 0), where ptr is no longer
required to point to an allocated object.
This was previously discussed in some detail at
https://discourse.llvm.org/t/question-about-getelementptr-inbounds-with-offset-0/62533.
The motivation for this change is twofold:
* Rust relies on getelementptr inbounds with zero offset to be
legal for arbitrary pointers to support zero-sized types. The
current rules are unclear on whether this is legal or not
(saying that there is a zero-size "allocated object" at every
address may be consistent with our current rules, but more
clarity is desired here).
* The current semantics require us to drop the inbounds flag
when materializing zero-index GEPs, which is done by some
InstCombine transforms. Preserving the inbounds flag can
substantially improve optimization quality in some cases, as
illustrated in D154055.
As far as I know, the only analysis/transforms affected by this
semantics change are:
* A special-case for comparisons with null in CaptureTracking,
which is fixed by D154054. As far as I can tell, that special
case is not particularly valuable and should be recovered by
other transforms.
* Folding gep inbounds undef, idx to poison. We now need to fold
to undef instead (D154215).
Differential Revision: https://reviews.llvm.org/D154051
Louis Dionne [Mon, 3 Jul 2023 15:02:47 +0000 (11:02 -0400)]
[libc++] Fix thread annotations on shared_mutex and shared_timed_mutex
Based on the comment in https://reviews.llvm.org/D54290#4418958, these
attributes need to be on the top-level functions in order to work
properly. Also, add tests.
Fixes http://llvm.org/PR57035.
Differential Revision: https://reviews.llvm.org/D154354
Alex Bradbury [Thu, 6 Jul 2023 12:34:58 +0000 (13:34 +0100)]
[RISCV][test] Add RV32I and RV64I RUN lines to llvm.frexp.ll
Thanks to D154555, these intrinsics no longer crash when used with a
soft float ABI.
Florian Hahn [Thu, 6 Jul 2023 12:31:44 +0000 (13:31 +0100)]
[LV] Consider if scalar epilogue is required in getMaximizedVFForTarget.
When a scalar epilogue is required, at least one iteration of the scalar loop
has to execute. Adjust ConstTripCount accordingly to avoid picking a max VF
that results in a dead vector loop.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D154261
Felipe de Azevedo Piovezan [Wed, 5 Jul 2023 12:44:52 +0000 (08:44 -0400)]
[lldb][NFC] Remove code duplication in InitOSO
Two identical loops were iterating over different ranges, leading to code
duplication. We replace this by a loop over the concatenation of the ranges.
We also use early returns to avoid deeply nested code and explicitly check for a
condition mentioned in comments.
Differential Revision: https://reviews.llvm.org/D154505
John Brawn [Thu, 6 Jul 2023 10:48:10 +0000 (11:48 +0100)]
Fix compile error in UnresolvedSetTest.cpp, hopefully the last one
This test is failing to compile when LLVM_ENABLE_MODULES=ON due to
NamedDecl being multiply defined. Fix this by avoiding declaring our
own NamedDecl in the test and instead cast a struct of appropriate
size and alignment to NamedDecl.
Eddie Phillips [Thu, 6 Jul 2023 10:48:56 +0000 (11:48 +0100)]
update_mir_test_checks.py - separate different prefix checks
Matches behaviour in update_llc_test_checks.py etc.
Fixes #63112
Differential Revision: https://reviews.llvm.org/D152333
Ivan Kosarev [Thu, 6 Jul 2023 10:22:25 +0000 (11:22 +0100)]
[AMDGPU] Add GlobalISel test coverage for floating-point truncations.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D154527
Marco Elver [Thu, 6 Jul 2023 10:25:47 +0000 (12:25 +0200)]
[compiler-rt] Fix __sanitizer_cpuset size on newer FreeBSD
Current FreeBSD has increased size of cpuset. Match it to not break the
build on newer FreeBSD.
Patch by John F. Carr
Fixes: https://github.com/llvm/llvm-project/issues/63485
Amilendra Kodithuwakku [Thu, 6 Jul 2023 09:45:10 +0000 (10:45 +0100)]
[LLD][ELF] Cortex-M Security Extensions (CMSE) Support
This commit provides linker support for Cortex-M Security Extensions (CMSE).
The specification for this feature can be found in ARM v8-M Security Extensions:
Requirements on Development Tools.
The linker synthesizes a security gateway veneer in a special section;
`.gnu.sgstubs`, when it finds non-local symbols `__acle_se_<entry>` and `<entry>`,
defined relative to the same text section and having the same address. The
address of `<entry>` is retargeted to the starting address of the
linker-synthesized security gateway veneer in section `.gnu.sgstubs`.
In summary, the linker translates input:
```
.text
entry:
__acle_se_entry:
[entry_code]
```
into:
```
.section .gnu.sgstubs
entry:
SG
B.W __acle_se_entry
.text
__acle_se_entry:
[entry_code]
```
If addresses of `__acle_se_<entry>` and `<entry>` are not equal, the linker
considers that `<entry>` already defines a secure gateway veneer so does not
synthesize one.
If `--out-implib=<out.lib>` is specified, the linker writes the list of secure
gateway veneers into a CMSE import library `<out.lib>`. The CMSE import library
will have 3 sections: `.symtab`, `.strtab`, `.shstrtab`. For every secure gateway
veneer <entry> at address `<addr>`, `.symtab` contains a `SHN_ABS` symbol `<entry>` with
value `<addr>`.
If `--in-implib=<in.lib>` is specified, the linker reads the existing CMSE import
library `<in.lib>` and preserves the entry function addresses in the resulting
executable and new import library.
Reviewed By: MaskRay, peter.smith
Differential Revision: https://reviews.llvm.org/D139092
Haojian Wu [Mon, 3 Jul 2023 09:49:13 +0000 (11:49 +0200)]
[llvm][Support] Deprecate llvm::writeFileAtomically API
We're in favor of the llvm::writeToOutput API, and all
writeFileAtomically usages have been migrated to writeToOutput.
Differential Revision: https://reviews.llvm.org/D153740
Matthias Springer [Thu, 6 Jul 2023 10:20:03 +0000 (12:20 +0200)]
[mlir][linalg][transform] Fix Python build
This should have been part of D154585.
Lorenzo Chelini [Wed, 5 Jul 2023 13:11:22 +0000 (15:11 +0200)]
[MLIR][Linalg] Expose `packMatmulGreedily` in `Transforms.h` (NFC)
Make the transformation accessible to other drivers (i.e., passes).
Simon Pilgrim [Thu, 6 Jul 2023 09:55:49 +0000 (10:55 +0100)]
[X86] Fold BITOP(PACKSS(X,Z),PACKSS(Y,W)) --> PACKSS(BITOP(X,Y),BITOP(Z,W)) (REAPPLIED)
Fold allsignbits pack patterns to make better use of cheap (and commutable) logic ops
Reapplied after
a32d14fd4c0a /
156913cb7764 with bitcast fix
Simon Pilgrim [Thu, 6 Jul 2023 09:45:41 +0000 (10:45 +0100)]
[X86] Add base SSE2 i686 test coverage to vector bitlogic reduction tests
Simon Pilgrim [Thu, 6 Jul 2023 09:37:24 +0000 (10:37 +0100)]
[X86] Add base SSE2 i686 test coverage to vector bool reduction tests
Matthias Springer [Thu, 6 Jul 2023 09:31:33 +0000 (11:31 +0200)]
[mlir][linalg][transform] Fix TileOp builder
The TileOp builders did not set `scalable_sizes`, which produces invalid ops. `scalable_sizes` must contain as any booleans as there are sizes.
Differential Revision: https://reviews.llvm.org/D154585
Haojian Wu [Thu, 6 Jul 2023 08:56:08 +0000 (10:56 +0200)]
[include-cleaner] Add an IgnoreHeaders flag to the command-line tool.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D153340
Gedare Bloom [Thu, 6 Jul 2023 09:13:22 +0000 (02:13 -0700)]
[clang-format] Fix align consecutive declarations over function pointers
Fixes a bug that prevents alignment from proceeding through a function
pointer in a list of declarations.
Fixes #63451.
Differential Revision: https://reviews.llvm.org/D153585
Dmitri Gribenko [Wed, 5 Jul 2023 11:08:46 +0000 (13:08 +0200)]
[docs] Remove incorrect markup in a code block
Gedare Bloom [Thu, 6 Jul 2023 08:36:31 +0000 (01:36 -0700)]
[clang-format] Fix RAS reference alignment when PAS is left or middle
Fixes a bug with the handling of right aligned references with left/middle
alignment pointers.
Fixes #63452.
Differential Revision: https://reviews.llvm.org/D153579
David Spickett [Tue, 4 Jul 2023 08:10:59 +0000 (08:10 +0000)]
[lldb] Fix crash when completing register names after program exit
Previously the following would crash:
(lldb) run
Process 2594053 launched: '/tmp/test.o' (aarch64)
Process 2594053 exited with status = 0 (0x00000000)
(lldb) register read <tab>
As the completer assumed that the execution context would always
have a register context. After a program has finished, it does not.
Split out the generic parts of the test from the x86 specific tests,
and added "register info" to both.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D154413
Craig Topper [Thu, 6 Jul 2023 08:14:02 +0000 (01:14 -0700)]
[RISCV] Use 'long' in aes64 Zknd/Zkne builtin tests. NFC
This matches the data type of the intrinsics. This case be seen
from the removal of sext and trunc instructions from the IR.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D154572
Craig Topper [Thu, 6 Jul 2023 07:55:16 +0000 (00:55 -0700)]
[RISCV] Add trunc instruction to the __builtin_riscv_ctz_64/__builtin_riscv_clz_64 IR.
These builtins were recently changed to return 'int' like the
similar __builtin_clz/__builtin_ctz builtins, but the IR generation
was not updated to use a truncate.
Job Noorman [Thu, 6 Jul 2023 07:28:13 +0000 (09:28 +0200)]
[JITLink][RISCV] Move relax to PostAllocationPasses
`JITLinkContext` is notified (using `notifyResolved`) of the final
symbol addresses after allocating memory and running the post-allocation
passes. However, linker relaxation, which can cause symbol addresses to
change, was run during the pre-fixup passes. This causes users of
JITLink (e.g., ORC) to pick-up wrong symbol addresses when linker
relaxation was enabled.
This patch fixes this by running relaxation during the post-allocation
passes.
Fixes #63671
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D154501
Andrzej Warzynski [Wed, 5 Jul 2023 15:45:43 +0000 (16:45 +0100)]
[mlir][linalg] Vectorize 0-d tensor extract
This patch adds the missing logic to vectorise `tensor.extract` for 0-d
tensors.
Fixes #63688
Differential Revision: https://reviews.llvm.org/D154518
Craig Topper [Thu, 6 Jul 2023 07:20:43 +0000 (00:20 -0700)]
[RISCV] Use 'int' for return type for clz_64/clo_64 tests in riscv64-xtheadbb.c. NFC
This matches the definition for the underlying builtins and what
is done in the Zbb test.
esmeyi [Thu, 6 Jul 2023 07:16:10 +0000 (03:16 -0400)]
[AIX] make integrated-as as default on AIX.
Summary: Clang uses LLVM's integrated assembler by default on most targets, however non-integrated-as mode is default on AIX. Currently integrated-as mode on AIX has passed tests of LLVM test-suite, bootstrap and Spec2017, therefore this patch sets integrated-as as the default assembler mode on AIX.
Reviewed By: DiggerLin
Differential Revision: https://reviews.llvm.org/D150758
Nikita Popov [Thu, 6 Jul 2023 06:56:03 +0000 (08:56 +0200)]
[ModRef] Use enum class for IRMemLocation (NFC)
As reported at https://reviews.llvm.org/D153305#4475840.
Serge Pavlov [Thu, 6 Jul 2023 05:27:28 +0000 (12:27 +0700)]
[AIX][clang][tests] XFail PCH/late-parsed-instantiations.cpp
The issue: https://github.com/llvm/llvm-project/issues/63704
XChy [Thu, 6 Jul 2023 05:44:56 +0000 (00:44 -0500)]
[InstCombine] Transform (A > 0) | (A < 0) -> zext (A != 0) fold
[InstCombine] Transform (A > 0) | (A < 0) -> zext (A != 0) fold
This extends **foldCastedBitwiseLogic** to handle the similar cases.
Actually, for `(A > B) | (A < B)`, when B != 0, it can be optimized to `zext( A != B )` by **foldAndOrOfICmpsUsingRanges**.
However, when B = 0, **transformZExtICmp** will transform `zext(A < 0) to i32` into `A << 31`,
which cannot be optimized by **foldAndOrOfICmpsUsingRanges**.
Because I'm new to LLVM and has no concise knowledge about how LLVM decides the order of optimization,
I choose to extend **foldCastedBitwiseLogic** to fold `( A << (X - 1) ) | ((A > 0) zext to iX) -> (A != 0) zext to iX`.
And the equivalent fold follows:
```
A << (X - 1) ) | ((A > 0) zext to iX
-> A < 0 | A > 0
-> (A != 0) zext to iX
```
It's proved by [[https://alive2.llvm.org/ce/z/33HzjE|alive-tv]]
Related issue:
[[https://github.com/llvm/llvm-project/issues/62586 | (a > b) | (a < b) is not simplified only for the case b=0 ]]
Reviewed By: goldstein.w.n
Differential Revision: https://reviews.llvm.org/D154126
XChy [Thu, 6 Jul 2023 05:44:56 +0000 (00:44 -0500)]
[InstCombine] Add tests for (A > 0) | (A < 0) -> zext (A != 0) fold (NFC)
Tests for an upcoming (A > 0) | (A < 0) -> zext (A != 0) fold.
Related issue:
[[ https://github.com/llvm/llvm-project/issues/62586 | (a > b) | (a < b) is not simplified only for the case b=0 ]]
Differential Revision: https://reviews.llvm.org/D154089