platform/upstream/llvm.git
13 months ago[X86] Add isUpperSubvectorUndef helper to simplify recognition of vectors widened...
Simon Pilgrim [Fri, 21 Jul 2023 16:48:11 +0000 (17:48 +0100)]
[X86] Add isUpperSubvectorUndef helper to simplify recognition of vectors widened with undef upper subvectors. NFC.

13 months ago[Sanitizers][Darwin][Test] Mark symbolize_pc test on Darwin/TSan+UBSan as UNSUPPORTED
Arthur Eubanks [Fri, 21 Jul 2023 16:47:08 +0000 (09:47 -0700)]
[Sanitizers][Darwin][Test] Mark symbolize_pc test on Darwin/TSan+UBSan as UNSUPPORTED

Followup to https://reviews.llvm.org/rG760c208f6ff9e97a9a11523c00874a1eec4f876b which XFAIL'd them, but they pass in some configurations.

13 months ago[flang] Accept an assumed-rank array as operand of ASSOCIATED()
Peter Klausler [Mon, 17 Jul 2023 16:42:47 +0000 (09:42 -0700)]
[flang] Accept an assumed-rank array as operand of ASSOCIATED()

The ASSOCIATED() intrinsic was mistakenly defined in the intrinsic
function table as requiring operands of known rank, which unintentionally
prevented assumed-rank dummy arguments from being tested.

Fixes llvm-test-suite/Fortran/gfortran/regression/pr88932.f90.

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

13 months agoclang/Debian: add Debian Trixie now that it is in unstable
Sylvestre Ledru [Fri, 21 Jul 2023 16:23:14 +0000 (18:23 +0200)]
clang/Debian: add Debian Trixie now that it is in unstable

13 months ago[MLIR][Linalg] Preserve DPS when decomposing Softmax
Lorenzo Chelini [Fri, 21 Jul 2023 11:28:45 +0000 (13:28 +0200)]
[MLIR][Linalg] Preserve DPS when decomposing Softmax

Preserve destination passing style (DPS) when decomposing
`linalg.Softmax`; instead of creating a new empty, which may materialize
as a new buffer after bufferization, use the result directly.

Reviewed By: qcolombet

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

13 months ago[RISCV][NFC] Add RISCVSubtarget field to RISCVExpandPseudo and RISCVPreRAExpandPseudo
Alex Bradbury [Fri, 21 Jul 2023 15:37:50 +0000 (16:37 +0100)]
[RISCV][NFC] Add RISCVSubtarget field to RISCVExpandPseudo and RISCVPreRAExpandPseudo

To my eye, it's cleaner to just get hold of STI in runOnMachineFunction
(as we do already for InstrInfo) and then accessing the field as needed
rather than to have repeated lookup code in the member functions or
helpers that need it.

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

13 months ago[libc] Treat the locks array as a bitfield
Joseph Huber [Fri, 21 Jul 2023 15:34:09 +0000 (10:34 -0500)]
[libc] Treat the locks array as a bitfield

Currently we keep an internal buffer of device memory that is used to
indicate ownership of a port. Since we only use this as a single bit we
can simply turn this into a bitfield. I did this manually rather than
having a separate type as we need very special handling of the masks
used to interact with the locks.

Reviewed By: JonChesterfield

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

13 months ago[Support] Implement LLVM_ENABLE_REVERSE_ITERATION for StringMap
Fangrui Song [Fri, 21 Jul 2023 15:46:51 +0000 (08:46 -0700)]
[Support] Implement LLVM_ENABLE_REVERSE_ITERATION for StringMap

ProgrammersManual.html says

> StringMap iteration order, however, is not guaranteed to be deterministic, so any uses which require that should instead use a std::map.

This patch makes -DLLVM_REVERSE_ITERATION=on (currently
-DLLVM_ENABLE_REVERSE_ITERATION=on works as well) shuffle StringMap
iteration order (actually flipping the hash so that elements not in the
same bucket are reversed) to catch violations, similar to D35043 for
DenseMap. This should help change the hash function (e.g., D142862,
D155781).

With a lot of fixes, there are still some violations. This patch
implements the "reverse_iteration" lit feature to skip such tests.
Eventually we should remove this feature.

`ninja check-{llvm,clang,clang-tools}` are clean with
`#define LLVM_ENABLE_REVERSE_ITERATION 1`.

Reviewed By: jhenderson

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

13 months ago[bazel] update config.h.cmake
Mikhail Goncharov [Fri, 21 Jul 2023 15:38:01 +0000 (17:38 +0200)]
[bazel] update config.h.cmake

13 months ago[RISCV] Allow delayed decision for ADD/SUB relocations
Fangrui Song [Fri, 21 Jul 2023 15:37:58 +0000 (08:37 -0700)]
[RISCV] Allow delayed decision for ADD/SUB relocations

For a label difference `A-B` in assembly, if A and B are separated by a
linker-relaxable instruction, we should emit a pair of ADD/SUB
relocations (e.g. R_RISCV_ADD32/R_RISCV_SUB32,
R_RISCV_ADD64/R_RISCV_SUB64).

However, the decision is made upfront at parsing time with inadequate
heuristics (`requiresFixup`). As a result, LLVM integrated assembler
incorrectly suppresses R_RISCV_ADD32/R_RISCV_SUB32 for the following
code:
```
// Simplified from a workaround https://android-review.googlesource.com/c/platform/art/+/2619609
// Both end and begin are not defined yet. We decide ADD/SUB relocations upfront and don't know they will be needed.
.4byte end-begin

begin:
  call foo
end:
```

To fix the bug, make two primary changes:

* Delete `requiresFixups` and the overridden emitValueImpl (from D103539).
  This deletion requires accurate evaluateAsAbolute (D153097).
* In MCAssembler::evaluateFixup, call handleAddSubRelocations to emit
  ADD/SUB relocations.

However, there is a remaining issue in
MCExpr.cpp:AttemptToFoldSymbolOffsetDifference. With MCAsmLayout, we may
incorrectly fold A-B even when A and B are separated by a
linker-relaxable instruction. This deficiency is acknowledged (see
D153097), but was previously bypassed by eagerly emitting ADD/SUB using
`requiresFixups`. To address this, we partially reintroduce `canFold` (from
D61584, removed by D103539).

Some expressions (e.g. .size and .fill) need to take the `MCAsmLayout`
code path in AttemptToFoldSymbolOffsetDifference, avoiding relocations
(weird, but matching GNU assembler and needed to match user
expectation). Switch to evaluateKnownAbsolute to leverage the `InSet`
condition.

As a bonus, this change allows for the removal of some relocations for
the FDE `address_range` field in the .eh_frame section.

riscv64-64b-pcrel.s contains the main test.
Add a linker relaxable instruction to dwarf-riscv-relocs.ll to test what
it intends to test.
Merge fixups-relax-diff.ll into fixups-diff.ll.

Reviewed By: kito-cheng

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

13 months agoRevert "[X86][BF16] Do not scalarize masked load for BF16 when we have BWI"
Phoebe Wang [Fri, 21 Jul 2023 15:29:11 +0000 (23:29 +0800)]
Revert "[X86][BF16] Do not scalarize masked load for BF16 when we have BWI"

This reverts commit ca1c05208ed35ba72869c65ad773b2cca4bbd360.

It caused Buildbot fail: https://lab.llvm.org/buildbot#builders/220/builds/24870

13 months ago[flang][nfc] Clarify the usage of llvmArgs and mlirArgs
Andrzej Warzynski [Fri, 21 Jul 2023 09:47:36 +0000 (10:47 +0100)]
[flang][nfc] Clarify the usage of llvmArgs and mlirArgs

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

13 months ago[X86][BF16] Do not scalarize masked load for BF16 when we have BWI
Phoebe Wang [Fri, 21 Jul 2023 15:18:38 +0000 (23:18 +0800)]
[X86][BF16] Do not scalarize masked load for BF16 when we have BWI

Fixes #63017

Reviewed By: RKSimon

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

13 months ago[mlir][nvgpu] Set useDefaultAttributePrinterParser
Guray Ozen [Fri, 21 Jul 2023 14:59:15 +0000 (16:59 +0200)]
[mlir][nvgpu] Set useDefaultAttributePrinterParser

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

13 months agoRevert "[mlir][spirv] Add D155747 to `.git-blame-ignore-revs`"
Jakub Kuderski [Fri, 21 Jul 2023 14:59:16 +0000 (10:59 -0400)]
Revert "[mlir][spirv] Add D155747 to `.git-blame-ignore-revs`"

This reverts commit b8a20658fee019fe9126a29f930ddd5dedec51ff.

This does not preserve the line history of cut-and-pasted code like I
expected.

13 months ago[ARM] Extend regression test for D154281
Jay Foad [Fri, 21 Jul 2023 14:43:11 +0000 (15:43 +0100)]
[ARM] Extend regression test for D154281

Add a test case with a larger call frame which does not satisfy
ARMFrameLowering::hasReservedCallFrame.

13 months ago[FunctionAttrs] Add tests for PR63936 (NFC)
Nikita Popov [Fri, 21 Jul 2023 14:44:38 +0000 (16:44 +0200)]
[FunctionAttrs] Add tests for PR63936 (NFC)

13 months agoAdd missing SLEEF mappings to scalable vector functions for log2 and log2f
Maciej Gabka [Thu, 20 Jul 2023 08:31:48 +0000 (08:31 +0000)]
Add missing SLEEF mappings to scalable vector functions for log2 and log2f

In the original commit adding SLEEF mappings, https://reviews.llvm.org/D146839
mappings for log2/log2f were missing.

Reviewed By: paulwalker-arm

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

13 months ago[ValueTracking] Check non-zero operator before dominating condition (NFC)
Nikita Popov [Fri, 21 Jul 2023 13:24:08 +0000 (15:24 +0200)]
[ValueTracking] Check non-zero operator before dominating condition (NFC)

Prefer checking for non-zero operator before non-zero via
dominating conditions. This is to make sure we don't have
compile-time regressions when special cases that are currently
part of isKnownNonZero() get moved into isKnownNonZeroFromOperator().

13 months ago[DAG] SimplifyDemandedBits - call ComputeKnownBits for constant non-uniform ISD:...
Simon Pilgrim [Fri, 21 Jul 2023 13:44:03 +0000 (14:44 +0100)]
[DAG] SimplifyDemandedBits - call ComputeKnownBits for constant non-uniform ISD::SRL shift amounts

We only attempted to determine KnownBits for uniform constant shift amounts, but ComputeKnownBits is able to handle some non-uniform cases as well that we can use as a fallback.

13 months ago[mlir][linalg] MapCopyToThreadsOp: Support tensor.pad
Matthias Springer [Fri, 21 Jul 2023 13:35:53 +0000 (15:35 +0200)]
[mlir][linalg] MapCopyToThreadsOp: Support tensor.pad

Also return the generated loop op.

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

13 months ago[ValueTracking] Extract isKnownNonZeroFromOperator() (NFC)
Nikita Popov [Fri, 21 Jul 2023 13:23:02 +0000 (15:23 +0200)]
[ValueTracking] Extract isKnownNonZeroFromOperator() (NFC)

Split off the primary part of the isKnownNonZero() implementation,
in the same way it is done for computeKnownBits(). This makes it
easier to reorder different parts of isKnownNonZero().

13 months agoRevert "[TLI][AArch64] Add missing SLEEF mappings to scalable vector functions for...
Maciej Gabka [Fri, 21 Jul 2023 13:50:10 +0000 (13:50 +0000)]
Revert "[TLI][AArch64] Add missing SLEEF mappings to scalable vector functions for log2 and log2f"

This reverts commit 791c89600aaa288d7066aea95a1e06cd6d61b2e3.

13 months ago[TLI][AArch64] Add missing SLEEF mappings to scalable vector functions for log2 and...
Maciej Gabka [Thu, 20 Jul 2023 08:31:48 +0000 (08:31 +0000)]
[TLI][AArch64] Add missing SLEEF mappings to scalable vector functions for log2 and log2f

In the original commit adding SLEEF mappings, https://reviews.llvm.org/D146839
mappings for log2/log2f were missing.

Reviewed By: paulwalker-arm

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

13 months ago[mlir][linalg] BufferizeToAllocationOp: Add option to materialize buffers for operands
Matthias Springer [Fri, 21 Jul 2023 13:29:16 +0000 (15:29 +0200)]
[mlir][linalg] BufferizeToAllocationOp: Add option to materialize buffers for operands

Add an option that does not bufferize the targeted op itself, but just materializes a buffer for the destination operands. This is useful for partial bufferization of complex ops such as `scf.forall`, which need special handling (and an analysis if the region).

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

13 months ago[mlir][transform] Add `apply_cse` option to `transform.apply_patterns` op
Matthias Springer [Fri, 21 Jul 2023 13:12:52 +0000 (15:12 +0200)]
[mlir][transform] Add `apply_cse` option to `transform.apply_patterns` op

Applying the canonicalizer and CSE in an interleaved fashion is useful after bufferization (and maybe other transforms) to fold away self copies.

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

13 months ago[clang][analyzer]Fix non-effective taint sanitation
Daniel Krupp [Wed, 19 Jul 2023 12:01:53 +0000 (14:01 +0200)]
[clang][analyzer]Fix non-effective taint sanitation

There was a bug in alpha.security.taint.TaintPropagation checker
in Clang Static Analyzer.
Taint filtering could only sanitize const arguments.
After this patch, taint filtering is effective also
on non-const parameters.

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

13 months ago[Clang] Diagnose jumps into statement expressions
Corentin Jabot [Fri, 7 Jul 2023 08:58:13 +0000 (10:58 +0200)]
[Clang] Diagnose jumps into statement expressions

Such jumps are not allowed by GCC and allowing them
can lead to situations where we jumps into unevaluated
statements.

Fixes #63682

Reviewed By: aaron.ballman, #clang-language-wg

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

13 months ago[mlir][nvgpu] Ignore -Wunused-function in NVGPUDialect.cpp (NFC)
Jie Fu [Fri, 21 Jul 2023 12:45:59 +0000 (20:45 +0800)]
[mlir][nvgpu] Ignore -Wunused-function in NVGPUDialect.cpp (NFC)

In file included from /Users/jiefu/llvm-project/mlir/lib/Dialect/NVGPU/IR/NVGPUDialect.cpp:363:
/Users/jiefu/llvm-project/build-Release/tools/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUAttrDefs.cpp.inc:22:36: error: unused function 'generatedAttributeParser' [-Werror,-Wunused-function]
static ::mlir::OptionalParseResult generatedAttributeParser(::mlir::AsmParser &parser, ::llvm::StringRef *mnemonic, ::mlir::Type type, ::mlir::Attribute &value) {
                                   ^
/Users/jiefu/llvm-project/build-Release/tools/mlir/include/mlir/Dialect/NVGPU/IR/NVGPUAttrDefs.cpp.inc:46:30: error: unused function 'generatedAttributePrinter' [-Werror,-Wunused-function]
static ::mlir::LogicalResult generatedAttributePrinter(::mlir::Attribute def, ::mlir::AsmPrinter &printer) {
                             ^
2 errors generated.

13 months ago[llvm][SLP] Exit early if inputs to comparator are equal
David Berard [Fri, 21 Jul 2023 12:24:47 +0000 (05:24 -0700)]
[llvm][SLP] Exit early if inputs to comparator are equal

**TL;DR:** This PR modifies a comparator. The comparator is used in a subsequent call to llvm::stable_sort. Sorting comparators should follow strict weak ordering - in particular, (x < x) should return false. This PR adds a fix to avoid an infinite loop when the inputs to the comparator are equal.

**Details**:

Sometimes when two equivalent tensors passed into the comparator, we encounter infinite looping (at https://github.com/llvm/llvm-project/blob/aae2eaae2cefd3132059925c4592276defdb1faa/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp#L4049)

Although it seems like this comparator will never be called with two equivalent pointers, some sanitizers, e.g. https://chromium.googlesource.com/chromiumos/third_party/gcc/+/refs/heads/stabilize-zako-5712.88.B/libstdc++-v3/include/bits/stl_algo.h#360, will add checks for (x < x). When this sanitizer is used with the current implementation, it triggers a comparator check for (x < x) which runs into the infinite loop

Reviewed By: ABataev

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

13 months ago[clangd] Prefer definitions for gototype and implementation
Kadir Cetinkaya [Wed, 14 Sep 2022 08:07:15 +0000 (10:07 +0200)]
[clangd] Prefer definitions for gototype and implementation

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

13 months ago[X86] matchBinaryShuffle - match PACKUS for v2i64 -> v4i32 shuffle truncation patterns.
Simon Pilgrim [Fri, 21 Jul 2023 11:26:45 +0000 (12:26 +0100)]
[X86] matchBinaryShuffle - match PACKUS for v2i64 -> v4i32 shuffle truncation patterns.

Handle PACKUSWD on +SSE41 targets, or fallback to PACKUSBW on any +SSE2 target

13 months ago[X86] Add packus.ll test coverage
Simon Pilgrim [Fri, 21 Jul 2023 10:56:35 +0000 (11:56 +0100)]
[X86] Add packus.ll test coverage

Similar to the existing packss.ll tests

13 months ago[X86] packss.ll - add SSE4.2 test coverage
Simon Pilgrim [Thu, 20 Jul 2023 13:31:02 +0000 (14:31 +0100)]
[X86] packss.ll - add SSE4.2 test coverage

13 months ago[OpenMP][OMPT] Add 'Initialized' flag
Michael Halkenhaeuser [Thu, 20 Jul 2023 19:41:35 +0000 (15:41 -0400)]
[OpenMP][OMPT] Add 'Initialized' flag

We observed some overhead and unnecessary debug output.
This can be alleviated by (re-)introduction of a boolean that indicates, if the
OMPT initialization has been performed.

Reviewed By: jdoerfert

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

13 months ago[clangd] Make the order of missing-include edits deterministic
Haojian Wu [Fri, 21 Jul 2023 12:12:44 +0000 (14:12 +0200)]
[clangd] Make the order of missing-include edits deterministic

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

13 months agoMark this test as unsupported on Windows systems
Aaron Ballman [Fri, 21 Jul 2023 12:08:09 +0000 (08:08 -0400)]
Mark this test as unsupported on Windows systems

There is a strange issue happening with command line processing though. The
command line argument
   --export-dynamic-symbol 'f*'
does not have the single quotes stripped on some Windows targets (but not
all). This causes the glob matching to fail, which means the test fails on
some Windows bots and passes on others.

This is expected to be a temporary measure to get bots back to green. I've not
found a commit that has caused a behavioral change that could be reverted
instead, so this could be an issue with lit or test machine configuration.

13 months ago[bazel] Tweak dependency spaghetti after 70c2e0618a0f3c09ed7149d88b4987b932eb6705
Benjamin Kramer [Fri, 21 Jul 2023 11:51:32 +0000 (13:51 +0200)]
[bazel] Tweak dependency spaghetti after 70c2e0618a0f3c09ed7149d88b4987b932eb6705

13 months ago[bazel] Port 5d8813dec69360fce897f063a4a65106ae8ea22b
Benjamin Kramer [Fri, 21 Jul 2023 11:51:10 +0000 (13:51 +0200)]
[bazel] Port 5d8813dec69360fce897f063a4a65106ae8ea22b

13 months ago[mlir] Fix build after D155680
Matthias Springer [Fri, 21 Jul 2023 11:33:54 +0000 (13:33 +0200)]
[mlir] Fix build after D155680

13 months ago[mlir] Update bazel build after rG70c2e0618a0f3c09ed7149d88b4987b932eb6705
Alexander Belyaev [Fri, 21 Jul 2023 11:16:31 +0000 (13:16 +0200)]
[mlir] Update bazel build after rG70c2e0618a0f3c09ed7149d88b4987b932eb6705

13 months ago[Clang] Fix access to an unitinialized variable
Corentin Jabot [Fri, 21 Jul 2023 10:32:23 +0000 (12:32 +0200)]
[Clang] Fix access to an unitinialized variable

This fixes the spurious test failure introduced in f9caa12328b2

13 months agoRevert "[LIT] Added an option to llvm-lit to emit the necessary test coverage data...
Shivam Gupta [Fri, 21 Jul 2023 10:29:56 +0000 (15:59 +0530)]
Revert "[LIT] Added an option to llvm-lit to emit the necessary test coverage data, divided per test case"

This reverts commit d8e26bccb3016d255298b7db78fe8bf05dd880b2.
Test case are meant to run only when LLVM_INDIVIDUAL_TEST_COVERAGE is set.

13 months ago[OpenMP] [OMPT] [6/8] Added callback support for target data operations, target submi...
Michael Halkenhaeuser [Wed, 8 Jun 2022 23:33:01 +0000 (16:33 -0700)]
[OpenMP] [OMPT] [6/8] Added callback support for target data operations, target submit, and target regions.

This patch adds support for invoking target callbacks but does not yet
invoke them. A new structure OmptInterface has been added that tracks
thread local states including correlation ids. This structure defines
methods that will be called from the device independent target library
with information related to a target entry point for which a callback
is invoked. These methods in turn use the callback functions maintained
by OmptDeviceCallbacksTy to invoke the tool supplied callbacks.

Depends on D124652

Patch from John Mellor-Crummey <johnmc@rice.edu>
With contributions from:
Dhruva Chakrabarti <Dhruva.Chakrabarti@amd.com>

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

13 months ago[mlir][bufferization] Remove cleanup pipeline from bufferization pass
Matthias Springer [Fri, 21 Jul 2023 10:10:36 +0000 (12:10 +0200)]
[mlir][bufferization] Remove cleanup pipeline from bufferization pass

To keep the pass simple, users should apply cleanup passes manually when necessary. In particular, `-cse -canonicalize` are often desireable to fold away self-copies that are created by the bufferization.

This addresses a comment in D120191.

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

13 months ago[AMDGPU] [NFC] Fixed a typo in SIShrinkInstructions.cpp
Pranav Taneja [Fri, 21 Jul 2023 10:03:37 +0000 (15:33 +0530)]
[AMDGPU] [NFC] Fixed a typo in SIShrinkInstructions.cpp

Reviewed By: pravinjagtap

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

13 months ago[AMDGPU][RFC] Update isLegalAddressingMode for GFX9 SMEM signed offsets
Jay Foad [Tue, 18 Jul 2023 12:38:31 +0000 (13:38 +0100)]
[AMDGPU][RFC] Update isLegalAddressingMode for GFX9 SMEM signed offsets

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

13 months ago[AMDGPU] Add tests for SMEM addressing modes in CodeGenPrepare
Jay Foad [Thu, 20 Jul 2023 15:51:48 +0000 (16:51 +0100)]
[AMDGPU] Add tests for SMEM addressing modes in CodeGenPrepare

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

13 months ago[LIT] Added an option to llvm-lit to emit the necessary test coverage data, divided...
Shivam Gupta [Fri, 21 Jul 2023 09:26:02 +0000 (14:56 +0530)]
[LIT] Added an option to llvm-lit to emit the necessary test coverage data, divided per test case

This patch is the first part of https://llvm.org/OpenProjects.html#llvm_patch_coverage.

We have first define a new variable LLVM_TEST_COVERAGE which when set, pass --emit-coverage option to
llvm-lit which will help in setting a unique value to LLVM_PROFILE_FILE for each RUN. So for example
coverage data for test case llvm/test/Analysis/AliasSet/memtransfer.ll will be emitted as
build/test/Analysis/AliasSet/memtransfer.profraw

Reviewed By: hnrklssn

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

13 months ago[mlir][transform][structured][python] Allow str arg in match_op_names.
Ingo Müller [Thu, 20 Jul 2023 09:58:41 +0000 (09:58 +0000)]
[mlir][transform][structured][python] Allow str arg in match_op_names.

Allow the `names` argument in `MatchOp.match_op_names` to be of type
`str` in addition to `Sequence[str]`. In this case, the argument is
treated as a list with one name, i.e., it is possible to write
`MatchOp.match_op_names(..., "test.dummy")` instead of
`MatchOp.match_op_names(..., ["test.dummy"])`.

Reviewed By: ftynse

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

13 months ago[mlir][linalg][transform] Extend diagnostics of FuseIntoContainingOp.
Ingo Müller [Thu, 20 Jul 2023 08:57:22 +0000 (08:57 +0000)]
[mlir][linalg][transform] Extend diagnostics of FuseIntoContainingOp.

This patch extends the diagnostic output of `FuseIntoContainingOp` when
it fails to find the next producer by also provided the location of the
affected transform op.

Reviewed By: ftynse

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

13 months ago[mlir][nvgpu] Add `tma.create.descriptor` to create tensor map descriptor
Guray Ozen [Fri, 21 Jul 2023 09:12:56 +0000 (11:12 +0200)]
[mlir][nvgpu] Add `tma.create.descriptor` to create tensor map descriptor

The Op creates a tensor map descriptor object representing tiled memory region. The descriptor is used by Tensor Memory Access (TMA). The `tensor` is the source tensor to be tiled. The `boxDimensions` is the size of the tiled memory region in each dimension.

The pattern here lowers `tma.create.descriptor` to a runtime function call that eventually calls calls CUDA Driver's `cuTensorMapEncodeTiled`. For more information see below:
https://docs.nvidia.com/cuda/cuda-driver-api/group__CUDA__TENSOR__MEMORY.html

Depends on D155453

Reviewed By: nicolasvasilache

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

13 months ago[RISCV] Add SDNode patterns for vrol.[vv,vx] and vror.[vv,vx,vi]
Luke Lau [Mon, 17 Jul 2023 11:11:21 +0000 (12:11 +0100)]
[RISCV] Add SDNode patterns for vrol.[vv,vx] and vror.[vv,vx,vi]

These correspond to ROTL/ROTR nodes

Reviewed By: craig.topper

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

13 months ago[mlir][test] Add missing LIT config for `mlir-cpu-config` + emulator
Andrzej Warzynski [Fri, 21 Jul 2023 07:25:12 +0000 (07:25 +0000)]
[mlir][test] Add missing LIT config for `mlir-cpu-config` + emulator

Similarly to when using `lli`, make sure that when using
`mlir-cpu-runner` with an emulator, a full path to `mlir-cpu-runner` is
used. Otherwise `mlir-cpu-runner` won't be found and you will get the
following error:
```
Error while loading mlir-cpu-runner: No such file or directory
```

This patch should fix:
  * https://lab.llvm.org/buildbot/#/builders/179
The breakage was originally introduced in
https://reviews.llvm.org/D155405.

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

13 months ago[mlir] allow region branch spec from parent op to itself
Alex Zinenko [Thu, 20 Jul 2023 12:24:44 +0000 (12:24 +0000)]
[mlir] allow region branch spec from parent op to itself

RegionBranchOpInterface did not allow the operation with regions to
specify itself as successors. Therefore, this implied that the control
is always transferred to a region before being transferred back to the
parent op. Since the region can only transfer the control back to the
parent op from a terminator, this transitively implied that the first
block of any region with a RegionBranchOpInterface is always executed
until the terminator can transfer the control flow back. This is
trivially false for any conditional-like operation that may or may not
execute the region, as well as for loop-like operations that may not
execute the body.

Remove the restriction from the interface description and update the
only transform that relied on it.

See
https://discourse.llvm.org/t/rfc-region-control-flow-interfaces-should-encode-region-not-executed-correctly/72103.

Depends On: https://reviews.llvm.org/D155757

Reviewed By: Mogball, springerm

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

13 months ago[mlir] allow dense dataflow to customize call and region operations
Alex Zinenko [Wed, 19 Jul 2023 21:58:01 +0000 (21:58 +0000)]
[mlir] allow dense dataflow to customize call and region operations

Initial implementations of dense dataflow analyses feature special cases
for operations that have region- or call-based control flow by
leveraging the corresponding interfaces. This is not necessarily
sufficient as these operations may influence the dataflow state by
themselves as well we through the control flow. For example,
`linalg.generic` and similar operations have region-based control flow
and their proper memory effects, so any memory-related analyses such as
last-writer require processing `linalg.generic` directly instead of, or
in addition to, the region-based flow.

Provide hooks to customize the processing of operations with region-
cand call-based contol flow in forward and backward dense dataflow
analysis. These hooks are trigerred when control flow is transferred
between the "main" operation, i.e. the call or the region owner, and
another region. Such an apporach allows the analyses to update the
lattice before and/or after the regions. In the `linalg.generic`
example, the reads from memory are interpreted as happening before the
body region and the writes to memory are interpreted as happening after
the body region. Using these hooks in generic analysis may require
introducing additional interfaces, but for now assume that the specific
analysis have spceial cases for the (rare) operaitons with call- and
region-based control flow that need additional processing.

Reviewed By: Mogball, phisiart

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

13 months ago[RISCV] Remove VPatBinaryExtVL_WV_WX multiclass. NFC
Luke Lau [Thu, 20 Jul 2023 11:59:13 +0000 (12:59 +0100)]
[RISCV] Remove VPatBinaryExtVL_WV_WX multiclass. NFC

It's no longer needed now that the sext/zext patterns have been merged.

Reviewed By: craig.topper

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

13 months ago[RISCV] Add patterns for vnsr[a,l].wx where shift amount has different type than...
Luke Lau [Wed, 19 Jul 2023 13:13:50 +0000 (14:13 +0100)]
[RISCV] Add patterns for vnsr[a,l].wx where shift amount has different type than vector element

We're currently only matching scalar shift amounts where the type is the same
as the vector element type. But because only the bottom log2(2*SEW) bits are
used, only 7 bits will be used at most so we can use any scalar type >= i8.

This patch adds patterns for the case above, as well as for when the shift
amount type is the same as the widened element type and doesn't need extended.

Reviewed By: craig.topper

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

13 months ago[RISCV] Add tests for vnsr[l,a].wx patterns that could be matched
Luke Lau [Wed, 19 Jul 2023 12:18:36 +0000 (13:18 +0100)]
[RISCV] Add tests for vnsr[l,a].wx patterns that could be matched

These patterns of ([l,a]shr v, ([s,z]ext splat)) only pick up the cases where
the scalar has the same type as the vector element. However since only the low
log2(SEW) bits of the scalar are read, we could use any scalar type that has
been extended.

Reviewed By: craig.topper

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

13 months ago[SystemZ] Allow symbols in immediate asm operands
Ilya Leoshkevich [Thu, 20 Jul 2023 08:11:24 +0000 (10:11 +0200)]
[SystemZ] Allow symbols in immediate asm operands

Currently mentioning any symbols in immediate asm operands is not
supported, for example:

    error: invalid operand for instruction
    lghi %r4,foo_end-foo

The immediate problem is that is*Imm() and print*Operand() functions do
not accept MCExprs, but simply relaxing these checks is not enough:
after symbol addresses are computed, range checks need to run against
resolved values.

Add a number of SystemZ::FixupKind members for each kind of immediate
value and process them in SystemZMCAsmBackend::applyFixup(). Only
perform the range checks, do not change anything.

Adjust the tests: move previously failing cases like the one shown
above out of insn-bad.s.

Reviewed By: uweigand

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

13 months ago[mlir] Fix bazel build after b96bd025b35761ae181da7e1796708c46e59f5d5
Alexander Belyaev [Fri, 21 Jul 2023 09:08:44 +0000 (11:08 +0200)]
[mlir] Fix bazel build after b96bd025b35761ae181da7e1796708c46e59f5d5

13 months ago[Clang] Fix constraint checking of non-generic lambdas.
Corentin Jabot [Mon, 3 Jul 2023 17:02:24 +0000 (19:02 +0200)]
[Clang] Fix constraint checking of non-generic lambdas.

A lambda call operator can be a templated entity -
and therefore have constraints while not being a function template

   template<class T> void f() {
     []() requires false { }();
   }

In that case, we would check the constraints of the call operator
which is non-viable. However, we would find a viable candidate:
the conversion operator to function pointer, and use it to
perform a surrogate call.
These constraints were not checked because:
 * We never check the constraints of surrogate functions
 * The lambda conversion operator has non constraints.

From the wording, it is not clear what the intent is but
it seems reasonable to expect the constraints of the lambda conversion
operator to be checked and it is consistent with GCC and MSVC.

This patch also improve the diagnostics for constraint failure
on surrogate calls.

Fixes #63181

Reviewed By: #clang-language-wg, aaron.ballman

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

13 months ago[X86] Expand constant expressions in test (NFC)
Nikita Popov [Fri, 21 Jul 2023 08:39:45 +0000 (10:39 +0200)]
[X86] Expand constant expressions in test (NFC)

13 months ago[mlir][nvgpu] Improve finding module Op to for `mbarrier.create`
Guray Ozen [Fri, 21 Jul 2023 08:36:29 +0000 (10:36 +0200)]
[mlir][nvgpu] Improve finding module Op to for `mbarrier.create`

Current transformation expects module op to be two level higher, however, it is not always the case. This work searches module op in a while loop.

Reviewed By: nicolasvasilache

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

13 months ago[mlir][nvgpu] Add nvgpu.tma.async.load and nvgpu.tma.descriptor
Guray Ozen [Thu, 20 Jul 2023 11:56:11 +0000 (13:56 +0200)]
[mlir][nvgpu] Add nvgpu.tma.async.load and nvgpu.tma.descriptor

This work adds `nvgpu.tma.async.load` Op that requests tma load asyncronusly using mbarrier object.

It also creates nvgpu.tma.descriptor type. The type is supposed be created by `cuTensorMapEncodeTiled` cuda drivers api.

Reviewed By: nicolasvasilache

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

13 months ago[mlir] remove RegionBranchOpInterface from linalg ops
Alex Zinenko [Thu, 20 Jul 2023 13:53:51 +0000 (13:53 +0000)]
[mlir] remove RegionBranchOpInterface from linalg ops

Linalg structure ops do not implement control flow in the way expected
by RegionBranchOpInterface, and the interface implementation isn't
actually used anywhere. The presence of this interface without correct
implementation is confusing for, e.g., dataflow analyses.

Reviewed By: springerm

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

13 months ago[LoopIdiom] Regenerate test checks (NFC)
Nikita Popov [Fri, 21 Jul 2023 08:12:05 +0000 (10:12 +0200)]
[LoopIdiom] Regenerate test checks (NFC)

13 months ago[InstCombine] Regenerate test checks (NFC)
Nikita Popov [Fri, 21 Jul 2023 08:11:35 +0000 (10:11 +0200)]
[InstCombine] Regenerate test checks (NFC)

13 months agoReapply [IR] Mark and constant expressions as undesirable
Nikita Popov [Thu, 20 Jul 2023 12:31:18 +0000 (14:31 +0200)]
Reapply [IR] Mark and constant expressions as undesirable

Reapply after fixing an issue in canonicalizeLogicFirst() exposed
by this change (218f97578b26f7a89f7f8ed0748c31ef0181f80a).

-----

In preparation for removing support for and expressions, mark them
as undesirable. As such, we will no longer implicitly create such
expressions, but they still exist.

13 months ago[bazel] add missing dep for llvm/unittests:frontend_tests
Haojian Wu [Fri, 21 Jul 2023 08:09:44 +0000 (10:09 +0200)]
[bazel] add missing dep for llvm/unittests:frontend_tests

13 months ago[IR] Accept non-Instruction in BinaryOperator::CreateWithCopiedFlags() (NFC)
Nikita Popov [Fri, 21 Jul 2023 07:58:22 +0000 (09:58 +0200)]
[IR] Accept non-Instruction in BinaryOperator::CreateWithCopiedFlags() (NFC)

The underlying copyIRFlags() API accepts arbitrary values and can
work with flags on operators (i.e. instructions or constant
expressions). Remove the arbitrary limitation that the
CreateWithCopiedFlags() API imposes, so we can directly pass through
values matched by PatternMatch, which can be constant expressions.

The attached test case works fine now, but would crash with an
upcoming change to not produce and constant expressions.

13 months ago[AArch64] Basic vector bswap costs
David Green [Fri, 21 Jul 2023 07:48:53 +0000 (08:48 +0100)]
[AArch64] Basic vector bswap costs

This adds some basic vector bswap costs, providing the type is supported.

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

13 months ago[NFC] Remove needless nullchecks.
Sindhu Chittireddy [Wed, 12 Jul 2023 18:01:19 +0000 (11:01 -0700)]
[NFC] Remove needless nullchecks.

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

13 months ago[llvm-exegesis] Guard `__builtin_thread_pointer` behind a configure check
Markus Böck [Fri, 21 Jul 2023 05:43:43 +0000 (07:43 +0200)]
[llvm-exegesis] Guard `__builtin_thread_pointer` behind a configure check

Due to arguably a bug in GCC[0], using `__has_builtin` is not sufficient to check whether `__builtin_thread_pointer` can actually be compiled by GCC. This makes it impossible to compile LLVM with `llvm-exegesis` enabled with e.g. GCC 10 as it does have the builtin, but no implementation for architectures such as x86.

This patch works around this issue by making it a cmake configure check whether the builtin can be compiled and used, rather than relying on the broken preprocessor macro.

[0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96952, demonstration: https://godbolt.org/z/9z5nWM6Ef

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

13 months ago[mlir] Add opt-in default property bytecode read and write implementation
Markus Böck [Fri, 21 Jul 2023 05:40:10 +0000 (07:40 +0200)]
[mlir] Add opt-in default property bytecode read and write implementation

Using properties currently requires at the very least implementing four methods/code snippets:
* `convertToAttribute`
* `convertFromAttribute`
* `writeToMlirBytecode`
* `readFromMlirBytecode`

This makes replacing attributes with properties harder than it has to be: Attributes by default do not require immediately defining custom bytecode encoding.

This patch therefore adds opt-in implementations of `writeToMlirBytecode` and `readFromMlirBytecode` that work with the default implementations of `convertToAttribute` and `convertFromAttribute`. They are provided by `defvar`s in `OpBase.td` and can be used by adding:
```
let writeToMlirBytecode = writeMlirBytecodeWithConvertToAttribute;
let readFromMlirBytecode = readMlirBytecodeUsingConvertFromAttribute;
```
to ones TableGen definition.

While this bytecode encoding is almost certainly not ideal for a given property, it allows more incremental use of properties and getting something sane working before optimizing the bytecode format.

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

13 months ago[gn build] Port c3648f37d0ed
LLVM GN Syncbot [Fri, 21 Jul 2023 05:54:11 +0000 (05:54 +0000)]
[gn build] Port c3648f37d0ed

13 months ago[libc++][hardening] Don't trigger uncategorized assertions in the hardened mode.
varconst [Fri, 21 Jul 2023 05:50:37 +0000 (22:50 -0700)]
[libc++][hardening] Don't trigger uncategorized assertions in the hardened mode.

The hardened mode is intended to only include security-critical,
relatively low-overhead checks that are intended to be usable in
production. By default, assertions are excluded from this mode.

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

13 months ago[libc++][ranges] Implement `ranges::to`.
varconst [Sat, 15 Jul 2023 03:54:38 +0000 (20:54 -0700)]
[libc++][ranges] Implement `ranges::to`.

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

13 months ago[modularize] Stabilize iteration order when processing module maps
Fangrui Song [Fri, 21 Jul 2023 05:44:23 +0000 (22:44 -0700)]
[modularize] Stabilize iteration order when processing module maps

Many diagnostics (e.g., ProblemsDuplicate.modularize,
ProblemsDisplayLists.modularize) are dependent on the iteration order of
StringMap, which is not guaranteed to be deterministic
(https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).
clang::ModuleMap::Modules is a StringMap. For now, sort by name in
modularize.

13 months agoSarif: stabilize artifacts order
Fangrui Song [Fri, 21 Jul 2023 04:37:50 +0000 (21:37 -0700)]
Sarif: stabilize artifacts order

StringMap iteration order is not guaranteed to be deterministic
(https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).

13 months ago[Driver] -fopenmp-targets=: stabilize OrderedOffloadingToolchains value order
Fangrui Song [Fri, 21 Jul 2023 04:17:04 +0000 (21:17 -0700)]
[Driver] -fopenmp-targets=: stabilize OrderedOffloadingToolchains value order

to make actions deterministic.
StringSet iteration order is not guaranteed to be deterministic
(https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).

13 months ago[lldb] Fix -Wreturn-type in RegisterInfos_x86_64_with_base_shared.cpp (NFC)
Jie Fu [Fri, 21 Jul 2023 03:41:28 +0000 (11:41 +0800)]
[lldb] Fix -Wreturn-type in RegisterInfos_x86_64_with_base_shared.cpp (NFC)

/data/llvm-project/lldb/source/Plugins/Process/Utility/RegisterInfos_x86_64_with_base_shared.cpp:319:1: error: non-void function does
not return a value in all control paths [-Werror,-Wreturn-type]
}
^
1 error generated.

13 months ago[RISCV] precommit for removing useless copy from undef subreg
Piyou Chen [Fri, 21 Jul 2023 03:19:02 +0000 (20:19 -0700)]
[RISCV] precommit for removing useless copy from undef subreg

testcase from https://github.com/llvm/llvm-project/issues/63554

Reviewed By: kito-cheng

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

13 months ago[clang] fix for D155342
Nick Desaulniers [Fri, 21 Jul 2023 03:30:37 +0000 (20:30 -0700)]
[clang] fix for D155342

13 months ago[clang][JumpDiagnostics] ignore non-asm goto target scopes
Nick Desaulniers [Fri, 21 Jul 2023 02:58:17 +0000 (19:58 -0700)]
[clang][JumpDiagnostics] ignore non-asm goto target scopes

The current behavior of JumpScopeChecker::VerifyIndirectOrAsmJumps was
to cross validate the scope of every jumping statement (goto, asm goto)
against the scope of every label (even if the label was not even a
possible target of the asm goto).

When we have multiple asm goto's with unique targets, we could trigger
false positive build errors complaining that labels that weren't even in
the asm goto's label list could not be jumped to.  Example:

    error: cannot jump from this asm goto statement to one of its possible targets
    asm goto(""::::foo);
    note: possible target of asm goto statement
    bar:
    ^

Fixes: https://github.com/ClangBuiltLinux/linux/issues/1886

Reviewed By: void, jyu2, rjmccall

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

13 months ago[llvm][utils] Use literal type name for non-template data formatters (NFC)
Dave Lee [Tue, 11 Jul 2023 18:24:31 +0000 (11:24 -0700)]
[llvm][utils] Use literal type name for non-template data formatters (NFC)

These don't need to be regex.

13 months ago[lldb] Delete unused LibcxxOptionalSummaryProvider (NFC)
Dave Lee [Fri, 14 Jul 2023 17:25:24 +0000 (10:25 -0700)]
[lldb] Delete unused LibcxxOptionalSummaryProvider (NFC)

No longer needed following refactoring in D115178.

13 months ago[lldb] Identify Swift-implemented ObjC classes
Dave Lee [Tue, 11 Jul 2023 20:20:49 +0000 (13:20 -0700)]
[lldb] Identify Swift-implemented ObjC classes

Classes implemented in Swift can be exposed to ObjC. For those classes, the ObjC
metadata is incomplete. Specifically, the encoded types of the ivars are incomplete. As
one might expect, the Swift metadata _is_ complete. In such cases, the Swift runtime
should be consulted when determining the dynamic type of a value.

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

13 months ago[BOLT] Improve Linux Kernel ORC reader
Maksim Panchenko [Wed, 19 Jul 2023 23:55:32 +0000 (16:55 -0700)]
[BOLT] Improve Linux Kernel ORC reader

  * Sort ORC entries in the internal table. Older Linux kernels did not
    sort them in the file (only during boot time).
  * Add an option to dump sorted ORC tables (--dump-orc).
  * Associate entries in the internal ORC table with a BinaryFunction
    even when we are not changing the function.
  * If the function doesn't have ORC entry at the start, propagate ORC
    state from a previous entry.

Reviewed By: Amir

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

13 months ago[llvm-profdata] Stabilize iteration order for InstrProfWriter
Fangrui Song [Fri, 21 Jul 2023 01:31:41 +0000 (18:31 -0700)]
[llvm-profdata] Stabilize iteration order for InstrProfWriter

If two functions are inserted to the same bucket, their order in the
serialized profile is dependent on StringMap iteration order, which is
not guaranteed to be deterministic.
(https://llvm.org/docs/ProgrammersManual.html#llvm-adt-stringmap-h).
Use a sort like we do in writeText.

13 months ago[libc++][hardening][NFC] Rename `HardenedMode.rst` to `Hardening.rst`.
Konstantin Varlamov [Fri, 21 Jul 2023 00:41:37 +0000 (17:41 -0700)]
[libc++][hardening][NFC] Rename `HardenedMode.rst` to `Hardening.rst`.

This addresses a comment from https://reviews.llvm.org/D154997.

13 months ago[RISCV] Expand memset.inline test coverage [nfc]
Philip Reames [Thu, 20 Jul 2023 23:46:45 +0000 (16:46 -0700)]
[RISCV] Expand memset.inline test coverage [nfc]

Add coverage for unaligned overlap cases, and for vector stores.

Note that the vector memset here is coming from store combining, not memset lowering.

13 months ago[clang][test] Remove unused variable 'SM' (NFC)
Jie Fu [Thu, 20 Jul 2023 23:59:30 +0000 (07:59 +0800)]
[clang][test] Remove unused variable 'SM' (NFC)

/data/llvm-project/clang/unittests/AST/DeclTest.cpp:153:18: error: unused variable 'SM' [-Werror,-Wunused-variable]
  SourceManager &SM = Ctx.getSourceManager();
                 ^
1 error generated.

13 months agoAMDGPU: Add flag to disable fdiv processing in IR pass
Matt Arsenault [Wed, 19 Jul 2023 12:39:05 +0000 (08:39 -0400)]
AMDGPU: Add flag to disable fdiv processing in IR pass

We kind of have to have multiple implementations of fdiv split between
the two selectors with some pre-processing. Add yet another test to
check for consistency of interpretation of flag combinations. We have
quite a bit of test redundancy here already, but there are so many
possible interesting permutations it's unwieldy to cover every detail
in any one of them. We have a number of overlapping fdiv tests but
it's hard to follow everything going on as it is.

13 months agoAMDGPU: Expand rsq testing to cover contract flag
Matt Arsenault [Mon, 17 Jul 2023 15:11:25 +0000 (11:11 -0400)]
AMDGPU: Expand rsq testing to cover contract flag

The 1.0/sqrt(x) -> rsq(x) fold increases precision and probably needs
a contract flag.

13 months ago[gn build] Port 49b3c3355f9c
LLVM GN Syncbot [Thu, 20 Jul 2023 23:36:14 +0000 (23:36 +0000)]
[gn build] Port 49b3c3355f9c

13 months ago[clang] adds `conceptDecl` as an ASTMatcher
Christopher Di Bella [Thu, 20 Jul 2023 22:31:48 +0000 (22:31 +0000)]
[clang] adds `conceptDecl` as an ASTMatcher

Closes #63934

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

13 months ago[lldb][x86_64] Support fs_base/gs_base register in Linux
Jeffrey Tan [Mon, 17 Jul 2023 23:15:06 +0000 (16:15 -0700)]
[lldb][x86_64] Support fs_base/gs_base register in Linux

Summary:
[lldb][x86_64] This patch adds fs_base/gs_base support for Linux x86_64.

Originally, I plan to split the diff into two parts, one to refactoring lldb_xxx_x86_64 => x86_64::lldb_xxx across code base and the other one for adding fs_base/gs_base, but it turns out to be a non-trivial effort to split and very error prone so I decided to keep a single diff to get feedback.

GDB supports fs_base/gs_base registers while LLDB does not. Since both linux coredump note section and ptrace
supports them it is a missing feature.

For context, this is a required feature to support getting pthread pointer on linux from both live and dump debugging.
See thread below for details:
https://discourse.llvm.org/t/how-to-get-pthread-pointer-from-lldb/70542/2?u=jeffreytan81

Implementation wise, we have initially tried `#ifdef` approach to reuse the code but it is introducing very tricky bugs and proves
hard to maintain. Instead the diff completely separates the registers between x86_64 and x86_64_with_base so that non-linux related
implementations can use x86_64 registers while linux uses x86_64_with_base.
Here are the list of changes done in the patch:
* Registers in lldb-x86-register-enums.h are separated into two: x86_64 and x86_64_with_base
* fs_base/gs_base are added into x86_64_with_base
* All linux files are change to use x86_64::lldb_xxx => x86_64_with_base::lldb_xxx
* Support linux elf-core:
* A new RegisterContextLinuxCore_x86_64 class is added for ThreadElfCore
* RegisterContextLinuxCore_x86_64 overrides and uses its own register set supports fs_base/gs_base
* RegisterInfos_x86_64_with_base/RegisterInfos_x86_64_with_base_shared ared added to provide g_contained_XXX/g_invalidate_XXX and RegInfo related code sharing.
* `RegisterContextPOSIX_x86 ::m_gpr_x86_64` seems to be unused so I removed it.
* `NativeRegisterContextDBReg_x86::GetDR()` is overridden in `NativeRegisterContextLinux_x86_64` to make watchpoint work.

Reviewers:clayborg,labath,jingham,jdoerfert,JDevlieghere,kusmour,GeorgeHuyubo

Subscribers:

Tasks:

Tags:

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

13 months agoAMDGPU: Fold fsub [+-0] into fneg when folding source modifiers
Matt Arsenault [Tue, 18 Jul 2023 21:46:31 +0000 (17:46 -0400)]
AMDGPU: Fold fsub [+-0] into fneg when folding source modifiers

This isn't always folded to fneg for a freestanding fsub depending on
the denormal mode. When matching source modifiers, we're implicitly
canonicalizing the input so we can fold it here.

Doesn't bother handling the VOP3P case since it's only relevant with
DAZ, which nobody really uses with f16.

For f64, tests show an existing bug where DAGCombiner tries to respect
the denormal mode for fsub -0, x, but not after it's lowered to fadd
-0, (fneg x). Either the fold is wrong or we shouldn't restrict the
fsub case based on the denormal mode.

https://reviews.llvm.org/D155652

13 months agoAMDGPU: Regenerate test checks
Matt Arsenault [Thu, 20 Jul 2023 23:11:23 +0000 (19:11 -0400)]
AMDGPU: Regenerate test checks

Mostly a workaround for recent reverts in update_test_checks