platform/upstream/llvm.git
22 months ago[clang][dataflow] Remove unused lambda capture
Dani Ferreira Franco Moura [Fri, 16 Dec 2022 14:39:15 +0000 (15:39 +0100)]
[clang][dataflow] Remove unused lambda capture

Reviewed By: krasimir

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

22 months ago[AArch64] RASv2 Assembly Support
Archibald Elliott [Tue, 13 Dec 2022 15:32:54 +0000 (15:32 +0000)]
[AArch64] RASv2 Assembly Support

This feature adds upstream support for FEAT_RASv2 and FEAT_PFAR. Both
are system-register-only, but FEAT_RAS is behind the command-line
extension "+ras", so FEAT_RASv2 is behind "+rasv2".

This patch includes support for ID_AA64MMFR4_EL1. This is an ID system
register so it is not behind any feature flags.

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

22 months ago[libcxx][Test] Fix expected diagnostics for std types with default integral arguments
Michael Buch [Fri, 16 Dec 2022 14:33:51 +0000 (14:33 +0000)]
[libcxx][Test] Fix expected diagnostics for std types with default integral arguments

The `clang::TypePrinter` has recently been changed to suppress
defaulted integral template parameters in D139986.

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

22 months ago[SCEV] Return ArrayRef for SCEV operands() (NFC)
Nikita Popov [Fri, 16 Dec 2022 14:29:47 +0000 (15:29 +0100)]
[SCEV] Return ArrayRef for SCEV operands() (NFC)

Use a consistent type for the operands() methods of different SCEV
types. Also make the API consistent by only providing operands(),
rather than also providin op_begin() and op_end() for some of them.

22 months agoUse range based loop to iterate over OptTable::PrefixesUnion
serge-sans-paille [Fri, 16 Dec 2022 14:10:34 +0000 (15:10 +0100)]
Use range based loop to iterate over OptTable::PrefixesUnion

And sneak in a small storage optimization of OptTable::PrefixChars

22 months ago[clang-format] add config parse test for short lambda
Backl1ght [Fri, 16 Dec 2022 12:53:58 +0000 (20:53 +0800)]
[clang-format] add config parse test for short lambda

Reviewed By: HazardyKnusperkeks, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D140105

22 months ago[SCEV] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 13:14:51 +0000 (14:14 +0100)]
[SCEV] Convert tests to opaque pointers (NFC)

22 months ago[SCEV] Name instructions in test (NFC)
Nikita Popov [Fri, 16 Dec 2022 13:30:40 +0000 (14:30 +0100)]
[SCEV] Name instructions in test (NFC)

22 months ago[libomptarget] Add HSA definitions for memory faults to dynamic_hsa
Joseph Huber [Fri, 16 Dec 2022 13:04:01 +0000 (07:04 -0600)]
[libomptarget] Add HSA definitions for memory faults to dynamic_hsa

Summary:
We use the dynamic HSA file to forward declare needed definitions from
the HSA runtime if not present at build time. These definitions were not
included so using them caused problems on systems without it if used.
Just add them.

22 months ago[SCEV] Convert some tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 12:09:05 +0000 (13:09 +0100)]
[SCEV] Convert some tests to opaque pointers (NFC)

22 months ago[Alignment] Use Align in SectionRef::getAlignment()
Guillaume Chatelet [Thu, 1 Dec 2022 14:50:29 +0000 (14:50 +0000)]
[Alignment] Use Align in SectionRef::getAlignment()

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

22 months ago[flang] Lower procedure ref to user defined elemental procedures (part 1)
Jean Perier [Fri, 16 Dec 2022 11:59:12 +0000 (12:59 +0100)]
[flang] Lower procedure ref to user defined elemental procedures (part 1)

Lower procedure ref to user defined elemental procedure when:
- there are no arguments that may be dynamically optional
- for functions, the result has no length parameters
- the reference can be unordered
- there are not character by value arguments

This uses the recently added hlfir.elemental operation and tools.
The "core" of the argument preparation is shared between elemental
and non elemental calls (genUserCalls is code moved without any
functional changes)

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

22 months ago[LAA] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 11:22:07 +0000 (12:22 +0100)]
[LAA] Convert tests to opaque pointers (NFC)

22 months ago[clang][DebugInfo] Add DW_AT_default_value support for template template parameters
Michael Buch [Fri, 16 Dec 2022 11:22:15 +0000 (11:22 +0000)]
[clang][DebugInfo] Add DW_AT_default_value support for template template parameters

After this patch, in the following snippet:
```
template <typename T> Foo {};

template <template <typename T> class CT = Foo> Bar {};

Bar<> b;
```

The debug-info entry for the `CT` template parameter will have
a `DW_AT_default_value (true)` attached to it.

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

22 months ago[llvm][DebugInfo] Add IsDefault parameter to DIBuilder::createTemplateTemplateParameter
Michael Buch [Fri, 16 Dec 2022 11:26:08 +0000 (11:26 +0000)]
[llvm][DebugInfo] Add IsDefault parameter to DIBuilder::createTemplateTemplateParameter

This is in preparation for Clang to emit `DW_AT_default_value`
for defaulted template template parameters.

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

22 months ago[clang][DebugInfo] Simplify logic to determine DW_AT_default_value for template param...
Michael Buch [Tue, 13 Dec 2022 12:15:09 +0000 (12:15 +0000)]
[clang][DebugInfo] Simplify logic to determine DW_AT_default_value for template parameters

DWARFv5 added support for labelling template parameters with
DW_AT_default_value to indicate whether the particular instantiation
defaulted parameter. The current implementation only supports a limited
set of possible cases. Namely for non-value-dependent integral template
parameters and simple type template parameters.

Useful cases that don't work are:
1. Type template parameters with defaults that are
   themselves templates. E.g.,
```
template<typename T1, typename T2 = Foo<T1>> class C1;
template<typename T = Foo<int>> class C2;
etc.
```
2. Template template parameters

`clang::isSubstitutedDefaultArgument` already implement the required logic
to determine whether a template argument is defaulted. This patch re-uses
this logic for DWARF CodeGen.

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

22 months ago[clang][TypePrinter] Teach isSubstitutedDefaultArgument about integral types
Michael Buch [Tue, 13 Dec 2022 14:30:17 +0000 (14:30 +0000)]
[clang][TypePrinter] Teach isSubstitutedDefaultArgument about integral types

This patch handles default integral non-type template parameters.

After this patch the clang TypePrinter will omit default integral
template arguments when the `PrintingPolicy::SuppressDefaultTemplateArgs`
option is specified and sets us up to be able to re-use
`clang::isSubstitutedDefaultArgument` from the DWARF CodeGen
component.

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

22 months ago[clang][AST][NFC] Expose clang::isSubstitutedDefaultArgument to clang/AST consumers
Michael Buch [Thu, 15 Dec 2022 21:26:33 +0000 (21:26 +0000)]
[clang][AST][NFC] Expose clang::isSubstitutedDefaultArgument to clang/AST consumers

**Summary**
A use-case has come up in DWARF CodeGen where we want to determine
whether a particular template argument matches the default template
parameter declaration.

Re-using this TypePrinter component there allows us to avoid duplicating
most of this code and immediately allows us to cover a wider range
of use-cases than the DWARF CodeGen does today.

22 months ago[LAA] Name instructions in test (NFC)
Nikita Popov [Fri, 16 Dec 2022 11:32:18 +0000 (12:32 +0100)]
[LAA] Name instructions in test (NFC)

And regenerate test checks.

22 months ago[AMDGPU] Generate permlane test checks
Jay Foad [Fri, 16 Dec 2022 10:37:23 +0000 (10:37 +0000)]
[AMDGPU] Generate permlane test checks

22 months ago[ASTContext] Avoid duplicating address space map. NFCI
Alex Richardson [Fri, 16 Dec 2022 11:10:11 +0000 (11:10 +0000)]
[ASTContext] Avoid duplicating address space map. NFCI

ASTContext was holding onto a pointer to the Clang->LLVM address space map
which is stored inside TargetInfo. Instead of doing this, we can forward to
TargetInfo instead. This change will allow us to eventually remove
getTargetAddressSpace() from ASTContext and only have this information in
TargetInfo.

Reviewed By: rjmccall

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

22 months ago[clang] silence unused variable warning
Krasimir Georgiev [Fri, 16 Dec 2022 11:21:21 +0000 (11:21 +0000)]
[clang] silence unused variable warning

No functional changes intended.

22 months ago[clang][dataflow] Remove unused argument in getNullability
Dani Ferreira Franco Moura [Fri, 16 Dec 2022 11:07:56 +0000 (12:07 +0100)]
[clang][dataflow] Remove unused argument in getNullability

This change will allow users to call getNullability() without providing an ASTContext.

Reviewed By: gribozavr2

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

22 months ago[GlobalAA] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 11:20:51 +0000 (12:20 +0100)]
[GlobalAA] Convert tests to opaque pointers (NFC)

22 months ago[LazyCallGraph] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 11:20:01 +0000 (12:20 +0100)]
[LazyCallGraph] Convert tests to opaque pointers (NFC)

22 months ago[ValueTracking] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 11:18:00 +0000 (12:18 +0100)]
[ValueTracking] Convert tests to opaque pointers (NFC)

22 months ago[TBAA] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 11:12:19 +0000 (12:12 +0100)]
[TBAA] Convert tests to opaque pointers (NFC)

22 months ago[LLVM][objcopy] Fix update-section.test on 32 bit platforms
David Spickett [Fri, 16 Dec 2022 11:09:49 +0000 (11:09 +0000)]
[LLVM][objcopy] Fix update-section.test on 32 bit platforms

This used %zu to print a uint64_t type. z is for size_t so on 32 bit
we tried to treat it as a 32 bit number.

Use PRIu64 instead to print as 64 bit everywhere.

22 months ago[MemDep] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 11:11:31 +0000 (12:11 +0100)]
[MemDep] Convert tests to opaque pointers (NFC)

22 months ago[MemDep] Run test through instnamer (NFC)
Nikita Popov [Fri, 16 Dec 2022 11:11:01 +0000 (12:11 +0100)]
[MemDep] Run test through instnamer (NFC)

22 months ago[Lint] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 11:08:39 +0000 (12:08 +0100)]
[Lint] Convert tests to opaque pointers (NFC)

22 months ago[IRSimilarity] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 11:07:56 +0000 (12:07 +0100)]
[IRSimilarity] Convert tests to opaque pointers (NFC)

22 months ago[DependenceAnalysis] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 10:58:04 +0000 (11:58 +0100)]
[DependenceAnalysis] Convert tests to opaque pointers (NFC)

22 months ago[clang][ExtractAPI] Fix naming of typedef'd anonymous enums
Daniel Grumberg [Wed, 14 Dec 2022 12:12:26 +0000 (12:12 +0000)]
[clang][ExtractAPI] Fix naming of typedef'd anonymous enums

Anonymous enums that are typedef'd should take on the name of the typedef.

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

22 months ago[LLVM][objcopy] Update Arm XFAIL in update section test
David Spickett [Fri, 16 Dec 2022 10:57:13 +0000 (10:57 +0000)]
[LLVM][objcopy] Update Arm XFAIL in update section test

a1b4e13cff2a792571927ee1fc6eebb05e40fae9 updated this to use
the target= syntax.

However the triple for our Arm bots is usually like:
armv8l-unknown-linux-gnueabihf

With "eabihf" on the end. I assume before we just checked for
"linux-gnu" being in the triple at all but now it is a proper
regex match.

Add .* on the end to account for the ABI tag on the end.

22 months ago[BasicAA] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 09:56:08 +0000 (10:56 +0100)]
[BasicAA] Convert tests to opaque pointers (NFC)

22 months agoRevert "[OpenMP][libomptarget] Add AMDGPU NextGen plugin with asynchronous behavior"
Kevin Sala [Fri, 16 Dec 2022 10:53:45 +0000 (11:53 +0100)]
Revert "[OpenMP][libomptarget] Add AMDGPU NextGen plugin with asynchronous behavior"

This reverts commit 87e6b96b0009983996bfe0aa27d358008c1d1087.

22 months ago[LoongArch] Add tests showing the optimization pipeline
Weining Lu [Fri, 16 Dec 2022 09:50:17 +0000 (17:50 +0800)]
[LoongArch] Add tests showing the optimization pipeline

Other targets like ARM, AArch64, RISCV and X86 have similar tests.

`O1`, `O2` and `O3` appear to be the same for now. But in future, some
passes may be disabled at lower levels (e.g. `O1`). Hoping we can use
FileCheck prefixes for differences to avoid repeating the contents 3
times.

Reviewed By: xen0n, MaskRay

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

22 months ago[BasicAA] Convert some tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 09:53:30 +0000 (10:53 +0100)]
[BasicAA] Convert some tests to opaque pointers (NFC)

22 months ago[LLDB][LoongArch] Add branch instructions for EmulateInstructionLoongArch
Hui Li [Fri, 16 Dec 2022 09:48:15 +0000 (17:48 +0800)]
[LLDB][LoongArch] Add branch instructions for EmulateInstructionLoongArch

Add conditional and unconditional branch instructions for loongarch64.
Note that this does not include floating-point branch instructions, that will come in a later patch.

Reviewed By: SixWeining, DavidSpickett

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

22 months ago[Delinearization] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 09:35:45 +0000 (10:35 +0100)]
[Delinearization] Convert tests to opaque pointers (NFC)

22 months ago[Clang] Allow additional mathematical symbols in identifiers.
Corentin Jabot [Sun, 30 Oct 2022 22:20:00 +0000 (23:20 +0100)]
[Clang] Allow additional mathematical symbols in identifiers.

Implement the proposed UAX Profile
"Mathematical notation profile for default identifiers".

This implements a not-yet approved Unicode for a vetted
UAX31 identifier profile
https://www.unicode.org/L2/L2022/22230-math-profile.pdf

This change mitigates the reported disruption caused
by the implementation of UAX31 in C++ and C2x,
as these mathematical symbols are commonly used in the
scientific community.

Fixes #54732

Reviewed By: tahonermann, #clang-language-wg

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

22 months ago[RISCV] Pull out repeated calls to getOperand. NFC
Craig Topper [Fri, 16 Dec 2022 08:49:47 +0000 (00:49 -0800)]
[RISCV] Pull out repeated calls to getOperand. NFC

Remove else after return.

22 months ago[Support] llvm::Optional => std::optional
Fangrui Song [Fri, 16 Dec 2022 08:49:10 +0000 (08:49 +0000)]
[Support] llvm::Optional => std::optional

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

22 months ago[flang] hlfir.apply codegen
Jean Perier [Fri, 16 Dec 2022 08:24:55 +0000 (09:24 +0100)]
[flang] hlfir.apply codegen

Lower hlfir.apply to hlfir.designate in bufferization.

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

22 months ago[flang] enable as_expr codegen from array without FortranVariabeInterface
Jean Perier [Fri, 16 Dec 2022 08:20:47 +0000 (09:20 +0100)]
[flang] enable as_expr codegen from array without FortranVariabeInterface

The defining op of HLFIR variables is expected to be visible
in most cases, but HLFIR codegen won't rely on it from a correctness
point of view.

This patch allows building a fir.shape from an hlfir::Entity does not
have a visible FortranVariabeInterface defining op.

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

22 months ago[flang] hlfir.elemental codegen
Jean Perier [Fri, 16 Dec 2022 08:19:07 +0000 (09:19 +0100)]
[flang] hlfir.elemental codegen

Without any optimization or when it cannot be optimized before
bufferization, an hlfir.elemental lowers to an array temporary.
Its codegen consists in:
- allocating a temp given the type, shape, and length parameter arguments.
- generating a loop nest given the elemental shape
- inlining the body of the elemental inside the loops, and replacing the
  yield_element by an assignment to an element of the temp.

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

22 months ago[trace] Change /sys/bus const char * variables to const char []
Fangrui Song [Fri, 16 Dec 2022 08:07:07 +0000 (08:07 +0000)]
[trace] Change /sys/bus const char * variables to const char []

22 months agoJSON: llvm::Optional => std::optional
Fangrui Song [Fri, 16 Dec 2022 07:56:52 +0000 (07:56 +0000)]
JSON: llvm::Optional => std::optional

Many files are from language servers.

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

22 months ago[gn] Port 344230913812cec3b4509c0216cefce06f69dd4d
Fangrui Song [Fri, 16 Dec 2022 07:40:23 +0000 (07:40 +0000)]
[gn] Port 344230913812cec3b4509c0216cefce06f69dd4d

22 months ago[SelectionDAG] Port ARC/M68k/LoongArch after D140161
Fangrui Song [Fri, 16 Dec 2022 07:34:42 +0000 (07:34 +0000)]
[SelectionDAG] Port ARC/M68k/LoongArch after D140161

22 months ago[mlir][llvm] Fastmath flags import from LLVM IR.
Tobias Gysi [Fri, 16 Dec 2022 07:05:34 +0000 (08:05 +0100)]
[mlir][llvm] Fastmath flags import from LLVM IR.

This revision adds support to import fastmath flags from LLVMIR. It
implement the import using a listener attached to the builder. The
listener gets notified if an operation is created and then checks if
there are fastmath flags to import from LLVM IR to the MLIR. The
listener based approach allows us to perform the import without changing
the mlirBuilders used to create the imported operations.

An alternative solution, could be to update the builders so that they
return the created operation using FailureOr<Operation*> instead of
LogicalResult. However, this solution implies an LLVM IR instruction
always maps to exatly one MLIR operation. While mostly true, there are
already exceptions to this such as the PHI instruciton. Additionally, an
mlirBuilder based solution also further complicates the builder
implementations, which led to the listener based solution.

Depends on D139405

Reviewed By: ftynse

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

22 months ago[clang-tidy] Use Python3 for add_new_check.py and rename_check.py
Carlos Galvez [Tue, 13 Dec 2022 21:06:14 +0000 (21:06 +0000)]
[clang-tidy] Use Python3 for add_new_check.py and rename_check.py

Fixes #58782

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

22 months ago[clang/Lexer] Enhance `Lexer::getImmediateMacroNameForDiagnostics` to return a result...
Argyrios Kyrtzidis [Thu, 15 Dec 2022 21:33:17 +0000 (13:33 -0800)]
[clang/Lexer] Enhance `Lexer::getImmediateMacroNameForDiagnostics` to return a result from non-file buffers

Use `SourceManager::isWrittenInScratchSpace()` to specifically check for token paste or stringization, instead of
excluding all non-file buffers. This allows diagnostics to mention macro names that were defined from the command-line.

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

22 months ago[RISCV] Emit .variant_cc directives for vector function calls.
Yeting Kuo [Tue, 6 Dec 2022 12:12:11 +0000 (20:12 +0800)]
[RISCV] Emit .variant_cc directives for vector function calls.

The patch is splitted from D103435. The patch emits .variant_cc [0] for those
function calls that have vector arguments or vector return values.

[0]: https://github.com/riscv/riscv-elf-psabi-doc/pull/190

Initial authored by: HsiangKai

Reviewed By: reames

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

22 months ago[docs] Update docs since getBasicBlockList() is now private
Vasileios Porpodas [Wed, 14 Dec 2022 23:44:55 +0000 (15:44 -0800)]
[docs] Update docs since getBasicBlockList() is now private

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

22 months ago[NFC] Cleanup: Function::getBasicBlockList() and Function::getSublistAccess() are...
Vasileios Porpodas [Wed, 14 Dec 2022 00:02:50 +0000 (16:02 -0800)]
[NFC] Cleanup: Function::getBasicBlockList() and Function::getSublistAccess() are now private

The Function class now supports an adequate set of member functions to help
modify the BB list, including Function::splice(), Function::erase(),
Function::insert() etc. so we no longer need access to the underlying list.

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

22 months ago[AA] Allow for flow-sensitive analyses.
David Goldblatt [Fri, 16 Dec 2022 03:33:10 +0000 (19:33 -0800)]
[AA] Allow for flow-sensitive analyses.

All current analyses ignore the context. We make the argument mandatory
for analyses, but optional for the query interface.

Reviewed By: nikic

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

22 months ago[lld-macho] Don't rewrite -rpath arguments in response file
Jez Ng [Fri, 16 Dec 2022 04:52:42 +0000 (23:52 -0500)]
[lld-macho] Don't rewrite -rpath arguments in response file

We only want to rewrite paths to files that the linker looks up. Files
under RPATH are looked up at runtime by dyld.

Reviewed By: #lld-macho, keith

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

22 months ago[Format] Capture `FormatStyle` by value to avoid use-after-free.
Jordan Rupprecht [Fri, 16 Dec 2022 04:38:32 +0000 (20:38 -0800)]
[Format] Capture `FormatStyle` by value to avoid use-after-free.

Fixes the test failure in 240e29c5015d246de7fb5e4421aa93042fada59b, reported on the D140058 review thread.

22 months ago[clang-format][NFC] Turn on some code-changing options one by one
Owen Pan [Wed, 14 Dec 2022 21:54:44 +0000 (13:54 -0800)]
[clang-format][NFC] Turn on some code-changing options one by one

For the code-changing options InsertBraces, RemoveBracesLLVM, and
RemoveSemicolon, turn the option on only when running the token
analyzer pass for it. This improves the run-time and avoids
interference from other options.

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

22 months ago[OpenMP] Add missing test for pinned memory API
Carlo Bertolli [Fri, 16 Dec 2022 03:29:15 +0000 (21:29 -0600)]
[OpenMP] Add missing test for pinned memory API

I accidentally left out the test for the pinned API introduced by D138933. Adding it back.

Reviewed By: jdoerfert

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

22 months ago[AIX][BigArchive][NFC] Add test case that list members of archive with free list...
Kai Luo [Fri, 16 Dec 2022 03:08:34 +0000 (11:08 +0800)]
[AIX][BigArchive][NFC] Add test case that list members of archive with free list in it

The archive is generated via
```
touch foo.c
ar crus libfoo.a foo.c
ar d libfoo.a foo.c
```
Thus it contains free list.

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

22 months agoAMDGPU/GlobalISel: Do not create readfirstlane with non-s32 type
Matt Arsenault [Wed, 19 Jan 2022 21:16:20 +0000 (16:16 -0500)]
AMDGPU/GlobalISel: Do not create readfirstlane with non-s32 type

We should probably handle any 32-bit type here, but the intrinsic
definition and selection pattern currently do not. Avoids a few lit
tests failures when switched on by default.

22 months ago[flang] Enforce 15.4.2.2(4)(c) - explicit interface required
Peter Klausler [Thu, 8 Dec 2022 21:45:57 +0000 (13:45 -0800)]
[flang] Enforce 15.4.2.2(4)(c) - explicit interface required

When a function has an implicit interface its result type may
not have a deferred type parameter.

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

22 months agoRemove the dependency between lib/DebugInfoDWARF and MC.
Shubham Sandeep Rastogi [Thu, 6 Oct 2022 19:15:07 +0000 (12:15 -0700)]
Remove the dependency between lib/DebugInfoDWARF and MC.

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

22 months ago[mlir][sparse] Added new SparseTensorEncodingAttr::withoutOrdering factory
wren romano [Thu, 15 Dec 2022 22:32:58 +0000 (14:32 -0800)]
[mlir][sparse] Added new SparseTensorEncodingAttr::withoutOrdering factory

Reviewed By: aartbik, Peiming

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

22 months ago[NFC][bazel] Update comment in llvm-config.h.cmake so headers match
Jordan Rupprecht [Fri, 16 Dec 2022 01:41:48 +0000 (17:41 -0800)]
[NFC][bazel] Update comment in llvm-config.h.cmake so headers match

22 months ago[flang] Check for polymorphism in DEALLOCATE statements in pure procedures
Peter Klausler [Wed, 7 Dec 2022 23:41:47 +0000 (15:41 -0800)]
[flang] Check for polymorphism in DEALLOCATE statements in pure procedures

Semantic checking for DEALLOCATE statements omitted checks for
polymorphic objects and ultimate allocatable components in a pure
procedure, which if not caught would allow execution of an impure
FINAL subroutine defined on a type extension.

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

22 months ago[mlir][tosa] Make tosa.resize to linalg avoid redundant loads for unit width
Rob Suderman [Fri, 16 Dec 2022 00:07:31 +0000 (16:07 -0800)]
[mlir][tosa] Make tosa.resize to linalg avoid redundant loads for unit width

When using a tosa resize for ?x1x1x? to ?x1x?x? we should avoid doing a 2D
interpolation as only two unique values are loaded. As the extract operation
performance numerical computation on its values the superfluous extracts may
fail to be coalesced. Instead we only interpolate between the values if there
are multiple values to interpolate between.

For the integer case we also perform scaling by the scaling-factor to apply
the same integer scaling behavior as interpolation.

Reviewed By: jpienaar, NatashaKnk

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

22 months agoImplement LWG-3646 std::ranges::view_interface::size returns a signed type
Igor Zhukov [Tue, 13 Dec 2022 00:07:26 +0000 (07:07 +0700)]
Implement LWG-3646 std::ranges::view_interface::size returns a signed type

Reviewed By: Mordante, philnik, #libc

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

22 months ago[mlir][sparse] add dim level type toString convenience method
Aart Bik [Thu, 15 Dec 2022 21:50:20 +0000 (13:50 -0800)]
[mlir][sparse] add dim level type toString convenience method

Reviewed By: wrengr, bixia

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

22 months ago[clang][deps] Implement `dump()` for the VFS
Jan Svoboda [Thu, 15 Dec 2022 23:03:07 +0000 (15:03 -0800)]
[clang][deps] Implement `dump()` for the VFS

22 months ago[mlir][sparse] add folder to sparse_tensor.storage.get operation.
Peiming Liu [Thu, 15 Dec 2022 23:04:17 +0000 (23:04 +0000)]
[mlir][sparse] add folder to sparse_tensor.storage.get operation.

Reviewed By: aartbik, wrengr

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

22 months ago[SelectionDAG] Give all the target specific subclasses of SelectionDAGISel their...
Craig Topper [Thu, 15 Dec 2022 23:32:55 +0000 (15:32 -0800)]
[SelectionDAG] Give all the target specific subclasses of SelectionDAGISel their own pass ID.

Previously we had a shared ID in SelectionDAGISel. AMDGPU has an
initializePass function for its subclass of SelectionDAGISel. No
other target does.

This causes all target specific SelectionDAGISel passes to be known
as "amdgpu-isel".

I'm not sure what would happen if another target tried to implement
an initializePass function too since the ID is already claimed.

This patch gives all targets their own ID and passes it down to
SelectionDAGISel constructor to MachineFunctionPass's constructor.

Unfortunately, I think this causes most targets to lose
print-before/after-all support for their SelectionDAGISel pass.
And they probably no longer support start/stop-before/after. We
can add initializePass functions to fix this as a follow up. NOTE:
This was probably also broken if the AMDGPU target isn't compiled in.

Step 1 to fixing PR59538.

Reviewed By: arsenm

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

22 months agoRevert "[lld-macho] Private label aliases to weak symbols should not retain section...
Jez Ng [Wed, 7 Dec 2022 16:17:51 +0000 (11:17 -0500)]
Revert "[lld-macho] Private label aliases to weak symbols should not retain section data"

This reverts commit 6736bce6db5fe15bcb765b976c99fff34500d1eb.

It's causing Swift-related crashes in e.g.
https://bugs.chromium.org/p/chromium/issues/detail?id=1400716 and
elsewhere.

22 months ago[AMDGPU] Lower VGPR to physical SGPR COPY to S_MOV_B32 if VGPR contains the compile...
Alexander Timofeev [Mon, 12 Dec 2022 20:18:19 +0000 (21:18 +0100)]
[AMDGPU] Lower VGPR to physical SGPR COPY to S_MOV_B32 if VGPR contains the compile time constant

Sometimes we have a constant value loaded to VGPR. In case we further
need to rematrerialize it in the physical scalar register we may avoid VGPR to
SGPR copy replacing it with S_MOV_B32.

Reviewed By: JonChesterfield, arsenm

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

22 months agoReland "Delete sanitizer_common-based ('old') scudo: o7"
Mitch Phillips [Thu, 15 Dec 2022 23:34:18 +0000 (15:34 -0800)]
Reland "Delete sanitizer_common-based ('old') scudo: o7"

This reverts commit 78f786d02a464ae69594ee8f678e4cee495642f5.

Internal use cases have been migrated.

This has been on life support for a long time. Now that -fsanitize=scudo
is scudo_standalone, this can be removed.

Tests are sticking around for now to be reused for scudo_standalone
later on.

22 months ago[OpenMP][libomptarget] Add AMDGPU NextGen plugin with asynchronous behavior
Kevin Sala [Mon, 12 Dec 2022 17:13:48 +0000 (18:13 +0100)]
[OpenMP][libomptarget] Add AMDGPU NextGen plugin with asynchronous behavior

This commit adds the AMDGPU NextGen plugin inheriting from PluginInterface's classes.
It also implements the asynchronous behavior in the plugin operations: kernel launches
and memory transfers. To this end, it implements the concept of streams of asynchronous
operations. The streams are implemented using the HSA signals to define input and output
dependencies between asynchronous operations.

Missing features:
  - Retrieve the maximum number of threads per group that a kernel can run. This requires
    reading the image.
  - Implement __tgt_rtl_sync_event, not used on the libomptarget side.

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

22 months ago[mlir][tensor][linalg] Add a pattern that generalizes tensor.pack op.
Hanhan Wang [Wed, 14 Dec 2022 22:36:37 +0000 (14:36 -0800)]
[mlir][tensor][linalg] Add a pattern that generalizes tensor.pack op.

The pattern generalizes a tensor::PackOp into a sequence of tensor +
Linalg ops, when the outer dims are all 1s. It uses the trick of
rank-reduced tensor.extract_slice to get the tile; transpose the tile;
use tensor.insert_slice to insert it to the destination of inner tile.

Reviewed By: pifon2a, tyb0807

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

22 months ago[flang] When resolving a binding, allow for overriding
Peter Klausler [Thu, 15 Dec 2022 21:56:17 +0000 (13:56 -0800)]
[flang] When resolving a binding, allow for overriding

In type-bound generic resolution, when the actual argument
is monomorphic, resolve the call to the target of the
most recent (i.e., least deeply inherited) override of
the binding, if any.

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

22 months ago[mlir] Convert tests to check 'target=...'
Paul Robinson [Thu, 15 Dec 2022 22:49:20 +0000 (14:49 -0800)]
[mlir] Convert tests to check 'target=...'

Part of the project to eliminate special handling for triples in lit
expressions.

22 months ago[MachOYAML] Improve section offset misalignment error message
Michael Buch [Thu, 15 Dec 2022 17:57:53 +0000 (17:57 +0000)]
[MachOYAML] Improve section offset misalignment error message

Before:
```
wrote too much data somewhere, section offsets don't line up
```

After:
```
wrote too much data somewhere, section offsets in section __debug_str for segment __DWARF don't line up: [cursor=0x581], [fileStart=0x0], [sectionOffset=0x579]
```

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

22 months ago[lldb][Test] Propagate llvm::yaml error message in TestFile::fromYaml
Michael Buch [Thu, 15 Dec 2022 16:26:20 +0000 (16:26 +0000)]
[lldb][Test] Propagate llvm::yaml error message in TestFile::fromYaml

Currently the test-suite would swallow the error message
on `llvm::yaml::convertYAML` failures.

This patch simply propagates the error string up to the caller.

Before patch:
```
[ RUN      ] DWARFASTParserClangTests.TestDefaultTemplateParamParsing
/Users/michaelbuch/Git/llvm-worktrees/playground/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp:19: Failure
Value of: llvm::detail::TakeExpected(File)
Expected: succeeded
  Actual: failed  (convertYAML() failed: )
Assertion failed: (!HasError && "Cannot get value when an error exists!"), function getStorage, file Error.h, line 671.
```

After patch:
```
[ RUN      ] DWARFASTParserClangTests.TestDefaultTemplateParamParsing
/Users/michaelbuch/Git/llvm-worktrees/playground/lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp:19: Failure
Value of: llvm::detail::TakeExpected(File)
Expected: succeeded
  Actual: failed  (convertYAML() failed: wrote too much data somewhere, section offsets don't line up)
Assertion failed: (!HasError && "Cannot get value when an error exists!"), function getStorage, file Error.h, line 671.
```

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

22 months ago[llvm] Convert tests to check 'target=...'
Paul Robinson [Thu, 15 Dec 2022 22:40:14 +0000 (14:40 -0800)]
[llvm] Convert tests to check 'target=...'

Part of the project to eliminate special handling for triples in lit
expressions.

22 months ago[mlgo] Retire LLVM_HAVE_TF_API
Kazu Hirata [Thu, 15 Dec 2022 22:40:16 +0000 (14:40 -0800)]
[mlgo] Retire LLVM_HAVE_TF_API

I've eliminated all uses of LLVM_HAVE_TF_API except a couple of them
being removed in llvm/lib/CodeGen/CMakeLists.txt.  This patch removes
remaining definitions and uses of LLVM_HAVE_TF_API.

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

22 months ago[LoopRotate] Clear block and loop dispo cache when merging blocks.
Florian Hahn [Thu, 15 Dec 2022 22:22:20 +0000 (22:22 +0000)]
[LoopRotate] Clear block and loop dispo cache when merging blocks.

Merging blocks in LoopRotate may remove blocks reference in the block
disposition cache. Clear the cache.

Fixes #59534.

22 months ago[MCJIT] Convert tests to check 'target=...'
Paul Robinson [Thu, 15 Dec 2022 22:08:36 +0000 (14:08 -0800)]
[MCJIT] Convert tests to check 'target=...'

Part of the project to eliminate special handling for triples in lit
expressions.

22 months ago[lld] Convert tests to check 'target=...'
Paul Robinson [Thu, 15 Dec 2022 21:57:50 +0000 (13:57 -0800)]
[lld] Convert tests to check 'target=...'

Part of the project to eliminate special handling for triples in lit
expressions.

22 months ago[mlgo] Use have_tflite instead of have_tf_api
Kazu Hirata [Thu, 15 Dec 2022 21:54:25 +0000 (13:54 -0800)]
[mlgo] Use have_tflite instead of have_tf_api

We are in the process of retiring LLVM_HAVE_TF_API in favor of
LLVM_HAVE_TFLITE.  This patch takes care of the transition in
llvm/test.

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

22 months ago[flang] Correct folding of SAME_TYPE_AS()
Peter Klausler [Mon, 5 Dec 2022 23:26:28 +0000 (15:26 -0800)]
[flang] Correct folding of SAME_TYPE_AS()

The result can't be known to be true at compilation time when
either operand is polymorphic.

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

22 months agoHeaders: tweak inclusion condition for stdatomic.h
Saleem Abdulrasool [Thu, 15 Dec 2022 20:34:04 +0000 (20:34 +0000)]
Headers: tweak inclusion condition for stdatomic.h

MSVC requires that C++23 be available (_HAS_CXX23) else the entire
content is elided. Conditionalise the inclusion properly so that C/C++
code using stdatomic.h for memory_order_* constants are able to do
so without changing the C++ standard. This repairs builds of Swift and
libdispatch after ba49d39b20cc5358da28af2ac82bd336028780bc.

Differential Revision: https://reviews.llvm.org/D139266
Reviewed By: aaron.ballman, Mordante, fsb4000

22 months ago[mailmap] Add my entry
Tommy Chiang [Thu, 15 Dec 2022 21:30:29 +0000 (05:30 +0800)]
[mailmap] Add my entry

22 months ago[PowerPC][GIsel] Materialize i64 constants.
Kai Nacke [Thu, 15 Dec 2022 20:26:32 +0000 (20:26 +0000)]
[PowerPC][GIsel] Materialize i64 constants.

Adds support for i64 constant. It uses the same pattern-based
approach as in SDAG (see PPCISelDAGToDAG::selectI64ImmDirect(),
PPCISelDAGToDAG::selectI64Imm()). It does not support the
prefixed instructions.

Reviewed By: arsenm, tschuett

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

22 months ago[NFC] Cleanup: Remove instances of Function::getBasicBlockList()
Vasileios Porpodas [Thu, 15 Dec 2022 03:07:24 +0000 (19:07 -0800)]
[NFC] Cleanup: Remove instances of Function::getBasicBlockList()

This is part of a series of patches that aim at making Function::getBasicBlockList() private.

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

22 months ago[libc] Handle allocation failures in the dirent API gracefully.
Siva Chandra Reddy [Wed, 14 Dec 2022 22:37:28 +0000 (22:37 +0000)]
[libc] Handle allocation failures in the dirent API gracefully.

Along the way, setting of errno has been moved out of the internal code.

Reviewed By: lntue

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

22 months ago[libc] fix shifting exact multiples of 64 in uint
Michael Jones [Thu, 15 Dec 2022 00:51:23 +0000 (16:51 -0800)]
[libc] fix shifting exact multiples of 64 in uint

The internal uint class had a bug introduced recently when optimizing
the shift routines. When calculating the value of a block, it would
shift an adjacent block by 64 - the shift amount. If the shift amount
was 0, this would be a shift of 64, which is undefined for a 64 bit
integer. This patch fixes this by adding a conditional to catch this
case.

Reviewed By: lntue

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

22 months ago[WindowsDriver] Improve VSInstallPath check for IDE subdirectory
Dimitry Andric [Thu, 15 Dec 2022 20:38:07 +0000 (21:38 +0100)]
[WindowsDriver] Improve VSInstallPath check for IDE subdirectory

This avoids potential memory allocation failures, if VSInstallPath is
not empty, but also does not contain the string "\Common7\IDE".

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

Reviewed By: mstorsjo

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

22 months agoRevert "[WindowsDriver] Improve VSInstallPath check for IDE subdirectory"
Dimitry Andric [Thu, 15 Dec 2022 20:36:32 +0000 (21:36 +0100)]
Revert "[WindowsDriver]  Improve VSInstallPath check for IDE subdirectory"

This reverts commit cc40dacbd0b736522d0254fb5525cde22bd5f166.

22 months ago[WindowsDriver] Improve VSInstallPath check for IDE subdirectory
Dimitry Andric [Sun, 11 Dec 2022 18:18:21 +0000 (19:18 +0100)]
[WindowsDriver]  Improve VSInstallPath check for IDE subdirectory

This avoids potential memory allocation failures, if VSInstallPath is
not empty, but also does not contain the string "\Common7\IDE".

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

Reviewed By: mstorsjo

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