Alex Richardson [Mon, 8 Mar 2021 14:23:42 +0000 (14:23 +0000)]
[compiler-rt] Silence a deprecation warning on FreeBSD
On FreeBSD the sys/timeb.h header has a #warning that it's deprecated.
However, we need to include this header here, so silence this warning that
is printed multiple times otherwise.
Reviewed By: dim
Differential Revision: https://reviews.llvm.org/D94963
Alex Richardson [Mon, 8 Mar 2021 14:15:15 +0000 (14:15 +0000)]
[asan][tests] Handle FreeBSD in large_func_test and use-after-delete
This is the same fix as
ab8a46024157b4d042ea6325710bbccd598adcfc for
Solaris and
23cd8d51ad519261137a40a5bbac6e537ee7ba25 (Windows+Darwin).
Alex Richardson [Mon, 8 Mar 2021 14:14:01 +0000 (14:14 +0000)]
[sanitizers] Fix typo in
ca9815fc247c
I accidentally committed the wrong version of this patch which didn't
actually enable the hooks for FreeBSD. Fixing the typo allows the tests
to actually pass.
Christian Sigg [Wed, 10 Mar 2021 09:35:20 +0000 (10:35 +0100)]
[mlir] Add base class for GpuKernelToBlobPass
Instead of configuring kernel-to-cubin/rocdl lowering through callbacks, introduce a base class that target-specific passes can derive from.
Put the base class in GPU/Transforms, according to the discussion in D98203.
The mlir-cuda-runner will go away shortly, and the mlir-rocdl-runner as well at some point. I therefore kept the existing code path working and will remove it in a separate step.
Depends On D98168
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D98279
Florian Hahn [Wed, 10 Mar 2021 09:47:53 +0000 (09:47 +0000)]
[DSE] Handle memcpy/memset with equal non-const sizes.
Currently DSE misses cases where the size is a non-const IR value, even
if they match. For example, this means that llvm.memcpy/llvm.memset
calls are not eliminated, even if they write the same number of bytes.
This patch extends isOverwite to try to get IR values for the number of
bytes written from the analyzed instructions. If the values match,
alias checks are performed and the result is returned.
At the moment this only covers llvm.memcpy/llvm.memset. In the future,
we may enable MemoryLocation to also track variable sizes, but this
simple approach should allow us to cover the important cases in DSE.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D98284
Sven van Haastregt [Wed, 10 Mar 2021 10:03:57 +0000 (10:03 +0000)]
[OpenCL] Set calling convention for -fdeclare-opencl-builtins
IR produced using TableGen builtin function declarations
(`fdeclare-opencl-builtins.cl`) did not have the target's calling
convention applied to builtin calls.
Fix this, and update the codegen test to check that IR produced using
opencl-c.h and `-fdeclare-opencl-builtins` is identical with respect
to the builtin calls.
Differential Revision: https://reviews.llvm.org/D98039
Vladislav Vinogradov [Fri, 5 Feb 2021 13:53:00 +0000 (16:53 +0300)]
[mlir] Model MemRef memory space as Attribute
Based on the following discussion:
https://llvm.discourse.group/t/rfc-memref-memory-shape-as-attribute/2229
The goal of the change is to make memory space property to have more
expressive representation, rather then "magic" integer values.
It will allow to have more clean ASM form:
```
gpu.func @test(%arg0: memref<100xf32, "workgroup">)
// instead of
gpu.func @test(%arg0: memref<100xf32, 3>)
```
Explanation for `Attribute` choice instead of plain `string`:
* `Attribute` classes allow to use more type safe API based on RTTI.
* `Attribute` classes provides faster comparison operator based on
pointer comparison in contrast to generic string comparison.
* `Attribute` allows to store more complex things, like structs or dictionaries.
It will allows to have more complex memory space hierarchy.
This commit preserve old integer-based API and implements it on top
of the new one.
Depends on D97476
Reviewed By: rriddle, mehdi_amini
Differential Revision: https://reviews.llvm.org/D96145
Hanhan Wang [Wed, 10 Mar 2021 09:51:00 +0000 (01:51 -0800)]
[mlir][linalg] Add support for using scalar attributes in TC ops.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D97876
Florian Hahn [Wed, 10 Mar 2021 09:43:41 +0000 (09:43 +0000)]
[DSE] Add tests with memset & memcpy combinations and non-const sizes.
Qiu Chaofan [Wed, 10 Mar 2021 09:27:21 +0000 (17:27 +0800)]
[NFC] [PowerPC] Remove unsafe-fp-math in some tests
As we're going to replace this ambiguous option with more precise
instruction-level fast-math description, some tests need to be updated
and the option doesn't play any role in some of them.
Juneyoung Lee [Wed, 10 Mar 2021 08:54:31 +0000 (17:54 +0900)]
[InstSimplify] Add tests for pr49495 (NFC)
Vladislav Vinogradov [Thu, 4 Mar 2021 08:28:24 +0000 (11:28 +0300)]
[ADT][NFC] Use `size_t` type for index in `indexed_accessor_range`
It makes it consistent with `size()` method return type and with
STL-like containers API.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D97921
serge-sans-paille [Mon, 8 Mar 2021 13:46:25 +0000 (14:46 +0100)]
[NFC] Remove duplicate isNoBuiltinFunc method
It's available both in CodeGenOptions and in LangOptions, and LangOptions
implementation is slightly better as it uses a StringRef instead of a char
pointer, so use it.
Differential Revision: https://reviews.llvm.org/D98175
Kirill Bobyrev [Wed, 10 Mar 2021 08:03:34 +0000 (09:03 +0100)]
[clangd] Enable reflection for clangd-index-server
This allows sending requests through CLI and more debugging
opportunities. Example:
```bash
$ grpc_cli ls localhost:50051
clang.clangd.remote.v1.SymbolIndex
grpc.reflection.v1alpha.ServerReflection
grpc.health.v1.Health
```
Valeriy Savchenko [Mon, 22 Feb 2021 17:05:12 +0000 (20:05 +0300)]
[analyzer] Fix StdLibraryFunctionsChecker performance issue
`initFunctionSummaries` lazily initializes a data structure with
function summaries for standard library functions. It is called for
every pre-, post-, and eval-call events, i.e. 3 times for each call on
the path. If the initialization doesn't find any standard library
functions in the translation unit, it will get re-tried (with the same
effect) many times even for small translation units.
For projects not using standard libraries, the speed-up can reach 50%
after this patch.
Differential Revision: https://reviews.llvm.org/D98244
Valeriy Savchenko [Tue, 9 Mar 2021 12:49:47 +0000 (15:49 +0300)]
[-Wcompletion-handler] Extend list of detected conventions
Update convention detection to accomodate changes from:
https://github.com/DougGregor/swift-evolution/blob/concurrency-objc/proposals/NNNN-concurrency-objc.md#asynchronous-completion-handler-methods
Differential Revision: https://reviews.llvm.org/D98251
Qiu Chaofan [Wed, 10 Mar 2021 07:21:32 +0000 (15:21 +0800)]
[PowerPC] Reduce symmetrical swaps for lane-insensitive vector ops
This patch simplifies pattern (xxswap (vec-op (xxswap a) (xxswap b)))
into (vec-op a b) if vec-op is lane-insensitive. The motivating case
is ScalarToVector-VecOp-ExtractElement sequence on LE, but the
peephole itself is not related to endianness, so BE may also benefit
from this.
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D97658
Fangrui Song [Wed, 10 Mar 2021 07:11:54 +0000 (23:11 -0800)]
[clangd] Treat __GCC_HAVE_DWARF2_CFI_ASM the same as isWrittenInBuiltinFile macros
Martin Storsjö [Mon, 8 Mar 2021 11:38:52 +0000 (13:38 +0200)]
[compiler-rt] Normalize i?86 to i386 and armv* to arm for COMPILER_RT_DEFAULT_TARGET_ARCH
This corresponds to getArchNameForCompilerRTLib in clang; any
32 bit x86 architecture triple (except on android, but those
exceptions are already handled in compiler-rt on a different level)
get the compiler rt library names with i386; arm targets get either
"arm" or "armhf". (Mapping to "armhf" is handled in the toplevel
CMakeLists.txt.)
Differential Revision: https://reviews.llvm.org/D98173
Fangrui Song [Wed, 10 Mar 2021 06:33:47 +0000 (22:33 -0800)]
[WPD][ELF] Allow whole program devirtualization for version script localized symbols
A `local:` version node in a version script can change the effective symbol binding
to STB_LOCAL. The linker needs to communicate the fact to enable WPD
(otherwise LTO does not know that the `!vcall_visibility` metadata has
effectively changed from VCallVisibilityPublic to VCallVisibilityLinkageUnit).
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D98220
Fangrui Song [Wed, 10 Mar 2021 06:32:28 +0000 (22:32 -0800)]
[test] Update tests
Fangrui Song [Wed, 10 Mar 2021 06:21:36 +0000 (22:21 -0800)]
Define __GCC_HAVE_DWARF2_CFI_ASM if applicable
In -fno-exceptions -fno-asynchronous-unwind-tables -g0 mode,
GCC does not emit `.cfi_*` directives.
```
% diff <(gcc -fno-asynchronous-unwind-tables -dM -E a.c) <(gcc -dM -E a.c)
130a131
> #define __GCC_HAVE_DWARF2_CFI_ASM 1
```
This macro is useful because code can decide whether inline asm should include `.cfi_*` directives.
`.cfi_*` directives without `.cfi_startproc` can cause assembler errors
(integrated assembler: `this directive must appear between .cfi_startproc and .cfi_endproc directives`).
Differential Revision: https://reviews.llvm.org/D97743
Lang Hames [Wed, 10 Mar 2021 05:54:18 +0000 (21:54 -0800)]
[JITLink] Add a null-terminator to eh-frame sections on ELF/x86-64.
__register_ehframes on Linux requires a null terminator to identify the end of
this section.
Greg McGary [Wed, 10 Mar 2021 04:40:08 +0000 (20:40 -0800)]
[lld-macho][NFC] drop opt:: when already using llvm::opt
Top-level `using llvm::opt` has been present in `lld/MachO/Driver*.cpp` for some time, so remove lingering `opt::` prefixes.
Differential Revision: https://reviews.llvm.org/D98314
Greg McGary [Wed, 10 Mar 2021 04:15:29 +0000 (20:15 -0800)]
[lld-macho][NFC] when reasonable, replace auto keyword with type names
lld policy discourages `auto`. Replace it with a type name whenever reasonable. Retain `auto` to avoid ...
* redundancy, as for decls such as `auto *t = mumble_cast<TYPE *>` or similar that specifies the result type on the RHS
* verbosity, as for iterators
* gratuitous suffering, as for lambdas
Along the way, add `const` when appropriate.
Note: a future diff will ...
* add more `const` qualifiers
* remove `opt::` when we are already `using llvm::opt`
Differential Revision: https://reviews.llvm.org/D98313
Wei Mi [Tue, 19 Jan 2021 17:20:13 +0000 (09:20 -0800)]
[SampleFDO] Support enabling -funique-internal-linkage-name.
now -funique-internal-linkage-name flag is available, and we want to flip
it on by default since it is beneficial to have separate sample profiles
for different internal symbols with the same name. As a preparation, we
want to avoid regression caused by the flip.
When we flip -funique-internal-linkage-name on, the profile is collected
from binary built without -funique-internal-linkage-name so it has no uniq
suffix, but the IR in the optimized build contains the suffix. This kind of
mismatch may introduce transient regression.
To avoid such mismatch, we introduce a NameTable section flag indicating
whether there is any name in the profile containing uniq suffix. Compiler
will decide whether to keep uniq suffix during name canonicalization
depending on the NameTable section flag. The flag is only available for
extbinary format. For other formats, by default compiler will keep uniq
suffix so they will only experience transient regression when
-funique-internal-linkage-name is just flipped.
Another type of regression is caused by places where we miss to call
getCanonicalFnName. Those places are fixed.
Differential Revision: https://reviews.llvm.org/D96932
Yao Zhao [Wed, 10 Mar 2021 03:23:03 +0000 (14:23 +1100)]
[xray] Fix xray document spelling
fix a couple of words spelling
Reviewed By: dberris
Differential Revision: https://reviews.llvm.org/D96658
Lang Hames [Wed, 10 Mar 2021 04:34:50 +0000 (20:34 -0800)]
[JITLink] Add support for STT_NOTYPE symbols to ELF/x86-64.
Lang Hames [Mon, 8 Mar 2021 04:55:13 +0000 (20:55 -0800)]
[JITLink] Assert that segment mapping does not exceed allocation size.
Philip Reames [Wed, 10 Mar 2021 04:28:39 +0000 (20:28 -0800)]
[rs4gc] common bdv operand visitation [nfc]
Yang Fan [Wed, 10 Mar 2021 03:47:00 +0000 (11:47 +0800)]
[clang][APINotes] Fix gcc Wunused-function warning (NFC)
GCC warning:
```
/llvm-project/clang/lib/APINotes/APINotesYAMLCompiler.cpp:574:6: warning: ‘void {anonymous}::Module::dump()’ defined but not used [-Wunused-function]
574 | void Module::dump() {
| ^~~~~~
```
Yang Fan [Wed, 10 Mar 2021 03:26:39 +0000 (11:26 +0800)]
[MC][ELF] Fix "enumeral and non-enumeral type in conditional expression" warning (NFC)
GCC warning:
```
/llvm-project/llvm/lib/MC/ELFObjectWriter.cpp: In member function ‘void {anonymous}::ELFWriter::writeHeader(const llvm::MCAssembler&)’:
/llvm-project/llvm/lib/MC/ELFObjectWriter.cpp:421:20: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
420 | W.OS << char(OSABI == ELF::ELFOSABI_NONE && OWriter.seenGnuAbi()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
421 | ? ELF::ELFOSABI_GNU
| ^~~~~~~~~~~~~~~~~~~
422 | : OSABI);
| ~~~~~~~
```
Philip Reames [Wed, 10 Mar 2021 03:18:15 +0000 (19:18 -0800)]
[tests] add a few more tests for D98122
Greg McGary [Wed, 3 Mar 2021 20:15:09 +0000 (12:15 -0800)]
[lld-macho] implement options -(un)exported_symbol(s_list)
Implement command-line options to alter a dylib's exported-symbols list:
* `-exported_symbol*` options override the default export list. The export list is compiled according to the command-line option(s) only.
* `-unexported_symbol*` options hide otherwise public symbols.
* `-*exported_symbol PATTERN` options specify a single literal or glob pattern.
* `-*exported_symbols_list FILE` options specify a file containing a series of lines containing symbol literals or glob patterns. Whitespace and `#`-prefix comments are stripped.
Note: This is a simple implementation of the primary use case. ld64 has much more complexity surrounding interactions with other options, many of which are obscure and undocumented. We will start simple and complexity as necessary.
Differential Revision: https://reviews.llvm.org/D98223
Ryan Prichard [Tue, 9 Mar 2021 22:20:45 +0000 (14:20 -0800)]
[Android] Default to --rtlib=compiler-rt
By default, the driver uses the compiler-rt builtins and links with
-l:libunwind.a.
Restore the previous behavior by passing --rtlib=libgcc.
Reviewed By: danalbert
Differential Revision: https://reviews.llvm.org/D96404
Arnold Schwaighofer [Fri, 5 Mar 2021 15:17:55 +0000 (07:17 -0800)]
[coro async] Transfer the original function's attributes to the clone
rdar://
75052917
Differential Revision: https://reviews.llvm.org/D98051
Jason Molenda [Wed, 10 Mar 2021 00:22:46 +0000 (16:22 -0800)]
Log in SetPrivateState when unwind logging enabled
It is easier to read the unwind logging when you can see
when the inferior resumes / stops and we're doing new unwinds.
David Blaikie [Tue, 9 Mar 2021 23:50:25 +0000 (15:50 -0800)]
Remove unused variable (rolling it into an assert)
William S. Moses [Tue, 9 Mar 2021 16:55:19 +0000 (11:55 -0500)]
[MemoryDependence] Fix invariant group store
Fix bug in MemoryDependence [and thus GVN] for invariant group.
Previously MemDep didn't verify that the store was storing into a
pointer rather than a store simply using a pointer.
Differential Revision: https://reviews.llvm.org/D98267
Mehdi Amini [Tue, 9 Mar 2021 23:30:36 +0000 (23:30 +0000)]
Fix MLIR test post
890afad954d
Mehdi Amini [Tue, 9 Mar 2021 23:13:38 +0000 (23:13 +0000)]
Fix Flang build after MLIR API changes around `generatedTypeParser`
Leonard Chan [Sat, 6 Mar 2021 00:11:01 +0000 (16:11 -0800)]
[llvm] Change DSOLocalEquivalent type if the underlying global value type changes
We encountered an issue where LTO running on IR that used the DSOLocalEquivalent
constant would result in bad codegen. The underlying issue was ValueMapper wasn't
properly handling DSOLocalEquivalent, so this just adds the machinery for handling
it. This code path is triggered by a fix to DSOLocalEquivalent::handleOperandChangeImpl
where DSOLocalEquivalent could potentially not have the same type as its underlying GV.
This updates DSOLocalEquivalent::handleOperandChangeImpl to change the type if
the GV type changes and handles this constant in ValueMapper.
Differential Revision: https://reviews.llvm.org/D97978
River Riddle [Tue, 9 Mar 2021 23:02:03 +0000 (15:02 -0800)]
[mlir][IR] Add an Operation::eraseOperands that supports batch erasure
This method allows for removing multiple disjoint operands at once, reducing the need to erase operands individually (which results in shifting the operand list).
Differential Revision: https://reviews.llvm.org/D98290
River Riddle [Tue, 9 Mar 2021 23:01:54 +0000 (15:01 -0800)]
[mlir][IR] Add a new SymbolUserMap class
This class provides efficient implementations of symbol queries related to uses, such as collecting the users of a symbol, replacing all uses, etc. This provides similar benefits to use related queries, as SymbolTableCollection did for lookup queries.
Differential Revision: https://reviews.llvm.org/D98071
Richard Smith [Tue, 9 Mar 2021 23:04:51 +0000 (15:04 -0800)]
PR49465: Disallow constant evaluation of a call to operator delete(nullptr).
The only time we would consider allowing this is inside a call to
std::allocator<T>::deallocate, whose contract does not permit deletion
of null pointers.
Alex Lorenz [Tue, 9 Mar 2021 22:42:07 +0000 (14:42 -0800)]
[clang][driver] Support Darwin SDK names with an optional prefix in their name
rdar://
74017977
Zequan Wu [Fri, 5 Mar 2021 21:38:12 +0000 (13:38 -0800)]
Revert "[llvm-cov] reset executation count to 0 after wrapped segment"
This reverts D85036
Differential Revision: https://reviews.llvm.org/D98084
Sanjay Patel [Tue, 9 Mar 2021 21:56:43 +0000 (16:56 -0500)]
[SLP] remove dead null check; NFC
We cast<> to Instruction (not dyn_cast<>), so we already
required/assumed that Cmp is not null.
Jianzhou Zhao [Sat, 6 Mar 2021 00:58:00 +0000 (00:58 +0000)]
[dfsan] Tracking origins at memory transfer
This is a part of https://reviews.llvm.org/D95835.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D98192
Mehdi Amini [Tue, 9 Mar 2021 21:59:35 +0000 (21:59 +0000)]
Fix LLVM Dialect LoopOptionsAttr round-tripping: the keywords were missing in the output
This indicated some missing test coverage, which are now added to the
roundtrip test.
David Green [Tue, 9 Mar 2021 21:57:18 +0000 (21:57 +0000)]
[ARM] Test for predicated scalar memops. NFC
This test shows a case where we can potentially scalarize the store in a
predicated loop, creating a lot of instructions that would be much
slower than scalar.
Philip Reames [Tue, 9 Mar 2021 21:48:45 +0000 (13:48 -0800)]
[tests] add tests to show effects of D98122
Dave Lee [Mon, 8 Mar 2021 21:11:08 +0000 (13:11 -0800)]
[cmake] Enable -Werror=return-type
Turn `-Wreturn-type` into an error.
This is currently used by libcxx, libcxxabi, and libunwind, and would be a good default
for all of llvm. I'm not aware of any cases where this shouldn't be an error. This
ensures different build configs, merges, and downstream branches catch issues sooner.
Differential Revision: https://reviews.llvm.org/D98224
Nathan James [Tue, 9 Mar 2021 21:39:19 +0000 (21:39 +0000)]
[clangd][NFC] Use std::string::replace in SourceCode:applyChange.
Just looks nicer and easier to read.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D98274
Alex Lorenz [Tue, 9 Mar 2021 21:18:19 +0000 (13:18 -0800)]
[clang][ObjC] allow the use of NSAttributedString * return type with format_arg attribute
This is useful for APIs that want to produce an attributed NSString as a result of
some formatting API call.
Mehdi Amini [Tue, 9 Mar 2021 21:03:20 +0000 (21:03 +0000)]
Add default LoopOptionsAttrBuilder constructor and method to check if empty() (NFC)
Also move setters out-of-line to make sure the templated helper is
actually instantiated.
Albion Fung [Tue, 9 Mar 2021 21:07:31 +0000 (16:07 -0500)]
[P10] [Power PC] Exploiting new load rightmost vector element instructions.
This pull request implements patterns to exploit the load rightmost vector
element instructions for loading element 0 on little endian PowerPC subtargets
into v8i16 and v16i8 vector registers for i16 and i8 data types.
Differential Revision: https://reviews.llvm.org/D94816#inline-921403
Juneyoung Lee [Tue, 9 Mar 2021 20:48:02 +0000 (05:48 +0900)]
Revert "[InstCombine] Add simplification of two logical and/ors"
This reverts commit
07c3b97e184d5bd828b8a680cdce46e73f3db9fc due to a reported failure in two-stage build.
Fangrui Song [Tue, 9 Mar 2021 20:46:13 +0000 (12:46 -0800)]
[profile] Fix InstrProfGetRangeRepValue to use UINT64_C
This is a minor issue because the TargetValue parameter of `__llvm_profile_instrument_memop`
is usually small and cannot exceed 2**31 at all.
Differential Revision: https://reviews.llvm.org/D97640
Philip Reames [Tue, 9 Mar 2021 20:39:47 +0000 (12:39 -0800)]
[test] precommit tests from D98222
Philip Reames [Tue, 9 Mar 2021 20:35:16 +0000 (12:35 -0800)]
[SCEV] Infer known bits from known sign bits
This was suggested by lebedev.ri over on D96534. You'll note lack of tests. During review, we weren't actually able to find a case which exercises it, but both I and lebedev.ri feel it's a reasonable change, straight forward, and near free.
Differential Revision: https://reviews.llvm.org/D97064
Peter Steinfeld [Tue, 9 Mar 2021 01:17:14 +0000 (17:17 -0800)]
[flang] Sort symbols by creation order
We have a "<" operator defined on the type semantics::Symbol that's based on
the symbols' locations in the cooked character stream. This is potentially
problematic when comparing symbols from .mod files when the cooked character
streams themselves might be allocated to varying memory locations.
This change fixes that by using the order in which symbols are created as the
basis for the "<" operator. Thanks to Tim and Peter for consultation on the
necessity of doing this and the idea for what to use as the basis of the sort.
This change in the "<" operator changed the expected results for three of the
tests. I manually inspected the new results, and they look OK to me. The
differences in data05.f90 and typeinfo01.f90 are entirely the order, offsets,
and sizes of the derived type components. The changes in resolve102.f90 are
due to the new, different "<" operator used for sorting.
Differential Revision: https://reviews.llvm.org/D98225
Florian Hahn [Tue, 9 Mar 2021 13:10:47 +0000 (13:10 +0000)]
[DSE] Add test cases with memory intrinsics and varying size values.
This patch adds a few tests for memset/memcyp with non-constant size
values. Some of the tests will be optimized in further patches.
Douglas Yung [Tue, 9 Mar 2021 20:24:32 +0000 (12:24 -0800)]
Add requirement for aarch64-registered-target to test change added in
42e3f97a9dd3a439f63a733c4ee909cba6b77e49.
George Balatsouras [Tue, 9 Mar 2021 02:05:52 +0000 (18:05 -0800)]
[dfsan] Update store.ll test
This removes hard-coded shadow width references and adds more RUN
lines to increase test coverage under different options (fast16 labels
mode).
Also, shortens the test by unifying common lines under both combine- and no-combine-ptr-label options.
Reviewed By: stephan.yichao.zhao
Differential Revision: https://reviews.llvm.org/D98227
Fangrui Song [Tue, 9 Mar 2021 20:14:12 +0000 (12:14 -0800)]
Revert D97743 "Define __GCC_HAVE_DWARF2_CFI_ASM if applicable"
This reverts commit
c11ff4bbada3b5127a1f010e0a97a1e6e46fb61a &
df67d3526962ae51446b1390e7c40e045e580ec2.
Trying to make the change to the driver to avoid round-trip issues.
Fangrui Song [Tue, 9 Mar 2021 20:04:51 +0000 (12:04 -0800)]
[test] Fix debug-info-macro.c
Christian Sigg [Tue, 9 Mar 2021 19:19:32 +0000 (20:19 +0100)]
[mlir] Default for gpu-binary-annotation option.
Provide default for gpuBinaryAnnotation so that we don't need to specify it in tests.
The annotation likely only needs to be target specific if we want to lower to e.g. both CUDA and ROCDL.
Reviewed By: herhut, bondhugula
Differential Revision: https://reviews.llvm.org/D98168
Aaron Ballman [Tue, 9 Mar 2021 19:52:59 +0000 (14:52 -0500)]
Move some attribute diagnostic helper functions; NFC.
These functions were local to SemaDeclAttr.cpp, but these functions are
useful in general (for instance, for statement or type attribute
processing). This refactoring is in advance of beginning to tablegen
diagnostic checks for statement attributes the way we already do for
declaration attributes.
There is one functional change in here as a drive-by. The
external_source_symbol attribute had one of its diagnostic checks
inside of an assert, which was corrected.
Philip Reames [Tue, 9 Mar 2021 19:44:43 +0000 (11:44 -0800)]
[cgp] improve robustness of uadd/usub transforms
LSR prefers to schedule iv increments just before the latch. The recent
80511565 broadened this to moving increments in the original IR. This pointed out a robustness problem with the CGP transform.
When we have a use of an induction increment outside of the loop (we canonicalize away from this form, but it happens e.g. unanalyzeable loops) we'd avoid performing the uadd/usub transform. Interestingly, all of these involve moving the increment closer to it's operands, so there's no concern about dominating all uses. We can handle that case cheaply, resulting in a more robust transform.
Philip Reames [Tue, 9 Mar 2021 19:39:10 +0000 (11:39 -0800)]
[tests] precommit test for an upcoming change
Mehdi Amini [Mon, 8 Mar 2021 06:06:37 +0000 (06:06 +0000)]
Switch generatedTypeParser/generatedAttributeParser to return an OptionalParseResult
This allows the caller to distinguish between a parse error or an
unmatched keyword. It fixes the redundant error that was emitted by the
caller when the generated parser would fail.
Differential Revision: https://reviews.llvm.org/D98162
Mehdi Amini [Sat, 6 Mar 2021 05:24:55 +0000 (05:24 +0000)]
Rework LLVM Dialect LoopOptions attribute
Instead of storing an array of LoopOpt attributes, which were just
wrapping std::pair<enum, int> anyway, we can have an attribute storing
a sorted ArrayRef<std::pair<enum, int>> as a single unit. This improves
here the textual format and the general API. Note that we're limiting
the options to fit into an int64_t by design, but this isn't a new
constraint.
Building the LoopOptions attribute is likely worth a specific builder
for efficient reason, that'll be the subject of a future patch.
Differential Revision: https://reviews.llvm.org/D98105
Peter Collingbourne [Wed, 6 Jan 2021 03:03:03 +0000 (19:03 -0800)]
scudo: Add support for tracking stack traces of secondary allocations.
There is no centralized store of information related to secondary
allocations. Moreover the allocations themselves become inaccessible
when the allocation is freed in order to implement UAF detection,
so we can't store information there to be used in case of UAF
anyway.
Therefore our storage location for tracking stack traces of secondary
allocations is a ring buffer. The ring buffer is copied to the process
creating the crash dump when a fault occurs.
The ring buffer is also used to store stack traces for primary
deallocations. Stack traces for primary allocations continue to be
stored inline.
In order to support the scenario where an access to the ring buffer
is interrupted by a concurrently occurring crash, the ring buffer is
accessed in a lock-free manner.
Differential Revision: https://reviews.llvm.org/D94212
Amara Emerson [Fri, 5 Mar 2021 18:10:42 +0000 (10:10 -0800)]
[AArch64][GlobalISel] Form G_DUPLANE32 for <2 x s32> shufflevectors in lowering.
For <2 x s32>, we can use G_DUPLANE32, but with a <4 x s32> source. To make it
work, we can just widen the original source with a concat_vectors.
Doing this allows <2 x float> indexed fmul instruction selection patterns to
fire, which gives a nice 0.3% code size saving on Bullet with -Os.
Differential Revision: https://reviews.llvm.org/D98059
Amara Emerson [Wed, 3 Mar 2021 22:55:03 +0000 (14:55 -0800)]
[GlobalISel] Fold away G_BUILD_VECTOR with all elements extracted.
If every element is extracted from a G_BUILD_VECTOR, pass through the source
registers. This is different to the extract(build_vector) combine because this
one tolerates multiple users as long as they're exhaustive.
Differential Revision: https://reviews.llvm.org/D97890
Philip Reames [Tue, 9 Mar 2021 19:23:07 +0000 (11:23 -0800)]
[cgp] group related code together [nfc]
Amara Emerson [Wed, 3 Mar 2021 07:48:55 +0000 (23:48 -0800)]
[AArch64][GlobalISel] Add combine for extract_vector_elt(build_vector, cst)
Differential Revision: https://reviews.llvm.org/D97835
Jay Foad [Tue, 9 Mar 2021 16:22:50 +0000 (16:22 +0000)]
[AMDGPU] Refactor AMDGPUTargetStreamer::EmitCodeEnd
Refactor and add comments to explain where the magic numbers come from
in terms of the instruction cache line size. NFC.
Differential Revision: https://reviews.llvm.org/D98266
gbtozers [Fri, 11 Sep 2020 15:19:51 +0000 (16:19 +0100)]
[DebugInfo] Process DBG_VALUE_LIST in LiveDebugValues
This patch implements DBG_VALUE_LIST handling to the LiveDebugValues pass. This
is a substantial change, and makes a few fundamental changes to the existing
logic.
We still use the basic model of a VarLocMap that is indexed by a LocIndex, with
a VarLocSet (a CoalescingBitVector underneath) giving us efficient lookups of
existing variable locations for a given location type. The main change is that
the VarLocMap may contain a given VarLoc multiple times (once for each unique
location operand), so that a VarLoc can be looked up from any of the registers
that it uses. This means that each VarLoc has multiple corresponding LocIndexes;
to allow us to iterate through the set of VarLocs (previously we would iterate
through the VarLocSet), we now also maintain a single entry in the VarLocMap
that contains every VarLoc exactly once.
The VarLoc class itself is also changed; this change is much simpler,
refactoring out location-specific members into a MachineLocation class and
adding a vector of these locations.
Differential Revision: https://reviews.llvm.org/D83890
Jordan Rupprecht [Tue, 9 Mar 2021 18:51:06 +0000 (10:51 -0800)]
[lldb][gui] Fix uninitialized variable in SourceFileWindowDelegate.
After
5419b671375c46299ff1da6c929859040e7beaf5 (which is `[SimplifyCFG] Update FoldTwoEntryPHINode to handle and/or of select and binop equally`), this uninitialized value is detected by msan.
Markus Böck [Tue, 9 Mar 2021 18:52:24 +0000 (19:52 +0100)]
[Support][test] Unconditionally use setenv macro when compiling on Windows
This test currently fails to compile when using a MinGW toolchain as setenv is not defined. This function is a POSIX function Windows does not implement.
This patch enables the setenv macro used in the unit test for all of Windows, making the test compile and run successfully.
Differential Revision: https://reviews.llvm.org/D98271
Fangrui Song [Tue, 9 Mar 2021 18:52:26 +0000 (10:52 -0800)]
Define __GCC_HAVE_DWARF2_CFI_ASM if applicable
In -fno-exceptions -fno-asynchronous-unwind-tables -g0 mode,
GCC does not emit `.cfi_*` directives.
```
% diff <(gcc -fno-asynchronous-unwind-tables -dM -E a.c) <(gcc -dM -E a.c)
130a131
> #define __GCC_HAVE_DWARF2_CFI_ASM 1
```
This macro is useful because code can decide whether inline asm should include `.cfi_*` directives.
`.cfi_*` directives without `.cfi_startproc` can cause assembler errors
(integrated assembler: `this directive must appear between .cfi_startproc and .cfi_endproc directives`).
Differential Revision: https://reviews.llvm.org/D97743
Jonas Devlieghere [Tue, 9 Mar 2021 17:52:59 +0000 (09:52 -0800)]
[lldb] Update crashlog script for JSON changes
Update the crashlog script for changes to the JSON schema.
rdar://
75122914
Differential revision: https://reviews.llvm.org/D98219
Jonas Devlieghere [Tue, 9 Mar 2021 17:49:33 +0000 (09:49 -0800)]
[lldb] Propagate XDG_CACHE_HOME environment variable to tests
This variable is used to reducing the likelihood of hitting module cache
issues in CI where different branches can potentially run on the same
machine.
Jonas Devlieghere [Tue, 9 Mar 2021 17:44:32 +0000 (09:44 -0800)]
[lldb] Use lit.with_system_environment to propagate env variables
Use lit's with_system_environment function to propagate environment
variables to the tests. Include the usual suspects, as well as the
variables already explicitly forwarded.
Nikita Popov [Sun, 28 Feb 2021 15:04:56 +0000 (16:04 +0100)]
[cmake] Link socket/nsl on SunOS in llvm-jitlink
llvm-jitlink and llvm-jitlink-executor make use of APIs that are
part of the socket and nsl libraries on SunOS systems (Solaris and
Illumos). Make sure they get linked.
Ran into this in Rust CI when cross-compiling LLVM 12 to these
targets.
Differential Revision: https://reviews.llvm.org/D97633
Xiangling Liao [Tue, 9 Mar 2021 18:01:03 +0000 (13:01 -0500)]
[NFC] Use llvm::SmallVector to workaround XL compiler problem on AIX
LLVM is recommending to use SmallVector (that is, omitting the N), in the
absence of a well-motivated choice for the number of inlined elements N.
However, this doesn't work well with XL compiler on AIX since some header(s)
aren't properly picked up with it. We need to take a further look into the real
issue underneath and fix it in a later patch.
But currently we'd like to use this patch to unblock the build compiler issue
first.
Differential Revision: https://reviews.llvm.org/D98265
Craig Topper [Tue, 9 Mar 2021 17:43:08 +0000 (09:43 -0800)]
[RISCV] Add support for VECTOR_REVERSE for scalable vector types.
I've left mask registers to a future patch as we'll need
to convert them to full vectors, shuffle, and then truncate.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D97609
Amara Emerson [Tue, 9 Mar 2021 17:54:27 +0000 (09:54 -0800)]
[AArch64][GlobalISel] Lower scalar G_{SMIN, SMAX, UMIN, UMAX}.
Fangrui Song [Tue, 9 Mar 2021 17:59:47 +0000 (09:59 -0800)]
[MC] Change ELFOSABI_NONE to ELFOSABI_GNU for SHF_GNU_RETAIN
GNU ld does not give SHF_GNU_RETAIN GC root semantics for ELFOSABI_NONE.
(https://sourceware.org/pipermail/binutils/2021-March/115581.html)
This allows GNU ld to interpret SHF_GNU_RETAIN and avoids a gold quirk
https://sourceware.org/bugzilla/show_bug.cgi?id=27490
Because ELFObjectWriter is in an anonymous namespace, I have to place
`markGnuAbi` in the parent MCObjectWriter.
Differential Revision: https://reviews.llvm.org/D97976
Christudasan Devadasan [Fri, 5 Mar 2021 07:59:14 +0000 (13:29 +0530)]
[AMDGPU] Fix the dead frame indices during custom spill lowering.
AMDGPU target tries to handle the SGPR and VGPR spills in a
custom pass before the actual frame lowering pass. Once they
are handled and the respective frames are eliminated in the
custom pass, certain uses of them still remain. For instance,
the DBG_VALUE instructions inserted by the allocator alongside
the spill instruction will use the corresponding frame index.
They become dead later during PEI and causes a crash while trying to
replace the frame indices. We should possibly avoid this custom pass.
For now, replacing such dead references with null register value.
Reviewed By: arsenm, scott.linder
Differential Revision: https://reviews.llvm.org/D98038
Nikita Popov [Sun, 7 Mar 2021 16:27:22 +0000 (17:27 +0100)]
[FastISel] Don't trivially kill extractvalues (PR49467)
All extractvalues of the same value at the same index will map to
the same register, so even if one specific extractvalue only has
one use, we should not mark it as a trivial kill, as there may be
more extractvalues later.
Fixes https://bugs.llvm.org/show_bug.cgi?id=49467.
Differential Revision: https://reviews.llvm.org/D98145
gbtozers [Fri, 11 Sep 2020 14:52:53 +0000 (15:52 +0100)]
[DebugInfo] Add replaceArg function to simplify DBG_VALUE_LIST expressions
The LiveDebugValues and LiveDebugVariables implementations for handling
DBG_VALUE_LIST instructions can be simplified significantly if they do not have
to deal with any duplicated operands, such as a DBG_VALUE_LIST that uses the
same register multiple times in its expression. This patch adds a function,
replaceArg, that can be used to simplify a DIExpression in the case of
duplicated operands.
Differential Revision: https://reviews.llvm.org/D83896
Craig Topper [Tue, 9 Mar 2021 17:33:00 +0000 (09:33 -0800)]
[RISCV] Add support for fixed vector reductions.
I've included tests that require type legalization to split the
vector. The i64 version of these scalarizes on RV32 due to type
legalization visiting the result before the vector type. So we
have to abort our custom expansion to avoid creating target
specific nodes with an illegal type. Then type legalization ends
up scalarizing. We might be able to fix this by doing custom
splitting for large vectors in our handler to get down to a legal
type.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D98102
Dave Lee [Tue, 9 Mar 2021 17:36:13 +0000 (09:36 -0800)]
Revert "[build][modules] Fix ObjCARCUtil.h modularization"
This reverts commit
f1b690598eeca0568e39134f28e0a59c1c1f3598.
Nico Weber [Tue, 9 Mar 2021 17:28:48 +0000 (12:28 -0500)]
[clang] unbreak Index/preamble-reparse-changed-module.m with LLVM_APPEND_VC_REV=NO after
46d4d1fea401
See discussion starting at https://reviews.llvm.org/D96816#2572431 .
The same thing is happening with
46d4d1fea401.
Craig Topper [Tue, 9 Mar 2021 17:02:17 +0000 (09:02 -0800)]
[RISCV] Don't modify the SEW immediate on the V extension pseudo instructions after inserting VSETVLI.
Previously we set the value to -1, but the SEW information could
be useful for scheduling.
Reviewed By: frasercrmck, rogfer01
Differential Revision: https://reviews.llvm.org/D98062
Craig Topper [Tue, 9 Mar 2021 16:51:01 +0000 (08:51 -0800)]
[RISCV] Optimize fixed vector ABS. Fix crash on scalable vector ABS for SEW=64 with RV32.
The default fixed vector expansion uses sra+xor+add since it can't
see that smax is legal due to our custom handling. So we select
smax(X, sub(0, X)) manually.
Scalable vectors are able to use the smax expansion automatically
for most cases. It crashes in one case because getConstant can't build a
SPLAT_VECTOR for nxvXi64 when i64 scalars aren't legal. So
we manually emit a SPLAT_VECTOR_I64 for that case.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D97991
Craig Topper [Tue, 9 Mar 2021 16:38:45 +0000 (08:38 -0800)]
[RISCV] Make the hasStdExtM() check in RISCVInstrInfo::getVLENFactoredAmount emit a diagnostic rather than an assert.
As far as I know we're not enforcing the StdExtM must be enabled
to use the V extension. If we use an assert here and hit this
code in a release build we'll silently emit an invalid instruction.
By using a diagnostic we report the error to the user in release
builds. I think there may still be a later fatal error from
the code emitter though.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D97970