Nikita Popov [Tue, 17 Jan 2023 11:59:54 +0000 (12:59 +0100)]
[Release] Produce mlir tarball
MLIR supports standalone builds, so I think it makes sense to also
produce a release tarball for the MLIR subproject.
Differential Revision: https://reviews.llvm.org/D141919
Nikita Popov [Wed, 14 Dec 2022 12:41:10 +0000 (13:41 +0100)]
[AsmParser] Remove typed pointer auto-detection
IR is now always parsed in opaque pointer mode, unless
-opaque-pointers=0 is explicitly given. There is no automatic
detection of typed pointers anymore.
The -opaque-pointers=0 option is added to any remaining IR tests
that haven't been migrated yet.
Differential Revision: https://reviews.llvm.org/D141912
wanglei [Wed, 18 Jan 2023 08:50:32 +0000 (16:50 +0800)]
Revert "[JITLink] Add an initial implementation of JITLink for ELF/LoongArch"
This reverts commit
28b6f38d0a841451af7b4893368543382dd5e630.
This breaks on LoongArch64 bot.
https://lab.llvm.org/staging/#/builders/236/builds/896
Nikita Popov [Wed, 18 Jan 2023 08:48:31 +0000 (09:48 +0100)]
Revert "[BitcodeReader] Allow reading pointer types from old IR"
This reverts commit
b56df190b01335506ce30a4559d880da76d1a181.
The unit tests are implemented in a way that requires support for
writing typed pointer bitcode, which is going away soon. Please
rewrite it in a way that not have requirement, e.g. by shipping
pre-compiled bitcode, as we do for integration tests.
Sergey Kachkov [Mon, 16 Jan 2023 14:43:35 +0000 (17:43 +0300)]
[GVN][NFC] Add pre-commit tests for non-local load cases (D141680)
Add test cases when load is non-local for select dependency, but can be
found in extended BB (chain of blocks with single predecessor). Check
that type of found load is the same.
Pierre van Houtryve [Thu, 12 Jan 2023 08:52:33 +0000 (03:52 -0500)]
[CodeGen] Prevent overlapping subregs in getCoveringSubRegIndexes
If `getCoveringSubRegIndexes` returns a set of subregister indexes where some subregisters overlap others, it can create unsatisfiable copy bundles that eventually cause VirtRegRewriter to error out due to "cycles in copy bundle".
We can simply prevent this by making the algorithm skip over subregisters indexes that would cause an overlap with already-covered lanes.
Note that in the case of AMDGPU, this problem is caused by the lack of subregisters indexes for 13/14/15-register tuples. We have everything up until 12, then we have 16 and 32 but nothing between 12 and 16.
This means that the best candidate to do the least amount of copies when splitting a 29-register tuple was to copy (e.g.) 0-15 and 14-29, causing an overlap.
With this change, getCoveringSubRegIndexes will now prefer using something like 0-15, 16-28 and 1
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D141576
Pierre van Houtryve [Tue, 17 Jan 2023 08:50:29 +0000 (03:50 -0500)]
[AMDGPU] Precommit test for D141576
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D141903
Nikita Popov [Wed, 18 Jan 2023 08:45:25 +0000 (09:45 +0100)]
[LowerIFunc] Remove typed pointer test (NFC)
Kirill Stoimenov [Wed, 18 Jan 2023 07:50:27 +0000 (23:50 -0800)]
[HWASAN] Add leak sanitizer flag support
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D141710
Vitaly Buka [Wed, 18 Jan 2023 07:40:30 +0000 (23:40 -0800)]
[HWASA] Restore LsanMetadata from D141642 Diff5
Unlike asan, we can't use pointer arithmetics to get from user ptr to
metadata. Asan does not use CombinedAllocator::GetMetadata and store
metadata next to the user data.
Konstantin Varlamov [Wed, 18 Jan 2023 06:45:46 +0000 (22:45 -0800)]
[libc++][ranges] Mark completed Ranges papers and issues as done, bump version macro
All C++20 Ranges papers and LWG issues are done, with the exception of
https://wg21.link/P2210R2 ("Superior String Splitting"), and marked as
such.
All of these were already implemented prior to this patch except bumping
the feature test macro `__cpp_lib_ranges` as required by
https://wg21.link/P2325R3 ("Views should not be required to be default
constructible"). Note that, even though P2325R3 was voted into C++23, it
was voted with a recommendation for vendors to retroactively apply the
change to C++20 (see https://github.com/cplusplus/papers/issues/1007).
Differential Revision: https://reviews.llvm.org/D139900
LLVM GN Syncbot [Wed, 18 Jan 2023 06:35:55 +0000 (06:35 +0000)]
[gn build] Port
28b6f38d0a84
Arthur Eubanks [Wed, 18 Jan 2023 06:31:56 +0000 (22:31 -0800)]
Revert "Diagnose extensions in 'offsetof'"
This reverts commit
f1f0a0d8e8fdd2e534d9423b2e64c6b8aaa53aee.
Causes crashes on
$ echo 'typedef int a; void c() { __builtin_offsetof(struct {a b}, b); }' | bin/clang -cc1 -emit-llvm -o /dev/null - -x c
Arthur Eubanks [Wed, 18 Jan 2023 06:31:25 +0000 (22:31 -0800)]
Revert "nullptr returned from ActOnTag() is not a valid result"
This reverts commit
3925fbc80019f72bf3f5174736f348acfb5768b0.
Dependent commit to be reverted.
wangpc [Wed, 18 Jan 2023 06:24:45 +0000 (14:24 +0800)]
[RISCV][NFC] Use uncompressInst to relax instructions
As the TODO said, we can just use generated uncompressInst to
relax instructions.
Reviewed By: craig.topper, kito-cheng
Differential Revision: https://reviews.llvm.org/D141834
wangpc [Wed, 18 Jan 2023 06:24:23 +0000 (14:24 +0800)]
[RISCV][NFC] Move compressInst/uncompressInst to RISCVBaseInfo
We have several usages of compressInst/uncompressInst in different
files, which results in duplicated code. We move their implementations
to RISCVBaseInfo under namespace RISCVRVC to remove these duplications.
Reviewed By: craig.topper, asb
Differential Revision: https://reviews.llvm.org/D141897
wangpc [Wed, 18 Jan 2023 06:24:03 +0000 (14:24 +0800)]
[TableGen][NFC] Add postfix for validators of CompressPat
So that we won't get redefinition errors if we use compressInst
and uncompressInst in the same file.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D141896
wanglei [Tue, 17 Jan 2023 07:10:00 +0000 (15:10 +0800)]
[JITLink] Add an initial implementation of JITLink for ELF/LoongArch
This implementation supports basic relocation types and adds EHFrame,
Got/Plt handling passes.
This patch also enables JIT support for LoongArch64.
With this patch, I successfully run hello.ll and simple_throw.ll
(which is generated from test-suite/SingleSource/Regression/C++/EH/simple_throw.cpp)
using the `lli` command with options `--jit-kind=orc --jit-linker=jitlink`.
Note: `hasJIT` property of LoongArch32 remains false as there is no
validation environment.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D141036
Chuanqi Xu [Tue, 17 Jan 2023 09:05:52 +0000 (17:05 +0800)]
[Serialization] Serialize the new added FunctionDeclBits: IsIneligibleOrNotSelected
Close https://github.com/llvm/llvm-project/issues/59719.
The root cause of the problem is that we forgot to serialize a new
introduced bit to FunctionDeclBits. Maybe we need to find some methods
to work for detecting this.
Jake Egan [Wed, 18 Jan 2023 05:55:16 +0000 (00:55 -0500)]
[NFC] Disable test on AIX due to different default output
Previous attempt to stop this test from running on AIX didn't work,
so revert it and require not system-aix instead.
This reverts commit
b1ac375e11c801be2a1e07e87be91ae54decf2eb.
Arthur Eubanks [Wed, 18 Jan 2023 06:13:29 +0000 (22:13 -0800)]
[gn build] Manually port e022ca8
Amir Ayupov [Tue, 10 Jan 2023 02:07:26 +0000 (18:07 -0800)]
[perf-training] Check extension in findFilesWithExtension
`findFilesWithExtension` helper checks for `endswith(extension)` instead of
exactly matching the file extension. This causes it to match unrelated files,
for example, `.profdata` files while matching `.fdata` files:
http://157.230.108.44:8011/#/builders/56/builds/247
```
Merging data from /worker/worker/bolt-x86_64-ubuntu-clang-bolt-gcc/build/tools/clang/prof.fdata.1124569.fdata...
Merging data from /worker/worker/bolt-x86_64-ubuntu-clang-bolt-gcc/build/tools/clang/test/Frontend/Output/optimization-remark-with-hotness-new-pm.c.tmp.profdata...
```
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D141342
Slava Zakharin [Wed, 18 Jan 2023 03:25:23 +0000 (19:25 -0800)]
[mlir] Fixed memory leak after D141726.
Reported in https://lab.llvm.org/buildbot/#/builders/5/builds/30788
Differential Revision: https://reviews.llvm.org/D141985
Matt Arsenault [Tue, 22 Nov 2022 21:55:44 +0000 (16:55 -0500)]
llvm-reduce: Reduce ifuncs
Reduce by calling the resolver function at the use site, and inserting
an indirect call. Try to delete if there are no uses left over.
We should also probably try to do something about constantexpr uses;
perhaps treat them like aliases.
Matt Arsenault [Fri, 2 Dec 2022 00:02:18 +0000 (19:02 -0500)]
Utils: Add utility pass to lower ifuncs
Create a global constructor which will initialize a global table of
function pointers. For now, this is only used as a reduction technique
for llvm-reduce.
In the future this may be useful to support ifunc on systems where the
program loader doesn't natively support it.
Matt Arsenault [Wed, 18 Jan 2023 00:14:16 +0000 (19:14 -0500)]
llvm-reduce: Simplify async usage by avoiding lambda
Use the variadic template form to avoid naming all the
parameters twice.
Matt Arsenault [Sat, 14 Jan 2023 21:37:46 +0000 (16:37 -0500)]
llvm-reduce: Use StringRef/ArrayRef
Matt Arsenault [Sat, 14 Jan 2023 20:15:44 +0000 (15:15 -0500)]
llvm-reduce: Add missing consts
Vitaly Buka [Wed, 18 Jan 2023 03:21:17 +0000 (19:21 -0800)]
[hwasan] Fix LsanMetadata::LsanMetadata
Nadeem, Usman [Wed, 18 Jan 2023 02:53:51 +0000 (18:53 -0800)]
[Flang] Fix parsing error on loop count compiler directive
Fixes: https://github.com/llvm/llvm-project/issues/58731
Fixes: https://github.com/llvm/llvm-project/issues/56678
Only handles this form which was reported: `!DIR$ LOOP COUNT (n1[, n2]...)`
Differential Revision: https://reviews.llvm.org/D141976
Change-Id: I768c8cb9f289c5fc4adee1ef8262c6d827574f27
chendewen [Wed, 18 Jan 2023 03:02:46 +0000 (11:02 +0800)]
[AArch64][SVE] Add more intrinsics in 'isZeroingInactiveLanes'.
The REINTERPRET_CAST operation generates redundant and and ptrue instructions.
For some instructions, this is redundant, because its inactive lanes are zeroed by construction.
For example. Codegen before:
```
facgt p2.d, p0/z, z4.d, z1.d
ptrue p1.d
and p1.b, p2/z, p2.b, p1.b
```
After:
```
facgt p1.d, p0/z, z4.d, z1.d
```
ref: https://reviews.llvm.org/D129851
Reviewed By:sdesmalen,paulwalker-arm
Differential Revision:https://reviews.llvm.org/D141469
Manish Gupta [Tue, 17 Jan 2023 23:22:30 +0000 (15:22 -0800)]
Add NVGPUUtil bazel lib
Chuanqi Xu [Mon, 16 Jan 2023 07:51:29 +0000 (15:51 +0800)]
[C++20] [Modules] Deprecate `-fmodules-ts` flag
Close https://github.com/llvm/llvm-project/issues/60060
Reviewed By: aaron.ballman, erichkeane
Differential Revision: https://reviews.llvm.org/p/erichkeane/
Craig Topper [Wed, 18 Jan 2023 02:04:55 +0000 (18:04 -0800)]
[RISCV] Eliminate the need to pass both RISCVSubtarget and MCSubtargetInfo to isCompressibleInst.
RISCVSubtarget should be a superclass of MCSubtargetInfo so should
have all the same information. Now we pass RISCVSubtarget by
reference and name it STI.
Confusingly, we seem to have been using an MCSubtargetInfo from
the TargetMachine rather than the one associated with the function
we are operating. I'm going to assume that was a mistake and not
intentional.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D141966
Chuanqi Xu [Thu, 12 Jan 2023 08:23:46 +0000 (16:23 +0800)]
[C++] [Coroutines] Deprecates the '-fcoroutines-ts' flag
According to https://github.com/llvm/llvm-project/issues/59110, the
`-fcoroutines-ts` flag should be deprecated.
Reviewed By: aaron.ballman, philnik
Differential Revision: https://reviews.llvm.org/D141572
Jan Korous [Wed, 18 Jan 2023 01:51:37 +0000 (17:51 -0800)]
[-Wunsafe-buffer-usage][NFC] Refactor checkUnsafeBufferUsage
Differential Revision: https://reviews.llvm.org/D141333
Kirill Stoimenov [Wed, 18 Jan 2023 00:50:48 +0000 (16:50 -0800)]
[HWASAN] Implemented LSAN SetLsanTag and IgnoreObjectLocked
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D141642
Jordan Rupprecht [Wed, 18 Jan 2023 01:16:36 +0000 (17:16 -0800)]
[NFC][bazel] Add export_files for utils/textmate/mlir.json
Nikolas Klauser [Tue, 17 Jan 2023 21:48:00 +0000 (22:48 +0100)]
[libc++][NFC] Split up ranges.transform.pass.cpp
`ranges.transform.pass.cpp` takes ~42s to run on my machine, `ranges.transform.binary.pass.cpp` takes ~26s and `ranges.transform.unary.pass.cpp` takes ~2s.
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D141965
Florian Mayer [Fri, 13 Jan 2023 19:15:37 +0000 (11:15 -0800)]
[NFC] [scudo] syntax-check DCHECK arguments if DCHECK is off
This is a widespread technique, used in at least:
* ABSL: https://github.com/abseil/abseil-cpp/blob/master/absl/log/internal/check_op.h#L52
* Chromium: https://source.chromium.org/chromium/chromium/src/+/main:base/check.h;l=185?q=DCHECK%20f:base&ss=chromium
* Android: https://cs.android.com/android/platform/superproject/+/master:system/libbase/include/android-base/logging.h;drc=
bda7f0a0cc945c860713a1dc497919f17fad1651;l=321
Reviewed By: Chia-hungDuan, vitalybuka
Differential Revision: https://reviews.llvm.org/D141713
Rashmi Mudduluru [Wed, 18 Jan 2023 00:28:23 +0000 (16:28 -0800)]
[-Wunsafe-buffer-usage] Emit warnings about unsafe operations on arrays
Differential Revision: https://reviews.llvm.org/D141725/new/
Florian Mayer [Tue, 17 Jan 2023 21:51:29 +0000 (13:51 -0800)]
[HWASan] link to doc in reports on Android
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D141973
Giorgis Georgakoudis [Tue, 17 Jan 2023 23:35:44 +0000 (15:35 -0800)]
[OpenMP] Support kernel record and replay
This patch adds functionality for recording and replaying the execution of OpenMP offload kernels, based on an original implementation by Steve Rangel. The patch extends libomptarget to extract a json description of the kernel, the device image binary, and a device memory snapshot before and after the execution of a recorded kernel. Kernel recording/replaying in libomptarget is controlled through env vars (LIBOMPTARGET_RECORD, LIBOMPTARGET_REPLAY). It provides a tool, llvm-omp-kernel-replay, for replaying a kernel using the extracted information with the ability to verify replayed execution using the post-execution device memory snapshot, also supporting changing the number of teams/threads for replaying.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D138931
Mircea Trofin [Tue, 17 Jan 2023 21:57:02 +0000 (13:57 -0800)]
[nfc][mlgo] Remove abstraction layers for training logger
This follows from D141720
Differential Revision: https://reviews.llvm.org/D141967
Anshil Gandhi [Tue, 17 Jan 2023 21:34:27 +0000 (14:34 -0700)]
[MachineBasicBlock] Explicit FT branching param
Introduce a parameter in getFallThrough() to optionally
allow returning the fall through basic block in spite of
an explicit branch instruction to it. This parameter is
set to false by default.
Introduce getLogicalFallThrough() which calls
getFallThrough(false) to obtain the block while avoiding
insertion of a jump instruction to its immediate successor.
This patch also reverts the changes made by D134557 and
solves the case where a jump is inserted after another jump
(branch-relax-no-terminators.mir).
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D140790
Arthur Eubanks [Tue, 17 Jan 2023 23:40:49 +0000 (15:40 -0800)]
Revert ""Reland "[pgo] Avoid introducing relocations by using private alias""
This reverts commit
6e5cbc097a5ac7fa95a8f425af8b03958151c763.
Causes link errors, see http://go/crb/1408161.
Mircea Trofin [Tue, 17 Jan 2023 23:14:30 +0000 (15:14 -0800)]
Fix OSX build break introduced by D141720
Rahman Lavaee [Wed, 7 Dec 2022 06:37:33 +0000 (22:37 -0800)]
[Propeller] Use Fixed MBB ID instead of volatile MachineBasicBlock::Number.
Let Propeller use specialized IDs for basic blocks, instead of MBB number.
This allows optimizations not just prior to asm-printer, but throughout the entire codegen.
This patch only implements the functionality under the new `LLVM_BB_ADDR_MAP` version, but the old version is still being used. A later patch will change the used version.
####Background
Today Propeller uses machine basic block (MBB) numbers, which already exist, to map native assembly to machine IR. This is done as follows.
- Basic block addresses are captured and dumped into the `LLVM_BB_ADDR_MAP` section just before the AsmPrinter pass which writes out object files. This ensures that we have a mapping that is close to assembly.
- Profiling mapping works by taking a virtual address of an instruction and looking up the `LLVM_BB_ADDR_MAP` section to find the MBB number it corresponds to.
- While this works well today, we need to do better when we scale Propeller to target other Machine IR optimizations like spill code optimization. Register allocation happens earlier in the Machine IR pipeline and we need an annotation mechanism that is valid at that point.
- The current scheme will not work in this scenario because the MBB number of a particular basic block is not fixed and changes over the course of codegen (via renumbering, adding, and removing the basic blocks).
- In other words, the volatile MBB numbers do not provide a one-to-one correspondence throughout the lifetime of Machine IR. Profile annotation using MBB numbers is restricted to a fixed point; only valid at the exact point where it was dumped.
- Further, the object file can only be dumped before AsmPrinter and cannot be dumped at an arbitrary point in the Machine IR pass pipeline. Hence, MBB numbers are not suitable and we need something else.
####Solution
We propose using fixed unique incremental MBB IDs for basic blocks instead of volatile MBB numbers. These IDs are assigned upon the creation of machine basic blocks. We modify `MachineFunction::CreateMachineBasicBlock` to assign the fixed ID to every newly created basic block. It assigns `MachineFunction::NextMBBID` to the MBB ID and then increments it, which ensures having unique IDs.
To ensure correct profile attribution, multiple equivalent compilations must generate the same Propeller IDs. This is guaranteed as long as the MachineFunction passes run in the same order. Since the `NextBBID` variable is scoped to `MachineFunction`, interleaving of codegen for different functions won't cause any inconsistencies.
The new encoding is generated under the new version number 2 and we keep backward-compatibility with older versions.
####Impact on Size of the `LLVM_BB_ADDR_MAP` Section
Emitting the Propeller ID results in a 23% increase in the size of the `LLVM_BB_ADDR_MAP` section for the clang binary.
Reviewed By: tmsriram
Differential Revision: https://reviews.llvm.org/D100808
Craig Topper [Tue, 17 Jan 2023 23:15:41 +0000 (15:15 -0800)]
[RISCV] Use zeroext instead of signext in mask reduction tests. NFC
This is more consistent with ABI and how bools on RISC-V are
represented.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D141963
Nikolas Klauser [Tue, 17 Jan 2023 02:54:32 +0000 (03:54 +0100)]
[libc++] Add ALLOW_RETRIES to a few flaky tests
Fixes #59464
Reviewed By: ldionne, Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D141885
Zibi Sarbinowski [Tue, 17 Jan 2023 22:34:43 +0000 (16:34 -0600)]
[SystemZ][z/OS] Fix cityhash lit for EBCDIC
This will fix __murmur2_or_cityhash.pass.cpp in EBCDIC mode. The reason it fails is because of string literals are being used as input to CityHash algorithm so we need to adjust the EBCDIC expected results.
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D141623
usama hameed [Wed, 11 Jan 2023 01:54:46 +0000 (17:54 -0800)]
[CompilerRT] Remove sanitizer support for i386 iossim
Summary:
This patch removes building sanitizers for i386 iossim. This is to reduce the toolchain size.
Reviewers:
Subscribers:
usama hameed [Wed, 11 Jan 2023 23:16:30 +0000 (15:16 -0800)]
[CompilerRT] Remove ubsan static runtime on Apple
This patch removes the static ubsan runtime on Apple devices. The motivation
is to reduce the toolchain size.
rdar://
102061519
Differential Revision: https://reviews.llvm.org/D141550
Lang Hames [Tue, 17 Jan 2023 21:45:38 +0000 (13:45 -0800)]
[ORC-RT] Reapply
ab59185fbfb (Add IntervalMap/Set), with missing files included.
The original commit was reverted in
c151e8428a due missing files (thanks Kazu!).
Kazu Hirata [Tue, 17 Jan 2023 21:36:03 +0000 (13:36 -0800)]
Revert "[ORC-RT] Add IntervalMap and IntervalSet collections."
This reverts commit
ab59185fbfb15c9ce5a64e3aacd3a8c7f6a97621.
It looks like this commit is missing interval_set_test.cpp.
Kazu Hirata [Tue, 17 Jan 2023 21:36:02 +0000 (13:36 -0800)]
[Analysis] Fix a warning
This patch fixes:
llvm/include/llvm/Analysis/Utils/TrainingLogger.h:94:14: error:
private field 'IncludeReward' is not used
[-Werror,-Wunused-private-field]
Craig Topper [Tue, 17 Jan 2023 21:35:08 +0000 (13:35 -0800)]
[RISCV][TableGen] Correct formatting in RISCVGenCompressInstEmitter.inc. NFC
Volodymyr Sapsai [Tue, 10 Jan 2023 20:24:07 +0000 (12:24 -0800)]
[clang][sema][Matrix] Move code from try-cast to `TypeLocVisitor`. NFC intended.
`MatrixTypeLoc` is not "sugar" `TypeLoc` and doesn't require to use the
underlying `TypeLoc` instead.
Differential Revision: https://reviews.llvm.org/D141422
Lang Hames [Tue, 17 Jan 2023 01:22:28 +0000 (17:22 -0800)]
[ORC-RT] Add IntervalMap and IntervalSet collections.
IntervalMap is an optionally-coalescing map -- it uses half-open ranges as keys,
allows lookups based on elements of the ranges (returning an iterator to the
containing range) and optionally coalesces adjacent ranges that have the same
value.
IntervalSet is an optionally-coalescing set based on IntervalMap.
These collections will be used to store and lookup metadata section ranges,
e.g. unwind-info ranges.
Kazu Hirata [Tue, 17 Jan 2023 21:12:40 +0000 (13:12 -0800)]
[mlir] Fix a deprecation warning
This patch fixes:
mlir/include/mlir/Dialect/Affine/LoopUtils.h:332:25: error:
'makeMutableArrayRef<mlir::scf::ForOp>' is deprecated: Use deduction
guide instead [-Werror,-Wdeprecated-declarations]
Mircea Trofin [Fri, 13 Jan 2023 20:22:20 +0000 (12:22 -0800)]
[mlgo] Remove the protobuf dependency
The dependency was due to the log format. This change switches to the
previously-introduced (D139370) "dependency-free" logger instead of the
protobuf-based one.
A subsequent change will clean out the unnecessary abstraction left
behind.
This change drops the logger unittest, we have sufficient test coverage
via lit tests, and a unit test would require adding, unnecesarily, a log
reader (the reader is expected to be python, for the ML side, and there
is a reader for that under Analysis/models, used for tests).
Differential Revision: https://reviews.llvm.org/D141720
Florian Hahn [Tue, 17 Jan 2023 21:11:32 +0000 (21:11 +0000)]
[VPlan] Replace VPExpandSCEVRecipe::classof with VP_CLASSOF_IMPL. (NFC)
Nikolas Klauser [Mon, 16 Jan 2023 18:26:53 +0000 (19:26 +0100)]
[libc++] Mark std::pmr virtual functions as _LIBCPP_HIDE_FROM_ABI_VIRTUAL
Reviewed By: ldionne, Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D141864
Aaron Ballman [Tue, 17 Jan 2023 21:00:46 +0000 (16:00 -0500)]
nullptr returned from ActOnTag() is not a valid result
DeclResult tracks two states: valid/invalid and usable/unusable.
Passing a null pointer to the constructor creates a valid but unusable
result and we wanted an invalid result instead. This changes some
functions to return a DeclResult rather than a Decl * to make it harder
to get this incorrect in callers.
Discovered when working on https://reviews.llvm.org/D141280.
Co-authored-by: Haojian Wu <hokein@google.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Differential Revision: https://reviews.llvm.org/D141580
Kazu Hirata [Tue, 17 Jan 2023 21:01:22 +0000 (13:01 -0800)]
[mlir] Fix a warning
This patch fixes:
mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp:820:13:
error: unused function 'hasAtMostOneResultFunctionOfDim'
[-Werror,-Wunused-function]
Craig Topper [Tue, 17 Jan 2023 20:46:11 +0000 (12:46 -0800)]
[RISCV] Add missing check prefixes to vreductions-mask.ll. NFC
There's a conflict between the riscv32 and riscv64 output for some
tests which caused the script to drop the check lines.
Add specific check prefixes for these cases.
Peiming Liu [Tue, 17 Jan 2023 19:25:40 +0000 (19:25 +0000)]
[mlir][sparse] avoid using mutable descriptor when unnecessary (NFC)
Use SparseTensorDescriptor whenever not calling setters, to avoid needing to create a temporal buffer for simple query purposes.
Reviewed By: bixia, wrengr
Differential Revision: https://reviews.llvm.org/D141953
Florian Hahn [Tue, 17 Jan 2023 20:53:13 +0000 (20:53 +0000)]
[VPlan] Replace VPScalarIVStepsRecipe::classof with VP_CLASSOF_IMPL(NFC)
Roy Jacobson [Sun, 15 Jan 2023 22:39:15 +0000 (00:39 +0200)]
[Clang] Reject in-class defaulting of previously declared comparison operators
Comparison operators are not allowed to be defaulted if they were previously declared outside the class.
Pretty low-impact, but it's nice to reject this without a linking error.
Fixes https://github.com/llvm/llvm-project/issues/51227.
Reviewed By: #clang-language-wg, ChuanqiXu
Differential Revision: https://reviews.llvm.org/D141803
Joseph Huber [Tue, 17 Jan 2023 20:09:12 +0000 (14:09 -0600)]
[Libomptarget][NFC] Rename device environment variable
This variable is used by the runtime. Before kernel launch we set it to
indicate several configuration options from the host. This patch renames
it to be more in-line with the rest of the named exported from the
runtime. This is better because this is the only symbol visible to the
host from the runtime, so it should have a reserved name.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D141960
Joseph Huber [Tue, 17 Jan 2023 20:25:29 +0000 (14:25 -0600)]
[Clang] Configure definitions for amdgpu/nvptx arch query tools
Summary:
These tools are built unconditionally now. However, there seemed to be
problems where the headers would be found during cross compilation, but
no libraries present. To combat this we should elect to make the CMake
indicate whether or not we should use the dynamic library method or link
it directly rather than using `__has_include`.
Joe Loser [Mon, 16 Jan 2023 21:52:16 +0000 (14:52 -0700)]
[llvm][ADT] Mark `makeMutableArrayRef` as deprecated
Now that all of the uses of `makeMutableArrayRef` are replaced in-tree with use
of deduction guides (see
https://github.com/llvm/llvm-project/commit/
a288d7f937708cf67d960962bfa22ffae37ddbf4),
mark `makeMutableArrayRef` as deprecated.
Also remove the old tests for `makeMutableArrayRef` in favor of the ones
introduced with the deduction guides in
https://github.com/llvm/llvm-project/commit/
38791259c1165cedfa313e06dc20e443f1e20634.
Differential Revision: https://reviews.llvm.org/D141872
Sanjay Patel [Tue, 17 Jan 2023 19:37:18 +0000 (14:37 -0500)]
[InstCombine] factor difference-of-squares to reduce multiplication
(X * X) - (Y * Y) --> (X + Y) * (X - Y)
https://alive2.llvm.org/ce/z/BAuRCf
The no-wrap propagation could be relaxed in some cases,
but there does not seem to be an obvious rule for that.
Sanjay Patel [Tue, 17 Jan 2023 18:32:50 +0000 (13:32 -0500)]
[InstCombine] add tests for difference-of-squares; NFC
Craig Topper [Tue, 17 Jan 2023 19:50:54 +0000 (11:50 -0800)]
[RISCV] Remove MCRegisterInfo dependency from compressInst/uncompresInst/isCompressibleInst.
This was being used to lookup the register class for a register number,
but those live in a tablegened array. We can index that array directly
just like RISCVAsmParser does.
Differential Revision: https://reviews.llvm.org/D141951
Sergei Barannikov [Sun, 15 Jan 2023 10:02:26 +0000 (13:02 +0300)]
[MC] Use MCRegister instead of unsigned in MCInstPrinter (NFC)
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D140654
Craig Topper [Tue, 17 Jan 2023 19:32:08 +0000 (11:32 -0800)]
[RISCV] Use Zvl*b as a lower bound for VScaleRange.
The backend has a fatal error in RISCVSubtarget::getMinRVVVectorSizeInBits
if RVVVectorBitsMin is less than the Zvl length from -march. Now
RVVVectorBitsMin is connected to VScaleRange in the backend, we
can trip this fatal error.
This patch adds the Zvl*b length as a lower bound to protect this.
The test is updated to test vscale-min with Zvl64b instead of V.
I'd like to do a proper diagnostic for this, but I don't think we
can do that from this function. Since -mvscale-min is an internal cc1
option, I'm not sure it's a big deal.
I'm planning to add a driver option -msve-vector-bits. I will
probably implement a diagnostic for that.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D141459
Aaron Ballman [Tue, 17 Jan 2023 19:26:29 +0000 (14:26 -0500)]
Diagnose extensions in 'offsetof'
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm made very
clear that it is an UB having type definitions with in offsetof.
Clang supports defining a type as the first argument as a conforming
extension due to how many projects use the construct in C99 and earlier
to calculate the alignment of a type. GCC also supports defining a type
as the first argument.
This adds extension warnings and documentation for the functionality
Clang explicitly supports.
Fixes #57065
Co-authored-by: Yingchi Long <i@lyc.dev>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Paul Robinson [Tue, 17 Jan 2023 19:26:51 +0000 (11:26 -0800)]
[PS5] Handle visibility options same as PS4
This update was missed in the initial rounds of upstreaming PS5.
Paul Robinson [Tue, 17 Jan 2023 18:47:07 +0000 (10:47 -0800)]
[PS4] NFC: rewrite a test to use lit's DEFINE feature
Preparatory to running the same test for PS5.
Frederik Gossen [Tue, 17 Jan 2023 19:07:33 +0000 (14:07 -0500)]
[MLIR] Add return type inference to scf.if builder
Differential Revision: https://reviews.llvm.org/D141928
Noah Goldstein [Tue, 17 Jan 2023 18:41:31 +0000 (10:41 -0800)]
Add additional tests for ctlz{_zero_undef} to test folding with xor; NFC
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D141549
Ashay Rane [Tue, 17 Jan 2023 18:55:02 +0000 (10:55 -0800)]
[mlir] fix dereferencing of optional sym_name attribute
`sym_name` is an optional attribute of `ModuleOp`, so it is unsafe to
fetch the underlying value without checking whether it is non-empty.
Such unsafe dereferencing causes the lower-host-to-llvm-calls_fail.mlir
test to segfault. Although this bug existed for four months, it wasn't
triggered, since previous tests executed a code path that used a default
value instead of one fetched from the module attribute.
This patch makes the code use a default value if the optional attribute
does not have a value.
Reviewed By: stella.stamenova
Differential Revision: https://reviews.llvm.org/D141941
Joseph Huber [Tue, 17 Jan 2023 15:34:49 +0000 (09:34 -0600)]
[OpenMP] Make `-Xarch_host` and `-Xarch_device` work for OpenMP offloading
Clang currently supports the `-Xarch_host` and `-Xarch_device` variants
to handle passing arguments to only one part of the offloading
toolchain. This was previously only supported fully for HIP / CUDA This
patch simple updates the logic to make it work for any offloading kind.
Fixes #59799
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D141935
Joseph Huber [Tue, 17 Jan 2023 14:55:55 +0000 (08:55 -0600)]
[Libomptarget] Replace Nvidia arch lookup with 'nvptx-arch'
This method to look up the CUDA architecture is deprecated in newer
versions of CMake. We also have our own way to query this information
that we control now via the `nvptx-arch` program, which should always be
present in LLVM builds with clang going forward. This is currently only
used for testing so I think we should be okay with the dependency.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D141933
Augusto Noronha [Fri, 13 Jan 2023 21:30:41 +0000 (13:30 -0800)]
[lldb] Only allow SymbolFiles to construct Types
SymbolFiles should own Types by keeping them in their TypeList. This
patch privates the Type constructor to guarantee that every created Type
is kept in the SymbolFile's type list.
Mitch Phillips [Fri, 13 Jan 2023 00:01:06 +0000 (16:01 -0800)]
Reland: [GWP-ASan] Add recoverable mode.
The GWP-ASan recoverable mode allows a process to continue to function
after a GWP-ASan error is detected. The error will continue to be
dumped, but GWP-ASan now has APIs that a signal handler (like the
example optional crash handler) can call in order to allow the
continuation of a process.
When an error occurs with an allocation, the slot used for that
allocation will be permanently disabled. This means that free() of that
pointer is a no-op, and use-after-frees will succeed (writing and
reading the data present in the page).
For heap-buffer-overflow/underflow, the guard page is marked as accessible
and buffer-overflows will succeed (writing and reading the data present
in the now-accessible guard page). This does impact adjacent
allocations, buffer-underflow and buffer-overflows from adjacent
allocations will no longer touch an inaccessible guard page. This could
be improved in future by having two guard pages between each adjacent
allocation, but that's out of scope of this patch.
Each allocation only ever has a single error report generated. It's
whatever came first between invalid-free, double-free, use-after-free or
heap-buffer-overflow, but only one.
Reviewed By: eugenis, fmayer
Differential Revision: https://reviews.llvm.org/D140173
Slava Zakharin [Tue, 17 Jan 2023 17:08:43 +0000 (09:08 -0800)]
[flang] Generate TBAA information.
This is initial version of TBAA information generation for Flang
generated IR. The desired behavior is that TBAA type descriptors
are generated for FIR types during FIR to LLVM types conversion,
and then TBAA access tags are attached to memory accessing operations
when they are converted to LLVM IR dialect.
In the initial version the type conversion is not producing
TBAA type descriptors, and all memory accesses are just partitioned
into two sets of box and non-box accesses, which can never alias.
The TBAA generation is enabled by default at >O0 optimization levels.
TBAA generation may also be enabled via `apply-tbaa` option of
`fir-to-llvm-ir` conversion pass. `-mllvm -disable-tbaa` engineering
option allows disabling TBAA generation to override Flang's default
(e.g. when -O1 is used).
SPEC CPU2006/437.leslie3d speeds up by more than 2x on Icelake.
Reviewed By: jeanPerier, clementval
Differential Revision: https://reviews.llvm.org/D141820
Anshil Gandhi [Tue, 17 Jan 2023 17:36:05 +0000 (10:36 -0700)]
[InstCombine] Handle PHI nodes in PtrReplacer
This patch adds on to the functionality implemented
in rG42ab5dc5a5dd6c79476104bdc921afa2a18559cf,
where PHI nodes are supported in the use-def traversal
algorithm to determine if an alloca ever overwritten
in addition to a memmove/memcpy. This patch implements
the support needed by the PointerReplacer to collect
all (indirect) users of the alloca in cases where a PHI
is involved. Finally, a new PHI is defined in the replace
method which takes in replaced incoming values and
updates the WorkMap accordingly.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D136201
Lorenzo Chelini [Tue, 17 Jan 2023 17:47:36 +0000 (18:47 +0100)]
[MLIR][SCF] Fix comment in `TestTilingInterface.cpp` (NFC)
The method is called `tileConsumerAndFuseProducerGreedilyUsingSCFForOp`
and not `tileAndFuseGreedilyUsingSCFForOp`.
Thurston Dang [Thu, 12 Jan 2023 23:18:17 +0000 (23:18 +0000)]
tsan: fix broken aarch64_39/42 mappings and expand them
The aarch64 39- and 42-bit mappings were broken: mappings to meta and shadow were not fully invertible. This CL introduces a working set of mappings, and also increases the size of some app regions:
* aarch64, 39-bit (2^39 == 512GB):
- Low: (Old) 4GB -> (New) 20GB
- Mid: 4GB -> 20GB
- Heap: 4GB -> 12GB
- High: 8GB -> 12GB
* aarch64, 42-bit (2^42 == 4TB):
- Low: 64GB -> 128GB
- Mid: 4GB -> 88GB
- Heap: 64GB -> 192GB
- High: 64GB
Additionally, this CL improves the code comments for all the linux aarch64 mappings.
Differential Revision: https://reviews.llvm.org/D141640
Thomas Raoux [Tue, 17 Jan 2023 17:25:51 +0000 (17:25 +0000)]
[mlir][vector] Fix extract op canonicalization for 0d vector
Fix ExtractOpFromBroadcast when the broadcast source is a 0d vector.
Differential Revision: https://reviews.llvm.org/D141735
Thomas Raoux [Fri, 13 Jan 2023 19:53:56 +0000 (19:53 +0000)]
[mlir][gpu] Improve foreach_thread distribution
Replace Ids with 0 when block dim is 1 when distributing foreach_thread.
Differential Revision: https://reviews.llvm.org/D141718
Thomas Raoux [Tue, 17 Jan 2023 17:05:11 +0000 (17:05 +0000)]
[mlir][vector] Add extra lowering for more transfer_write maps
Add pattern to lower transfer_write with permutation map that are not
permutation of minor identity map.
Differential Revision: https://reviews.llvm.org/D141815
Christopher Bate [Thu, 8 Dec 2022 00:28:27 +0000 (17:28 -0700)]
[mlir][EmitC] Remove Pure trait from `emitc.include`
The op `emitc.include` does not have results and thus will be elided
during canonicalization, which is not correct behavior. This change
removes the 'Pure' trait and adds a canonicalization test.
Reviewed By: jpienaar, marbre
Differential Revision: https://reviews.llvm.org/D141704
Thomas Raoux [Sun, 15 Jan 2023 07:25:00 +0000 (07:25 +0000)]
[mlir][vector] Fix lowering of permutation maps for transfer_write op
The lowering of transfer write permutation maps didn't match the op definition:
https://github.com/llvm/llvm-project/blob/
93ccccb00d9717b58ba93f0942a243ba6dac4ef6/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td#L1476
Fix the lowering and add a case to the integration test in
order to enforce the correct semantic.
Differential Revision: https://reviews.llvm.org/D141801
Alex Brachet [Tue, 17 Jan 2023 17:02:50 +0000 (17:02 +0000)]
[scudo] Fix -Wsign-compare warning
Mehdi Amini [Tue, 17 Jan 2023 08:28:08 +0000 (08:28 +0000)]
Fix crash in LLVM Dialect inliner interface: add support for llvm.return
The LLVM inliner was missing the `handleTerminator` method in the
Dialect interface implementation.
Fixes #60093
Differential Revision: https://reviews.llvm.org/D141901
Mehdi Amini [Tue, 17 Jan 2023 16:20:20 +0000 (16:20 +0000)]
Fix crash in scf.parallel verifier
Fixes #59989
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D141911
Kadir Cetinkaya [Tue, 17 Jan 2023 16:11:02 +0000 (17:11 +0100)]
[clangd] Disable modernize-macro-to-enum tidy check
Check relies on seeing PP-directives from preamble, hence it's unusable.
See https://github.com/clangd/clangd/issues/1464.