platform/upstream/llvm.git
2 years ago[lib++][ranges][NFC] Refactor `iterator_operations.h` to use tags.
Konstantin Varlamov [Wed, 13 Jul 2022 00:52:14 +0000 (17:52 -0700)]
[lib++][ranges][NFC] Refactor `iterator_operations.h` to use tags.

Change the mechanism in `iterator_operations.h` to pass around a generic
policy tag indicating whether an internal function is being invoked from
a "classic" STL algorithm or a ranges algorithm. `IterOps` is now
a template class specialized on the policy tag.

The advantage is that this mechanism is more generic and allows defining
arbitrary conditions in a clean manner.

Also add a few more iterator functions to `IterOps`.

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

2 years ago[NFCI] Fix unused variable warning with asserts off in clang/lib/Sema/TypeLocBuilder.cpp
Jorge Gorbe Moya [Wed, 13 Jul 2022 00:40:41 +0000 (17:40 -0700)]
[NFCI] Fix unused variable warning with asserts off in clang/lib/Sema/TypeLocBuilder.cpp

2 years ago[clang] Implement ElaboratedType sugaring for types written bare
Matheus Izvekov [Mon, 11 Oct 2021 16:15:36 +0000 (18:15 +0200)]
[clang] Implement ElaboratedType sugaring for types written bare

Without this patch, clang will not wrap in an ElaboratedType node types written
without a keyword and nested name qualifier, which goes against the intent that
we should produce an AST which retains enough details to recover how things are
written.

The lack of this sugar is incompatible with the intent of the type printer
default policy, which is to print types as written, but to fall back and print
them fully qualified when they are desugared.

An ElaboratedTypeLoc without keyword / NNS uses no storage by itself, but still
requires pointer alignment due to pre-existing bug in the TypeLoc buffer
handling.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D112374

2 years ago[NFCI] Fix unused variable/function warnings in MacroCallReconstructorTest.cpp when...
Jorge Gorbe Moya [Tue, 12 Jul 2022 23:46:07 +0000 (16:46 -0700)]
[NFCI] Fix unused variable/function warnings in MacroCallReconstructorTest.cpp when asserts are disabled.

2 years ago[LinkerWrapper] Tweak save-temps output name
Joseph Huber [Tue, 12 Jul 2022 23:40:54 +0000 (19:40 -0400)]
[LinkerWrapper] Tweak save-temps output name

Summary:
A previous patch added the Task to the output filename when doing
`save-temps` the majority of cases there is only a single task so we
only add the task explicitly to differentiate it from the first one.

2 years agoRevert "[dsymutil] Account for DW_OP_convert being CU relative"
Nico Weber [Tue, 12 Jul 2022 23:36:21 +0000 (19:36 -0400)]
Revert "[dsymutil] Account for DW_OP_convert being CU relative"

This reverts commit 7f3000fa8b321f7fae169a615734de74a737b5d4.
Breaks tests on Windows, see commits on https://reviews.llvm.org/rG7f3000fa

2 years ago[trace] Avoid a crash in the dumper when disassembling fails
Walter Erquinigo [Tue, 12 Jul 2022 19:41:30 +0000 (12:41 -0700)]
[trace] Avoid a crash in the dumper when disassembling fails

In rare situations, disassemblying would fail that produce an invalid
InstructionSP object. We need to check that it's valid before using.

With this change, now the dumper doesn't crash with dumping instructions of
ioctl. In fact, it now dumps this output

 {
    "id": 6135,
    "loadAddress": "0x7f4bfe5c7515",
    "module": "libc.so.6",
    "symbol": "ioctl",
    "source": "glibc/2.34/src/glibc-2.34/sysdeps/unix/syscall-template.S",
    "line": 120,
    "column": 0
 }

Anyway, we need to investigate why the diassembler failed disassembling that
instruction. From over 2B instructions I was disassembling today, just this
one failed, so this could be a bug in LLVM's core disassembler.

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

2 years ago[trace] Add a flag to the decoder to output the instruction type
Walter Erquinigo [Tue, 12 Jul 2022 23:09:03 +0000 (16:09 -0700)]
[trace] Add a flag to the decoder to output the instruction type

To build complex binding upon instruction trace, additional metadata 'instruction type' is needed.

This diff has followings:
 - Add a flag -k  / --kind for instruction dump
 - Remove SetGranularity and SetIgnoreErros from Trace cursor

Sample output:

```
(lldb) thread trace dump instruction -k
thread #1: tid = 3198805
  libc.so.6`_IO_puts + 356
    2107: 0x00007ffff7163594 (    return)     retq
    2106: 0x00007ffff7163592 (     other)     popq   %r13
    2105: 0x00007ffff7163590 (     other)     popq   %r12
    2104: 0x00007ffff716358f (     other)     popq   %rbp
    2103: 0x00007ffff716358e (     other)     popq   %rbx
    2102: 0x00007ffff716358c (     other)     movl   %ebx, %eax
    2101: 0x00007ffff7163588 (     other)     addq   $0x8, %rsp
    2100: 0x00007ffff7163570 ( cond jump)     je     0x89588                   ; <+344>
    2099: 0x00007ffff716356e (     other)     decl   (%rdx)
    2098: 0x00007ffff7163565 ( cond jump)     je     0x8956e                   ; <+318>
    2097: 0x00007ffff716355e (     other)     cmpl   $0x0, 0x33c02b(%rip)      ; __libc_multiple_threads
    2096: 0x00007ffff7163556 (     other)     movq   $0x0, 0x8(%rdx)
    2095: 0x00007ffff7163554 ( cond jump)     jne    0x89588                   ; <+344>
    2094: 0x00007ffff7163550 (     other)     subl   $0x1, 0x4(%rdx)
    2093: 0x00007ffff7163549 (     other)     movq   0x88(%rbp), %rdx
    2092: 0x00007ffff7163547 ( cond jump)     jne    0x89588                   ; <+344>
    2091: 0x00007ffff7163540 (     other)     testl  $0x8000, (%rbp)           ; imm = 0x8000
    2090: 0x00007ffff716353c (     other)     cmovaq %rax, %rbx
    2089: 0x00007ffff7163535 (     other)     cmpq   $0x7fffffff, %rbx         ; imm = 0x7FFFFFFF
    2088: 0x00007ffff7163530 (     other)     movl   $0x7fffffff, %eax         ; imm = 0x7FFFFFFF
```

Reviewed By: wallace

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

2 years ago[mlir][vector] Fix crash in vector.reduction canonicalization
Thomas Raoux [Tue, 12 Jul 2022 22:44:39 +0000 (22:44 +0000)]
[mlir][vector] Fix crash in vector.reduction canonicalization

since vector.reduce support accumulator in all the cases remove the
assert assuming old definition.

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

2 years agoAdd coverage for missing (urem x, (lshr pow2, y)) -> (and x, (add (lshr pow2, y)...
Philip Reames [Tue, 12 Jul 2022 22:59:25 +0000 (15:59 -0700)]
Add coverage for missing (urem x, (lshr pow2, y)) -> (and x, (add (lshr pow2, y), -1)) transform

2 years ago[ADT] Use Empty Base Optimization for Allocators
Nathan James [Tue, 12 Jul 2022 22:57:03 +0000 (23:57 +0100)]
[ADT] Use Empty Base Optimization for Allocators

In D94439, BumpPtrAllocator changed its implementation to use an empty base optimization for the underlying allocator.
This patch builds on that by extending its functionality to more classes as well as enabling the underlying allocator to be a reference type, something not currently possible as you can't derive from a reference.

The main place this sees use is in StringMaps which often use the default MallocAllocator, yet have to pay the size of a pointer for no reason.

Reviewed By: dblaikie

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

2 years ago{RISCV] Test coverage for improved lowering assuming vscale is pow-of-two
Philip Reames [Tue, 12 Jul 2022 22:40:17 +0000 (15:40 -0700)]
{RISCV] Test coverage for improved lowering assuming vscale is pow-of-two

2 years agoRevert "[Clang] Add a warning on invalid UTF-8 in comments."
Jonas Devlieghere [Tue, 12 Jul 2022 22:16:14 +0000 (15:16 -0700)]
Revert "[Clang] Add a warning on invalid UTF-8 in comments."

This reverts commit cc309721d20c8e544ae7a10a66735ccf4981a11c because it
breaks the following tests on GreenDragon:

  TestDataFormatterObjCCF.py
  TestDataFormatterObjCExpr.py
  TestDataFormatterObjCKVO.py
  TestDataFormatterObjCNSBundle.py
  TestDataFormatterObjCNSData.py
  TestDataFormatterObjCNSError.py
  TestDataFormatterObjCNSNumber.py
  TestDataFormatterObjCNSURL.py
  TestDataFormatterObjCPlain.py
  TestDataFormatterObjNSException.py

https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/45288/

2 years ago[mlir][VectorToLLVM] Fix bug in lowering of vector.reduce fmax/fmin
Thomas Raoux [Tue, 12 Jul 2022 21:38:10 +0000 (21:38 +0000)]
[mlir][VectorToLLVM] Fix bug in lowering of vector.reduce fmax/fmin

The lowering of fmax/fmin reduce was ignoring the optional accumulator.

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

2 years ago[dsymutil] Account for DW_OP_convert being CU relative
Jonas Devlieghere [Tue, 12 Jul 2022 21:18:19 +0000 (14:18 -0700)]
[dsymutil] Account for DW_OP_convert being CU relative

Currently, dsymutil treats the DW_OP_convert operand as absolute instead
of CU relative, as described by in the DWARFv5 spec, 2.5.1.6:

  "[DW_OP_convert] takes one operand, which is an unsigned LEB128 integer
  that represents the offset of a debugging information entry in the current
  compilation unit"

This patch makes dsymutil correctly treat the offset as CU relative,
preventing a crash when there are multiple compilation units.

Big thanks to Akira Hatanaka for figuring out this issue and providing
both a reduced test case and a proposed fix.

2 years ago[lld-macho][nfc] Change force-load.s test to actually test
Jez Ng [Tue, 12 Jul 2022 21:54:18 +0000 (17:54 -0400)]
[lld-macho][nfc] Change force-load.s test to actually test

I'd forgotten to change a copypasted line...

2 years agoRevert "[GISel] Unify use of getStackGuard"
Kai Nacke [Tue, 12 Jul 2022 21:00:43 +0000 (17:00 -0400)]
Revert "[GISel] Unify use of getStackGuard"

This reverts commit e60b4fb2b777118c0ff664a6347851df14fcf75b.

2 years ago[X86] Move isInRange(ArrayRef<int>) inside assert to fix NDEBUG builds. NFC.
Simon Pilgrim [Tue, 12 Jul 2022 20:51:01 +0000 (21:51 +0100)]
[X86] Move isInRange(ArrayRef<int>) inside assert to fix NDEBUG builds. NFC.

Fix unused static function warning introduced by D129207

2 years ago[GISel] Unify use of getStackGuard
Kai Nacke [Tue, 12 Jul 2022 16:56:23 +0000 (12:56 -0400)]
[GISel] Unify use of getStackGuard

Some rework of getStackGuard() based on comments in
https://reviews.llvm.org/D129505.

- getStackGuard() now creates and returns the destination
  register, simplifying calls
- the pointer type is passed to getStackGuard() to avoid
  recomputation
- removed PtrMemTy in emitSPDescriptorParent(), because
  this type is only used here when loading the value but
  not when storing the value

Reviewed By: arsenm

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

2 years ago[Attributor] Don't crash if getAnalysisResultForFunction() returns null LoopInfo
Augie Fackler [Tue, 12 Jul 2022 20:03:34 +0000 (16:03 -0400)]
[Attributor] Don't crash if getAnalysisResultForFunction() returns null LoopInfo

I have no idea what's going on here. This code was moved
around/introduced in change cb26b01d57f5 and starts crashing with a NULL
dereference once I apply https://reviews.llvm.org/D123090. I assume that
I've unwittingly taught the attributor enough that it's able to do more
clever things than in the past, and it's able to trip on this case. I
make no claims about the correctness of this patch, but it passes tests
and seems to fix all the crashes I've been seeing.

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

2 years ago[lldb] Fix macOS Ventura version number checks
Jonas Devlieghere [Tue, 12 Jul 2022 20:27:30 +0000 (13:27 -0700)]
[lldb] Fix macOS Ventura version number checks

Unlike Python 2 which reports 10.16 on any recent macOS, Python 3
correctly reports Ventura as macOS 13.

2 years ago[mlir] Switch create to use NamedAttrList&&
Jacques Pienaar [Tue, 12 Jul 2022 20:24:09 +0000 (13:24 -0700)]
[mlir] Switch create to use NamedAttrList&&

Avoids needing the two parallel functions as NamedAttrList already takes care
of caching DictionaryAttr and implicitly can convert from either.

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

2 years ago[ORC] Remove unused function declaration. (NFC)
Sunho Kim [Tue, 12 Jul 2022 20:10:50 +0000 (05:10 +0900)]
[ORC] Remove unused function declaration. (NFC)

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

2 years ago[lldb] Make the g_arguments_data constexpr and fix the static assert
Jonas Devlieghere [Tue, 12 Jul 2022 17:56:01 +0000 (10:56 -0700)]
[lldb] Make the g_arguments_data constexpr and fix the static assert

This fixes the static assert that's meant to keep the g_arguments_data
table in sync with the CommandArgumentType enumeration. Indeed, the
assert didn't fire even though the current code is missing an entry.
This patches fixes that as well.

Differential revision: https://reviews.llvm.org/D129529

2 years ago[AMDGPU] Regenerate local-memory.amdgcn.ll test checks
Simon Pilgrim [Tue, 12 Jul 2022 20:09:34 +0000 (21:09 +0100)]
[AMDGPU] Regenerate local-memory.amdgcn.ll test checks

2 years ago[clangd] Remove `allCommitCharacters`
Sam McCall [Tue, 12 Jul 2022 17:50:07 +0000 (19:50 +0200)]
[clangd] Remove `allCommitCharacters`

This was added in 2a095ff6f5028b76, however it never worked with VSCode
due to bugs in vscode-languageclient
(https://github.com/microsoft/vscode-languageserver-node/issues/673).
Now that it does work, we can tell the interactions with text editing, with
snippets, and vscode's select-first-completion behavior are bad.

The spec is vague and clients could do something reasonable with the
current values. However they could clearly do something unreasonable
too, and over time behavior+spec tends to converge on VSCode's behavior.

This addresses https://github.com/clangd/vscode-clangd/pull/358
See also https://github.com/clangd/vscode-clangd/pull/358 which hotfixes
this on the client-side (as we can't apply this change retroactively to
clangd 12-14).

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

2 years agoPretty printer test fixes
David Blaikie [Tue, 12 Jul 2022 19:29:00 +0000 (19:29 +0000)]
Pretty printer test fixes

2 years ago[JITLink][COFF] Fix compiler warnings.
sunho [Tue, 12 Jul 2022 19:25:14 +0000 (04:25 +0900)]
[JITLink][COFF] Fix compiler warnings.

2 years agoSpeculatively fix this C DR test
Aaron Ballman [Tue, 12 Jul 2022 19:16:10 +0000 (15:16 -0400)]
Speculatively fix this C DR test

There is a failing bot:
http://45.33.8.238/macm1/40002/step_7.txt

It looks to be failing because of a regex and how it handles whitespace,
so modifying the CHECK line slightly to account for that.

2 years ago[libc++][test] Adds spaceship support to macros.
Mark de Wever [Tue, 12 Jul 2022 17:22:43 +0000 (19:22 +0200)]
[libc++][test] Adds spaceship support to macros.

This was already reviewed as D128603. This contains only the updates to
the test script.

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

2 years ago[clang/ios] Make -mios-version-min the canonical spelling over -miphoneos-version-min
Nico Weber [Tue, 12 Jul 2022 15:51:04 +0000 (11:51 -0400)]
[clang/ios] Make -mios-version-min the canonical spelling over -miphoneos-version-min

Like https://reviews.llvm.org/D129226, but for iOS.

No behavior change.

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

2 years ago[JITLink][COFF] Add missing REQUIRES: asserts.
Sunho Kim [Tue, 12 Jul 2022 19:05:08 +0000 (04:05 +0900)]
[JITLink][COFF] Add missing REQUIRES: asserts.
This fixes the buildbot failure in release only buildbots.

2 years ago[gn build] Port db995d72db14
LLVM GN Syncbot [Tue, 12 Jul 2022 18:54:07 +0000 (18:54 +0000)]
[gn build] Port db995d72db14

2 years ago[JITLink][COFF] Initial COFF support.
Sunho Kim [Tue, 12 Jul 2022 18:50:37 +0000 (03:50 +0900)]
[JITLink][COFF] Initial COFF support.

Adds initial COFF support in JITLink. This is able to run a hello world c program in x86 windows successfully.

Implemented
- COFF object loader
- Static local symbols
- Absolute symbols
- External symbols
- Weak external symbols
- Common symbols
- COFF jitlink-check support
- All COMDAT selection type execpt largest
- Implicit symobl size calculation
- Rel32 relocation with PLT stub.
- IMAGE_REL_AMD64_ADDR32NB relocation

Reviewed By: lhames

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

2 years ago[TargetLowering][RISCV] Make expandCTLZ work for non-power of 2 types.
Craig Topper [Sat, 9 Jul 2022 23:40:52 +0000 (16:40 -0700)]
[TargetLowering][RISCV] Make expandCTLZ work for non-power of 2 types.

To convert CTLZ to popcount we do

x = x | (x >> 1);
x = x | (x >> 2);
...
x = x | (x >>16);
x = x | (x >>32); // for 64-bit input
return popcount(~x);

This smears the most significant set bit across all of the bits
below it then inverts the remaining 0s and does a population count.

To support non-power of 2 types, the last shift amount must be
more than half of the size of the type. For i15, the last shift
was previously a shift by 4, with this patch we add another shift
of 8.

Fixes PR56457.

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

2 years ago[RISCV] Pre-commit test for PR56457. NFC
Craig Topper [Sat, 9 Jul 2022 23:39:57 +0000 (16:39 -0700)]
[RISCV] Pre-commit test for PR56457. NFC

2 years ago[LLD] Two tweaks to symbol ordering scheme
YongKang Zhu [Tue, 12 Jul 2022 18:34:12 +0000 (11:34 -0700)]
[LLD] Two tweaks to symbol ordering scheme

When `--symbol-ordering-file` is specified, the linker today will always put
hot contributions in the middle of cold ones when targeting RISC machine, so
to minimize the chances that branch thunks need be generated for hot code
calling into cold code. This is not necessary when user specifies an ordering
of read-only data (vs. function) symbols, or when output section is small such
that no branch thunk would ever be required. The latter is common for mobile
apps. For example, among all the native ARM64 libraries in Facebook Instagram
App for Android, 80% of them have text section smaller than 64KB and the
largest text section seen is less than 8MB, well below the distance that a
BRANCH26 can reach.

Reviewed By: MaskRay

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

2 years ago[libc++][NFC] Add MVS guard for locale_mgmt_zos.h
David Tenty [Mon, 11 Jul 2022 15:36:19 +0000 (11:36 -0400)]
[libc++][NFC] Add MVS guard for locale_mgmt_zos.h

This header need not be included on non-z/OS IBM platforms (and indeed
will add nothing when it is), so add a guard. This let's us remove the
header without things breaking when shipping libc++ for AIX.

Reviewed By: hubert.reinterpretcast, fanbo-meng

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

2 years agoChange default C dialect for PS5 to gnu17/gnu18.
Sunil Srivastava [Tue, 12 Jul 2022 18:13:11 +0000 (11:13 -0700)]
Change default C dialect for PS5 to gnu17/gnu18.

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

2 years agoBuild Windows releases with libxml enabled, to unbreak llvm-mt
Hans Wennborg [Tue, 12 Jul 2022 15:58:21 +0000 (17:58 +0200)]
Build Windows releases with libxml enabled, to unbreak llvm-mt

Recent CMake versions have started to prefer llvm-mt when using
clang-cl, which doesn't work at all when llvm-mt is built without
libxml which has been the case so far.

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

Differential revision: https://reviews.llvm.org/D129571

2 years ago[lldb] Fix TestDataFormatterLibcxxString broken by D129490
Pavel Labath [Tue, 12 Jul 2022 18:05:20 +0000 (20:05 +0200)]
[lldb] Fix TestDataFormatterLibcxxString broken by D129490

We need to check for the error inside the value object to avoid reading
garbage through invalid (target) pointers.

2 years agoUpdate the status for more C DRs
Aaron Ballman [Tue, 12 Jul 2022 18:06:13 +0000 (14:06 -0400)]
Update the status for more C DRs

This mostly finishes the DRs in the 200s. There are a few DRs left
which will require more thought and work to test.

2 years agoReland "[LLDB][NFC] Decouple dwarf location table from DWARFExpression."
Zequan Wu [Tue, 12 Jul 2022 17:30:49 +0000 (10:30 -0700)]
Reland "[LLDB][NFC] Decouple dwarf location table from DWARFExpression."

This reland 227dffd0b6d78154516ace45f6ed28259c7baa48 and
562c3467a6738aa89203f72fc1d1343e5baadf3c with failed api tests fixed by keeping
function base file addres in DWARFExpressionList.

2 years ago[~NFC] Fix printf() type punning warning in asan_globals.cpp
Mitch Phillips [Tue, 12 Jul 2022 17:48:19 +0000 (10:48 -0700)]
[~NFC] Fix printf() type punning warning in asan_globals.cpp

2 years ago[coroutine] add nomerge function attribute to `llvm.coro.save`
Yuanfang Chen [Tue, 12 Jul 2022 17:39:16 +0000 (10:39 -0700)]
[coroutine] add nomerge function attribute to `llvm.coro.save`

It is illegal to merge two `llvm.coro.save` calls unless their
`llvm.coro.suspend` users are also merged. Marks it "nomerge" for
the moment.

This reverts D129025.

Alternative to D129025, which affects other token type users like WinEH.

Reviewed By: ChuanqiXu

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

2 years ago[libc++] Fixes CI.
Mark de Wever [Tue, 12 Jul 2022 17:38:28 +0000 (19:38 +0200)]
[libc++] Fixes CI.

2 years ago[libc++][format] Adds integral formatter benchmarks.
Mark de Wever [Tue, 5 Jul 2022 06:20:33 +0000 (08:20 +0200)]
[libc++][format] Adds integral formatter benchmarks.

This is a preparation to look at possible performance improvements.

Reviewed By: #libc, ldionne

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

2 years ago[libc++][chrono] Avoid tautological comparisions.
Mark de Wever [Sun, 10 Jul 2022 12:36:34 +0000 (14:36 +0200)]
[libc++][chrono] Avoid tautological comparisions.

In our implementation the year is always less than or equal to the
class' `max()`. It's unlikely this ever changes since changing the
year's range will be an ABI break. A static_assert is added as a
guard.

This was reported by @philnik.

Reviewed By: ldionne, #libc

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

2 years agoSilence a sphinx diagnostic; NFC
Aaron Ballman [Tue, 12 Jul 2022 17:02:20 +0000 (13:02 -0400)]
Silence a sphinx diagnostic; NFC

This addresses the failure with:
https://lab.llvm.org/buildbot/#/builders/92/builds/29618

2 years ago[gn build] (manually) port dc63ad8878de
Nico Weber [Tue, 12 Jul 2022 16:36:09 +0000 (12:36 -0400)]
[gn build] (manually) port dc63ad8878de

2 years ago[gn build] Port 2240d72f15f3
LLVM GN Syncbot [Tue, 12 Jul 2022 16:26:51 +0000 (16:26 +0000)]
[gn build] Port 2240d72f15f3

2 years ago[Sema] Add deprecation warnings for some compiler provided __has_* type traits
Roy Jacobson [Tue, 5 Jul 2022 22:37:31 +0000 (01:37 +0300)]
[Sema] Add deprecation warnings for some compiler provided __has_* type traits

Some compiler provided type traits like __has_trivial_constructor have been documented
as deprecated for quite some time.
Still, some people apparently still use them, even though mixing them with concepts
and with deleted functions leads to weird results. There's also disagreement about some
edge cases between GCC (which Clang claims to follow) and MSVC.

This patch adds deprecation warnings for the usage of those builtins, except for __has_trivial_destructor
which doesn't have a GCC alternative.

I made the warning on by default, so I had to silence it for some tests but it's not too many.

Some (decade old) history of issues with those builtins:
https://github.com/llvm/llvm-project/issues/18187
https://github.com/llvm/llvm-project/issues/18559
https://github.com/llvm/llvm-project/issues/22161
https://github.com/llvm/llvm-project/issues/33063

The abseil usage of them that triggered me to add this warning:
https://github.com/abseil/abseil-cpp/issues/1201

Weird interaction of those builtins with C++20's conditionally trivial special member functions:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106085

Reviewed By: #clang-language-wg, aaron.ballman

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

2 years ago[X86] initial -mfunction-return=thunk-extern support
Nick Desaulniers [Tue, 12 Jul 2022 16:17:15 +0000 (09:17 -0700)]
[X86] initial -mfunction-return=thunk-extern support

Adds support for:
* `-mfunction-return=<value>` command line flag, and
* `__attribute__((function_return("<value>")))` function attribute

Where the supported <value>s are:
* keep (disable)
* thunk-extern (enable)

thunk-extern enables clang to change ret instructions into jmps to an
external symbol named __x86_return_thunk, implemented as a new
MachineFunctionPass named "x86-return-thunks", keyed off the new IR
attribute fn_ret_thunk_extern.

The symbol __x86_return_thunk is expected to be provided by the runtime
the compiled code is linked against and is not defined by the compiler.
Enabling this option alone doesn't provide mitigations without
corresponding definitions of __x86_return_thunk!

This new MachineFunctionPass is very similar to "x86-lvi-ret".

The <value>s "thunk" and "thunk-inline" are currently unsupported. It's
not clear yet that they are necessary: whether the thunk pattern they
would emit is beneficial or used anywhere.

Should the <value>s "thunk" and "thunk-inline" become necessary,
x86-return-thunks could probably be merged into x86-retpoline-thunks
which has pre-existing machinery for emitting thunks (which could be
used to implement the <value> "thunk").

Has been found to build+boot with corresponding Linux
kernel patches. This helps the Linux kernel mitigate RETBLEED.
* CVE-2022-23816
* CVE-2022-28693
* CVE-2022-29901

See also:
* "RETBLEED: Arbitrary Speculative Code Execution with Return
Instructions."
* AMD SECURITY NOTICE AMD-SN-1037: AMD CPU Branch Type Confusion
* TECHNICAL GUIDANCE FOR MITIGATING BRANCH TYPE CONFUSION REVISION 1.0
  2022-07-12
* Return Stack Buffer Underflow / Return Stack Buffer Underflow /
  CVE-2022-29901, CVE-2022-28693 / INTEL-SA-00702

SystemZ may eventually want to support "thunk-extern" and "thunk"; both
options are used by the Linux kernel's CONFIG_EXPOLINE.

This functionality has been available in GCC since the 8.1 release, and
was backported to the 7.3 release.

Many thanks for folks that provided discrete review off list due to the
embargoed nature of this hardware vulnerability. Many Bothans died to
bring us this information.

Link: https://www.youtube.com/watch?v=IF6HbCKQHK8
Link: https://github.com/llvm/llvm-project/issues/54404
Link: https://gcc.gnu.org/legacy-ml/gcc-patches/2018-01/msg01197.html
Link: https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/advisory-guidance/return-stack-buffer-underflow.html
Link: https://arstechnica.com/information-technology/2022/07/intel-and-amd-cpus-vulnerable-to-a-new-speculative-execution-attack/?comments=1
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ce114c866860aa9eae3f50974efc68241186ba60
Link: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00702.html
Link: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00707.html
Reviewed By: aaron.ballman, craig.topper

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

2 years ago[AST] [Modules] Handle full cases of DefaultArgStorage::setInherited
Chuanqi Xu [Fri, 8 Jul 2022 06:20:50 +0000 (14:20 +0800)]
[AST] [Modules] Handle full cases of DefaultArgStorage::setInherited

There were two assertions in DefaultArgStorage::setInherited previously.
It requires the DefaultArgument is either empty or an argument value. It
would crash if it has a pointer refers to the previous declaration or
contains a chain to the previous declaration.

But there are edge cases could hit them actually. One is
InheritDefaultArguments.cppm that I found recently. Another one is pr31469.cpp,
which was created fives years ago.

This patch tries to fix the two failures by handling full cases in
DefaultArgStorage::setInherited.

This is guaranteed to not introduce any breaking change since it lives
in the path we wouldn't touch before. And the added assertions for
sameness should keep the correctness.

Reviewed By: v.g.vassilev

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

2 years ago[Sanitizers][Darwin] Remove SANITIZER_MAC
Mariusz Borsa [Mon, 11 Jul 2022 17:14:06 +0000 (10:14 -0700)]
[Sanitizers][Darwin] Remove SANITIZER_MAC

This is to finish the change started by D125816 , D126263 and D126577 (replace SANITIZER_MAC by SANITIZER_APPLE).
Dropping definition of SANITIZER_MAC completely, to remove any possible confusion.

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

2 years ago[AST] Accept identical TypeConstraint referring to other template
Chuanqi Xu [Tue, 12 Jul 2022 15:47:37 +0000 (23:47 +0800)]
[AST] Accept identical TypeConstraint referring to other template
parameters.

The current implementation to judge the similarity of TypeConstraint in
ASTContext::isSameTemplateParameter is problematic, it couldn't handle
the following case:

```C++
template <__integer_like _Tp, C<_Tp> Sentinel>
constexpr _Tp operator()(_Tp &&__t, Sentinel &&last) const {
    return __t;
}
```

When we see 2 such declarations from different modules, we would judge
their similarity by `ASTContext::isSame*` methods. But problems come for
the TypeConstraint. Originally, we would profile each argument one by
one. But it is not right. Since the profiling result of `_Tp` would
refer to two different template type declarations. So it would get
different results. It is right since the `_Tp` in different modules
refers to different declarations indeed. So the same declaration in
different modules would meet incorrect our-checking results.

It is not the thing we want. We want to know if the TypeConstraint have
the same expression.

Reviewer: vsapsai, ilya-biryukov

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

2 years ago[AMDGPU] SILowerControlFlow uses LiveIntervals
Jay Foad [Tue, 12 Jul 2022 10:16:15 +0000 (11:16 +0100)]
[AMDGPU] SILowerControlFlow uses LiveIntervals

The availability of LiveIntervals affects kill flags in the output, so
declare the use to avoid strange effects where the output of this pass
is different depending on what other passes are scheduled after it.

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

2 years ago[LinkerWrapper] Clean-up unused definitions
Joseph Huber [Tue, 12 Jul 2022 15:40:38 +0000 (11:40 -0400)]
[LinkerWrapper] Clean-up unused definitions

Summary:

There are a few definitions that are unused or unnecessary after
previous changes, clean them up.

2 years ago[LinkerWrapper] Make ThinLTO work inside the linker wrapper
Joseph Huber [Tue, 12 Jul 2022 14:10:54 +0000 (10:10 -0400)]
[LinkerWrapper] Make ThinLTO work inside the linker wrapper

Summary:
Previous assumptions held that the LTO stage would only have a single
output. This is incorrect when using thinLTO which outputs multiple
files. Additionally there were some bugs with how we hanlded input that
cause problems when performing thinLTO. This patch addresses these
issues.

The performance of Thin-LTO is currently pretty bad. But I am content to
leave it that way as long as it compiles.

2 years ago[Modules] Add ODR Check for concepts
Chuanqi Xu [Tue, 12 Jul 2022 15:19:19 +0000 (23:19 +0800)]
[Modules] Add ODR Check for concepts

Closing https://github.com/llvm/llvm-project/issues/56310

Previously we don't check the contents of concept so it might merge
inconsistent results.

Important Note: this patch might break existing code but the behavior
might be right.

Reviewed By: erichkeane

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

2 years ago[GISel] Check useLoadStackGuardNode() before generating LOAD_STACK_GUARD
Kai Nacke [Mon, 11 Jul 2022 18:32:42 +0000 (14:32 -0400)]
[GISel] Check useLoadStackGuardNode() before generating LOAD_STACK_GUARD

When lowering llvm::stackprotect intrinsic, the SDAG implementation
checks useLoadStackGuardNode() to either create a LOAD_STACK_GUARD or use
the first argument of the intrinsic. This check is not present in the
IRTranslator, which results in always generating a LOAD_STACK_GUARD even
if the target does not support it.

Reviewed By: arsenm

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

2 years ago[flang] Lower TRANSPOSE without using runtime.
Slava Zakharin [Fri, 8 Jul 2022 22:10:33 +0000 (15:10 -0700)]
[flang] Lower TRANSPOSE without using runtime.

Calling runtime TRANSPOSE requires a temporary array for the result,
and, sometimes, a temporary array for the argument. Lowering it inline
should provide faster code.

I added -opt-transpose control just for debugging purposes temporary.
I am going to make driver changes that will disable inline lowering
for -O0. For the time being I would like to enable it by default
to expose the code to more tests.

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

2 years ago[mlir] Remove VectorToROCDL
Krzysztof Drewniak [Thu, 7 Jul 2022 17:32:06 +0000 (17:32 +0000)]
[mlir] Remove VectorToROCDL

Between issues such as
https://github.com/llvm/llvm-project/issues/56323, the fact that this
lowering (unlike the code in amdgpu-to-rocdl) does not correctly set
up bounds checks (and thus will cause page faults on reads that might
need to be padded instead), and that fixing these problems would,
essentially, involve replicating amdgpu-to-rocdl, remove
--vector-to-rocdl for being broken. In addition, the lowering does not
support many aspects of transfer_{read,write}, like supervectors, and
may not work correctly in their presence.

We (the MLIR-based convolution generator at AMD) do not use this
conversion pass, nor are we aware of any other clients.

Migration strategies:
- Use VectorToLLVM
- If buffer ops are particularly needed in your application, use
amdgpu.raw_buffer_{load,store}

A VectorToAMDGPU pass may be introduced in the future.

Reviewed By: ThomasRaoux

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

2 years ago[clang][deps] Override dependency and serialized diag files for modules
Ben Langmuir [Fri, 8 Jul 2022 22:51:15 +0000 (15:51 -0700)]
[clang][deps] Override dependency and serialized diag files for modules

When building modules, override secondary outputs (dependency file,
dependency targets, serialized diagnostic file) in addition to the pcm
file path. This avoids inheriting per-TU command-line options that
cause non-determinism in the results (non-deterministic command-line for
the module build, non-determinism in which TU's .diag and .d files will
contain the module outputs). In clang-scan-deps we infer whether to
generate dependency or serialized diagnostic files based on an original
command-line. In a real build system this should be modeled explicitly.

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

2 years ago[PS4/PS5] NFC: Use preferred predicate in a triple check
Paul Robinson [Tue, 12 Jul 2022 15:09:29 +0000 (08:09 -0700)]
[PS4/PS5] NFC: Use preferred predicate in a triple check

Also add a test to verify this difference in the PS4/PS5 ABIs,
now that we have identified it.

2 years agotry to fix lldb build after d489268392d23
Nico Weber [Tue, 12 Jul 2022 15:08:27 +0000 (11:08 -0400)]
try to fix lldb build after d489268392d23

2 years ago[mlir] fold more eagerly in structured op splitting
Alex Zinenko [Fri, 8 Jul 2022 15:46:10 +0000 (15:46 +0000)]
[mlir] fold more eagerly in structured op splitting

Existing implementation of structured op splitting creates several
affine.apply and affine.min operations in its subshape computation.
As these shapes are further used in data slice extraction, this may lead
to slice shapes being dynamic even when the original shapes and the
splitting point are static. This is particularly visible when splitting
is combined with further subsetting transformations such as tiling. Use
composition and folding more aggressively in splitting to avoid this.

In particular, introduce a `createComposedAffineMin` function that the
affine map used in "min" with the maps used by any `affine.apply` that
may be feeding the operands to the "min". This enables production of
more static shapes. Also introduce a `createComposedFoldedAffineApply`
function that combines the existing `createComposedAffineApply` with
in-place folding to propagate constants produced by zero-input affine
maps. Using these when splitting allows the subsequent canonicalizer
pass to recover static shapes for structured ops.

Reviewed By: nicolasvasilache

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

2 years ago[clang/mac] Make -mmacos-version-min the canonical spelling over -mmacosx-version-min
Nico Weber [Wed, 6 Jul 2022 20:43:48 +0000 (22:43 +0200)]
[clang/mac] Make -mmacos-version-min the canonical spelling over -mmacosx-version-min

This was promised 5 years ago in https://reviews.llvm.org/D32796,
let's do it.

Both flags are still accepted. No behavior change except for which
form shows up in --help output and in dumps of internal state
(such as with RC_DEBUG_OPTIONS).

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

2 years ago[NVPTX] Add missing pass names
Igor Kudrin [Tue, 12 Jul 2022 14:58:13 +0000 (07:58 -0700)]
[NVPTX] Add missing pass names

Differential Revision:

2 years ago[mlir][vector] Add accumulator operand to MultiDimReduce op
Thomas Raoux [Tue, 12 Jul 2022 02:31:30 +0000 (02:31 +0000)]
[mlir][vector] Add accumulator operand to MultiDimReduce op

This allows vectorizing linalg reductions without changing the operation
order. Therefore this produce a valid vectorization even if operations
are not associative.

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

2 years ago[LoopVectorize] Change PredicatedBBsAfterVectorization to be per VF
David Sherwood [Tue, 21 Jun 2022 13:07:49 +0000 (14:07 +0100)]
[LoopVectorize] Change PredicatedBBsAfterVectorization to be per VF

When calculating the cost of Instruction::Br in getInstructionCost
we query PredicatedBBsAfterVectorization to see if there is a
scalar predicated block. However, this meant that the decisions
being made for a given fixed-width VF were affecting the cost for a
scalable VF. As a result we were returning InstructionCost::Invalid
pointlessly for a scalable VF that should have a low cost. I
encountered this for some loops when enabling tail-folding for
scalable VFs.

Test added here:

  Transforms/LoopVectorize/AArch64/sve-tail-folding-cost.ll

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

2 years ago[DAG] SimplifyDemandedBits - AND/OR/XOR - attempt basic knownbits simplifications...
Simon Pilgrim [Tue, 12 Jul 2022 13:08:47 +0000 (14:08 +0100)]
[DAG] SimplifyDemandedBits - AND/OR/XOR - attempt basic knownbits simplifications before calling SimplifyMultipleUseDemandedBits

Noticed while investigating the SystemZ regressions in D77804, prefer handling the knownbits analysis/simplification in the bitop nodes directly before falling back to SimplifyMultipleUseDemandedBits

2 years ago[NFC] Fix compile time regression seen on some benchmarks after a630ea3003 commit
Dawid Jurczak [Tue, 12 Jul 2022 13:00:27 +0000 (15:00 +0200)]
[NFC] Fix compile time regression seen on some benchmarks after a630ea3003 commit

The goal of this change is fixing most of compile time slowdown seen after a630ea3003 commit on lencod and sqlite3 benchmarks.
There are 3 improvements included in this patch:

1. In getNumOperands when possible get value directly from SmallNumOps.
2. Inline getLargePtr by moving its definition to header.
3. In TBAAStructTypeNode::getField get all operands once instead taking operands in loop one after one.

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

2 years ago[mlir] Handle linalg.index correctly in TilingInterface
Alex Zinenko [Fri, 8 Jul 2022 11:49:47 +0000 (13:49 +0200)]
[mlir] Handle linalg.index correctly in TilingInterface

The existing implementation of the TilingInterface for Linalg ops was not
modifying the `linalg.index` ops contained within other Linalg ops (they need
to be summed up with the values of respective tile loop induction variables),
which led to the interface-based tiling being incorrect for any Linalg op with
index semantics.

In the process, fix the function performing the index offsetting to use the
pattern rewriter API instead of RAUW as it is being called from patterns and
may mess up the internal state of the rewriter. Also rename the function to
clearly catch all uses.

Depends On D129365

Reviewed By: mravishankar

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

2 years ago[mlir] Use semantically readable functions for transform op effects
Alex Zinenko [Fri, 8 Jul 2022 11:49:27 +0000 (13:49 +0200)]
[mlir] Use semantically readable functions for transform op effects

A recent commit introduced helper functions with semantically meaningful names
to populate the lists of memory effects in transform ops, use them whenever
possible.

Depends On D129287

Reviewed By: springerm

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

2 years ago[mlir] Transform op for multitile size generation
Alex Zinenko [Thu, 7 Jul 2022 13:56:06 +0000 (15:56 +0200)]
[mlir] Transform op for multitile size generation

Introduce a structured transform op that emits IR computing the multi-tile
sizes with requested parameters (target size and divisor) for the given
structured op. The sizes may fold to arithmetic constant operations when the
shape is constant. These operations may then be used to call the existing
tiling transformation with a single non-zero dynamic size (i.e. perform
strip-mining) for each of the dimensions separately, thus achieving multi-size
tiling with optional loop interchange. A separate test exercises the entire
script.

Depends On D129217

Reviewed By: nicolasvasilache

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

2 years ago[Clang] Add a warning on invalid UTF-8 in comments.
Corentin Jabot [Fri, 17 Jun 2022 14:23:41 +0000 (16:23 +0200)]
[Clang] Add a warning on invalid UTF-8 in comments.

Introduce an off-by default `-Winvalid-utf8` warning
that detects invalid UTF-8 code units sequences in comments.

Invalid UTF-8 in other places is already diagnosed,
as that cannot appear in identifiers and other grammar constructs.

The warning is off by default as its likely to be somewhat disruptive
otherwise.

This warning allows clang to conform to the yet-to be approved WG21
"P2295R5 Support for UTF-8 as a portable source file encoding"
paper.

Reviewed By: aaron.ballman, #clang-language-wg

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

2 years ago[mlir] Allow Tile transform op to take dynamic sizes
Alex Zinenko [Thu, 7 Jul 2022 13:55:44 +0000 (15:55 +0200)]
[mlir] Allow Tile transform op to take dynamic sizes

Extend the definition of the Tile structured transform op to enable it
accepting handles to operations that produce tile sizes at runtime. This is
useful by itself and prepares for more advanced tiling strategies. Note that
the changes are relevant only to the transform dialect, the tiling
transformation itself already supports dynamic sizes.

Depends On D129216

Reviewed By: nicolasvasilache

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

2 years ago[LLDB] Catagory decorator for watchpoint test in TestCompletion.py
Muhammad Omair Javaid [Tue, 12 Jul 2022 11:56:28 +0000 (16:56 +0500)]
[LLDB] Catagory decorator for watchpoint test in TestCompletion.py

This patch adds watchpoint catagory decorator to watchpoint dependent
tests in TestCompletion.py.

2 years ago[OpenMP] Do not link static library with `-nogpulib`
Joseph Huber [Tue, 12 Jul 2022 02:20:29 +0000 (22:20 -0400)]
[OpenMP] Do not link static library with `-nogpulib`

Normally we do not link the device libraries if the user passed
`nogpulib` we do this for the standard bitcode library. This behaviour
was not added when using the static library for LTO, causing it to
always be linked in. This patch fixes that.

Reviewed By: JonChesterfield

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

2 years ago[Libomptarget] Allow static assert to work on 32-bit systems
Joseph Huber [Tue, 12 Jul 2022 12:02:17 +0000 (08:02 -0400)]
[Libomptarget] Allow static assert to work on 32-bit systems

Summary:
We use a static assert to make sure that someone doesn't change the size
of an argument struct without properly updating all the other logic.
This originally only checked the size on a 64-bit system with 8-byte
pointers, causing builds on 32-bit systems to fail. This patch allows
either pointer size to work.

Fixes #56486

2 years ago[NFC][flang][OpenMP] Add comment for handling the data race problem in copyin clause
Peixin Qiao [Tue, 12 Jul 2022 11:54:24 +0000 (19:54 +0800)]
[NFC][flang][OpenMP] Add comment for handling the data race problem in copyin clause

The reference and description is missed before.

Reviewed By: kiranchandramohan

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

2 years ago[LLDB] Fix NativePDB/local-variables.cpp for AArch64/Windows
Muhammad Omair Javaid [Tue, 12 Jul 2022 11:24:08 +0000 (16:24 +0500)]
[LLDB] Fix NativePDB/local-variables.cpp for AArch64/Windows

This patch fixes NativePDB/local-variables.cpp test for AArch64 Windows.
There are two changes:
1) Replace function breakpoint with line breakpoint required due to pr56288
2) Adjust "target modules dump ast" test as the output was slightly different
on AArch64/Windows.

2 years ago[Mem2Reg] Consistently preserve nonnull assume for uninit load
Nikita Popov [Tue, 12 Jul 2022 10:38:52 +0000 (12:38 +0200)]
[Mem2Reg] Consistently preserve nonnull assume for uninit load

When performing a !nonnull load from uninitialized memory, we
should preserve the nonnull assume just like in all other cases.
We already do this correctly in the generic mem2reg code, but
don't handle this case when using the optimized single-block
implementation.

Make sure that the optimized implementation exhibits the same
behavior as the generic implementation.

2 years agoUndeprecate ATOMIC_FLAG_INIT in C++
Aaron Ballman [Tue, 12 Jul 2022 10:48:31 +0000 (06:48 -0400)]
Undeprecate ATOMIC_FLAG_INIT in C++

C++20 deprecated ATOMIC_FLAG_INIT thinking it was deprecated in C when it
wasn't. It is expected to be undeprecated in C++23 as part of LWG3659
(https://wg21.link/LWG3659), which is currently Tentatively Ready.

This handles the case where the user includes <stdatomic.h> in C++ code in a
freestanding compile mode. The corollary libc++ changes are in
1544d1f9fdb115782202d72ad200c3f93b2c4f5a.

2 years ago[Mem2Reg] Add test for uninitialized nonnull loads (NFC)
Nikita Popov [Tue, 12 Jul 2022 10:31:31 +0000 (12:31 +0200)]
[Mem2Reg] Add test for uninitialized nonnull loads (NFC)

This shows a difference in behavior between the single block and
the multi block case.

2 years agoFixing build bot failure due to python-pip unavailability.
Vignesh Balasubramanian [Tue, 12 Jul 2022 10:18:51 +0000 (15:48 +0530)]
Fixing build bot failure due to python-pip unavailability.

commit: 51d3f421f48f7c888c37a13be049a4ca8b61436e
failed due to missing python-pip om machine.
Now the ompd gdb-plugin code will be skipped with a warning
if pip is not available in the machine.

2 years ago[lldb] add SBSection.alignment to python bindings
David M. Lary [Tue, 12 Jul 2022 09:51:33 +0000 (11:51 +0200)]
[lldb] add SBSection.alignment to python bindings

This commit adds SBSection.GetAlignment(), and SBSection.alignment as a python property to lldb.

Reviewed By: clayborg, JDevlieghere, labath

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

2 years agoRevert "[lldb] add SBSection.alignment to python bindings"
Pavel Labath [Tue, 12 Jul 2022 10:17:29 +0000 (12:17 +0200)]
Revert "[lldb] add SBSection.alignment to python bindings"

The patch didn't get proper attribution. Will recommit.

This reverts commit 4135abca897d1b945193f767cbf42a200b55bbdc.

2 years ago[lldb] add SBSection.alignment to python bindings
Pavel Labath [Tue, 12 Jul 2022 09:51:33 +0000 (11:51 +0200)]
[lldb] add SBSection.alignment to python bindings

This commit adds SBSection.GetAlignment(), and SBSection.alignment as a python property to lldb.

Reviewed By: clayborg, JDevlieghere, labath

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

2 years ago[AArch64] Fix subtarget features for tests. NFC
David Green [Tue, 12 Jul 2022 10:03:40 +0000 (11:03 +0100)]
[AArch64] Fix subtarget features for tests. NFC

These tests were using instructions that require feature predicates that
were not enabled.

2 years ago[gn build] Port 73ebcabff2d9
LLVM GN Syncbot [Tue, 12 Jul 2022 09:49:13 +0000 (09:49 +0000)]
[gn build] Port 73ebcabff2d9

2 years ago[libc++][ranges][NFC] Implement the repetitive parts of the remaining range algorithms:
Konstantin Varlamov [Tue, 12 Jul 2022 09:48:29 +0000 (02:48 -0700)]
[libc++][ranges][NFC] Implement the repetitive parts of the remaining range algorithms:

- create the headers (but not include them from `<algorithm>`);
- define the niebloid and its member functions with the right signatures
  (as no-ops);
- make sure all the right headers are included that are required by each
  algorithm's signature;
- update `CMakeLists.txt` and the module map;
- create the test files with the appropriate synopses.

The synopsis in `<algorithm>` is deliberately not updated because that
could be taken as a readiness signal. The new headers aren't included
from `<algorithm>` for the same reason.

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

2 years ago[InlineAsm] Improve error messages for invalid constraint strings
Nikita Popov [Tue, 12 Jul 2022 09:20:49 +0000 (11:20 +0200)]
[InlineAsm] Improve error messages for invalid constraint strings

InlineAsm constraint string verification can fail for many reasons,
but used to always print a generic "invalid type for inline asm
constraint string" message -- which is especially confusing if
the actual error is unrelated to the type, e.g. a failure to parse
the constraint string.

Change the verify API to return an Error with a more specific
error message, and print that in the IR parser.

2 years ago[LLDB][ClangExpression] Remove unused StructVars::m_object_pointer_type
Michael Buch [Fri, 8 Jul 2022 12:19:27 +0000 (13:19 +0100)]
[LLDB][ClangExpression] Remove unused StructVars::m_object_pointer_type

This member variable was removed a while ago in
443427357f539f5ac97e664a53aa9e50788abce9. It was previously used in
materialization code paths that have since been removed. Nowadays,
`m_object_pointer_type` gets set but not used anywhere.

This patch simply removes all remaining instances of it and any
supporting code.

**Testing**

* API tests pass

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

2 years ago[mlir] assorted fixes in transform dialect documentation
Alex Zinenko [Tue, 12 Jul 2022 09:17:36 +0000 (09:17 +0000)]
[mlir] assorted fixes in transform dialect documentation

Various typos and formatting fixes that make the generated documentation
hard to follow.

2 years ago[LLDB][DataFormatter] Add data formatter for libcxx std::unordered_map iterator
Michael Buch [Fri, 8 Jul 2022 09:47:04 +0000 (10:47 +0100)]
[LLDB][DataFormatter] Add data formatter for libcxx std::unordered_map iterator

This patch adds a formatter for libcxx's `std::unordered_map` iterators.
The implementation follows a similar appraoch to the `std::map` iterator
formatter. I was hesistant about coupling the two into a common
implementation since the libcxx layouts might change for one of the
the containers but not the other.

All `std::unordered_map` iterators are covered with this patch:
1. const/non-const key/value iterators
2. const/non-const bucket iterators

Note that, we currently don't have a formatter for `std::unordered_map`.
This patch doesn't change that, we merely add support for its iterators,
because that's what Xcode users requested. One can still see contents
of `std::unordered_map`, whereas with iterators it's less ergonomic.

**Testing**

* Added API test

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

2 years ago[OpenMP][OMPD] GDB plugin code to leverage libompd to provide debugging
Vignesh Balasubramanian [Tue, 12 Jul 2022 08:32:50 +0000 (14:02 +0530)]
[OpenMP][OMPD] GDB plugin code to leverage libompd to provide debugging
support for OpenMP programs.

This is 5th of 6 patches started from https://reviews.llvm.org/D100181
This plugin code, when loaded in gdb, adds a few commands like
ompd icv, ompd bt, ompd parallel.
These commands create an interface for GDB to read the OpenMP
runtime through libompd.

Reviewed By: @dreachem
Differential Revision: https://reviews.llvm.org/D100185

2 years ago[mlir] Add ReplicateOp to the Transform dialect
Alex Zinenko [Thu, 7 Jul 2022 13:55:23 +0000 (15:55 +0200)]
[mlir] Add ReplicateOp to the Transform dialect

This handle manipulation operation allows one to define a new handle that is
associated with a the same payload IR operations N times, where N can be driven
by the size of payload IR operation list associated with another handle. This
can be seen as a sort of broadcast that can be used to ensure the lists
associated with two handles have equal numbers of payload IR ops as expected by
many pairwise transform operations.

Introduce an additional "expensive" check that guards against consuming a
handle that is assocaited with the same payload IR operation more than once as
this is likely to lead to double-free or other undesired effects.

Depends On D129110

Reviewed By: nicolasvasilache

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

2 years ago[libc++][ranges][NFC] Consolidate some repetitive range algorithm tests:
Konstantin Varlamov [Tue, 12 Jul 2022 09:06:22 +0000 (02:06 -0700)]
[libc++][ranges][NFC] Consolidate some repetitive range algorithm tests:

- checking that the algorithm supports predicates returning
  a non-boolean type that's implicitly convertible to `bool`;
- checking that predicates and/or projections are invoked using
  `std::invoke`.

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