platform/upstream/llvm.git
21 months ago[clang][pp] only __is_target_environment(unknown) should match unknown target triple...
Alex Lorenz [Wed, 2 Nov 2022 20:40:52 +0000 (13:40 -0700)]
[clang][pp] only __is_target_environment(unknown) should match unknown target triple environment

21 months ago[VectorCombine] add tests for load+shuffle and update to typeless ptr; NFC
Sanjay Patel [Wed, 2 Nov 2022 19:55:51 +0000 (15:55 -0400)]
[VectorCombine] add tests for load+shuffle and update to typeless ptr; NFC

21 months ago[OpenMP][libomp] Fix disabled affinity
Jonathan Peyton [Tue, 1 Nov 2022 17:29:17 +0000 (12:29 -0500)]
[OpenMP][libomp] Fix disabled affinity

Fix setting affinity type and topology method when affinity is disabled
and fix places that were not taking into account that affinity can be
explicitly disabled by putting proper KMP_AFFINITY_CAPABLE() check.

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

21 months ago[clang-format] Don't skip #else/#elif of #if 0
Owen Pan [Sun, 30 Oct 2022 23:45:00 +0000 (16:45 -0700)]
[clang-format] Don't skip #else/#elif of #if 0

Fixes #58188.

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

21 months agoRevert "[Attributor][NFCI] Move MemIntrinsic handling into the initializer"
Joseph Huber [Wed, 2 Nov 2022 20:28:50 +0000 (15:28 -0500)]
Revert "[Attributor][NFCI] Move MemIntrinsic handling into the initializer"

This was causing failures when optimizing codes with complex numbers.
Revert until a fix can be implemented.

This reverts commit 7fdf3564c04075d3e6be2d9540e5a6f1e084be9f.

21 months ago[LinkerWrapper] report on missing libraries
Joseph Huber [Tue, 1 Nov 2022 18:16:47 +0000 (18:16 +0000)]
[LinkerWrapper] report on missing libraries

The linker wrapper does its own library searching for static archives
that can contain device code. The device linking phases happen before
the host linking phases so that we can generate the necessary
registration code and link it in with the rest of the code. Previously,
If a library containing needed device code was not found the execution
would continue silently until it failed with undefined symbols. This
patch allows the linker wrapper to perform its own check beforehand to
catch these errors.

Reviewed By: jdoerfert

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

21 months ago[clang] Fix inline builtin functions of an __asm__ renamed function with symbol prefixes
Martin Storsjö [Mon, 31 Oct 2022 10:18:21 +0000 (12:18 +0200)]
[clang] Fix inline builtin functions of an __asm__ renamed function with symbol prefixes

If a function is renamed with `__asm__`, the name provided is the
exact symbol name, without any extra implicit symbol prefixes.
If the target does use symbol prefixes, the IR level symbol gets
an `\01` prefix to indicate that it's a literal symbol name to be
taken as is.

When a builtin function is specialized by providing an inline
version of it, that inline function is named `<funcname>.inline`.

When the base function has been renamed due to `__asm__`, the inline
function ends up named `<asmname>.inline`. Up to this point,
things did work as expected before.

However, for targets with symbol prefixes, one codepath that produced
the combined name `<asmname>.inline` used the mangled `asmname` with
`\01` prefix, while others didn't. This patch fixes this.

This fixes the combination of asm renamed builtin function, with
inline override of the function, on any target with symbol
prefixes (such as i386 windows and any Darwin target).

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

21 months ago[RISCV] Move RVVBitsPerBlock to TargetParser.h so we can use it in clang. NFC
Craig Topper [Wed, 2 Nov 2022 16:18:41 +0000 (09:18 -0700)]
[RISCV] Move RVVBitsPerBlock to TargetParser.h so we can use it in clang. NFC

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

21 months ago[LV][RISCV] Add test showing poor choice of VF for short loop
Philip Reames [Wed, 2 Nov 2022 20:00:35 +0000 (13:00 -0700)]
[LV][RISCV] Add test showing poor choice of VF for short loop

21 months ago[wasm-ld] Update supported features in the generic CPU configuration
Dan Gohman [Tue, 18 Oct 2022 18:10:19 +0000 (11:10 -0700)]
[wasm-ld] Update supported features in the generic CPU configuration

Accompanying https://reviews.llvm.org/D125728, this updates LLVM
Codegen's "generic" CPU to enable the same new features.

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

21 months ago[flang][NFC] Fix typo in filename
Valentin Clement [Wed, 2 Nov 2022 19:47:19 +0000 (20:47 +0100)]
[flang][NFC] Fix typo in filename

21 months ago[flang] Fix for polymoprhic pointer component
Valentin Clement [Wed, 2 Nov 2022 19:46:09 +0000 (20:46 +0100)]
[flang] Fix for polymoprhic pointer component

Fix path that generates MutableBox for
pointer component.

Reviewed By: PeteSteinfeld

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

21 months ago[mlir][llvmir] Support FastmathFlags for LLVM intrinsic operations.
Slava Zakharin [Wed, 2 Nov 2022 18:42:46 +0000 (11:42 -0700)]
[mlir][llvmir] Support FastmathFlags for LLVM intrinsic operations.

This is required for D126305 code to propagate fastmath attributes
for Arith operations that are converted to LLVM IR intrinsics
operations.

LLVM IR intrinsic operations are using custom assembly format now
to avoid printing {fastmathFlags = #llvm.fastmath<none>}, which
is too verbose.

Reviewed By: rriddle

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

21 months ago[libc++] Implement P2438R2 (std::string::substr() &&)
Nikolas Klauser [Tue, 9 Aug 2022 11:17:30 +0000 (13:17 +0200)]
[libc++] Implement P2438R2 (std::string::substr() &&)

This doesn't affect our ABI because `std::string::substr()` isn't in the dylib and the mangling of `substr() const` and `substr() const&` are different.

Reviewed By: ldionne, Mordante, var-const, avogelsgesang, #libc

Spies: arphaman, huixie90, libcxx-commits

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

21 months ago[bolt] update bazel rules for f71d32a0eea4
Augie Fackler [Wed, 2 Nov 2022 16:29:24 +0000 (12:29 -0400)]
[bolt] update bazel rules for f71d32a0eea4

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

21 months ago[OpenMP][OpenMPIRBuilder] Migrate loadOffloadInfoMetadata from clang to OMPIRbuilder
Akash Banerjee [Thu, 27 Oct 2022 18:45:26 +0000 (19:45 +0100)]
[OpenMP][OpenMPIRBuilder] Migrate loadOffloadInfoMetadata from clang to OMPIRbuilder

This patch moves the implementation of the loadOffloadInfoMetadata to the OMPIRbuilder.

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

21 months ago[clangd] Add scoped enum constants to all-scopes-completion
Tom Praschan [Mon, 31 Oct 2022 20:36:18 +0000 (21:36 +0100)]
[clangd] Add scoped enum constants to all-scopes-completion

This was originally part of https://reviews.llvm.org/D136925, but we decided to move it to a separate patch.
In case it turns out to be controversial, it can be reverted more easily.

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

21 months agoAdd Async Function to the Async Dialect
yijiagu [Wed, 2 Nov 2022 18:27:26 +0000 (11:27 -0700)]
Add Async Function to the Async Dialect

Add Async Function to the Async Dialect

Today `async.execute` operation semantics requires attached region to be executed in a thread managed by the runtime, and always returns an `!async.token` result. We need to model async functions that are not necessarily executed in a runtime-managed threads, but eventually lowered to llvm coroutines.

Example:

```
async.func @foo(%arg0: !async.value<f32>) -> !async.token {
  %0 = async.await %arg0: !async.value<f32>
  "do_something_with_f32"(%0)
  return
}
```

If `arg0` is available this function will be executed in the caller thread. If it's not available it will be suspended and resumed later later on a thread managed by the async runtime. Currently this is not representable with `async.execute` operations.

The longer term goal is to make async dialect more like https://github.com/lewissbaker/cppcoro to be able to represent structured host concurrency in MLIR.

(1) Add async.func, async.call, and async.return operations in Async Dialect

Reviewed By: ezhulenev, rriddle

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

21 months agoFix LLVM sphinx build bot
Aaron Ballman [Wed, 2 Nov 2022 18:32:47 +0000 (14:32 -0400)]
Fix LLVM sphinx build bot

This should address the issue found in:
https://lab.llvm.org/buildbot/#/builders/30/builds/27824

21 months ago[TSan] Adjust `TSAN_RTL_CFLAGS` before it gets copied
Julian Lettner [Wed, 2 Nov 2022 18:21:34 +0000 (11:21 -0700)]
[TSan] Adjust `TSAN_RTL_CFLAGS` before it gets copied

Add `COMPILER_RT_LIBDISPATCH_CFLAGS` to `TSAN_RTL_CFLAGS` before it gets
duplicated to `TSAN_RTL_DYNAMIC_CFLAGS` so both versions have the
necessary flags.

Reviewed By: wrotki, rsundahl

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

21 months ago[ConstraintElimination] Generate true/false vectors for vector cmps.
Florian Hahn [Wed, 2 Nov 2022 18:13:34 +0000 (18:13 +0000)]
[ConstraintElimination] Generate true/false vectors for vector cmps.

This fixes crashes when vector compares can be simplified to true/false.

21 months ago[mlir][linalg] Add support for vectorizing convs that have different types.
Hanhan Wang [Wed, 2 Nov 2022 18:02:48 +0000 (11:02 -0700)]
[mlir][linalg] Add support for vectorizing convs that have different types.

Reviewed By: dcaballe

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

21 months ago[llvm-tblgen] NFC: Small code refactor in DecoderEmitter.
James Y Knight [Wed, 2 Nov 2022 16:29:42 +0000 (12:29 -0400)]
[llvm-tblgen] NFC: Small code refactor in DecoderEmitter.

Extracts part of populateInstruction into a separate
addOneOperandFields function.

21 months agoRevert "[cmake][msvc] Enable standards-conforming preprocessor"
Jan Svoboda [Wed, 2 Nov 2022 17:57:24 +0000 (10:57 -0700)]
Revert "[cmake][msvc] Enable standards-conforming preprocessor"

This reverts commit 12d8e7c6ade55bba241259312e3e4bdcf6aeab81.

The Windows MLIR buildbot started failing with:

C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9531): error C2220: the following warning is treated as an error
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9531): warning C5105: macro expansion producing 'defined' has undefined behavior
C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um\winbase.h(9531): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings

21 months agollvm-reduce: Require x86 to run file ouput test
Matt Arsenault [Wed, 2 Nov 2022 17:39:50 +0000 (10:39 -0700)]
llvm-reduce: Require x86 to run file ouput test

The MIR test somewhat depends on target support.

21 months agoAMDGPU: Directly pass Function to mayUseAGPRs
Matt Arsenault [Wed, 2 Nov 2022 17:38:29 +0000 (10:38 -0700)]
AMDGPU: Directly pass Function to mayUseAGPRs

This was taking the MachineFunction, but only inspecting the
underlying IR.

21 months ago[NewPM][Pipeline] Add PipelineTuningOption to set inliner threshold
Arthur Eubanks [Sun, 30 Oct 2022 16:52:20 +0000 (09:52 -0700)]
[NewPM][Pipeline] Add PipelineTuningOption to set inliner threshold

The legacy PM allowed you to set a custom inliner threshold via
  builder.Inliner = llvm::createFunctionInliningPass(inline_threshold);

This allows the same thing to be done with the new PM optimization pipelines.

Reviewed By: asbirlea

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

21 months ago[docs][NewPM] Move pass plugin documentation into existing new PM docs
Arthur Eubanks [Mon, 24 Oct 2022 17:45:51 +0000 (10:45 -0700)]
[docs][NewPM] Move pass plugin documentation into existing new PM docs

Reviewed By: awarzynski, asbirlea

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

21 months ago[opt] Add -p alias for -passes
Arthur Eubanks [Sun, 23 Oct 2022 19:02:59 +0000 (12:02 -0700)]
[opt] Add -p alias for -passes

See [1] for background.

Some people have complained that `opt -passes=instcombine` is a lot more typing than `opt -instcombine`.
As a compromise that nobody has objected to in [1], allow `opt -p instcombine`.

[1] https://discourse.llvm.org/t/rfc-legacy-opt-pass-syntax-with-new-pass-manager/65863

Reviewed By: bjope, asbirlea

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

21 months ago[lldb] Add information on type systems to statistics dump command
Alex Langford [Mon, 31 Oct 2022 21:50:04 +0000 (14:50 -0700)]
[lldb] Add information on type systems to statistics dump command

Context: I plan on using this change primarily downstream in the apple
fork of llvm to track swift module loading time.

Reviewed By: clayborg, tschuett

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

21 months ago[llvm-config] Remove --src-root option
Michał Górny [Tue, 1 Nov 2022 03:23:36 +0000 (04:23 +0100)]
[llvm-config] Remove --src-root option

Remove the `--src-root` option from the deprecated llvm-config tool.
None of the llvm-project projects use this option anymore. The value
was only meaningful for in-tree use and usually became no longer correct
once LLVM was installed -- either because it was built in a temporary
directory, or installed from a binary package and built on a different
system entirely.  Therefore, third-party tools could not have been
relying on it anyway.

The LLVM_SRC_ROOT #define is left intact, as it is used to compute
includedir when llvm-config is used in-source.

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

21 months ago[ASAN] Removed special case controlling allocator constants for __aarch64__.
Kirill Stoimenov [Wed, 2 Nov 2022 16:13:02 +0000 (16:13 +0000)]
[ASAN] Removed special case controlling allocator constants for __aarch64__.

This patch should land before D137136 to make sure that the leak sanitizer allocator works correctly. This patch is NFC without D137136.

Reviewed By: vitalybuka

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

21 months ago[PGO] Add a threshold for number of critical edges in PGO
Rong Xu [Wed, 2 Nov 2022 17:11:34 +0000 (10:11 -0700)]
[PGO] Add a threshold for number of critical edges in PGO

For some auto-generated sources, we have a huge number of critical
edges (like from switch statements). We have seen instance of 183777
critical edges in one function.

After we split the critical edges in PGO instrumentation/profile-use
pass, the CFG is so large that we have compiler time issues in
downstream passes (like in machine CSE and block placement). Here I
add a threshold to skip PGO if the number of critical edges are too
large.

The threshold is large enough so that it will not affect the majority
of PGO compilation.

Also sync the logic for skipping instrumentation and profile-use. I
think this is the correct thing to do.

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

21 months ago[Assignment Tracking][2/*] Add flags to enable Assignment Tracking
OCHyams [Wed, 2 Nov 2022 17:00:58 +0000 (17:00 +0000)]
[Assignment Tracking][2/*] Add flags to enable Assignment Tracking

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

Enable in clang: -Xclang -fexperimental-assignment-tracking
Enable in llvm tools: -experimental-assignment-tracking

When assignment tracking is enabled in clang it will pass on the flag to enable
the feature in lllvm. It's undefined behaviour to read IR that contains
assignment tracking metadata without specifying the feature flags.

Tests will come with later patches that add assignment tracking features.

Reviewed By: jmorse

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

21 months ago[mlir][scf] support 1:N type conversion for scf.if/while/condition
Peiming Liu [Mon, 31 Oct 2022 16:26:32 +0000 (16:26 +0000)]
[mlir][scf] support 1:N type conversion for scf.if/while/condition

Reviewed By: ftynse

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

21 months ago[ValueLattice] Fix typo in condition (NFC)
Nikita Popov [Wed, 2 Nov 2022 16:50:02 +0000 (17:50 +0100)]
[ValueLattice] Fix typo in condition (NFC)

Fix typo pointed out by Roman Divacky.

There should be no functional change, as the rest of the code will
return nullptr for undef anyway. The condition is just there for
clarity.

21 months ago[mlir][arith] Use declarative asm format for fastmath flags
rkayaith [Mon, 31 Oct 2022 16:50:17 +0000 (12:50 -0400)]
[mlir][arith] Use declarative asm format for fastmath flags

Switch to using an optional group in the assembly format instead of a
custom directive. There's no change to the actual printed format.

Reviewed By: vzakhari

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

21 months ago[mlir][Transform] Fix ASAN heap-use-after-free
Nicolas Vasilache [Wed, 2 Nov 2022 16:39:16 +0000 (09:39 -0700)]
[mlir][Transform] Fix ASAN heap-use-after-free

21 months ago[mlir][scf] refactor scf structuralOpConversion to better support 1:N type conversion
Peiming Liu [Fri, 28 Oct 2022 23:39:47 +0000 (23:39 +0000)]
[mlir][scf] refactor scf structuralOpConversion to better support 1:N type conversion

This patch moves the 1:N type mapping into its own classes to allow better code reuse in D137100.

Reviewed By: ftynse

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

21 months ago[openmp][AMDGPU] - Correct getNumberOfBlocks calculation.
Ethan Stewart [Wed, 2 Nov 2022 16:37:42 +0000 (11:37 -0500)]
[openmp][AMDGPU] - Correct getNumberOfBlocks calculation.

This patch fixes the 6 amdgpu buildbot lit test failures
introduced by https://reviews.llvm.org/D135444.
      libomptarget :: amdgcn-amd-amdhsa :: mapping/reduction_implicit_map.cpp
      libomptarget :: amdgcn-amd-amdhsa :: offloading/cuda_no_devices.c
      libomptarget :: amdgcn-amd-amdhsa :: offloading/target-teams-atomic.c
      libomptarget :: amdgcn-amd-amdhsa-LTO :: mapping/reduction_implicit_map.cpp
      libomptarget :: amdgcn-amd-amdhsa-LTO :: offloading/cuda_no_devices.c
      libomptarget :: amdgcn-amd-amdhsa-LTO :: offloading/target-teams-atomic.c

Reviewed By: jhuber6

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

21 months ago[cmake][msvc] Enable standards-conforming preprocessor
Jan Svoboda [Wed, 2 Nov 2022 16:35:00 +0000 (09:35 -0700)]
[cmake][msvc] Enable standards-conforming preprocessor

Since we now only support Visual Studio 2019 16.7 and newer, we're able to use the /Zc:preprocessor flag that turns on the standards-conforming preprocessor. Among other things, it correctly expands __VA_ARGS__. This enables removal of some boilerplate in D135128.

Reviewed By: Bigcheese, thieta

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

21 months ago[lldb] Update TestDump.test for gnuwin32's 'file' command output
Jonas Devlieghere [Wed, 2 Nov 2022 16:30:55 +0000 (09:30 -0700)]
[lldb] Update TestDump.test for gnuwin32's 'file' command output

Remove the colon from the CHECK line for the output of the file command.
On macOS and Linux, the file command uses a colon as the separator
between the path and the file type, but gnuwin32's file command uses a
semicolon.

21 months ago[mlir][Pass] Disallow mixing -pass-pipeline with other pass options
rkayaith [Tue, 11 Oct 2022 19:23:48 +0000 (15:23 -0400)]
[mlir][Pass] Disallow mixing -pass-pipeline with other pass options

Currently `-pass-pipeline` can be specified multiple times and mixed
with the individual `-pass-name` options. Removing this feature will
allow for including the pipeline anchor as part of the option
argument (see D134900).

Reviewed By: rriddle

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

21 months ago[mlir] Don't mix -pass-pipeline with other pass options
rkayaith [Tue, 11 Oct 2022 21:29:39 +0000 (17:29 -0400)]
[mlir] Don't mix -pass-pipeline with other pass options

These are test updates required for D135745, which disallows mixing
`-pass-pipeline` and the individual `-pass-name` options.

Reviewed By: rriddle, mehdi_amini

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

21 months ago[OpenMP][libomptarget] Fix AsyncInfoTy object in omp_target_memcpy
Kevin Sala Penadés [Wed, 2 Nov 2022 16:03:34 +0000 (12:03 -0400)]
[OpenMP][libomptarget] Fix AsyncInfoTy object in omp_target_memcpy

The AsyncInfoTy should be created in the same device as the async operation will be issued. In omp_target_memcpy, the AsyncInfoTy for the host to destination device transfer was created referring to the source device.

Reviewed By: tianshilei1992

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

21 months ago[flang] Handle dispatch on nopass procedure from array element
Valentin Clement [Wed, 2 Nov 2022 15:52:05 +0000 (16:52 +0100)]
[flang] Handle dispatch on nopass procedure from array element

When a fir.dispatch is done with a NOPASS type-bound
procedure, the object in fir.dispatch is just used to gather the vtable.
Therefore, no transformation is done on it and the original entity
is used. The current code generation didn't expect the entity to be an array.
This patch update the code generation to be able to retrieve the vtable
accordingly.

Reviewed By: PeteSteinfeld

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

21 months agollvm-reduce: Add explicit triple to test
Matt Arsenault [Wed, 2 Nov 2022 15:30:21 +0000 (08:30 -0700)]
llvm-reduce: Add explicit triple to test

Some host targets are managing to get through MIR parsing
without constructing their MachineFunctionInfo.

Fixes at least SystemZ and SPARC (issue 58768)

21 months ago[libc] Add a doc about the libc fullbuild mode.
Siva Chandra Reddy [Mon, 31 Oct 2022 08:25:25 +0000 (01:25 -0700)]
[libc] Add a doc about the libc fullbuild mode.

Reviewed By: jeffbailey

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

21 months ago[libc] Add links to libc Discourse and to the libc Discord channel.
Siva Chandra Reddy [Wed, 2 Nov 2022 07:34:11 +0000 (00:34 -0700)]
[libc] Add links to libc Discourse and to the libc Discord channel.

Reviewed By: jeffbailey

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

21 months ago[libc] Add a contributing guide to the docs.
Siva Chandra Reddy [Fri, 28 Oct 2022 08:09:38 +0000 (01:09 -0700)]
[libc] Add a contributing guide to the docs.

Reviewed By: jeffbailey

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

21 months ago[libc] Add a porting guide to the docs.
Siva Chandra Reddy [Fri, 28 Oct 2022 07:12:08 +0000 (00:12 -0700)]
[libc] Add a porting guide to the docs.

Reviewed By: jeffbailey

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

21 months ago[RISCV] Fix cost of legal fixed length masked load and stores
Philip Reames [Wed, 2 Nov 2022 00:19:29 +0000 (17:19 -0700)]
[RISCV] Fix cost of legal fixed length masked load and stores

We can cost them the same way as a scalable masked load/store. By hitting the default path, we were costing them as if they were being scalarized. This is a significant over estimate.

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

21 months agoFix Assignment Tracking docs error from 33c7ae55e729069be754f56c4d4606cdeddd377b
OCHyams [Wed, 2 Nov 2022 14:08:23 +0000 (14:08 +0000)]
Fix Assignment Tracking docs error from 33c7ae55e729069be754f56c4d4606cdeddd377b

link: https://lab.llvm.org/buildbot/#/builders/30/builds/27812
21 months ago[mlir] Use the same pipeline tuning options as clang for execution engine
Denys Shabalin [Wed, 2 Nov 2022 13:04:37 +0000 (14:04 +0100)]
[mlir] Use the same pipeline tuning options as clang for execution engine

This change make sure that ExecutionEngine's pass pipeline is identical to one
used by clang. Previously, SLPVectorization was not enabled which caused
differences in code...

...generation.

Reviewed By: ftynse

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

21 months ago[MIRVRegNamer] Avoid opcode hash collision
John Brawn [Fri, 28 Oct 2022 13:17:01 +0000 (14:17 +0100)]
[MIRVRegNamer] Avoid opcode hash collision

D121929 happens to cause CodeGen/MIR/AArch64/mirnamer.mir to fail due
to a hash collision caused by adding two extra opcodes. The collision
is only in the top 19 bits of the hashed opcode so fix this by just
using the whole hash (in fixed width hex for consistency) instead of
the top 5 decimal digits.

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

21 months ago[MachineCSE] Allow PRE of instructions that read physical registers
John Brawn [Thu, 27 Oct 2022 13:14:57 +0000 (14:14 +0100)]
[MachineCSE] Allow PRE of instructions that read physical registers

Currently MachineCSE forbids PRE when the instruction reads a physical
register. Relax this so that it's allowed when the value being read is
the same as what would be read in the place the instruction would be
hoisted to.

This is being done in preparation for adding FPCR handling to the
AArch64 backend, in order to prevent it to from worsening the
generated code, but for targets that already have a similar register
it should improve things.

This patch affects code generation in several tests. The new code
looks better except for in Thumb2/LowOverheadLoops/memcall.ll where
we perform PRE but the LowOverheadLoops transformation then undoes
it. Also in AMDGPU/selectcc-opt.ll the CHECK makes things look worse,
but actually the function as a whole is better (as a MOV is PRE'd).

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

21 months ago[CVP] Add test for icmp without constant operand (NFC)
Nikita Popov [Wed, 2 Nov 2022 13:47:57 +0000 (14:47 +0100)]
[CVP] Add test for icmp without constant operand (NFC)

We should still be able to fold comparisons based on ranged in
this case.

21 months ago[Assignment Tracking][1/*] Add initial docs for Assignment Tracking
OCHyams [Wed, 2 Nov 2022 13:42:52 +0000 (13:42 +0000)]
[Assignment Tracking][1/*] Add initial docs for Assignment Tracking

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
  rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

Add documentation outlining the intent and design.

21 months ago[InstCombine] fold mul with decremented "shl -1" factor (2nd try)
Sanjay Patel [Wed, 2 Nov 2022 13:15:11 +0000 (09:15 -0400)]
[InstCombine] fold mul with decremented "shl -1" factor (2nd try)

This is a corrected version of:
bc886e9b587b

I made a copy-paste error that created an "add" instead of the
intended "sub" on that attempt. The regression tests showed the
bug, but I overlooked that.

As I said in a comment on issue #58717, the bug reports resulting
from the botched patch confirm that the pattern does occur in
many real-world applications, so hopefully eliminating the multiply
results in better code.

I added one more regression test in this version of the patch,
and here's an Alive2 proof to show that exact example:
https://alive2.llvm.org/ce/z/dge7VC

Original commit message:

This is a sibling to:
6064e92b0a84
...but we canonicalize the shl+add to shl+xor,
so the pattern is different than I expected:
https://alive2.llvm.org/ce/z/8CX16e

I have not found any patterns that are safe
to propagate no-wrap, so that is not included
here.

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

21 months ago[DebugInfo] Fix minor debug info bug in deleteDeadLoop
OCHyams [Thu, 20 Oct 2022 14:40:14 +0000 (15:40 +0100)]
[DebugInfo] Fix minor debug info bug in deleteDeadLoop

Using a DebugVariable as the set key rather than std::pair<DIVariable *,
DIExpression *> ensures we don't accidently confuse multiple instances of
inlined variables.

Reviewed By: jryans

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

21 months ago[BasicAA] Re-enable cs-cs-arm.ll test (PR58738)
Nikita Popov [Wed, 2 Nov 2022 13:21:38 +0000 (14:21 +0100)]
[BasicAA] Re-enable cs-cs-arm.ll test (PR58738)

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

21 months ago[mlir][linalg] Fix crash in canonicalization pattern
Matthias Springer [Wed, 2 Nov 2022 11:36:54 +0000 (12:36 +0100)]
[mlir][linalg] Fix crash in canonicalization pattern

This crash was due to incorrect usage of `hasTensorSemantics`, which has changed recently with DestinationStyleOpInterface. An op has tensor semantics if all of its inits and inputs are tensors. Previously, only inits needed to be tensors.

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

21 months ago[Test] Add test exposing crash in SimpleLoopUnswitch
Dmitry Makogon [Wed, 2 Nov 2022 12:55:56 +0000 (19:55 +0700)]
[Test] Add test exposing crash in SimpleLoopUnswitch

The test crashes with an assert in unswitchNontrivialInvariants.

21 months ago[InstCombine] use logical-and matcher to avoid crash
Sanjay Patel [Wed, 2 Nov 2022 12:21:42 +0000 (08:21 -0400)]
[InstCombine] use logical-and matcher to avoid crash

Follow-on to:
ec0b406e16c44f1554

This should prevent crashing for example like issue #58552
by not matching a select-of-vectors-with-scalar-condition.

The test that shows a regression seems unlikely to occur
in real code.

This also picks up an optimization in the case where a real
(bitwise) logic op is used. We could already convert some
similar select ops to real logic via impliesPoison(), so
we don't see more diffs on commuted tests. Using commutative
matchers (when safe) might also handle one of the TODO tests.

21 months ago[InstCombine] add tests for logical-and / logical-or folds; NFC
Sanjay Patel [Wed, 2 Nov 2022 12:14:44 +0000 (08:14 -0400)]
[InstCombine] add tests for logical-and / logical-or folds; NFC

Similar to 29661fe94bf12ced1 - there are matching
deficiencies and a potential crash lurking in
these patterns.

21 months ago[wasm] Always treat DWARF expression addresses as load addresses
Philip Pfaffe [Wed, 2 Nov 2022 10:51:18 +0000 (10:51 +0000)]
[wasm] Always treat DWARF expression addresses as load addresses

When resolving absolute addresses for DW_OP_addr or DW_OP_addrx, these are always load addresses rather than file addresses in wasm.

Reviewed By: DavidSpickett

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

21 months agoReenable POSIX builtin library functions in gnu2x mode
Aaron Ballman [Wed, 2 Nov 2022 11:56:43 +0000 (07:56 -0400)]
Reenable POSIX builtin library functions in gnu2x mode

gnu17 and earlier modes automatically expose several POSIX C APIs, and
this was accidentally disabled for gnu2x in
7d644e1215b376ec5e915df9ea2eeb56e2d94626.

This restores the behavior for gnu2x mode (without changing the
behavior in C standards modes instead of GNU modes).

Fixes #56607

21 months ago[InstCombine] Remove redundant splats in InstCombineVectorOps
Matt Devereau [Wed, 12 Oct 2022 09:20:05 +0000 (09:20 +0000)]
[InstCombine] Remove redundant splats in InstCombineVectorOps

Splatting the first vector element of the result of a BinOp, where any of the
BinOp's operands are the result of a first vector element splat can be simplified to
splatting the first vector element of the result of the BinOp

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

21 months ago[AMDGPU][NFC] Split MC tests into promoted from VOP1 to VOP3 and only VOP3
Mirko Brkusanin [Tue, 1 Nov 2022 15:32:55 +0000 (16:32 +0100)]
[AMDGPU][NFC] Split MC tests into promoted from VOP1 to VOP3 and only VOP3

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

21 months ago[AMDGPU][NFC] Split MC tests into promoted from VOP2 to VOP3 and only VOP3
Mirko Brkusanin [Tue, 1 Nov 2022 15:22:45 +0000 (16:22 +0100)]
[AMDGPU][NFC] Split MC tests into promoted from VOP2 to VOP3 and only VOP3

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

21 months ago[RuntimeDyld] Require x86_64-linux for IFUNC test
Moritz Sichert [Wed, 2 Nov 2022 11:08:52 +0000 (12:08 +0100)]
[RuntimeDyld] Require x86_64-linux for IFUNC test

This test was introduced by a667aa4de041816cb4865bce8f523228f2332ffa. It
assumes that it runs on x86_64 on linux, so require that for the test.

21 months ago[AMDGPU] Constify a couple of methods. NFC.
Jay Foad [Wed, 2 Nov 2022 11:03:59 +0000 (11:03 +0000)]
[AMDGPU] Constify a couple of methods. NFC.

21 months ago[LoopPredication][NFCI] Perform 'visited' check before pushing to worklist
Max Kazantsev [Wed, 2 Nov 2022 11:02:59 +0000 (18:02 +0700)]
[LoopPredication][NFCI] Perform 'visited' check before pushing to worklist

This prevents duplicates to be pushed into the stack and hypothetically
should reduce memory footprint on ugly cornercases with multiple repeating
duplicates in 'and' tree.

21 months ago[clangd] Index unscoped enums in class scope for code completion
Tom Praschan [Wed, 2 Nov 2022 11:50:50 +0000 (12:50 +0100)]
[clangd] Index unscoped enums in class scope for code completion

Fixes https://github.com/clangd/clangd/issues/1082

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

21 months ago[mlir] Make `OperationFingerPrint` class public
Ivan Butygin [Mon, 31 Oct 2022 13:16:03 +0000 (14:16 +0100)]
[mlir] Make `OperationFingerPrint` class public

It can be useful to external users as well for detecting if there were any changes in IR between passes.

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

21 months ago[MachineCombiner] Add `const` to `shouldReduceRegisterPressure` arguments. NFC
Anton Sidorenko [Tue, 1 Nov 2022 16:32:39 +0000 (19:32 +0300)]
[MachineCombiner] Add `const` to `shouldReduceRegisterPressure` arguments. NFC

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

21 months ago[RuntimeDyld] Added support for relocation of indirect functions
Moritz Sichert [Wed, 20 Jan 2021 16:08:47 +0000 (17:08 +0100)]
[RuntimeDyld] Added support for relocation of indirect functions

In ELF, symbols of type STT_GNU_IFUNC need to be resolved by calling the
function at the symbol's address. This is implemented by adding special
stubs for all symbols of that type.

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

21 months ago[ValueLattice] Use DL-aware folding in getCompare()
Nikita Popov [Wed, 2 Nov 2022 09:41:11 +0000 (10:41 +0100)]
[ValueLattice] Use DL-aware folding in getCompare()

Use DL-aware ConstantFoldCompareInstOperands() API instead of
ConstantExpr API. The practical effect of this is that SCCP can
now fold comparisons that require DL.

21 months ago[ValueLattice] Move getCompare() out of line (NFC)
Nikita Popov [Wed, 2 Nov 2022 09:33:44 +0000 (10:33 +0100)]
[ValueLattice] Move getCompare() out of line (NFC)

This is a fairly large method that is unlikely to benefit from
inlining.

21 months ago[SCCP] Add test for icmp that requires DL to fold (NFC)
Nikita Popov [Wed, 2 Nov 2022 09:30:04 +0000 (10:30 +0100)]
[SCCP] Add test for icmp that requires DL to fold (NFC)

21 months agoReapply [ValueLattice] Fix getCompare() for undef values
Nikita Popov [Tue, 1 Nov 2022 15:39:20 +0000 (16:39 +0100)]
Reapply [ValueLattice] Fix getCompare() for undef values

Relative to the previous attempt, this also updates the
ValueLattice unit tests.

-----

Resolve the TODO about incorrect getCompare() behavior. This can
be made more precise (e.g. by materializing the undef value and
performing constant folding on it), but for now just return an
unknown result to fix the correctness issue.

This should be NFC in terms of user-visible behavior, because the
only user of this method (SCCP) was already guarding against
UndefValue results.

21 months ago[AA] Remove some overloads (NFC)
Nikita Popov [Tue, 1 Nov 2022 15:23:26 +0000 (16:23 +0100)]
[AA] Remove some overloads (NFC)

Having all these instruction-specific overloads does not seem to
provide any compile-time benefit, so drop them in favor of the
generic methods accepting "const Instruction *". Only leave behind
the per-instruction AAQI overloads, which are part of the internal
implementation.

21 months ago[mlir][transform] Add PrintOp to transform dialect
Matthias Springer [Wed, 2 Nov 2022 09:09:46 +0000 (10:09 +0100)]
[mlir][transform] Add PrintOp to transform dialect

This op dumps the associated payload IR to stderr. It has proven useful for printf-style debugging.

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

21 months ago[reland][libc] Switch to new implementation of mem* functions
Guillaume Chatelet [Wed, 2 Nov 2022 09:03:58 +0000 (09:03 +0000)]
[reland][libc] Switch to new implementation of mem* functions

The new framework makes it explicit which processor feature is being
used and allows for easier per platform customization:
 - ARM cpu now uses trivial implementations to reduce code size.
 - Memcmp, Bcmp and Memmove have been optimized for x86
 - Bcmp has been optimized for aarch64.

This is a reland of https://reviews.llvm.org/D135134 (b3f1d58, 028414881381)

Reviewed By: courbet

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

21 months agoRevert "[FLANG] Fix MSVC + clang-cl build"
Muhammad Omair Javaid [Wed, 2 Nov 2022 09:06:43 +0000 (13:06 +0400)]
Revert "[FLANG] Fix MSVC + clang-cl build"

This reverts commit 870fbf8e300f3012470593ac087219a04d52857f.

21 months ago[ConstraintElimination] Do not crash on vector GEP in decomposeGEP
Bjorn Pettersson [Tue, 1 Nov 2022 18:55:23 +0000 (19:55 +0100)]
[ConstraintElimination] Do not crash on vector GEP in decomposeGEP

Commit 359bc5c541ae4b02 caused
 Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"'
failures in decomposeGEP when the GEP pointer operand is a vector.

Fix is to use DataLayout::getIndexTypeSizeInBits when fetching the
index size, as it will use the scalar type in case of a ptr vector.

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

21 months ago[AArch64][SVE2] Add the SVE2.1 ld1q gather & st1q scatter instructions
David Sherwood [Tue, 1 Nov 2022 15:09:26 +0000 (15:09 +0000)]
[AArch64][SVE2] Add the SVE2.1 ld1q gather & st1q scatter instructions

This patch adds the assembly/disassembly for the following instructions:

ld1q : Gather load quadwords
st1q : Scatter store quadwords

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

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

21 months ago[libc] Improve testing of mem functions
Guillaume Chatelet [Thu, 27 Oct 2022 17:01:14 +0000 (17:01 +0000)]
[libc] Improve testing of mem functions

This patch extracts the testing logic from `op_tests.cpp` into
`memory_check_utils.h` so we can reuse it for mem* function integration
tests.

This makes testing consistent and thorough.
For instance this catches a bug that got unnoticed during submission of
D136595 and D135134. Integration test for memcmp was only testing a
single size.

This also leverages ASAN to make sure that data is not read / written
outside permitted boundaries

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

21 months ago[AArch64][SVE2] Add the SVE2.1 while & pext predicate pair instructions
David Sherwood [Wed, 26 Oct 2022 10:40:02 +0000 (10:40 +0000)]
[AArch64][SVE2] Add the SVE2.1 while & pext predicate pair instructions

This patch adds the assembly/disassembly for the following
predicate pair instructions:

pext:    Set pair of predicates from predicate-as-counter
whilelt: While incrementing signed scalar less than scalar
whilele: While incrementing signed scalar less than or equal to scalar
whilegt: While incrementing signed scalar greater than scalar
whilege: While incrementing signed scalar greater than or equal to scalar
whilelo: While incrementing unsigned scalar lower than scalar
whilels: While incrementing unsigned scalar lower or same as scalar
whilehs: While decrementing unsigned scalar higher or same as scalar
whilehi: While decrementing unsigned scalar higher than scalar

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

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

21 months ago[FLANG] Fix MSVC + clang-cl build
Muhammad Omair Javaid [Mon, 31 Oct 2022 20:53:16 +0000 (00:53 +0400)]
[FLANG] Fix MSVC + clang-cl build

Flang build on windows with MSVC environment and clang-cl compiler
requires clang_rt.builtin.${target} library. This patch allows us to
locate and include this link library. This is mostly needed for flang
runtime and associated unittests. Clang implicitly uses this library
while calling lld-link via clang driver however a standalone call to
lld-link doesnt link against clang_rt library on its own.

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

21 months ago[CLANG] XFAIL c-strings.c & volatile-1.c AArch64/Windows
Muhammad Omair Javaid [Wed, 2 Nov 2022 08:29:21 +0000 (12:29 +0400)]
[CLANG] XFAIL c-strings.c & volatile-1.c AArch64/Windows

c-strings.c and volatile-1.c failing due to alignment issue on WoA. I am
going to mark them as XFAIL for now.

21 months ago[asan][test] Convert some tests to use opaque pointers
Fangrui Song [Wed, 2 Nov 2022 08:26:48 +0000 (01:26 -0700)]
[asan][test] Convert some tests to use opaque pointers

21 months ago[X86] Use default attributes for more intrinsics
Nikita Popov [Tue, 1 Nov 2022 13:24:41 +0000 (14:24 +0100)]
[X86] Use default attributes for more intrinsics

This is a continuation of D136939, adding the default attributes
(nosync, nofree, nocallback and willreturn) to more readnone
X86 intrinsics.

This still doesn't cover all of them...

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

21 months ago[LoongArch] Inline one-time-used variable and format codes. NFC.
gonglingqin [Tue, 1 Nov 2022 11:31:30 +0000 (19:31 +0800)]
[LoongArch] Inline one-time-used variable and format codes. NFC.

21 months ago[flang] lower intrinsic constants to HLFIR
Jean Perier [Wed, 2 Nov 2022 07:36:45 +0000 (08:36 +0100)]
[flang] lower intrinsic constants to HLFIR

Use the utility to lower Constant<T> that was split from current lowering
in https://reviews.llvm.org/D136955.

The difference in HLFIR is the addition of a fir.declare on constant
outlined in memory so that all the information about them is available.

Lowering to HLFIR is enabled in Brideg::genExprValue to allow testing
of scalar constant lowering.

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

21 months ago[libc] Add definitions of a few missing macros and types.
Siva Chandra Reddy [Tue, 1 Nov 2022 22:27:21 +0000 (22:27 +0000)]
[libc] Add definitions of a few missing macros and types.

21 months ago[hwasan] Remove no-op setDSOLocal. NFC
Fangrui Song [Wed, 2 Nov 2022 07:17:16 +0000 (00:17 -0700)]
[hwasan] Remove no-op setDSOLocal. NFC

PrivateLinkage and HiddenVisibility are implicitly dso_local.

21 months ago[CSKY] Fix the adjustFixupValue of fixup_csky_pcrel_uimm7_scale4
Zi Xuan Wu (Zeson) [Mon, 31 Oct 2022 10:07:37 +0000 (18:07 +0800)]
[CSKY] Fix the adjustFixupValue of fixup_csky_pcrel_uimm7_scale4

The logic to calculate the offset of lrw16 is complex and the Value
before adjustFixupValue should in range of 0 <= (Value >> 2) <= 0xfe.

It also influences the relax condition.

21 months ago[CSKY] Fix .bss directive compling error created by --save-temps
Zi Xuan Wu (Zeson) [Fri, 28 Oct 2022 02:26:32 +0000 (10:26 +0800)]
[CSKY] Fix .bss directive compling error created by --save-temps

.bss without symbol and num following can't be compiled in CSKY target, which is consistent to GCC behavior.
So when --save-temps generates .bss, we should UsesELFSectionDirectiveForBSS to avoid such error.

21 months ago[compiler-rt] Switch from llvm-config to find_package(LLVM)
Michał Górny [Sat, 29 Oct 2022 17:03:37 +0000 (19:03 +0200)]
[compiler-rt] Switch from llvm-config to find_package(LLVM)

Replace the use of the deprecated `llvm-config` tool with LLVM's CMake
files for detecting LLVM in standalone builds.

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