platform/upstream/llvm.git
20 months ago[lldb] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 04:11:39 +0000 (20:11 -0800)]
[lldb] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[mlir] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 03:58:32 +0000 (19:58 -0800)]
[mlir] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[llvm] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 03:47:13 +0000 (19:47 -0800)]
[llvm] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[LoongArch] Specify registers used for exception handling
Weining Lu [Mon, 5 Dec 2022 03:42:22 +0000 (11:42 +0800)]
[LoongArch] Specify registers used for exception handling

See definition in backend D134709 and the doc [1] for more detail.

With the benefit of this change, most libcxx and libcxxabi tests pass.

[1]: https://llvm.org/docs/ExceptionHandling.html

Reviewed By: xen0n, wangleiat

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

20 months ago[MCDisassembler] Work around GCC 7 after f4c16c44737caac25bf09ec2d85809820579ae40
Fangrui Song [Mon, 5 Dec 2022 03:34:14 +0000 (03:34 +0000)]
[MCDisassembler] Work around GCC 7 after f4c16c44737caac25bf09ec2d85809820579ae40

The use of union isn't really necessary. So just flatten its fields.

20 months ago[PowerPC][GISel]support for float point and integer convertion
Chen Zheng [Mon, 5 Dec 2022 02:53:59 +0000 (21:53 -0500)]
[PowerPC][GISel]support for float point and integer convertion

Add support for fptosi,fptoui,sitofp,uitofp

For now only handle 64 bit integer to make it does not depend on
any other patches. 32 bit integer needs handling for G_SEXT/G_ZEXT.

Reviewed By: arsenm

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

20 months ago[test][CodeGen] Check noundef for omited return
Vitaly Buka [Sat, 3 Dec 2022 00:54:24 +0000 (16:54 -0800)]
[test][CodeGen] Check noundef for omited return

20 months ago[test][CodeGen] Check noundef for return value
Vitaly Buka [Sat, 3 Dec 2022 00:09:59 +0000 (16:09 -0800)]
[test][CodeGen] Check noundef for return value

20 months ago[NFC][CodeGen] Extract HasStrictReturn
Vitaly Buka [Fri, 2 Dec 2022 23:22:29 +0000 (15:22 -0800)]
[NFC][CodeGen] Extract HasStrictReturn

20 months ago[NFC][CodeGen] Add const to a method
Vitaly Buka [Fri, 2 Dec 2022 22:59:13 +0000 (14:59 -0800)]
[NFC][CodeGen] Add const to a method

20 months ago[flang] Diagnostic for shape argument in c_f_pointer
Qihan Cai [Sat, 26 Nov 2022 10:46:29 +0000 (21:46 +1100)]
[flang] Diagnostic for shape argument in c_f_pointer

Fix #59177, add check for dimensionality for shape argument against rank of FPTR argument in c_f_pointer

Reviewed By: peixin

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

20 months ago[RISCV] Use findFirstSet instead of countTrailingZeros. NFC
Craig Topper [Mon, 5 Dec 2022 02:00:36 +0000 (18:00 -0800)]
[RISCV] Use findFirstSet instead of countTrailingZeros. NFC

findFirstSet is a wrapper around countTrailingZeros so they are
equivalent here, but I think findFirstSet more cleary describes
the algorithm here.

20 months ago[RISCV] Use emplace_back to shorten lines in RISCVMatInt. NFC
Craig Topper [Mon, 5 Dec 2022 02:00:27 +0000 (18:00 -0800)]
[RISCV] Use emplace_back to shorten lines in RISCVMatInt. NFC

A few other minor improvements.

20 months ago[PowerPC] don't check CTR clobber in hardware loop insertion pass
Chen Zheng [Fri, 2 Dec 2022 05:39:39 +0000 (00:39 -0500)]
[PowerPC] don't check CTR clobber in hardware loop insertion pass

We added a new post-isel CTRLoop pass in D122125. That pass will expand
the hardware loop related intrinsic to CTR loop or normal loop based
on the loop context. So we don't need to conservatively check the CTR
clobber now on the IR level.

Reviewed By: lkail

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

20 months ago[clang-tools-extra] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 01:40:28 +0000 (17:40 -0800)]
[clang-tools-extra] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[llvm] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 01:31:16 +0000 (17:31 -0800)]
[llvm] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[mlir] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 01:23:50 +0000 (17:23 -0800)]
[mlir] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[llvm] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 01:12:44 +0000 (17:12 -0800)]
[llvm] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[flang] Don't propagate PRIVATE into submodule module files
Peter Klausler [Thu, 17 Nov 2022 21:34:40 +0000 (13:34 -0800)]
[flang] Don't propagate PRIVATE into submodule module files

Module files for submodules should not contain PRIVATE attributes,
since everything in them is local to the parent module and
accessible to all descendant submodules.

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

20 months ago[lldb/unittests] Use std::nullopt instead of None (NFC)
Kazu Hirata [Mon, 5 Dec 2022 00:51:27 +0000 (16:51 -0800)]
[lldb/unittests] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[lldb] Use std::nullopt instead of None (NFC)
Kazu Hirata [Mon, 5 Dec 2022 00:51:25 +0000 (16:51 -0800)]
[lldb] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[gn build] Port 122efef8ee9b
LLVM GN Syncbot [Mon, 5 Dec 2022 00:11:52 +0000 (00:11 +0000)]
[gn build] Port 122efef8ee9b

20 months ago[DebugInfo] llvm::Optional => std::optional
Fangrui Song [Mon, 5 Dec 2022 00:09:22 +0000 (00:09 +0000)]
[DebugInfo] llvm::Optional => std::optional

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

20 months ago[clang] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Sun, 4 Dec 2022 23:57:24 +0000 (15:57 -0800)]
[clang] Use std::nullopt instead of None in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months agoRevert "Reapply "[CodeGen] Add new pass for late cleanup of redundant definitions.""
Jonas Paulsson [Sun, 4 Dec 2022 23:52:00 +0000 (00:52 +0100)]
Revert "Reapply "[CodeGen] Add new pass for late cleanup of redundant definitions.""

This reverts commit 17db0de330f943833296ae72e26fa988bba39cb3.

Some more bots got broken - need to investigate.

20 months ago[flang] Check restrictions on TRANSFER()
Peter Klausler [Thu, 17 Nov 2022 01:10:05 +0000 (17:10 -0800)]
[flang] Check restrictions on TRANSFER()

Enforce detectable compilation-time violations of restrictions on the
arguments to the TRANSFER() intrinsic function (16.9.163) with
error messages, and mark other potential problems with warnings.

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

20 months ago[SanitizerBinaryMetadata] Use weak __start_/__stop_ instead of dummy empty section
Fangrui Song [Sun, 4 Dec 2022 23:06:34 +0000 (15:06 -0800)]
[SanitizerBinaryMetadata] Use weak __start_/__stop_ instead of dummy empty section

D130887 uses a dummy empty section `sanmd_covered` (with the SHF_GNU_RETAIN flag on
ELF) to prevent `undefined symbol: __start_sanmd_covered` if all `sanmd_covered`
are discarded by `ld --gc-sections` (in `-z start-stop-gc` mode).

The dummy `sanmd_covered` does not have the SHF_LINK_ORDER flag, so mixing it
with SHF_LINK_ORDER `sanmd_covered` causes an issue to GNU ld<2.36
(https://sourceware.org/bugzilla/show_bug.cgi?id=26256).

Similar to D98903 for SanitizerCoverage, let's make encapsulation symbols
undefined weak[1]. This additionally avoids size cost due to the dummy section and
symbol.

[1]: https://maskray.me/blog/2021-01-31-metadata-sections-comdat-and-shf-link-order

Reviewed By: melver

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

20 months ago[IR] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 23:05:22 +0000 (15:05 -0800)]
[IR] Use std::nullopt instead of None (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[VPlan] Support sinking VPScalarIVStepsRecipe.
Florian Hahn [Sun, 4 Dec 2022 22:59:16 +0000 (22:59 +0000)]
[VPlan] Support sinking VPScalarIVStepsRecipe.

This patch extends VP-based sinking to also sink VPScalarStepsRecipe.
This takes us a step closer towards retiring the IR based sinking.

The main change is extending VPScalarIVStepsRecipe::execute to support
executing in a replicate-region.

Depends on D133758.

Reviewed By: Ayal

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

20 months ago[Target] llvm::Optional => std::optional
Fangrui Song [Sun, 4 Dec 2022 22:43:14 +0000 (22:43 +0000)]
[Target] llvm::Optional => std::optional

The updated functions are mostly internal with a few exceptions (virtual functions in
TargetInstrInfo.h, TargetRegisterInfo.h).
To minimize changes to LLVMCodeGen, GlobalISel files are skipped.

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

20 months ago[flang] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 22:40:10 +0000 (14:40 -0800)]
[flang] Use std::nullopt instead of None (NFC)

I've verified that every single instance of std::nullopt in this patch
affects generated files and would reduce the number of warnings if
None were deprecated.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[mlir] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 22:40:08 +0000 (14:40 -0800)]
[mlir] Use std::nullopt instead of None (NFC)

I've verified that every single instance of std::nullopt in this patch
affects generated files and would reduce the number of warnings if
None were deprecated.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[flang] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 21:52:47 +0000 (13:52 -0800)]
[flang] Use std::nullopt instead of None (NFC)

I've verified that every change in this patch affects generated files
and would reduce the number of warnings if None were deprecated.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[mlir] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 21:52:45 +0000 (13:52 -0800)]
[mlir] Use std::nullopt instead of None (NFC)

I've verified that every change in this patch affects generated files
and would reduce the number of warnings if None were deprecated.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[clang] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 21:52:44 +0000 (13:52 -0800)]
[clang] Use std::nullopt instead of None (NFC)

I've verified that every change in this patch affects generated files
and would reduce the number of warnings if None were deprecated.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[llvm] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 21:52:42 +0000 (13:52 -0800)]
[llvm] Use std::nullopt instead of None (NFC)

I've verified that every change in this patch affects generated files
and would reduce the number of warnings if None were deprecated.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[MC] llvm::Optional => std::optional
Fangrui Song [Sun, 4 Dec 2022 21:36:08 +0000 (21:36 +0000)]
[MC] llvm::Optional => std::optional

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

20 months ago[flang] Fix pgoOpt
Fangrui Song [Sun, 4 Dec 2022 21:29:00 +0000 (21:29 +0000)]
[flang] Fix pgoOpt

20 months ago[flang] Emit errors and warnings about DIM= arguments to intrinsic functions
Peter Klausler [Wed, 16 Nov 2022 21:48:45 +0000 (13:48 -0800)]
[flang] Emit errors and warnings about DIM= arguments to intrinsic functions

The semantics of many transformational intrinsic functions, especially
reductions like SUM(), are determined by the static presence or absence
of a DIM= argument.  In the case of an actual DIM= argument that is
syntactically present but could be dynamically absent at execution time
(due to being OPTIONAL, POINTER, or ALLOCATABLE), f18 should emit some
kind of diagnostic message.

Other compilers either ignore this possibility or treat it as a hard
error; neither really seems correct, so let's do something more nuanced.

For cases where the dynamic absence of a value for DIM doesn't pose
as much of a risk because it lowering is going to assume that it's
equal to 1 anyway, emit only a portability warning.

For other cases where the generated code or runtime support library
will need the value of DIM= during execution, emit a warning that
the use of an OPTIONAL/POINTER/ALLOCATABLE variable or component
here is dicey and should be reconsidered.

While here, also catch bad constant DIM= values.

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

20 months ago[Passes] llvm::Optional => std::optional
Fangrui Song [Sun, 4 Dec 2022 20:44:52 +0000 (20:44 +0000)]
[Passes] llvm::Optional => std::optional

20 months agoInstructions: convert Optional to std::optional
Krzysztof Parzyszek [Sat, 3 Dec 2022 21:26:59 +0000 (15:26 -0600)]
Instructions: convert Optional to std::optional

20 months ago[clang-format] Link the braces of a block in UnwrappedLineParser
Owen Pan [Sat, 3 Dec 2022 15:16:32 +0000 (07:16 -0800)]
[clang-format] Link the braces of a block in UnwrappedLineParser

This includes TT_MacroBlockBegin and TT_MacroBlockEnd as well.

We can no longer use MatchingParen of FormatToken as an indicator
to mark optional braces. Instead, we directly set Optional of an
l_brace first and reset it later if it turns out that the braces
are not optional.

Also added a test case for deeply nested loops.

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

20 months ago[ELF][test] Clean up aarch64-variant_pcs.s
Fangrui Song [Sun, 4 Dec 2022 19:52:11 +0000 (11:52 -0800)]
[ELF][test] Clean up aarch64-variant_pcs.s

20 months agoUndo a bit of fcf4e360ba6b that confuses MSVC
Benjamin Kramer [Sun, 4 Dec 2022 19:33:25 +0000 (20:33 +0100)]
Undo a bit of fcf4e360ba6b that confuses MSVC

clang\lib\Serialization\GlobalModuleIndex.cpp(818): error C2440: 'initializing': cannot convert from 'const ValueTy' to '_Ty2 &&'
        with
        [
            ValueTy=llvm::SmallVector<unsigned int,2>
        ]
        and
        [
            _Ty2=llvm::SmallVector<unsigned int,2>
        ]

20 months ago[test] Fix CodeGen/M68k/pipeline.ll after D123394 MachineLateInstrsCleanupPass
Fangrui Song [Sun, 4 Dec 2022 19:08:37 +0000 (19:08 +0000)]
[test] Fix CodeGen/M68k/pipeline.ll after D123394 MachineLateInstrsCleanupPass

20 months agoIR: HotnessThreshold llvm::Optional => std::optional
Fangrui Song [Sun, 4 Dec 2022 19:06:47 +0000 (19:06 +0000)]
IR: HotnessThreshold llvm::Optional => std::optional

20 months ago[BOLT] Fix after DebugInfoMetadata change 0ca43d44888885d6caf7636db91fe810e822263c
Fangrui Song [Sun, 4 Dec 2022 18:57:52 +0000 (18:57 +0000)]
[BOLT] Fix after DebugInfoMetadata change 0ca43d44888885d6caf7636db91fe810e822263c

20 months ago[flang] Check constraint C834 on INTENT(OUT) assumed-size dummy arrays
Peter Klausler [Tue, 15 Nov 2022 20:14:51 +0000 (12:14 -0800)]
[flang] Check constraint C834 on INTENT(OUT) assumed-size dummy arrays

An assumed-size dummy array argument with INTENT(OUT) can't have a type
that might require any runtime (re)initialization, since the size of the
array is not known.

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

20 months ago[NFC][SimplifyCFG] Add some tests with PHI's for fold-branch-to-common-dest xform
Roman Lebedev [Sun, 4 Dec 2022 15:51:57 +0000 (18:51 +0300)]
[NFC][SimplifyCFG] Add some tests with PHI's for fold-branch-to-common-dest xform

20 months ago[NFC] Re-autogenerate checklines in a few tests being affected
Roman Lebedev [Sun, 4 Dec 2022 17:50:26 +0000 (20:50 +0300)]
[NFC] Re-autogenerate checklines in a few tests being affected

20 months ago[NFC][SimplifyCFG] `shouldFoldCondBranchesToCommonDestination()`: report the common...
Roman Lebedev [Sun, 4 Dec 2022 16:29:16 +0000 (19:29 +0300)]
[NFC][SimplifyCFG] `shouldFoldCondBranchesToCommonDestination()`: report the common succ

20 months agoDebugInfoMetadata: convert Optional to std::optional
Krzysztof Parzyszek [Sat, 3 Dec 2022 22:01:15 +0000 (16:01 -0600)]
DebugInfoMetadata: convert Optional to std::optional

20 months agoIterate over StringMaps using structured bindings. NFCI.
Benjamin Kramer [Sun, 4 Dec 2022 17:36:41 +0000 (18:36 +0100)]
Iterate over StringMaps using structured bindings. NFCI.

20 months ago[ADT] Enable structured bindings for iterating StringMap
Benjamin Kramer [Sun, 4 Dec 2022 16:30:33 +0000 (17:30 +0100)]
[ADT] Enable structured bindings for iterating StringMap

const references only for now, we can add overloads to have a mutable or
movable `second` if the need arises.

20 months agoCompress a few pairs using PointerIntPairs
Benjamin Kramer [Sun, 4 Dec 2022 15:15:39 +0000 (16:15 +0100)]
Compress a few pairs using PointerIntPairs

Use the uniform structured bindings interface where possible. NFCI.

20 months agoDebugInfo: convert Optional to std::optional
Krzysztof Parzyszek [Sat, 3 Dec 2022 21:55:23 +0000 (15:55 -0600)]
DebugInfo: convert Optional to std::optional

20 months ago[ADT] Allow structured bindings on PointerIntPair
Benjamin Kramer [Sun, 4 Dec 2022 15:10:00 +0000 (16:10 +0100)]
[ADT] Allow structured bindings on PointerIntPair

Apart from simplifying code, this has the advantage of making the
interface between std::pair and PointerIntPair more uniform.

20 months ago[NFC][clang] Strengthen checks in avx512fp16-builtins.c
John McIver [Sun, 4 Dec 2022 14:57:34 +0000 (14:57 +0000)]
[NFC][clang] Strengthen checks in avx512fp16-builtins.c

* Add end-of-line check to load instructions

20 months ago[NFC][clang] Strengthen checks in avx512f-builtins.c
John McIver [Sun, 4 Dec 2022 14:55:03 +0000 (14:55 +0000)]
[NFC][clang] Strengthen checks in avx512f-builtins.c

* Add check to unnamed portion of nontemporal attribute
* Add end-of-line check to load instructions

20 months ago[VPlan] Mark VPScalarIVStepsRecipe as not reading/writing memory.
Florian Hahn [Sun, 4 Dec 2022 12:58:46 +0000 (12:58 +0000)]
[VPlan] Mark VPScalarIVStepsRecipe as not reading/writing memory.

The recipe only computes the inductions steps using its operands. It
does neither read nor write memory.

Split of from D133760.

20 months ago[VPlan] Add sideeffect/memory unit test for VPScalarIVStepsRecipe. (NFC)
Florian Hahn [Sun, 4 Dec 2022 12:50:09 +0000 (12:50 +0000)]
[VPlan] Add sideeffect/memory unit test for VPScalarIVStepsRecipe. (NFC)

20 months ago[OpenMP][libomptarget] Add hasQueue() function in NextGen plugin's AsyncInfoWrapperTy
Kevin Sala [Sun, 4 Dec 2022 00:40:39 +0000 (01:40 +0100)]
[OpenMP][libomptarget] Add hasQueue() function in NextGen plugin's AsyncInfoWrapperTy

This patch prepares the PluginInterface for the new AMDGPU NextGen plugin.

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

20 months ago[LV] Update test to use use variables in CHECK lines.
Florian Hahn [Sun, 4 Dec 2022 11:59:00 +0000 (11:59 +0000)]
[LV] Update test to use use variables in CHECK lines.

This makes the test more robust with respect to value numbering which
will change with future changes.

20 months ago[mlir][affine] Support affine.parallel in the index set analysis
Kai Sasaki [Sun, 4 Dec 2022 11:09:01 +0000 (20:09 +0900)]
[mlir][affine] Support affine.parallel in the index set analysis

Support affine.parallel in the index set analysis. It allows us to do dependence analysis containing affine.parallel in addition to affine.for and affine.if. This change only supports the constant lower/upper bound in affine.parallel. Other complicated affine map bounds will be supported in further commits.

See https://github.com/llvm/llvm-project/issues/57327

Reviewed By: bondhugula

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

20 months agoRevert "[AArch64] Make ArchInfo copyable again"
Tomas Matheson [Sun, 4 Dec 2022 11:00:01 +0000 (11:00 +0000)]
Revert "[AArch64] Make ArchInfo copyable again"

This reverts commit 6272f87ba06132a1b479068759d72178e5fe4472.

20 months ago[DWARFLinker][NFC] Change interface of DWARFLinker to specify accel table kinds expli...
Alexey Lapshin [Sun, 20 Nov 2022 19:03:51 +0000 (20:03 +0100)]
[DWARFLinker][NFC] Change interface of DWARFLinker to specify accel table kinds explicitly.

Currently, DWARFLinker receives kind of accel tables as predefined sets:

```
  Apple,   ///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.
  Dwarf,   ///< DWARF v5 .debug_names.
  Default, ///< Dwarf for DWARF5 or later, Apple otherwise.
  Pub,     ///< .debug_pubnames, .debug_pubtypes
```

This patch removes implicit sets of tables(Default, Dwarf) and allows to ask for several sets:

```
  Apple,     ///< .apple_names, .apple_namespaces, .apple_types, .apple_objc.
  Pub,       ///< .debug_pubnames, .debug_pubtypes
  DebugNames ///< .debug_names.
```

It allows seamlessness adding more accel tables in the future: .gdb_index, .debug_cu_index...
Doing things that way, DWARFLinker will be independent of consumers' requirements.
f.e. dsymutil and llvm-dwarfutil may have different variants for Default set
(so, instead of implementing these differencies inside DWARFLinker it could be
implemented in the corresponding module).

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

20 months ago[Object] llvm::Optional => std::optional
Fangrui Song [Sun, 4 Dec 2022 09:11:11 +0000 (09:11 +0000)]
[Object] llvm::Optional => std::optional

20 months agoCorrect typo introduced in f607884a04b0ca06951227a01d00bc59b948d337
serge-sans-paille [Sat, 3 Dec 2022 21:23:44 +0000 (22:23 +0100)]
Correct typo introduced in f607884a04b0ca06951227a01d00bc59b948d337

Fix #59321

20 months ago[flang/unittests] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 03:08:01 +0000 (19:08 -0800)]
[flang/unittests] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[mlir/unittests] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 03:07:59 +0000 (19:07 -0800)]
[mlir/unittests] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[polly] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 02:50:29 +0000 (18:50 -0800)]
[polly] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[mlir] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sun, 4 Dec 2022 02:50:27 +0000 (18:50 -0800)]
[mlir] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[MLIR] Fix typo in `add_mlir_library` docs. NFC.
Joe Loser [Sun, 4 Dec 2022 02:27:37 +0000 (19:27 -0700)]
[MLIR] Fix typo in `add_mlir_library` docs. NFC.

`s/librar/library` in `llvm_add_library`.

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

20 months ago[MLIR] Use `if constexpr` in `StorageUniquer` and `IR/AffineExpr`
Joe Loser [Sun, 4 Dec 2022 01:01:53 +0000 (18:01 -0700)]
[MLIR] Use `if constexpr` in `StorageUniquer` and `IR/AffineExpr`

Querying the type trait is something that can be done at compile time. So,
replace the runtime `if` with `if constexpr`.

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

20 months ago[flang] Warn about local names that are the same as their enclosing program unit
Peter Klausler [Mon, 14 Nov 2022 22:38:03 +0000 (14:38 -0800)]
[flang] Warn about local names that are the same as their enclosing program unit

Modules, submodules, main programs, and BLOCK DATA subprograms have names
that cannot be used within their scope, so we allow those names to be
used for other entities in the scope.  This might not be entirely
conformant with the language standard, so warn about it.

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

20 months ago[flang] More error checking for ASSOCIATED()
Peter Klausler [Mon, 14 Nov 2022 18:29:32 +0000 (10:29 -0800)]
[flang] More error checking for ASSOCIATED()

The TARGET= argument of the ASSOCIATED() intrinsic function must be a valid
pointer assignment statement target.  Ensure that it does not contain a vector
subscript or any coindexing, either of which would imply a data copy into
temporary storage.

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

20 months ago[flang] Emit portability warning for assigned FORMAT use
Peter Klausler [Mon, 14 Nov 2022 17:42:12 +0000 (09:42 -0800)]
[flang] Emit portability warning for assigned FORMAT use

Emit a portability warning about usage of a deprecated feature
when an I/O data transfer statement uses a scalar integer
variable as an assigned format.

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

20 months ago[flang] INTENT(IN) pointer may not be forwarded to INTENT(IN OUT) or (OUT) dummy
Peter Klausler [Mon, 14 Nov 2022 01:08:01 +0000 (17:08 -0800)]
[flang] INTENT(IN) pointer may not be forwarded to INTENT(IN OUT) or (OUT) dummy

19.6.8 forbids using an INTENT(IN) pointer dummy argument in a pointer association
context, and associated such a pointer with a dummy argument of INTENT(IN OUT) or
INTENT(OUT) is a circumstance that needs to be caught as an error.

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

20 months ago[MLIR] Simplify key construction/hashing in StorageUniquer
Joe Loser [Sat, 3 Dec 2022 05:18:24 +0000 (22:18 -0700)]
[MLIR] Simplify key construction/hashing in StorageUniquer

`getKey` and `getHash` use mutually exclusive overloads based on existence of
methods to determine how to compute get the key or hash, respectively.  This is
a bit verbose with `std::enable_if_t`.  Simplify it a bit by using
`if constexpr` directly.  As an added bonus, this is slightly quicker to
compile.

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

20 months ago[flang] Check constraint C1577 for statement functions
Peter Klausler [Thu, 10 Nov 2022 18:24:38 +0000 (10:24 -0800)]
[flang] Check constraint C1577 for statement functions

Check most of the requiremens of constraint C1577 for statement functions.
The restrictions that prevent recursion are hard errors; the others seem
to be benign legacies and are caught as portability warnings.

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

20 months agoRemove a useless temporary of a base class type.
Alexander Kornienko [Sat, 3 Dec 2022 22:58:37 +0000 (23:58 +0100)]
Remove a useless temporary of a base class type.

This was found by clang-tidy bugprone-undelegated-constructor check.
Was there since the very first commit back in 2016.

Reviewed By: clayborg, labath, srhines

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

20 months ago[flang] Don't repeat module procedure interface from ancestor in *.mod file
Peter Klausler [Thu, 1 Dec 2022 19:41:40 +0000 (11:41 -0800)]
[flang] Don't repeat module procedure interface from ancestor in *.mod file

When a submodule defines a module procedure whose interface was declared
in an ancestor (sub)module, don't repeat the definition of that interface
in the submodule's *.mod file output.

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

20 months ago[OpenMP][libomptarget] Simplify resource managers in NextGen plugins
Kevin Sala [Sun, 27 Nov 2022 22:12:41 +0000 (23:12 +0100)]
[OpenMP][libomptarget] Simplify resource managers in NextGen plugins

This patch removes the classes GenericStreamManagerTy and GenericEventManagerTy
from the PluginInterface header.

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

20 months ago[OpenMP][libomptarget] Improve NextGen plugin interface for initialization
Kevin Sala [Wed, 23 Nov 2022 23:24:12 +0000 (00:24 +0100)]
[OpenMP][libomptarget] Improve NextGen plugin interface for initialization

This patch modifies the PluginInterface to define functions for initializing
and deinitializing GenericPluginTy instances instead of using the constructor
and destructor. This way, we can return errors from these functions. Also, it
defines some functions that each plugin should implement for creating
plugin-specific objects.

This patch prepares the PluginInterface for the new AMDGPU NextGen plugin.

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

20 months agoIRBuilder: convert Optional to std::optional
Krzysztof Parzyszek [Sat, 3 Dec 2022 19:11:42 +0000 (13:11 -0600)]
IRBuilder: convert Optional to std::optional

20 months ago[OpenMP][libomptarget] Add minor fixes to NextGen plugins
Kevin Sala [Wed, 23 Nov 2022 22:27:53 +0000 (23:27 +0100)]
[OpenMP][libomptarget] Add minor fixes to NextGen plugins

List of fixes:
  - omptarget_device_environment symbol is not mandatory in device images
  - Do not synchronize in ~AsyncInfoWrapperTy() if the async info's queue is null
  - GenericDeviceResourceRef's create() and destroy() require the device as parameter

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

20 months ago[OpenMP][libomptarget] Allow overriding function that gets ELF symbol info
Kevin Sala [Wed, 23 Nov 2022 21:15:14 +0000 (22:15 +0100)]
[OpenMP][libomptarget] Allow overriding function that gets ELF symbol info

The OpenMP target's NextGen plugins retrieve symbol information in the ELF image
(i.e., address and size) through the ELF section and ELF symbol objects. However,
the images of CUDA programs compute the address differently from the images of
AMDGPU programs:

  - Address for CUDA symbols: image begin + section's offset + symbol's st_value
  - Address for AMDGPU symbols: image + begin + symbol's st_value

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

20 months ago[flang] Take character function length into account when testing compatibility
Peter Klausler [Wed, 9 Nov 2022 22:20:32 +0000 (14:20 -0800)]
[flang] Take character function length into account when testing compatibility

When a character-valued function is passed as an actual argument, and both
the actual function and the dummy argument have explicit result lengths, take them
into account when testing for compatibility.

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

20 months ago[gn build] Port 17db0de330f9
LLVM GN Syncbot [Sat, 3 Dec 2022 20:23:49 +0000 (20:23 +0000)]
[gn build] Port 17db0de330f9

20 months ago[COFF] llvm::Optional => std::optional
Fangrui Song [Sat, 3 Dec 2022 20:23:39 +0000 (20:23 +0000)]
[COFF] llvm::Optional => std::optional

20 months ago[Driver] llvm::Optional => std::optional
Fangrui Song [Sat, 3 Dec 2022 20:17:05 +0000 (20:17 +0000)]
[Driver] llvm::Optional => std::optional

and change a few referenced Basic and llvm/lib/WindowsDriver API

20 months agoReapply "[CodeGen] Add new pass for late cleanup of redundant definitions."
Jonas Paulsson [Thu, 1 Dec 2022 18:33:11 +0000 (19:33 +0100)]
Reapply "[CodeGen] Add new pass for late cleanup of redundant definitions."

Init captures added in processBlock() to avoid capturing structured bindings,
which caused the build problems (with clang).

RISCV has this disabled for now until problems relating to post RA pseudo
expansions are resolved.

20 months ago[flang] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 20:14:21 +0000 (12:14 -0800)]
[flang] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[clang/unittests] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 20:14:19 +0000 (12:14 -0800)]
[clang/unittests] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months agoFPEnv: convert Optional to std::optional
Krzysztof Parzyszek [Sat, 3 Dec 2022 19:54:35 +0000 (13:54 -0600)]
FPEnv: convert Optional to std::optional

20 months ago[clang-tools-extra] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 19:54:50 +0000 (11:54 -0800)]
[clang-tools-extra] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[clang-tidy] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 19:54:48 +0000 (11:54 -0800)]
[clang-tidy] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[clang] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 19:54:46 +0000 (11:54 -0800)]
[clang] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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

20 months ago[Driver] llvm::None => std::nullopt. NFC
Fangrui Song [Sat, 3 Dec 2022 19:43:25 +0000 (19:43 +0000)]
[Driver] llvm::None => std::nullopt. NFC

20 months ago[Basic] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 3 Dec 2022 19:34:27 +0000 (11:34 -0800)]
[Basic] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

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