447894 Commits

Author SHA1 Message Date
Dinar Temirbulatov
022f5ad3ec Move isAllInactivePredicate and isAllActivePredicate definition upwards, NFC 2023-01-10 14:23:29 +00:00
Andrew Ng
85a2f29fd4 [lld][COFF] Fix bug causing assertion in Chunk::setAlignment
Reinstate use of FakeSection class to avoid constructing SectionChunk
from unintialised coff_section in FakeSectionChunk constructor.

Issue was caused by commit 5a58b19f9c93f3ac51bcde318508131ae78aa10c,
"[LLD] Remove global state in lld/COFF".
2023-01-10 14:19:53 +00:00
Yitzhak Mandelbaum
264976d98e [clang][dataflow] Unify TransferOptions and DataflowAnalysisContext::Options.
Merges `TransferOptions` into the newly-introduced
`DataflowAnalysisContext::Options` and removes explicit parameter for
`TransferOptions`, relying instead on the common options carried by the analysis
context. Given that there was no intent to allow different options between calls
to `transfer`, a common value for the options is preferable.

Differential Revision: https://reviews.llvm.org/D140703
2023-01-10 14:17:25 +00:00
Jay Foad
e2e5d59236 [AMDGPU] Add GFX10/GFX11 wave64 test coverage in huge-private-buffer.ll 2023-01-10 14:17:09 +00:00
Jens Massberg
f082e54cef Avoid u8"" literals in tests, their type changes in C++20
Just specify the encoded bytes instead, which causes less confusion anyway.

Differential Revision: https://reviews.llvm.org/D141368
2023-01-10 15:14:09 +01:00
Jay Foad
a7c2121d03 [AMDGPU] Fix duplicate -verify-machineinstrs option 2023-01-10 14:07:09 +00:00
Tomas Matheson
f3fb973924 [AArch64] Comprehensive tests for atomic operations
There are a lot of variants of atomic operations, and AArch64 has several
distinct options to codegen them, and does different things depending on
available features, architecture version and optimisation level. The current
testing for atomic operations has been added gradually over time and does not
give full coverate.  Given how complex the codegen for atomic operations is, it
is valuable to cover the entire parameter space, i.e. test them all. The
resulting set of tests serve also as a reference for how each is codegened.

In order to keep the test files readable and avoid constant updating for
unrelated codegen changes, the test outputs are filtered to only include the
relevant instructions. This shows for each operation and feature which codegen
approach is taken (e.g. ll/sc loop, atomic instruction, library call).

The following parameter space is tested:
 - feature: +lse, +rcpc, etc
 - optimisation level: O0, O1 (covers GISel and SelectionDAG)
 - atomic instruction: load, store, cmpxchg, atomirmw*
 - size: i8, i16, i32, i64, i128
 - aligned/unaligned accesses
 - endianness: big, little
 - atomic ordering: release, acquire, etc
 - load atomic only: const/non-const
 - cmpxchg only: weak/strong
 - atomicrmw: update operation (add, sub, etc)

Notably not covered:
 - volatility: there should be no difference between volatile/non-volatile
 - atomicrmw fadd/fsub

The files are split by triple, LLVM instruction, and feature. This makes it
easy to diff between features and endianness for a given instruction.

The file that generates the tests is included.

There are 70 test files with an average of 2800 lines each.

Differential Revision: https://reviews.llvm.org/D141064
2023-01-10 14:02:13 +00:00
Alex Zinenko
394892841a [mlir] verify that transform ops have memory effects
Add a verifier to the TransformOpInterface ensuring that operations
implementing the interface define memory effects on their operands and
results.

Add the missing effects to TileToForeachThreadOp, specifically for
operands that were added at a later version of the op without modifying
`getEffects` accordingly.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D141371
2023-01-10 13:49:40 +00:00
Ganesh Gopalasubramanian
506ef97dc8 Revert "[X86] Add RMPQUERY to SNP instructions"
This reverts commit 313b747c5bf293aa86caf0da57b978a9758cd57b.
It wasn't reviwed as yet.
2023-01-10 19:11:25 +05:30
Ganesh Gopalasubramanian
313b747c5b [X86] Add RMPQUERY to SNP instructions 2023-01-10 19:01:18 +05:30
Tobias Gysi
6e39520630 [mlir][llvm] Call the instruction builders from a static method (NFC).
Extract a static method to call the MLIR builders that translate LLVM IR
instructions to MLIR LLVM dialect operations. This change ensures the
MLIR builders have to use the moduleImport argument rather than calling
the import methods directly. As a result, both the intrinsic and the
instruction MLIR builders have to use a moduleImport argument and none
of them has direct access to private moduleImport methods. The revision
thus enforces consistent MLIR builder implementations for instructions
and intrinsics.

The revision also moves parseDataLayoutAlignment closer to its use.

Reviewed By: Dinistro

Differential Revision: https://reviews.llvm.org/D141265
2023-01-10 14:17:56 +01:00
Sam McCall
2bac59bab4 [Support] avoid u8"" literals in tests, their type changes in C++20
Just specify the encoded bytes instead, which causes less confusion anyway.

Differential Revision: https://reviews.llvm.org/D141312
2023-01-10 14:00:22 +01:00
Sam McCall
98ae3616cd [AST] include decls owned by FriendDecl in -ast-dump
Differential Revision: https://reviews.llvm.org/D141362
2023-01-10 13:59:58 +01:00
Jay Foad
fadacaa87a [AMDGPU] Add GFX11 test coverage for FeatureBackOffBarrier 2023-01-10 12:36:16 +00:00
Jay Foad
efc5cedb38 [AMDGPU] Regenerate checks in waitcnt-preexisting-vscnt.mir 2023-01-10 12:36:16 +00:00
Alexey Bataev
f698c21345 [X86][NFC]Move and rephrase the comment, NFC 2023-01-10 04:35:11 -08:00
Pavel Kopyl
8913b35f08 [NVPTX] Enforce minumum alignment of 4 for byval parametrs in a function prototype
As a result, we have identical alignment calculation of byval
parameters for:

  - LowerCall() - getting alignment of an argument (.param)

  - emitFunctionParamList() - getting alignment of a
    parameter (.param) in a function declaration

  - getPrototype() - getting alignment of a parameter (.param) in a
    function prototypes that is used for indirect calls

This change is required to avoid ptxas error: 'Alignment of argument
does not match formal parameter'. This error happens even in cases
where it logically shouldn't.

For instance:

  .param .align 4 .b8 param0[4];
  ...
  callprototype ()_ (.param .align 2 .b8 _[4]);
  ...

Here we allocate 'param0' with alignment of 4 and it should be fine to
pass it to a function that requires minimum alignment of 2.

At least ptxas v12.0 rejects this code.

Differential Revision: https://reviews.llvm.org/D140581
2023-01-10 15:22:40 +03:00
Pavel Kopyl
d6775052de [NVPTX] Set default version of architecture to SM_30, PTX to 6.0.
Support of variadic functions triggers an assertion on several tests
from llvm/test/CodeGen/Generic/ if nvptx64-* is specified as a default
triplet:

Support for variadic functions (unsized array parameter) introduced in
PTX ISA version 6.0 and requires target sm_30.

That happens because those tests contain variadic function calls and
default versions of both PTX ISA (3.2) and architecture (sm_20) are
below the minimally required.

There were no observable problems with these tests before adding
support of variadic functions, because nvptx backend just didn't
handle them properly generating invalid PTX code.

Differential Revision: https://reviews.llvm.org/D141054
2023-01-10 15:22:40 +03:00
Nikita Popov
482898d9e2 [GVNSink] Convert tests to opaque pointers (NFC)
Keeping bitcasts in the common_bitcast() test, otherwise sinking
no longer occurs there. GVNSink seems to have a silly cost model
where sinking just the stores is considered non-profitable, but
sinking the stores and bitcasts (which are free...) is profitable.

As this is not a default-enabled pass, and this problem would exist
without opaque pointers as well, I'm not trying to do anything
about this.
2023-01-10 12:46:53 +01:00
Ties Stuij
88b3127ed1 [AArch64] lower abs intrinsic to new ABS instruction in GIsel
When feature CSSC is available, the abs intrinsic should map to the
new scalar ABS instruction when using GlobalIsel

spec:
https://developer.arm.com/documentation/ddi0602/2022-09/Base-Instructions/ABS--Absolute-value-

Reviewed By: aemerson

Differential Revision: https://reviews.llvm.org/D139419
2023-01-10 11:46:28 +00:00
Nikita Popov
39d1c5897a [GVNSink] Make tests more robust (NFC)
Avoid use of no-op GEPs.
2023-01-10 12:40:10 +01:00
Jens Massberg
2a43b5038d Remove unnecessary template specifiers from truct constructors in tests.
As far as I can see they are unnecessary and in C++20 they lead to errors.
Removing them the tests pass with C++20 and the default version.
Example error message:
```
llvm-project/llvm/unittests/IR/PassBuilderCallbacksTest.cpp:275:30: error: expected unqualified-id before ‘)’ token
  275 |   MockAnalysisHandle<Module>() { setDefaults(); }
```

Differential Revision: https://reviews.llvm.org/D141358
2023-01-10 12:35:06 +01:00
Nikita Popov
f8feb64949 [GlobalMerge] Convert tests to opaque pointers (NFC) 2023-01-10 12:34:20 +01:00
Sjoerd Meijer
551a3d8777 [CostModel][AArch64] Add insert/extract element tests for neoverse cores. NFC. 2023-01-10 11:26:53 +00:00
Matthias Springer
0ff3cf0c0c [mlir] GreedyPatternRewriter: fix counting of iterations
The GreedyPatternRewriteDriver did previously not count the first iteration. I.e., when setting `config.maxIterations = 1`, two iterations were performed. In pratice, this number is not really important; we usually just need a limit in some reasonable order of magnitude. However, this fix allows us to write better convergence/worklist tests with carefully crafted test patterns to purposely trigger edge cases in the driver.

Similarly, the first rewrite was previously not counted towards `config.maxNumRewrites`.

For consistency, `OpPatternRewriteDriver` now uses `config.maxNumRewrites` instead of `config.maxIterations`; this driver does not have "iterations", it consists of a single loop (corresponding to the inner loop in the GreedyPatternRewriteDriver).

Differential Revision: https://reviews.llvm.org/D141365
2023-01-10 12:21:08 +01:00
Nikita Popov
094ccee2c8 Reapply [Dominators] Add findNearestCommonDominator() for Instructions (NFC)
Reapply with checks for instructions in unreachable blocks. A test
case for this was added in 1ee4a93b15bb.

-----

This is a recurring pattern: We want to find the nearest common
dominator (instruction) for two instructions, but currently only
provide an API for the nearest common dominator of two basic blocks.

Add an overload that accepts and return instructions.
2023-01-10 12:16:31 +01:00
Nikita Popov
1ee4a93b15 [DSE] Add test with different unreachable block order (NFC) 2023-01-10 12:13:15 +01:00
Sam Clegg
ff8e0ed930 [lld][WebAssembly] Fix memory.fill argument in 64-bit mode
This only effects folks building with wasm64 + shared memory which
is not currently a supported configuration in emscripten or any other
wasm toolchain.

Differential Revision: https://reviews.llvm.org/D141005
2023-01-10 03:11:05 -08:00
Luke Lau
f085d089f9 [UpdateTestChecks] Add wasm64 target
wasm32 was already supported, so here I've just reused the same regex. I'm not sure if this is actually correct: I don't know for certain if wasm32 and wasm64 have different output formats, but it seems to work.

Reviewed By: dschuff, asb

Differential Revision: https://reviews.llvm.org/D141130
2023-01-10 10:58:23 +00:00
Dmitri Gribenko
0e9956204d Revert "[JumpThreading] Preserve profile metadata during select unfolding"
This reverts commit 957952dbf2f34ed552e8e1f8c35eed17eee2ea38.

Addition in the newly added code can overflow.  As a result, the
constructor of `BranchProbability()` can trigger an assertion. See
the discussion on https://reviews.llvm.org/D138132 for more details.
2023-01-10 11:54:50 +01:00
Simon Pilgrim
f21a754915 [AArch64] Add Issue #59898 test case for D141363 2023-01-10 10:49:29 +00:00
serge-sans-paille
984b800a03
Move from llvm::makeArrayRef to ArrayRef deduction guides - last part
This is a follow-up to https://reviews.llvm.org/D140896, split into
several parts as it touches a lot of files.

Differential Revision: https://reviews.llvm.org/D141298
2023-01-10 11:47:43 +01:00
Simon Pilgrim
740d2f6b87 [AArch64] Regenerate rotate.ll test
Simplifies diff for D141363
2023-01-10 10:44:32 +00:00
chenglin.bi
b1b4758e7f [LSR] Hoist IVInc to loop header if its all uses are in the loop header
When the latch block is different from header block, IVInc will be expanded in the latch loop. We can't generate the post index load/store this case.
But if the IVInc only used in the loop, actually we still can use the post index load/store because when exit loop we don't care the last IVInc value.
So, trying to hoist IVInc to help backend to generate more post index load/store.

Fix #53625

Reviewed By: eopXD

Differential Revision: https://reviews.llvm.org/D138636
2023-01-10 18:34:00 +08:00
eopXD
96b52c1eec [Clang][RISCV] Expose vlenb to user
This commit adds function `vlenb` into riscv_vector.h. `vlenb` is defined
through builtin function `__builtin_rvv_vlenb`, which is lowered to
`llvm.read_register`.

Reviewed By: kito-cheng, pcwang-thead

Differential Revision: https://reviews.llvm.org/D141032
2023-01-10 02:23:44 -08:00
esmeyi
2aa4b69bd6 [XCOFF][NFC] Update the test aix-xcoff-huge-relocs.ll 2023-01-10 05:18:53 -05:00
Jessica Del
f33633f512 [AMDGPU] adding test for partially masked operands
This test is testing whether the compiler behaves correctly when only
parts of an operand are masked.
In this case, no optimization is supposed to happen, since neither
the upper nor the lower half is
fully masked. Therefore, none
of the halves can be known to be zero.
The result is a regular multiplication.
2023-01-10 11:05:52 +01:00
Krasimir Georgiev
879bfe6a97 Revert "[clang-format] Add an option for breaking after C++11 attributes"
This reverts commit a28f0747c2f3728bd8a6f64f7c8ba80b4e0cda9f.

It appears that this regresses some function definitions, added an
example as a comment over at https://reviews.llvm.org/D140956.
2023-01-10 09:23:44 +00:00
Ben Shi
4c6d6fc176 [AVR] Do not select unimplemented pseudo instructions
Reviewed By: aykevl, Miss_Grape

Differential Revision: https://reviews.llvm.org/D141210
2023-01-10 16:51:46 +08:00
Pierre van Houtryve
b3fdb7b0cb [InstCombine] Combine lshr of add -> (a + b < a)
Tries to perform
  (lshr (add (zext X), (zext Y)), K)
  ->  (icmp ult (add X, Y), X)
  where
    - The add's operands are zexts from a K-bits integer to a bigger type.
    - The add is only used by the shr, or by iK (or narrower) truncates.
    - The lshr type has more than 2 bits (other types are boolean math).
    - K > 1

This seems to be a pattern that just comes from OpenCL front-ends, so adding DAG/GISel combines doesn't seem to be worth the complexity.

Original patch D107552 by @abinavpp - adapted to use (a + b < a) instead of uaddo following discussion on the review.
See this issue https://github.com/RadeonOpenCompute/ROCm/issues/488

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D138814
2023-01-10 03:37:23 -05:00
Jean Perier
4e78f88561 [flang] Lower addresses inside global initializers in HLFIR
Move the code to lower an expression to address or a box in HLFIR from
Bridge.cpp to ConvertExpr.cpp so that it can be used inside
ConvertVariable.cpp (that needs to use a different symbol map that the
one held in the bridge).

Lower NULL to hlfir.null.

This allows lowering derived type constant structure constructors with
pointer components into fir.global.

Differential Revision: https://reviews.llvm.org/D141276
2023-01-10 09:32:55 +01:00
Pierre van Houtryve
561471b1b8 [InstCombine] Precommit D138814 tests
Separate commit for D138814's testcases to make review easier.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D139011
2023-01-10 03:28:22 -05:00
Jean Perier
de2811ee45 [flang] Allow and use fir.rebox in fir.global
The current lowering of initial target in fir.global is relying
on how fir.box are created: instead of using a fir.rebox to add
the POINTER attribute to the created descriptor, it is looking
for a fir.embox defining operation and creating a copy of
it with a different result types.

The rational for doing so was that fir.rebox codegen was not possible
inside fir.global because it expects to manipulate the input fir.box
in memory, while objects cannot be manipulated in memory inside
a fir.global region that must be constant foldable.

But this approach has two problems:
- it won't work with hlfir where fir.box may be created by more
  operations than fir.embox (e.g. hlfir.delcare or hlfir.designate).
  In general, looking for a precise defining op for a value is
  fragile.
- manually copying and modifying an operation is risky: it is easy
  to forget copying some default operands (that could be added later).

This patch modifies the helpers to get descriptor fields so that they
can both operate on fir.box lowered in memory or in an llvm.struct
value. This enables the usage of fir.rebox in fir.global op.

The fallout in FIR tests is caused by the usage of constant index
when creating GEP (because extractOp requires constant indices).
MLIR builder uses i32 bit constant indices when non mlir::Value
indices are passed to the MLIR GEP op builder. Previously,
an 64 nist mlir constant value was created and passed to the GEP
builder. In this case, the builder respect the value type when
later generating the GEP.
Given this changes impact the "dimension" index that can, per
Fortran requirement, not be greated than 15, using a 32 bit index
is just fine and actually simplify the MLIR LLVM IR generation.

The fallout in lowering tests is caused by the introduction
of the fir.rebox everytime an initial target is created.

Differential Revision: https://reviews.llvm.org/D141136
2023-01-10 09:25:19 +01:00
Douglas Yung
ac07911b45 Revert "[llvm-profdata] Add option to cap profile output size"
This reverts commit 5b72d0e4f5eeb8f90c744cac8e0728cffeca61a9.

The test added is failing on Mac/Windows. See review for buildbot failure links.
2023-01-09 23:53:14 -08:00
Douglas Yung
146f78bf03 Revert "[ProfileData] Fix a warning"
This reverts commit 9f4a9d3f44501fa755eb71fe855e15cf0e59e8b8.

Reverting this change which was a follow-up to 5b72d0e4f5eeb8f90c744cac8e0728cffeca61a9 which is being reverted due to test failures on Mac/Windows.
2023-01-09 23:52:06 -08:00
esmeyi
ea6dec1b3a [XCOFF] support the overflow section (only relocation overflow is handled).
Summary: This patch handles relocation field overflows in an XCOFF32 file. (XCOFF64 files may not have overflow section headers.) If a section has more than 65,534 relocation entries or line number entries, both of these fields are set to a value of 65535. In this case, an overflow section header with the s_flags field equal to STYP_OVRFLO is used to contain the relocation and line-number count information. Since line number is not supported, this patch only handles the relocation overflow.

Reviewed By: shchenz

Differential Revision: https://reviews.llvm.org/D137819
2023-01-10 02:39:02 -05:00
Johannes Doerfert
22c898dbfd [OpenMP] Use Attributor to find underlying objects of stores
When we see a store in generic mode we need to decide if we should guard
it for SPMDzation. This patch changes the getUnderlyingObjects call to
the more optimistic getAssumedUnderlyingObjects call to identify more
thread local pointers.
2023-01-09 23:34:52 -08:00
Yi Kong
e37cb6390c Fix build when LLVM_BUILTIN_TARGETS is not set
If LLVM_BUILTIN_TARGETS is not set, no OS specific variants will be
created, causing CMake build failure. Depend on the generic builtins
target if LLVM_BUILTIN_TARGETS is not set.

Differential Revision: https://reviews.llvm.org/D141273
2023-01-10 14:56:03 +09:00
Alexandre Ganea
eded23dfda [Clang] Silence a "unused variable" warning when building with MSVC 2023-01-09 23:45:20 -05:00
Amy Huang
5a58b19f9c [LLD] Remove global state in lld/COFF
Remove globals from the lldCOFF library, by moving globals into a context class.
This patch mostly moves the config object into COFFLinkerContext.

See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html for
context about removing globals from LLD.

Reviewed By: aganea

Differential Revision: https://reviews.llvm.org/D110450
2023-01-09 23:39:30 -05:00