platform/upstream/llvm.git
21 months ago[Presburger] Use std::optional in PresburgerRelation.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 18:22:11 +0000 (10:22 -0800)]
[Presburger] Use std::optional in PresburgerRelation.cpp (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

21 months ago[AliasAnalysis] Use std::optional in LocalAliasAnalysis.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 18:20:47 +0000 (10:20 -0800)]
[AliasAnalysis] Use std::optional in LocalAliasAnalysis.cpp (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

21 months ago[SROA] Rewrite store-into-selected-address into predicated stores
Roman Lebedev [Sat, 10 Dec 2022 17:01:44 +0000 (20:01 +0300)]
[SROA] Rewrite store-into-selected-address into predicated stores

Same basic idea as with unfolding loads into predicated loads,
but we obviously can't have speculative stores.

21 months ago[NFC][SROA] Add tests with store-into-select-of-addrs
Roman Lebedev [Sat, 10 Dec 2022 17:23:00 +0000 (20:23 +0300)]
[NFC][SROA] Add tests with store-into-select-of-addrs

21 months agoRevert "[FileCheck] Use std::optional in FileCheck.cpp (NFC)"
Kazu Hirata [Sat, 10 Dec 2022 17:28:07 +0000 (09:28 -0800)]
Revert "[FileCheck] Use std::optional in FileCheck.cpp (NFC)"

This reverts commit f555ec57cc01181ce09c802194b6f572f7a3f78a.

One build failure has been reported:

https://lab.llvm.org/buildbot/#/builders/67/builds/9785/steps/6/logs/stdio

21 months ago[llvm-gsymutil] Use std::optional in llvm-gsymutil.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:31:15 +0000 (08:31 -0800)]
[llvm-gsymutil] Use std::optional in llvm-gsymutil.cpp (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

21 months ago[Scalar] Use std::optional in InductiveRangeCheckElimination.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:29:35 +0000 (08:29 -0800)]
[Scalar] Use std::optional in InductiveRangeCheckElimination.cpp (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

21 months ago[Coroutines] Use std::optional in CoroFrame.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:27:36 +0000 (08:27 -0800)]
[Coroutines] Use std::optional in CoroFrame.cpp (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

21 months ago[ProfileData] Use std::optional in InstrProfCorrelator.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:25:50 +0000 (08:25 -0800)]
[ProfileData] Use std::optional in InstrProfCorrelator.cpp (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

21 months ago[FileCheck] Use std::optional in FileCheck.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:24:18 +0000 (08:24 -0800)]
[FileCheck] Use std::optional in FileCheck.cpp (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

21 months ago[MachO] Use std::optional in MachOConfig.h (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:22:37 +0000 (08:22 -0800)]
[MachO] Use std::optional in MachOConfig.h (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

21 months ago[OpenMP] Use std::optional in OMPIRBuilder.h (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:21:04 +0000 (08:21 -0800)]
[OpenMP] Use std::optional in OMPIRBuilder.h (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

21 months ago[DWARFLinker] Use std::optional in DWARFLinkerCompileUnit.h (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:19:36 +0000 (08:19 -0800)]
[DWARFLinker] Use std::optional in DWARFLinkerCompileUnit.h (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

21 months ago[BinaryFormat] Use std::optional in Wasm.h (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:18:04 +0000 (08:18 -0800)]
[BinaryFormat] Use std::optional in Wasm.h (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

21 months ago[Checkers] Use std::optional in UnixAPIChecker.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:10:24 +0000 (08:10 -0800)]
[Checkers] Use std::optional in UnixAPIChecker.cpp (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

21 months ago[Checkers] Use std::optional in StdLibraryFunctionsChecker.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:09:00 +0000 (08:09 -0800)]
[Checkers] Use std::optional in StdLibraryFunctionsChecker.cpp (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

21 months ago[RetainCountChecker] Use std::optional in RetainCountDiagnostics.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:07:12 +0000 (08:07 -0800)]
[RetainCountChecker] Use std::optional in RetainCountDiagnostics.cpp (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

21 months ago[Checkers] Use std::optional in MallocChecker.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:04:28 +0000 (08:04 -0800)]
[Checkers] Use std::optional in MallocChecker.cpp (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

21 months ago[Checkers] Use std::optional in GenericTaintChecker.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 16:00:24 +0000 (08:00 -0800)]
[Checkers] Use std::optional in GenericTaintChecker.cpp (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

21 months ago[Checkers] Use std::optional in BasicObjCFoundationChecks.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 15:58:36 +0000 (07:58 -0800)]
[Checkers] Use std::optional in BasicObjCFoundationChecks.cpp (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

21 months ago[InstCombine] reorder FP select folds
Sanjay Patel [Sat, 10 Dec 2022 14:41:41 +0000 (09:41 -0500)]
[InstCombine] reorder FP select folds

There was a code comment about detecting min/max, and we were already
doing that later.

The real motivation is hinted at by the new TODO comment. I'm hoping
to untangle some FMF ambiguity in follow-on patches. See discussion
in issue #59279.

There are enough unknowns in FMF handling that I can't say with
certainty that this change is NFC, but it doesn't cause any existing
regression tests to change.

21 months ago[InstCombine] add tests for fabs folds with more FMF; NFC
Sanjay Patel [Fri, 9 Dec 2022 19:36:22 +0000 (14:36 -0500)]
[InstCombine] add tests for fabs folds with more FMF; NFC

The existing variants have "nsz", but that's not enough
to get fabs/fneg semantics right with a NAN input, so
I duplicated those with "nnan" tacked on. See discussion
in issue #59279.

21 months ago[FuncSpec] Make the Function Specializer part of the IPSCCP pass.
Alexandros Lamprineas [Fri, 9 Dec 2022 17:41:05 +0000 (17:41 +0000)]
[FuncSpec] Make the Function Specializer part of the IPSCCP pass.

Reland 877a9f9abec61f06e39f1cd872e37b828139c2d1 since D138654 (parent)
has been fixed with 9ebaf4fef4aac89d4eff08e48185d61bc893f14e and with
8f1e11c5a7d70f96943a72649daa69f152d73e90.

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

21 months ago[libc++][doc] Fixes a formating issue.
Mark de Wever [Sat, 10 Dec 2022 14:28:15 +0000 (15:28 +0100)]
[libc++][doc] Fixes a formating issue.

21 months agoRevert "[clang-format] Link the braces of a block in UnwrappedLineParser"
Owen Pan [Sat, 10 Dec 2022 01:16:47 +0000 (17:16 -0800)]
Revert "[clang-format] Link the braces of a block in UnwrappedLineParser"

This reverts commit e33243c950ac40d027ad8facbf7ccf0624604a16 but
keeps the added test case and also adds another test case.

Fixes #59417.

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

21 months ago[Driver] -fstack-size-section: pass -stack-size-section to backend for LTO
Fangrui Song [Sat, 10 Dec 2022 10:15:29 +0000 (10:15 +0000)]
[Driver] -fstack-size-section: pass -stack-size-section to backend for LTO

The option does not change IR but affect object file generation. Without a
backend option the option is a no-op for in-process ThinLTO.

The problem is known and there are many options similar to -fstack-size-section.
That said, -fstack-size-section has relatively wider adoption, so it probably
makes sense to have custom code for it.

Close https://github.com/llvm/llvm-project/issues/59424

21 months agoUse if constexpr to simplify some SFINAE in mlir::OpState (NFC)
Mehdi Amini [Sat, 10 Dec 2022 08:35:59 +0000 (08:35 +0000)]
Use if constexpr to simplify some SFINAE in mlir::OpState (NFC)

Reviewed By: rriddle

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

21 months agoImprove class documentation for mlir::Operation
Mehdi Amini [Sat, 10 Dec 2022 08:35:36 +0000 (08:35 +0000)]
Improve class documentation for mlir::Operation

As a cornerstone of MLIR, this deserves more than the
current few lines.

Reviewed By: rriddle

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

21 months ago[Frontend] Use std::optional in TextDiagnostic.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 07:22:41 +0000 (23:22 -0800)]
[Frontend] Use std::optional in TextDiagnostic.cpp (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

21 months ago[Rewrite] Use std::optional in InclusionRewriter.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 07:21:35 +0000 (23:21 -0800)]
[Rewrite] Use std::optional in InclusionRewriter.cpp (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

21 months ago[Frontend] Use std::optional in CompilerInvocation.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 07:19:23 +0000 (23:19 -0800)]
[Frontend] Use std::optional in CompilerInvocation.cpp (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

21 months ago[Frontend] Use std::optional in CompilerInstance.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 07:16:32 +0000 (23:16 -0800)]
[Frontend] Use std::optional in CompilerInstance.cpp (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

21 months ago[Frontend] Use std::optional in ASTUnit.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 07:12:19 +0000 (23:12 -0800)]
[Frontend] Use std::optional in ASTUnit.cpp (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

21 months ago[Format] Use std::optional in QualifierAlignmentFixer.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 07:09:06 +0000 (23:09 -0800)]
[Format] Use std::optional in QualifierAlignmentFixer.cpp (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

21 months ago[Format] Use std::optional in Format.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 07:07:58 +0000 (23:07 -0800)]
[Format] Use std::optional in Format.cpp (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

21 months ago[Format] Use std::optional in ContinuationIndenter.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 07:06:32 +0000 (23:06 -0800)]
[Format] Use std::optional in ContinuationIndenter.cpp (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

21 months ago[ExtractAPI] Use std::optional in ExtractAPIConsumer.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 07:03:10 +0000 (23:03 -0800)]
[ExtractAPI] Use std::optional in ExtractAPIConsumer.cpp (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

21 months ago[linux] Use std::optional in DirectoryWatcher-linux.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 06:55:06 +0000 (22:55 -0800)]
[linux] Use std::optional in DirectoryWatcher-linux.cpp (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

21 months ago[Targets] Use std::optional in RISCV.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 06:52:29 +0000 (22:52 -0800)]
[Targets] Use std::optional in RISCV.cpp (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

21 months ago[Basic] Use std::optional in TargetID.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 06:51:10 +0000 (22:51 -0800)]
[Basic] Use std::optional in TargetID.cpp (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

21 months ago[Basic] Use std::optional in FileManager.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 06:49:47 +0000 (22:49 -0800)]
[Basic] Use std::optional in FileManager.cpp (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

21 months ago[Basic] Use std::optional in DarwinSDKInfo.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 06:48:14 +0000 (22:48 -0800)]
[Basic] Use std::optional in DarwinSDKInfo.cpp (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

21 months ago[AST] Use std::optional in OSLog.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 06:21:54 +0000 (22:21 -0800)]
[AST] Use std::optional in OSLog.cpp (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

21 months ago[AST] Use std::optional in ExprConstant.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 06:19:46 +0000 (22:19 -0800)]
[AST] Use std::optional in ExprConstant.cpp (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

21 months ago[AST] Use std::optional in ASTImporter.cpp (NFC)
Kazu Hirata [Sat, 10 Dec 2022 06:17:46 +0000 (22:17 -0800)]
[AST] Use std::optional in ASTImporter.cpp (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

21 months ago[Clang][LoongArch] Add intrinsic for iocsrrd and iocsrwr
gonglingqin [Sat, 10 Dec 2022 03:45:18 +0000 (11:45 +0800)]
[Clang][LoongArch] Add intrinsic for iocsrrd and iocsrwr

These intrinsics are required by Linux [1].

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/loongarch/include/asm/loongarch.h#n240

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

21 months ago[llvm][perf] fix a compiler warning when compile LLVM with LLVM_USE_PERF.
Peiming Liu [Sat, 10 Dec 2022 00:57:00 +0000 (00:57 +0000)]
[llvm][perf] fix a compiler warning when compile LLVM with LLVM_USE_PERF.

To fix "PerfJITEventListener.cpp:208:32: warning: missing field 'Version' initializer [-Wmissing-field-initializers]"

Reviewed By: ezhulenev

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

21 months agoRevert "[compiler-rt][hwasan] Let CheckAddressSized eventually call HandleTagMismatch...
Gulfem Savrun Yeniceri [Sat, 10 Dec 2022 04:44:26 +0000 (04:44 +0000)]
Revert "[compiler-rt][hwasan] Let CheckAddressSized eventually call HandleTagMismatch on Fuchsia"

This reverts commit bcc4470bade15dbafa879973828a03c7e5194399.

21 months agoRevert "[compiler-rt][hwasan] Add unused attribute to GetRegisters"
Gulfem Savrun Yeniceri [Sat, 10 Dec 2022 04:44:10 +0000 (04:44 +0000)]
Revert "[compiler-rt][hwasan] Add unused attribute to GetRegisters"

This reverts commit 3e3ae76de451496d6fb8b4713f847a59d6bc19f5.

21 months ago[sanitizer] Fix the internal_clone implementation on loongarch
Youling Tang [Sat, 10 Dec 2022 03:50:35 +0000 (11:50 +0800)]
[sanitizer] Fix the internal_clone implementation on loongarch

Fix syscall clone argument passing order, also `call fn(arg)` should
return, change `jr $a5`(jirl $zero, $a5, 0) to `jirl $ra, $a5, 0`.

Reviewed By: SixWeining

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

21 months ago[safestack] Enable loongarch64
Youling Tang [Sat, 10 Dec 2022 03:48:12 +0000 (11:48 +0800)]
[safestack] Enable loongarch64

Enable safestack on loongarch64.

Some test cases will fail on loongarch, it will be fixed in glibc,
Links: https://sourceware.org/pipermail/libc-alpha/2022-November/143641.html

Reviewed By: #sanitizers, SixWeining, vitalybuka

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

21 months ago[libc] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 10 Dec 2022 03:47:16 +0000 (19:47 -0800)]
[libc] 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

21 months ago[LoongArch] Add testcases for privileged intrinsic macros
gonglingqin [Sat, 10 Dec 2022 02:26:06 +0000 (10:26 +0800)]
[LoongArch] Add testcases for privileged intrinsic macros

Add testcases calling macros to the implemented privileged intrinsics
as discussed in D139288. The intrinsics involved include ibar, dbar,
break, syscall, and CRC check intrinsics.

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

21 months ago[libc++][ranges][NFC] Update Ranges status.
Konstantin Varlamov [Sat, 10 Dec 2022 03:32:18 +0000 (19:32 -0800)]
[libc++][ranges][NFC] Update Ranges status.

Add a link to an in-progress patch.

21 months ago[libc] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 10 Dec 2022 03:14:05 +0000 (19:14 -0800)]
[libc] 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

21 months ago[AMDGPU] Update MFMASmallGemmOpt with better performing stategy
Austin Kerbow [Fri, 2 Dec 2022 20:32:02 +0000 (12:32 -0800)]
[AMDGPU] Update MFMASmallGemmOpt with better performing stategy

Based on experiments this does better with target small GEMM kernels.

Reviewed By: jrbyrnes

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

21 months ago[clang] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Sat, 10 Dec 2022 02:39:01 +0000 (18:39 -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

21 months ago[flang] Use std::nullopt instead of llvm::None (NFC)
Kazu Hirata [Sat, 10 Dec 2022 02:32:33 +0000 (18:32 -0800)]
[flang] Use std::nullopt instead of llvm::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

21 months ago[llvm] Use std::nullopt instead of None (NFC)
Kazu Hirata [Sat, 10 Dec 2022 02:32:31 +0000 (18:32 -0800)]
[llvm] 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

21 months ago[mlir][arith] Define mulsi_extended op
Jakub Kuderski [Sat, 10 Dec 2022 01:25:31 +0000 (20:25 -0500)]
[mlir][arith] Define mulsi_extended op

Extend D139688 with the signed version of the extended multiplication
op. Add conversion to the SPIR-V and LLVM dialects.

This was originally proposed in:
https://discourse.llvm.org/t/rfc-arith-add-extended-multiplication-ops/66869.

Reviewed By: antiagainst

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

21 months ago[scudo] Enable more warnings for standalone build
Dominic Chen [Sat, 10 Dec 2022 01:15:47 +0000 (17:15 -0800)]
[scudo] Enable more warnings for standalone build

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

21 months ago[RISCV] clang-format lowerReductionSeq. NFC
Craig Topper [Sat, 10 Dec 2022 01:00:29 +0000 (17:00 -0800)]
[RISCV] clang-format lowerReductionSeq. NFC

Wraps a long line to 80 columns.

21 months ago[LangRef] Fix typo. NFC.
Yeting Kuo [Sat, 10 Dec 2022 01:01:47 +0000 (09:01 +0800)]
[LangRef] Fix typo. NFC.

bswap is an unary operation.

Reviewed By: craig.topper

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

21 months ago[RISCV] Simplify RISCVSubtarget. NFC
Craig Topper [Sat, 10 Dec 2022 00:21:33 +0000 (16:21 -0800)]
[RISCV] Simplify RISCVSubtarget. NFC

The flags, initialization of the flags, and the getter methods for
features defined in RISCV.td can be generated by TableGen.

Reviewed By: reames

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

21 months ago[mlir][sparse] avoid sorting when unnecessary when convert sparse tensors.
Peiming Liu [Fri, 9 Dec 2022 23:21:09 +0000 (23:21 +0000)]
[mlir][sparse] avoid sorting when unnecessary when convert sparse tensors.

Reviewed By: aartbik

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

21 months ago[gn build] Port ec3f8feddf81
LLVM GN Syncbot [Fri, 9 Dec 2022 23:21:59 +0000 (23:21 +0000)]
[gn build] Port ec3f8feddf81

21 months ago[Clang-Tidy] Empty Check
Abraham Corea Diaz [Fri, 9 Dec 2022 22:38:34 +0000 (22:38 +0000)]
[Clang-Tidy] Empty Check

Adds a clang-tidy check for the incorrect use of `empty()` on a
container when the result of the call is ignored.

Authored-by: Abraham Corea Diaz <abrahamcd@google.com>
Co-authored-by: Denis Nikitin <denik@google.com>
Reviewed By: cjdb

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

21 months ago[Headers][ARM] Allow `struct _Unwind_Exception` in unwind.h
Ryan Prichard [Fri, 9 Dec 2022 23:15:22 +0000 (15:15 -0800)]
[Headers][ARM] Allow `struct _Unwind_Exception` in unwind.h

Use the same approach as used in libunwind/include/unwind_arm_ehabi.h
(D89570) and GCC's unwind-arm-common.h, so that _Unwind_Exception can be
used both with and without the struct tag.

Fixes a build failure in libcxxabi/test/forced_unwind1.pass.cpp.

Reviewed By: danielkiss

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

21 months ago[libc++][Android] Disable pbump2gig for Android
Ryan Prichard [Fri, 9 Dec 2022 23:15:16 +0000 (15:15 -0800)]
[libc++][Android] Disable pbump2gig for Android

Android devices frequently don't have enough memory to run this test.

e.g. On the API 33 x86-64 emulator with 2GiB RAM, the test triggers the
OOM Killer, the device reboots, and then `adb shell` exits with status
0 and no output.

Reviewed By: danalbert, #libc, Mordante

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

21 months ago[libc++][Android] Android/Bionic headers don't work with modules yet
Ryan Prichard [Fri, 9 Dec 2022 23:14:42 +0000 (15:14 -0800)]
[libc++][Android] Android/Bionic headers don't work with modules yet

The current Android headers don't appear to work with modules. We may
want to fix them eventually.

Reviewed By: #libc, Mordante

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

21 months ago[libc++][Android] Include cstdlib to define __BIONIC__
Ryan Prichard [Fri, 9 Dec 2022 23:14:04 +0000 (15:14 -0800)]
[libc++][Android] Include cstdlib to define __BIONIC__

__ANDROID__ is a built-in compiler macro, but __BIONIC__ is defined by
the libc header.

Reviewed By: #libc_abi, compnerd

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

21 months ago[NFC][Assignment Tracking Analysis] Stop failing test from running on PPC.
Stefan Pintilie [Fri, 9 Dec 2022 23:00:42 +0000 (17:00 -0600)]
[NFC][Assignment Tracking Analysis] Stop failing test from running on PPC.

The test remove-undef-fragment.ll fails on the PPC bots. I've disabled the test
everywhere except X86 to allow for the investigation of the issue.

21 months ago[mlir] Remove double 'the' in comment (NFC)
SaeHie Park [Fri, 9 Dec 2022 22:51:36 +0000 (14:51 -0800)]
[mlir] Remove double 'the' in comment (NFC)

Remove the double 'the' in the comment for 'getInsertionBlock()'.

Reviewed By: jpienaar, rriddle

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

21 months ago[mlir][arith] Define mului_extended op
Jakub Kuderski [Fri, 9 Dec 2022 22:37:05 +0000 (17:37 -0500)]
[mlir][arith] Define mului_extended op

Add conversion to the SPIR-V and LLVM dialects.

This was originally proposed in:
https://discourse.llvm.org/t/rfc-arith-add-extended-multiplication-ops/66869.

Reviewed By: antiagainst

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

21 months ago[libc] add result class to strtointeger
Michael Jones [Thu, 1 Sep 2022 22:19:35 +0000 (15:19 -0700)]
[libc] add result class to strtointeger

This is a class intended to improve errno handling for internal
functions by allowing functions to return their result and error status
instead of setting errno. This specific class will be used for
strtointeger and (in a followup patch) strtofloat.

Reviewed By: sivachandra

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

21 months ago[OpenMP][FIX] Do not use reachability reasoning in parallel contexts
Johannes Doerfert [Fri, 9 Dec 2022 22:13:52 +0000 (14:13 -0800)]
[OpenMP][FIX] Do not use reachability reasoning in parallel contexts

Similar to dominance reasoning, we cannot use CFG reachability if the
instructions might be executed by different threads. A follow up will
improve our sensitivity for situations when it is OK to use graph
reasoning.

21 months agoRevert "Implement CWG2631"
Arthur Eubanks [Fri, 9 Dec 2022 22:17:37 +0000 (14:17 -0800)]
Revert "Implement CWG2631"

This reverts commit c9a6713b4788f10b81202b70993068e475b392f7.

Causes crashes, see D136554.

21 months ago[SCEV] Cache ZExt SCEV expressions.
Florian Hahn [Fri, 9 Dec 2022 22:14:03 +0000 (22:14 +0000)]
[SCEV] Cache ZExt SCEV expressions.

When creating SCEV expressions for ZExt, there's quite a bit of
reasoning done and in many places the reasoning in turn will try to
create new SCEVs for other ZExts.

This can have a huge compile-time impact. The attached test from #58402
takes an excessive amount of compile time; without the patch, the test
doesn't complete in 1500+ seconds, but with the patch it completes in 1
second.

To speed up this case, cache created ZExt expressions for given (SCEV, Ty) pairs.
Caching just ZExts is relatively straight-forward, but it might make
sense to extend it to other expressions in the future.

This has a slight positive impact on CTMark:
* O3: -0.03%
* ReleaseThinLTO: -0.03%
* ReleaseLTO-g: 0.00%

https://llvm-compile-time-tracker.com/compare.php?from=bf9de7464946c65f488fe86ea61bfdecb8c654c1&to=5ac0108553992fb3d58bc27b1518e8cf06658a32&stat=instructions:u

The patch also improves compile-time for some internal real-world workloads
where time spent in SCEV goes from ~300 seconds to ~3 seconds.

There are a few cases where computing & caching the result earlier may
return more pessimistic results, but the compile-time savings seem to
outweigh that.

Fixes #58402.

Reviewed By: mkazantsev

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

21 months ago[SystemZ][NFC] Simplify SystemZSubtarget
Kai Nacke [Fri, 9 Dec 2022 20:26:17 +0000 (15:26 -0500)]
[SystemZ][NFC] Simplify SystemZSubtarget

The flags, initialization of the flags, and the getter methods for
features defined in SystemZFeatures.td can be generated by TableGen.

Reviewed By: uweigand

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

21 months ago[flang] Skip fast_math linker test on powerpc
Tom Eccles [Fri, 9 Dec 2022 21:20:42 +0000 (21:20 +0000)]
[flang] Skip fast_math linker test on powerpc

Related to https://reviews.llvm.org/D138675

21 months ago[RISCV] Share reduction lowering code for vp.reduce
Philip Reames [Fri, 9 Dec 2022 19:56:20 +0000 (11:56 -0800)]
[RISCV] Share reduction lowering code for vp.reduce

We can consolidate code and clarify edge case behavior at the same time.

There are two functional differences here.

First, I remove the ResVT handling, and always use the reduction element type. This appears to be dead code. There's no test coverage, and this code doesn't need to account for scalar type legalization anyways.

Second, if the VL happens to be known non-zero, we can avoid passing through start. This is mostly needed to allow reuse of the existing code; I don't consider it interesting as an optimization on it's own.

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

21 months agoAllow epilogue_begin to be emitted when generating DWARF
Ariel Burton [Fri, 9 Dec 2022 20:04:27 +0000 (20:04 +0000)]
Allow epilogue_begin to be emitted when generating DWARF

We identify epilogue code by looking for instructions tagged
with FrameDestroy.

A function may have more than one epilogue, e.g., because of early
returns or code duplicated during optimization. We need only track
the current block, and emit epilogie_begin at most once per block.

We reduce the number of entries in the line table by combining
epilogue_begin with other flags instead of emitting a separate
entry just for epilogue_begin.

Reviewed By: dblaikie, aprantl

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

21 months ago[CodeView][Test] Fix module build by removing unused header
Steven Wu [Fri, 9 Dec 2022 20:14:42 +0000 (12:14 -0800)]
[CodeView][Test] Fix module build by removing unused header

Remove unnecessary header from CodeView unittest. The unused PDB header
include has a dependency on Object -> Bitcode -> intrinsics_gen, which
will fail the module build because the module needed to build the tests
rely on the intrinsics gen.

Reviewed By: aprantl

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

21 months agoRevert "Reland [lld-macho] Fix bug in reading cpuSubType field."
Vy Nguyen [Fri, 9 Dec 2022 20:07:08 +0000 (15:07 -0500)]
Revert "Reland [lld-macho] Fix bug in reading cpuSubType field."

This reverts commit f472da190b65a1db2512960ee5334889a6663aef.

21 months ago[flang] Add -ffast-math and -Ofast
Tom Eccles [Wed, 19 Oct 2022 13:19:28 +0000 (13:19 +0000)]
[flang] Add -ffast-math and -Ofast

clang -cc1 accepts -Ofast. I did not add it to flang -fc1 because this
seems redundant because the compiler driver will always resolve -Ofast
into -O3 -ffast-math (I added a test for this).

-menable-infs is removed from the frontend-forwarding test because if
all of the fast-math component flags are present, these will be resolved
into the fast-math flag. Instead -menable-infs is tested in the
fast-math test.

Specifying -ffast-math to the compiler driver causes linker invocations
to include crtfastmath.o.

RFC: https://discourse.llvm.org/t/rfc-the-meaning-of-ofast/66554

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

21 months ago[LLD] Convert a test to use 'target=...' instead of triple check
Paul Robinson [Fri, 9 Dec 2022 19:52:47 +0000 (11:52 -0800)]
[LLD] Convert a test to use 'target=...' instead of triple check

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

21 months agoMove Clang's per-suite test targets into a folder
Chris Bieneman [Fri, 9 Dec 2022 19:29:46 +0000 (13:29 -0600)]
Move Clang's per-suite test targets into a folder

Putting these under a folder allows the CMake integraiton for IDEs to
sort the per-suite targets under a folder nested under the clang tests.

21 months agoResolve possible test failure on Windows
Chris Bieneman [Fri, 9 Dec 2022 19:27:49 +0000 (13:27 -0600)]
Resolve possible test failure on Windows

If dr0xx.c's timestamp is newer than dr324.c the preprocessor will issue
an unexpected diagnostic in dr324.c. To prevent this diagnostic we can
have dr324.c run touch against itself to force its timestamp to be new.

21 months ago[mlir][arith] Add canon pattern: addui_extended -> addi
Jakub Kuderski [Fri, 9 Dec 2022 19:40:04 +0000 (14:40 -0500)]
[mlir][arith] Add canon pattern: addui_extended -> addi

Demote `arith.addui_extended` to `arith.addi` when the 'overflow'
result has no uses.

Reviewed By: antiagainst

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

21 months ago[LV] Account for minimum vscale when rejecting scalable vectorization of short loops
Philip Reames [Fri, 9 Dec 2022 19:24:01 +0000 (11:24 -0800)]
[LV] Account for minimum vscale when rejecting scalable vectorization of short loops

The vectorizer has code to reject scalable vectorization of loops with very short trip counts, and instead use fixed length vectors. The current code doesn't account for the minimum vscale value known, and thus under estimates the number of lanes in the scalable type for RISCV's default configuration. This results in use of predication and a trivially dead loop where a single straight line piece of code would suffice.

Note that the code quality of the original scalable vectorization could (and probably should) be improved other ways as well. This patch is solely about whether the scalable vectorization was the right choice to begin with.

This bit of code - both with and without my change - does make the unchecked assumption that the target knows how to lower fixed length vectors whose length is provably less than the vector length.

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

21 months agoAMDGPU: Erase llvm.global_ctors/global_dtors after lowering
Matt Arsenault [Fri, 9 Dec 2022 19:11:02 +0000 (14:11 -0500)]
AMDGPU: Erase llvm.global_ctors/global_dtors after lowering

We should be able to run the pass multiple times without breaking
anything. If we still need to track these for some reason, we could
replace with new entries for the kernels.

21 months ago[NFC][DX] Update test case to use new opt flags
Chris Bieneman [Fri, 9 Dec 2022 19:15:34 +0000 (13:15 -0600)]
[NFC][DX] Update test case to use new opt flags

The legacy `-<pass>` options are now erroring out. This updates to the
new pass manager option.

21 months ago[NFC] Update DXContainer tests to use fake parts
Chris Bieneman [Fri, 9 Dec 2022 17:57:07 +0000 (11:57 -0600)]
[NFC] Update DXContainer tests to use fake parts

The tests that are focused on testing the file structure should use
fake part names so that the errors get triggered consistently. As we
add parsing support for known data types and structures under the parts
the parsing errors change to be more semantically accurate.

This change ensures the general errors continue to work with less churn
on the test cases in the future.

21 months agoFix GetAddressOf for children of pointer ValueObjectConstResult* variables.
Jim Ingham [Thu, 8 Dec 2022 19:00:08 +0000 (11:00 -0800)]
Fix GetAddressOf for children of pointer ValueObjectConstResult* variables.

The original code always set the m_live_address of children of the ValueObjects that
use ValueObjectConstResultImpl backends to the parent m_live_address + child_byte_offset.
That is correct for structure types, but wrong for pointer types, since m_live_address
for a pointer type is the address of the storage for the pointer, not of the pointee.

Also added a test which was failing before this patch.

21 months agoReland [lld-macho] Fix bug in reading cpuSubType field.
Vy Nguyen [Fri, 9 Dec 2022 14:06:43 +0000 (09:06 -0500)]
Reland [lld-macho] Fix bug in reading cpuSubType field.

This reverts commit 66692c822aee47baa2cb71f92090d58a8dc01116.

New changes:
  - update test to require aarch64
  - update test to not hard-code cpu[sub] type values (since they could change)
  - update test to temporarily skip windows (because llvm-mc on windows doesn't seem to work with triple arm64-apple-macos)

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

21 months ago[WebAssembly] Nullify dangling register DBG_VALUEs
Heejin Ahn [Wed, 30 Nov 2022 23:37:29 +0000 (15:37 -0800)]
[WebAssembly] Nullify dangling register DBG_VALUEs

Register-based `DBG_VALUE` should have been
converted into either local-based or stack-operand-based, so at this
point they don't contain any information.

This CL nullifies them, i.e., turning them info
`DBG_VALUE $noreg, $noreg, ...`, which makes the variable appear as
"optimized out". It is not safe to simply remove these instruction
because at this point, because the fact that there is a `DBG_VALUE` here
means the location this variable resides has changed to somewhere else;
we've lost that information where that was.

---

The below is not really about the CL itself, but a pre-existing bug in
`llvm-locstats` variable coverage we are going to be affected after this
CL. Feel free to skip if you don't have time.

This CL has an unexpected side effect of increasing variable coverage
reported by `llvm-locstats`, due to a bug mentioned in
https://lists.llvm.org/pipermail/llvm-dev/2021-January/148139.html.
Currently inlined functions' formal parameters that don't have any
coverage, including those who only have `DBG_VALUE $noreg, $noreg`s
associated with them, don't generate `DW_TAG_formal_parameter` DIEs, and
they don't get into consideration in `llvm-dwarf --statistics` and
`llvm-locstats`. This is a known bug mentioned in
https://lists.llvm.org/pipermail/llvm-dev/2021-January/148139.html. For
example, this is a snippet of `llvm-dwarfdump` output of `wc`, where
`isword` is inlined into another function. `isword` has a formal
parameter `c`, which doesn't have any coverage in this inlined area, so
its `DW_TAG_formal_parameter` was not generated:
```
0x0000018d:     DW_TAG_inlined_subroutine
                  DW_AT_abstract_origin  (0x0000012c "isword")
                  DW_AT_low_pc  (0x00000166)
                  DW_AT_high_pc  (0x0000016d)
                  DW_AT_call_file  ("/usr/local/google/home/aheejin/test/dwarf-verify/wc/wc.c")
                  DW_AT_call_line  (100)
                  DW_AT_call_column  (0x0a)
```

But our dangling-register-based formal parameters currently generate
`DW_TAG_formal_parameter` DIEs, even though they don't have any
meaningful coverage, and this happened to generate correct statistics,
because it correctly sees this `c` doesn't have any coverage in this
inlined area. So our current `llvm-dwarfdump` (before this CL) is like:
```
0x0000018d:     DW_TAG_inlined_subroutine
                  DW_AT_abstract_origin  (0x0000012c "isword")
                  DW_AT_low_pc  (0x00000166)
                  DW_AT_high_pc  (0x0000016d)
                  DW_AT_call_file  ("/usr/local/google/home/aheejin/test/dwarf-verify/wc/wc.c")
                  DW_AT_call_line  (100)
                  DW_AT_call_column  (0x0a)

0x0000019a:       DW_TAG_formal_parameter
                    DW_AT_abstract_origin  (0x00000134 "c")
```
Note that this `DW_TAG_formal_parameter` doesn't have any
`DW_AT_location` attribute under it, meaning it doesn't have any
coverage.

On the other hand, if the `DW_TAG_formal_parameter` is not generated,
`llvm-dwarfdump --statistics` wouldn't even know about the parameter's
existence,  and doesn't include it in the coverage computation, making
the overall coverage (incorrectly) go up.

`DBG_VALUE $noreg, $noreg` used to generate this empty
`DW_TAG_formal_parameter`, but it changed for consistency in D95617.

It looks this bug in `llvm-dwarf --statistics` (and `llvm-locstats`,
which uses `llvm-dwarf --statistics`) has not been fixed so far. So we
get the coverage that's little incorrectly higher than our actual
coverage. But this bug apparently affects every target in LLVM.

Reviewed By: dschuff

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

21 months agoSwitch the "command script add" interactive input to use the new command form.
Jim Ingham [Fri, 9 Dec 2022 01:23:04 +0000 (17:23 -0800)]
Switch the "command script add" interactive input to use the new command form.

We're suggesting people use the form of the command that takes an exe_ctx - it
is both more convenient and more correct - since you should not be using
GetSelected{Target, Process, etc.} in commands.

21 months ago[clang][dataflow] Add support for structured bindings of tuple-like types.
Yitzhak Mandelbaum [Wed, 7 Dec 2022 16:03:37 +0000 (16:03 +0000)]
[clang][dataflow] Add support for structured bindings of tuple-like types.

This patch adds interpretation of binding declarations resulting from a
structured binding (`DecompositionDecl`) to a tuple-like type. Currently, the
framework only supports binding to a struct.

Fixes issue #57252.

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

21 months ago[WebAssembly] Print DEBUG_VALUE once for target indices
Heejin Ahn [Wed, 7 Dec 2022 18:51:06 +0000 (10:51 -0800)]
[WebAssembly] Print DEBUG_VALUE once for target indices

`DEBUG_VALUE` comments are printed before an instruction, so they are
not printed with `AddComment` method as other comments are, but printed
using `emitRawComment` method. But currently `emitDebugValueComment`
calls `emitRawComment` twice for target-index-based `DBG_VALUE`s: once
in the `switch`-`case`,
https://github.com/llvm/llvm-project/blob/d77ae7f2513504655e555cd326208598093d66e2/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp#L1192-L1193
and again at the end of the method:
https://github.com/llvm/llvm-project/blob/d77ae7f2513504655e555cd326208598093d66e2/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp#L1227-L1228

This makes them printed twice. I think this happened through multiple
commits modifying and refactoring this method.

Reviewed By: dschuff

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

21 months agoAMDGPU: Port AMDGPUCtorDtorLowering to new PM
Matt Arsenault [Fri, 9 Dec 2022 18:33:30 +0000 (13:33 -0500)]
AMDGPU: Port AMDGPUCtorDtorLowering to new PM