platform/upstream/llvm.git
23 months ago[flang][NFC] Remove implemented TODOs
Valentin Clement [Mon, 5 Dec 2022 09:32:08 +0000 (10:32 +0100)]
[flang][NFC] Remove implemented TODOs

23 months ago[Test] Add 2 more simplified test with missing opts
Max Kazantsev [Mon, 5 Dec 2022 08:56:23 +0000 (15:56 +0700)]
[Test] Add 2 more simplified test with missing opts

These are simplified versions of one existing test, but we cannot deal
with them either.

23 months ago[flang] Pointer assignment with remapping involcing polymorphic entities
Valentin Clement [Mon, 5 Dec 2022 08:35:50 +0000 (09:35 +0100)]
[flang] Pointer assignment with remapping involcing polymorphic entities

Lower pointer assignment with remapping involving polymorphic entities
to runtime call to PointerAssociateRemapping.
For the time being all pointer assignment involcing polymorphic entities are
done with the runtime call. When lhs is not unlimited polymorphic
we might be able to do it inlined as well.

Reviewed By: jeanPerier, PeteSteinfeld

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

23 months ago[LAA] Use cross-iteration alias analysis
Nikita Popov [Mon, 14 Nov 2022 15:13:51 +0000 (16:13 +0100)]
[LAA] Use cross-iteration alias analysis

LAA analyzes cross-iteration memory dependencies, as such AA should
not make assumptions about equality of values inside the loop, as
they may come from different iterations.

Fix this by exposing the MayBeCrossIteration AA flag and enabling
it for LAA.

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

23 months ago[mlir][tensor] Fold rank-reducing insert_slice with inverse collapse_shape
Matthias Springer [Mon, 5 Dec 2022 08:16:05 +0000 (09:16 +0100)]
[mlir][tensor] Fold rank-reducing insert_slice with inverse collapse_shape

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

23 months ago[mlir][tensor] Fold rank-reducing extract_slice with inverse expand_shape
Matthias Springer [Mon, 5 Dec 2022 08:15:52 +0000 (09:15 +0100)]
[mlir][tensor] Fold rank-reducing extract_slice with inverse expand_shape

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

23 months ago[LegacyPM] Remove dead declarations
Fangrui Song [Mon, 5 Dec 2022 08:09:23 +0000 (08:09 +0000)]
[LegacyPM] Remove dead declarations

23 months ago[flang] Lower function return to HLFIR
Jean Perier [Mon, 5 Dec 2022 08:05:37 +0000 (09:05 +0100)]
[flang] Lower function return to HLFIR

The only special thing that is needed is to update the bridge symbol
lookup to deal with the HLFIR symbol lookup (symbols are mapped to
fir::FortranVariableInterface operations, not Fortran::Lower::SymbolBox).

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

23 months ago[PowerPC] Remove unused MacOSX check
Fangrui Song [Mon, 5 Dec 2022 07:54:11 +0000 (07:54 +0000)]
[PowerPC] Remove unused MacOSX check

PPC Darwin support was removed long ago.

23 months ago[LegacyPM] Remove AnnotationRemarksLegacyPass
Fangrui Song [Mon, 5 Dec 2022 07:51:17 +0000 (07:51 +0000)]
[LegacyPM] Remove AnnotationRemarksLegacyPass

Following recent changes to remove non-core features of the legacy
PM/optimization pipeline. This is a new pass (2020-11) to generate remarks from
!annotation metadata (e.g. -ftrivial-auto-var-init=).

23 months ago[PowerPC] Use default attributes for intrinsics
Nikita Popov [Tue, 8 Nov 2022 11:26:34 +0000 (12:26 +0100)]
[PowerPC] Use default attributes for intrinsics

This switches a large subset of PowerPC intrinsics to use default
attributes (nosync, nofree, nocallback and willreturn). In
particular the presence of willreturn is important to avoid
optimization regression in the future.

This patch primarily covers readnone/readonly intrinsics.

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

23 months ago[llvm-c] Remove C API functions that are incompatible with opaque pointers
Nikita Popov [Wed, 5 Oct 2022 15:13:25 +0000 (17:13 +0200)]
[llvm-c] Remove C API functions that are incompatible with opaque pointers

These deprecated functions are incompatible with opaque pointers,
and have replacements that accept an explicit type. Drop them now
as a final warning to consumers of the C API to migrate their code
(while LLVMGetElementType still exists as a temporary workaround).

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

23 months ago[lldb] Fix the way we set up the lldb modules infrastructure.
Vassil Vassilev [Mon, 5 Dec 2022 07:18:23 +0000 (07:18 +0000)]
[lldb] Fix the way we set up the lldb modules infrastructure.

D127284 introduced a new language option which is not benign from modules
perspective. Before this patch lldb would set up the compiler invocation and
later enable incremental processing. Post-D127284 this does not work because
the option causes a module hash mismatch for implicit modules.

In addition, D127284 enables parsing statements on the global scope if
incremental processing is on and thus `syntax_error_for_lldb_to_find` was
rightfully not recognized as a declaration and is considered a statement
which produces a slightly different diagnostic.

Thanks to Michael Buch for the help in understanding this issue. This patch
should appease the lldb bots.

More discussion available at: https://reviews.llvm.org/D127284

23 months ago[Kaleidoscope] Fix build after std::optional changes
Nikita Popov [Mon, 5 Dec 2022 07:37:08 +0000 (08:37 +0100)]
[Kaleidoscope] Fix build after std::optional changes

23 months ago[mlir][Linalg] Apply ClangTidy fixes (NFC)
Adrian Kuegel [Mon, 5 Dec 2022 07:18:00 +0000 (08:18 +0100)]
[mlir][Linalg] Apply ClangTidy fixes (NFC)

23 months ago[AST] Make AliasSetTracker work on BatchAA
Nikita Popov [Mon, 14 Nov 2022 14:08:44 +0000 (15:08 +0100)]
[AST] Make AliasSetTracker work on BatchAA

D138014 restricted AST to work on immutable IR. This means it is
also safe to use a single BatchAA instance for the entire AST
lifetime, instead of only batching parts of individual queries.

The primary motivation for this is not compile-time, but rather
having a central place to control cross-iteration AA, which will
be used by D137958.

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

23 months agoTransforms/IPO: llvm::Optional => std::optional
Fangrui Song [Mon, 5 Dec 2022 07:07:19 +0000 (07:07 +0000)]
Transforms/IPO: llvm::Optional => std::optional

23 months ago[test][msan] Update for noundef on retval
Vitaly Buka [Mon, 5 Dec 2022 06:29:15 +0000 (22:29 -0800)]
[test][msan] Update for noundef on retval

23 months agoRemove unused #include "llvm/ADT/Optional.h"
Fangrui Song [Mon, 5 Dec 2022 06:31:11 +0000 (06:31 +0000)]
Remove unused #include "llvm/ADT/Optional.h"

23 months ago[iwyu] Add Hashing.h
Fangrui Song [Mon, 5 Dec 2022 06:26:26 +0000 (06:26 +0000)]
[iwyu] Add Hashing.h

23 months agoForward-declare raw_ostream (NFC)
Kazu Hirata [Mon, 5 Dec 2022 05:43:10 +0000 (21:43 -0800)]
Forward-declare raw_ostream (NFC)

This patch adds forward declarations of raw_ostream to those header
files that are relying on the forward declaration of raw_ostream in
llvm/include/llvm/ADT/Optional.h.

I'm planning to move operator<< for Optional<T> and std::optional<T>
from Optional.h to llvm/include/llvm/Support/raw_ostream.h.  Once I do
so, we no longer need to forward-declare raw_ostream in Optional.h.

23 months ago[ELF] Produce DT_RISCV_VARIANT_CC
Fangrui Song [Mon, 5 Dec 2022 05:08:37 +0000 (21:08 -0800)]
[ELF] Produce DT_RISCV_VARIANT_CC

https://github.com/riscv/riscv-elf-psabi-doc/pull/190 introduced STO_RISCV_VARIANT_CC.
The linker should:

* Copy the STO_RISCV_VARIANT_CC bit to .symtab/.dynsym: already fulfilled after
  82ed93ea0552c8f82df05859ee93e70b71c4e65d
* Produce DT_RISCV_VARIANT_CC if at least one R_RISCV_JUMP_SLOT relocation
  references a symbol with the STO_RISCV_VARIANT_CC bit. Done by this patch.

Reviewed By: kito-cheng

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

23 months ago[NFC][XCOFF] format `XCOFFObjectWriter.cpp`
esmeyi [Mon, 5 Dec 2022 04:57:33 +0000 (23:57 -0500)]
[NFC][XCOFF] format `XCOFFObjectWriter.cpp`

23 months ago[iwyu] Fix files which would break without #include Optional.h
Fangrui Song [Mon, 5 Dec 2022 04:53:28 +0000 (04:53 +0000)]
[iwyu] Fix files which would break without #include Optional.h

23 months ago[clang] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Mon, 5 Dec 2022 04:31:05 +0000 (20:31 -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

23 months agoCheckedArithmetic: llvm::Optional => std::optional
Fangrui Song [Mon, 5 Dec 2022 04:30:54 +0000 (04:30 +0000)]
CheckedArithmetic: llvm::Optional => std::optional

23 months agoRemove unused #include "llvm/ADT/Optional.h"
Fangrui Song [Mon, 5 Dec 2022 04:21:07 +0000 (04:21 +0000)]
Remove unused #include "llvm/ADT/Optional.h"

23 months ago[RISCV] Support .variant_cc directive for the assembler.
Yeting Kuo [Sat, 19 Nov 2022 14:46:24 +0000 (22:46 +0800)]
[RISCV] Support .variant_cc directive for the assembler.

The patch is split from D103435. The patch supported a new directive .variant_cc
that annotates function with STO_RISCV_VARIANT_CC. Symbols marked with
STO_RISCV_VARIANT_CC do not use standard calling conversion or use parameter not
passed in GPR/FPR.

Related: https://github.com/riscv/riscv-elf-psabi-doc/pull/190

Initial authored by: HsiangKai

Reviewed By: MaskRay

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

23 months ago[IR] llvm::Optional => std::optional
Fangrui Song [Mon, 5 Dec 2022 04:13:11 +0000 (04:13 +0000)]
[IR] llvm::Optional => std::optional

Many llvm/IR/* files have been migrated by other contributors.
This migrates most remaining files.

23 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

23 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

23 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

23 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

23 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.

23 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

23 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

23 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

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

23 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

23 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

23 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.

23 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.

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

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

23 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

23 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

23 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.

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

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

23 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

23 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

23 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

23 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

23 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

23 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>
        ]

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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.

23 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.

23 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.

23 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

23 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.

23 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

23 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

23 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.

23 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)

23 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

23 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.

23 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

23 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.

23 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

23 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

23 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

23 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

23 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

23 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