platform/upstream/llvm.git
2 years ago[NFC][asan] Always pass Dominator Trees into forAllReachableExits
Vitaly Buka [Fri, 23 Jul 2021 00:07:44 +0000 (17:07 -0700)]
[NFC][asan] Always pass Dominator Trees into forAllReachableExits

2 years ago[mlir][tosa] Make tosa MakeBroadcastable pass handle unreanked tensors.
Rob Suderman [Fri, 23 Jul 2021 00:22:11 +0000 (17:22 -0700)]
[mlir][tosa] Make tosa MakeBroadcastable pass handle unreanked tensors.

If this pass executes without shape inference its possible for unranked tensors
to appear in the IR. This pass should gracefully handle unranked tensors.

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

2 years ago[ARC] Add tablegen definition for the Find Leading Set (FLS) instruction
Thomas Johnson [Thu, 22 Jul 2021 23:26:46 +0000 (16:26 -0700)]
[ARC] Add tablegen definition for the Find Leading Set (FLS) instruction

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

2 years ago[profile] Add binary id into profiles
Gulfem Savrun Yeniceri [Thu, 6 May 2021 16:09:12 +0000 (16:09 +0000)]
[profile] Add binary id into profiles

This patch adds binary id into profiles to easily associate binaries
with the corresponding profiles. There is an RFC that discusses
the motivation, design and implementation in more detail:
https://lists.llvm.org/pipermail/llvm-dev/2021-June/151154.html

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

2 years ago[ELF] --gc-sections: allow GC on reserved sections in a group
Fangrui Song [Fri, 23 Jul 2021 00:09:23 +0000 (17:09 -0700)]
[ELF] --gc-sections: allow GC on reserved sections in a group

This generalizes D70146 (SHT_NOTE) to more reserved sections and makes our rules
more consistent. Now SHF_GROUP is more similar to SHF_LINK_ORDER.

For SHT_INIT_ARRAY/SHT_FINI_ARRAY, the rule will be closer to PE/COFF link.exe.

Previously sanitizers use llvm.global_ctors to make module_ctor a GC
root, which is considered an abuse.
https://groups.google.com/g/generic-abi/c/TpleUEkNoQI

We can squeak through on compatibility issues because compilers otherwise don't
use SHF_GROUP special sections.

2 years ago[ELF][test] Add a test about GCable SHF_LINK_ORDER SHT_INIT_ARRAY
Fangrui Song [Fri, 23 Jul 2021 00:04:54 +0000 (17:04 -0700)]
[ELF][test] Add a test about GCable SHF_LINK_ORDER SHT_INIT_ARRAY

2 years ago[CSSPGO] Fix a typo in SampleContextTracker
Hongtao Yu [Thu, 22 Jul 2021 21:41:55 +0000 (14:41 -0700)]
[CSSPGO] Fix a typo in SampleContextTracker

Fixing a typo in SampleContextTracker to use debug name when debug linkage name is no present. This should only affect C programs.

Saw 0.6% perf win on Cinder which is mostly C code.

Reviewed By: wenlei, wmi

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

2 years ago[lld/mac] Handle symbols from -U in treatUndefinedSymbol()
Nico Weber [Thu, 22 Jul 2021 15:20:36 +0000 (11:20 -0400)]
[lld/mac] Handle symbols from -U in treatUndefinedSymbol()

In ld64, `-U section$start$FOO$bar` handles `section$start$FOO$bar`
as a regular `section$start` symbol, that is section$start processing
happens before -U processing.

Likely, nobody uses that in practice so it doesn't seem very important
to be compatible with this, but it also moves the -U handling code next
to the `-undefined dynamic_lookup` handling code, which is nice because
they do the same thing. And, in fact, this did identify a bug in a corner
case in the intersection of `-undefined dynamic_lookup` and dead-stripping
(fix for that in D106565).

Vaguely related to PR50760.

No interesting behavior change.

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

2 years ago[gn build] (manually) port f8c6515554cc (libLLVMDWP)
Nico Weber [Thu, 22 Jul 2021 23:38:19 +0000 (19:38 -0400)]
[gn build] (manually) port f8c6515554cc (libLLVMDWP)

2 years agoAdd llvm-readobj and binutils symlinks to LLVM_TOOLCHAIN_TOOLS
Mara Sophie Grosch [Thu, 22 Jul 2021 23:33:20 +0000 (16:33 -0700)]
Add llvm-readobj and binutils symlinks to LLVM_TOOLCHAIN_TOOLS

This patch adds llvm-readobj and the binutils symlink for readelf to
LLVM_TOOLCHAIN_TOOLS.

Tvoid *thread, void *attr,hey are required by some (most?)
autoconf-built libraries, adding these allows me to build newlib with
the toolchain generated this way.

Also opened an issue for that some days ago, see
https://bugs.llvm.org/show_bug.cgi?id=50698

Reviewed By: sbc100

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

2 years ago[WebAssembly][NFC] Update test expectations labels after db7efcab7dd9
Thomas Lively [Thu, 22 Jul 2021 23:31:12 +0000 (16:31 -0700)]
[WebAssembly][NFC] Update test expectations labels after db7efcab7dd9

Commit db7efcab7dd9 changed the implementations of the wasm_*_extract_lane and
wasm_*_replace_lane intrinsics from using builtin functions to using the
standard vector extensions. This did not change the resulting IR, but it changes
how update_cc_test_checks.py labels values in the IR. This commit simply updates
those labels.

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

2 years ago[lld/mac] Fix bug in interaction of -dead_strip and -undefined dynamic_lookup
Nico Weber [Thu, 22 Jul 2021 15:37:29 +0000 (11:37 -0400)]
[lld/mac] Fix bug in interaction of -dead_strip and -undefined dynamic_lookup

We lost the `used` bit on the Undefined when we replaced it with a DylibSymbol
in treatUndefined().

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

2 years ago[libcxx][modularisation] properly modularises advance, next, and prev
Christopher Di Bella [Tue, 29 Jun 2021 03:53:44 +0000 (03:53 +0000)]
[libcxx][modularisation] properly modularises advance, next, and prev

`__function_like` wasn't being exported, so certain properties of the
`ranges` functions weren't being propagated in modules land.

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

2 years ago[MLGO] Strip TF_PIP cmake variable
Mircea Trofin [Thu, 22 Jul 2021 23:26:46 +0000 (16:26 -0700)]
[MLGO] Strip TF_PIP cmake variable

This should fix build breaks for 'development' mode. The other modes
were unaffected - 'release' because it doesn't use TFUtils.cpp, and the
mixed mode because the AOT compiled code brings in the necessary include
dirs anyway.

2 years ago[OpenMP] Refined the logic to give a regular task from a hidden helper task
Shilei Tian [Thu, 22 Jul 2021 23:20:57 +0000 (19:20 -0400)]
[OpenMP] Refined the logic to give a regular task from a hidden helper task

In current implementation, if a regular task depends on a hidden helper task,
and when the hidden helper task is releasing its dependences, it directly calls
`__kmp_omp_task`. This could cause a problem that if `__kmp_push_task` returns
`TASK_NOT_PUSHED`, the task will be executed immediately. However, the hidden
helper threads are assumed to only execute hidden helper tasks. This could cause
problems because when calling `__kmp_omp_task`, the encountering gtid, which is
not the real one of the thread, is passed.

This patch uses `__kmp_give_task`, but because it is a static function, a new
wrapper `__kmpc_give_task` is added.

Reviewed By: AndreyChurbanov

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

2 years ago[hwasan] Use stack safety analysis.
Florian Mayer [Thu, 22 Jul 2021 21:19:21 +0000 (14:19 -0700)]
[hwasan] Use stack safety analysis.

This avoids unnecessary instrumentation.

Reviewed By: eugenis, vitalybuka

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

2 years ago[Bazel] Rename LLVMDWP to DWP
Geoffrey Martin-Noble [Thu, 22 Jul 2021 23:05:40 +0000 (16:05 -0700)]
[Bazel] Rename LLVMDWP to DWP

Since Bazel has packages, we don't prefix target names with LLVM. I
forgot when translating the CMake.

2 years ago[docs] Add the compiler-rt requirement to the test suite doc
Mircea Trofin [Wed, 28 Apr 2021 16:09:01 +0000 (09:09 -0700)]
[docs] Add the compiler-rt requirement to the test suite doc

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

2 years ago[Bazel] Change external_zlib attribute to string
Michael McLoughlin [Thu, 22 Jul 2021 23:01:49 +0000 (16:01 -0700)]
[Bazel] Change external_zlib attribute to string

When using `llvm_zlib_external` rule with `external_zlib` attribute set to a
label referring to the main repository, like `@//third_party/zlib`, it will be
replaced with `//third_party/zlib` after template substitution. This will then
attempt to find `//third_party/zlib` within the local repository
`@llvm_zlib//third_party/zlib`, which does not exist, rather than the intended
reference back to the main repository. The issue appears to be that the
conversion of `Label` type to string with
`str(repository_ctx.attr.external_zlib)`, which is causing the main repository
qualifier to be lost.

This diff fixes the issue by changing the `external_zlib` attribute to
`attr.string` type rather than `attr.label`.

In future a more elegant solution may be possible that preserves use of the
`Label` type, depending on resolution of the issue
https://github.com/bazelbuild/bazel/issues/13731.

Ported from Github PR https://github.com/google/llvm-bazel/pull/236.

Reviewed By: GMNGeoffrey

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

2 years ago[mlir][tosa] Quantized Conv2DOp lowering to linalg added.
Rob Suderman [Tue, 20 Jul 2021 21:41:37 +0000 (14:41 -0700)]
[mlir][tosa] Quantized Conv2DOp lowering to linalg added.

Includes a version of a quantized conv2D operations with a lowering from TOSA
to linalg with corresponding test. We keep the quantized and quantized variants
as separate named ops to avoid the additional operations for non-quantized
convolutions.

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

2 years ago[dfsan] Add wrappers for v*printf functions
George Balatsouras [Fri, 16 Jul 2021 21:53:32 +0000 (14:53 -0700)]
[dfsan] Add wrappers for v*printf functions

Functions `vsnprintf`, `vsprintf` and `vfprintf` commonly occur in DFSan warnings.

Reviewed By: stephan.yichao.zhao

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

2 years ago[OpenMP] Renaming RT functions `GetNumberOfBlocksInKernel` and `GetNumberOfThreadsInB...
Jose M Monsalve Diaz [Thu, 22 Jul 2021 22:17:09 +0000 (18:17 -0400)]
[OpenMP] Renaming RT functions `GetNumberOfBlocksInKernel` and `GetNumberOfThreadsInBlock`

These functions should follow the camel case convention. These are really easy to change
and are needed for D106033.

Reviewed By: JonChesterfield

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

2 years agoFix the logic so stop-hooks get run after a breakpoint that ran an expression
Jim Ingham [Thu, 22 Jul 2021 19:03:12 +0000 (12:03 -0700)]
Fix the logic so stop-hooks get run after a breakpoint that ran an expression

Code was added to Target::RunStopHook to make sure that we don't run stop hooks when
you stop after an expression evaluation. But the way it was done was to check that we
hadn't run an expression since the last natural stop. That failed in the case where you
stopped for a breakpoint which had run an expression, because the stop-hooks get run
after the breakpoint actions, and so by the time we got to running the stop-hooks,
we had already run a user expression.

I fixed this by adding a target ivar tracking the last natural stop ID at which we had
run a stop-hook. Then we keep track of this and make sure we run the stop-hooks only
once per natural stop.

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

2 years ago[AArch64] Regenerate test arm64-ccmp.ll
Eli Friedman [Thu, 22 Jul 2021 22:03:05 +0000 (15:03 -0700)]
[AArch64] Regenerate test arm64-ccmp.ll

2 years ago[Bazel] Update for f8c6515554
Geoffrey Martin-Noble [Thu, 22 Jul 2021 21:51:04 +0000 (14:51 -0700)]
[Bazel] Update for f8c6515554

Update Bazel for
https://github.com/llvm/llvm-project/commit/f8c6515554 by splitting out
an LLVMDWP library target.

2 years ago[DebugInfo] Add -fno-ctor-homing for as counterpart to -fuse-ctor-homing
Amy Huang [Thu, 22 Jul 2021 18:26:03 +0000 (11:26 -0700)]
[DebugInfo] Add -fno-ctor-homing for as counterpart to -fuse-ctor-homing

Add an opt out flag for constructor homing.

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

2 years agoPR51158: Don't emit -Wswitch or -Wcovered-switch-default for empty enums
David Blaikie [Thu, 22 Jul 2021 21:23:32 +0000 (14:23 -0700)]
PR51158: Don't emit -Wswitch or -Wcovered-switch-default for empty enums

An empty enum is used to implement C++'s new-ish "byte" type (to make
sure it's a separate type for overloading, etc - compared to a typedef)
- without any enumerators. Some clang warnings don't make sense in this
sort of situation, so let's skip them for empty enums.

It's arguable that possibly some situations of enumerations without
enumerators might want the previous-to-this-patch behavior (if the enum
is autogenerated and in some cases comes up empty, then maybe a default
in an empty switch would still be considered problematic - so that when
you add the first enumeration you do get a -Wswitch warning). But I
think that's niche enough & this std::byte case is mainstream enough
that we should prioritize the latter over the former.

If someone's got a middle ground proposal to account for both of those
situations, I'm open to patches/suggestions/etc.

2 years ago[dfsan] Make warn_unimplemented off by default
Jianzhou Zhao [Thu, 22 Jul 2021 21:00:45 +0000 (21:00 +0000)]
[dfsan] Make warn_unimplemented off by default

Because almost all internal use cases need to turn warn_unimplemented off.

2 years ago[SimplifyCFG] SimplifyCondBranchToTwoReturns(): really only deal with different ret...
Roman Lebedev [Thu, 22 Jul 2021 21:13:46 +0000 (00:13 +0300)]
[SimplifyCFG] SimplifyCondBranchToTwoReturns(): really only deal with different ret blocks

This function is called when some predecessor of an empty return block
ends with a conditional branch, with both successors being empty ret blocks.

Now, because of the way SimplifyCFG works, it might happen to simplify
one of the blocks in a way that makes a conditional branch
into an unconditional one, since it's destinations are now identical,
but it might not have actually simplified said conditional branch
into an unconditional one yet.

So, we have to check that ourselves first,
especially now that SimplifyCFG aggressively tail-merges
all ret and resume blocks.

Even if it was an unconditional branch already,
`SimplifyCFGOpt::simplifyReturn()` doesn't call `FoldReturnIntoUncondBranch()`
by default.

2 years ago[NFC][LoopDeletion] Autogenerate checlines in simplify-then-delete.ll test
Roman Lebedev [Thu, 22 Jul 2021 21:28:43 +0000 (00:28 +0300)]
[NFC][LoopDeletion] Autogenerate checlines in simplify-then-delete.ll test

2 years ago[NFC][SimplifyCFG] Add test for SimplifyCondBranchToTwoReturns() mishandling
Roman Lebedev [Thu, 22 Jul 2021 21:09:44 +0000 (00:09 +0300)]
[NFC][SimplifyCFG] Add test for SimplifyCondBranchToTwoReturns() mishandling

2 years ago[DWP] Refactoring llvm-dwp in to a library part 2
Alexander Yermolovich [Thu, 22 Jul 2021 21:11:49 +0000 (14:11 -0700)]
[DWP] Refactoring llvm-dwp in to a library part 2

This is follow up to https://reviews.llvm.org/D106198 where llvm-dwp was refactored in to multiple files.
In this patch moving them in to lib/include directories.

Reviewed By: dblaikie

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

2 years ago[asan] Modified ASAN_MEMORY_ACCESS_CALLBACK to use a function call to ReportGenericEr...
Kirill Stoimenov [Wed, 21 Jul 2021 16:20:35 +0000 (16:20 +0000)]
[asan] Modified ASAN_MEMORY_ACCESS_CALLBACK to use a function call to ReportGenericErrorWrapper.

This change eliminate the stack frame for the fast path and improves runtime performance.

Reviewed By: vitalybuka

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

2 years ago[NFC] Fix test build breakage on Darwin
Shu-Chun Weng [Thu, 22 Jul 2021 21:17:58 +0000 (14:17 -0700)]
[NFC] Fix test build breakage on Darwin

2 years agoReland: "[WebAssembly] Deduplicate imports of the same module name, field name, and...
Nick Fitzgerald [Thu, 22 Jul 2021 21:12:50 +0000 (14:12 -0700)]
Reland: "[WebAssembly] Deduplicate imports of the same module name, field name, and type"

When two symbols import the same thing, only one import should be
emitted in the Wasm file.

Fixes https://bugs.llvm.org/show_bug.cgi?id=50938

Reverted in: 16aac493e59519377071e900d119ba2e7e5b525d.

Reviewed By: sbc100

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

2 years ago[mlir] Also update inferReturnTensorTypes (NFC)
Jacques Pienaar [Thu, 22 Jul 2021 20:57:36 +0000 (13:57 -0700)]
[mlir] Also update inferReturnTensorTypes (NFC)

Missed this one in the first go.

2 years ago[lldb] Fix build failure introduced by 3d4cadfb26437bd686ca8177f5454a366fed59eb
Med Ismail Bennani [Thu, 22 Jul 2021 20:54:27 +0000 (20:54 +0000)]
[lldb] Fix build failure introduced by 3d4cadfb26437bd686ca8177f5454a366fed59eb

This patch updates the `ScriptedProcess::GetGenericInteger` return type
to `llvm::Optional<unsigned long long>` to match implementation.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[lldb/Interpreter] Conform ScriptedProcessPythonInterface to SWIG python types
Med Ismail Bennani [Thu, 22 Jul 2021 20:47:25 +0000 (20:47 +0000)]
[lldb/Interpreter] Conform ScriptedProcessPythonInterface to SWIG python types

This patch should address the compiler warnings due to mismatch type
comparaison.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[LLD] [COFF] Make -export-all-symbols work as intended for EXEs
Martin Storsjö [Sun, 18 Jul 2021 19:52:32 +0000 (22:52 +0300)]
[LLD] [COFF] Make -export-all-symbols work as intended for EXEs

If some symbols are marked with dllexport, we still want to export
all symbols if -export-all-symbols is specified. Previously, this
only worked as it should for DLL output, not for EXE.

This should fix downstream bug
https://github.com/msys2/MINGW-packages/issues/9163.

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

2 years ago[MLGO] Correct protobuf path
Mircea Trofin [Thu, 22 Jul 2021 20:24:28 +0000 (13:24 -0700)]
[MLGO] Correct protobuf path

2 years ago[clang-tidy] performance-unnecessary-copy-initialization: Create option to exclude...
Felix Berger [Fri, 16 Jul 2021 18:38:47 +0000 (14:38 -0400)]
[clang-tidy] performance-unnecessary-copy-initialization: Create option to exclude container types from triggering the check.

Add string list option of type names analagous to `AllowedTypes` which lets
users specify a list of ExcludedContainerTypes.

Types matching this list will not trigger the check when an expensive variable
is copy initialized from a const accessor method they provide, i.e.:

```
ExcludedContainerTypes = 'ExcludedType'

void foo() {
  ExcludedType<ExpensiveToCopy> Container;
  const ExpensiveToCopy NecessaryCopy = Container.get();
}
```

Even though an expensive to copy variable is copy initialized the check does not
trigger because the container type is excluded.

This is useful for container types that don't own their data, such as view types
where modification of the returned references in other places cannot be reliably
tracked, or const incorrect types.

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

Reviewed-by: ymandel
2 years ago[WebAssembly] Implementation of global.get/set for reftypes in LLVM IR
Paulo Matos [Thu, 22 Jul 2021 19:11:39 +0000 (21:11 +0200)]
[WebAssembly] Implementation of global.get/set for reftypes in LLVM IR

Reland of 31859f896.

This change implements new DAG notes GLOBAL_GET/GLOBAL_SET, and
lowering methods for load and stores of reference types from IR
globals. Once the lowering creates the new nodes, tablegen pattern
matches those and converts them to Wasm global.get/set.

Reviewed By: tlively

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

2 years ago[NFC][MLGO] Fix vector sizing
Mircea Trofin [Thu, 22 Jul 2021 19:47:49 +0000 (12:47 -0700)]
[NFC][MLGO] Fix vector sizing

The bots only build release mode, and the use of `reserve` instead of
`resize`, while not causing invalid memory accesses, is incorrect.

2 years ago[AIX] Define __LONGDOUBLE64 macro
Jake Egan [Thu, 22 Jul 2021 19:44:26 +0000 (15:44 -0400)]
[AIX] Define __LONGDOUBLE64 macro

This patch defines the macro __LONGDOUBLE64 for AIX when long double is 8 bytes.

Reviewed By: cebowleratibm

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

2 years ago[NFCI][TLI] prepare[US]REMEqFold(): don't add nonsensical 'exact' flag to rotates...
Roman Lebedev [Thu, 22 Jul 2021 19:59:22 +0000 (22:59 +0300)]
[NFCI][TLI] prepare[US]REMEqFold(): don't add nonsensical 'exact' flag to rotates created

As pointed out by Craig Topper.

2 years ago[ms] [llvm-ml] Fix macro case-insensitivity
Eric Astor [Thu, 22 Jul 2021 19:50:37 +0000 (15:50 -0400)]
[ms] [llvm-ml] Fix macro case-insensitivity

We previously had issues identifying macros not registered with a lowercase name.

Reviewed By: mstorsjo, thakis

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

2 years ago[AIX] Generate large code model relocations when mcmodel=medium on AIX
Anjan Kumar Guttahalli Krishna [Thu, 22 Jul 2021 04:20:11 +0000 (00:20 -0400)]
[AIX] Generate large code model relocations when mcmodel=medium on AIX

This patch makes the changes in the driver that converts the medium code
model to large.

Reviewed By: hubert.reinterpretcast

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

2 years agoFix TSAN signal interceptor out-of-bound access
Shu-Chun Weng [Wed, 21 Jul 2021 17:59:09 +0000 (10:59 -0700)]
Fix TSAN signal interceptor out-of-bound access

signal(2) and sigaction(2) have defined behaviors for invalid signal number
(EINVAL) and some programs rely on it.

The added test case also reveals that MSAN is too strict in this regard.

Test case passed on x86_64 Linux and AArch64 Linux.

Reviewed By: vitalybuka

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

2 years ago[LICM][SCCP] Regenerate test checks (NFC)
Nikita Popov [Thu, 22 Jul 2021 19:06:39 +0000 (21:06 +0200)]
[LICM][SCCP] Regenerate test checks (NFC)

2 years ago[AIX] Clang's library integration support for 128-bit long double is incomplete on...
Anjan Kumar Guttahalli Krishna [Thu, 22 Jul 2021 19:32:06 +0000 (15:32 -0400)]
[AIX] Clang's library integration support for 128-bit long double is incomplete on AIX.

Emit the unsupported option error until the Clang's library integration support for 128-bit long double is available for AIX.

Reviewed By: Whitney, cebowleratibm

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

2 years ago[mlir] Update to use ValueShapeRange (NFC)
Jacques Pienaar [Thu, 22 Jul 2021 19:24:48 +0000 (12:24 -0700)]
[mlir] Update to use ValueShapeRange (NFC)

Update to use alias in preparation for changing it to not just be a pure alias.

2 years ago[libomptarget][amdgpu][nfc] Normalise license headers
Jon Chesterfield [Thu, 22 Jul 2021 19:22:49 +0000 (20:22 +0100)]
[libomptarget][amdgpu][nfc] Normalise license headers

Reviewed By: gregrodgers, jdoerfert

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

2 years ago[SimplifyCFG] FoldTwoEntryPHINode(): bailout on inverted logical and/or (PR51149)
Roman Lebedev [Thu, 22 Jul 2021 19:11:46 +0000 (22:11 +0300)]
[SimplifyCFG] FoldTwoEntryPHINode(): bailout on inverted logical and/or (PR51149)

The logical (select) form of and/or will now be a source of problems.
We don't really account for it's inverted form, yet it exists,
and presumably we should treat it just like non-inverted form:
https://alive2.llvm.org/ce/z/BU9AXk

https://bugs.llvm.org/show_bug.cgi?id=51149 reports a reportedly-serious
perf regression that will hopefully be mitigated by this.

2 years ago[NFC][SimplifyCFG] Add some more tests w/ two-entry PHI nodes and
Roman Lebedev [Thu, 22 Jul 2021 19:07:23 +0000 (22:07 +0300)]
[NFC][SimplifyCFG] Add some more tests w/ two-entry PHI nodes and

2 years ago[clang-tidy] performance-unnecessary-copy-initialization: Disable check when variable...
Felix Berger [Wed, 14 Jul 2021 20:11:55 +0000 (16:11 -0400)]
[clang-tidy] performance-unnecessary-copy-initialization: Disable check when variable and initializer have different replaced template param types.

This can happen when a template with two parameter types is instantiated with a
single type. The fix would only be valid for this instantiation but fail for
others that rely on an implicit type conversion.

The test cases illustrate when the check should trigger and when not.

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

2 years ago[nfc] Fix typo in comment, s/node/note
Jon Chesterfield [Thu, 22 Jul 2021 19:16:53 +0000 (20:16 +0100)]
[nfc] Fix typo in comment, s/node/note

2 years ago[CostModel][X86] Adjust shift SSE4 legalized costs based on llvm-mca reports.
Simon Pilgrim [Thu, 22 Jul 2021 19:07:18 +0000 (20:07 +0100)]
[CostModel][X86] Adjust shift SSE4 legalized costs based on llvm-mca reports.

Update shl/lshr/ashr costs based on the worst case costs from the script in D103695 - many of the 128-bit shifts (usually where integer multiplies aren't used) have similar behaviour to AVX1 so we can merge them.

2 years ago[CostModel][X86] Fix funnel shift check prefixes
Simon Pilgrim [Thu, 22 Jul 2021 19:00:05 +0000 (20:00 +0100)]
[CostModel][X86] Fix funnel shift check prefixes

We'd lost AVX1 test coverage due to bulldozer (XOP) trying to use the same check prefixes - we really need to fix the update script to avoid this!

2 years ago[libomptarget][amdgpu][nfc] Replace use of gelf.h with libelf.h
Jon Chesterfield [Thu, 22 Jul 2021 19:04:13 +0000 (20:04 +0100)]
[libomptarget][amdgpu][nfc] Replace use of gelf.h with libelf.h

AMDGPU can assume Elf64 so doesn't need to abstract over Elf32

Drop a few other unused headers at the same time. Now only llvm elf
and libelf are used by the plugin.

Reviewed By: jdoerfert

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

2 years agoCorrectly diagnose taking the address of a register variable in C
Aaron Ballman [Thu, 22 Jul 2021 18:49:21 +0000 (14:49 -0400)]
Correctly diagnose taking the address of a register variable in C

We caught the cases where the user would explicitly use the & operator,
but we were missing implicit conversions such as array decay.

Fixes PR26336. Thanks to Samuel Neves for inspiration for the patch.

2 years ago[gn build] Port 3959c95deb11
LLVM GN Syncbot [Thu, 22 Jul 2021 18:41:45 +0000 (18:41 +0000)]
[gn build] Port 3959c95deb11

2 years ago[X86] Fix SLM FP<->INT throughputs.
Simon Pilgrim [Thu, 22 Jul 2021 18:26:07 +0000 (19:26 +0100)]
[X86] Fix SLM FP<->INT throughputs.

Noticed while trying to clean up the shift costs model for SSE4 targets using the script in D10369 - SLM double-pumps all the 128-bit vector conversion ops and only use FP0 pipe - numbers taken from Intel AOM + Agner.

2 years ago[ARC] Add disassembly for the conditioned RSUB immediate instruction
Thomas Johnson [Thu, 22 Jul 2021 18:15:24 +0000 (11:15 -0700)]
[ARC] Add disassembly for the conditioned RSUB immediate instruction

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

2 years ago[Matrix] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build after D106457...
Fangrui Song [Thu, 22 Jul 2021 18:33:01 +0000 (11:33 -0700)]
[Matrix] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build after D106457. NFC

2 years ago[libc++] Add helper type non-propagating-cache
Louis Dionne [Mon, 19 Jul 2021 16:12:49 +0000 (12:12 -0400)]
[libc++] Add helper type non-propagating-cache

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

2 years ago[libc++][docs] Take lock for range.single.view.
zoecarver [Thu, 22 Jul 2021 18:15:24 +0000 (11:15 -0700)]
[libc++][docs] Take lock for range.single.view.

Mark this item as in progress and assigned to me.

2 years ago[clang][test] Add -fuse-ld= to test case added in 2542c1a5a130 to resolve test failur...
Alex Lorenz [Thu, 22 Jul 2021 18:12:38 +0000 (11:12 -0700)]
[clang][test] Add -fuse-ld= to test case added in 2542c1a5a130 to resolve test failure with CLANG_DEFAULT_LINKER=lld

2 years ago[Matrix] Fix miscompile for NT matmul if the transpose has other use
Adam Nemet [Wed, 21 Jul 2021 16:46:47 +0000 (09:46 -0700)]
[Matrix] Fix miscompile for NT matmul if the transpose has other use

We should only add the fake lowering entry for the matrix remark if the
transpose is not lowered on its own.  `MapVector::insert` is used to insert
the entry during proper lowering which does not overwrite the fake entry in
the map.

We actually had test coverage for this but the reference output code was
wrong; it was storing undef rather than the transposed column.

Also add an assert that would have caught this.

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

2 years ago[mlir] Improve description of interface options
Marius Brehler [Thu, 22 Jul 2021 12:06:52 +0000 (12:06 +0000)]
[mlir] Improve description of interface options

Reviewed By: rriddle

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

2 years ago[InstCombine][test] add coverage for possible fabs folds; NFC
Krishna Kariya [Thu, 22 Jul 2021 17:18:57 +0000 (13:18 -0400)]
[InstCombine][test] add coverage for possible fabs folds; NFC

This goes with D101727 (adds FMF to the select).

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

2 years ago[clang][driver][darwin] Add driver support for Mac Catalyst
Alex Lorenz [Tue, 13 Jul 2021 19:33:04 +0000 (12:33 -0700)]
[clang][driver][darwin] Add driver support for Mac Catalyst

This commit adds driver support for the Mac Catalyst target,
as supported by the Apple clang compile

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

2 years ago[AArch64] Adjust the cost of integer sum reductions
David Green [Thu, 22 Jul 2021 17:19:54 +0000 (18:19 +0100)]
[AArch64] Adjust the cost of integer sum reductions

This changes the cost to (LT.first-1) * cost(add) + 2, where the cost of
an add is assumed to be 1. This brings it inline with the other
reductions.

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

2 years ago[CostModel][X86] Adjust shift SSE legalized costs based on llvm-mca reports.
Simon Pilgrim [Thu, 22 Jul 2021 16:40:44 +0000 (17:40 +0100)]
[CostModel][X86] Adjust shift SSE legalized costs based on llvm-mca reports.

Update shl/lshr/ashr costs based on the worst case costs from the script in D103695.

2 years ago[OpenMPOpt] Add support for BooleanStateWithSetVector
Shilei Tian [Thu, 22 Jul 2021 16:37:43 +0000 (12:37 -0400)]
[OpenMPOpt] Add support for BooleanStateWithSetVector

D101977 added `BooleanStateWithPtrSetVector` to store pointers to a set meanwhile
tracking boolean state. One of the limitation is that it can only store pointer.
We might want it to store other types of values, such as integer for parallel
level. This patch generalizes the idea and create `BooleanStateWithSetVector`.
`BooleanStateWithPtrSetVector` therefore becomes a type alias of `BooleanStateWithSetVector`.

Reviewed By: jdoerfert

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

2 years ago[test] Add llvm-stress to LLVM_TEST_DEPENDS and lit substitutions
Fangrui Song [Thu, 22 Jul 2021 16:37:01 +0000 (09:37 -0700)]
[test] Add llvm-stress to LLVM_TEST_DEPENDS and lit substitutions

D106430 added a test which needs LLVM_TEST_DEPENDS and lit substitution.

2 years ago[MLIR][memref] Fix findDealloc() to handle > 1 dealloc for the given alloc.
Rahul Joshi [Thu, 22 Jul 2021 00:13:40 +0000 (17:13 -0700)]
[MLIR][memref] Fix findDealloc() to handle > 1 dealloc for the given alloc.

- Change findDealloc() to return Optional<Operation *> and return None if > 1
  dealloc is associated with the given alloc.
- Add findDeallocs() to return all deallocs associated with the given alloc.
- Fix current uses of findDealloc() to bail out if > 1 dealloc is found.

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

2 years ago[libomptarget][amdgpu] Implement dlopen of libhsa
Jon Chesterfield [Thu, 22 Jul 2021 15:54:10 +0000 (16:54 +0100)]
[libomptarget][amdgpu] Implement dlopen of libhsa

AMDGPU plugin equivalent of D95155, build without HSA installed locally

Compiles a new file, plugins/amdgpu/dynamic_hsa/hsa.cpp, to an object file that
exposes the same symbols that the plugin presently uses from hsa. The object
file contains dlopen of hsa and cached dlsym calls. Also provides header files
corresponding to the subset that is used.

This is behind a feature flag, LIBOMPTARGET_FORCE_DLOPEN_LIBHSA, default off.
That allows developers to build against the dlopen/dlsym implementation, e.g.
while testing this mode.

Enabling by default will cause this plugin to build on a wider variety of
machines than it does at present so may break some CI builds. That risk can
be minimised by reviewing the header dependencies of the library and ensuring
it doesn't use any libraries that are not already used by libomptarget.

Separating the implementation from enabling by default in case the latter needs
to be rolled back after wider CI results.

Reviewed By: jdoerfert

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

2 years ago[PowerPC] Add PowerPC "__stbcx" builtin and intrinsic for XL compatibility
Victor Huang [Thu, 22 Jul 2021 15:05:30 +0000 (10:05 -0500)]
[PowerPC] Add PowerPC "__stbcx" builtin and intrinsic for XL compatibility

This patch is in a series of patches to provide builtins for compatibility
with the XL compiler. This patch adds the builtin and intrinsic for "__stbcx".

Reviewed By: nemanjai, #powerpc

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

2 years ago[OpenCL][NFC] Refactors lang version check in test.
Anastasia Stulova [Thu, 22 Jul 2021 15:43:18 +0000 (16:43 +0100)]
[OpenCL][NFC] Refactors lang version check in test.

Fixed test to use predefined version marco instead
of passing extra macro in the command line.

Patch by Topotuna (Justas Janickas)!

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

2 years ago[OPENMP]Fix PR49787: Codegen for calling __tgt_target_teams_nowait_mapper has too...
Alexey Bataev [Thu, 22 Jul 2021 15:11:49 +0000 (08:11 -0700)]
[OPENMP]Fix PR49787: Codegen for calling __tgt_target_teams_nowait_mapper has too few arguments.

Added missed arguments in
__tgt_target_teams_nowait_mapper/__tgt_target_nowait_mapper runtime
functions calls.

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

2 years ago[lld/mac] Move handling of special undefineds later
Nico Weber [Thu, 22 Jul 2021 14:31:39 +0000 (10:31 -0400)]
[lld/mac] Move handling of special undefineds later

treatUndefinedSymbol() was previously called before gatherInputSections()
and markLive() for these special symbols, but after them for normal
undefineds.

For PR50760, treatUndefinedSymbol() will have to potentially create
sections, so it's good to move treatUndefinedSymbol() for special
undefineds later, so that it can assume that gatherInputSections()
and markLive() has already been called always.

No intended behavior change, but part of PR50760 (and covered in
tests in the patch for the full feature).

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

2 years agoRevert "[OPENMP]Fix PR49787: Codegen for calling __tgt_target_teams_nowait_mapper...
Alexey Bataev [Thu, 22 Jul 2021 15:06:03 +0000 (08:06 -0700)]
Revert "[OPENMP]Fix PR49787: Codegen for calling __tgt_target_teams_nowait_mapper has too few arguments."

This reverts commit b455f7f22564a096c043b02fa159ab16669c121c to fix
buildbots.

2 years ago[lldb] Remove a wrong assert in TestStructTypes that checks that empty structs in...
Raphael Isemann [Thu, 22 Jul 2021 14:56:32 +0000 (16:56 +0200)]
[lldb] Remove a wrong assert in TestStructTypes that checks that empty structs in C always have size 0

D105471 fixes the way we assign sizes to empty structs in C mode. Instead of
just giving them a size 0, we instead use the size we get from DWARF if possible.

After landing D105471 the TestStructTypes test started failing on Windows. The
tests checked that the size of an empty C struct is 0 while the size LLDB now
reports is 4 bytes. It turns out that 4 bytes are the actual size Clang is using
for C structs with the MicrosoftRecordLayoutBuilder. The commit that introduced
that behaviour is 00a061dccc6671c96412d7b28ab2012963208579.

This patch removes that specific check from TestStructTypes. Note that D105471
added a series of tests that already cover this case (and the added checks
automatically adjust to whatever size the target compiler chooses for empty
structs).

2 years ago[OPENMP]Fix PR49787: Codegen for calling __tgt_target_teams_nowait_mapper has too...
Alexey Bataev [Wed, 21 Jul 2021 20:35:09 +0000 (13:35 -0700)]
[OPENMP]Fix PR49787: Codegen for calling __tgt_target_teams_nowait_mapper has too few arguments.

Added missed arguments in
__tgt_target_teams_nowait_mapper/__tgt_target_nowait_mapper runtime
functions calls.

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

2 years ago[HIP] Fix no matching constructor for init of shared_ptr and malloc
Aaron En Ye Shi [Wed, 21 Jul 2021 17:21:04 +0000 (17:21 +0000)]
[HIP] Fix no matching constructor for init of shared_ptr and malloc

Allow standard header versions of malloc and free to be defined
before introducing the device versions.

Fixes: SWDEV-295901

Reviewed By: yaxunl

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

2 years ago[libomptarget][nfc] Improve static assert message in dlwrap
Jon Chesterfield [Thu, 22 Jul 2021 14:24:19 +0000 (15:24 +0100)]
[libomptarget][nfc] Improve static assert message in dlwrap

Revision of D102858. Raise dlwrap arity argument to template argument
so the correct value is given in the error message. E.g. '2 == 1' instead of
'2 == trait<>::nargs'.

Arity higher than it should be:
Before diff
```
$/plugins/cuda/dynamic_cuda/cuda.cpp:23:1: error:
      static_assert failed due to requirement '2 == trait<cudaError_enum (*)(unsigned int)>::nargs'
      "Arity Error"
DLWRAP_INTERNAL(cuInit, 2);
^~~~~~~~~~~~~~~~~~~~~~~~~~
...
$/include/dlwrap.h:166:3: note: expanded from macro
      'DLWRAP_COMMON'
  static_assert(ARITY == trait<decltype(&SYMBOL)>::nargs, "Arity Error");      \
```

After diff
In file included from $/plugins/cuda/dynamic_cuda/cuda.cpp:16:
```
$/include/dlwrap.h:131:3: error: static_assert failed due to
      requirement '2UL == 1UL' "Arity Error"
  static_assert(Requested == Required, "Arity Error");
  ^             ~~~~~~~~~~~~~~~~~~~~~
$/plugins/cuda/dynamic_cuda/cuda.cpp:23:1: note: in
      instantiation of function template specialization 'dlwrap::verboseAssert<2UL, 1UL>' requested
      here
DLWRAP_INTERNAL(cuInit, 2);
```

Arity lower than it should be:
Before diff
```
$/plugins/cuda/dynamic_cuda/cuda.cpp:131:10: error: no
      matching function for call to 'dlwrap_cuInit'
  return dlwrap_cuInit(X);
         ^~~~~~~~~~~~~
$/plugins/cuda/dynamic_cuda/cuda.cpp:23:1: note: candidate
      function not viable: requires 0 arguments, but 1 was provided
DLWRAP_INTERNAL(cuInit, 0);
```

After diff
In file included from $/plugins/cuda/dynamic_cuda/cuda.cpp:16:
```
$/include/dlwrap.h:131:3: error: static_assert failed due to
      requirement '0UL == 1UL' "Arity Error"
  static_assert(Requested == Required, "Arity Error");
  ^             ~~~~~~~~~~~~~~~~~~~~~
$/plugins/cuda/dynamic_cuda/cuda.cpp:23:1: note: in
      instantiation of function template specialization 'dlwrap::verboseAssert<0UL, 1UL>' requested
      here
DLWRAP_INTERNAL(cuInit, 0);
```

Reviewed By: jdoerfert

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

2 years ago[AArch64][SME] Improve diagnostic for vector select register
Cullen Rhodes [Thu, 22 Jul 2021 13:46:19 +0000 (13:46 +0000)]
[AArch64][SME] Improve diagnostic for vector select register

Reviewed By: sdesmalen

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

2 years agoRevert "[clang][fpenv][patch] Change clang option -ffp-model=precise to select ffp...
Melanie Blower [Thu, 22 Jul 2021 13:40:54 +0000 (09:40 -0400)]
Revert "[clang][fpenv][patch] Change clang option -ffp-model=precise to select ffp-contract=on"

This reverts commit b9b696bba6702a31ac0995a494cd31c730ade5ec.
Buildbot failures see https://lab.llvm.org/buildbot#builders/118/builds/4138
and https://lab.llvm.org/buildbot#builders/110/builds/5112

2 years ago[lldb] Fix TestCompletion by using SIGPIPE instead of SIGINT as test signal
Raphael Isemann [Thu, 22 Jul 2021 13:31:12 +0000 (15:31 +0200)]
[lldb] Fix TestCompletion by using SIGPIPE instead of SIGINT as test signal

The test I added in commit 078003482e90ff5c7ba047a3d3152f0b0c392b31 was using
SIGINT for testing the tab completion. The idea is to have a signal that only
has one possible completion and I ended up picking SIGIN -> SIGINT for the test.
However on non-Linux systems there is SIGINFO which is a valid completion for
`SIGIN' and so the test fails there.

This replaces SIGIN -> SIGINT with SIGPIP -> SIGPIPE completion which according
to LLDB's signal list in Host.cpp is the only valid completion.

2 years ago[Transforms] Remove getOrCreateInitFunction (NFC)
Kazu Hirata [Thu, 22 Jul 2021 13:30:39 +0000 (06:30 -0700)]
[Transforms] Remove getOrCreateInitFunction (NFC)

The last use was removed on Jan 16, 2019 in commit
81101de5853b4ed64640220a086a67b16f36f153.

2 years ago[OpenMP] Fix warnings for uninitialized block counts
Joseph Huber [Thu, 22 Jul 2021 12:27:36 +0000 (08:27 -0400)]
[OpenMP] Fix warnings for uninitialized block counts

Summary:
Fixes some warning given for uninitialized block counts if the exection mode is
not recognized. This shouldn't happen in practice because the execution mode is
checked when it's read from the device.

2 years ago[gn build] (manually) port 78bda894129 from 2012 because 924d62ca4a85 added it to...
Nico Weber [Thu, 22 Jul 2021 13:11:07 +0000 (09:11 -0400)]
[gn build] (manually) port 78bda894129 from 2012 because 924d62ca4a85 added it to check-llvm

2 years agoImplement _ExtInt conversion rules
Aaron Ballman [Thu, 22 Jul 2021 13:10:36 +0000 (09:10 -0400)]
Implement _ExtInt conversion rules

Clang implemented the _ExtInt datatype as a bit-precise integer type,
which was then proposed to WG14. WG14 has accepted the proposal
(http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2709.pdf), but Clang
requires some additional work as a result.

In the original Clang implementation, we elected to disallow implicit
conversions involving these types until after WG14 finalized the rules.
This patch implements the rules decided by WG14: no integer promotion
for bit-precise types, conversions prefer the larger of the two types
and in the event of a tie (say _ExtInt(32) and a 32-bit int), the
standard type wins.

There are more changes still needed to conform to N2709, but those will
be handled in follow-up patches.

2 years ago[lldb][NFC] Allow range-based for loops over DWARFDIE's children
Raphael Isemann [Thu, 22 Jul 2021 12:18:57 +0000 (14:18 +0200)]
[lldb][NFC] Allow range-based for loops over DWARFDIE's children

This patch adds the ability to get a DWARFDIE's children as an LLVM range.

This way we can use for range loops to iterate over them and we can use LLVM's
algorithms like `llvm::all_of` to query all children.

The implementation has to do some small shenanigans as the iterator needs to
store a DWARFDIE, but a DWARFDIE container is also a DWARFDIE so it can't return
the iterator by value. I just made the `children` getter a templated function to
avoid the cyclic dependency.

Reviewed By: #lldb, werat, JDevlieghere

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

2 years ago[lldb/Plugins] Add ScriptedProcess Process Plugin
Med Ismail Bennani [Tue, 20 Jul 2021 13:00:54 +0000 (13:00 +0000)]
[lldb/Plugins] Add ScriptedProcess Process Plugin

This patch introduces Scripted Processes to lldb.

The goal, here, is to be able to attach in the debugger to fake processes
that are backed by script files (in Python, Lua, Swift, etc ...) and
inspect them statically.

Scripted Processes can be used in cooperative multithreading environments
like the XNU Kernel or other real-time operating systems, but it can
also help us improve the debugger testing infrastructure by writting
synthetic tests that simulates hard-to-reproduce process/thread states.

Although ScriptedProcess is not feature-complete at the moment, it has
basic execution capabilities and will improve in the following patches.

rdar://65508855

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[clang][fpenv][patch] Change clang option -ffp-model=precise to select ffp-contract=on
Melanie Blower [Thu, 22 Jul 2021 11:58:50 +0000 (07:58 -0400)]
[clang][fpenv][patch] Change clang option -ffp-model=precise to select ffp-contract=on

Change the ffp-model=precise to enables -ffp-contract=on (previously
-ffp-model=precise enabled -ffp-contract=fast). This is a follow-up
to Andy Kaylor's comments in the llvm-dev discussion "Floating Point
semantic modes". From the same email thread, I put Andy's distillation
of floating point options and floating point modes into UsersManual.rst
Also fixes bugs.llvm.org/show_bug.cgi?id=50222

Reviewed By: rjmccall, andrew.kaylor

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

2 years ago[lldb] Fix that `process signal` completion always returns all signals
Raphael Isemann [Thu, 22 Jul 2021 11:37:34 +0000 (13:37 +0200)]
[lldb] Fix that `process signal` completion always returns all signals

`CompletionRequest::AddCompletion` adds the given string as completion of the
current command token. `CompletionRequest::TryCompleteCurrentArg` only adds it
if the current token is a prefix of the given string. We're using
`AddCompletion` for the `process signal` handler which means that `process
signal SIGIN` doesn't get uniquely completed to `process signal SIGINT` as we
unconditionally add all other signals (such as `SIGABRT`) as possible
completions.

By using `TryCompleteCurrentArg` we actually do the proper filtering which will
only add `SIGINT` (as that's the only signal with the prefix 'SIGIN' in the
example above).

Reviewed By: mib

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

2 years ago[LoopVectorize] Fix crash for predicated instruction with scalable VF
Caroline Concatto [Wed, 5 May 2021 14:20:16 +0000 (15:20 +0100)]
[LoopVectorize] Fix crash for predicated instruction with scalable VF

This patch avoids computing discounts for predicated instructions  when the
VF is scalable.
There is no support for vectorization of loops with division because the
vectorizer cannot guarantee that zero divisions will not happen.

This loop now does not use VF scalable

```
for (long long i = 0; i < n; i++)
    if (cond[i])
      a[i] /= b[i];
```

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

2 years agoAdd support for zero-sized Scalars as a LowLevelType
Paulo Matos [Fri, 16 Jul 2021 08:34:44 +0000 (10:34 +0200)]
Add support for zero-sized Scalars as a LowLevelType

Opaque values (of zero size) can be stored in memory with the
implemention of reference types in the WebAssembly backend. Since
MachineMemOperand uses LLTs we need to be able to support
zero-sized scalars types in LLTs.

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

2 years ago[lldb][NFCI] Remove redundant accessibility heuristic in the DWARF parser
Raphael Isemann [Thu, 22 Jul 2021 11:31:23 +0000 (13:31 +0200)]
[lldb][NFCI] Remove redundant accessibility heuristic in the DWARF parser

LLDB's DWARF parser has some heuristics for guessing and fixing up the
accessibility of C++ class/struct members after they were already created in the
internal Clang AST. The heuristic is that if a struct/class has a base class,
then it's actually a class and it's members are private unless otherwise
specified.

From what I can see this heuristic isn't sound and also unnecessary. The idea
that inheritance implies that the `class` keyword was used and the default
visibility is `private` is incorrect. Also both GCC and Clang use
`DW_TAG_structure_type` and `DW_TAG_class_type` for `struct` and `class` types
respectively, so the default visibility we infer from that information is always
correct and there is no need to fix it up.

And finally, the access specifiers we set in the Clang AST are anyway unused
within LLDB. The expression parser explicitly ignores them to give users access
to private members and there is not SBAPI functionality that exposes this
information.

This patch removes all the heuristic code for the reasons above and instead
just relies on the access values we infer from the tag kind and explicit
annotations in DWARF.

This patch is NFCI.

Reviewed By: werat

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