platform/upstream/llvm.git
21 months ago[libc++][NFC] Change _VSTD to std as a prereq for D122780
Louis Dionne [Tue, 11 Oct 2022 19:58:35 +0000 (15:58 -0400)]
[libc++][NFC] Change _VSTD to std as a prereq for D122780

21 months ago[MC] [NFC] replace tabs with space in test
Florian Mayer [Tue, 11 Oct 2022 19:37:02 +0000 (12:37 -0700)]
[MC] [NFC] replace tabs with space in test

21 months ago[TokenLexer][NFC] Rename the InstLoc to ExpandLoc
Haojian Wu [Tue, 11 Oct 2022 12:58:22 +0000 (14:58 +0200)]
[TokenLexer][NFC] Rename the InstLoc to ExpandLoc

We don't use the "instantiate" word for the macro expansion in LLVM,
see c9c8419c383d0b53c40973f7587003ef45daf481.

21 months agoReenable gdb pretty printers, and update them.
Sterling Augustine [Mon, 10 Oct 2022 22:26:14 +0000 (15:26 -0700)]
Reenable gdb pretty printers, and update them.

Libcxx gdb pretty printers were disabled due to an old version
of gdb in the release testing. This reenables them, and fixes
various bit rot issues from not running them.

21 months ago[DX] Add analysis and printer for shader flags
Chris Bieneman [Tue, 11 Oct 2022 17:09:30 +0000 (12:09 -0500)]
[DX] Add analysis and printer for shader flags

This adds infrastructural pieces for an analysis to compute the DXIL
shader flags. In this state the analysis can compute two fairly
straightforward feature flags for use of double-precision floating
point values and the DX 11.1 extended double support.

This patch does conflict with D135190, conflicts will be resolved prior
to merging.

Reviewed By: python3kgae

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

# Conflicts:
# llvm/lib/Target/DirectX/CMakeLists.txt
# llvm/lib/Target/DirectX/DirectXTargetMachine.cpp

21 months ago[NFC] Test commit.
Michele Scandale [Tue, 11 Oct 2022 19:26:08 +0000 (12:26 -0700)]
[NFC] Test commit.

21 months ago[runtimes] Add the ability to customize the output name of libc++, libc++abi and...
Louis Dionne [Tue, 11 Oct 2022 14:05:56 +0000 (10:05 -0400)]
[runtimes] Add the ability to customize the output name of libc++, libc++abi and libunwind

We already had the ability to do that for libc++.dylib, so this only adds
consistency for all the runtime libraries. This should allow working around
difficulties on AIX as described in https://llvm.org/D134221.

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

21 months ago[libunwind] Install the headers by default
Louis Dionne [Tue, 11 Oct 2022 13:19:55 +0000 (09:19 -0400)]
[libunwind] Install the headers by default

Just like we install libc++ and libc++abi headers by default when we
install the library, it makes sense to install the libunwind headers
by default when we build libunwind. In the current state of things,
there is an increased risk that folks are using older (previously
installed) libunwind headers along with a recent libunwind dylib,
which is not ideal.

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

21 months ago[OpenMP] Fix `-foffload-lto` for offloading to Nvidia
Joseph Huber [Tue, 11 Oct 2022 18:39:06 +0000 (13:39 -0500)]
[OpenMP] Fix `-foffload-lto` for offloading to Nvidia

Summary:
A previous patch ensured that we can't use `-foffload-lto` with CUDA in
non-RDC mode. This did not correctly check for if we were actually
offloading to CUDA so it ended up preventing us from using LTO for
OpenMP.

21 months ago[OpenMP][Docs] Add documentation for linking OpenMP with CUDA/HIP
Joseph Huber [Tue, 11 Oct 2022 17:00:06 +0000 (12:00 -0500)]
[OpenMP][Docs] Add documentation for linking OpenMP with CUDA/HIP

Summary:
This patch adds an entry to the FAQ that shows how to link CUDA with
OpenMP.

21 months ago[Clang] Fix use of `hasArg` when `hasFlag` should be used instead
Joseph Huber [Tue, 11 Oct 2022 16:42:40 +0000 (11:42 -0500)]
[Clang] Fix use of `hasArg` when `hasFlag` should be used instead

Summary:
This option forwards a clang flag with a `-no` variant to the Clang
compiler. It should use the `hasFlag` so it works properly when the
option is overridden.

21 months ago[OpenMP][Docs] Document multi-architecture binary handling
Joseph Huber [Tue, 11 Oct 2022 16:30:03 +0000 (11:30 -0500)]
[OpenMP][Docs] Document multi-architecture binary handling

Summary:
This patch adds some documentation in the FAQ regarding
multi-architecture binary support using the `--offload-arch` flag.

21 months ago[docs] Fix warning in AMDGPUUsage.rst after 3d9f011a9c624b3128bc6b5e71ed456eb92e268c
Abinav Puthan Purayil [Tue, 11 Oct 2022 18:24:01 +0000 (23:54 +0530)]
[docs] Fix warning in AMDGPUUsage.rst after 3d9f011a9c624b3128bc6b5e71ed456eb92e268c

21 months ago[mlir][arith] Improve EmulateWideInt diagnostics
Jakub Kuderski [Tue, 11 Oct 2022 18:24:38 +0000 (14:24 -0400)]
[mlir][arith] Improve EmulateWideInt diagnostics

Print unsupported types on match failures.

Suggested by @Mogball and @jpienaar in D135204.

Reviewed By: Mogball

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

21 months ago[LLDB] Fix crash when printing a struct with a static wchar_t member
Arthur Eubanks [Fri, 7 Oct 2022 17:08:25 +0000 (10:08 -0700)]
[LLDB] Fix crash when printing a struct with a static wchar_t member

Similar to D135170.

Reviewed By: DavidSpickett

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

21 months ago[AMDGPU] Make the uses_dynamic_stack field in the kernel descriptor and the metadata...
Abinav Puthan Purayil [Tue, 27 Sep 2022 05:36:35 +0000 (11:06 +0530)]
[AMDGPU] Make the uses_dynamic_stack field in the kernel descriptor and the metadata map specific to code object v5 and later

Unfortunately, we have a broken handling of this in the runtime of rocm
5.3. The runtime is expected to handle this correctly when v5 becomes
the default.

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

21 months ago[clang-format] update --files help description
Yuanfang Chen [Tue, 11 Oct 2022 17:18:11 +0000 (10:18 -0700)]
[clang-format] update --files help description

correlates the option with reponse file concept.

Reviewed By: HazardyKnusperkeks

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

21 months ago[PPC] Opaque pointer migration, part 2.
Kai Nacke [Fri, 7 Oct 2022 18:34:40 +0000 (18:34 +0000)]
[PPC] Opaque pointer migration, part 2.

The LIT test cases were migrated with the script provided by
Nikita Popov. Due to the size of the change it is split into
several parts.

Reviewed By: nemanja, nikic

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

21 months ago[PPC] Opaque pointer migration, part 1.
Kai Nacke [Fri, 7 Oct 2022 17:50:35 +0000 (17:50 +0000)]
[PPC] Opaque pointer migration, part 1.

The LIT test cases were migrated with the script provided by
Nikita Popov. Due to the size of the change it is split into
several parts.

Reviewed By: nemanja, amyk, nikic, PowerPC

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

21 months ago[NFC][libc++][format] Improves tests.
Mark de Wever [Wed, 5 Oct 2022 17:21:43 +0000 (19:21 +0200)]
[NFC][libc++][format] Improves tests.

This is mainly to improve the readability of the tests. As a side
effects the tests run faster too,

Reviewed By: ldionne, #libc

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

21 months agoApply clang-tidy fixes for llvm-qualified-auto in Tiling.cpp (NFC)
Mehdi Amini [Thu, 6 Oct 2022 19:07:20 +0000 (19:07 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in Tiling.cpp (NFC)

21 months agoApply clang-tidy fixes for readability-identifier-naming in GPUTransformOps.cpp ...
Mehdi Amini [Thu, 6 Oct 2022 18:58:57 +0000 (18:58 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in GPUTransformOps.cpp (NFC)

21 months ago[GlobalISel] Combine (X op Y) == X --> Y == 0
Jessica Paquette [Thu, 6 Oct 2022 18:03:43 +0000 (11:03 -0700)]
[GlobalISel] Combine (X op Y) == X --> Y == 0

This matches patterns of the form

```
(X op Y) == X
```

And transforms them to

```
Y == 0
```

where appropriate.

Example: https://godbolt.org/z/hfW811c7W

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

21 months ago[SDAG] Treat DemandedElts argument to isSplatVector as splat for scalable vectors...
Philip Reames [Tue, 11 Oct 2022 16:32:49 +0000 (09:32 -0700)]
[SDAG] Treat DemandedElts argument to isSplatVector as splat for scalable vectors [nfc]

The previous code used a APInt(1, 0) to represent the demanded elts of a scalable vector, and then ignored that argument if type was scalable.  This was inconsistent with the UndefElts parameter which is set to either APInt(1, 0) or APInt(1,1) - that is, implicitly broadcast across all lanes.  Particularly since the undef code relied on the DemandedElts parameter having bitwidth 1 to achieve that result!

This change switches the demanded parameter to APInt(1,1), documents the broadcast semantics, and takes advantage of it to remove one special case for scalable vectors which is no longer required.

21 months ago[HLSL] Add Resource kind for HLSLResourceAttr.
Xiang Li [Thu, 6 Oct 2022 00:35:32 +0000 (17:35 -0700)]
[HLSL] Add Resource kind for HLSLResourceAttr.

A new EnumArgument ResourceKind is added for HLSLResourceAttr.
This will be use to get resource kind instead of parse it from the type name.

Reviewed By: aaron.ballman

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

21 months ago[flang] Fix buildbot failure after D135610.
Slava Zakharin [Tue, 11 Oct 2022 15:54:58 +0000 (08:54 -0700)]
[flang] Fix buildbot failure after D135610.

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

21 months ago[mlir] generate docs for GPU transform extension
Alex Zinenko [Tue, 11 Oct 2022 15:31:51 +0000 (15:31 +0000)]
[mlir] generate docs for GPU transform extension

21 months ago[AMDGPU] Make disassembler convertFMAanyK call more generic
Joe Nash [Tue, 11 Oct 2022 14:24:52 +0000 (10:24 -0400)]
[AMDGPU] Make disassembler convertFMAanyK call more generic

Make support more generic to support future instructions.
Currently NFC.

Reviewed By: foad, arsenm

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

21 months ago[Hexagon] Remove unused function, NFC
Krzysztof Parzyszek [Tue, 11 Oct 2022 15:04:07 +0000 (08:04 -0700)]
[Hexagon] Remove unused function, NFC

21 months ago[gn build] Reformat all build files
Nico Weber [Tue, 11 Oct 2022 14:26:00 +0000 (10:26 -0400)]
[gn build] Reformat all build files

Ran:

    git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format

21 months ago[GISel] Add redundant bitcast folding combine
Pierre van Houtryve [Tue, 4 Oct 2022 11:06:15 +0000 (11:06 +0000)]
[GISel] Add redundant bitcast folding combine

Simply folds away bitcasts that cancel each other.

Reviewed By: arsenm

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

21 months ago[libc++] static_assert that rebinding the allocator works as expected
Nikolas Klauser [Sat, 8 Oct 2022 20:17:32 +0000 (22:17 +0200)]
[libc++] static_assert that rebinding the allocator works as expected

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

21 months ago[Intrinsics] Remove duplicate ImmArg attribute on amdgcn.global.load.lds
Nikita Popov [Tue, 11 Oct 2022 14:32:18 +0000 (16:32 +0200)]
[Intrinsics] Remove duplicate ImmArg attribute on amdgcn.global.load.lds

21 months ago[gn build] port 243da90ea535 more
Nico Weber [Tue, 11 Oct 2022 14:28:56 +0000 (10:28 -0400)]
[gn build] port 243da90ea535 more

21 months ago[SDAG] Clarify behavior of scalable demanded/undef elts in isSplatValue [nfc]
Philip Reames [Tue, 11 Oct 2022 14:26:44 +0000 (07:26 -0700)]
[SDAG] Clarify behavior of scalable demanded/undef elts in isSplatValue [nfc]

Update comment, and add an assertion to check property expected by sole (non-test) caller.  Remove tests which appear to have been copied from fixed vector tests, and whose demanded bits don't correspond to the way this interface is otherwise used.

21 months ago[LoopRotation] Also drop block dispositions.
Florian Hahn [Tue, 11 Oct 2022 14:25:27 +0000 (15:25 +0100)]
[LoopRotation] Also drop block dispositions.

LoopRotation may also fold basic blocks, so cached block dispositions
also need to be dropped.

Fixes #58291.

21 months ago[gn build] (semi-automatically) port 243da90ea535
Nico Weber [Tue, 11 Oct 2022 14:24:17 +0000 (10:24 -0400)]
[gn build] (semi-automatically) port 243da90ea535

21 months ago[NVPTX] Fix a segfault for bitcasted calls with byval params
Luke Drummond [Fri, 23 Sep 2022 15:50:51 +0000 (16:50 +0100)]
[NVPTX] Fix a segfault for bitcasted calls with byval params

`getFunctionParamOptimizedAlign` was being passed a null function
argument when getting the callee of a bitcasted function symbol. This is
because `CallBase::getCalledFunction` does not look through bitcasts.

There is already code to handle this case in
`NVPTXTargetLowering::getArgumentAlignment`, which is now hoisted into
an NVPTX util.

The alignment computation now gracefully handles computing alignment of
virtual functions with a check for null.

21 months ago[LLDB] Change RegisterValue::GetAsMemoryData to const RegisterInfo&
David Spickett [Wed, 28 Sep 2022 14:00:02 +0000 (14:00 +0000)]
[LLDB] Change RegisterValue::GetAsMemoryData to const RegisterInfo&

Most of the paths to this never passed nullptr intentionally. Those
that possibly could have were assuming it was not null elsehwere,
so would have crashed.

I've added asserts in those cases.

At least one case was relying on GetAsMemoryData to return an error
when it was given nullptr. So I've hoisted that error setting code
out into the caller.

Depends on D134963

Reviewed By: clayborg

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

21 months ago[InstCombine] try harder to cancel out mul/div
Sanjay Patel [Tue, 11 Oct 2022 13:28:09 +0000 (09:28 -0400)]
[InstCombine] try harder to cancel out mul/div

((Op1 * X) / Y) / Op1 --> X / Y
https://alive2.llvm.org/ce/z/JYxWjA

InstSimplify handles the more basic mul+div pattern with
shared operand, but we don't seem to have any reassociation
folds to handle cases where the common op is further away.

This is a generalization of 9cff4711ac72 and another
transform derived from issue #58137.

21 months ago[InstCombine] add tests for div with common mul operand; NFC
Sanjay Patel [Tue, 11 Oct 2022 12:39:10 +0000 (08:39 -0400)]
[InstCombine] add tests for div with common mul operand; NFC

21 months ago[mlir][Bazel] Remove unused dependency.
Adrian Kuegel [Tue, 11 Oct 2022 13:39:28 +0000 (15:39 +0200)]
[mlir][Bazel] Remove unused dependency.

21 months agoMake windows resource generation more robust
Anush Elangovan [Tue, 11 Oct 2022 13:30:15 +0000 (06:30 -0700)]
Make windows resource generation more robust

This is another attempt at https://reviews.llvm.org/D110489.

When build IREE we run into cases where we don't have / need
LLVM_VERSION_* etc set. Compilation fails if it isn't an integer.

Reviewed By: stellaraccident

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

21 months ago[LLDB] Switch to RegisterInfo& for EmulateInstruction::WriteRegister
David Spickett [Wed, 28 Sep 2022 13:15:44 +0000 (13:15 +0000)]
[LLDB] Switch to RegisterInfo& for EmulateInstruction::WriteRegister

WriteRegister and WriteRegisterUnsigned were never pased nullptr,
and only one of them appeared to handle it. Switch to ref to make
the intent clear.

Depends on D134962

Reviewed By: clayborg

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

21 months ago[mlir][llvm] Introduce a mapValue function in LLVMIR import (nfc).
Tobias Gysi [Tue, 11 Oct 2022 12:58:32 +0000 (15:58 +0300)]
[mlir][llvm] Introduce a mapValue function in LLVMIR import (nfc).

The revision adds a mapValue function to the Importer, which can be used
in the MLIR builders to provide controlled accesses to the result
mapping of the imported instructions. Additionally, the change allows us
to avoid accessing a private member variable of the Importer class,
which simplifies future refactorings that aim at factoring out a
conversion interface (similar to the MLIR to LLVM translation). The
revision also renames the variables used when emitting the MLIR builders
to prepare the generalization to non-intrinsic instructions. In
particular, it renames callInst to inst and it passes in the instruction
arguments using an llvmOperands array rather than accessing the call
arguments directly.

Reviewed By: ftynse

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

21 months ago[TableGen] Change representation of ArgumentAttributes (NFC)
Nikita Popov [Tue, 11 Oct 2022 13:01:48 +0000 (15:01 +0200)]
[TableGen] Change representation of ArgumentAttributes (NFC)

Instead of a flat list that includes the argument index, use a
nested vector, where each inner vector is the attribute set for
a single argument. This is more obvious and makes followup changes
simpler.

21 months ago[libclang] CIndex: Visit UsingTypeLoc as TypeRef
Kai Stierand [Tue, 11 Oct 2022 12:32:43 +0000 (14:32 +0200)]
[libclang] CIndex: Visit UsingTypeLoc as TypeRef

Reviewed By: sammccall

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

21 months ago[libc++] Add the C++17 <memory_resource> header (mono-patch)
Arthur O'Dwyer [Thu, 6 Oct 2022 20:53:30 +0000 (16:53 -0400)]
[libc++] Add the C++17 <memory_resource> header (mono-patch)

This patch is the rebase and squash of three earlier patches.
It supersedes all three of them.

- D47111: experimental monotonic_buffer_resource.
- D47358: experimental pool resources.
- D47360: Copy std::experimental::pmr to std::pmr.

The significant difference between this patch and the-sum-of-those-three
is that this patch does not add `std::experimental::pmr::monotonic_buffer_resource`
and so on. This patch simply adds the C++17 standard facilities, and
leaves the `std::experimental` namespace entirely alone.

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

21 months agoReland "[clang][LoongArch] Set MaxAtomicInlineWidth and MaxAtomicPromoteWidth for...
wanglei [Tue, 11 Oct 2022 12:23:03 +0000 (20:23 +0800)]
Reland "[clang][LoongArch] Set MaxAtomicInlineWidth and MaxAtomicPromoteWidth for LoongArch"

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

21 months ago[NFC] Factor out collection of unswitch candidate to a separate function
Max Kazantsev [Tue, 11 Oct 2022 11:01:58 +0000 (18:01 +0700)]
[NFC] Factor out collection of unswitch candidate to a separate function

Just to make the code more structured and easier to understand.

21 months ago[NFC] Refine API in SimpleLoopUnswitch: add missing const notions
Max Kazantsev [Tue, 11 Oct 2022 11:53:44 +0000 (18:53 +0700)]
[NFC] Refine API in SimpleLoopUnswitch: add missing const notions

21 months ago[NFC] Refine API: add missing const notion in hasPartialIVCondition
Max Kazantsev [Tue, 11 Oct 2022 11:30:17 +0000 (18:30 +0700)]
[NFC] Refine API: add missing const notion in hasPartialIVCondition

21 months ago[flang] Add cpowi function to runtime and use instead of pgmath
David Truby [Mon, 3 Oct 2022 11:01:50 +0000 (11:01 +0000)]
[flang] Add cpowi function to runtime and use instead of pgmath

This patch adds a cpowi function to the flang runtime, and switches
to using that function instead of pgmath for complex number to
integer power operations.

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

21 months ago[LLDB] Change pointer to ref in EmulateInstruction::ReadRegister methods
David Spickett [Wed, 28 Sep 2022 12:45:18 +0000 (12:45 +0000)]
[LLDB] Change pointer to ref in EmulateInstruction::ReadRegister methods

ReadRegister and ReadRegisterAsUnsigned are always passed valid pointers,
so the parameter should be a ref to make the intent clear.

Reviewed By: clayborg

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

21 months ago[NFC] Pre-commit tests for D135434.
Simon Tatham [Fri, 7 Oct 2022 09:17:29 +0000 (10:17 +0100)]
[NFC] Pre-commit tests for D135434.

pipeliner-preserve-ties.mir demonstrates a current bug in which the
output of the Modulo Software Pipelining pass has left off a tie
between operands in the conditional `t2ADDri` instruction. It should
look like this:

    %19:rgpr = t2ADDri %1, 1, 1 /* CC::ne */, $cpsr, $noreg, implicit %1(tied-def 0)

in which the final input operand is tied to the output, because that's
the input that will become the output value if the conditionalized add
instruction does not execute, and hence, must necessarily be whatever
was in the output register beforehand.

In the input to the pipeliner, those `tied-def` specifications are
present and correct. But when the pipeliner clones MachineInstrs, it
loses them.

pipeliner-inlineasm.mir does not demonstrate any bug: the output is
already correct, because of compensation code in the machine pipeliner
that applies only to INLINEASM instructions. But no test previously
exercised that code, so I add one now before making changes in that
area.

21 months ago[mlir] drop unnecssary transform.with_pdl_patterns from tests, NFC
Alex Zinenko [Tue, 11 Oct 2022 11:44:58 +0000 (11:44 +0000)]
[mlir] drop unnecssary transform.with_pdl_patterns from tests, NFC

Many tests wrap the piece of the IR related to the transform dialect
into `transform.with_pdl_patterns` without actually using PDL patterns
inside. Some of these are leftovers from migration to `structured.match`
and some others are cargo cult, both are useless and pollute the tests.

Reviewed By: guraypp

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

21 months agoReland "[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC"
Weining Lu [Tue, 11 Oct 2022 11:13:18 +0000 (19:13 +0800)]
Reland "[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC"

Reference: https://gcc.gnu.org/onlinedocs/gccint/Machine-Constraints.html

k: A memory operand whose address is formed by a base register and
(optionally scaled) index register.

m: A memory operand whose address is formed by a base register and
offset that is suitable for use in instructions with the same
addressing mode as st.w and ld.w.

ZB: An address that is held in a general-purpose register. The offset
is zero.

ZC: A memory operand whose address is formed by a base register and
offset that is suitable for use in instructions with the same
addressing mode as ll.w and sc.w.

Note:
The INLINEASM SDNode flags in below tests are updated because the new
introduced enum `Constraint_k` is added before `Constraint_m`.
  llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-inline-asm.ll
  llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-inline-asm.ll
  llvm/test/CodeGen/X86/callbr-asm-kill.mir

This patch passes `ninja check-all` on a X86 machine with all official
targets and the LoongArch target enabled.

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

21 months ago[AMDGPU][MC] Correct image_gather4h
Dmitry Preobrazhensky [Tue, 11 Oct 2022 11:40:23 +0000 (14:40 +0300)]
[AMDGPU][MC] Correct image_gather4h

Correct encoding of image_gather4h for GFX9; disable this instruction for SI, CI and VI.

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

21 months ago[AArch64] Add SEH_Nop opcodes for BTI hints
Martin Storsjö [Wed, 5 Oct 2022 10:49:20 +0000 (13:49 +0300)]
[AArch64] Add SEH_Nop opcodes for BTI hints

These are harmless for the unwinder - the unwinder doesn't need to
handle them for being able to unwind correctly.

Only add the opcodes when the branch target is in a SEH prologue;
for jumptables e.g. within a function, we shouldn't add any SEH
opcodes.

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

21 months ago[llvm-readobj] Decode the new ARM64 SEH info for return address signing
Martin Storsjö [Wed, 5 Oct 2022 09:04:02 +0000 (12:04 +0300)]
[llvm-readobj] Decode the new ARM64 SEH info for return address signing

This got documented upstream in
https://github.com/MicrosoftDocs/cpp-docs/pull/4202.

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

21 months agoRevert "[clang][LoongArch] Set MaxAtomicInlineWidth and MaxAtomicPromoteWidth for...
Weining Lu [Tue, 11 Oct 2022 11:21:28 +0000 (19:21 +0800)]
Revert "[clang][LoongArch] Set MaxAtomicInlineWidth and MaxAtomicPromoteWidth for LoongArch"

This reverts commit 6547565e7bdcd9c3f683ad196b62d08c7061fdf1.

This breaks test: Preprocessor/init-loongarch.c

21 months ago[CostModel][X86] Add insertelement costs into a known base vector value
Simon Pilgrim [Tue, 11 Oct 2022 11:07:13 +0000 (12:07 +0100)]
[CostModel][X86] Add insertelement costs into a known base vector value

We were only testing inserting into undef/poison base vectors

Test coverage for Issue #58261

21 months ago[LoongArch] Define getSetCCResultType for setting vector setCC type
wanglei [Tue, 11 Oct 2022 10:50:11 +0000 (18:50 +0800)]
[LoongArch] Define getSetCCResultType for setting vector setCC type

To avoid trigger "No default SetCC type for vectors!" Assertion.

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

21 months ago[mlir] use raw function pointer instead of std::function
Alex Zinenko [Tue, 11 Oct 2022 10:55:51 +0000 (10:55 +0000)]
[mlir] use raw function pointer instead of std::function

Accessing the target of std::function apparently requires RTTI, use a
raw pointer instead.

21 months ago[clang][LoongArch] Set MaxAtomicInlineWidth and MaxAtomicPromoteWidth for LoongArch
wanglei [Tue, 11 Oct 2022 10:12:28 +0000 (18:12 +0800)]
[clang][LoongArch] Set MaxAtomicInlineWidth and MaxAtomicPromoteWidth for LoongArch

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

21 months ago[LoongArch] Add codegen support of GlobalTLSAddress lowering
wanglei [Tue, 11 Oct 2022 09:43:59 +0000 (17:43 +0800)]
[LoongArch] Add codegen support of GlobalTLSAddress lowering

There are static and dynamic TLS address lowering in DAG stage according
to different TLS models.

TLS address will be lowered to pseudo instruction and then expanded by
the `LoongArch Pre-RA pseudo instruction expansion` pass.

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

21 months ago[mlir] switch the transform loop extension to use types
Alex Zinenko [Mon, 10 Oct 2022 14:38:31 +0000 (14:38 +0000)]
[mlir] switch the transform loop extension to use types

Add types to the Loop (SCF) extension of the transform dialect.

See https://discourse.llvm.org/t/rfc-type-system-for-the-transform-dialect/65702

Reviewed By: nicolasvasilache

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

21 months ago[mlir] add OperationType to the Transform dialect
Alex Zinenko [Mon, 10 Oct 2022 14:33:59 +0000 (14:33 +0000)]
[mlir] add OperationType to the Transform dialect

Add a new OperationType handle type to the Transform dialect. This
transform type is parameterized by the name of the payload operation it
can point to. It is intended as a constraint on transformations that are
only applicable to a specific kind of payload operations. If a
transformation is applicable to a small set of operation classes, it can
be wrapped into a transform op by using a disjunctive constraint, such
as `Type<Or<[Transform_ConcreteOperation<"foo">.predicate,
Transform_ConcreteOperation<"bar">.predicate]>>` for its operand without
modifying this type. Broader sets of accepted operations should be
modeled as specific types.

Reviewed By: nicolasvasilache

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

21 months ago[mlir] cleanup transform payload setting
Alex Zinenko [Fri, 7 Oct 2022 15:04:36 +0000 (15:04 +0000)]
[mlir] cleanup transform payload setting

Before the multi-handle relaxation, the transform interpreter did not
actually set payload for a handle that had no further uses as a hacky
mechanism to work around the multi-handle problem. This is no longer
necessary and can be removed to avoid debugging surprises when a handle
has no payload even when its producing op assigned it.

Reviewed By: nicolasvasilache

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

21 months ago[mlir] switch transform dialect ops to use TransformTypeInterface
Alex Zinenko [Wed, 5 Oct 2022 14:23:19 +0000 (14:23 +0000)]
[mlir] switch transform dialect ops to use TransformTypeInterface

Use the recently introduced TransformTypeInterface instead of hardcoding
the PDLOperationType. This will allow the operations to use more
specific transform types to express pre/post-conditions in the future.
It requires the syntax and Python op construction API to be updated.
Dialect extensions will be switched separately.

Reviewed By: nicolasvasilache

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

21 months ago[mlir] clean up transform dialect definitions, NFC
Alex Zinenko [Tue, 4 Oct 2022 15:49:30 +0000 (15:49 +0000)]
[mlir] clean up transform dialect definitions, NFC

Refactor the definition of the Transform dialect to move non-trivial
method implementations out of the .td file, and detemplatize functions
when possible while moving their implementations to a .cpp.

Reviewed By: nicolasvasilache

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

21 months ago[mlir] add types to the transform dialect
Alex Zinenko [Tue, 4 Oct 2022 11:49:21 +0000 (11:49 +0000)]
[mlir] add types to the transform dialect

Introduce a type system for the transform dialect. A transform IR type
captures the expectations of the transform IR on the payload IR
operations that are being transformed, such as being of a certain kind
or implementing an interface that enables the transformation. This
provides stricter checking and better readability of the transform IR
than using the catch-all "handle" type.

This change implements the basic support for a type system amendable to
dialect extensions and adds a drop-in replacement for the unrestricted
"handle" type. The actual switch of transform dialect ops to that type
will happen in a separate commit.

See https://discourse.llvm.org/t/rfc-type-system-for-the-transform-dialect/65702

Reviewed By: nicolasvasilache

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

21 months ago[mlir][gpu] Add `subgroup_reduce` operation
Ivan Butygin [Wed, 5 Oct 2022 21:57:33 +0000 (23:57 +0200)]
[mlir][gpu] Add `subgroup_reduce` operation

Introduce `subgroup_reduce` operation, similar to `all_reduce`, but operating on subgroup scope instead of workgroup.
It is intended as low-level building block for more high level abstractions (e.g for workgroup-wide `all_reduce` ops).
Only introduce version taking reduce operation enum for simplicity sake.

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

21 months ago[mlir][Linalg] Retire LinalgStrategyTilePass and filter-based pattern.
Nicolas Vasilache [Mon, 10 Oct 2022 09:05:14 +0000 (02:05 -0700)]
[mlir][Linalg] Retire LinalgStrategyTilePass and filter-based pattern.

Context: https://discourse.llvm.org/t/psa-retire-linalg-filter-based-patterns/63785

Uses of `LinalgTilingPattern::returningMatchAndRewrite` are replaced by a top-level `tileWithLinalgTilingOptions` function that is marked obsolete and serves
as a temporary means to transition away from `LinalgTilingOptions`-based tiling.
LinalgTilingOptions supports too many options that have been orthogonalized with the use of the transform dialect.

Additionally, the revision introduces a `transform.structured.tile_to_scf_for` structured transform operation that is needed to properly tile `tensor.pad`
via the TilingInterface. Uses of `transform.structured.tile` will be deprecated and replaced by this new op.
This will achieve the deprecation of `linalg::tileLinalgOp`.
Context: https://discourse.llvm.org/t/psa-retire-tileandfuselinalgops-method/63850

In the process of transitioning, tests that were performing tile and distribute on tensors are retired: transformations should be orthogonalized better in the future.
In particular, tiling to specific loop types and tileAndDistribute behavior are not available via the transform ops.
The behavior is still available as part of the `tileWithLinalgTilingOptions` method to allow downstream clients to transition without breakages but is meant to be retired soon.

As more tests are ported to the transform dialect, it became necessary to introduce a test-transform-dialect-erase-schedule-pass to discard the transform specification
once applied so that e2e lowering and execution is possible.

Lastly, a number of redundant tests that were testing composition of patterns are retired as they are available with a better mechanism via the transform dialect.

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

21 months ago[SimplifyLibCalls] Use helper methods to query attributes (NFC)
Nikita Popov [Tue, 11 Oct 2022 09:41:28 +0000 (11:41 +0200)]
[SimplifyLibCalls] Use helper methods to query attributes (NFC)

21 months ago[Attributes] Return Optional from getAllocSizeArgs() (NFC)
Nikita Popov [Tue, 11 Oct 2022 09:01:29 +0000 (11:01 +0200)]
[Attributes] Return Optional from getAllocSizeArgs() (NFC)

As suggested on D135572, return Optional<> from getAllocSizeArgs()
rather than the peculiar pair(0, 0) sentinel.

The method on Attribute itself does not return Optional, because
the attribute must exist in that case.

21 months ago[Attributes] Support int attributes with zero value
Nikita Popov [Mon, 10 Oct 2022 11:57:24 +0000 (13:57 +0200)]
[Attributes] Support int attributes with zero value

This regularly comes up as a stumbling stone when adding int
attributes: They currently need to be encoded in a way to avoids
the zero value.

This adds support for zero-value int attributes by a) making the
ctor determine int/enum attribute based on attribute kind, not
whether the value is non-zero and b) switching getRawIntAttr()
to return an Optional, so that it's possible to distinguish a zero
value from non-existence.

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

21 months ago[AttrBuilder] Remove unused vscale accessors (NFC)
Nikita Popov [Tue, 11 Oct 2022 08:29:44 +0000 (10:29 +0200)]
[AttrBuilder] Remove unused vscale accessors (NFC)

These accessors are not used. Generally, nowadays it is preferable
to perform queries on AttributeSets/Lists, rather than the
AttrBuilder, which is optimized towards attribute construction now.

21 months ago[AArch64][ARM] Alter most of arm_neon.h to be target-based, not preprocessor based.
David Green [Tue, 11 Oct 2022 08:09:16 +0000 (09:09 +0100)]
[AArch64][ARM] Alter most of arm_neon.h to be target-based, not preprocessor based.

Similar to D131064, this alters most of the intrinsics in arm_neon.h to
be target based, not preprocessor based. The intrinsics that are changed
are the ones with obvious target features (fp16, fp16fml, cryptos, i8mm
and bf16). The ones that are not yet altered are the ones without target
features like rdma (8.1) and complex (8.3). Those will be switched in a
followup patch that allows targeting architecture versions.

The existing ArchGuard in arm_neon.td is split into ArchGuard that still
adds ifdef defines (for example for intrinsics that require __aarch64__),
and TargetGuards for intrinsics dependant on target features. From there
the TargetGuards are used in two ways:
 - For intrinsics emitted as functions, __attribute__((target(TargetGuard)))
   is added to the definition of the function. Along with the existing
   always_inline intrinsic, this will give a compile time error if the
   function is used in a context where the target feature is not available.
 - For intrinsics emitted as macros, the __builtins are emitted into
   arm_neon.inc using TARGET_BUILTIN as opposed to BUILTIN, which includes
   the target feature and gives an error if the builtin is found in a
   function without the required features, similar to arm_sve.h.

The second method requires that the intrinsics be separable from the
existing _v intrinsics used in other types. For example
__builtin_neon_splat_lane_bf16 is used as opposed to
__builtin_neon_splat_lane_v. There are some adjustments to the CGBuiltin
to account for intrinsics that can be treated similarly, except for
their target features.

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

21 months ago[Attributes] Remove AttrBuilder::hasAlignmentAttr() method (NFC)
Nikita Popov [Tue, 11 Oct 2022 07:56:37 +0000 (09:56 +0200)]
[Attributes] Remove AttrBuilder::hasAlignmentAttr() method (NFC)

This was the odd one out, with similar methods not existing for
any other attributes. In the places where it is used, it is best
replaced by AttrBuilder::getAttribute(), which allows us to both
test for presence of the attribute and retrieve its value at the
same time. (To just check for presence, contains() could be used.)

21 months ago[AsmParser] Remove some redundant checks for align attributes
Nikita Popov [Tue, 11 Oct 2022 07:53:08 +0000 (09:53 +0200)]
[AsmParser] Remove some redundant checks for align attributes

The verifier already has a more general check that the attribute is
legal for the position it is used in.

21 months ago[Attributes] Remove special SRet/ByVal attribute handling in C API
Nikita Popov [Tue, 11 Oct 2022 07:39:39 +0000 (09:39 +0200)]
[Attributes] Remove special SRet/ByVal attribute handling in C API

Proper construction functions for these have long since been
exposed, and these attributes require a type nowadays, so drop the
old compatibility code.

21 months ago[MustExec][LICM] Handle latch being part of an inner cycle (PR57780)
Nikita Popov [Tue, 20 Sep 2022 11:04:27 +0000 (13:04 +0200)]
[MustExec][LICM] Handle latch being part of an inner cycle (PR57780)

The algorithm in allLoopPathsLeadToBlock() does not handle the case
where the loop latch is part of the predecessor set correctly: In
this case, we may take the backedge (escaping to a different loop
iteration) and not execute other latch successors. This can happen
if the latch is part of an inner cycle.

Fixes https://github.com/llvm/llvm-project/issues/57780.

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

21 months ago[test] Require aarch64-registered-target
Fangrui Song [Tue, 11 Oct 2022 05:27:26 +0000 (22:27 -0700)]
[test] Require aarch64-registered-target

21 months ago[libc] Add POSIX functions posix_spawn_file_actions_*.
Siva Chandra Reddy [Mon, 10 Oct 2022 08:35:21 +0000 (08:35 +0000)]
[libc] Add POSIX functions posix_spawn_file_actions_*.

Namely, posix_spawn_file_actions_addclose,
posix_spawn_file_actions_adddup2, posix_spawn_file_actions_addopen,
posix_spawn_file_actions_destroy, posix_spawn_file_actions_init have
been added.

Reviewed By: michaelrj, lntue

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

21 months ago[MC][test] Add Mach-O .addrsig test
Fangrui Song [Tue, 11 Oct 2022 04:10:35 +0000 (21:10 -0700)]
[MC][test] Add Mach-O .addrsig test

21 months ago[clang-format] Fix mis-attributing preprocessor directives to macros
Jacob Abraham [Tue, 11 Oct 2022 02:57:17 +0000 (19:57 -0700)]
[clang-format] Fix mis-attributing preprocessor directives to macros

This solves the issue where a case statement inside a macro greedily
adds preprocessor lines such as #include to the macro even if they
are not a part of the macro to begin with.

Fixes #58214.

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

21 months ago[flang] Support GNU extensions IARGC and GETARG in runtime
Peixin-Qiao [Tue, 11 Oct 2022 02:29:23 +0000 (10:29 +0800)]
[flang] Support GNU extensions IARGC and GETARG in runtime

The GNU extension intrinsic IARGC is equivalent to
COMMAND_ARGUMENT_COUNT, and the GETARG is similar to
GET_COMMAND_ARGUMENT, but with less arguments. Reuse the runtime of
COMMAND_ARGUMENT_COUNT and GET_COMMAND_ARGUMENT for IARGC and GETARG.

Reviewed By: klausler

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

21 months ago[DeviceRTL] CMake fix using target-level dependency
Ye Luo [Mon, 10 Oct 2022 22:53:50 +0000 (17:53 -0500)]
[DeviceRTL] CMake fix using target-level dependency

File-level dependency should not be used on files generated during the build. The next command may execute before the generating command finishes writing the file. Use add_custom_target and use target-level dependency.

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

21 months ago[flang][NFC] Fix typos in FIROps.td
Peixin-Qiao [Tue, 11 Oct 2022 01:51:36 +0000 (09:51 +0800)]
[flang][NFC] Fix typos in FIROps.td

Reviewed By: kiranchandramohan

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

21 months ago[flang][NFC] Fix fir::ConvertOp description
Peixin-Qiao [Tue, 11 Oct 2022 01:25:41 +0000 (09:25 +0800)]
[flang][NFC] Fix fir::ConvertOp description

According to the support of fir::ConvertOp conversion in CodeGen.cpp,
it also supports integer to pointer conversion and pointer to integer
conversion. The entity can be array, and the conversion type can be
pointer to array.

Reviewed By: jeanPerier

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

21 months ago[clang] makes `__is_destructible` KEYALL instead of KEYMS
Christopher Di Bella [Thu, 6 Oct 2022 01:50:16 +0000 (01:50 +0000)]
[clang] makes `__is_destructible` KEYALL instead of KEYMS

This makes it possible to be used in all modes, instead of just when
`-fms-extensions` is enabled. Also moves the `-fms-extensions`-exclusive
traits into their own file so we can check the others aren't dependent
on this flag.

This is information that the compiler already has, and should be exposed
so that the library doesn't need to reimplement the exact same
functionality.

This was originally a part of D116280.

Depends on D135177.

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

21 months ago[clang] adds `__is_scoped_enum`, `__is_nullptr`, and `__is_referenceable`
Christopher Di Bella [Tue, 4 Oct 2022 16:44:39 +0000 (16:44 +0000)]
[clang] adds `__is_scoped_enum`, `__is_nullptr`, and `__is_referenceable`

... as builtins.

This is information that the compiler already has, and should be exposed
so that the library doesn't need to reimplement the exact same
functionality.

This was originally a part of D116280.

Depends on D135175.

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

21 months ago[clang] adds `__is_bounded_array` and `__is_unbounded_array` as builtins
Christopher Di Bella [Tue, 4 Oct 2022 15:49:20 +0000 (15:49 +0000)]
[clang] adds `__is_bounded_array` and `__is_unbounded_array` as builtins

This is information that the compiler already has, and should be exposed
so that the library doesn't need to reimplement the exact same
functionality.

This was originally a part of D116280.

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

21 months ago[mlir][arith] Fix another file header (NFC)
Jeff Niu [Tue, 11 Oct 2022 00:03:35 +0000 (17:03 -0700)]
[mlir][arith] Fix another file header (NFC)

21 months ago[flang] Add type-specific runtime entries for Minloc/Maxloc.
Slava Zakharin [Mon, 10 Oct 2022 17:43:01 +0000 (10:43 -0700)]
[flang] Add type-specific runtime entries for Minloc/Maxloc.

We used to have a big switch statement over the type categories and kinds
inside Minloc/Maxloc. After D133051 the switch grew bigger, and this
changed inlining decisions made by GCC (the build compiler). Some of the
simple methods stopped being inlined, and this caused slight performance
regression in Polyhedron/gas_dyn2. This change adds separate entries
for real/integer data types to let them be optimized separately.

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

21 months ago[mlir][arith] Fix header spacing (NFC)
Jeff Niu [Mon, 10 Oct 2022 23:51:04 +0000 (16:51 -0700)]
[mlir][arith] Fix header spacing (NFC)

21 months ago[libc] fix header list for x86_64
Michael Jones [Mon, 10 Oct 2022 22:35:16 +0000 (15:35 -0700)]
[libc] fix header list for x86_64

Some headers hadn't been added, this fixes that and improves the
ordering.

Reviewed By: sivachandra

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

21 months ago[libc] reset errno in isatty tests
Michael Jones [Mon, 10 Oct 2022 22:48:18 +0000 (15:48 -0700)]
[libc] reset errno in isatty tests

Errno wasn't getting reset between tests, causing cascading failures.

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

21 months ago[mlir][tosa] Fix tosa::Select to linalg::generic indexingMaps bug
AmosLewis [Mon, 10 Oct 2022 22:47:50 +0000 (15:47 -0700)]
[mlir][tosa] Fix tosa::Select to linalg::generic indexingMaps bug

The tosa to linalg generic ops indexingMaps rank use is wrong.
 Find this bug in gpt2 pytorch model lowering to tosa.
 issue link is here https://github.com/llvm/llvm-project/issues/58154

Reviewed By: jpienaar

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