platform/upstream/llvm.git
13 months ago[flang] [stack-arrays] fix unused variable warning
Tom Eccles [Mon, 5 Jun 2023 15:35:14 +0000 (15:35 +0000)]
[flang] [stack-arrays] fix unused variable warning

13 months agoSilence C++17 extension warnings; NFC
Aaron Ballman [Mon, 5 Jun 2023 15:34:17 +0000 (11:34 -0400)]
Silence C++17 extension warnings; NFC

Amends 12728e144994efe84715f4e5dbb8c3104e9f0b5a
Addresses issues found by:
https://lab.llvm.org/buildbot/#/builders/216/builds/22308

13 months ago[NFC][DAG] Move isTruncateOf so that it can be used in foldBinOpIntoSelect.
Amaury Séchet [Mon, 5 Jun 2023 15:32:33 +0000 (15:32 +0000)]
[NFC][DAG] Move isTruncateOf so that it can be used in foldBinOpIntoSelect.

13 months agoSilence C++17 extension diagnostics in test; NFC
Aaron Ballman [Mon, 5 Jun 2023 15:31:55 +0000 (11:31 -0400)]
Silence C++17 extension diagnostics in test; NFC

Amends 12728e144994efe84715f4e5dbb8c3104e9f0b5a
Found by:
https://lab.llvm.org/buildbot/#/builders/139/builds/42135

13 months ago[LoopUnroll] Add test for SCEV invalidation issue (NFC)
Nikita Popov [Mon, 5 Jun 2023 15:25:59 +0000 (17:25 +0200)]
[LoopUnroll] Add test for SCEV invalidation issue (NFC)

Test for the issue reported at https://reviews.llvm.org/D149331#4387931.

13 months agoRevert "[LCSSA] Don't invalidate SCEV"
Nikita Popov [Mon, 5 Jun 2023 15:23:07 +0000 (17:23 +0200)]
Revert "[LCSSA] Don't invalidate SCEV"

This reverts commit 5cbb9f7a58d98ba432c6ddeefa581f6fc521315c.

Causes verifier error reported at
https://reviews.llvm.org/D149331#4387931.

13 months ago[mlir] [linalg] Update documentation for fuse_into_containing_op
Harsh Menon [Fri, 2 Jun 2023 23:18:00 +0000 (16:18 -0700)]
[mlir] [linalg] Update documentation for fuse_into_containing_op

This patch updates the docs for fuse_into_containing_op. It
updates the returned values to include the new_containing_op
and adds a brief description of the new_containing_op.

updates the docs with new changes in the
op regarding the return of the new_containing_op as well
as a brief description o

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

13 months ago[clangd] Revert to older include spelling approach.
Viktoriia Bakalova [Mon, 5 Jun 2023 15:18:17 +0000 (15:18 +0000)]
[clangd] Revert to older include spelling approach.

13 months ago[NFC][CLANG] Fix nullptr dereference issue in checkSizelessVectorShift()
Manna, Soumi [Mon, 5 Jun 2023 15:09:25 +0000 (08:09 -0700)]
[NFC][CLANG] Fix nullptr dereference issue in checkSizelessVectorShift()

This patch uses castAs instead of getAs which will assert if the type doesn't match in checkSizelessVectorShift(clang::Sema &, clang::ActionResult<clang::Expr *, true> &, clang::ActionResult<clang::Expr *, true> &, clang::SourceLocation, bool).

Reviewed By: erichkeane

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

13 months ago[C] Support _Generic expressions with a type operand
Aaron Ballman [Mon, 5 Jun 2023 15:03:14 +0000 (11:03 -0400)]
[C] Support _Generic expressions with a type operand

_Generic accepts an expression operand whose type is matched against a
list of associations. The expression operand is unevaluated, but the
type matched is the type after lvalue conversion. This conversion loses
type information, which makes it more difficult to match against
qualified or incomplete types.

This extension allows _Generic to accept a type operand instead of an
expression operand. The type operand form does not undergo any
conversions and is matched directly against the association list.

This extension is also supported in C++ as we already supported
_Generic selection expressions there.

The RFC for this extension can be found at:
https://discourse.llvm.org/t/rfc-generic-selection-expression-with-a-type-operand/70388

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

13 months agoRevert "[DAGCombine] Make sure combined nodes are added back to the worklist in topol...
JP Lehr [Mon, 5 Jun 2023 14:39:50 +0000 (10:39 -0400)]
Revert "[DAGCombine] Make sure combined nodes are added back to the worklist in topological order."

This reverts commit e69fa03ddd85812be3143d79a0359c3e8d43bd45.

This patch lead to build time outs on the AMDGPU OpenMP runtime
buildbot.

13 months ago[ConstraintElimination] Refactor `checkAndReplaceCondition` (NFC)
Antonio Frighetto [Mon, 5 Jun 2023 14:53:27 +0000 (16:53 +0200)]
[ConstraintElimination] Refactor `checkAndReplaceCondition` (NFC)

Handling `true` and `false` constant replacements is now abstracted
out into a single lambda function `ReplaceCmpWithConstant`, so as to
reduce code duplication.

13 months ago[mlir][spirv] Change numeric constant's bit-extension decision to be based on type
Md Abdullah Shahneous Bari [Mon, 5 Jun 2023 14:46:29 +0000 (10:46 -0400)]
[mlir][spirv] Change numeric constant's bit-extension decision to be based on type

Integer constants with bit width less than a word (e.g., i8, i16)
should be bit extended based on its type to be SPIR-V spec-compliant.
Previously, the decision was based on the most significant bit of the
value which ignores the signless semantics and causes problems when
interfacing with SPIR-V tools.

Dealing with numeric literals: the SPIR-V spec says, "If a numeric
type’s bit width is less than 32-bits, the value appears in the
low-order bits of the word, and the high-order bits must be 0 for
a floating-point type or integer type with Signedness of 0, or sign
extended for an integer type with a Signedness of 1 (similarly for the
remaining bits of widths larger than 32 bits but not a multiple of 32
bits)."

Therefore, signless integers (e.g., i8, i16) and unsigned integers
should be 0-extended, and signed integers (e.g., si8, si16) should be
sign-extended.

Patch By: mshahneo
Reviewed By: kuhar

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

13 months agoRevert "[LCSSA] Remove unused ScalarEvolution argument (NFC)"
Nikita Popov [Mon, 5 Jun 2023 14:41:49 +0000 (16:41 +0200)]
Revert "[LCSSA] Remove unused ScalarEvolution argument (NFC)"

This reverts commit 5362a0d859d8e96b3f7c0437b7866e17a818a4f7.

In preparation for reverting a dependent revision.

13 months ago[libc++] Use .gen.py tests for the transitive inclusion tests
Louis Dionne [Wed, 31 May 2023 20:32:06 +0000 (13:32 -0700)]
[libc++] Use .gen.py tests for the transitive inclusion tests

This finishes the transition of tests covered in generate_header_tests.py
to the new .gen.py format.

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

13 months ago[gn build] Port b77e50e6aef5
LLVM GN Syncbot [Mon, 5 Jun 2023 14:11:26 +0000 (14:11 +0000)]
[gn build] Port b77e50e6aef5

13 months ago[libc++] Implement `stop_token`
Hui [Wed, 17 May 2023 12:22:23 +0000 (13:22 +0100)]
[libc++] Implement `stop_token`

Implement stop_token
http://eel.is/c++draft/thread.stoptoken

13 months ago[AppleAccelTable][NFC] Remove `struct` keyword from member decl
Felipe de Azevedo Piovezan [Sat, 3 Jun 2023 10:37:30 +0000 (06:37 -0400)]
[AppleAccelTable][NFC] Remove `struct` keyword from member decl

This is only needed in C.

Depends on D151989

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

13 months ago[mlir][Vector] Fix a propagation bug with transfer_read
Quentin Colombet [Mon, 5 Jun 2023 12:33:52 +0000 (14:33 +0200)]
[mlir][Vector] Fix a propagation bug with transfer_read

In the vector distribute patterns, we used to move
`vector.transfer_read`s out of `vector.warp_execute_on_lane0`s
irrespectively of how they were defined.

This could create transfer_read operations that would read values from
within the warpOp's body from outside of the body.
E.g.,
```
warpop {
  %defined_in_body
  %read = transfer_read %defined_in_body
  vector.yield %read
}
```
=>
```
warpop {
  %defined_in_body
  vector.yield ...
}
// %defined_in_body is referenced outside of its scope.
%read = transfer_read %defined_in_body
```

The fix consists in checking that all the values feeding the new
`transfer_read` are defined outside of warpOp's body.

Note: We could do this check before creating any operation, but that would
mean knowing what `affine::makeComposedAffineApply` actually do. So the
current fix is a trade off of coupling the implementations of this
propagation and `makeComposedAffineApply` versus compile time.

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

13 months ago[TypePromotion] Don't treat bitcast as a Source
David Green [Mon, 5 Jun 2023 13:42:08 +0000 (14:42 +0100)]
[TypePromotion] Don't treat bitcast as a Source

This removes BitCasts from isSource in Type Promotion, as I don't believe they
need to be treated as Sources. They will usually be from floats or hoisted
constants, where constants will be handled already.

This fixes #62513, but didn't otherwise cause any differences in the tests I
ran.

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

13 months ago[GlobalISel][X86] Regenerate legalize-undef.mir
Simon Pilgrim [Mon, 5 Jun 2023 13:26:36 +0000 (14:26 +0100)]
[GlobalISel][X86] Regenerate legalize-undef.mir

13 months ago[X86] Replace X32 test check prefix with X86 + add common CHECK prefix
Simon Pilgrim [Mon, 5 Jun 2023 13:23:00 +0000 (14:23 +0100)]
[X86] Replace X32 test check prefix with X86 + add common CHECK prefix

We try to only use X32 for gnux32 triple test cases

13 months ago[X86] Replace X32 test check prefix with X86
Simon Pilgrim [Mon, 5 Jun 2023 13:21:41 +0000 (14:21 +0100)]
[X86] Replace X32 test check prefix with X86

We try to only use X32 for gnux32 triple test cases

13 months agoAdd customization group for MLIR.
Philipp Stephani [Mon, 5 Jun 2023 13:34:17 +0000 (15:34 +0200)]
Add customization group for MLIR.

Otherwise the customization options don’t appear in any group.

Reviewed By: sammccall

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

13 months ago[clang][Interp][NFC] Make a single-line comment a doc comment
Timm Bäder [Mon, 5 Jun 2023 13:27:51 +0000 (15:27 +0200)]
[clang][Interp][NFC] Make a single-line comment a doc comment

13 months ago[mlir][vector][NFC] Clean up headers
Matthias Springer [Mon, 5 Jun 2023 12:16:23 +0000 (14:16 +0200)]
[mlir][vector][NFC] Clean up headers

Certain functions were declared in `VectorOps.h` instead of `VectorTransforms.h` or `VectorRewritePatterns.h`.

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

13 months agoCheck for a ‘buffer’ type instead of ‘buffer-live’.
Philipp Stephani [Mon, 5 Jun 2023 13:09:47 +0000 (15:09 +0200)]
Check for a ‘buffer’ type instead of ‘buffer-live’.

Reviewed By: sammccall

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

13 months agoRemove 3-byte characters causing clang-tblgen to get I/O error.
Zibi Sarbinowski [Mon, 5 Jun 2023 12:56:34 +0000 (07:56 -0500)]
Remove 3-byte characters causing clang-tblgen to get I/O error.

[SystemZ} This revision fixes the following error caused by 301eb6b68f30074ee3a90e2dfbd11dfd87076323.
LLVM ERROR: IO failure on output stream: EDC5122I Input/output error.

The characters seems to be 3-byte characters which cause the failure with auto conversion from EBCDIC to ASCII.
Credit to @Kai who found this issue.

Reviewed By: abhina.sreeskantharajan

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

13 months ago[clang][Diagnostics] Split source ranges into line ranges before...
Timm Bäder [Fri, 2 Jun 2023 07:03:12 +0000 (09:03 +0200)]
[clang][Diagnostics] Split source ranges into line ranges before...

... emitting them.

This makes later code easier to understand, since we emit the code
snippets line by line anyway.
It also fixes the weird underlinig of multi-line source ranges.

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

13 months ago[clang][dataflow] Use a `PointerValue` for `value` property in optional checker.
Martin Braenne [Mon, 5 Jun 2023 11:30:39 +0000 (11:30 +0000)]
[clang][dataflow] Use a `PointerValue` for `value` property in optional checker.

The `ReferenceValue` class will be eliminated as part of the ongoing migration
to strict handling of value categories (see https://discourse.llvm.org/t/70086
for details).

Reviewed By: gribozavr2

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

13 months agoFix test bot breakage from 36f351098cd50809658493d9b2e22a795874bab0
Alexey Lapshin [Mon, 5 Jun 2023 11:34:57 +0000 (13:34 +0200)]
Fix test bot breakage from 36f351098cd50809658493d9b2e22a795874bab0

This addresses the issue found by: https://lab.llvm.org/buildbot/#/builders/168/builds/13834

13 months ago[Flang][OpenMP][MLIR] Add lowering from PFT to MLIR (FIR) for OpenMP declare target...
Andrew Gozillon [Mon, 5 Jun 2023 11:46:27 +0000 (06:46 -0500)]
[Flang][OpenMP][MLIR] Add lowering from PFT to MLIR (FIR) for OpenMP declare target directive in Flang

This patch adds PFT lowering for the OpenMP declare target directive
in Flang to the omp dialects declare target attribute, which currently
applies to function or global operations.

Reviewers: kiranchandramohan, skatrak, jsjodin

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

13 months ago[AMDGPU][AsmParser][NFC] Specify parser methods directly in operand classes.
Ivan Kosarev [Mon, 5 Jun 2023 11:58:34 +0000 (12:58 +0100)]
[AMDGPU][AsmParser][NFC] Specify parser methods directly in operand classes.

Eliminates the need for custom operand classes whose only purpose is to
define a parser method.

Part of <https://github.com/llvm/llvm-project/issues/62629>.

Reviewed By: dp

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

13 months ago[clang-tidy] Move the misc system header dir to Inputs subdir, NFC.
Haojian Wu [Mon, 5 Jun 2023 11:52:15 +0000 (13:52 +0200)]
[clang-tidy] Move the misc system header dir to Inputs subdir, NFC.

Follows the existing patterns, and makes life easier for bazel build
system.

13 months ago[AMDGPU][AsmParser][NFC] Immediate operand classes to derive from custom operands.
Ivan Kosarev [Mon, 5 Jun 2023 11:40:39 +0000 (12:40 +0100)]
[AMDGPU][AsmParser][NFC] Immediate operand classes to derive from custom operands.

Removes unnecessary duplication in TableGen definitions.

Part of <https://github.com/llvm/llvm-project/issues/62629>.

Reviewed By: dp

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

13 months ago[clang][Interp][NFC] Make Src parameter for move functions const
Timm Bäder [Mon, 5 Jun 2023 09:55:46 +0000 (11:55 +0200)]
[clang][Interp][NFC] Make Src parameter for move functions const

13 months agofix failures caused by https://reviews.llvm.org/D146737
Mateja Marjanovic [Mon, 5 Jun 2023 11:09:38 +0000 (13:09 +0200)]
fix failures caused by https://reviews.llvm.org/D146737

buildbot: https://lab.llvm.org/buildbot/#/builders/77/builds/27340

13 months ago[DAGCombine] Make sure combined nodes are added back to the worklist in topological...
Amaury Séchet [Sat, 30 Apr 2022 23:45:28 +0000 (23:45 +0000)]
[DAGCombine] Make sure combined nodes are added back to the worklist in topological order.

Currently, a node and its users are added back to the worklist in reverse topological order after it is combined. This diff changes that order to be topological. This is part of a larger migration to get the DAGCombiner to process nodes in topological order.

Reviewed By: RKSimon

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

13 months ago[GlobalISel][X86] Add 128/256/512-bit vector and/or/xor test coverage
Simon Pilgrim [Mon, 5 Jun 2023 11:08:12 +0000 (12:08 +0100)]
[GlobalISel][X86] Add 128/256/512-bit vector and/or/xor test coverage

Based off the legalize-add-v*.mir tests

13 months ago[GlobalISel][X86] Add illegal types and 32-bit target scalar and/or/xor test coverage
Simon Pilgrim [Mon, 5 Jun 2023 10:45:11 +0000 (11:45 +0100)]
[GlobalISel][X86] Add illegal types and 32-bit target scalar and/or/xor test coverage

Based off the legalize-add.mir tests

13 months ago[InstCombine] add overflow checking on AddSub `C-(X+C2) --> (C-C2)-X`
khei4 [Sun, 4 Jun 2023 14:19:44 +0000 (23:19 +0900)]
[InstCombine] add overflow checking on AddSub `C-(X+C2) --> (C-C2)-X`
Differential Revision: https://reviews.llvm.org/D152068

13 months ago[InstCombine] precommit test for D152068(NFC)
khei4 [Sun, 4 Jun 2023 04:31:18 +0000 (13:31 +0900)]
[InstCombine] precommit test for D152068(NFC)
Differential Revision: https://reviews.llvm.org/D152091

13 months ago[AMDGPU] Trim zero components from buffer and image stores
Mateja Marjanovic [Fri, 2 Jun 2023 13:41:15 +0000 (15:41 +0200)]
[AMDGPU] Trim zero components from buffer and image stores

For image and buffer stores the default behaviour on GFX11 and
older is to set all unset components to zero. So if we pass
only X component it will be the same as X000, or XY same as XY00.

This patch simplifies the passed vector of components in InstCombine
by removing zero components from the end.

For image stores it also trims DMask if necessary.

Reviewed by: arsenm, foad, nhaehnle, piotr

13 months ago[AMDGPU] Regenerate some GlobalISel checks
Jay Foad [Mon, 5 Jun 2023 10:18:13 +0000 (11:18 +0100)]
[AMDGPU] Regenerate some GlobalISel checks

13 months ago[X86] canonicalizeShuffleWithBinOps - ensure a binary shuffle of binops have the...
Simon Pilgrim [Mon, 5 Jun 2023 10:18:17 +0000 (11:18 +0100)]
[X86] canonicalizeShuffleWithBinOps - ensure a binary shuffle of binops have the same value type

Fixes #63091

13 months ago[X86] Add test case for Issue #63091
Simon Pilgrim [Mon, 5 Jun 2023 09:42:16 +0000 (10:42 +0100)]
[X86] Add test case for Issue #63091

13 months ago[GlobalISel][X86] Add G_CTTZ_ZERO_UNDEF/G_CTTZ legalization handling
Simon Pilgrim [Mon, 5 Jun 2023 09:14:46 +0000 (10:14 +0100)]
[GlobalISel][X86] Add G_CTTZ_ZERO_UNDEF/G_CTTZ legalization handling

G_CTTZ_ZERO_UNDEF is always legal using the BSF instruction, G_CTTZ requires the BMI1 TZCNT instruction

13 months ago[gn build] Port 90c5fe982222
LLVM GN Syncbot [Mon, 5 Jun 2023 10:08:50 +0000 (10:08 +0000)]
[gn build] Port 90c5fe982222

13 months ago[OpenMP][bbc][flang] Add _OPENMP macro definition
Dominik Adamski [Mon, 22 May 2023 11:11:53 +0000 (06:11 -0500)]
[OpenMP][bbc][flang] Add _OPENMP macro definition

OpenMP standard (section 3.3 for OpenMP 5.2) requires that _OPENMP macro
contains release date of given OpenMP standard version.

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

Reviewed By: kiranchandramohan

13 months ago[flang] Store KindMapping by value in FirOpBuilder
Tom Eccles [Thu, 1 Jun 2023 11:09:45 +0000 (11:09 +0000)]
[flang] Store KindMapping by value in FirOpBuilder

Previously only a constant reference was stored in the FirOpBuilder.
However, a lot of code was merged using

FirOpBuilder builder{rewriter, getKindMapping(mod)};

This is incorrect because the KindMapping returned will go out of scope
as soon as FirOpBuilder's constructor had run. This led to an infinite
loop running some tests using HLFIR (because the stack space containing
the kind mapping was re-used and corrupted).

One solution would have just been to fix the incorrect call sites,
however, as a large number of these had already made it past review, I
decided to instead change FirOpBuilder to store its own copy of the
KindMapping. This is not costly because nearly every time we construct a
KindMapping is exclusively to construct a FirOpBuilder. To make this
common pattern simpler, I added a new constructor to FirOpBuilder which
calls getKindMapping().

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

13 months ago[flang] convert stack arrays allocation to match old type
Tom Eccles [Thu, 1 Jun 2023 19:23:25 +0000 (19:23 +0000)]
[flang] convert stack arrays allocation to match old type

The old fir.allocmem operation returned a !fir.heap<.> type. The new
fir.alloca operation returns a !fir.ref<.> type. This patch inserts a
fir.convert so that the old type is preserved. This prevents verifier
failures when types returned from fir.if statements don't match the
expected type.

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

13 months ago[bazel] Merge BytecodeOpInterface target into IR.
Johannes Reifferscheid [Mon, 5 Jun 2023 09:45:19 +0000 (11:45 +0200)]
[bazel] Merge BytecodeOpInterface target into IR.

Reviewed By: akuegel

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

13 months agoRevert D148717 "[libc] Improve memcmp latency and codegen"
Guillaume Chatelet [Mon, 5 Jun 2023 09:50:30 +0000 (09:50 +0000)]
Revert D148717 "[libc] Improve memcmp latency and codegen"

This reverts commit 9ec6ebd3ceabb29482aa18a64b943788b65223dc.

The patch broke RISCV and aarch64 builtbots.

13 months agoReapply [SCCP] Constant propagation through freeze instruction
Mikhail Gudim [Mon, 5 Jun 2023 09:43:29 +0000 (11:43 +0200)]
Reapply [SCCP] Constant propagation through freeze instruction

Reapply with extra check for struct types, which caused buildbot
failures last time.

-----

The freeze instruction has not been handled by SCCPInstVisitor.
This patch adds SCCPInstVisitor::visitFreezeInst(FreezeInst &I)
method to handle freeze instructions.

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

13 months ago[include-cleaner] Allow multiple strategies for spelling includes.
Viktoriia Bakalova [Thu, 1 Jun 2023 15:48:14 +0000 (15:48 +0000)]
[include-cleaner] Allow multiple strategies for spelling includes.

Summary:

Reviewers:

Subscribers:

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

13 months ago[libc] Improve memcmp latency and codegen
Guillaume Chatelet [Wed, 19 Apr 2023 14:57:14 +0000 (14:57 +0000)]
[libc] Improve memcmp latency and codegen

This is based on ideas from @nafi to:
 - use a branchless version of 'cmp' for 'uint32_t',
 - completely resolve the lexicographic comparison through vector
   operations when wide types are available. We also get rid of byte
   reloads and serializing '__builtin_ctzll'.

I did not include the suggestion to replace comparisons of 'uint16_t'
with two 'uint8_t' as it did not seem to help the codegen. This can
be revisited in sub-sequent patches.

The code been rewritten to reduce nested function calls, making the
job of the inliner easier and preventing harmful code duplication.

Reviewed By: nafi3000

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

13 months ago[mlir][transform] ApplyPatternsOp: Register canonicalization patterns
Matthias Springer [Mon, 5 Jun 2023 08:20:24 +0000 (10:20 +0200)]
[mlir][transform] ApplyPatternsOp: Register canonicalization patterns

Also support replacing payload ops with ConstantLike ops in the TrackingListener, even if the replacement op does not have the same name. (Not supported for ops with multiple results, as this would require splitting the handle.)

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

13 months ago[mlir][SCF][transform] Register SCF dialect patterns
Matthias Springer [Mon, 5 Jun 2023 08:20:09 +0000 (10:20 +0200)]
[mlir][SCF][transform] Register SCF dialect patterns

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

13 months ago[mlir][linalg][transform] Register linalg dialect patterns
Matthias Springer [Mon, 5 Jun 2023 08:19:55 +0000 (10:19 +0200)]
[mlir][linalg][transform] Register linalg dialect patterns

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

13 months ago[AMDGPU] Make use of MachineInstr::all_defs and all_uses. NFCI.
Jay Foad [Mon, 5 Jun 2023 08:53:43 +0000 (09:53 +0100)]
[AMDGPU] Make use of MachineInstr::all_defs and all_uses. NFCI.

13 months ago[AArch64][SVE] Predicated mla/mls patterns
David Green [Mon, 5 Jun 2023 09:08:57 +0000 (10:08 +0100)]
[AArch64][SVE] Predicated mla/mls patterns

To go with D149267 and D149967, this adds predicated mla/mls patterns, selected
from select(mask, add(a, mul(b, c)), a) -> mla(a, mask, b, c). The existing
patterns are eventually removed by D149967.

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

13 months agouse // instad of ; in c file tests, NFC
Chen Zheng [Mon, 5 Jun 2023 09:02:38 +0000 (05:02 -0400)]
use // instad of ; in c file tests, NFC

13 months agoAdopt Properties in builtin dialect
Mehdi Amini [Mon, 5 Jun 2023 08:27:02 +0000 (01:27 -0700)]
Adopt Properties in builtin dialect

This was missed when the other dialects adopted it.

Reviewed By: rriddle

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

13 months ago[PowerPC] Combine fptoint-store under strict cases
Qiu Chaofan [Mon, 5 Jun 2023 08:24:02 +0000 (16:24 +0800)]
[PowerPC] Combine fptoint-store under strict cases

Reviewed By: shchenz

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

13 months agofix failures caused by https://reviews.llvm.org/D148490
Chen Zheng [Mon, 5 Jun 2023 07:40:50 +0000 (03:40 -0400)]
fix failures caused by https://reviews.llvm.org/D148490

buildbot: https://lab.llvm.org/buildbot/#/builders/214/builds/7823

13 months ago[mlir][Bazel] Adjust BUILD files for a9d003ef855ff7ed1bf4f8229ee9944b55936e6f
Adrian Kuegel [Mon, 5 Jun 2023 07:57:01 +0000 (09:57 +0200)]
[mlir][Bazel] Adjust BUILD files for a9d003ef855ff7ed1bf4f8229ee9944b55936e6f

13 months ago[clangd] Do not end inactiveRegions range at position 0 of line
Nathan Ridge [Tue, 23 May 2023 08:17:09 +0000 (04:17 -0400)]
[clangd] Do not end inactiveRegions range at position 0 of line

This carries over the fix previously made for semantic highlighting
https://reviews.llvm.org/D92148, to the new inactiveRegions
protocol as well.

In addition, the directives at the beginning and end of an
inactive region are now excluded from the region.

Fixes https://github.com/clangd/clangd/issues/1631
Fixes https://github.com/clangd/clangd/issues/773

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

13 months ago[gn build] Port bbcd998efdb5
LLVM GN Syncbot [Mon, 5 Jun 2023 07:38:58 +0000 (07:38 +0000)]
[gn build] Port bbcd998efdb5

13 months agoRevert "[NFC][RFC][TableGen] Split GlobalISelEmitter.cpp"
pvanhout [Mon, 5 Jun 2023 07:37:51 +0000 (09:37 +0200)]
Revert "[NFC][RFC][TableGen] Split GlobalISelEmitter.cpp"

This reverts commit 79caedf5f8992ac16313157470f529344972c2ee.

13 months ago[gn build] Port 79caedf5f899
LLVM GN Syncbot [Mon, 5 Jun 2023 07:28:16 +0000 (07:28 +0000)]
[gn build] Port 79caedf5f899

13 months ago[NFC][RFC][TableGen] Split GlobalISelEmitter.cpp
pvanhout [Thu, 25 May 2023 12:19:08 +0000 (14:19 +0200)]
[NFC][RFC][TableGen] Split GlobalISelEmitter.cpp

This patch splits the GlobalISelEmitter.cpp file, which imports DAG ISel patterns for GISel, into separate "GISelMatchTable.h/cpp" files.

The main motive is readability & maintainability. GlobalISelEmitter.cpp was about 6400 lines of mixed code, some bits implementing the match table codegen, some others dedicated to importing DAG patterns.

Now it's down to  2700 + a 2150 header + 2000 impl.
It's a tiny bit more lines overall but that's to be expected - moving
inline definitions to out-of-line, adding comments in the .cpp, etc. all of that takes additional space, but I think the tradeoff is worth it.

I did as little unrelated code changes as possible, I would say the biggest change is the introduction of the `gi` namespace used to prevent name conflicts/ODR violations with type common names such as `Matcher`.
It was previously not an issue because all of the code was in an anonymous namespace.

This moves all of the "match table" code out of the file, so predicates,
rules, and actions are all separated now. I believe this helps separating concerns, now `GlobalISelEmitter.cpp` is more focused on importing DAG patterns into GI, instead of also containing the whole match table internals as well.

Note: the new files have a "GISel" prefix to make them distinct from the other "GI" files in the same folder, which are for the combiner.

Reviewed By: aemerson

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

13 months ago[bazel] add missing dep for GPUTransforms
Mikhail Goncharov [Mon, 5 Jun 2023 07:20:08 +0000 (09:20 +0200)]
[bazel] add missing dep for GPUTransforms

13 months agoRevert "[XCOFF][DWARF] XCOFF64 should be able to select the dwarf format in intergrat...
esmeyi [Mon, 5 Jun 2023 06:50:47 +0000 (02:50 -0400)]
Revert "[XCOFF][DWARF] XCOFF64 should be able to select the dwarf format in intergrated-as mode."

This reverts commit 4054c68644dfebbb584bca698a25d18d1d312bae.

Due to AIX system linker requires DWARF64 for XCOFF64.

13 months ago[mlir][memref][transform] Register memref dialect patterns
Matthias Springer [Mon, 5 Jun 2023 06:40:20 +0000 (08:40 +0200)]
[mlir][memref][transform] Register memref dialect patterns

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

13 months ago[PowerPC] Require FPCVT for store fptoi combination
Qiu Chaofan [Mon, 5 Jun 2023 06:25:04 +0000 (14:25 +0800)]
[PowerPC] Require FPCVT for store fptoi combination

13 months ago[FPEnv] Intrinsics for access to FP environment
Serge Pavlov [Mon, 5 Jun 2023 06:09:34 +0000 (13:09 +0700)]
[FPEnv] Intrinsics for access to FP environment

The change implements intrinsics 'get_fpenv', 'set_fpenv' and 'reset_fpenv'.
They are used to read floating-point environment, set it or reset to
some default state. They do the same actions as C library functions
'fegetenv' and 'fesetenv'. By default these intrinsics are lowered to calls
to these functions.

The new intrinsics specify FP environment as a value of integer type, it
is convenient of most targets where the FP state is a content of some
register. Some targets however use long representations. On X86 the size
of FP environment is 256 bits, and even half of this size is not a legal
ibteger type. To facilitate legalization in such cases, two sets of DAG
nodes is used. Nodes GET_FPENV and SET_FPENV are used when FP
environment may be represented by a legal integer type. Nodes
GET_FPENV_MEM and SET_FPENV_MEM consider FP environment as a region in
memory, much like `fesetenv` and `fegetenv` do. They are used when
target has long representation for floationg-point state.

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

13 months agoReland "[PowerPC] Simplify fp-to-int store optimization"
Qiu Chaofan [Mon, 5 Jun 2023 05:25:10 +0000 (13:25 +0800)]
Reland "[PowerPC] Simplify fp-to-int store optimization"

The build failure should be fixed by de681d53. Follow-up refactor will
be done in future patches.

This reverts commit e7c5ced0b9f0551ea17e1d2b48be86f03a772c59.

13 months ago[NFC][COFF] clang-format WinCOFFObjectWriter and MCWinCOFFObjectWriter
Haohai Wen [Mon, 5 Jun 2023 05:41:43 +0000 (13:41 +0800)]
[NFC][COFF] clang-format WinCOFFObjectWriter and MCWinCOFFObjectWriter

Reviewed By: skan

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

13 months ago[Affine-fusion] Fix a bug in mod detection
Vinayaka Bandishti [Mon, 5 Jun 2023 05:17:42 +0000 (10:47 +0530)]
[Affine-fusion] Fix a bug in mod detection

Fix a bug in detecting unknown ids as mods of known ids that was
preventing certain fusions.

While at this, fix the function signature of `detectAsMod` function to
have output as the last argument.

Reviewed By: bondhugula

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

13 months agoMake optimize llvm common to both gpu-to-hsaco/cubin
Vinayaka Bandishti [Mon, 5 Jun 2023 05:02:51 +0000 (10:32 +0530)]
Make optimize llvm common to both gpu-to-hsaco/cubin

Before serializing, optimizations on llvm were only called on path to
hsaco, and not cubin. Define opt-level for `gpu-to-cubin` pass as well,
and move call to optimize llvm to a common place.

Reviewed By: bondhugula

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

13 months ago[clang][CodeGen] Account for VTT address space
Alex Voicu [Mon, 5 Jun 2023 02:06:25 +0000 (03:06 +0100)]
[clang][CodeGen] Account for VTT address space

Correctly account for the fact that certain targets do not use the generic address space for the implicit VTT argument. This entails adjusting `ItaniumCXXABI::buildStructorSignature`, `ItaniumCXXABI::addImplicitStructorParams` and `ItaniumCXXABI::getImplicitConstructorArgs` to use the target's global variable address space. The associated test is temporarily marked `XFAIL` as additional fixes are needed.

Reviewed By: rjmccall

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

13 months ago[NFC][COFF] Use COFFSection.MCSection when writeSection
Haohai Wen [Mon, 5 Jun 2023 01:33:45 +0000 (09:33 +0800)]
[NFC][COFF] Use COFFSection.MCSection when writeSection

Each COFFSection bind MCSection when created. No need to iterate
throught MCAssembler when writeSection.

Reviewed By: skan

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

13 months ago[AIX] use system assembler for assembly files
Chen Zheng [Mon, 5 Jun 2023 01:36:58 +0000 (21:36 -0400)]
[AIX] use system assembler for assembly files
Change to system assembler to compile assembly files even
-fintegrated-as is specified. We don't have a good Clang as
for now for assembly files on AIX.

Reviewed By: qiucf

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

13 months ago[mlir][bytecodegen] Add list helper methods.
Jacques Pienaar [Sun, 4 Jun 2023 22:52:37 +0000 (15:52 -0700)]
[mlir][bytecodegen] Add list helper methods.

Previously the SignedVarInt was incorrectly defined. Follow up work
needed for improving Array printing/parsing, but correcting the
definitions for now.

13 months agoFix test bot breakage from 36f351098cd50809658493d9b2e22a795874bab0
Alexey Lapshin [Sun, 4 Jun 2023 22:04:30 +0000 (00:04 +0200)]
Fix test bot breakage from 36f351098cd50809658493d9b2e22a795874bab0

This addresses the issue found by: https://lab.llvm.org/buildbot/#/builders/192/builds/2309

13 months ago[mlir][bytecodegen] Add ReservedOrDead marker.
Jacques Pienaar [Sun, 4 Jun 2023 21:59:50 +0000 (14:59 -0700)]
[mlir][bytecodegen] Add ReservedOrDead marker.

Enables reserving or marking dead in enum list, resulting in skipping in dispatches.

13 months ago[mlir][bytecodegen] Remove comments (NFC).
Jacques Pienaar [Sun, 4 Jun 2023 21:19:40 +0000 (14:19 -0700)]
[mlir][bytecodegen] Remove comments (NFC).

Fix missed review comment from https://reviews.llvm.org/D144820

13 months ago[Docs][llvm-mc] Fix location of statement
Aiden Grossman [Sun, 4 Jun 2023 20:40:37 +0000 (20:40 +0000)]
[Docs][llvm-mc] Fix location of statement

The comment moved is referring to the --output-asm-syntax flag rather
than the --print-imm-hex flag, but seems to have mistakenly been put
under the definition of that flag due to some misplaced line numbers on
phabricator.

13 months ago[bazel] Port 36f351098cd5
Benjamin Kramer [Sun, 4 Jun 2023 19:39:52 +0000 (21:39 +0200)]
[bazel] Port 36f351098cd5

13 months ago[LV] Check if value was already not uniform for previous VF.
Florian Hahn [Sun, 4 Jun 2023 19:31:00 +0000 (20:31 +0100)]
[LV] Check if value was already not uniform for previous VF.

If the value was already known to not be uniform for the previous
(smaller VF), it cannot be uniform for the larger VF.

This slightly reduces compile-time, once uniformity checks are becoming
a bit more expensive due to using SCEV rewriting (D148841).

Reviewed By: Ayal

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

13 months agomake sanitizer happy for 36f351098cd50809658493d9b2e22a795874bab0.
Alexey Lapshin [Sun, 4 Jun 2023 18:46:55 +0000 (20:46 +0200)]
make sanitizer happy for 36f351098cd50809658493d9b2e22a795874bab0.

13 months ago[gn build] Port 36f351098cd5
LLVM GN Syncbot [Sun, 4 Jun 2023 18:33:22 +0000 (18:33 +0000)]
[gn build] Port 36f351098cd5

13 months ago[DWARFLinkerParallel][Reland] Add interface files, create a skeleton implementation.
Alexey Lapshin [Fri, 31 Mar 2023 22:12:29 +0000 (00:12 +0200)]
[DWARFLinkerParallel][Reland] Add interface files, create a skeleton implementation.

This patch creates skeleton implementation for the DWARFLinkerParallel.
It also integrates DWARFLinkerParallel into dsymutil and llvm-dwarfutil,
so that empty DWARFLinker::link() can be called. To do this new command
line option is added "--linker apple/llvm". Additionally it changes
existing DWARFLinker interfaces/implementations to be compatible:
use Error for error reporting for the DWARFStreamer, make DWARFFile to
owner of referenced resources, other small refactorings.

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

13 months ago[gn build] Port 7e1ee1e10dc0
LLVM GN Syncbot [Sun, 4 Jun 2023 17:27:50 +0000 (17:27 +0000)]
[gn build] Port 7e1ee1e10dc0

13 months ago[libcxx] Add strict weak ordering checks to sorting algorithms
Danila Kutenin [Sun, 4 Jun 2023 17:24:24 +0000 (19:24 +0200)]
[libcxx] Add strict weak ordering checks to sorting algorithms

This is the implementation of the first proposal of strict weak ordering checks described in https://discourse.llvm.org/t/rfc-strict-weak-ordering-checks-in-the-debug-libc/70217

This targets the most vulnerable algorithms like std::sort

Reviewed By: philnik, #libc

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

13 months ago[NFC][CLANG] [NFC][CLANG] Fix nullptr dereference issue in ConvertQualTypeToKind()
Manna, Soumi [Sun, 4 Jun 2023 16:35:29 +0000 (09:35 -0700)]
[NFC][CLANG] [NFC][CLANG] Fix nullptr dereference issue in ConvertQualTypeToKind()

This patch uses castAs instead of getAs which will assert if the type doesn't match in ConvertQualTypeToKind(clang::ASTContext const &, clang::QualType).

Reviewed By: erichkeane

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

13 months ago[NFC][CLANG] Fix Static Code Analyzer Concerns
Manna, Soumi [Sun, 4 Jun 2023 16:04:49 +0000 (09:04 -0700)]
[NFC][CLANG] Fix Static Code Analyzer Concerns

This patch uses castAs instead of getAs which will assert if the type doesn't match to resolve dereference issue with nullptr FPT when calling getThisType() in clang::CodeGen::CGDebugInfo::CreateType(clang::MemberPointerType const *, llvm::DIFile *).

Reviewed By: erichkeane

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

13 months ago[GlobalIsel][X86] Move G_ICMP legalization before legacy handling and merge 32-bit...
Simon Pilgrim [Sun, 4 Jun 2023 15:59:23 +0000 (16:59 +0100)]
[GlobalIsel][X86] Move G_ICMP legalization before legacy handling and merge 32-bit/64-bit handling

I've kept the legalForCartesianProduct call, but this requires us to maintain 32-bit/64-bit integer lists - we might want to just use legalIf and perform the type pair set matching manually.

13 months ago[AVR][NFC][test] Suppement a test of the pseudo instruction RORBRd
Ben Shi [Sun, 4 Jun 2023 03:22:10 +0000 (11:22 +0800)]
[AVR][NFC][test] Suppement a test of the pseudo instruction RORBRd

Reviewed By: aykevl, Patryk27

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

13 months ago[MC] Remove unused mc_difflist_iterator constructor (NFC)
Sergei Barannikov [Sun, 4 Jun 2023 14:06:53 +0000 (17:06 +0300)]
[MC] Remove unused mc_difflist_iterator constructor (NFC)

The constructor hasn't been used since its introduction.