platform/upstream/llvm.git
19 months ago[mlir][AMDGPU] Remove buffer ops that are statically out of bounds
Krzysztof Drewniak [Wed, 9 Nov 2022 22:26:33 +0000 (22:26 +0000)]
[mlir][AMDGPU] Remove buffer ops that are statically out of bounds

When the bounds check attribute is true, the raw buffer load, store,
and atomic operations have well-defined behavior (returning 0 for
loads and ignoring stores) when the buffer access exceeds the bounds
of the memory being accessed.

Because of how LLVM currently implements these buffer operations (as
opaque intrinsics), the backend cannot optimize out this known
behavior and eliminate the memory operations. Therefore, use MLIR's
canonicalization system to eliminate these operations.

Reviewed By: nirvedhmeshram

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

19 months ago[AArch64][SME] Always allocate a lazy-save buffer if a function has ZA state.
Sander de Smalen [Mon, 21 Nov 2022 16:01:54 +0000 (16:01 +0000)]
[AArch64][SME] Always allocate a lazy-save buffer if a function has ZA state.

We already do this for most cases, with the exception of instructions that
get expanded to function calls (e.g. for lowering operations on fp128
values), in which case we temporarily allocate a lazy-save buffer.

The code that is generated in this case, is however incorrect, as it seems
to pass an incorrect address for the TPIDR2 object to the ZA restore
function. By always allocating the lazy-save buffer once, we avoid this
issue entirely.

The cost is that we also allocate such a buffer when it is not
needed. We could fix that in a follow-up patch, where we remove the
lazy-save buffer when it isn't used.

Reviewed By: paulwalker-arm

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

19 months ago[test][lldb-vscode] Un-realpath coreFile test.
Jordan Rupprecht [Mon, 21 Nov 2022 16:32:49 +0000 (08:32 -0800)]
[test][lldb-vscode] Un-realpath coreFile test.

TestVSCode_coreFile looks for an exe/core file in the same directory as the test. It first calls `realpath`, but I don't think it's necessary. Using `realpath` prevents this test from working when run as part of a build system that uses content-addressed-storage, i.e. all the files might all be symlinks in the same directory pointing to files in different directories elsewhere. If some amount of normalization is needed, maybe `os.path.normpath()` would be useful, although I wouldn't see why that's needed either.

(This is a fairly trivial patch, but I'm mailing it to see if there is a reason we need to keep `realpath`, and if so, if there's some other workaround we can do).

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

19 months ago[FPEnv] Enable strict fp for AArch64 in clang
John Brawn [Wed, 26 Oct 2022 13:00:45 +0000 (14:00 +0100)]
[FPEnv] Enable strict fp for AArch64 in clang

The AArch64 target now has the necessary support for strict fp, so
enable it in clang.

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

19 months ago[libc++][NFC] Add link to GCC bug report in <limits.h> workaround
Louis Dionne [Mon, 21 Nov 2022 16:01:13 +0000 (11:01 -0500)]
[libc++][NFC] Add link to GCC bug report in <limits.h> workaround

19 months ago[lld/ELF] Make plugin-opt=jobs= help text refer to --thinlto-jobs=
Nico Weber [Mon, 21 Nov 2022 15:55:39 +0000 (10:55 -0500)]
[lld/ELF] Make plugin-opt=jobs= help text refer to --thinlto-jobs=

19 months ago[flang] Accept BaseBoxType in couple of fir.array_* operations
Valentin Clement [Mon, 21 Nov 2022 15:53:48 +0000 (16:53 +0100)]
[flang] Accept BaseBoxType in couple of fir.array_* operations

Couple of operation are expecting BoxType but can totally handle
ClassType as well. This patch updates couple of locations to support
BaseBoxType instead of BoxType only.

Reviewed By: jeanPerier, PeteSteinfeld

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

19 months ago[lld/ELF] Fix grammar-o in a help string
Nico Weber [Mon, 21 Nov 2022 15:54:01 +0000 (10:54 -0500)]
[lld/ELF] Fix grammar-o in a help string

19 months ago[lld/ELF] Rename OPT_thinlto_jobs to OPT_thinlto_jobs_eq
Nico Weber [Mon, 21 Nov 2022 15:53:10 +0000 (10:53 -0500)]
[lld/ELF] Rename OPT_thinlto_jobs to OPT_thinlto_jobs_eq

The flag ends with a `=`, so its name should end with `_eq`.
No behavior change.

19 months ago[Assignment Tracking][25/*] Replace sunk address uses in dbg.assign intrinsics
OCHyams [Mon, 21 Nov 2022 15:46:52 +0000 (15:46 +0000)]
[Assignment Tracking][25/*] Replace sunk address uses in dbg.assign intrinsics

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

Reviewed By: StephenTozer

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

19 months ago[clangd] Add option to skip per-location checks.
Sam McCall [Mon, 21 Nov 2022 15:41:53 +0000 (16:41 +0100)]
[clangd] Add option to skip per-location checks.

This avoids a slow step after timing tidy checks for https://github.com/clangd/clangd/issues/1337

19 months ago[clangd] Move --check options into Check.cpp. Add --check-completion.
Sam McCall [Mon, 21 Nov 2022 15:37:32 +0000 (16:37 +0100)]
[clangd] Move --check options into Check.cpp. Add --check-completion.

This is less plumbing and clutter in ClangdMain.cpp.
Having --check-lines imply completion was just about minimizing plumbing
I think, so make that explicit.

19 months ago[X86] Pre-commit tests for pr58685 (negated cases)
Phoebe Wang [Mon, 21 Nov 2022 15:23:12 +0000 (23:23 +0800)]
[X86] Pre-commit tests for pr58685 (negated cases)

19 months ago[clangd] Extend --check to time clang-tidy checks, so we can block slow ones
Sam McCall [Mon, 17 Oct 2022 14:38:11 +0000 (16:38 +0200)]
[clangd] Extend --check to time clang-tidy checks, so we can block slow ones

misc-const-correctness is so catastrophically slow that we need to block it
from running. But we need a way to detect this without breaking users first.

This is part of a plan to run only fast checks by default.
More details in  https://github.com/clangd/clangd/issues/1337

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

19 months ago[XCOFF] llvm-readobj support display symbol table of loader section of xcoff object...
zhijian [Mon, 21 Nov 2022 15:11:12 +0000 (10:11 -0500)]
[XCOFF] llvm-readobj support display symbol table of loader section of xcoff object file.

Reviewers: James Henderson, Esme Yi

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

19 months ago[LoopFlatten] Add a test for incorrect IV increment uses. NFC
David Green [Mon, 21 Nov 2022 15:05:44 +0000 (15:05 +0000)]
[LoopFlatten] Add a test for incorrect IV increment uses. NFC

These are a couple of test cases from 58441, showing LCSSA uses on
the IV increment. Part of D138404.

19 months ago[NFC][InstCombine] Pre-commit tests for D137934
Thomas Symalla [Mon, 21 Nov 2022 15:04:26 +0000 (16:04 +0100)]
[NFC][InstCombine] Pre-commit tests for D137934

Various InstCombine tests to show diffs with the new
extractelement / select folding.

19 months ago[libc++][NFC] Rename folder for char_traits<wchar_t> tests
Louis Dionne [Mon, 21 Nov 2022 14:48:18 +0000 (09:48 -0500)]
[libc++][NFC] Rename folder for char_traits<wchar_t> tests

19 months ago[mlir][bufferization] Support general Attribute as memory space
Lei Zhang [Mon, 21 Nov 2022 14:33:13 +0000 (09:33 -0500)]
[mlir][bufferization] Support general Attribute as memory space

MemRef has been accepting a general Attribute as memory space for
a long time. This commits updates bufferization side to catch up,
which allows downstream users to plugin customized symbolic memory
space. This also eliminates quite a few `getMemorySpaceAsInt`
calls, which is deprecated.

Reviewed By: springerm

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

19 months agoRemove -cc1 -fconcepts-ts flag
Erich Keane [Mon, 21 Nov 2022 14:30:47 +0000 (06:30 -0800)]
Remove -cc1 -fconcepts-ts flag

The -fconcepts-ts flag has been deprecated for 5 releases now, so just
remove it, concepts is supported in C++20 mode.

19 months ago[DAGCombiner] fold or (and x, y), x --> x
chenglin.bi [Mon, 21 Nov 2022 14:10:55 +0000 (22:10 +0800)]
[DAGCombiner] fold or (and x, y), x --> x

Reviewed By: RKSimon

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

19 months ago[llvm,polly,clang] Stop setting config.enable_shared in most places
Nico Weber [Fri, 18 Nov 2022 15:47:34 +0000 (10:47 -0500)]
[llvm,polly,clang] Stop setting config.enable_shared in most places

Clang's lit.cfg.py reads this to add an "enable-shared" feature that
three of clang's lit tests use. Nothing else reads enable_shared, so
remove it from most lit.site.cfg.py.in files.

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

19 months ago[AArch64][SVE] Precommit tests for VSCALE/SVE CNTx demanded bits
Benjamin Maxwell [Mon, 21 Nov 2022 13:22:03 +0000 (13:22 +0000)]
[AArch64][SVE] Precommit tests for VSCALE/SVE CNTx demanded bits

19 months ago[libc++] Remove workarounds for systems that used to require __need_XXX macros
Louis Dionne [Mon, 8 Aug 2022 18:06:40 +0000 (14:06 -0400)]
[libc++] Remove workarounds for systems that used to require __need_XXX macros

Libc++ tried accomodating systems that need to be able to define various
__need_FOO macros before including C library headers, however it does not
appear to be needed anymore in most cases. Indeed, glibc used to use that
system to conditionally provide definitions, however almost all instances
of these macros have been removed from glibc years ago.

I think the next step would be to also fix Clang's own builtin headers
to stop needing these macros.

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

19 months agoMerge kDynamicSize and kDynamicSentinel into one constant.
Aliia Khasanova [Fri, 18 Nov 2022 18:00:10 +0000 (18:00 +0000)]
Merge kDynamicSize and kDynamicSentinel into one constant.

resolve conflicts

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

19 months ago[X86][NFC] Minor improvement in X86InstrInfo::optimizeCompareInstr
Shengchen Kan [Mon, 21 Nov 2022 12:59:22 +0000 (20:59 +0800)]
[X86][NFC] Minor improvement in X86InstrInfo::optimizeCompareInstr

Before this patch, the code enumerated `getCondFromBranch`, `getCondFromSETCC` and `getCondFromFromCMov` to get the condition code of a `MachineInstr`, and assigned the result to variable `OldCC` when `MI || IsSwapped || ImmDelta != 0` was satisfiled.

After this patch, the `if-else` structure is eliminated by using `getCondFromMI`. Since `OldCC` is only used when  `MI || IsSwapped || ImmDelta != 0`  is true, it is initialized with `getCondFromMI` directly outside the scope of `if` now.

Reviewed By: pengfei

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

19 months ago[NFC][IndVars] Add LLVM_DEBUG printout to replaceExitCond
Max Kazantsev [Mon, 21 Nov 2022 12:18:53 +0000 (19:18 +0700)]
[NFC][IndVars] Add LLVM_DEBUG printout to replaceExitCond

19 months ago[lldb] Enable TestTargetVar on non-darwin
Pavel Labath [Mon, 21 Nov 2022 12:13:34 +0000 (13:13 +0100)]
[lldb] Enable TestTargetVar on non-darwin

19 months ago[clang-format][NFC] Removed unused include
Björn Schäpers [Sun, 20 Nov 2022 14:08:28 +0000 (15:08 +0100)]
[clang-format][NFC] Removed unused include

19 months ago[clang-format][NFC] Don't add a load of 0es
Björn Schäpers [Sat, 19 Nov 2022 16:22:09 +0000 (17:22 +0100)]
[clang-format][NFC] Don't add a load of 0es

Shift is 0 for all non comments, maybe even for comments. Don't add the
0 up to three times.

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

19 months ago[clang-format][NFC] Format lambda in conditional
Björn Schäpers [Thu, 17 Nov 2022 20:07:31 +0000 (21:07 +0100)]
[clang-format][NFC] Format lambda in conditional

This sort of amends cdbe296853b1b3fc6415236f05770360e23f0d39

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

19 months ago[clang-format][NFC] Remove unneeded braces
Björn Schäpers [Thu, 17 Nov 2022 20:01:50 +0000 (21:01 +0100)]
[clang-format][NFC] Remove unneeded braces

Done by clang-format itself.

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

19 months ago[mlir][linalg] Change linalg.broadcast `dimensions` attribute to represent added...
Oleg Shyshkov [Mon, 21 Nov 2022 12:15:50 +0000 (13:15 +0100)]
[mlir][linalg] Change linalg.broadcast `dimensions` attribute to represent added dimensions.

Original [RFC](discourse.llvm.org/t/rfc-primitive-ops-add-broadcastop-to-linalg/66313) defined `dimensions` as a map from input to init, but a discussion in reviews.llvm.org/D138291 concluded that it's more natural for `dimensions` to represent added dims. Also this way is more consistent with `linalg.reduce`.

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

19 months agoMark test using -debug-only as requiring assertions
Benjamin Kramer [Mon, 21 Nov 2022 10:46:02 +0000 (11:46 +0100)]
Mark test using -debug-only as requiring assertions

19 months ago[MachineTraceMetrics] Pick the trace successor for an entry block
Anton Sidorenko [Fri, 18 Nov 2022 09:33:02 +0000 (12:33 +0300)]
[MachineTraceMetrics] Pick the trace successor for an entry block

We generate erroneous trace for a basic block if it does not have at least one
predecessor when MinInstr strategy is used. Currently only this strategy is
implemented, so we always have a wrong trace for any entry block. This results in
wrong instructions heights calculation and also leads to wrong critical path.

The described behavior is demonstrated on a simple test. It shows that early
if-conv pass makes wrong decisions due to incorrectly calculated critical path
lenght.

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

19 months ago[MachineTraceMetrics] Precommit test for D138272
Anton Sidorenko [Fri, 18 Nov 2022 09:31:28 +0000 (12:31 +0300)]
[MachineTraceMetrics] Precommit test for D138272

19 months ago[libc][test][NFC] bump mpfr version to 4.1.1
Guillaume Chatelet [Mon, 21 Nov 2022 09:38:42 +0000 (09:38 +0000)]
[libc][test][NFC] bump mpfr version to 4.1.1

19 months ago[mlir] bazel for D137997
Alex Zinenko [Mon, 21 Nov 2022 09:20:19 +0000 (10:20 +0100)]
[mlir] bazel for D137997

19 months ago[Test] Add some test showing limitations of makeIVComparisonInvariant
Max Kazantsev [Mon, 21 Nov 2022 09:19:01 +0000 (16:19 +0700)]
[Test] Add some test showing limitations of makeIVComparisonInvariant

The transform doesn't work if argument isn't immediately a Phi.

19 months ago[flang] Add hlfir.designate codegen for Fortran ArrayRef
Jean Perier [Mon, 21 Nov 2022 09:04:28 +0000 (10:04 +0100)]
[flang] Add hlfir.designate codegen for Fortran ArrayRef

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

19 months ago[flang][NFC] Update TODOs list
Valentin Clement [Mon, 21 Nov 2022 09:04:58 +0000 (10:04 +0100)]
[flang][NFC] Update TODOs list

19 months ago[ELF] InputFile: change symbols to unique_ptr<Symbol *[]>
Fangrui Song [Mon, 21 Nov 2022 09:02:04 +0000 (09:02 +0000)]
[ELF] InputFile: change symbols to unique_ptr<Symbol *[]>

We may try a custom allocator in the future.

19 months ago[flang] Add fir.select_type conversion to if-then-else ladder
Valentin Clement [Mon, 21 Nov 2022 09:00:17 +0000 (10:00 +0100)]
[flang] Add fir.select_type conversion to if-then-else ladder

Convert fir.select_type operation to an if-then-else ladder.
The type guards are sorted before the conversion so it follows the
execution of SELECT TYPE construct as mentioned in 11.1.11.2 point 4
of the Fortran standard.

Depends on D138279

Reviewed By: jeanPerier

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

19 months ago[LoongArch] AsmParser support for the li.[wd] pseudo instructions
wanglei [Mon, 21 Nov 2022 07:36:28 +0000 (15:36 +0800)]
[LoongArch] AsmParser support for the li.[wd] pseudo instructions

The `li.[wd]` pseudo instructions are used to load an immediate value
into a GPR. These expand directly during asm parsing. As the result,
only real MC instructions are emitted to the MCStreamer. The actual
expansion to real instructions is similar to the expansion performed by
the GAS.

Note: The `li.w` always treats the imm operand as a 32-bit signed value.

Reviewed By: SixWeining

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

19 months ago[RISCV] Enable reduction pattern SelectICmp and SelectFCmp.
Mel Chen [Mon, 14 Nov 2022 13:54:37 +0000 (05:54 -0800)]
[RISCV] Enable reduction pattern SelectICmp and SelectFCmp.

Reviewed By: david-arm

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

19 months ago[llvm] Use Optional::operator-> (NFC)
Kazu Hirata [Mon, 21 Nov 2022 08:15:35 +0000 (00:15 -0800)]
[llvm] Use Optional::operator-> (NFC)

Since std::optional does not offer getPointer(), this patch replaces
X.getPointer()->foo with X->foo to make the migration from
llvm::Optional to std::optional easier.

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

19 months ago[Test] One more test for IndVars, showing imperfect work with context
Max Kazantsev [Mon, 21 Nov 2022 08:14:28 +0000 (15:14 +0700)]
[Test] One more test for IndVars, showing imperfect work with context

19 months ago[mlir][test] Fix how the number of flops is calculated
Andrzej Warzynski [Mon, 21 Nov 2022 07:15:26 +0000 (12:45 +0530)]
[mlir][test] Fix how the number of flops is calculated

Make sure that the number of repetitions is correctly incorporated when
calculating the number of floating point operations.

Reviewed By: bondhugula

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

19 months ago[MLIR][Transform] Transform dialect support for affine
Amy Wang [Sat, 19 Nov 2022 13:27:54 +0000 (14:27 +0100)]
[MLIR][Transform] Transform dialect support for affine

Create the directory and file structures to support transform ops for
the affine dialect in the future.  Enable affine.unroll and affine.get_parent_for
transform operations in this first batch of check in.

Reviewed By: ftynse

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

19 months ago[LoongArch] Support parsing la* pseudo instructions
wanglei [Mon, 21 Nov 2022 07:13:10 +0000 (15:13 +0800)]
[LoongArch] Support parsing la* pseudo instructions

This patch makes `IAS` compatible with `GAS`. It accepts `la*` pseudo
instructions, and expands `la{,.local,.global}` into different
instructions according to different features.

```
 Default:
     la = la.global = la.got
     la.local = la.pcrel
 With feature "+la-global-with-pcrel":
     la = la.global = la.pcrel
 With feature "+la-global-with-abs":
     la = la.global = la.abs
 With feature "+la-local-with-abs":
     la.local = la.abs
 With features "+la-global-with-pcrel,+la-global-with-abs"(disorder):
     la = la.global = la.pcrel
```
Note: To keep consistent with `GAS` behavior, the "la" can only have
      one register operand.

Reviewed By: SixWeining

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

19 months ago[Test] Add some examples where IndVars fails to turn condition into invariant
Max Kazantsev [Mon, 21 Nov 2022 06:14:13 +0000 (13:14 +0700)]
[Test] Add some examples where IndVars fails to turn condition into invariant

19 months ago[Scalar] Teach matchExpandedRem to return std::optional (NFC)
Kazu Hirata [Mon, 21 Nov 2022 06:38:43 +0000 (22:38 -0800)]
[Scalar] Teach matchExpandedRem to return std::optional (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

19 months ago[PowerPC] XCOFF exception section support on the integrated assembler path
Paul Scoropan [Mon, 21 Nov 2022 05:16:26 +0000 (00:16 -0500)]
[PowerPC] XCOFF exception section support on the integrated assembler path

Continuation of https://reviews.llvm.org/D132146 (direct assembly path support, needs to merge first). Adds support to the integrated assembler path for emitting XCOFF exception sections. Both features need https://reviews.llvm.org/D133030 to merge first

Reviewed By: shchenz, DiggerLin

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

19 months ago[ELF] Simplify postScanRelocations with in.got
Fangrui Song [Mon, 21 Nov 2022 06:04:18 +0000 (06:04 +0000)]
[ELF] Simplify postScanRelocations with in.got

19 months agoRevert "Revert "[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary""
Christopher Di Bella [Mon, 21 Nov 2022 04:36:14 +0000 (04:36 +0000)]
Revert "Revert "[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary""

This reverts commit 196edb9f3f4a036371af0013a3d8b857fe0924d5.

19 months agoRevert "[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary"
Christopher Di Bella [Mon, 21 Nov 2022 04:34:56 +0000 (04:34 +0000)]
Revert "[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary"

This reverts commit eb3f7880a272b818940e2bd2510ae04b0e32873f.

19 months ago[ELF] Add InputSectionBase::{addRelocs,relocs} and GotSection::addConstant to add...
Fangrui Song [Mon, 21 Nov 2022 04:12:03 +0000 (04:12 +0000)]
[ELF] Add InputSectionBase::{addRelocs,relocs} and GotSection::addConstant to add/access relocations

to prepare for changing `relocations` from a SmallVector to a pointer.

Also change the `isec` parameter in `addAddendOnlyRelocIfNonPreemptible` to `GotSection &`.

19 months agoApply clang-tidy fixes for readability-identifier-naming in TosaValidation.cpp (NFC)
Mehdi Amini [Thu, 17 Nov 2022 09:43:07 +0000 (09:43 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in TosaValidation.cpp (NFC)

19 months agoApply clang-tidy fixes for modernize-use-equals-default in TosaValidation.cpp (NFC)
Mehdi Amini [Thu, 17 Nov 2022 09:42:32 +0000 (09:42 +0000)]
Apply clang-tidy fixes for modernize-use-equals-default in TosaValidation.cpp (NFC)

19 months ago[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary
Christopher Di Bella [Mon, 21 Nov 2022 03:44:11 +0000 (03:44 +0000)]
[clang-tblgen][NFC] renames Diagnostic.Text to Diagnostic.Summary

The [Improving Clang's Diagnostics RFC][1] identifies eight broad fields
for Clang to surface, two of which are text-based. Since the current
diagnostics more closely map to the diagnostic summary (or headline), we
should rename them to ensure that there's no confusion when
Diagnostic.Reason is introduced in the near future.

[1]: https://discourse.llvm.org/t/rfc-improving-clang-s-diagnostics/62584

Reviewed By: aaron.ballman, erichkeane

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

19 months ago[LoongArch] Make function name in error message consistent with the user input. NFC
gonglingqin [Mon, 21 Nov 2022 02:51:58 +0000 (10:51 +0800)]
[LoongArch] Make function name in error message consistent with the user input. NFC

19 months ago[CSKY] Lower ISD::ConstantPool node to support getting the address of ConstantPool...
Zi Xuan Wu (Zeson) [Mon, 21 Nov 2022 01:33:09 +0000 (09:33 +0800)]
[CSKY] Lower ISD::ConstantPool node to support getting the address of ConstantPool entry

When there is not GRS or MOVIH/ORI instruction, we can not get the address of
ConstantPool entry directly. So we need put the address into ConstantPool to leverage CSKY::LRW instruction.

19 months ago[LoongArch] Add intrinsics for ibar, break and syscall
gonglingqin [Mon, 21 Nov 2022 01:12:18 +0000 (09:12 +0800)]
[LoongArch] Add intrinsics for ibar, break and syscall

Diagnostics for intrinsic input parameters have also been added.

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

19 months ago[ELF] Don't ignore --detect-odr-violations
Fangrui Song [Mon, 21 Nov 2022 00:52:03 +0000 (00:52 +0000)]
[ELF] Don't ignore --detect-odr-violations

We don't implement the gold specific feature and it's inappropriate to ignore it.
The option is used by some projects under gold configure checks.

19 months ago[CMake][OpenMP] Remove -Wl,--warn-shared-textrel
Fangrui Song [Mon, 21 Nov 2022 00:37:32 +0000 (00:37 +0000)]
[CMake][OpenMP] Remove -Wl,--warn-shared-textrel

This option is legacy and is removed from GNU ld's doc (many binutils
distributions are configured with --enable-textrel-check=). lld ignores the
option.

19 months ago[ELF] Simplify InputSectionBase::getSize
Fangrui Song [Mon, 21 Nov 2022 00:02:36 +0000 (00:02 +0000)]
[ELF] Simplify InputSectionBase::getSize

19 months ago[ELF] Replace rawData+size with content_+size+compressedSize
Fangrui Song [Sun, 20 Nov 2022 23:22:32 +0000 (23:22 +0000)]
[ELF] Replace rawData+size with content_+size+compressedSize

compressedSize resides in an existing union. sizeof(InputSection) decreases from
160 to 152 on ELF64 systems.

19 months ago[ELF] Change rawData to content() and data() to contentMaybeDecompress()
Fangrui Song [Sun, 20 Nov 2022 22:43:22 +0000 (22:43 +0000)]
[ELF] Change rawData to content() and data() to contentMaybeDecompress()

Clarify data() which may trigger decompression and make it feasible to refactor
the member variable rawData.

19 months ago[clang] Remove unused forward declarations (NFC)
Kazu Hirata [Sun, 20 Nov 2022 22:32:17 +0000 (14:32 -0800)]
[clang] Remove unused forward declarations (NFC)

19 months ago[LLDB] Do not dereference promise pointer in `coroutine_handle` pretty printer
Adrian Vogelsgesang [Fri, 26 Aug 2022 13:00:43 +0000 (06:00 -0700)]
[LLDB] Do not dereference promise pointer in `coroutine_handle` pretty printer

So far, the pretty printer for `std::coroutine_handle` internally
dereferenced the contained frame pointer displayed the `promise`
as a sub-value. As noticed in https://reviews.llvm.org/D132624
by @labath, this can lead to an endless loop in lldb during printing
if the coroutine frame pointers form a cycle.

This commit breaks the cycle by exposing the `promise` as a pointer
type instead of a value type. The depth to which the `frame variable`
and the `expression` commands dereference those pointers can be
controlled using the `--ptr-depth` argument.

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

20 months ago[ELF] InputSectionBase: add bool compressed to avoid overloading size with compressed...
Fangrui Song [Sun, 20 Nov 2022 21:56:13 +0000 (21:56 +0000)]
[ELF] InputSectionBase: add bool compressed to avoid overloading size with compressed semantics

Rename uncompressedSize to size, to prepare for shrinking rawData+size from 3 words to 2 words.

20 months ago[Analysis] Remove getInverseMinMaxPred
Kazu Hirata [Sun, 20 Nov 2022 21:30:19 +0000 (13:30 -0800)]
[Analysis] Remove getInverseMinMaxPred

The last uses of getInverseMinMaxPred were removed on February 24,
2022 in commit 5423b0a52567b2fba8cbae3afee760f53c3f14d2.

20 months ago[ELF] Shuffle SectionBase fields. NFC
Fangrui Song [Sun, 20 Nov 2022 21:23:30 +0000 (21:23 +0000)]
[ELF] Shuffle SectionBase fields. NFC

Move frequently used fields (e.g. sectionKind, partition) to the top. My x86-64 lld executable is 600+B smaller.

20 months agoAdd version to all LLVM cmake package
Thomas Preud'homme [Thu, 17 Nov 2022 23:35:18 +0000 (23:35 +0000)]
Add version to all LLVM cmake package

Add a version to non-LLVM cmake package so that users needing an exact
version match can use the version parameter to find_package. Also adjust
the find_package(LLVM) to use an exact version match as well.

Reviewed By: arsenm, stellaraccident

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

20 months agoAdd a new top level statistic that tracks how many modules have variable errors.
Greg Clayton [Sun, 20 Nov 2022 17:40:23 +0000 (09:40 -0800)]
Add a new top level statistic that tracks how many modules have variable errors.

We have a statistic on each module named "debugInfoHadVariableErrors" which tracks when we have debug info, but an error prevented the variables from being displayed. This patch adds a new top level statistic named "totalModuleCountWithVariableErrors" which is a count of the modules that have "debugInfoHadVariableErrors" set to true.

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

20 months ago[ADT] Remove deperecated methods in OptionalStorage
Kazu Hirata [Sun, 20 Nov 2022 20:24:16 +0000 (12:24 -0800)]
[ADT] Remove deperecated methods in OptionalStorage

Note that I deprecated these methods on August 7, 2022 in commit
commit b5f8d42efe3e246d582d4a1a328fac915e4ce8dc.

20 months ago[ADT] Remove llvm::empty
Kazu Hirata [Sun, 20 Nov 2022 20:06:19 +0000 (12:06 -0800)]
[ADT] Remove llvm::empty

Note that I deprecated llvm::empty on September 18, 2022 in commit
6b49f30fca04ea3e4d57aef40e4bb6716a378870.

20 months ago[LV] Clean up LoopVectorizationCostModel::calculateRegisterUsage. NFC
Bjorn Pettersson [Sat, 19 Nov 2022 00:40:37 +0000 (01:40 +0100)]
[LV] Clean up LoopVectorizationCostModel::calculateRegisterUsage. NFC

Minor refactoring in LoopVectorizationCostModel::calculateRegisterUsage.

Also adding some FIXME:s related to what appears to be some short
comings related to how the register usage is calculated.

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

20 months ago[TableGen] Fix SubRegIndex size computation for concatenated subregs of unknown size
Bjorn Pettersson [Sat, 19 Nov 2022 00:16:11 +0000 (01:16 +0100)]
[TableGen] Fix SubRegIndex size computation for concatenated subregs of unknown size

When calculating the size of concatenated subregisters, and at least
one of the subregisters involved has an unknown size (-1), then the
concatenated size should be set to -1 as well.

This bug was found for an out-of-tree target.

Looking at lib/Target the only in-tree target that has a subregister
with unknown size is X86:
  X86RegisterInfo.td:  def sub_mask_0   : SubRegIndex<-1>;

But it looks like sub_mask_0 don't result in any concatenated subreg
index with faulty size if looking at X86SubRegIdxRanges[].

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

20 months ago[TableGen] Let -register-info-debug dump Offset/Size for each SubRegIndex
Bjorn Pettersson [Sat, 19 Nov 2022 00:00:57 +0000 (01:00 +0100)]
[TableGen] Let -register-info-debug dump Offset/Size for each SubRegIndex

This patch adds dumping of the Offset and Size info for each
SubRegIndex printed when using
  llvm-tblgen -gen-register-info -register-info-debug

It also updates the ConcatenatedSubregs.td to check those printouts,
including some new subreg definitions that show short-comings in
how the size is calculated when concatenating subregisters and at
least one has an incomplete size (-1). Today TableGen will just add
sizes together, resulting in MCRegisterInfo::getSubRegIdxSize()
returning a value that isn't -1 even if the combined subregister size
is unknown.

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

20 months ago[Support] Use std::is_convertible_v (NFC)
Kazu Hirata [Sun, 20 Nov 2022 19:52:04 +0000 (11:52 -0800)]
[Support] Use std::is_convertible_v (NFC)

20 months ago[ADT] Use std::is_copy_constructible_v (NFC)
Kazu Hirata [Sun, 20 Nov 2022 19:32:31 +0000 (11:32 -0800)]
[ADT] Use std::is_copy_constructible_v (NFC)

20 months ago[X86] IceLakeServer - PACKS instructions take latency 3cy
Simon Pilgrim [Sun, 20 Nov 2022 19:28:27 +0000 (19:28 +0000)]
[X86] IceLakeServer - PACKS instructions take latency 3cy

This appears to be a slow down vs Skylake (which the model was copied off) - confirmed with uops.info / instlatx64

Noticed as D138359 was reporting that many of the PACKS overrides were redundant, but were in fact incorrect

20 months ago[LLDB] Recognize `std::noop_coroutine()` in `std::coroutine_handle` pretty printer
Adrian Vogelsgesang [Thu, 25 Aug 2022 01:12:08 +0000 (18:12 -0700)]
[LLDB] Recognize `std::noop_coroutine()` in `std::coroutine_handle` pretty printer

With this commit, the `std::coroutine_handle` pretty printer now
recognizes `std::noop_coroutine()` handles. For noop coroutine handles,
we identify use the summary string `noop_coroutine` and we don't print
children

Instead of
```
(std::coroutine_handle<void>) $3 = coro frame = 0x555555559058 {
  resume = 0x00005555555564f0 (a.out`std::__1::coroutine_handle<std::__1::noop_coroutine_promise>::__noop_coroutine_frame_ty_::__dummy_resume_destroy_func() at noop_coroutine_handle.h:79)
  destroy = 0x00005555555564f0 (a.out`std::__1::coroutine_handle<std::__1::noop_coroutine_promise>::__noop_coroutine_frame_ty_::__dummy_resume_destroy_func() at noop_coroutine_handle.h:79)
}
```

we now print

```
(std::coroutine_handle<void>) $3 = noop_coroutine
```

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

20 months ago[libc++][NFC] Refactor run-buildbot to make it closer to our buildkite pipeline
Louis Dionne [Fri, 18 Nov 2022 21:17:10 +0000 (16:17 -0500)]
[libc++][NFC] Refactor run-buildbot to make it closer to our buildkite pipeline

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

20 months ago[ADT] Remove deprecated `llvm::array_lengthof`
Joe Loser [Sun, 20 Nov 2022 05:01:29 +0000 (22:01 -0700)]
[ADT] Remove deprecated `llvm::array_lengthof`

`llvm::array_lengthof` was marked deprecated a bit over two months ago in
5758c824dab4851fd061201483987b338c051417.  Now, finally remove it.  Since this
function was the only one in `STLArrayExtras.h`, get rid of the whole header.

D118342 (2022-01) moved the function to `STLArrayExtras.h`. This function should
have very few users now (MaskRay made some downstream inspection in
https://reviews.llvm.org/D133502#3777981). D133502 deprecated the function.

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

20 months ago[ADT] Simplify determining size for joining items
Joe Loser [Sun, 20 Nov 2022 05:11:18 +0000 (22:11 -0700)]
[ADT] Simplify determining size for joining items

`join_items_size` uses recursive function templates for determining the total
items size.  Instead, use fold expressions since we have C++17 available now.

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

20 months ago[lldb] Fix test expectation in `TestCoroutineHandle.py` for 32-bit systems
Adrian Vogelsgesang [Sun, 20 Nov 2022 14:52:15 +0000 (06:52 -0800)]
[lldb] Fix test expectation in `TestCoroutineHandle.py` for 32-bit systems

20 months ago[llvm] Remove unused forward declarations (NFC)
Kazu Hirata [Sun, 20 Nov 2022 17:59:36 +0000 (09:59 -0800)]
[llvm] Remove unused forward declarations (NFC)

20 months ago[Clang] Add papers approved in Kona by WG21 to the C++ status page
Corentin Jabot [Sun, 20 Nov 2022 17:51:52 +0000 (18:51 +0100)]
[Clang] Add papers approved in Kona by WG21 to the C++ status page

Approved core issues will be updated separately through an update
of the defect report list when a new core issue list is
published.

20 months ago[MCA][X86] Add missing test coverage for BWI instructions
Simon Pilgrim [Sun, 20 Nov 2022 17:19:50 +0000 (17:19 +0000)]
[MCA][X86] Add missing test coverage for BWI instructions

20 months ago[MCA][X86] Add test coverage for IFMA instructions
Simon Pilgrim [Sun, 20 Nov 2022 16:00:26 +0000 (16:00 +0000)]
[MCA][X86] Add test coverage for IFMA instructions

20 months ago[gn build] port af8c49dc1ec4
Nico Weber [Sun, 20 Nov 2022 17:02:33 +0000 (12:02 -0500)]
[gn build] port af8c49dc1ec4

20 months ago[libc++] Introduce a setting to remove fstream from the library
Louis Dionne [Fri, 18 Nov 2022 20:01:33 +0000 (15:01 -0500)]
[libc++] Introduce a setting to remove fstream from the library

This allows porting the library to platforms that are able to support
<iostream> but that do not have a notion of a filesystem, and where it
hence doesn't make sense to support std::fstream (and never will).

Also, remove reliance on <fstream> in various tests that didn't
actually need it.

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

20 months ago[LLD][COFF] Survive empty and invalid PCH signature
Alexandre Ganea [Sun, 20 Nov 2022 15:24:02 +0000 (10:24 -0500)]
[LLD][COFF] Survive empty and invalid PCH signature

Solve two issues that showed up when using LLD with Unreal Engine & FASTBuild:
1. It seems the S_OBJNAME record doesn't always record the "precomp signature". We were relying on that to match the PCH.OBJ with their dependent-OBJ.
2. MSVC link.exe is able to link a PCH.OBJ when the "precomp signatureÈ doesn't match, but LLD was failing. This was occuring since the Unreal Engine Build Tool was compiling the PCH.OBJ, but the dependent-OBJ were compiled & cached through FASTBuild. Upon a clean rebuild, the PCH.OBJs were recompiled by the Unreal Build Tool, thus the "precomp signatures" were changing; however the OBJs were already cached by FASTBuild, thus having an old "precomp signatures".

We now ignore "precomp signatures" and properly fallback to cmd-line name lookup, like MSVC link.exe does, and only fail if the PCH.OBJ type stream doesn't match the count expected by the dependent-OBJ.

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

20 months ago[X86] Fix atomic rmw intrinsic expansion for non-opaque pointers
Benjamin Kramer [Sun, 20 Nov 2022 14:24:14 +0000 (15:24 +0100)]
[X86] Fix atomic rmw intrinsic expansion for non-opaque pointers

This is a bit annoying, but there are still users out there that got
broken by this (this time it was numba). We need to keep some barebones
support around until non-opaque pointers are completely gone.

20 months agoReapply "[LLDB] Devirtualize coroutine promise types for `std::coroutine_handle`"
Adrian Vogelsgesang [Wed, 24 Aug 2022 03:53:00 +0000 (20:53 -0700)]
Reapply "[LLDB] Devirtualize coroutine promise types for `std::coroutine_handle`"

The original commit was missing a `ClangASTImporter::CopyType` call.
Original commit message:

This commit teaches the `std::coroutine_handle` pretty-printer to
devirtualize type-erased promise types. This is particularly useful to
resonstruct call stacks, either of asynchronous control flow or of
recursive invocations of `std::generator`. For the example recently
introduced by https://reviews.llvm.org/D132451, printing the `__promise`
variable now shows

```
(std::__coroutine_traits_sfinae<task, void>::promise_type) __promise = {
  continuation = coro frame = 0x555555562430 {
    resume = 0x0000555555556310 (a.out`task detail::chain_fn<1>() at llvm-nested-example.cpp:66)
    destroy = 0x0000555555556700 (a.out`task detail::chain_fn<1>() at llvm-nested-example.cpp:66)
    promise = {
      continuation = coro frame = 0x5555555623e0 {
        resume = 0x0000555555557070 (a.out`task detail::chain_fn<2>() at llvm-nested-example.cpp:66)
        destroy = 0x0000555555557460 (a.out`task detail::chain_fn<2>() at llvm-nested-example.cpp:66)
        promise = {
          ...
        }
      }
      result = 0
    }
  }
  result = 0
}
```

(shortened to keep the commit message readable) instead of

```
(std::__coroutine_traits_sfinae<task, void>::promise_type) __promise = {
  continuation = coro frame = 0x555555562430 {
    resume = 0x0000555555556310 (a.out`task detail::chain_fn<1>() at llvm-nested-example.cpp:66)
    destroy = 0x0000555555556700 (a.out`task detail::chain_fn<1>() at llvm-nested-example.cpp:66)
  }
  result = 0
}
```

Note how the new debug output reveals the complete asynchronous call
stack: our own function resumes `chain_fn<1>` which in turn will resume
`chain_fn<2>` and so on. Thereby this change allows users of lldb to
inspect the logical coroutine call stack without using any custom debug
scripts (although the display is still a bit clumsy. It would be nicer
to also integrate this into lldb's backtrace feature, but I don't know
how to do so)

The devirtualization currently works by introspecting the function
pointed to by the `destroy` pointer. (The `resume` pointer is not worth
much, given that for the final suspend point `resume` is set to a
nullptr. We have to use the `destroy` pointer instead.) We then look
for a `__promise` variable inside the `destroy` function. This
`__promise` variable is synthetically generated by LLVM, and looking at
its type reveals the type-erased promise_type.

This approach only works for clang-generated code, though. While gcc
also adds a `_Coro_promise` variable to the `resume` function, it does
not do so for the `destroy` function. However, we can't use the `resume`
function, as it will be reset to a nullptr at the final suspension
point. For the time being, I am happy with de-virtualization only working
for clang. A follow-up commit will further improve devirtualization and
also expose the variables spilled to the coroutine frame. As part of
this, I will also revisit gcc support.

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

20 months ago[X86] Remove unnecessary SHLD32rri8/SHRD16rri8 instruction override from bdver2 model
Simon Pilgrim [Sun, 20 Nov 2022 14:17:44 +0000 (14:17 +0000)]
[X86] Remove unnecessary SHLD32rri8/SHRD16rri8 instruction override from bdver2 model

Reported by D138359 - the override matches the WriteSHDrri base sched def

20 months ago[X86] Remove unnecessary XGETBV instruction overrides from znver1/znver2 models
Simon Pilgrim [Sun, 20 Nov 2022 14:05:05 +0000 (14:05 +0000)]
[X86] Remove unnecessary XGETBV instruction overrides from znver1/znver2 models

Reported by D138359 - znver models already treats all WriteSystem sched instructions as microcoded

20 months ago[MCA][X86] Add test coverage for XSAVE instructions
Simon Pilgrim [Sun, 20 Nov 2022 13:56:04 +0000 (13:56 +0000)]
[MCA][X86] Add test coverage for XSAVE instructions