514873 Commits

Author SHA1 Message Date
Ellis Hoag
adaa603224
[MachineVerifier] Report errors from one thread at a time (#111605)
Create the `ReportedErrors` class to track the number of reported errors
during verification. The class will block reporting errors if some other
thread is currently reporting an error.

I've encountered a case where there were many different verifications
reporting errors at the same time on different threads. This ensures
that we don't start printing the error from one case until we are
completely done printing errors from other cases. Most of the time
`AbortOnError = true` so we usually abort after reporting the first
error.

Depends on https://github.com/llvm/llvm-project/pull/111602.
2024-10-11 11:53:44 -07:00
vporpo
31b85c6ead
[SandboxVec][Interval] Implement Interval::comesBefore() (#112026)
This patch implements `Interval::comesBefore(const Interval &Other)`
which returns true if this interval is strictly before Other in program
order. The function asserts that the intervals are disjoint.
2024-10-11 11:51:38 -07:00
Aaron Ballman
bc53359b92 Update the C status page with papers adopted in Minneapolis 2024-10-11 14:45:47 -04:00
Sterling-Augustine
f0909e3a99
[SandboxIR] Add utility function to find the base Value for Mem instructions (#112030) 2024-10-11 11:19:59 -07:00
Krystian Stasiowski
2bb3d3a3f3
Reapply "[Clang][Sema] Refactor collection of multi-level template argument lists (#106585, #111173)" (#111852)
This patch reapplies #111173, fixing a bug when instantiating dependent
expressions that name a member template that is later explicitly
specialized for a class specialization that is implicitly instantiated.

The bug is addressed by adding the `hasMemberSpecialization` function,
which return `true` if _any_ redeclaration is a member specialization.
This is then used when determining the instantiation pattern for a
specialization of a template, and when collecting template arguments for
a specialization of a template.
2024-10-11 14:08:06 -04:00
Sirraide
48bda00b28
[Clang] [Sema] Don't crash on unexpanded pack in invalid block literal (#110762)
Consider #109148:
```c++
template <typename ...Ts>
void f() {
    [] {
        (^Ts);
    };
}
```

When we encounter `^Ts`, we try to parse a block and subsequently call
`DiagnoseUnexpandedParameterPack()` (in `ActOnBlockArguments()`), which
sees `Ts` and sets `ContainsUnexpandedParameterPack` to `true` in the
`LambdaScopeInfo` of the enclosing lambda. However, the entire block is
subsequently discarded entirely because it isn’t even syntactically
well-formed. As a result, `ContainsUnexpandedParameterPack` is `true`
despite the lambda’s body no longer containing any unexpanded packs,
which causes an assertion the next time
`DiagnoseUnexpandedParameterPack()` is called.

This pr moves handling of unexpanded parameter packs into
`CapturingScopeInfo` instead so that the same logic is used for both
blocks and lambdas. This fixes this issue since the
`ContainsUnexpandedParameterPack` flag is now part of the block (and
before that, its `CapturingScopeInfo`) and no longer affects the
surrounding lambda directly when the block is parsed. Moreover, this
change makes blocks actually usable with pack expansion.

This fixes #109148.
2024-10-11 20:03:43 +02:00
Jorge Gorbe Moya
2aa1dbf9c9
[SandboxIR] Add a test for creating non-contiguous Regions. (#112027)
It checks that a Region can have non-contiguous instructions, and that
when iterating through it you don't get the instructions in-between that
aren't part of the Region.
2024-10-11 11:01:52 -07:00
LLVM GN Syncbot
7f1b465c6a [gn build] Port 2c01b2785802 2024-10-11 17:00:05 +00:00
LLVM GN Syncbot
91627546cd [gn build] Port 188ede28e046 2024-10-11 17:00:04 +00:00
LLVM GN Syncbot
4ef737a43e [gn build] Port 089227feaf0e 2024-10-11 17:00:03 +00:00
LLVM GN Syncbot
756ef97eeb [gn build] Port 04af63b267c3 2024-10-11 17:00:02 +00:00
Sunho Kim
7fea5c034c [ORC] Try to skip unsupported targets in another reoptimization test.
Skipping another reoptimization test when target is not found.
2024-10-12 01:59:26 +09:00
Sunho Kim
222d8fadb4 [ORC] Try to skip unsupported targets in reoptimization test.
Many build bots are getting failures because of this:
https://lab.llvm.org/buildbot/#/builders/140/builds/8600
https://lab.llvm.org/buildbot/#/builders/137/builds/6824
https://lab.llvm.org/buildbot/#/builders/140/builds/8600
2024-10-12 01:49:06 +09:00
Krzysztof Parzyszek
697d65ded6
[flang][OpenMP] Parsing support for map type modifiers (#111860)
This commit adds parsing of type modifiers for the MAP clause: CLOSE,
OMPX_HOLD, and PRESENT. The support for ALWAYS has already existed.

The new modifiers are not yet handled in lowering: when present, a TODO
message is emitted and compilation stops.
2024-10-11 11:38:32 -05:00
Caio Oliveira
64bcb27d97
[mlir][spirv] Make gen_spirv_dialect.py more precise when finding inst_category (#111777)
Use a word boundary, current code was currently failing when parsing the
definition of because it would also match
`CooperativeMatrixOp` from a later mention of
`SPIRV_KHR_CooperativeMatrixOperandsAttr`.
2024-10-11 12:35:40 -04:00
Simon Pilgrim
03447ab98d [X86] Add test coverage for #110317
Add tests showing potential to use PSHUFB for shifts of constant uniform values by using a pre-computed LUT of all legal shift amounts
2024-10-11 17:22:56 +01:00
Sunho Kim
188ede28e0 [ORC] Implement basic reoptimization. 2024-10-12 01:21:05 +09:00
Sunho Kim
04af63b267 [ORC] Introduce IRPartitionLayer for common partition functionality. 2024-10-12 01:21:05 +09:00
Sunho Kim
2c01b27858 [ORC] Introduce RedirectionManager interface and implementation using JITLink. 2024-10-12 01:21:05 +09:00
Janek van Oirschot
50866e84d1
Revert "[AMDGPU] Avoid resource propagation for recursion through multiple functions" (#112013)
Reverts llvm/llvm-project#111004
2024-10-11 17:10:28 +01:00
Jacques Pienaar
b96ebee1fa
[mlir] Fix allocateAndCopyWithAlign for immutable (#108679)
Previously this would assert when attempting to getMutableData.
2024-10-11 09:10:01 -07:00
Adrian Prantl
089227feaf
Support inline diagnostics in CommandReturnObject (#110901)
and implement them for dwim-print (a.k.a. `p`) as an example.

The next step will be to expose them as structured data in
SBCommandReturnObject.
2024-10-11 09:08:52 -07:00
Erich Keane
5b25c31351
[OpenACC] Implement loop 'gang' clause. (#112006)
The 'gang' clause is used to specify parallel execution of loops, thus
has some complicated rules depending on the 'loop's associated compute
construct. This patch implements all of those.
2024-10-11 09:05:19 -07:00
Kazu Hirata
3f156ef4cc
[clangd] Simplify code with *Map::operator[] (NFC) (#111939) 2024-10-11 09:00:39 -07:00
Kazu Hirata
0f476277d5
[ObjectYAML] Avoid repeated hash lookups (NFC) (#111938) 2024-10-11 09:00:15 -07:00
Kazu Hirata
2acec3ee21
[ExecutionEngine] Avoid repeated hash lookups (NFC) (#111937) 2024-10-11 08:59:19 -07:00
Kazu Hirata
8a53dc69c2
[DebugInfo] Avoid repeated map lookups (NFC) (#111936) 2024-10-11 08:59:01 -07:00
Kazu Hirata
eef6c0926e
[ARM] Avoid repeated hash lookups (NFC) (#111935) 2024-10-11 08:58:06 -07:00
Kazu Hirata
75774c1c36
[llvm-profdata] Default to MemProf version 3 (#108863)
It's very confusing to have support for Verion 3 but not default to
it.  This patch teaches llvm-profdata to use MemProf version 3 by
default.
2024-10-11 08:56:45 -07:00
Fangrui Song
b1746894de [AMDGPU] Fix -Wunused-variable in non-assertion builds after #109818 2024-10-11 08:52:11 -07:00
Fangrui Song
1c6688ae34
[ELF] Make shouldAddProvideSym return values consistent when demoted to Undefined
Case: `PROVIDE(f1 = bar);` when both `f1` and `bar` are in separate
sections that would be discarded by GC.

Due to `demoteDefined`, `shouldAddProvideSym(f1)` may initially return
false (when Defined) and then return true (been demoted to Undefined).

```
addScriptReferencedSymbolsToSymTable
  shouldAddProvideSym(f1): false
  // the RHS (bar) is not added to `referencedSymbols` and may be GCed
declareSymbols
  shouldAddProvideSym(f1): false
markLive
demoteSymbolsAndComputeIsPreemptible
  // demoted f1 to Undefined
processSymbolAssignments
  addSymbol
    shouldAddProvideSym(f1): true
```

The inconsistency can cause `cmd->expression()` in `addSymbol` to be
evaluated, leading to `symbol not found: bar` errors (since `bar` in the
RHS is not in `referencedSymbols` and is GCed) (#111478).

Fix this by adding a `sym->isUsedInRegularObj` condition, making
`shouldAddProvideSym(f1)` values consistent. In addition, we need a
`sym->exportDynamic` condition to keep provide-shared.s working.

Fixes: ebb326a51fec37b5a47e5702e8ea157cd4f835cd

Pull Request: https://github.com/llvm/llvm-project/pull/111945
2024-10-11 08:47:07 -07:00
Juan Manuel Martinez Caamaño
2d5f3b0a61
[AMDGPU][SIPreEmitPeephole] mustRetainExeczBranch: use BranchProbability and TargetSchedmodel (#109818)
Remove s_cbranch_execnz branches if the transformation is
profitable according to `BranchProbability` and `TargetSchedmodel`.
2024-10-11 17:45:59 +02:00
Janek van Oirschot
67160c5ab5
[AMDGPU] Avoid resource propagation for recursion through multiple functions (#111004)
Avoid constructing recursive MCExpr definitions when multiple functions
cause a recursion.

Fixes #110863
2024-10-11 16:42:50 +01:00
vporpo
e8dd95e97b
[SandboxVec][DAG] Extend DAG (#111908)
This patch implements growing the DAG towards the top or bottom. This
does the necessary dependency checks and adds new mem dependencies.
2024-10-11 08:12:29 -07:00
Jie Fu
8b17916217 [RISCV] Fix -Wunused-function in RISCVVLOptimizer.cpp (NFC)
/llvm-project/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp:125:21:
error: unused function 'operator<<' [-Werror,-Wunused-function]
static raw_ostream &operator<<(raw_ostream &OS, const OperandInfo &OI) {
                    ^
1 error generated.
2024-10-11 23:03:38 +08:00
Javed Absar
c13f806f17
[mlir][linalg] raise generic to named ops. (#110421)
Add support for specializing linalg.broadcast and linalg.transform from generic. Also, does some refactoring to reuse specialization checks, migrating some common uses to op interface methods.
2024-10-11 15:27:27 +01:00
erichkeane
bae17a2682 [OpenACC] Make all AST enums have an underlying type.
We store these in a few places, so ensuring they are kept in a uint8_t
will minimize the amount of storage on the stack.
2024-10-11 07:21:17 -07:00
erichkeane
2d133aaaeb [OpenACC] Fix 'classof' for two unused types.
While implementing a different clause, I discovered these placeholder
clauses had their 'classof' implementation done incorrectly, so this
fixes that.
2024-10-11 07:21:16 -07:00
Shilei Tian
e34e27f198
[TTI][AMDGPU] Allow targets to adjust LastCallToStaticBonus via getInliningLastCallToStaticBonus (#111311)
Currently we will not be able to inline a large function even if it only
has one live use because the inline cost is still very high after
applying `LastCallToStaticBonus`, which is a constant. This could
significantly impact the performance because CSR spill is very
expensive.

This PR adds a new function `getInliningLastCallToStaticBonus` to TTI to
allow targets to customize this value.

Fixes SWDEV-471398.
2024-10-11 10:19:54 -04:00
Ralf Jung
a8a6624595
[IR] LangRef: state explicitly that floats generally behave according to IEEE-754 (#102140)
Fixes https://github.com/llvm/llvm-project/issues/60942: IEEE semantics
is likely what many frontends want (it definitely is what Rust wants),
and it is what LLVM passes already assume when they use APFloat to
propagate float operations.

This does not reflect what happens on x87, but what happens there is
just plain unsound (https://github.com/llvm/llvm-project/issues/89885,
https://github.com/llvm/llvm-project/issues/44218); there is no coherent
specification that will describe this behavior correctly -- the backend
in combination with standard LLVM passes is just fundamentally buggy in
a hard-to-fix-way.

There's also the questions around flushing subnormals to zero, but [this
discussion](https://discourse.llvm.org/t/questions-about-llvm-canonicalize/79378)
seems to indicate a general stance of: this is specific non-standard
hardware behavior, and generally needs LLVM to be told that basic float
ops do not return the standard result. Just naively running
LLVM-compiled code on hardware configured to flush subnormals will lead
to #89885-like issues.

AFAIK this is also what Alive2 implements (@nunoplopes please correct me
if I am wrong).
2024-10-11 18:01:07 +04:00
donald chen
4b3f251bad
[mlir] [dataflow] unify semantics of program point (#110344)
The concept of a 'program point' in the original data flow framework is
ambiguous. It can refer to either an operation or a block itself. This
representation has different interpretations in forward and backward
data-flow analysis. In forward data-flow analysis, the program point of
an operation represents the state after the operation, while in backward
data flow analysis, it represents the state before the operation. When
using forward or backward data-flow analysis, it is crucial to carefully
handle this distinction to ensure correctness.

This patch refactors the definition of program point, unifying the
interpretation of program points in both forward and backward data-flow
analysis.

How to integrate this patch?

For dense forward data-flow analysis and other analysis (except dense
backward data-flow analysis), the program point corresponding to the
original operation can be obtained by `getProgramPointAfter(op)`, and
the program point corresponding to the original block can be obtained by
`getProgramPointBefore(block)`.

For dense backward data-flow analysis, the program point corresponding
to the original operation can be obtained by
`getProgramPointBefore(op)`, and the program point corresponding to the
original block can be obtained by `getProgramPointAfter(block)`.

NOTE: If you need to get the lattice of other data-flow analyses in
dense backward data-flow analysis, you should still use the dense
forward data-flow approach. For example, to get the Executable state of
a block in dense backward data-flow analysis and add the dependency of
the current operation, you should write:

``getOrCreateFor<Executable>(getProgramPointBefore(op),
getProgramPointBefore(block))``

In case above, we use getProgramPointBefore(op) because the analysis we
rely on is dense backward data-flow, and we use
getProgramPointBefore(block) because the lattice we query is the result
of a non-dense backward data flow computation.

related dsscussion:
https://discourse.llvm.org/t/rfc-unify-the-semantics-of-program-points/80671/8
corresponding PSA:
https://discourse.llvm.org/t/psa-program-point-semantics-change/81479
2024-10-11 21:59:05 +08:00
LLVM GN Syncbot
5dac691b66 [gn build] Port 1c94388f38c6 2024-10-11 13:45:57 +00:00
Michael Maitland
1c94388f38
[RISCV] Introduce VLOptimizer pass (#108640)
The purpose of this optimization is to make the VL argument, for
instructions that have a VL argument, as small as possible. This is
implemented by visiting each instruction in reverse order and checking
that if it has a VL argument, whether the VL can be reduced.

By putting this pass before VSETVLI insertion, we see three kinds of
changes to generated code:
1. Eliminate VSETVLI instructions
2. Reduce the VL toggle on VSETVLI instructions that also change vtype
3. Reduce the VL set by a VSETVLI instruction

The list of supported instructions is currently whitelisted for safety.
In the future, we could add more instructions to `isSupportedInstr` to
support even more VL optimization.

We originally wrote this pass because vector GEP instructions do not
take a VL, which leads us to emit code that uses VL=VLMAX to implement
GEP in the RISC-V backend. As a result, some of the vector instructions
will write to lanes, specifically between the intended VL and VLMAX,
that will never be read. As an alternative to this pass, we considered
adding a vector predicated GEP instruction, but this would not fit well
into the intrinsic type system since GEP has a variable number of
arguments, each with arbitrary types. The second approach we considered
was to put this pass after VSETVLI insertion, but we found that it was
more difficult to recognize optimization opportunities, especially
across basic block boundaries -- the data flow analysis was also a bit
more expensive and complex.

While this pass solves the GEP problem, we have expanded it to handle
more cases of VL optimization, and there is opportunity for the analysis
to be improved to enable even more optimization. We have a few follow up
patches to post, but figured this would be a good start.

---------

Co-authored-by: Craig Topper <craig.topper@sifive.com>
Co-authored-by: Kito Cheng <kito.cheng@sifive.com>
2024-10-11 09:45:35 -04:00
Andrzej Warzyński
f7eb271542
[mlir][vector] Add more tests for ConvertVectorToLLVM (7/n) (#111895)
Adds tests with scalable vectors for the Vector-To-LLVM conversion pass.
Covers the following Ops:
  * vector.fma
  * vector.reduce
2024-10-11 14:36:26 +01:00
Louis Dionne
33c14f1965
[libc++] Add output groups to run-buildbot (#111739)
This improves the CI output by providing collapsable sections for
sub-parts of our build.

This was originally opened as #75233.

Co-authored-by: eric <eric@efcs.ca>
2024-10-11 09:29:47 -04:00
Louis Dionne
923fef9038
[libc++abi] Remove unused LIBCXXABI_LIBCXX_INCLUDES CMake option (#111824)
This hasn't been used for several years, so it's effectively dead code
at this point.
2024-10-11 09:27:22 -04:00
Alejandro Álvarez Ayllón
bd12729a82
[clang] Ignore inline namespace for hasName (#109147)
Add a new enumeration `SuppressInlineNamespaceMode` to `PrintingPolicy` that
is explicit about how to handle inline namespaces. `SuppressInlineNamespace`
uses that enumeration now instead of a Boolean value.

Specializing a template from an inline namespace should be transparent.
For instance

```
namespace foo {
    inline namespace v1 {
        template<typename A>
        void function(A&);
    }
}

namespace foo {
    template<>
    void function<int>(int&);
}
```

`hasName` should match both declarations of `foo::function`.

Makes the behavior of `matchesNodeFullSlow` and `matchesNodeFullFast`
consistent, fixing an assert inside `HasNameMatcher::matchesNode`.
2024-10-11 09:23:47 -04:00
Benjamin Maxwell
c3a10dc849
[AArch64] Disable consecutive store merging when Neon is unavailable (#111519)
Lowering fixed-size BUILD_VECTORS without Neon may introduce stack
spills, leading to more stores/reloads than if the stores were not
merged. In some cases, it can also prevent using paired store
instructions.

In the future, we may want to relax when SVE is available, but
currently, the SVE lowerings for BUILD_VECTOR are limited to a few
specific cases.
2024-10-11 14:15:01 +01:00
David Spickett
a2bd5db00d
[lldb] Fix finding make tool for tests (#111980)
Fixes 0e913237871e8c9290e82be30be8b3484952eee0 /
https://github.com/llvm/llvm-project/pull/111531

For reasons I can't explain, a clean build works fine for me, and all
the bots are working fine. But if I rebuild in some way the make tool
becomes None.

Looking at the other variables, they had these extra lines so I've added
those for make and it seems to solve the problem.
2024-10-11 14:14:04 +01:00
Erich Keane
c8554e13ee
Turn -Wdeprecated-literal-operator on by default (#111027)
It would be nice to see what our users think about this change, as this
is something that WG21/EWG quite wants to fix a handful of questionable
issues with UB. Depending on the outcome of this after being committed,
we might instead suggest EWG undeprecate this, and require a bit of
'magic' from the lexer.

Additionally, this patch makes it so we emit this diagnostic ALSO in
cases where the literal name is reserved. It doesn't make sense to limit
that.

---------

Co-authored-by: Vlad Serebrennikov <serebrennikov.vladislav@gmail.com>
2024-10-11 06:10:03 -07:00