platform/upstream/llvm.git
2 years ago[scudo][Fuchsia] Increase MaxNumCachedHint
Alex Brachet [Thu, 29 Sep 2022 20:57:10 +0000 (20:57 +0000)]
[scudo][Fuchsia] Increase MaxNumCachedHint

This brings the value closer to other platforms and allows
for future improvements, see D133897.

2 years ago[libc] Add GNU extension functions sched_getaffinity and sched_setaffinity.
Siva Chandra Reddy [Thu, 29 Sep 2022 07:57:52 +0000 (07:57 +0000)]
[libc] Add GNU extension functions sched_getaffinity and sched_setaffinity.

Reviewed By: michaelrj

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

2 years ago[HIP] stop forcing the lang std in the driver
Siu Chi Chan [Tue, 13 Sep 2022 17:42:43 +0000 (13:42 -0400)]
[HIP] stop forcing the lang std in the driver

D103221 changed HIP's default to C++14, removing the driver logic to
force it into a different std.

Change-Id: I9f5220a7456687039b0bd3b3574f3124d3cc7665

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

Change-Id: I40513f2ebe93ee53ea95c8bb3cc704487d970263

2 years ago[Clang][NFC] Fix broken link in release notes
Roy Jacobson [Thu, 29 Sep 2022 20:16:17 +0000 (23:16 +0300)]
[Clang][NFC] Fix broken link in release notes

2 years ago[Clang] P1169R4: static operator()
Roy Jacobson [Thu, 29 Sep 2022 15:45:03 +0000 (18:45 +0300)]
[Clang] P1169R4: static operator()

Implements 'P1169R4: static operator()' from C++2b.

Reviewed By: #clang-language-wg, aaron.ballman

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

2 years ago[SCEVExpander] Move LCSSA fixup to ::expand.
Florian Hahn [Thu, 29 Sep 2022 19:49:55 +0000 (20:49 +0100)]
[SCEVExpander] Move LCSSA fixup to ::expand.

Move LCSSA fixup from ::expandCodeForImpl to ::expand(). This has
the advantage that we directly preserve LCSSA nodes here instead of
relying on doing so in rememberInstruction. It also ensures that we
 don't add the non-LCSSA-safe value to InsertedExpressions.

Alternative to D132704.

Fixes #57000.

Reviewed By: efriedma

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

2 years ago[X86] Avoid miscompile in combineOr (X86ISelLowering.cpp)
Bjorn Pettersson [Thu, 29 Sep 2022 16:22:56 +0000 (18:22 +0200)]
[X86] Avoid miscompile in combineOr (X86ISelLowering.cpp)

In combineOr (X86ISelLowering.cpp) there is a DAG combine that rewrite
a "(0 - SetCC) | C" pattern into something simpler given that a LEA
can be used. Another requirement is that C has some specific value,
for example 1 or 7. When checking those requirements the code used a
32-bit unsigned variable to store the value of C. So for a 64-bit OR
this could miscompile in case any of the 32 most significant bits in
C were non zero.

This patch adds fixes the bug by using a large enough type for the
C value.

The faulty code seem to have been introduced by commit 9bceb8981d32fe
(D131358).

Reviewed By: RKSimon

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

2 years ago[X86] Pre-commit test case showing bug in combineOr (X86ISelLowering.cpp)
Bjorn Pettersson [Thu, 29 Sep 2022 16:14:15 +0000 (18:14 +0200)]
[X86] Pre-commit test case showing bug in combineOr (X86ISelLowering.cpp)

In combineOr (X86ISelLowering.cpp) there is a DAG combine that rewrite
a "(0 - SetCC) | C" pattern into something simpler given that a LEA
can be used. Another requirement is that C has some specific value,
for example 1 or 7. When doing that check it is using a 32-bit
unsigned variable to store the value of C. So for a 64-bit OR this
could miscompile in case any of the 32 most significant bits in C
are set.

This patch adds a test case to show this miscompile bug.

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

2 years ago[Driver][test] Restore %clang -cc1 in test/Driver
Fangrui Song [Thu, 29 Sep 2022 19:21:57 +0000 (12:21 -0700)]
[Driver][test] Restore %clang -cc1 in test/Driver

This partially reverts commit 1609a5d7715c06ff52c13af8b20ee64811a8ec7b (the
test/Driver part). We want to discourage %clang_cc1 and clang -cc1 in
test/Driver. The clang -cc1 uses in hlsl/offload/etc are not good examples.

2 years ago[mlir][sparse] fix build breakage due to Arith name change
Aart Bik [Thu, 29 Sep 2022 19:09:09 +0000 (12:09 -0700)]
[mlir][sparse] fix build breakage due to Arith name change

Reviewed By: Peiming

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

2 years ago[libc++] Include skipped headers in the --trace-includes output
Louis Dionne [Wed, 28 Sep 2022 20:07:43 +0000 (16:07 -0400)]
[libc++] Include skipped headers in the --trace-includes output

By default, Clang does not include headers that are skipped due to
the include guard optimization in the --trace-includes output, which
breaks the use case that we were trying to use it for.

However, Clang does support the -fshow-skipped-includes flag, which
does exactly what we need and will result in an accurate include
graph.

As a fly-by fix, make sure that our includes don't differ between
-fexceptions and -fno-exceptions.

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

2 years ago[clang] [test] Use %clang_cc1 substitution consistently
Michał Górny [Thu, 29 Sep 2022 18:58:47 +0000 (20:58 +0200)]
[clang] [test] Use %clang_cc1 substitution consistently

Use the `%clang_cc1` substitution consistently across the test suite,
replacing inline `%clang -cc1` invocations, except for one Preprocessor
test where this is causing breakage.  This is necessary to ensure that
additional parameters passed via `%clang` do not interfere with `-cc1`
that must always be passed as the first command-line argument.

Remove the additional substitution blocking `%clang_cc1` use in Driver
tests.  It has been added in 2013 and was supposed to prevent tests
calling `clang -cc1` from being added to Driver.  The state of the test
suite proves that it did not succeed at all.

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

2 years ago[llvm] [lit] Move %clang_dxc substitution from clang/test
Michał Górny [Thu, 29 Sep 2022 18:58:43 +0000 (20:58 +0200)]
[llvm] [lit] Move %clang_dxc substitution from clang/test

Move the `%clang_dxc` substitution from local definition in clang/test
to lit's `llvm/config.py` module where all other driver definitions
are found.  This improves consistency and makes it easier to control
global clang options.

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

2 years ago[clang] [Driver] More flexible rules for loading default configs
Michał Górny [Thu, 29 Sep 2022 18:58:35 +0000 (20:58 +0200)]
[clang] [Driver] More flexible rules for loading default configs

Change the default config file loading logic to be more flexible
and more readable at the same time.  The new algorithm focuses on four
locations, in order:

1. <triple>-<mode>.cfg using real driver mode
2. <triple>-<mode>.cfg using executable suffix
3. <triple>.cfg + <mode>.cfg using real driver mode
4. <triple>.cfg + <mode>.cfg using executable suffix

This is meant to preserve reasonable level of compatibility with
the existing use, while introducing more flexibility and making the code
simpler.  Notably:

1. In this layout, the actual target triple is normally respected,
   and e.g. in `-m32` build the `x86_64-*` configs will never be used.

2. Both real driver mode (preferable) and executable suffix are
   supported.  This permits correctly handling calls with explicit
   `--driver-mode=` while at the same time preserving compatibility
   with the existing code.

3. The first two locations provide users with the ability to override
   configuration per specific target+mode combinaton, while the next two
   make it possible to independently specify per-target and per-mode
   configuration.

4. All config file locations are applicable independently of whether
   clang is started via a prefixed executable, or bare `clang`.

5. If the target is not explicitly specified and the executable prefix
   does not name a valid triple, it is used instead of the actual target
   triple for backwards compatibility.

This is particularly meant to address Gentoo's use case for
configuration files: to configure the default runtimes (i.e. `-rtlib=`,
`-stdlib=`) and `--gcc-install-dir=` for all the relevant drivers,
as well as to make it more convenient for users to override `-W` flags
to test compatibility with future versions of Clang easier.

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

2 years ago[mlir][sparse] Add rewrite rule for the sort operator.
bixia1 [Wed, 28 Sep 2022 19:59:00 +0000 (12:59 -0700)]
[mlir][sparse] Add rewrite rule for the sort operator.

Add sparse-buffer-rewrite pass to rewrite sparse primitives on buffers to MLIR
implementation.

Add sparse rewrite rule for the sort operator.

Add FileCheck test and integration test.

Reviewed By: aartbik

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

2 years ago[clang][deps] NFC: Expose more flexible version of `Worker::computeDependencies()`
Jan Svoboda [Thu, 29 Sep 2022 18:00:42 +0000 (11:00 -0700)]
[clang][deps] NFC: Expose more flexible version of `Worker::computeDependencies()`

This patch adds new member function to `DependencyScanningWorker` that allows clients to pass custom `DiagnosticConsumer`, and returns `bool`.

This provides more flexibility compared to the existing version that automatically stringifies diagnostics and returns them in `llvm::Error`.

Reviewed By: benlangmuir

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

2 years ago[libclang] Split-out parts of `Index.h`
Jan Svoboda [Thu, 29 Sep 2022 17:58:27 +0000 (10:58 -0700)]
[libclang] Split-out parts of `Index.h`

The `Index.h` header defines some functions and data structures that are useful for other (non-indexing) APIs. This patch extracts those into separate headers.

Reviewed By: akyrtzi, benlangmuir

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

2 years ago[Clang][NFC] Add missing feature macros to lexer test
Roy Jacobson [Thu, 29 Sep 2022 18:16:29 +0000 (21:16 +0300)]
[Clang][NFC] Add missing feature macros to lexer test

2 years agoWhen there are variable errors, display an error in VS Code's local variables view.
Greg Clayton [Wed, 21 Sep 2022 03:58:08 +0000 (20:58 -0700)]
When there are variable errors, display an error in VS Code's local variables view.

After recent diffs that enable variable errors that stop variables from being correctly displayed when debugging, allow users to see these errors in the LOCALS variables in the VS Code UI. We do this by detecting when no variables are available and when there is an error to be displayed, and we add a single variable named "<error>" whose value is a string error that the user can read. This allows the user to be aware of the reason variables are not available and fix the issue. Previously if someone enabled "-gline-tables-only" or was debugging with DWARF in .o files or with .dwo files and those separate object files were missing or they were out of date, the user would see nothing in the variables view. Communicating these errors to the user is essential to a good debugging experience.

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

2 years ago[NFC] Add header documentation to the SBError::GetCString() to clarify ownwership...
Greg Clayton [Thu, 29 Sep 2022 00:33:12 +0000 (17:33 -0700)]
[NFC] Add header documentation to the SBError::GetCString() to clarify ownwership of the returned string.

Title says it all!

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

2 years ago[AArch64] Lower multiplication by a constant (NFC)
zhongyunde [Thu, 29 Sep 2022 17:35:18 +0000 (01:35 +0800)]
[AArch64] Lower multiplication by a constant (NFC)

Refactor according https://reviews.llvm.org/D134706#inline-1298952
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D134848

2 years ago[DX] [ObjectYAML] Support DX shader feature flags
Chris Bieneman [Tue, 20 Sep 2022 21:30:59 +0000 (16:30 -0500)]
[DX] [ObjectYAML] Support DX shader feature flags

DXContainers contain a feature flag part, which stores a bitfield used
to denote what underlying hardware features the shader requires. This
change adds feature flags to the DXContainer YAML tooling to enable
testing generating feature flags during HLSL code generation.

Depends on D133980

Reviewed By: lhames

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

2 years ago[AArch64] Lower multiplication by a constant int to shl+sub+shl
zhongyunde [Thu, 29 Sep 2022 17:30:31 +0000 (01:30 +0800)]
[AArch64] Lower multiplication by a constant int to shl+sub+shl

Decompose the const 14 can be separated from D132322
Change the costmodel to lower a = b * C where C = 2^n - 2^m to
        lsl     w8, w0, n
        sub     w0, w8, w0, lsl m
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D134706

2 years agoRevert "[mlir][Linalg] Add ReduceOp to Linalg structured ops."
Stella Stamenova [Thu, 29 Sep 2022 17:23:54 +0000 (10:23 -0700)]
Revert "[mlir][Linalg] Add ReduceOp to Linalg structured ops."

This reverts commit d02233f0da17c73f2070b5d59c80547102fa12a3.

This commit the Windows mlir buildbot: https://lab.llvm.org/buildbot/#/builders/13/builds/26413

2 years ago[libc] add clock_gettime
Michael Jones [Fri, 23 Sep 2022 21:00:52 +0000 (14:00 -0700)]
[libc] add clock_gettime

Add the clock_gettime syscall wrapper and tests.

Reviewed By: sivachandra

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

2 years ago[gn build] Port 63accaf46f09
LLVM GN Syncbot [Thu, 29 Sep 2022 17:15:28 +0000 (17:15 +0000)]
[gn build] Port 63accaf46f09

2 years ago[NFC] Refactor DXContainer to support more parts
Chris Bieneman [Wed, 28 Sep 2022 18:30:44 +0000 (13:30 -0500)]
[NFC] Refactor DXContainer to support more parts

This patch refactors some of the DXContainer Object and YAML code to
make it easier to add more part parsing.

DXContainer has a whole bunch of constant values, so I've added a
DXContainerConstants.def file which will grow with constant
definitions, but starts with just part identifiers. I've also added a
utility to parse the part magic string into an enum, and converted the
code to use that utility and the enum instead of the part literal
string.

Reviewed By: lhames

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

2 years agoRevert "[DirectX backend] Support global ctor for DXILBitcodeWriter."
Chris Bieneman [Thu, 29 Sep 2022 16:57:47 +0000 (11:57 -0500)]
Revert "[DirectX backend] Support global ctor for DXILBitcodeWriter."

This reverts commit 26129766df701d462ed9a6a9a68a88b3564a70bd.

The reverted commit broke in-tree unit tests for the DirectX backend.

2 years ago[AMDGPU][MC][GFX11] Disable non-null src0 for s_waitcnt_*cnt
Dmitry Preobrazhensky [Thu, 29 Sep 2022 16:54:00 +0000 (19:54 +0300)]
[AMDGPU][MC][GFX11] Disable non-null src0 for s_waitcnt_*cnt

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

2 years ago[CGSCC][DevirtWrapper] Properly handle invalidating analyses for invalidated SCCs
Arthur Eubanks [Thu, 29 Sep 2022 16:54:10 +0000 (09:54 -0700)]
[CGSCC][DevirtWrapper] Properly handle invalidating analyses for invalidated SCCs

f77342693 handled the adaptor and pass manager but missed the devirt wrapper.

2 years ago[mlir][scf] Simplify the logic for `replaceLoopWithNewYields` for perfectly nested...
Mahesh Ravishankar [Mon, 26 Sep 2022 22:09:31 +0000 (22:09 +0000)]
[mlir][scf] Simplify the logic for `replaceLoopWithNewYields` for perfectly nested loops.

Based on discussion in https://reviews.llvm.org/D134411, instead of
first modifying the inner most loop first followed by modifying the
outer loops from inside out, this patch restructures the logic to
start the modification from the outer most loop.

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

2 years ago[DSE] Eliminate noop store even through has clobbering between LoadI and StoreI
luxufan [Mon, 12 Sep 2022 01:02:09 +0000 (01:02 +0000)]
[DSE] Eliminate noop store even through has clobbering between LoadI and StoreI

For noop store of the form of LoadI and StoreI,
An invariant should be kept is that the memory state of the related
MemoryLoc before LoadI is the same as before StoreI.
For this example:
```
define void @pr49927(i32* %q, i32* %p) {
  %v = load i32, i32* %p, align 4
  store i32 %v, i32* %q, align 4
  store i32 %v, i32* %p, align 4
  ret void
}
```
Here the definition of the store's destination is different with the
definition of the load's destination, which it seems that the
invariant mentioned above is broken. But the definition of the
store's destination would write a value that is LoadI, actually, the
invariant is still kept. So we can safely ignore it.

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

Reviewed By: nikic

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

2 years ago[ARM] Add an option for disabling omitting DLS.
David Green [Thu, 29 Sep 2022 16:42:45 +0000 (17:42 +0100)]
[ARM] Add an option for disabling omitting DLS.

Useful for testing, this option disables when `DLS lr, lr` gets removed.

2 years ago[flang] Add atomic_fetch_or to the list of intrinsics
Katherine Rasmussen [Fri, 2 Sep 2022 00:01:52 +0000 (17:01 -0700)]
[flang] Add atomic_fetch_or to the list of intrinsics

Add the atomic subroutine, atomic_fetch_or, to the list of
intrinsic subroutines. Add new enumerators to deal with the rank
of the atom dummy argument, and the kind of atomic_int_kind. Use
check for a coindexed-object for the fourth dummy argument. Move
atomic_int_kind and atomic_logical_kind definitions from
iso_fortran_env module to the __fortran_builtins module to allow
for access to those values when analyzing `atomic_fetch_or`
calls in flang/lib/Evaluate/intrinsics.cpp.

Reviewed By: jeanPerier

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

2 years ago[AArch64][GlobalISel] Update shuffle->ext test before patch.
Amara Emerson [Thu, 29 Sep 2022 16:20:02 +0000 (17:20 +0100)]
[AArch64][GlobalISel] Update shuffle->ext test before patch.

2 years ago[mlir][Affine] Move/expose hasNoInterveningEffect
Maksim Levental [Thu, 29 Sep 2022 16:08:36 +0000 (11:08 -0500)]
[mlir][Affine] Move/expose hasNoInterveningEffect

Expose [[ https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Affine/Utils/Utils.cpp#L661 | Dialect/Affine/Utils/Utils.cpp#hasNoInterveningEffect ]] for downstream use (particular use case is a lazy implementation of [[ https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Affine/Utils/Utils.cpp#L845 | forwardStoreToLoad ]] in CIRCT). This exposes hasNoInterveningEffect and instantiates for the necessary types.

Reviewed By: bondhugula

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

2 years ago[InstSimplify][PhaseOrdering] add tests for vector select of min/max; NFC
Sanjay Patel [Wed, 28 Sep 2022 16:13:34 +0000 (12:13 -0400)]
[InstSimplify][PhaseOrdering] add tests for vector select of min/max; NFC

The phase ordering test is the almost unoptimized IR for the example
in issue #42100; it was passed through -mem2reg to reduce obvious
excessive load/store and other noise.

D134879

2 years ago[ModuleInliner] Add a cost-benefit-based priority
Kazu Hirata [Thu, 29 Sep 2022 16:00:38 +0000 (09:00 -0700)]
[ModuleInliner] Add a cost-benefit-based priority

This patch teaches the module inliner a traversal order designed for
the instrumentation FDO (+ThinLTO) scenario.

The new traversal order prioritizes call sites in the following order:

1. Those call sites that are expected to reduce the caller size

2. Those call sites that have gone through the cost-benefit analaysis

3. The remaining call sites

With this fairly simple traversal order, a large internel benchmark
yields performance comparable to the bottom-up inliner -- both in
terms of the execution performance and .text* sizes.

Big thanks goes to Liqiang Tao for the module inliner infrastructure.

I still have hacks outside this patch to prevent excessively long
compilation or .text* size explosion.  I'm trying to come up with
acceptable solutions in near future.

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

2 years ago[lld][COFF][LTO] Don't disable verifier in assert builds
Arthur Eubanks [Wed, 28 Sep 2022 22:57:19 +0000 (15:57 -0700)]
[lld][COFF][LTO] Don't disable verifier in assert builds

We should catch more issues this way.

This previously the behavior and was dropped in cde5e5b600b06.

Reviewed By: hans

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

2 years ago[flang][mlir][arith] Fix flang build after dialect renaming
Jakub Kuderski [Thu, 29 Sep 2022 15:55:17 +0000 (11:55 -0400)]
[flang][mlir][arith] Fix flang build after dialect renaming

Tested with `ninja check-flang`

2 years ago[NFC][libc++][test] Enables variant test.
Mark de Wever [Wed, 28 Sep 2022 17:58:05 +0000 (19:58 +0200)]
[NFC][libc++][test] Enables variant test.

Noticed this while working on D133326. Let's see whehter all compilers
now support this feature.

Reviewed By: #libc, philnik, ldionne

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

2 years ago[mlir][arith] Change dialect name from Arithmetic to Arith
Jakub Kuderski [Thu, 29 Sep 2022 15:14:47 +0000 (11:14 -0400)]
[mlir][arith] Change dialect name from Arithmetic to Arith

Suggested by @lattner in https://discourse.llvm.org/t/rfc-define-precise-arith-semantics/65507/22.

Tested with:
`ninja check-mlir check-mlir-integration check-mlir-mlir-spirv-cpu-runner check-mlir-mlir-vulkan-runner check-mlir-examples`

and `bazel build --config=generic_clang @llvm-project//mlir:all`.

Reviewed By: lattner, Mogball, rriddle, jpienaar, mehdi_amini

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

2 years ago[DSE][NFC] Update noop-stores.ll using update_test_checks.py
luxufan [Sun, 25 Sep 2022 14:56:19 +0000 (14:56 +0000)]
[DSE][NFC] Update noop-stores.ll using update_test_checks.py

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

2 years ago[ValueTracking] Fix CannotBeOrderedLessThanZero() for fdiv (PR58046)
Nikita Popov [Thu, 29 Sep 2022 13:51:05 +0000 (15:51 +0200)]
[ValueTracking] Fix CannotBeOrderedLessThanZero() for fdiv (PR58046)

When checking the RHS of fdiv, we should set the SignBitOnly flag,
because a negative zero can become -Inf, which is ordered less
than zero.

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

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

2 years ago[Debugify][OriginalDIMode] Update script to handle large JSON reports
Nikola Tesic [Wed, 28 Sep 2022 10:34:32 +0000 (12:34 +0200)]
[Debugify][OriginalDIMode] Update script to handle large JSON reports

This patch updates llvm/utils/llvm-original-di-preservation.py to create more
compact HTML verify-debuginfo-preserve reports by:
- removing duplicated debug info bugs,
- introducing -compress option to create highly compressed report.
Additionally, this patch makes script able to process very large JSON inputs.
That is done by reading & analyzing JSON report in chunks.

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

2 years ago[Debugify][OriginalDIMode] Make HTML reporting infrastructure more resilient
Nikola Tesic [Wed, 28 Sep 2022 10:32:46 +0000 (12:32 +0200)]
[Debugify][OriginalDIMode] Make HTML reporting infrastructure more resilient

Debugify in OriginalDebugInfo mode (verify-each-debuginfo-preserve), when used
in parallel builds of large projects, can produce incorrect report. More
precisely, simultaneous writes to JSON report file, could form incorrect JSON
objects, which describe found Debug Info bugs.
This patch uses the lock/unlock mechanism to protect JSON report file and also
makes script llvm/utils/llvm-original-di-preservation.py resilient to corrupted
lines in the report file. So, it ensures the creation of HTML report.

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

2 years ago[RISCV] Adjust vector immediate store materialization cost
Philip Reames [Thu, 29 Sep 2022 14:31:03 +0000 (07:31 -0700)]
[RISCV] Adjust vector immediate store materialization cost

This change updates the costs to make constant pool loads match their actual cost, and adds the broadcast special case to avoid too many regressions. We really need more information about the constants being rematerialized, but this is an incremental improvement.

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

2 years ago[libc++] Add missing return 0;'s to main() functions in tests
Louis Dionne [Thu, 29 Sep 2022 14:34:52 +0000 (10:34 -0400)]
[libc++] Add missing return 0;'s to main() functions in tests

2 years ago[mlir][Linalg] Add ReduceOp to Linalg structured ops.
Adrian Kuegel [Wed, 28 Sep 2022 11:49:13 +0000 (13:49 +0200)]
[mlir][Linalg] Add ReduceOp to Linalg structured ops.

This will allow to model (variadic) reductions with this special op instead of
using GenericOp.

RFC: https://discourse.llvm.org/t/rfc-primitive-ops-add-mapop-reductionop-transposeop-broadcastop-to-linalg/64184

2 years ago[mlir] fix formatting in markdown
Alex Zinenko [Thu, 29 Sep 2022 14:09:40 +0000 (14:09 +0000)]
[mlir] fix formatting in markdown

2 years ago[libc][NFC] Move alignment utils to utils.h
Guillaume Chatelet [Thu, 29 Sep 2022 13:51:20 +0000 (13:51 +0000)]
[libc][NFC] Move alignment utils to utils.h

2 years ago[LSR][NFC] Add missing constness
eopXD [Thu, 29 Sep 2022 13:30:32 +0000 (06:30 -0700)]
[LSR][NFC] Add missing constness

2 years ago[InstSimplify] Add test for PR58046 (NFC)
Nikita Popov [Thu, 29 Sep 2022 13:21:57 +0000 (15:21 +0200)]
[InstSimplify] Add test for PR58046 (NFC)

2 years ago[RISCV] Add lowering for llvm.roundeven
eopXD [Wed, 28 Sep 2022 03:14:04 +0000 (20:14 -0700)]
[RISCV] Add lowering for llvm.roundeven

Reviewed By: craig.topper

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

2 years agoUnwind-tables: move back to original logic outline for kind.
Tim Northover [Mon, 26 Sep 2022 12:26:36 +0000 (13:26 +0100)]
Unwind-tables: move back to original logic outline for kind.

There are lots of options interacting in complex ways here, and when moving to
`getDefaultUnwindTableLevel` I had refactored this and changed behaviour in
some cases. So this reverts the basic structure of the logic back to the
original, while leaving the hook in the new style.

2 years ago[mlir][GPU] treat the absence of workgroup attributes correctly
Alex Zinenko [Thu, 29 Sep 2022 09:50:24 +0000 (09:50 +0000)]
[mlir][GPU] treat the absence of workgroup attributes correctly

The helper function in GPUFuncOp incorrectly assumed the workgroup
attribution attribute is always present. Instead, treat its absence as
if its value was zero, i.e., no workgroup attributions are specified.

Closes #58045.

Reviewed By: nicolasvasilache

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

2 years ago[Support] Class for response file expansion (NFC)
Serge Pavlov [Sun, 21 Aug 2022 17:30:28 +0000 (00:30 +0700)]
[Support] Class for response file expansion (NFC)

Functions that implement expansion of response and config files depend
on many options, which are passes as arguments. Extending the expansion
requires new options, it in turn causes changing calls in various places
making them even more bulky.

This change introduces a class ExpansionContext, which represents set of
options that control the expansion. Its methods implements expansion of
responce files including config files. It makes extending the expansion
easier.

No functional changes.

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

2 years ago[libc][test] Better reporting for MemoryMatcher
Guillaume Chatelet [Thu, 29 Sep 2022 12:13:26 +0000 (12:13 +0000)]
[libc][test] Better reporting for MemoryMatcher

2 years agoReapply [FunctionAttrs] Infer precise FMRB
Nikita Popov [Fri, 23 Sep 2022 11:03:59 +0000 (13:03 +0200)]
Reapply [FunctionAttrs] Infer precise FMRB

The previous version of the patch would incorrect convert an
existing argmemonly attribute into an inaccessiblemem_or_argmemonly
attribute.

-----

This updates checkFunctionMemoryAccess() to infer a precise
FunctionModRefBehavior, rather than an approximation split into
read/write and argmemonly.

Afterwards, we still map this back to imprecise function attributes.
This still allows us to infer some cases that we previously did not
handle, namely inaccessiblememonly and inaccessiblemem_or_argmemonly.
In practice, this means we get better memory attributes in the
presence of intrinsics like @llvm.assume.

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

2 years ago[FunctionAttrs] Add test for argmemonly function that already has attr (NFC)
Nikita Popov [Thu, 29 Sep 2022 11:55:36 +0000 (13:55 +0200)]
[FunctionAttrs] Add test for argmemonly function that already has attr (NFC)

Test for the issue reported in https://reviews.llvm.org/D134527#3821010.

2 years agoRevert "[clang][Interp] Handle enums"
Timm Bäder [Thu, 29 Sep 2022 11:40:57 +0000 (13:40 +0200)]
Revert "[clang][Interp] Handle enums"

This reverts commit c090295916a921e809184f589c6830475e293b8b.

One of the test cases fails. Revert this until I know a way to make it
work reliably.

2 years ago[LLVM][DebugInfo] Disable split-complex.ll for aarch64-pc-windows-msvc
Muhammad Omair Javaid [Thu, 29 Sep 2022 11:32:49 +0000 (16:32 +0500)]
[LLVM][DebugInfo] Disable split-complex.ll for aarch64-pc-windows-msvc

This patch disables split-complex.ll for aarch64-pc-windows-msvc.
split-complex.ll fails with a crash when run on AArch64/Windows.
I have reported following issue: llvm-project/issues/58053

2 years ago[Clang][Arm] Fix fp16 return error tests under AArch64/Arm. NFC
David Green [Thu, 29 Sep 2022 11:16:13 +0000 (12:16 +0100)]
[Clang][Arm] Fix fp16 return error tests under AArch64/Arm. NFC

The -fallow-half-arguments-and-returns option was removed in
59528e4bdb27ed4ab3, replaced with an always-on target option under
AArch64/Arm. There are two tests - fp16-sema.c and renderscripts.rs that
test that an error is produced for __fp16 function args/returns, which
are now expected to pass for Arm/AArch64. i.e they no longer give the
same error as before on native Arm/AArch64 machines. Alter the targets
of those tests to compensate.

2 years ago[mlir] Add Python bindings for StridedLayoutAttr
Denys Shabalin [Thu, 29 Sep 2022 09:41:42 +0000 (09:41 +0000)]
[mlir] Add Python bindings for StridedLayoutAttr

Reviewed By: ftynse

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

2 years ago[mlir][Linalg] Slightly adjust DestinationStyleOpInterface.
Adrian Kuegel [Thu, 29 Sep 2022 10:28:45 +0000 (12:28 +0200)]
[mlir][Linalg] Slightly adjust DestinationStyleOpInterface.

Rename some interface methods to be consistent with the new accessor names.
This is a preparation for adding a ReduceOp, which then will implement
getIteratorTypes() and getOutputs() instead of iterator_types() and outputs().

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

2 years ago[clang][Interp][NFC] Remove unused prototypes
Timm Bäder [Wed, 28 Sep 2022 11:20:37 +0000 (13:20 +0200)]
[clang][Interp][NFC] Remove unused prototypes

2 years ago[clang][Interp][NFC] Make EvalEmitter::isActive() const
Timm Bäder [Wed, 28 Sep 2022 10:37:52 +0000 (12:37 +0200)]
[clang][Interp][NFC] Make EvalEmitter::isActive() const

2 years ago[clang][Interp][NFC] Unifty ReadArg() impl in Disasm.cpp
Timm Bäder [Fri, 23 Sep 2022 10:40:44 +0000 (12:40 +0200)]
[clang][Interp][NFC] Unifty ReadArg() impl in Disasm.cpp

We can use another if constexpr here to make this shorter and easier to
understand.

2 years ago[clang][Interp] Print Function address in dump()
Timm Bäder [Fri, 23 Sep 2022 09:48:58 +0000 (11:48 +0200)]
[clang][Interp] Print Function address in dump()

It's used in the bytecode dump of the function itself, so useful to
identify which function is being called.

2 years ago[clang][Interp][NFC] Remove unused opcode argument types
Timm Bäder [Sat, 17 Sep 2022 14:03:39 +0000 (16:03 +0200)]
[clang][Interp][NFC] Remove unused opcode argument types

2 years ago[clang][Interp][NFC] Unify the two ReadArg() implementations
Timm Bäder [Sat, 17 Sep 2022 14:14:37 +0000 (16:14 +0200)]
[clang][Interp][NFC] Unify the two ReadArg() implementations

Just use a constexpr if here instead of two different implementations.
[#

2 years ago[clang][Interp][NFC] Remove unused function
Timm Bäder [Mon, 19 Sep 2022 07:09:16 +0000 (09:09 +0200)]
[clang][Interp][NFC] Remove unused function

2 years ago[clang][Interp] Specify Boolean conversion operartors as (u)int32
Timm Bäder [Sat, 17 Sep 2022 06:11:36 +0000 (08:11 +0200)]
[clang][Interp] Specify Boolean conversion operartors as (u)int32

Follow up to https://reviews.llvm.org/D133934

2 years ago[clang][Interp] Properly destruct allocated Records
Timm Bäder [Fri, 16 Sep 2022 16:59:00 +0000 (18:59 +0200)]
[clang][Interp] Properly destruct allocated Records

We are otherwise leaking some memory the records might allocate
themselves.

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

2 years ago[clang][Interp][NFC] Make classes final that can be final
Timm Bäder [Sat, 17 Sep 2022 13:14:32 +0000 (15:14 +0200)]
[clang][Interp][NFC] Make classes final that can be final

2 years ago[clang][Interp][NFC] Make some Record methods const
Timm Bäder [Fri, 16 Sep 2022 16:26:24 +0000 (18:26 +0200)]
[clang][Interp][NFC] Make some Record methods const

2 years ago[clang][Interp][NFC] Limit includes to neccessary ones
Timm Bäder [Fri, 16 Sep 2022 16:21:16 +0000 (18:21 +0200)]
[clang][Interp][NFC] Limit includes to neccessary ones

2 years ago[clang][Interp] Rename a local variable to be more specific
Timm Bäder [Fri, 16 Sep 2022 16:15:57 +0000 (18:15 +0200)]
[clang][Interp] Rename a local variable to be more specific

It's called BaseSize in the Record class as well, so call it BaseSize
when creating the Record.

2 years ago[clang][Interp] Handle enums
Timm Bäder [Fri, 16 Sep 2022 07:17:52 +0000 (09:17 +0200)]
[clang][Interp] Handle enums

Handle DeclRefExprs of enum types. They are otherwise handled like
integers.

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

2 years ago[clang][Interp] Record item types in InterpStack
Timm Bäder [Thu, 15 Sep 2022 14:08:28 +0000 (16:08 +0200)]
[clang][Interp] Record item types in InterpStack

The type information is lost when pushing things on the stack. When
later pop()ing items of the wrong type, we can instead simply get
garbage values and those problems are hard to find. Add another stack to
record the type of item we pushed and use that for debugging.

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

2 years ago[clang][Interp][NFC] Make a few InterpStack functions const
Timm Bäder [Thu, 15 Sep 2022 13:36:51 +0000 (15:36 +0200)]
[clang][Interp][NFC] Make a few InterpStack functions const

2 years ago[clang][Interp] Handle sizeof()
Timm Bäder [Wed, 14 Sep 2022 14:53:55 +0000 (16:53 +0200)]
[clang][Interp] Handle sizeof()

Implement visiting UnaryExprOrTypeTraitExprs to handle sizeof()
expressions.

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

2 years ago[clang][Interp][NFC] Unify emit() implementations
Timm Bäder [Tue, 27 Sep 2022 05:29:09 +0000 (07:29 +0200)]
[clang][Interp][NFC] Unify emit() implementations

Instead of two overloads, use a if constexpr to differentiate between
pointer and non-pointer parameters

2 years ago[clang][Interp][NFC] Forward-declare Pointer in InterpFrame.h
Timm Bäder [Wed, 14 Sep 2022 13:13:58 +0000 (15:13 +0200)]
[clang][Interp][NFC] Forward-declare Pointer in InterpFrame.h

We don't need the full include here.

2 years ago[clang][Interp][NFC] Remove an unnecessary <vector> include.
Timm Bäder [Wed, 14 Sep 2022 13:12:42 +0000 (15:12 +0200)]
[clang][Interp][NFC] Remove an unnecessary <vector> include.

2 years ago[clang][Interp] Pass initializer when creating globals
Timm Bäder [Wed, 14 Sep 2022 13:03:04 +0000 (15:03 +0200)]
[clang][Interp] Pass initializer when creating globals

This is dead code right now but will be used for implementing array
fillers, where we need some information from the initializer when
allocaing the Descriptors.

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

2 years ago[BOLT] Report BB reordering %-age vs profiled and total number of functions
Amir Ayupov [Wed, 28 Sep 2022 18:18:51 +0000 (20:18 +0200)]
[BOLT] Report BB reordering %-age vs profiled and total number of functions

Reviewed By: spupyrev

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

2 years ago[AMDGPU] Add use check in v_fma combine.
Thomas Symalla [Thu, 29 Sep 2022 07:29:39 +0000 (09:29 +0200)]
[AMDGPU] Add use check in v_fma combine.

In D132837, an existing v_fma combine was extended to regard nested
fma instructions. Originally, the inner FMA was checked for being used
only once. In its current state, this check is missing, which causes
some regressions.

In this patch, this check was added.

Reviewed By: foad

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

2 years ago[LV] Create createInductionResumeValue helper (NFC).
Florian Hahn [Thu, 29 Sep 2022 10:12:28 +0000 (11:12 +0100)]
[LV] Create createInductionResumeValue helper (NFC).

Factor out the logic to create induction resume values for a specific
induction. This will be used in D92132 to support widened IVs during
epilogue vectorization.

Reviewed By: Ayal

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

2 years ago[Clang][Arm] Convert -fallow-half-arguments-and-returns to a target option. NFC
David Green [Thu, 29 Sep 2022 10:00:32 +0000 (11:00 +0100)]
[Clang][Arm] Convert -fallow-half-arguments-and-returns to a target option. NFC

This cc1 option -fallow-half-arguments-and-returns allows __fp16 to be
passed by argument and returned, without giving an error. It is
currently always enabled for Arm and AArch64, by forcing the option in
the driver. This means any cc1 tests (especially those needing
arm_neon.h) need to specify the option too, to prevent the error from
being emitted.

This changes it to a target option instead, set to true for Arm and
AArch64. This allows the option to be removed. Previously it was implied
by -fnative_half_arguments_and_returns, which is set for certain
languages like open_cl, renderscript and hlsl, so that option now too
controls the errors. There were are few other non-arm uses of
-fallow-half-arguments-and-returns but I believe they were unnecessary.
The strictfp_builtins.c tests were converted from __fp16 to _Float16 to
avoid the issues.

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

2 years ago[mlir] Add C bindings for StridedArrayAttr
Denys Shabalin [Wed, 28 Sep 2022 13:40:31 +0000 (13:40 +0000)]
[mlir] Add C bindings for StridedArrayAttr

Reviewed By: ftynse

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

2 years ago[LLVM][MC] Disable cfi-version test for aarch64-pc-windows*
Muhammad Omair Javaid [Thu, 29 Sep 2022 08:19:37 +0000 (13:19 +0500)]
[LLVM][MC] Disable cfi-version test for aarch64-pc-windows*

This patch disables MC/ELF/cfi-version.ll test as windows does not emit
.debug_frame needed by the test. This was previously disabled for arm64
but windows on arm uses aarch64-pc-windows* triple. Replacing arm64 with
aarch64 to accomodate windows aarch64 triple(s).

Reviewed By: DavidSpickett

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

2 years ago[mlir][memref]Add conversion support for memref.extract_aligned_pointer_as_index...
Nicolas Vasilache [Thu, 29 Sep 2022 09:29:31 +0000 (02:29 -0700)]
[mlir][memref]Add conversion support for memref.extract_aligned_pointer_as_index to LLVM

Reviewed By: pifon2a

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

2 years ago[WinEH] Prepare test win64-funclet-preisel-intrinsics.ll for extension to nested...
Stefan Gränitz [Thu, 29 Sep 2022 09:01:59 +0000 (11:01 +0200)]
[WinEH] Prepare test win64-funclet-preisel-intrinsics.ll for extension to nested try-catch case (NFC)

2 years ago[mlir][memref]Add pattern to forward memref.extract_aligned_pointer_as_index(view_lik...
Nicolas Vasilache [Wed, 28 Sep 2022 22:29:55 +0000 (15:29 -0700)]
[mlir][memref]Add pattern to forward memref.extract_aligned_pointer_as_index(view_like_op) to its source

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

2 years ago[DebugInfo][InferAddressSpaces] Propagate DebugLoc when cloning an instruction in...
Juan Manuel MARTINEZ CAAMAÑO [Mon, 26 Sep 2022 13:49:32 +0000 (13:49 +0000)]
[DebugInfo][InferAddressSpaces] Propagate DebugLoc when cloning an instruction in InferAddressSpaces

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

2 years ago[StructurizeCFG] Remove imposible case and replace by assert
Juan Manuel MARTINEZ CAAMAÑO [Tue, 27 Sep 2022 13:48:10 +0000 (13:48 +0000)]
[StructurizeCFG] Remove imposible case and replace by assert

In addition, replace outdated XFAIL test by a new one.

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

2 years ago[SCEVExpander] Use CreateBitOrPointerCast instead of builder (NFC).
Florian Hahn [Thu, 29 Sep 2022 08:24:38 +0000 (09:24 +0100)]
[SCEVExpander] Use CreateBitOrPointerCast instead of builder (NFC).

Simplify the code by using CastInst::CreateBitOrPointerCast directly. By
not going through the builder, the temporary instruction also won't get
registered in InsertedValues & co, which means less work overall and
simplifies the clean-up.

2 years agoFix frint ACLE intrinsic names
Michael Platings [Wed, 28 Sep 2022 19:30:29 +0000 (20:30 +0100)]
Fix frint ACLE intrinsic names

Although the instruction names begin "frint", the ACLE spec states that
the intrinsic names begin "__rint", without the "f".

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

2 years agoRevert "[cmake] Export GetHostTriple.cmake"
Nikita Popov [Thu, 29 Sep 2022 07:56:51 +0000 (09:56 +0200)]
Revert "[cmake] Export GetHostTriple.cmake"

This turned out to be insufficient by itself, because we would
also need to export config.guess.

This reverts commit 4ac4d6bc9f312e18416739d70c9beb727acd33fb.