platform/upstream/llvm.git
20 months ago[mlir] Use std::optional instead of llvm::Optional (NFC)
Kazu Hirata [Thu, 16 Feb 2023 03:40:10 +0000 (19:40 -0800)]
[mlir] Use std::optional instead of llvm::Optional (NFC)

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

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

20 months ago[RISCV] Make a const member function static. NFC
Craig Topper [Thu, 16 Feb 2023 03:28:39 +0000 (19:28 -0800)]
[RISCV] Make a const member function static. NFC

This function doesn't use any members from the class so it can be
static.

20 months agoUpdate: [RISCV][MC] Add support for experimental zfa extension(FLI instruction not...
Jun Sha (Joshua) [Thu, 16 Feb 2023 01:54:40 +0000 (09:54 +0800)]
Update: [RISCV][MC] Add support for experimental zfa extension(FLI instruction not included)

20 months ago[RISCV][MC] Add support for experimental zfa extension(FLI instruction not included)
Jun Sha (Joshua) [Thu, 16 Feb 2023 01:50:59 +0000 (09:50 +0800)]
[RISCV][MC] Add support for experimental zfa extension(FLI instruction not included)

20 months ago[MC] Remove an unneeded comparison on cast result. NFC
Fangrui Song [Thu, 16 Feb 2023 01:46:45 +0000 (17:46 -0800)]
[MC] Remove an unneeded comparison on cast result. NFC

20 months agoFix bazel build
Pranav Kant [Thu, 16 Feb 2023 01:31:19 +0000 (01:31 +0000)]
Fix bazel build

Fallback from 66b3f4a407316004df11307b92aa603b20c0b349

20 months ago[mlir][sparse] reduce the input size in stress_test.py to make it finish in time.
Peiming Liu [Thu, 16 Feb 2023 01:11:16 +0000 (01:11 +0000)]
[mlir][sparse] reduce the input size in stress_test.py to make it finish in time.

Reviewed By: aartbik

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

20 months ago[debugserver] Initialize logging earlier in the startup sequence
Alex Langford [Wed, 15 Feb 2023 22:18:31 +0000 (14:18 -0800)]
[debugserver] Initialize logging earlier in the startup sequence

Prior to setting up logging, we have uses of RNBLogSTDERR and
RNBLogSTDOUT. These macros will dump to STDERR and STDOUT respectively
if debugserver has a tty. Otherwise, it uses _DNBLog, which will do
nothing if a logging function hasn't been set up. For example, if you
specify a log file that cannot be opened for any reason and you don't
have a tty, you have 0 insight into what happened.

rdar://105473133

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

20 months ago[mlir][sparse] introduce operations to query sparse tensor slice offset/strides at...
Peiming Liu [Tue, 10 Jan 2023 23:46:45 +0000 (23:46 +0000)]
[mlir][sparse] introduce operations to query sparse tensor slice offset/strides at the given dimenion

Reviewed By: aartbik

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

20 months ago[Clang][Driver] Fix integer normalization with KCFI
Sami Tolvanen [Wed, 15 Feb 2023 23:14:20 +0000 (23:14 +0000)]
[Clang][Driver] Fix integer normalization with KCFI

Commit 71c7313f42d2b6063fea09854cf4fc46fd0627e1 added integer
normalization for CFI, but doesn't correctly pass the argument
with -fsanitize=kcfi. Set CfiICallNormalizeIntegers also with
SanitizerKind::KCFI to fix the issue.

20 months ago[LoopReroll] Remove legacy pass (unused in the pipeline)
Fangrui Song [Thu, 16 Feb 2023 00:09:32 +0000 (16:09 -0800)]
[LoopReroll] Remove legacy pass (unused in the pipeline)

Following recent changes to remove non-core legacy passes.

20 months ago[mlir][sparse] support coiteration over sparse tensor slices
Peiming Liu [Wed, 28 Dec 2022 19:53:32 +0000 (19:53 +0000)]
[mlir][sparse] support coiteration over sparse tensor slices

Reviewed By: aartbik

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

20 months agoReland "[hwasan] Add definitions for missing operator delete functions"
Leonard Chan [Wed, 15 Feb 2023 22:34:21 +0000 (22:34 +0000)]
Reland "[hwasan] Add definitions for missing operator delete functions"

Looks like builders were failing for the sized variants of operator
delete. These are hidden behind the __cpp_sized_deallocation macro
which can be defined with -fsized-deallocation.

20 months ago[scudo] Improve the uses of roundUpTo/roundDownTo/isAligned
Chia-hung Duan [Wed, 15 Feb 2023 01:31:49 +0000 (01:31 +0000)]
[scudo] Improve the uses of roundUpTo/roundDownTo/isAligned

The implementations of those functions require the rounding target to be
power-of-two. It's better to add a debugging check to avoid misuse.
Besides, add a general verion of those three to accommadate non
power-of-two cases.

Also change the name to roundUp/roundDown/isAligned

Reviewed By: cferris, cryptoad

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

20 months ago[scudo] Calling iterateOverChunks requires holding lock
Chia-hung Duan [Wed, 15 Feb 2023 01:31:20 +0000 (01:31 +0000)]
[scudo] Calling iterateOverChunks requires holding lock

Ensure the allocator is disabled before visiting all chunks.

Reviewed By: cferris

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

20 months ago[scudo] Add thread-safety annotations on TSD data members
Chia-hung Duan [Wed, 15 Feb 2023 01:30:45 +0000 (01:30 +0000)]
[scudo] Add thread-safety annotations on TSD data members

Ideally, we want to assert that all the operations on
Cache/QuarantineCache always have the `Mutex` acquired. However,
the current architecture of accessing TSD is not easy to cooperate
with the thread-safety analysis because of pointer aliasing. In
alternative, we add the getters for accessing TSD member and attach
proper thread-safety annotations on them.

Reviewed By: cferris

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

20 months ago[LoopFlatten] Inline an external linkage function not in llvm::. NFC
Fangrui Song [Wed, 15 Feb 2023 23:40:34 +0000 (15:40 -0800)]
[LoopFlatten] Inline an external linkage function not in llvm::. NFC

20 months ago[LoopFlatten] Remove legacy pass (unused in the pipeline)
Fangrui Song [Wed, 15 Feb 2023 23:28:16 +0000 (15:28 -0800)]
[LoopFlatten] Remove legacy pass (unused in the pipeline)

Following recent changes to remove non-core legacy passes.

20 months ago[lldb] Remove pydoc import during script interpreter init
Dave Lee [Wed, 15 Feb 2023 22:01:05 +0000 (14:01 -0800)]
[lldb] Remove pydoc import during script interpreter init

The Python script interpreter imports `pydoc` during initialization, but this can be
slow in some cases, and doesn't seem to be necessary any more.

This can be slow because pydoc may execute shell commands (for example `xcrun` on
macOS). The shell commands may have variable performance, depending on their caches and
search space.

The 2012 bug report for the original commit (f71a8399997bfdc1ddeeb30c6a8897554a11c382)
says the following:

> "script help" in lldb pipes the help documentation through less(1) but there's some
> problem with the key handling and often the keys you'd use to move in less (space to
> move down a page, 'q' to quit) are not received by less (they're going to lldb
> instead)

This was resolved at the time by overriding `pydoc`'s pager to be the `plainpager`
function.

I have manually tested `script help(lldb.SBDebugger)` and found no issues with the
pager, including using "space" for paging, "/" for searching, and "q" for quitting.

The presumption is that lldb and/or Python have improved I/O handling that eliminates
the original problem.

The original bug report gave an ~/.lldbinit workaround:

```
script import pydoc; pydoc.pager = pydoc.plainpager
```

Note that calling Python's `help()` will import `pydoc`, but this will only happen for
users who use `help()` from the `script` command.

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

20 months ago[mlir][sparse] disable sparse convolution test cases.
Peiming Liu [Wed, 15 Feb 2023 22:27:39 +0000 (22:27 +0000)]
[mlir][sparse] disable sparse convolution test cases.

These test cases will be re-enabled after new algorithm is implemented.

Reviewed By: aartbik

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

20 months ago[LoopInterchange] Remove legacy pass (unused in the pipeline)
Fangrui Song [Wed, 15 Feb 2023 23:09:29 +0000 (15:09 -0800)]
[LoopInterchange] Remove legacy pass (unused in the pipeline)

Following recent changes to remove non-core legacy passes.

20 months ago[libc][bazel] Add missing dependency for stdlib tests.
Tue Ly [Wed, 15 Feb 2023 23:03:17 +0000 (18:03 -0500)]
[libc][bazel] Add missing dependency for stdlib tests.

20 months ago[mlir][sparse] split sparse concatenate test cases smaller ones.
Peiming Liu [Wed, 15 Feb 2023 22:19:48 +0000 (22:19 +0000)]
[mlir][sparse] split sparse concatenate test cases smaller ones.

To allow a better parallelization.

Reviewed By: aartbik

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

20 months ago[mlir][sparse] adding `SparseTensorType::get{Pointer,Index}Type` methods
wren romano [Wed, 15 Feb 2023 21:31:05 +0000 (13:31 -0800)]
[mlir][sparse] adding `SparseTensorType::get{Pointer,Index}Type` methods

Depends On D143800

Reviewed By: aartbik

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

20 months agoRevert "Transform vector SET{LE/ULT/ULE} -> SETLT and SET{GE/UGT/UGE} -> SETGT if...
Noah Goldstein [Wed, 15 Feb 2023 22:10:22 +0000 (16:10 -0600)]
Revert "Transform vector SET{LE/ULT/ULE} -> SETLT and SET{GE/UGT/UGE} -> SETGT if possible"

This reverts commit f3732c2b18df305a1927b9d4a94610421a2750e7.

20 months agoRevert "Remove incorrect comment around `truncateAVX512SetCCNoBWI`; NFC"
Noah Goldstein [Wed, 15 Feb 2023 22:10:14 +0000 (16:10 -0600)]
Revert "Remove incorrect comment around `truncateAVX512SetCCNoBWI`; NFC"

This reverts commit f895d55f149b66542940b22c547bb8400cbe2237.

20 months ago[PseudoProbe] Refactoring a test
Hongtao Yu [Wed, 15 Feb 2023 22:03:05 +0000 (14:03 -0800)]
[PseudoProbe] Refactoring a test

As titled.

Reviewed By: fhahn

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

20 months ago[gn build] Port 6f3e6a765a9e
LLVM GN Syncbot [Wed, 15 Feb 2023 22:00:54 +0000 (22:00 +0000)]
[gn build] Port 6f3e6a765a9e

20 months ago[Clang][docs] Update the release notes page to the new skeleton
Roy Jacobson [Wed, 15 Feb 2023 21:53:38 +0000 (23:53 +0200)]
[Clang][docs] Update the release notes page to the new skeleton

Was discussed at https://reviews.llvm.org/D142578.

20 months agoRevert "[hwasan] Add definitions for missing operator delete functions"
Leonard Chan [Wed, 15 Feb 2023 21:51:49 +0000 (21:51 +0000)]
Revert "[hwasan] Add definitions for missing operator delete functions"

This reverts commit d6ff0808618cd421d7ee82daec951956ec27a837.

This broke a bunch of builders:
http://45.33.8.238/linux/99657/step_10.txt
https://lab.llvm.org/buildbot/#/builders/247/builds/1627

20 months ago[RISCV] Use !cond instead of multiple !if in RISCVInstrInfoVPseudos.td. NFC
Craig Topper [Wed, 15 Feb 2023 21:46:05 +0000 (13:46 -0800)]
[RISCV] Use !cond instead of multiple !if in RISCVInstrInfoVPseudos.td. NFC

Rely on !cond erroring for unmatched condition instead of using a
bogus string for the default.

20 months ago[X86][Win64] Avoid statepoints prior to SEH epilogue
Markus Böck [Wed, 15 Feb 2023 21:25:46 +0000 (22:25 +0100)]
[X86][Win64] Avoid statepoints prior to SEH epilogue

This patchs purpose is very similar to https://reviews.llvm.org/D119644

The gist of the issue is that SEH unwinding has certain invariants around call instructions. One of those is that a call instruction must not be immediately followed by the function epilogue. Failing to do so leads to Windows' unwinder not recognizing the frame and skipping it when unwinding the stack.

LLVM ensures this invariant by inserting a noop after a call prior to an epilogue. The implementation however, makes the unfortunate assumption that pseudo instructions may not be calls, leading to statepoints being skipped and no noop being inserted.
This patch fixes that issue by only skipping over pseudo instructions that aren't calls.

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

20 months ago[mlir][sparse] misc code cleanup
wren romano [Wed, 15 Feb 2023 21:28:11 +0000 (13:28 -0800)]
[mlir][sparse] misc code cleanup

* Flattening/simplifying some nested conditionals
* const-ifying some local variables

Depends On D143800

Reviewed By: aartbik

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

20 months ago[flang][runtime] MayAlias() must be false for unallocated descriptors
Peter Klausler [Wed, 15 Feb 2023 21:11:37 +0000 (13:11 -0800)]
[flang][runtime] MayAlias() must be false for unallocated descriptors

When either descriptor argument to MayAlias() is not allocated, the
result must be false by definition, since the values of the extents
in the dimensional information may be uninitialized.

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

20 months ago[RISCV] Add CLB/CLH/SLB/SLH formats for Zcb instructions.
Craig Topper [Wed, 15 Feb 2023 20:53:17 +0000 (12:53 -0800)]
[RISCV] Add CLB/CLH/SLB/SLH formats for Zcb instructions.

This matches how they are described in the spec.

Rework the tablegen classes to make this format consistent with
other formats.

Reviewed By: asb

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

20 months ago[RISCV] Remove some vestiges of Zbp and Zbt extensions. NFC
Craig Topper [Wed, 15 Feb 2023 20:51:03 +0000 (12:51 -0800)]
[RISCV] Remove some vestiges of Zbp and Zbt extensions. NFC

Unused tablegen classes and unused operand type.

20 months ago[clang-format] Fix windows build.
Manuel Klimek [Wed, 15 Feb 2023 20:59:43 +0000 (20:59 +0000)]
[clang-format] Fix windows build.

MSVC needs a return after llvm_unreachable.

20 months ago[NFC] Make Module::getIFuncList() private
Vasileios Porpodas [Wed, 15 Feb 2023 18:54:04 +0000 (10:54 -0800)]
[NFC] Make Module::getIFuncList() private

This is a followup to d180443570d7895193d2ab6f1e1486d669dc9723
which did not actually remove the `public` keyword.

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

20 months ago[mlir][sparse] Adding `SparseTensorType::{operator==, hasSameDimToLvlMap}`
wren romano [Wed, 15 Feb 2023 20:03:52 +0000 (12:03 -0800)]
[mlir][sparse] Adding `SparseTensorType::{operator==, hasSameDimToLvlMap}`

Depends On D143800

Reviewed By: aartbik, Peiming

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

20 months ago[flang] Don't add a source range to a type instantiation's scope
Peter Klausler [Wed, 15 Feb 2023 19:11:54 +0000 (11:11 -0800)]
[flang] Don't add a source range to a type instantiation's scope

A type instantiation's scope doesn't require a source range, as we don't
need/want it to be the result of SemanticsContext::FindScope(), and
adding the original type's source range to the scope of one of its
instantiations has the side effect of expanding the source range of
all of its parents to include the original type definition, which
breaks FindScope() for any scope including a type instantiation.

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

20 months agoRevert D129735 "[RISCV] Add new pass to transform undef to pseudo for vector values."
Fangrui Song [Wed, 15 Feb 2023 19:51:08 +0000 (11:51 -0800)]
Revert D129735 "[RISCV] Add new pass to transform undef to pseudo for vector values."

This reverts commit f1c4241fb6e50c507adafbe14faf82a755ab92ca.

It causes use-after-poison asan failures for
CodeGen/RISCV/rvv/undef-earlyclobber-chain.ll and CodeGen/RISCV/regalloc-last-chance-recoloring-failure.ll

20 months ago[C2x] Implement the `unreachable` macro for WG14 N2826
Aaron Ballman [Wed, 15 Feb 2023 19:41:38 +0000 (14:41 -0500)]
[C2x] Implement the `unreachable` macro for WG14 N2826

This exposes __builtin_unreachable as the expansion for the unreachable
macro in C2x. I added this definition under __need_STDDEF_H_misc on the
assumption there is no need for a separate need macro to control adding
this.

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

20 months ago[hwasan] Add definitions for missing operator delete functions
Leonard Chan [Wed, 15 Feb 2023 19:41:04 +0000 (19:41 +0000)]
[hwasan] Add definitions for missing operator delete functions

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

20 months ago[NFC][SVE] Refactor isel for floating multiply-add operations to use PatFrags.
Paul Walker [Wed, 8 Feb 2023 10:52:19 +0000 (10:52 +0000)]
[NFC][SVE] Refactor isel for floating multiply-add operations to use PatFrags.

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

20 months ago[scudo] Fix inconsistent signed/unsigned comparison
Chia-hung Duan [Wed, 15 Feb 2023 18:26:24 +0000 (18:26 +0000)]
[scudo] Fix inconsistent signed/unsigned comparison

Fix broken test on PPC

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

20 months ago[ConstriantElimination] Add NODEBUG condition around `dump`
Zain Jaffal [Wed, 15 Feb 2023 17:43:25 +0000 (17:43 +0000)]
[ConstriantElimination] Add NODEBUG condition around `dump`

20 months ago[AArch64] Guard extra uses in mls combine.
David Green [Wed, 15 Feb 2023 18:36:46 +0000 (18:36 +0000)]
[AArch64] Guard extra uses in mls combine.

This is a small extension to D143143 to ensure that nodes with multiple uses to
not get transformed. The tests have also been extended to include more mla
cases.

20 months ago[mlir] bazel fix
Aart Bik [Wed, 15 Feb 2023 18:33:10 +0000 (10:33 -0800)]
[mlir] bazel fix

Reviewed By: olegshyshkov

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

20 months ago[mlir][tensor] Fix a bug in tiling unpack op.
Hanhan Wang [Tue, 14 Feb 2023 18:02:35 +0000 (10:02 -0800)]
[mlir][tensor] Fix a bug in tiling unpack op.

The inner tiling sizes could be dynamic (which are Values). In this
context, they should be added to tiledOperand when cloning the op.

Reviewed By: chelini

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

20 months ago[libc++][CI] Starts using Clang 17.
Mark de Wever [Tue, 7 Feb 2023 10:10:24 +0000 (11:10 +0100)]
[libc++][CI] Starts using Clang 17.

Reviewed By: #libc, ldionne, Mordante

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

20 months ago[Pseudo probe] Duplicate probes in vectorized loop body.
Hongtao Yu [Wed, 15 Feb 2023 02:21:22 +0000 (18:21 -0800)]
[Pseudo probe] Duplicate probes in vectorized loop body.

Prevoius pseudo probes were dropped out of a vectorized loop body during loop vectorization. This can result in the samples of the loop entry is used for the loop body, which in turn can cause undercounting of the loop iteration count. The undercounting can further prevent the loop from being vectorized in the next build. I'm fixing this by explicting allowing pseudo probes to be kept in the vectorized loop body, and by claiming a probe instruction is not "uniform", the vectorizer will duplicate it by the number of vector lanes.

For one internal service, I'm seeing the change causes the size increase of the .pseudoprobe section by 0.7%, which should count around 0.2% of the whole binary size.

Reviewed By: wenlei

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

20 months ago[CodeGen] Add a flag to `Address` and `Lvalue` that is used to keep
Akira Hatanaka [Thu, 26 Jan 2023 23:29:33 +0000 (15:29 -0800)]
[CodeGen] Add a flag to `Address` and `Lvalue` that is used to keep
track of whether the pointer is known not to be null

The flag will be used for the arm64e work we plan to upstream in the
future (see https://lists.llvm.org/pipermail/llvm-dev/2019-October/136091.html).
Currently the flag has no effect on code generation.

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

20 months agoReland "[mlir] Make the vast majority of intgration and runner tests work on Windows"
Markus Böck [Wed, 15 Feb 2023 17:57:13 +0000 (18:57 +0100)]
Reland "[mlir] Make the vast majority of intgration and runner tests work on Windows"

This reverts commit 5561e174117ff395d65b6978d04b62c1a1275138

The logic was moved from cmake into lit fixing the issue that lead to the revert and potentially others with multi-config cmake generators

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

20 months ago[flang][runtime] Fix typo in assign.cpp
Peter Klausler [Wed, 15 Feb 2023 18:12:43 +0000 (10:12 -0800)]
[flang][runtime] Fix typo in assign.cpp

Variable name 'y' needs to be used in the declaration of 'yDesc'.

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

20 months ago[mlir][spirv] Support i32 memref.atomic_rmw conversion
Lei Zhang [Wed, 15 Feb 2023 17:51:17 +0000 (17:51 +0000)]
[mlir][spirv] Support i32 memref.atomic_rmw conversion

These cases can be directly mapped to spirv.AtomicI* ops.

Reviewed By: kuhar

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

20 months ago[flang][NFC] Remove unwanted tab
Valentin Clement [Wed, 15 Feb 2023 17:51:58 +0000 (18:51 +0100)]
[flang][NFC] Remove unwanted tab

20 months ago[Clang][AMDGPU] Set LTO CG opt level based on Clang option
Scott Linder [Wed, 15 Feb 2023 17:29:19 +0000 (17:29 +0000)]
[Clang][AMDGPU] Set LTO CG opt level based on Clang option

For AMDGCN default to mapping --lto-O# to --lto-CGO# in a 1:1 manner
(i.e. clang -O<N> implies --lto-O<N> and --lto-CGO<N>).

Ensure there is a means to override this via -Xoffload-linker and begin
to claim these arguments to avoid incorrect warnings that they are not
used.

Reviewed By: yaxunl, MaskRay

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

20 months ago[LLD] Add --lto-CGO[0-3] option
Scott Linder [Wed, 15 Feb 2023 17:12:47 +0000 (17:12 +0000)]
[LLD] Add --lto-CGO[0-3] option

Allow controlling the CodeGenOpt::Level independent of the LTO
optimization level in LLD via new options for the COFF, ELF, MachO, and
wasm frontends to lld. Most are spelled as --lto-CGO[0-3], but COFF is
spelled as -opt:lldltocgo=[0-3].

See D57422 for discussion surrounding the issue of how to set the CG opt
level. The ultimate goal is to let each function control its CG opt
level, but until then the current default means it is impossible to
specify a CG opt level lower than 2 while using LTO. This option gives
the user a means to control it for as long as it is not handled on a
per-function basis.

Reviewed By: MaskRay, #lld-macho, int3

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

20 months ago[mlir][vectorToGPU] Fix type used when folding transpose into read op
Thomas Raoux [Wed, 15 Feb 2023 16:52:49 +0000 (16:52 +0000)]
[mlir][vectorToGPU] Fix type used when folding transpose into read op

Pick the right result type when folding transpose op into a read

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

20 months ago[DebugInfo][Docs] Fix broken link in instruction referencing doc
J. Ryan Stinnett [Wed, 15 Feb 2023 17:04:51 +0000 (17:04 +0000)]
[DebugInfo][Docs] Fix broken link in instruction referencing doc

20 months ago[mlir] Silence a few -Wunused-but-set-parameter warnings
Rahul Kayaith [Wed, 15 Feb 2023 16:25:40 +0000 (11:25 -0500)]
[mlir] Silence a few -Wunused-but-set-parameter warnings

Some older versions of gcc hit false positives here:

/workdir/llvm-project/mlir/include/mlir/IR/Attributes.h:391:49: warning: parameter 'ty' set but not used [-Wunused-but-set-parameter]
  391 |   static inline bool isPossible(mlir::Attribute ty) {

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81676

20 months ago[mlir][AMDGPU] 8-bit float usage in the AMDGPU dialect
Krzysztof Drewniak [Tue, 20 Dec 2022 15:32:25 +0000 (15:32 +0000)]
[mlir][AMDGPU] 8-bit float usage in the AMDGPU dialect

Upcoming AMD hardware will include functions that accept 8-bit floats.
Specifically, there are MFMA instructions that accept 8-bit floats,
either using the same or mixed formats. This patch adds MLIR wrappers
for these intrinsics and explicitly adds support for 8-bit floats in
the gpu-to-rocdl conversion by way of amdgpu-to-rocdl.

Since LLVM does not have f8 types, when targeting LLVM for compilation
on an AMD GPU, both f8 types used on AMD hardware (f8E5M2FNUZ and
f8E4M3FNUZ) are rewritten to i8.

This patch also relaxes the restriction that the types of both source
operands to a amdgpu.mfma instructions match exactly, as this is not
necessarily required for the bf8 (f8E5M2FNUZ) and fp8 (f8E4M3FNUZ)
instructions. In addition, since the buffer_{load,store} operations
maintain a whitelist of permitted types, we add the relevant f8 types
to that list.

This patch does not add any implementations of arithmetic operations
for f8 types.

Reviewed By: jakeh-gc

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

20 months ago[InstCombine] remove stale test comment; NFC
Sanjay Patel [Wed, 15 Feb 2023 16:43:17 +0000 (11:43 -0500)]
[InstCombine] remove stale test comment; NFC

20 months agoRecommit "[ConstraintElimination] Change debug output to display variable names."
Zain Jaffal [Wed, 15 Feb 2023 15:41:24 +0000 (15:41 +0000)]
Recommit "[ConstraintElimination] Change debug output to display variable names."

This reverts commit 02ae7e72b3f00969eeb579a2b4346082827f0b35.

include Value.h in ConstraintSystem.h

20 months ago[libc++abi][AIX] Skip non-C++ EH aware frames when retrieving exception object
Xing Xue [Wed, 15 Feb 2023 16:14:52 +0000 (11:14 -0500)]
[libc++abi][AIX] Skip non-C++ EH aware frames when retrieving exception object

Summary:
The personality routine for the legacy AIX xlclang++ compiler uses the stack slot reserved for compilers to pass the exception object to the landing pad. The landing pad retrieves the exception object with a call to the runtime function __xlc_exception_handle(). The current implementation incorrectly assumes that __xlc_exception_handle() should go up one stack frame to get to the stack frame of the caller of __xlc_exception_handle(), which is supposedly the stack frame of the function containing the landing pad. However, this does not always work, e.g., the xlclang++ compiler sometimes generates a wrapper of __xlc_exception_handle() and calls the wrapper from the landing pad for optimization purposes. This patch changes the implementation to unwind the stack from __xlc_exception_handle() and skip frames not associated with functions that are C++ EH-aware until a frame associated with a C++ EH-aware function is found and then retrieving the exception object with the expectation that the located frame is the one that the personality routine installed as it transferred control to the landing pad.

Reviewed by: cebowleratibm, hubert.reinterpretcast, daltenty

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

20 months ago[AArch64] Always lower fp16 zero to FMOVH0
David Green [Wed, 15 Feb 2023 16:06:32 +0000 (16:06 +0000)]
[AArch64] Always lower fp16 zero to FMOVH0

We can always use FMOVH0 to lower fp16 zero, even without fullfp16. We can
either expand it to movi d0, #0 or fmov s0, wzr, which will both clear all the
bits of the register.

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

20 months ago[flang][runtime] Return the right mutable modes from INQUIRE in child I/O
Peter Klausler [Tue, 14 Feb 2023 22:07:27 +0000 (14:07 -0800)]
[flang][runtime] Return the right mutable modes from INQUIRE in child I/O

During child I/O -- a call to a user-defined subroutine with a generic interface
to handle read and write operations on a specific derived type -- ensure that
any INQUIRE statement probing mutable modes like BLANK= will observe changes
that have been made to those modes via control edit descriptors like BN
while processing the original I/O statement's format.

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

20 months ago[mlir][linalg] Fix insertion point bug in D144022
Matthias Springer [Wed, 15 Feb 2023 15:40:42 +0000 (16:40 +0100)]
[mlir][linalg] Fix insertion point bug in D144022

This should have been part of D144022.

20 months ago[libc++][NFC] Replace _LIBCPP_STD_VER > x with _LIBCPP_STD_VER >= x
Nikolas Klauser [Mon, 13 Feb 2023 23:56:09 +0000 (00:56 +0100)]
[libc++][NFC] Replace _LIBCPP_STD_VER > x with _LIBCPP_STD_VER >= x

This change is almost fully mechanical. The only interesting change is in `generate_feature_test_macro_components.py` to generate `_LIBCPP_STD_VER >=` instead. To avoid churn in the git-blame this commit should be added to the `.git-blame-ignore-revs` once committed.

Reviewed By: ldionne, var-const, #libc

Spies: jloser, libcxx-commits, arichardson, arphaman, wenlei

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

20 months ago[clang][dataflow] Change `transfer` API to take a reference.
Yitzhak Mandelbaum [Mon, 13 Feb 2023 16:27:39 +0000 (16:27 +0000)]
[clang][dataflow] Change `transfer` API to take a reference.

The provided `CFGElement` is never null, so a reference is a more precise type.

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

20 months agoRevert "Recommit "[ConstraintElimination] Change debug output to display variable...
Nikita Popov [Wed, 15 Feb 2023 15:36:44 +0000 (16:36 +0100)]
Revert "Recommit "[ConstraintElimination] Change debug output to display variable names.""

This reverts commit 2a2a6bfcfe8e62886542cb673ac8df349cf26499.

This causes build failures:

    /home/npopov/repos/llvm-project/llvm/lib/Analysis/ConstraintSystem.cpp: In member function ‘llvm::SmallVector<std::__cxx11::basic_string<char> > llvm::ConstraintSystem::getVarNamesList() const’:
    /home/npopov/repos/llvm-project/llvm/lib/Analysis/ConstraintSystem.cpp:118:10: error: invalid use of incomplete type ‘class llvm::Value’
      118 |     if (V->getName().empty())
          |          ^~
    In file included from /home/npopov/repos/llvm-project/llvm/lib/Analysis/ConstraintSystem.cpp:9:
    /home/npopov/repos/llvm-project/llvm/include/llvm/Analysis/ConstraintSystem.h:21:7: note: forward declaration of ‘class llvm::Value’
       21 | class Value;
          |       ^~~~~
    /home/npopov/repos/llvm-project/llvm/lib/Analysis/ConstraintSystem.cpp:119:22: error: invalid use of incomplete type ‘class llvm::Value’
      119 |       OperandName = V->getNameOrAsOperand();
          |                      ^~
    /home/npopov/repos/llvm-project/llvm/include/llvm/Analysis/ConstraintSystem.h:21:7: note: forward declaration of ‘class llvm::Value’
       21 | class Value;
          |       ^~~~~
    /home/npopov/repos/llvm-project/llvm/lib/Analysis/ConstraintSystem.cpp:121:41: error: invalid use of incomplete type ‘class llvm::Value’
      121 |       OperandName = std::string("%") + V->getName().str();
          |                                         ^~
    /home/npopov/repos/llvm-project/llvm/include/llvm/Analysis/ConstraintSystem.h:21:7: note: forward declaration of ‘class llvm::Value’
       21 | class Value;
          |       ^~~~~

20 months ago[InstSimplify] Add additional insertvalue into undef tests (NFC)
Nikita Popov [Wed, 15 Feb 2023 15:32:46 +0000 (16:32 +0100)]
[InstSimplify] Add additional insertvalue into undef tests (NFC)

20 months ago[llvm][AArch64] Fix BTI after returns_twice when call has no attributes
David Spickett [Wed, 15 Feb 2023 08:55:22 +0000 (08:55 +0000)]
[llvm][AArch64] Fix BTI after returns_twice when call has no attributes

Previously we were looking for the returns twice attribute by manually
getting the function attributes from the call. This meant that we only
found attributes on the call itself, not what it was calling.

So if you had:
%call1 = call i32 @setjmp(ptr noundef null)

We would not BTI protect that even though setjmp clearly needs it.

Clang happens to produce:
%call = call i32 @setjmp(ptr noundef null) #0 ; returns_twice

So all valid calls were protected. This is not guaranteed,
the frontend may choose not to put attributes on the call.

It is undefined behaviour to call setjmp indirectly
(https://pubs.opengroup.org/onlinepubs/9699919799/functions/setjmp.html)
but as I misused the APIs here I think it's worth fixing up regardless.

Added comments to the test file where the IR differs from what
clang would output.

Reviewed By: nikic

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

20 months agoRecommit "[ConstraintElimination] Change debug output to display variable names."
Zain Jaffal [Wed, 15 Feb 2023 15:22:42 +0000 (15:22 +0000)]
Recommit "[ConstraintElimination] Change debug output to display variable names."

This reverts commit 62d0e1a8541f93dfbf66d982f66da32676df2df7.

remove `dumpWithNames` function

20 months agoRevert "[ConstraintElimination] Change debug output to display variable names."
Zain Jaffal [Wed, 15 Feb 2023 15:21:46 +0000 (15:21 +0000)]
Revert "[ConstraintElimination] Change debug output to display variable names."

This reverts commit 869c87ad10e87db7c032c3464338ab9d50916510.

`dumpWithNames` function should be removed

20 months ago[ConstraintElimination] Change debug output to display variable names.
Zain Jaffal [Wed, 15 Feb 2023 15:07:14 +0000 (15:07 +0000)]
[ConstraintElimination] Change debug output to display variable names.

Previously when constraint system outputs the rows in the system the variables used are x1,2...n making it hard to infer which ones they relate to in the IR

Reviewed By: fhahn

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

20 months ago[reland][libc] Separate memcpy implementations per arch
Guillaume Chatelet [Wed, 15 Feb 2023 10:47:10 +0000 (10:47 +0000)]
[reland][libc] Separate memcpy implementations per arch

As x86_64 implementations is likely to grow up to a point where it's no more manageable to have all implementations in the same file.

20 months ago[mlir][memref] Bufferize memref.tensor_store op
Matthias Springer [Wed, 15 Feb 2023 14:26:14 +0000 (15:26 +0100)]
[mlir][memref] Bufferize memref.tensor_store op

This change adds the BufferizableOpInterface implementation for memref.tensor_store.

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

20 months ago[mlir][linalg] Add bufferize_to_allocation transform op
Matthias Springer [Wed, 15 Feb 2023 14:09:34 +0000 (15:09 +0100)]
[mlir][linalg] Add bufferize_to_allocation transform op

This transform materializes a buffer allocation for a given tensor value. All uses of the original value are replaced with the allocation.

Certain non-DPS ops may have an optimized lowering path that bufferizes the entire defining op. Such optimization is added for `tensor.pad` as part of this change.

The resulting IR can be further bufferized with One-Shot Bufferize.

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

20 months ago[ConstantFold] Check for constant global earlier (NFC)
Nikita Popov [Wed, 15 Feb 2023 13:33:59 +0000 (14:33 +0100)]
[ConstantFold] Check for constant global earlier (NFC)

Check that the underlying object is a constant global with
definitive initializer upfront, so we can skip the more expensive
offset calculation logic if we can't perform the fold anyway.

20 months ago[lld][RISCV][test] Expand testing in riscv-attributes.s
Alex Bradbury [Wed, 15 Feb 2023 14:00:54 +0000 (14:00 +0000)]
[lld][RISCV][test] Expand testing in riscv-attributes.s

This patch is related to the discussion in
<https://discourse.llvm.org/t/rfc-resolving-issues-related-to-extension-versioning-in-risc-v/68472/1>.
It slightly expands the coverage of behaviour for unrecognized
extensions (there are slightly different forms of error for zfoo vs e.g.
'y'), and adds coverage for an extension with an
unrecognized/unsupported version number.

Use "unrecognized" terminology because the expectation is the error
checking will be reduced in a follow-up patch posted for review.

20 months ago[LangRef] improve documentation of SNaN in the default FP environment
Sanjay Patel [Wed, 15 Feb 2023 13:56:24 +0000 (08:56 -0500)]
[LangRef] improve documentation of SNaN in the default FP environment

Make it explicit that SNaN is not handled differently than
QNaN in the LLVM default floating-point environment.

Note that an IEEE-754-compliant model disallows transforms
like "X * 1.0 -> X". That is because math operations are
expected to convert SNaN to QNaN (set the signaling bit).

But LLVM has had those kinds of transforms from the beginning:
https://alive2.llvm.org/ce/z/igb55y

We should be IEEE-754-compliant under strict-FP (the logic is
implemented with a helper named canIgnoreSNaN()), but I don't
think there is any demand to do that with default optimization.

See issue #43070 for earlier draft/discussion about this change.

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

20 months ago[bazel] Fix missing dependency in clang-tools-extra/clang-tidy:llvmlibc
Guillaume Chatelet [Wed, 15 Feb 2023 13:54:13 +0000 (13:54 +0000)]
[bazel] Fix missing dependency in clang-tools-extra/clang-tidy:llvmlibc

20 months ago[NVPTX] Fix NVPTX output name in the driver with `-save-temps`
Joseph Huber [Wed, 15 Feb 2023 13:37:47 +0000 (07:37 -0600)]
[NVPTX] Fix NVPTX output name in the driver with `-save-temps`

Summary:
Currently, OpenMP and direct compilation uses an NVPTX toolchain to
directly invoke the CUDA tools from Clang to do the assembling and
linking of NVPTX codes. This breaks under `-save-temps` because of a
workaround. The `nvlink` linker does not accept `.o` files, so we need
to be selective when we output these. The previous logic keyed off of
presense in the temp files and wasn't a great solution. Change this to
just query the input args for `-c` to see if we stop at the assembler.

Fixes https://github.com/llvm/llvm-project/issues/60767

20 months agoRevert "[libc] Separate memcpy implementations per arch"
Guillaume Chatelet [Wed, 15 Feb 2023 13:29:07 +0000 (13:29 +0000)]
Revert "[libc] Separate memcpy implementations per arch"

This is patch is still breaking downstream users...
This reverts commit 97e441dc6cfae31bc56b375e43899946ec7f08a8.

20 months ago[libc] Separate memcpy implementations per arch
Guillaume Chatelet [Wed, 15 Feb 2023 10:47:10 +0000 (10:47 +0000)]
[libc] Separate memcpy implementations per arch

As x86_64 implementations is likely to grow up to a point where it's no more manageable to have all implementations in the same file.

20 months ago[mlir][transform] Add transform.get_result op
Matthias Springer [Wed, 15 Feb 2023 13:15:41 +0000 (14:15 +0100)]
[mlir][transform] Add transform.get_result op

This transform op returns a value handle pointing to the specified OpResult of the targeted op.

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

20 months ago[clang-format] assert(false) -> llvm_unreachable
Benjamin Kramer [Wed, 15 Feb 2023 13:10:09 +0000 (14:10 +0100)]
[clang-format] assert(false) -> llvm_unreachable

Avoids warnings in -asserts builds.

FormatTokenSource.h:240:3: error: non-void function does not return a value [-Werror,-Wreturn-type]
  }
  ^

20 months ago[bazel] create a clang-tidy binary target
Jathu Satkunarajah [Wed, 15 Feb 2023 12:51:52 +0000 (13:51 +0100)]
[bazel] create a clang-tidy binary target

Create a binary target for clang-tidy. Tested by running:

```
$ bazel build --config=generic_clang @llvm-project//clang-tools-extra/...
$ bazel test --config=generic_clang @llvm-project//clang-tools-extra/...
$ bazel run --config=generic_clang @llvm-project//clang-tools-extra/clang-tidy -- --help
```

Reviewed By: #bazel_build, aaronmondal

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

20 months ago[MachineTraceMetrics] Add local strategy
Anton Sidorenko [Tue, 14 Feb 2023 10:30:44 +0000 (13:30 +0300)]
[MachineTraceMetrics] Add local strategy

This strategy makes each trace local to the basic block. For in-order cores some
heuristics work better when we do local decisions. For example, MachineCombiner
may expect that instructions outside the current basic block do not lengthen
the critical path when we execute instructions in order or the core has a
small re-order buffer.

This patch only introduce the strategy, real use-case is added in the further
pathes.

Depends on D140539

Reviewed By: spatel

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

20 months ago[X86] Remove abs(sub_nsw()) -> abds fold from adbu test file
Simon Pilgrim [Wed, 15 Feb 2023 12:44:14 +0000 (12:44 +0000)]
[X86] Remove abs(sub_nsw()) -> abds fold from adbu test file

Copy+paste typo - it was correctly removed from 128/512 variants

20 months ago[lldb] Fix a log format warning on Windows, don't assume uint64_t is a long type
Martin Storsjö [Wed, 15 Feb 2023 08:42:20 +0000 (10:42 +0200)]
[lldb] Fix a log format warning on Windows, don't assume uint64_t is a long type

On Windows, long is 32 bit, and uint64_t is long long.

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

20 months ago[clang-format] Enable FormatTokenSource to insert tokens.
Manuel Klimek [Wed, 1 Feb 2023 13:18:44 +0000 (13:18 +0000)]
[clang-format] Enable FormatTokenSource to insert tokens.

In preparation for configured macro replacements in formatting,
add the ability to insert tokens to FormatTokenSource, and implement
token insertion in IndexedTokenSource.

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

20 months agoAMDGPU: Fix not adding to depth in getNegatedExpression
Matt Arsenault [Wed, 15 Feb 2023 12:31:40 +0000 (08:31 -0400)]
AMDGPU: Fix not adding to depth in getNegatedExpression

20 months agoclang: Rename misleading test name
Matt Arsenault [Tue, 31 Jan 2023 17:16:59 +0000 (13:16 -0400)]
clang: Rename misleading test name

This is a test for attribute propagation, not metadata

20 months ago[lld][ARM][NFCI][1/3]Big Endian support - Removing assumptions
Simi Pallipurath [Wed, 15 Feb 2023 11:06:04 +0000 (11:06 +0000)]
[lld][ARM][NFCI][1/3]Big Endian support - Removing assumptions

Change:
 - Replacing the memcpy that assume little endian with the endian-aware write.

Shouldn't affect the output for now, just a prerequisite for the next patches.

Reviewed By: MaskRay

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

20 months ago[AArch64][NFC] Rename AEK_SMEF64 and AEK_SMEI64 feature flags
Caroline Concatto [Wed, 15 Feb 2023 09:40:41 +0000 (09:40 +0000)]
[AArch64][NFC] Rename  AEK_SMEF64 and AEK_SMEI64 feature flags

Update feature flag names from:
AEK_SMEF64  to AEK_SMEF64F64
and
AEK_SMEI64 to AEK_SMEI16I64
These feature flags had their name changed in this previous patch
 https://reviews.llvm.org/D135974

Reviewed By: c-rhodes

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

20 months ago[SimpleLoopUnswitch] Canonicalize conditions for injection of invariant condition
Max Kazantsev [Wed, 15 Feb 2023 11:15:24 +0000 (18:15 +0700)]
[SimpleLoopUnswitch] Canonicalize conditions for injection of invariant condition

When loop condition isn't immediately in the form supported by invariant injection
unswitching, try to canonicalize it to this form.

Differential Revision: https://reviews.llvm.org/D143175
Reviewed By: skatkov

20 months ago[Test][NFC] Rename one of test parameters to avoid confusing associations
Max Kazantsev [Wed, 15 Feb 2023 11:07:02 +0000 (18:07 +0700)]
[Test][NFC] Rename one of test parameters to avoid confusing associations

Name 'len' implicitly hints that it should be non-negative, but in fact in some of
these tests the baseline profitable scenario for the transform to be profitable is
when this thing is negative. Rename to avoid this confusion.

20 months ago[Symbolize][MinGW] Support demangling i386 call-conv-decorated C++ names
Alvin Wong [Tue, 14 Feb 2023 22:38:52 +0000 (06:38 +0800)]
[Symbolize][MinGW] Support demangling i386 call-conv-decorated C++ names

On i386 Windows, after C++ names have been Itanium-mangled, the C name
mangling specific to its call convention may also be applied on top.
This change teaches symbolizer to be able to demangle this type of
mangled names.

As part of this change, `demanglePE32ExternCFunc` has also been modified
to fix unwanted stripping for vectorcall names when the demangled name
is supposed to contain a leading `_`. Notice that the vectorcall
mangling does not add either an `_` or `@` prefix. The old code always
tries to strip the prefix first, which for Itanium mangled names in
vectorcall, the leading underscore of the Itanium name gets stripped
instead and breaks the Itanium demangler.

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