platform/upstream/llvm.git
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.

2 years agoRevert D134638 "[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC"
Fangrui Song [Thu, 29 Sep 2022 07:54:55 +0000 (00:54 -0700)]
Revert D134638 "[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC"

This reverts commit b7baddc7557e5c35a0f6a604a134d849265a99d4.

Broke CodeGen/X86/callbr-asm-kill.mir
We shall pay attention when adding new constraints.

2 years ago[NFC][AMDGPU] Pre-commit FMA test.
Thomas Symalla [Thu, 29 Sep 2022 07:53:23 +0000 (09:53 +0200)]
[NFC][AMDGPU] Pre-commit FMA test.

2 years ago[ELF] Make symAux[0] a sentinel
Fangrui Song [Thu, 29 Sep 2022 07:50:19 +0000 (00:50 -0700)]
[ELF] Make symAux[0] a sentinel

And default auxIdx to 0.

2 years ago[Driver] Add --config= as canonical spelling of --config
Fangrui Song [Thu, 29 Sep 2022 07:38:12 +0000 (00:38 -0700)]
[Driver] Add --config= as canonical spelling of --config

Driver options usually use `Joined` instead of `Separate`. It is also weird that
`--config-system-dir=`/etc exist while `--config=` did not exist.

Reviewed By: mgorny

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

2 years ago[clangd] Avoid using constructor/destructor of vector<incomplete type>
Sam McCall [Thu, 29 Sep 2022 07:28:06 +0000 (09:28 +0200)]
[clangd] Avoid using constructor/destructor of vector<incomplete type>

This is formally invalid, and causes build errors when building with
clang in -std=c++20.

http://eel.is/c%2B%2Bdraft/vector.overview#4

2 years ago[AMDGPU] Update `mad-mix*` CodeGen tests
Pierre van Houtryve [Wed, 28 Sep 2022 06:50:17 +0000 (06:50 +0000)]
[AMDGPU] Update `mad-mix*` CodeGen tests

- Use `fneg %a` instead of `fsub -0.0, %a`
  - This is for D134354 as we don't currently support folding `fsub -0.0, %a` into `fneg` on GISel.
    Also, `fneg` is the canonical way to do the negation.
- Switch to `update_llc_test_checks`-generated tests.
  - Better test coverage
  - Easier to update
  - Easier to see changes in future diffs
- Remove unnecessary CL arguments in RUN lines

Motive for the patch: Preparation for D134354 - we would like to
put GISel tests in this file as well. Fixing the lack of `fneg` and
switching to generated testing makes it much easier.

Reviewed By: arsenm

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

2 years ago[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC
Weining Lu [Thu, 29 Sep 2022 06:47:24 +0000 (14:47 +0800)]
[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC

k: A memory operand whose address is formed by a base register and
(optionally scaled) index register.

m: A memory operand whose address is formed by a base register and
offset that is suitable for use in instructions with the same
addressing mode as st.w and ld.w.

ZB: An address that is held in a general-purpose register. The offset
is zero.

ZC: A memory operand whose address is formed by a base register and
offset that is suitable for use in instructions with the same
addressing mode as ll.w and sc.w.

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

2 years agoRevert "[sanitizer] Use LLVM_ENABLE_LIBCXX to build symbolizer"
Vitaly Buka [Thu, 29 Sep 2022 06:53:01 +0000 (23:53 -0700)]
Revert "[sanitizer] Use LLVM_ENABLE_LIBCXX to build symbolizer"

Trigger some "libatomic" error.

This reverts commit ccbb40147286e2e1996b2b7f089fc44f049c9d28.

2 years ago[NFC][CMake] Inline the append_libcxx_libs macro
Petr Hosek [Thu, 29 Sep 2022 06:51:43 +0000 (06:51 +0000)]
[NFC][CMake] Inline the append_libcxx_libs macro

This is only invoked from a single site and doesn't add any value.

2 years ago[llvm-stress] Remove dependency to legacy pass manager
Bjorn Pettersson [Wed, 28 Sep 2022 10:59:33 +0000 (12:59 +0200)]
[llvm-stress] Remove dependency to legacy pass manager

This patch removes the dependency to the legacy pass manager when
building llvm-stress.

Instead of setting up a pass manager at all we just run verifyModule()
to check that the generated IR satisfies the verifier, and then
we use Module::print() to output the IR. No need to setup passes and
populating a pass manager since we aren't doing anything more fancy
than that.

Reviewed By: aeubanks

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

2 years ago[clang] Add debug info in MicrosoftCXXABI::EmitVirtualMemPtrThunk()
Arthur Eubanks [Wed, 28 Sep 2022 19:56:44 +0000 (12:56 -0700)]
[clang] Add debug info in MicrosoftCXXABI::EmitVirtualMemPtrThunk()

(Probably) fixes https://crbug.com/1355639

Reviewed By: dblaikie

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

2 years ago[AMDGPU] Report minimum scratch size in code object v5 and later by default
Abinav Puthan Purayil [Thu, 15 Sep 2022 13:10:36 +0000 (18:40 +0530)]
[AMDGPU] Report minimum scratch size in code object v5 and later by default

This change sets
-amdgpu-assume-{external-call-stack-size | dynamic-stack-object-size}
options to zero by default for code object v5 and later. The runtime is
expected to adjust the scratch size if the amdhsa_uses_dynamic_stack bit
in the kernel descriptor is set.

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

2 years ago[ADT] IntervalTree - Fix random unittests failures in a debug builds.
Carlos Alberto Enciso [Thu, 29 Sep 2022 04:17:36 +0000 (05:17 +0100)]
[ADT] IntervalTree - Fix random unittests failures in a debug builds.

On a debug build with _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
enabled from 100 executions around 80 are failing.

More details in https://reviews.llvm.org/D125776#3820399

The issue is related to the use of std::sort.

Reviewed By: antondaubert, jryans, probinson

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

2 years ago[mlir] Making verification after parsing optional
River Riddle [Thu, 29 Sep 2022 01:39:26 +0000 (18:39 -0700)]
[mlir] Making verification after parsing optional

This is very useful when you want to parse IR even if
its invalid (e.g. bytecode). It's also useful if you don't
want to pay the cost of verification in certain situations.

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

2 years ago[mlir][python] stop initialization on ImportError
Ashay Rane [Wed, 28 Sep 2022 14:53:36 +0000 (14:53 +0000)]
[mlir][python] stop initialization on ImportError

An `_mlirRegisterEverything.*.so` file from an old build that referenced
`MLIRPythonExtension.RegisterEverything`, but which no longer references
that extension in a new build, causes runtime errors in the new build
like:

    ImportError: _mlirRegisterEverything.cpython-38-x86_64-linux-gnu.so: undefined symbol: mlirRegisterAllPasses

The error occurs because the MLIR Python binding tries to dynamically
import the `_mlirRegisterEverything` module but the dynamic importer
fails since the new build no longer references
`MLIRPythonExtension.RegisterEverything`.

One possible solution is for the user to manually remove the
`_mlirRegisterEverything.*.so` file.  This patch instead resolves the
problem in code by printing a waning if the module cannot be
imported.

Reviewed By: stellaraccident

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