490625 Commits

Author SHA1 Message Date
Adrian Prantl
55bc0488af
Improve and modernize logging for Process::CompleteAttach() (#82717)
Target::SetArchitecture() does not necessarily set the triple that is
being passed in, and will unconditionally log the real architecture to
the log channel. By flipping the order between the log outputs, the
resulting combined log makes a lot more sense to read.
2024-02-23 08:00:58 -08:00
Lukacma
08cb1a62f6
[AArch64][SVE] Add intrinsincs to assembly mapping for svpmov (#81861)
This patch enables translation of svpmov intrinsic to the correct
assembly instruction, instead of function call.
2024-02-23 15:40:44 +00:00
Matthias Springer
3b232f066d
[mlir][linalg] LinalgOp: Disallow mixed tensor/buffer semantics (#80660)
Related discussion:
https://github.com/llvm/llvm-project/pull/73908/files#r1414913030.

This change fixes #73547.
2024-02-23 15:52:26 +01:00
Michael Maitland
be083dba95
[RISCV][NFC] Allow SchedVar to be a def inside our scheduler model files. (#82634)
All SchedModel files have a line that looks like:

```
def SomeModel : SchedMachineModel;
let SchedModel = SomeModel in {
  ...
}
```

TableGen requires that all records defined within the top level `let`
must have a field `SchedModel` somewhere in their nested record
hierarchy (i.e. the record has a field `SchedModel : SchedMachineModel`
or recursively, one of its members has a field `SchedModel :
SchedMachineModel`).

Classes such as `SchedPredicate` have added a field `SchedModel :
SchedMachineModel`, even though the field is never used, just to supress
**errors** (not warnings) caused from having the top level let in the
model files. This decision was made to avoid having hundreds of the same
`let` statement littered in every scheduler model file.

The reason we have never seen an error for `SchedVar` before is because
`SchedVar` is never instantiated with a `def`. Instead, it is only
created as a value that is consumed by `SchedWriteVariant`:

```
... : SchedWriteVariant<[SchedVar<...>, SchedVar<...>]>;
```

There is a problem with this style of instantiation. In particular, the
problem arises as we try to take a class based approach to building
scheduler models. I will describe the problem from the bottom up.

The `LMULWriteResMXVariant` multiclass takes in a `SchedPredicateBase
Pred`. Today, the RISCVSchedSiFive7.td file defines `VLDSX0Pred` outside
the scope of any class. That means that `VLDSX0Pred` exists before
`LMULWriteResMXVariant` multiclass is instantiated. With this approach,
there is no error since the predicate is instantated in entirety before
the variant multiclass is instantiated. However, I have the intention to
move the definition of both the predicate and the variant multiclass
records inside a multiclass to factor out common parts between multiple
scheduler models.

I plan to have something like:

```
multiclass SiFive7Base<SiFive7BaseConfig c> {
  def VLDSX0Pred : ...;
  // Need defvar since record is prefixed with NAME.
  defvar VLDSX0Pred = !cast<...>(NAME # VLDSX0Pred);
  defm SiFive7 : LMULWriteResMXVariant<VLDSX0Pred>;
}

defm "SiFive7Version1" : SiFive7Base<SiFive7BaseConfig<...>>;
defm "SiFive7Version2" : SiFive7Base<SiFive7BaseConfig<...>>;
```

In this scheme, VLDSX0Pred is defined within the same multiclass
transaction that the `LMULWriteResMXVariant` is defined in. For some
reason, TableGen does not allow `Values` to reference records that were
created in the same parent record construction. If the `SchedVar` is not
a `def`, then it will not be able to find the record `NAME #
VLDSX0Pred`. Making it a def, allows TableGen to find `NAME #
VLDSX0Pred` in scope.

The simplest example of this is:

```
class A {}
class B<A a> { A x = a;}
class C<B b> { B y = b;}
multiclass D {
  def MyA : A;
  defvar aa = !cast<A>(NAME # MyA);
  // This works
  def : B<aa>;
  // This does not work because constructing B by value cannot find `NAME # MyA`
  // error: Undefined reference to record: 'MyA'
  def : C<B<aa>>;
  // To fix it, define it like such:
  def MyB : B<aa>;
  defvar bb = !cast<B>(NAME # MyB);
  def : C<bb>;
}
defm "" : D;
```

In summary, in order to use a class based approach to creating scheduler
resources to promote resusability, `SchedVar`s must be created using
defs instead of being instantiated by value so that it can resolve
records that were part of the instantiation of the parent record being
created. In order to do this without refactoring the top level `let`
statement that all scheduler model files use, we add an unused field
`SchedModel : SchedMachineModel` to `SchedVar`, similiar to what has
been done in `SchedPredicate`.
2024-02-23 09:15:48 -05:00
Benoît Amiaux
52ada07ef5
build_llvm_release.bat: add tarball export to x64 release (#79840)
Like linux releases, export a tar.xz files containing most llvm tools,
including non toolchain utilities, llvm-config, llvm-link and others.

We do this by reconfiguring cmake one last time at the last step,
running the install target so we do not need to recompile anything.

Fix #51192
Fix #53052
2024-02-23 14:49:57 +01:00
Orlando Cazalet-Hyams
71d47a0b00
[RemoveDIs] Enable DPLabels conversion [3b/3] (#82639)
Enables conversion between llvm.dbg.label and DPLabel.
2024-02-23 13:46:57 +00:00
hev
c747b24262
[NFC] Precommit a memcpy test for isOrEquivalentToAdd (#82758) 2024-02-23 21:43:53 +08:00
Joseph Huber
b8a7d8131e [LLVM] Fix incorrect GPU triple detection for runtimes builds
Summary:
This block of code is used to prevent a GPU-based cross compiling build
from taking incompatible arguments. However this incorrectly used the
LLVM default triple instead of the runtimes target. Fix that so the bots
can continue to default the triple to NVPTX.
2024-02-23 07:32:03 -06:00
Matthias Springer
492e8ba038
[mlir] Fix memory leaks after #81759 (#82762)
This commit fixes memory leaks that were introduced by #81759. The way
ops and blocks are erased changed slightly.

The leaks were caused by an incorrect implementation of op builders:
blocks must be created with the supplied builder object. Otherwise, they
are not properly tracked by the dialect conversion and can leak during
rollback.
2024-02-23 14:28:57 +01:00
Timm Bäder
ad49fe3e89 [clang][Interp] Don't return success for already failed global variables
We might be visiting them more than once. We used to return true for
second and subsequent cases, just because we had already visited it
before.
2024-02-23 14:05:19 +01:00
Abhina Sree
1197fcabc4
[libcxx][test] Change UNSUPPORTED to XFAIL for target-related failures (#81513)
This is a followup from this discussion
https://github.com/llvm/llvm-project/pull/80735#discussion_r1486586017
to mark targets that were initially marked as UNSUPPORTED with an XFAIL
instead.
2024-02-23 08:01:56 -05:00
Yingwei Zheng
3b70387c54
[ValueTracking] Handle more integer intrinsics in propagatesPoison (#82749)
This patch extends `propagatesPoison` to handle more integer intrinsics.
It will turn more logical ands/ors into bitwise ands/ors.

See also https://reviews.llvm.org/D99671.
2024-02-23 20:57:56 +08:00
tsitdikov
e09e0d52a0
Users/tsitdikov (#82757)
Fix Test ARM SME library and build rule.
2024-02-23 12:54:15 +00:00
r4nt
ddb4450a46
[ClangFormat] Fix indent in child lines within a macro argument. (#82523)
When reconstructing lines from a macro expansion, make sure that lines
at different levels in the expanded code get indented correctly as part
of the macro argument.
2024-02-23 13:18:00 +01:00
Johannes Reifferscheid
bcf9826a53
[MLIR] Expose approximation patterns for tanh/erf. (#82750)
These patterns can already be used via
populateMathPolynomialApproximationPatterns, but that includes a number
of other patterns that may not be needed.

There are already similar functions for expansion.

For now only adding tanh and erf since I have a concrete use case for
these two.
2024-02-23 13:15:08 +01:00
Sander de Smalen
3b3d0978c3 [Clang] Fix acle_sme_zero.c once more. 2024-02-23 12:13:14 +00:00
Garvit Gupta
f1e0392b82
[RISCV] Disable generation of asynchronous unwind tables for RISCV baremetal (#81727)
The below culprit patch enabled the generation of asynchronous unwind
tables (-funwind-tables=2) by default for RISCV for both linux and
RISCVToolChain baremetal object. However, since there are 2 baremetal
toolchain objects for RISCV, this created a discrepancy between their
behavior. Moreover, enabling the generation of asynchronous unwind
tables based on whether `-gcc-toolchain` option is present or not
doesn't seem to be the best criteria to decide on the same. This patch
make the behavior consistent by disabling the unwind tables in
RISCVToolChain Baremetal object.

Culprit Patch - https://reviews.llvm.org/D145164
2024-02-23 20:01:58 +08:00
tsitdikov
6ac2c0488f
Add TestArmSME dependency to mlir-opt library.
TestArmSME was added in e132643474, now we need to add dependency on it.
2024-02-23 11:57:14 +00:00
Markus Böck
d9e4309b45 [mlir][NFC] Fix format specifier warning on Windows
`%ld` specifier is defined to work on values of type `long`. The parameter given to `fprintf` is of type `intptr_t` whose actual underlying integer type is unspecified. On Unix systems it happens to commonly be `long` but on 64-bit Windows it is defined as `long long`.

The cross-platform way to print a `intptr_t` is to use `PRIdPTR` which expands to the correct format specifier for `intptr_t`. This avoids any undefined behaviour and compiler warnings.
2024-02-23 12:50:33 +01:00
Stanislav Mekhanoshin
3dfca24dda
[AMDGPU] Fix encoding of VOP3P dpp on GFX11 and GFX12 (#82710)
The bug affects dpp forms of v_dot2_f32_f16. The encoding does not match
SP3 and does not set op_sel_hi bits properly.
2024-02-23 03:50:00 -08:00
tsitdikov
e132643474
Add build rule for MLIRArmSMETestPasses
MLIRArmSMETestPasses was added in b39f5660a4, we need to add a build rule for it as well.
2024-02-23 11:47:40 +00:00
Sander de Smalen
cdf19d13bf [Clang] Fix acle_sme_zero.c (missing aarch64-registered-target)
This test was added in #82648
2024-02-23 11:43:55 +00:00
Orlando Cazalet-Hyams
8a16422020
[RemoveDIs] Add DPLabels support [3a/3] (#82633)
Patch 2 of 3 to add llvm.dbg.label support to the RemoveDIs project. The
patch stack adds the DPLabel class, which is the RemoveDIs llvm.dbg.label
equivalent.

   1. Add DbgRecord base class for DPValue and the not-yet-added
       DPLabel class.
   2. Add the DPLabel class.
-> 3. Add support to passes.

The next patch, #82639, will enable conversion between dbg.labels and DPLabels.

AssignemntTrackingAnalysis support could have gone two ways:

1. Have the analysis store a DPLabel representation in its results -
   SelectionDAGBuilder reads the analysis results and ignores all DbgRecord
   kinds.
2. Ignore DPLabels in the analysis - SelectionDAGBuilder reads the analysis
   results but still needs to iterate over DPLabels from the IR.

I went with option 2 because it's less work and is no less correct than 1. It's
worth noting that causes labels to sink to the bottom of packs of debug records.
e.g., [value, label, value] becomes [value, value, label]. This shouldn't be a
problem because labels and variable locations don't have an ordering requirement.
The ordering between variable locations is maintained and the label movement is
deterministic
2024-02-23 11:37:21 +00:00
Sander de Smalen
3c90fce450
[Clang][AArch64] Add missing prototypes for streaming-compatible routines (#82649) 2024-02-23 11:31:53 +00:00
Sander de Smalen
22734e15d8
[Clang][AArch64] Fix 'svzero_za' intrinsic to take no arguments. (#82648)
We previously defined svzero_za as:

  void svzero_za();

rather than:

  void svzero_za(void);

Which meant that Clang accepted arguments. Compiling for example
`svzero_za(<non-constant integer>)` ended up with incorrect IR and a
compiler crash because it couldn't select an instruction for it.
2024-02-23 11:31:24 +00:00
Evgenii Kudriashov
790bcecce6
[GlobalISel] Fix a check that aligned tail call is lowered (#82016)
Despite of a valid tail call opportunity, backends still may not
generate a tail call or such lowering is not implemented yet.

Check that lowering has happened instead of its possibility when
generating G_ASSERT_ALIGN.
2024-02-23 12:11:50 +01:00
Benjamin Kramer
e7c60915e6 Remove duplicated REQUIRES: asserts 2024-02-23 12:01:30 +01:00
Timm Bäder
404854ee20 [clang][Interp][NFC] Print global variable initialization state 2024-02-23 11:59:32 +01:00
Matthias Springer
7bb08ee826
[mlir][Transforms][NFC] Decouple ConversionPatternRewriterImpl from ConversionPatternRewriter (#82333)
`ConversionPatternRewriterImpl` no longer maintains a reference to the
respective `ConversionPatternRewriter`. An `MLIRContext` is sufficient.
This commit simplifies the internal state of
`ConversionPatternRewriterImpl`.
2024-02-23 11:55:24 +01:00
kadir çetinkaya
9dfb843050
[include-cleaner] Use FoundDecl only for using-shadow-decls (#82615) 2024-02-23 11:48:04 +01:00
Daniel Krupp
de04b7d44e
[analyzer] Fix core.VLASize checker false positive taint reports (#68140)
The checker reported a false positive on this code 

void testTaintedSanitizedVLASize(void) {
  int x;
  scanf("%d", &x);
  if (x<1)
    return;
  int vla[x]; // no-warning
}

After the fix, the checker only emits tainted warning if the vla size is
coming from a tainted source and it cannot prove that it is positive.
2024-02-23 11:44:34 +01:00
Kadir Cetinkaya
4419b2c27f
[clangd] Make tidy-rename tests conditional 2024-02-23 11:39:14 +01:00
kadir çetinkaya
5cb2ebc08f
Reland "[clang] Preserve found-decl when constructing VarTemplateIds" (#82612)
Update include-cleaner tests. Now that we have proper found-decls set up
for VarTemplates, in case of instationtations we point to primary
templates and not specializations. To be changed in a follow-up patch.
2024-02-23 11:37:30 +01:00
Matthias Springer
5f1319bb38
[mlir][Transforms] Encapsulate dialect conversion options in ConversionConfig (#82250)
This commit adds a new `ConversionConfig` struct that allows users to
customize the dialect conversion. This configuration is similar to
`GreedyRewriteConfig` for the greedy pattern rewrite driver.

A few existing options are moved to this objects, simplifying the
dialect conversion API.
2024-02-23 11:28:05 +01:00
Timm Bäder
13acb3af5a [clang][Interp] Don't diagnose alread invalid function decls
They have already been diagnosed before. Also improve that test case.
2024-02-23 10:53:31 +01:00
Benjamin Maxwell
78890904c4
[mlir][math] Propagate scalability in convert-math-to-llvm (#82635)
This also generally increases the coverage of scalable vector types in
the math-to-llvm tests.
2024-02-23 09:48:58 +00:00
Cullen Rhodes
b39f5660a4
[mlir][ArmSME] Add test-lower-to-arm-sme pipeline (#81732)
The ArmSME compilation pipeline has evolved significantly and is now
sufficiently complex enough that it warrants a proper lowering pipeline
that encapsulates the various passes and orderings. Currently the
pipeline is loosely defined in our integration tests, but these have
diverged and are not using the same passes or ordering everywhere.

This patch introduces a test-lower-to-arm-sme pipeline mirroring
test-lower-to-llvm that provides some sanity when running e2e examples
and can be used a reference for targeting ArmSME in MLIR.

All the integration tests are updated to use this pipeline. The
intention is to productize the pipeline once it becomes more mature.
2024-02-23 09:42:08 +00:00
Matthias Springer
a622b21f46
[mlir][Transforms] Make ConversionPatternRewriter constructor private (#82244)
`ConversionPatternRewriter` objects should not be constructed outside of
dialect conversions. Some IR modifications performed through a
`ConversionPatternRewriter` are reflected in the IR in a delayed fashion
(e.g., only when the dialect conversion is guaranteed to succeed). Using
a `ConversionPatternRewriter` outside of the dialect conversion is
incorrect API usage and can bring the IR in an inconsistent state.

Migration guide: Use `IRRewriter` instead of
`ConversionPatternRewriter`.
2024-02-23 10:31:55 +01:00
Tobias Gysi
335d34d9ea
[MLIR][LLVM] Fix debug intrinsic import (#82637)
This revision handles the case that the translation of a scope fails due
to cyclic metadata. This mainly affects the import of debug intrinsics
that indirectly take such a scope as metadata argument (e.g. via local
variable or label metadata). This commit ensures we drop intrinsics with
such a dependency on cyclic metadata.
2024-02-23 10:30:19 +01:00
Paschalis Mpeis
bbdc62e718
[AArch64][CostModel] Improve scalar frem cost (#80423)
In AArch64 the cost of scalar frem is the cost of a call to 'fmod'.
2024-02-23 09:29:45 +00:00
Pierre van Houtryve
2ae8bee8f1
[ARM][GlobalISel] Remove legacy legalizer rules (#82619)
I've been looking at LegacyLegalizerInfo and what its place in GISel is.
It seems like it's very close to being deleted so I'm checking if we can
remove the last remaining uses of it.

Looks like we can do a drop-in replacement with the new legalizer for
ARM.
2024-02-23 10:28:58 +01:00
Daniel Kiss
b13c8e5099 Revert "[llvm][AArch64] Autoupgrade function attributes from Module attributes. (#80640)"
This reverts commit 531e8c26b3f2626e7f1a997e0e8b61d67d10aded.
2024-02-23 10:24:15 +01:00
Matthias Springer
59ff4d131c
[mlir][Transforms][NFC] Turn unresolved materializations into IRRewrites (#81761)
This commit is a refactoring of the dialect conversion. The dialect
conversion maintains a list of "IR rewrites" that can be committed (upon
success) or rolled back (upon failure).

This commit turns the creation of unresolved materializations
(`unrealized_conversion_cast`) into `IRRewrite` objects. After this
commit, all steps in `applyRewrites` and `discardRewrites` are calls to
`IRRewrite::commit` and `IRRewrite::rollback`.
2024-02-23 10:15:12 +01:00
Matthias Springer
9ca70d72f4
[mlir][Transforms][NFC] Turn op creation into IRRewrite (#81759)
This commit is a refactoring of the dialect conversion. The dialect
conversion maintains a list of "IR rewrites" that can be committed (upon
success) or rolled back (upon failure).

Until now, the dialect conversion kept track of "op creation" in
separate internal data structures. This commit turns "op creation" into
an `IRRewrite` that can be committed and rolled back just like any other
rewrite. This commit simplifies the internal state of the dialect
conversion.
2024-02-23 10:03:26 +01:00
Timm Bäder
ace83da316 [clang][Interp][NFC] Improve Program dump()ing
Add colors as well as more details for global variables.
2024-02-23 10:00:16 +01:00
Chuanqi Xu
b014944e47 [NFC] [doc] Mentioning to include the guard headers from imported modules 2024-02-23 16:54:13 +08:00
Matthias Springer
d68d295161
[mlir][Transforms][NFC] Turn op/block arg replacements into IRRewrites (#81757)
This commit is a refactoring of the dialect conversion. The dialect
conversion maintains a list of "IR rewrites" that can be committed (upon
success) or rolled back (upon failure).

Until now, op replacements and block argument replacements were kept
track in separate data structures inside the dialect conversion. This
commit turns them into `IRRewrite`s, so that they can be committed or
rolled back just like any other rewrite. This simplifies the internal
state of the dialect conversion.

Overview of changes:
* Add two new rewrite classes: `ReplaceBlockArgRewrite` and
`ReplaceOperationRewrite`. Remove the `OpReplacement` helper class; it
is now part of `ReplaceOperationRewrite`.
* Simplify `RewriterState`: `numReplacements` and `numArgReplacements`
are no longer needed. (Now being kept track of by `numRewrites`.)
* Add `IRRewrite::cleanup`. Operations should not be erased in `commit`
because they may still be referenced in other internal state of the
dialect conversion (`mapping`). Detaching operations is fine.
* `trackedOps` are now updated during the "commit" phase instead of
after applying all rewrites.
2024-02-23 09:48:13 +01:00
Balázs Kéri
5ca877591e
[clang][analyzer] Fix argument invalidations in StreamChecker. (#79470)
Specific arguments passed to stream handling functions are changed by
the function, this means these should be invalidated ("escaped") by the
analyzer. This change adds the argument invalidation (in specific cases)
to the checker.
2024-02-23 09:35:38 +01:00
Dani
6fae3e7844
[llvm][AArch64] Do not inline a function with different signing scheme. (#80642)
If the signing scheme is different that maybe the functions assumes
different behaviours and dangerous to inline them without analysing
them. This should be a rare case.
2024-02-23 09:30:36 +01:00
Dani
531e8c26b3
[llvm][AArch64] Autoupgrade function attributes from Module attributes. (#80640)
`sign-return-address` and similar module attributes should be propagated
to the function level before modules got merged because module flags may
contradict and this information is not recoverable.
Generated code will match with the normal linking flow.
2024-02-23 09:04:33 +01:00