platform/upstream/llvm.git
13 months agoReplace deprecated startswith_insensitive with starts_with_insensitive
Fangrui Song [Mon, 5 Jun 2023 18:01:27 +0000 (11:01 -0700)]
Replace deprecated startswith_insensitive with starts_with_insensitive

13 months ago[InstCombine] Add transform `(icmp pred (shl {nsw and/or nuw} X, Y), C)` -> `(icmp...
Noah Goldstein [Mon, 5 Jun 2023 07:37:08 +0000 (02:37 -0500)]
[InstCombine] Add transform `(icmp pred (shl {nsw and/or nuw} X, Y), C)` -> `(icmp pred X, C)`

Three new transforms:
    1) `(icmp pred (shl nsw nuw X, Y), C)` [if `C <= 0`] -> `(icmp pred X, C)`
        - ugt: https://alive2.llvm.org/ce/z/K_57J_
        - sgt: https://alive2.llvm.org/ce/z/BL8u_a
        - sge: https://alive2.llvm.org/ce/z/yZZVYz
        - uge: https://alive2.llvm.org/ce/z/R4jwwJ
        - ule: https://alive2.llvm.org/ce/z/-gbmth
        - sle: https://alive2.llvm.org/ce/z/ycZVsh
        - slt: https://alive2.llvm.org/ce/z/4MzHYm
        - sle: https://alive2.llvm.org/ce/z/fgNfex
        - ult: https://alive2.llvm.org/ce/z/cXfvH5
        - eq : https://alive2.llvm.org/ce/z/sZh_Ti
        - ne : https://alive2.llvm.org/ce/z/UrqSWA

    2) `(icmp eq/ne (shl {nsw|nuw} X, Y), 0)` -> `(icmp eq/ne X, 0)`
        - eq+nsw: https://alive2.llvm.org/ce/z/aSJN6D
        - eq+nuw: https://alive2.llvm.org/ce/z/r2_-br
        - ne+nuw: https://alive2.llvm.org/ce/z/RkETtu
        - ne+nsw: https://alive2.llvm.org/ce/z/8iSfW3

    3) `(icmp slt (shl nsw X, Y), 0/1)` -> `(icmp pred X, 0/1)`
       `(icmp sgt (shl nsw X, Y), 0/-1)` -> `(icmp pred X, 0/-1)`
        - slt: https://alive2.llvm.org/ce/z/eZYRan
        - sgt: https://alive2.llvm.org/ce/z/QQeP26

    Transform 3) is really sle/slt/sge/sgt with 0, but sle/sge
    canonicalize to slt/sgt respectively so its implemented as such.

Reviewed By: nikic

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

13 months ago[InstCombine] Add tests for tranforming `(icmp pred (shl {nsw and/or nuw} X, Y),...
Noah Goldstein [Mon, 5 Jun 2023 07:37:06 +0000 (02:37 -0500)]
[InstCombine] Add tests for tranforming `(icmp pred (shl {nsw and/or nuw} X, Y), C)`; NFC

Reviewed By: nikic

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

13 months ago[sanitizer] add new symbolizer symbol
Florian Mayer [Mon, 5 Jun 2023 17:57:49 +0000 (10:57 -0700)]
[sanitizer] add new symbolizer symbol

13 months ago[mlir][sparse] Make getNumTensors() consistent between LoopEmitter and Merger.
Peiming Liu [Mon, 5 Jun 2023 17:26:40 +0000 (17:26 +0000)]
[mlir][sparse] Make getNumTensors() consistent between LoopEmitter and Merger.

Reviewed By: aartbik

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

13 months ago[Sema] Do not emit -Wunused-variable for variables declared with cleanup attribute
Nathan Chancellor [Mon, 5 Jun 2023 17:49:41 +0000 (10:49 -0700)]
[Sema] Do not emit -Wunused-variable for variables declared with cleanup attribute

A variable declared with __attribute__((cleanup)) cannot be unused, as
its address is passed to the clean up function. Do not emit
-Wunused-variable for variables declared with the cleanup attribute,
which matches GCC's behavior: https://godbolt.org/z/dz5YfTsan

Reviewed By: erichkeane, nickdesaulniers

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

13 months ago[IRBUilder] Introduce getAllOnesMask [nfc]
Philip Reames [Mon, 5 Jun 2023 17:46:49 +0000 (10:46 -0700)]
[IRBUilder] Introduce getAllOnesMask [nfc]

Simplify D99750 by factoring out a utility which we already have multiple instances of in tree.

13 months agoRemove vestiges of removed OCaml modules
Alan Hu [Mon, 5 Jun 2023 17:19:45 +0000 (13:19 -0400)]
Remove vestiges of removed OCaml modules

Several OCaml modules using the old PassManager API were removed in
https://reviews.llvm.org/D144751, but the META file still needed to be
updated to remove them. This diff also removes an unused macro definition
related to the module removals.

Reviewed By: nikic

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

13 months agoRevert "Properly restore SP tag on exceptions"
Florian Mayer [Mon, 5 Jun 2023 17:26:33 +0000 (10:26 -0700)]
Revert "Properly restore SP tag on exceptions"

This reverts commit 6a2e0cb418175bb985aa898604560110a77c43da.

13 months ago[AMDGPU] Add intrinsic for converting global pointers to resources
Krzysztof Drewniak [Wed, 19 Apr 2023 15:19:14 +0000 (15:19 +0000)]
[AMDGPU] Add intrinsic for converting global pointers to resources

Define the function @llvm.amdgcn.make.buffer.rsrc, which take a 64-bit
pointer, the 16-bit stride/swizzling constant that replace the high 16
bits of an address in a buffer resource, the 32-bit extent/number of
elements, and the 32-bit flags (the latter two being the 3rd and 4th
wards of the resource), and combines them into a ptr addrspace(8).

This intrinsic is lowered during the early phases of the backend.

This intrinsic is needed so that alias analysis can correctly infer
that a certain buffer resource points to the same memory as some
global pointer. Previous methods of constructing buffer resources,
which relied on ptrtoint, would not allow for such an inference.

Depends on D148184

Reviewed By: arsenm

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

13 months ago[AMDGPU] Use resource base for buffer instruction MachineMemOperands
Krzysztof Drewniak [Wed, 12 Apr 2023 23:18:17 +0000 (23:18 +0000)]
[AMDGPU] Use resource base for buffer instruction MachineMemOperands

1. Remove the existing code that would encode the constant offsets (if
there were any) on buffer intrinsic operations onto their
`MachineMemOperand`s. As far as I can tell, this use of `offset` has
no substantial impact on the generated code, especially since the same
reasoning is performed by areMemAccessesTriviallyDisjoint().

2. When a buffer resource intrinsic takes a pointer argument as the
base resource/descriptor, place that memory argument in the value
field of the MachineMemOperand attached to that intrinsic.

This is more conservative than what would be produced by more typical
LLVM code using GEP, as the Value (for alias analysis purposes)
corresponding to accessing buffer[0] and buffer[1] is the same.
However, the target-specific analysis of disjoint offsets covers a lot
of the simple usecases.

Despite this limitation, the new buffer intrinsics, combined with
LLVM's existing pointer annotations, allow for non-trivial
optimizations, as seen in the new tests, where marking two buffer
descriptors "noalias" allows merging together loads and stores in a
"load from A, modify loaded value, store to B" sequence, which would
not be possible previously.

Depends on D147547

Reviewed By: arsenm

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

13 months agoRevert "[libc++] Optimize for_each for segmented iterators"
Nikolas Klauser [Mon, 5 Jun 2023 17:00:02 +0000 (10:00 -0700)]
Revert "[libc++] Optimize for_each for segmented iterators"

This reverts commit b1dc43aa3a05c2f14725e2e6428544208ccbe161.

13 months ago[AMDGPU] Add buffer intrinsics that take resources as pointers
Krzysztof Drewniak [Tue, 4 Apr 2023 17:11:04 +0000 (17:11 +0000)]
[AMDGPU] Add buffer intrinsics that take resources as pointers

In order to enable the LLVM frontend to better analyze buffer
operations (and to potentially enable more precise analyses on the
backend), define versions of the raw and structured buffer intrinsics
that use `ptr addrspace(8)` instead of `<4 x i32>` to represent their
rsrc arguments.

The new intrinsics are named by replacing `buffer.` with `buffer.ptr`.

One advantage to these intrinsic definitions is that, instead of
specifying that a buffer load/store will read/write some memory, we
can indicate that the memory read or written will be based on the
pointer argument. This means that, for example, a read from a
`noalias` buffer can be pulled out of a loop that is modifying a
distinct buffer.

In the future, we will define custom PseudoSourceValues that will
allow us to package up the (buffer, index, offset) triples that buffer
intrinsics contain and allow for more precise backend analysis.

This work also enables creating address space 7, which represents
manipulation of raw buffers using native LLVM load and store
instructions.

Where tests simply used a buffer intrinsic while testing some other
code path (such as the tests for VGPR spills), they have been updated
to use the new intrinsic form. Tests that are "about" buffer
intrinsics (for instance, those that ensure that they codegen as
expected) have been duplicated, either within existing files or into
new ones.

Depends on D145441

Reviewed By: arsenm, #amdgpu

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

13 months ago[Demangle] convert is*Encoding to use std::string_view
Nick Desaulniers [Mon, 5 Jun 2023 16:33:44 +0000 (09:33 -0700)]
[Demangle] convert is*Encoding to use std::string_view

This was originally a part of D149104 which was backed out. This change
is uncontroversial though, so split it out and reland it.

Reviewed By: MaskRay

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

13 months ago[Flang][PFT] Skip continue insertion for OpenMP Loops
Kiran Chandramohan [Mon, 5 Jun 2023 16:14:12 +0000 (16:14 +0000)]
[Flang][PFT] Skip continue insertion for OpenMP Loops

Unstructured regions presents some issues for OpenMP code generation.
While there are no branches out of the OpenMP region, there can be
branches inside. This required the availability of an artificial
target at the end of an OpenMP region. This was implemented by
insertion an artifical `continue` and marking it as a target for
a branch.
(https://github.com/flang-compiler/f18-llvm-project/pull/1178)

The artificial target is not required for OpenMP loops. Since the
DO loop end can itself be a target of a branch. Moreover, insertion
of the continue between the end of the loop and the end of the
OpenMP loop construct presents problems since the OpenMP MLIR
loop construct models both the loop and the construct. This can
cause the terminator of the OpenMP loop construct to be missed.
This patch solves the issue by skipping the insertion of the
continue.

Note: This issue is only hit if the `end openmp loop` directive
is missed.

This patch fixes the issues in:
-> https://github.com/llvm/llvm-project/issues/58378
-> https://github.com/flang-compiler/f18-llvm-project/issues/1426

Fixes #58378

Reviewed By: vdonaldson

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

13 months ago[RISCV] Switch vwsll.v* instructions to use the VSHT_IV_V_X_I class instead of VALU_I...
Craig Topper [Mon, 5 Jun 2023 16:24:50 +0000 (09:24 -0700)]
[RISCV] Switch vwsll.v* instructions to use the VSHT_IV_V_X_I class instead of VALU_IV_V_X_I.

This allows us to remove the uimm5 argument and changes the
scheduler class from ALU to Shift.

Ultimately we need a WShift scheduler class, but we need to scrub
all of the crypto instructions for scheduler classes so I'll leave
that for future work.

Reviewed By: 4vtomat, ego

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

13 months ago[TableGen] Fix indentation. NFC
Michael Liao [Mon, 5 Jun 2023 16:19:58 +0000 (12:19 -0400)]
[TableGen] Fix indentation. NFC

13 months ago[LLD] Emit DT_PPC64_OPT into the dynamic section
Stefan Pintilie [Fri, 2 Jun 2023 18:46:25 +0000 (14:46 -0400)]
[LLD] Emit DT_PPC64_OPT into the dynamic section

As per section 4.2.2 of the PowerPC ELFv2 ABI, this value tells the dynamic linker which optimizations it is allowed to do.
Specifically, the higher order bit of the two tells the dynamic linker that there may be multiple TOC pointers in the binary.

When we resolve any NOTOC relocations during linking, we need to set this value because we may be calling
TOC functions from NOTOC functions when the NOTOC function already clobbered the TOC pointer.

In practice, this ensures that the PLT resolver always resolves the call to the GEP (global entry point) of
the TOC function (which will set up the TOC for the TOC function).

Original patch by nemanjai

Reviewed By: MaskRay

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

13 months ago[clangd] Move completion signatures and labelDetails
Sam McCall [Tue, 23 May 2023 20:39:55 +0000 (22:39 +0200)]
[clangd] Move completion signatures and labelDetails

(When clients support it, otherwise keep the existing rendering).

In VSCode this makes the signature darker.

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

13 months ago[Flang][OpenMP] Refactor to properly fix privatisation of loop bounds
Kiran Chandramohan [Mon, 5 Jun 2023 15:43:37 +0000 (15:43 +0000)]
[Flang][OpenMP] Refactor to properly fix privatisation of loop bounds

The OpenMP loop Operations have the bounds attached to them. If the
loop bounds are privatised then the privatisation has to happen
before the loop operation is created. To do this the privatisation
is split into two steps. The first step performs cloning and
firstprivate handling, the second step performs lastprivate handling.

This also reverts the changes in the temporary fix (D127137).

Fixes https://github.com/flang-compiler/f18-llvm-project/issues/1171#issuecomment-1143880545
Fixes https://github.com/flang-compiler/f18-llvm-project/issues/1171#issuecomment-1119997442

Fixes #60872

Reviewed By: NimishMishra

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

13 months ago[clangd] Show size, offset and padding for bit fields on hover
SR_team [Mon, 5 Jun 2023 15:52:06 +0000 (17:52 +0200)]
[clangd] Show size, offset and padding for bit fields on hover

Examle:
```
struct test {
char a;
char b : 3;
char c : 5;
int d;
int e : 27;
};
```

{F27617774}
{F27617776}
{F27617777}
{F27617780}

Reviewed By: sammccall

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

13 months ago[libunwind] Removes CMake work-arounds.
Mark de Wever [Sun, 4 Jun 2023 15:41:17 +0000 (17:41 +0200)]
[libunwind] Removes CMake work-arounds.

CMake older than 3.20.0 is no longer supported.
This removes work-arounds for no longer supported versions.

Reviewed By: #libunwind, mstorsjo

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

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