Yonghong Song [Mon, 18 Oct 2021 04:26:15 +0000 (21:26 -0700)]
BPF: Support btf_type_tag attribute
A new kind BTF_KIND_TYPE_TAG is defined. The tags associated
with a pointer type are emitted in their IR order as modifiers.
For example, for the following declaration:
int __tag1 * __tag1 __tag2 *g;
The BTF type chain will look like
VAR(g) -> __tag1 --> __tag2 -> pointer -> __tag1 -> pointer -> int
In the above "->" means BTF CommonType.Type which indicates
the point-to type.
Differential Revision: https://reviews.llvm.org/D113222
not-jenni [Thu, 4 Nov 2021 23:52:24 +0000 (16:52 -0700)]
Canonicalization for add to no-op if one of the inputs is zero
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D113207
Daniel McIntosh [Wed, 11 Aug 2021 18:54:16 +0000 (14:54 -0400)]
[libcxxabi] Fix NO_THREADS version of test_exception_storage.pass.cpp
`thread_code` returns param, which for NO_THREADS is going to be
`&thread_globals`. Thus, the return value will never be null. The test
was probably meant to check if `*thread_code(&thread_globals) == 0`.
However, to avoid the extra cast, and to bring the NO_THREADS version
more in line with the regular version of the test, this changes it to
check if thread_globals == 0 directly.
Reviewed By: ldionne, #libc_abi
Differential Revision: https://reviews.llvm.org/D113048
Yonghong Song [Thu, 4 Nov 2021 23:06:12 +0000 (16:06 -0700)]
BPF: fix a buildbot test failure
Commit
737e4216c537 ("[Attr] support btf_type_tag attribute")
added btf_type_tag support in llvm. Buildbot reported a
failure with attr-btf_type_tag.ll.
; CHECK-NEXT: DW_AT_type (0x[[T1:[0-9]+]] "int ***")
<stdin>:15:2: note: possible intended match here
DW_AT_type (0x0000002f "int ***")
The pattern [0-9]+ is not enough to match
0000002f, we
need [0-9a-f]+. This patch fixed the issue.
Johannes Doerfert [Wed, 3 Nov 2021 15:28:11 +0000 (10:28 -0500)]
[OpenMP] Build device runtimes for sm_86
Reviewed By: carlo.bertolli
Differential Revision: https://reviews.llvm.org/D113111
Johannes Doerfert [Wed, 3 Nov 2021 15:26:34 +0000 (10:26 -0500)]
[OpenMP] Introduce the keepAlive function into the old device RT
Reviewed By: ye-luo
Differential Revision: https://reviews.llvm.org/D113110
Johannes Doerfert [Wed, 3 Nov 2021 15:06:57 +0000 (10:06 -0500)]
[OpenMP][NFCI] Cleanup new device RT mapping interface
Minimize the `impl` interface and clean up some uses of mapping
functions.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D112154
Philip Reames [Thu, 4 Nov 2021 22:21:39 +0000 (15:21 -0700)]
[indvars] Use loop guards when canonicalizing exit conditions
This extends the logic in canonicalizeExitConditions to use loop guards to specialize the SCEV of the loop invariant term before quering it's range.
Arthur Eubanks [Thu, 4 Nov 2021 18:23:46 +0000 (11:23 -0700)]
[NewPM] Use the default AA pipeline by default
We almost always want to use the default AA pipeline. It's very easy for
users of PassBuilder to forget to customize the AAManager to use the
default AA pipeline (for example, the NewPM C API forgets to do this).
If somebody wants a custom AA pipeline, similar to what is being done
now with the default AA pipeline registration, they can
FAM.registerPass([&] { return std::move(MyAA); });
before calling
PB.registerFunctionAnalyses(FAM);
For example, LTOBackend.cpp and NewPMDriver.cpp do this.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D113210
Ben Langmuir [Tue, 2 Nov 2021 17:49:08 +0000 (10:49 -0700)]
[ORC] Add a utility for adding missing "self" relocations to a Symbol
If a tool wants to introduce new indirections via stubs at link-time in
ORC, it can cause fidelity issues around the address of the function if
some references to the function do not have relocations. This is known
to happen inside the body of the function itself on x86_64 for example,
where a PC-relative address is formed, but without a relocation.
```
_foo:
leaq -7(%rip), %rax ## form pointer to '_foo' without relocation
_bar:
leaq (%rip), %rax ## uses X86_64_RELOC_SIGNED to '_foo'
```
The consequence of introducing a stub for such a function at link time
is that if it forms a pointer to itself without relocation, it will not
have the same value as a pointer from outside the function. If the
function pointer is used as a key, this can cause problems.
This utility provides best-effort support for adding such missing
relocations using MCDisassembler and MCInstrAnalysis to identify the
problematic instructions. Currently it is only implemented for x86_64.
Note: the related issue with call/jump instructions is not handled
here, only forming function pointers.
rdar://
83514317
Differential revision: https://reviews.llvm.org/D113038
Daniel McIntosh [Fri, 16 Jul 2021 17:39:31 +0000 (13:39 -0400)]
[libcxx][NFC] tidy up money_get::__do_get's sign parsing
Same logic, but much easier to read this way
Reviewed By: ldionne, #libc, Mordante
Differential Revision: https://reviews.llvm.org/D112958
David Blaikie [Thu, 4 Nov 2021 17:09:53 +0000 (10:09 -0700)]
DebugInfo: Fix incorrect line table lookup when resolving decl_file from a split unit
Specifically in DWARFv5 the unit for the line table entry was correct
but the context was incorrect - leading to looking up .debug_line_str in
the dwp instead of the executable.
(perhaps we could/should remove the context pointer entirely, and rely
on the one in the unit... I might try that as a separate follow-up
commit)
Philip Reames [Thu, 4 Nov 2021 21:46:20 +0000 (14:46 -0700)]
[indvars] Allow rotation (narrowing) of exit test when discovering trip count
This relaxes the one-use requirement on the rotation transform specifically for the case where we know we're zexting an IV of the loop. This allows us to discover trip count information in SCEV, which seems worth a single extra loop invariant truncate. Honestly, I'd prefer if SCEV could just compute the trip count directly (e.g. D109457), but this unblocks practical benefit.
Mogball [Thu, 4 Nov 2021 20:34:01 +0000 (20:34 +0000)]
[mlir][core] Slightly improved attribute lookup
- String binary search does 1 less string comparison
- Identifier linear scan on large attribute list is switched to string binary search
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D112970
Mike Rice [Wed, 3 Nov 2021 21:57:01 +0000 (14:57 -0700)]
[OpenMP] Add parsing/sema/serialization for 'bind' clause.
Differential Revision: https://reviews.llvm.org/D113154
Stanislav Mekhanoshin [Thu, 4 Nov 2021 21:26:42 +0000 (14:26 -0700)]
[InstCombine] Precommit updated and-xor-or.ll tests. NFC.
Tests for:
(~(a | b) & c) | ~(a | (b | c)) -> ~(a | b)
(~(a | b) & c) | ~(b | (a | c)) -> ~(a | b)
Yonghong Song [Fri, 1 Oct 2021 06:35:06 +0000 (23:35 -0700)]
[Attr] support btf_type_tag attribute
This patch added clang codegen and llvm support
for btf_type_tag support. Currently, btf_type_tag
attribute info is preserved in DebugInfo IR only for
pointer types associated with typedef, global variable
and function declaration. Eventually, such information
is emitted to dwarf.
The following is an example:
$ cat test.c
#define __tag __attribute__((btf_type_tag("tag")))
int __tag *g;
$ clang -O2 -g -c test.c
$ llvm-dwarfdump --debug-info test.o
...
0x0000001e: DW_TAG_variable
DW_AT_name ("g")
DW_AT_type (0x00000033 "int *")
DW_AT_external (true)
DW_AT_decl_file ("/home/yhs/test.c")
DW_AT_decl_line (2)
DW_AT_location (DW_OP_addr 0x0)
0x00000033: DW_TAG_pointer_type
DW_AT_type (0x00000042 "int")
0x00000038: DW_TAG_LLVM_annotation
DW_AT_name ("btf_type_tag")
DW_AT_const_value ("tag")
0x00000041: NULL
0x00000042: DW_TAG_base_type
DW_AT_name ("int")
DW_AT_encoding (DW_ATE_signed)
DW_AT_byte_size (0x04)
0x00000049: NULL
Basically, a DW_TAG_LLVM_annotation tag will be inserted
under DW_TAG_pointer_type tag if that pointer has a btf_type_tag
associated with it.
Differential Revision: https://reviews.llvm.org/D111199
Philip Reames [Thu, 4 Nov 2021 21:19:24 +0000 (14:19 -0700)]
[indvars] Extend canonicalizeExitConditions to inverted operands
As discussed in the original reviews, but done in a follow on.
Yonghong Song [Thu, 4 Nov 2021 20:23:19 +0000 (13:23 -0700)]
[Clang][Attr] Support btf_type_tag attribute
This patch introduced btf_type_tag attribute. The attribute
is a type attribute and intends to address the below
linux use cases.
typedef int __user *__intp;
int foo(int __user *arg, ...)
static int do_execve(struct filename *filename,
const char __user *const __user *__argv,
const char __user *const __user *__envp)
Here __user in the kernel defined as
__attribute__((noderef, address_space(__user)))
for sparse ([1]) type checking mode.
For normal clang compilation, we intend to replace it with
__attribute__((btf_type_tag("user")))
and record such informaiton in dwarf and BTF so such
information later can be used in kernel for bpf verification
or for other tracing functionalities.
[1] https://www.kernel.org/doc/html/v4.11/dev-tools/sparse.html
Differential Revision: https://reviews.llvm.org/D111199
Thomas Symalla [Mon, 25 Oct 2021 08:33:55 +0000 (10:33 +0200)]
[AMDGPU] Changes the AMDGPU_Gfx calling convention by making the SGPRs 4..29 callee-save. This is to avoid superfluous s_movs when executing amdgpu_gfx function calls as the callee is likely not going to change the argument values.
This patch changes the AMDGPU_Gfx calling convention. It defines the SGPR registers s[4:29] as callee-save and leaves some SGPRs usable for callers. The intention is to avoid unneccessary s_mov instructions for arguments the caller would otherwise save and restore in these registers.
Reviewed By: sebastian-ne
Differential Revision: https://reviews.llvm.org/D111637
Noah Shutty [Thu, 4 Nov 2021 19:59:59 +0000 (12:59 -0700)]
[Support] Improve Caching conformance with Support library behavior
This diff makes several amendments to the local file caching mechanism
which was migrated from ThinLTO to Support in
rGe678c51177102845c93529d457b020f969125373 in response to follow-up
discussion on that commit.
Patch By: noajshu
Differential Revision: https://reviews.llvm.org/D113080
Kiran Chandramohan [Thu, 4 Nov 2021 17:50:20 +0000 (17:50 +0000)]
[Flang][OpenMP] Use the ultimate symbol in a call to the IsPointer function
The IsPointer check currently fails for host-associated symbols in OpenMP
regions. This causes some failures in semantic checks for pointer association
in an OpenMP region. Fix is to use the ultimate symbol in the call to the
IsPointer function in CheckPointerAssignment function in
lib/Semantics/pointer-assignment.cpp.
Reviewed By: klausler, peixin
Differential Revision: https://reviews.llvm.org/D112876
Simon Pilgrim [Thu, 4 Nov 2021 16:02:25 +0000 (16:02 +0000)]
[X86][SSE] Regenerate vector funnel shift tests
Mogball [Wed, 3 Nov 2021 17:06:14 +0000 (17:06 +0000)]
[mlir][ods] Op::verify should not call OpAdaptor::verify
OpAdaptor::verify performs string lookups on an attribute dictionary. By
calling OpAdaptor::verify, Op::verify is not able to use cached attribute
identifiers for faster lookups.
Reviewed By: jpienaar, rriddle
Differential Revision: https://reviews.llvm.org/D113039
Mogball [Wed, 3 Nov 2021 17:59:02 +0000 (17:59 +0000)]
[llvm][adt] make_first_range returning reference to temporary
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D112957
David Green [Thu, 4 Nov 2021 18:42:12 +0000 (18:42 +0000)]
[ARM] Move VPTBlock pass after post-ra scheduling
Currently when tail predicating loops, vpt blocks need to be created
with the vctp predicate in case we need to revert to non-tail predicated
form. This has the unfortunate side effect of severely hampering post-ra
scheduling at times as the instructions are already stuck in vpt blocks,
not allowed to be independently ordered.
This patch addresses that by just moving the creation of VPT blocks
later in the pipeline, after post-ra scheduling has been performed. This
allows more optimal scheduling post-ra before the vpt blocks are
created, leading to more optimal tail predicated loops.
Differential Revision: https://reviews.llvm.org/D113094
Michael Jones [Fri, 15 Oct 2021 22:11:37 +0000 (15:11 -0700)]
[libc] add stpcpy and stpncpy
Adds an implementation for stpcpy and stpncpy, which are posix extension
functions.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D111913
Wouter van Oortmerssen [Mon, 25 Oct 2021 21:00:42 +0000 (14:00 -0700)]
[WebAssembly] Fix debug locations for ExplicitLocals pass
This is a reworked version of the reverted patch: https://reviews.llvm.org/D112487
Note that
a) it doesn't need the test changes anymore, and
b) I checked at least locally it passes other.test_pthread_lsan_leak
Differential Revision: https://reviews.llvm.org/D113208
Mark de Wever [Wed, 3 Nov 2021 18:25:20 +0000 (19:25 +0100)]
[libc++] Improve no wide characters configuration.
When wide characters are supported libc++ manually translates a
`narrow non-breaking space` and a `non-breaking space` to a space.
This behaviour wasn't available when wide characters were disabled.
This enables an emulation for that configuration.
Updating the libc++ Docker image to Ubuntu Focal caused some breakage.
This was temporary disabled in D112737. This re-enables four of these
tests.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D113133
Arthur O'Dwyer [Mon, 20 Sep 2021 22:03:49 +0000 (18:03 -0400)]
[libc++] Remove non-atomic "platform" semaphore implementations.
These can't be made constexpr-constructible (constinit'able),
so they aren't C++20-conforming. Also, the platform versions are
going to be bigger than the atomic/futex version, so we'd have
the awkward situation that `semaphore<42>` could be bigger than
`semaphore<43>`, and that's just silly.
Differential Revision: https://reviews.llvm.org/D110110
Chia-hung Duan [Thu, 4 Nov 2021 18:11:50 +0000 (18:11 +0000)]
[mlir] Handle StringAttr in SparseElementsAttr::getZeroAttr.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D111203
Josh Mottley [Thu, 21 Oct 2021 14:39:05 +0000 (14:39 +0000)]
[flang][flang-omp-report] Add flang-omp-report summarising script
The flang plugin ``flang-omp-report`` takes one fortran file in and returns a
YAML report file of the input file. This becomes an issue when you want to
analyse an entire project into one final report.
The purpose of this Python script is to generate a final YAML
report from all of the files generated by ``flang-omp-report``. The report can
have (currently) 2 formats; summary and log. Summary focuses on "summarizing"
all constructs and there clauses from all YAML files with a corresponding "count"
for each. Log instead combines the generated YAML files into one report in a
"cleaner" format. (Pseudo) Examples can be found for both formats at the top of
the script.
Differential Revision: https://reviews.llvm.org/D111042
Co-Authored by: Ivan Zhechev <ivan.zhechev@arm.com>
Craig Topper [Thu, 4 Nov 2021 16:59:05 +0000 (09:59 -0700)]
[RISCV] Add another test case showing unnecessary vsetvli near mask instructions.
This is similar to D112762, but the VL for the mask instruction
comes from a Phi node selecting between two vsetvlis.
Rahman Lavaee [Thu, 28 Oct 2021 00:00:27 +0000 (17:00 -0700)]
Make the BBAddrMap struct binary-format-agnostic.
The only binary-format-related field in the BBAddrMap structure is the function address (`Addr`), which will use uint64_t in 64B format and uint32_t in 32B format. This patch changes it to use uint64_t in both formats.
This allows non-templated use of the struct, at the expense of a marginal additional size overhead for the 32-bit format. The size of the BB address map section does not change.
Differential Revision: https://reviews.llvm.org/D112679
Zakk Chen [Thu, 4 Nov 2021 16:22:34 +0000 (09:22 -0700)]
[RISCV] Rename some assembler mnemonic and intrinsic functions for RVV 1.0.
Rename vpopc/vmandnot/vmornot to vcpop/vmandn/vmorn assembler mnemonic.
Reviewed By: frasercrmck, jrtc27, craig.topper
Differential Revision: https://reviews.llvm.org/D111062
Aart Bik [Thu, 4 Nov 2021 00:04:42 +0000 (17:04 -0700)]
[mlir][sparse] reject sparsity annotation in "scalar" tensors
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D113152
Jonas Devlieghere [Thu, 4 Nov 2021 16:43:31 +0000 (09:43 -0700)]
[debugserver] Fix typo in DNBArchImplARM64
rdar://
85020754
Philip Reames [Thu, 4 Nov 2021 16:36:07 +0000 (09:36 -0700)]
[docs] Update new builder instructions to default to building each change
We generally prefer build bots which build each change as they come in as long as they can keep up. This generates much higher quality feedback to a developer. However, the code structure is such that we currently default new builders to batching.
This change updates the getting started instruction for a builder to explicitly advocate for not collapsing requests.
Differential Revision: https://reviews.llvm.org/D112776
Tobias Gysi [Thu, 4 Nov 2021 15:51:58 +0000 (15:51 +0000)]
[mlir][linalg] Add support for transitive fusion.
Extend fusion on tensors to fuse producers greedily.
Reviewed By: nicolasvasilache, hanchung
Differential Revision: https://reviews.llvm.org/D110262
Geoffrey Martin-Noble [Mon, 1 Nov 2021 23:41:44 +0000 (16:41 -0700)]
[NFC] Add size inference to to_vector
A default calculated size for SmallVector was added in
https://reviews.llvm.org/D92522 after discussion in
https://groups.google.com/g/llvm-dev/c/Z-VwNCTRGSg, but to_vector still
requires an explicit size. This patch adds the default size to to_vector
as well, so that this case doesn't unnecessarily force users to pick an
arbitrary size.
Reviewed By: silvas, dblaikie
Differential Revision: https://reviews.llvm.org/D112968
Alex Bradbury [Thu, 4 Nov 2021 15:53:37 +0000 (15:53 +0000)]
[RISCV][ELF] Remove internal binutils relocations
These relocations have been removed from the psABI doc in
https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/199. This
patch simply updates llvm/include/llvm/BinaryFormat/ELFRelocs/RISCV.def
to match.
Differential Revision: https://reviews.llvm.org/D112999
Kazu Hirata [Thu, 4 Nov 2021 15:51:05 +0000 (08:51 -0700)]
[Hexagon] Use make_early_inc_range (NFC)
Daniel Kiss [Thu, 4 Nov 2021 15:29:12 +0000 (16:29 +0100)]
[libcxxabi][ARM] Make CXX_end_cleanup compatible with Armv6-M
On Armv6-M the branch may not able to reach the _Unwind_Resume function because it's relocation(R_ARM_THM_JUMP11) is in -2048, 2047 range only.
Reviewed By: chill, stuij, lenary
Differential Revision: https://reviews.llvm.org/D113181
Clement Courbet [Thu, 4 Nov 2021 13:58:31 +0000 (14:58 +0100)]
[Sema][NFC] Improve test coverage of builtin operators.
In preparation for D112453.
Fix numbering of tests for [over.built]: 15->16, 16->17.
Jamie Schmeiser [Thu, 4 Nov 2021 14:39:39 +0000 (10:39 -0400)]
Remove unused function from print-changed=dot-cfg code
Summary:
Remove unused function from print-changed=dot-cfg code to silence a
gcc compiler warning.
Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: uabelho(Mikael Holmen)
Differential Revision: https://reviews.llvm.org/D113188
Sander de Smalen [Thu, 4 Nov 2021 13:49:10 +0000 (13:49 +0000)]
[NFC] Remove from UnivariateLinearPolyBase::getValue().
This interface should not have existed in the first place, let alone
be a public member.
It allows calling `ElementCount::get(..)->getValue()`, which is ambiguous.
The interfaces to be used are either getFixedValue() or getKnownMinValue().
Raphael Isemann [Thu, 4 Nov 2021 14:23:08 +0000 (15:23 +0100)]
[lldb][NFC] StringRef-ify name param in CreateClassTemplateDecl
Simon Pilgrim [Thu, 4 Nov 2021 14:18:43 +0000 (14:18 +0000)]
[ARM] Regenerate shift-combine.ll test checks
Simon Pilgrim [Thu, 4 Nov 2021 14:18:02 +0000 (14:18 +0000)]
[AMDGPU] Regenerate shift-and-i128-ubfe.ll test checks
Adam Czachorowski [Tue, 2 Nov 2021 16:40:30 +0000 (17:40 +0100)]
[clangd] Find definition of ClassTemplate without going through index.
I noticed that, while go-to-def works on cases like:
namespace ns {
template<typename T> struct Foo {};
}
using ::ns::Fo^o;
it only works because of the FileIndex. We can get definition location
directly from AST too.
Differential Revision: https://reviews.llvm.org/D113029
Josh Mottley [Wed, 20 Oct 2021 12:20:25 +0000 (12:20 +0000)]
[flang][flang-omp-report] Remove the loop workarounds for nowait clause
In a "Worksharing-loop construct", one can add a nowait clause at the end
of the loop (i.e. at the loop tail). This clause wasn't associated with
the corresponding loop when originally worked on in flang-omp-report.
Note that this refers to parsing and parse-tree generation. To work
around it, it was needed to track such clauses and the loops.
This should no longer be required (and in fact no longer works) and so
was removed. This results in 'curLoopLogRecord' and 'loopLogRecordStack' and
all references to them being removed. This also allows for
'constructClauses' to be swapped from std::deque to llvm::SmallVector.
Lastly a new test has been added testing the "nowait" clauses in a
variety of ways.
Reviewed By: awarzynski, kiranchandramohan
Differential Revision: https://reviews.llvm.org/D112217
Raphael Isemann [Thu, 4 Nov 2021 13:49:58 +0000 (14:49 +0100)]
[lldb][NFC] Remove a bunch of unnecessary nullptr checks
Those nullptr checks are after we already accessed the pointer.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D113175
Kevin Petit [Thu, 19 Aug 2021 17:28:58 +0000 (18:28 +0100)]
[OpenCL] Fix parsing of opencl-c.h as CL 3.0 with device-scope atomics enabled
https://reviews.llvm.org/D108392
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
Sjoerd Meijer [Thu, 4 Nov 2021 10:36:19 +0000 (10:36 +0000)]
[FuncSpec] Enable it only with -O3
Function specialisation was running at all optimisation levels (if enabled on
the command line, it is not on by default). That was an oversight and not
something we want to do. Function specialisation duplicates functions when it
triggers, so the backend is processing more functions/instructions resulting in
compile-time increases, which seems more appropriate with -O3 and inline with
GCC. Please note that since function specialisation is not enabled by default,
this didn't require updating any pass manager tests.
Differential Revision: https://reviews.llvm.org/D112129
Raphael Isemann [Thu, 4 Nov 2021 10:20:29 +0000 (11:20 +0100)]
[lldb][NFC] StringRef-ify the name parameter in CreateEnumerationType
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D113176
Guillaume Chatelet [Thu, 4 Nov 2021 12:14:31 +0000 (12:14 +0000)]
[libc][NFC] Allow memset (and bzero) to be inlined
This allows shipping individual functions without also having to provide
memset or bzero at the expense of bigger functions.
Similar to D113097.
Differential Revision: https://reviews.llvm.org/D113108
Guillaume Chatelet [Thu, 4 Nov 2021 12:13:29 +0000 (12:13 +0000)]
[libc][NFC] Allow memcmp to be inlined
Similar to D113097 although not strictly necessary for now. It helps
keeping the same structure for all memory functions.
Differential Revision: https://reviews.llvm.org/D113103
Guillaume Chatelet [Thu, 4 Nov 2021 12:15:17 +0000 (12:15 +0000)]
[libc][NFC] Allow memcpy to be inlined
This allows shipping individual functions without also having to provide
`memcpy` at the expense of bigger functions.
Next is to use this `inlined_memcpy` in:
- loader/linux/x86_64/start.cpp
- src/string/memmove.cpp
- src/string/mempcpy.cpp
- src/string/strcpy.cpp
- src/string/strdup.cpp
- src/string/strndup.cpp
Differential Revision: https://reviews.llvm.org/D113097
Josh Mottley [Fri, 29 Oct 2021 13:45:28 +0000 (13:45 +0000)]
[flang][flang-omp-report] Removed unnecessary comments in flang-omp-report plugin tests
This patch removes unnecessary comments in the flang-omp-report
plugin tests which can be implied from the file name and run command.
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D112817
Chen Zheng [Thu, 4 Nov 2021 13:32:31 +0000 (13:32 +0000)]
[PowerPC][NFC] make option ppc-formprep-max-vars can be set more than one time.
Aaron Ballman [Thu, 4 Nov 2021 13:40:22 +0000 (09:40 -0400)]
No longer crash when a consteval function returns a structure
Ensure that the destination slot exists in this case. This addresses PR51484.
Simon Pilgrim [Thu, 4 Nov 2021 13:00:42 +0000 (13:00 +0000)]
[InstCombine] Add reference to PR52397 to help with triage
rG1e5f814302f8 added the test case, I've added PR52397 to the comment to help keep track of the source of the bug
Simon Pilgrim [Thu, 4 Nov 2021 12:11:42 +0000 (12:11 +0000)]
[X86][SSE] Improve PMADDWD SimplifyDemandedVectorElts handling
Check both operands for zero elements to remove unnecessary demanded elts.
Try to help reduce some minor regressions noticed in D110995
Muhammad Omair Javaid [Thu, 4 Nov 2021 12:38:24 +0000 (17:38 +0500)]
[LLDB] Fix Cpsr size for WoA64 target
CPSR on Arm64 is 4 bytes in size but windows on Arm implementation is trying to read/write 8 bytes against a byte register causing LLDB unit tests failures.
Ref: https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-arm64_nt_context
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D112471
Muhammad Omair Javaid [Thu, 4 Nov 2021 12:37:42 +0000 (17:37 +0500)]
[LIT] Add win32 PLATFORM env var to test config
LIT skips various system environment variables while building test
config. It turns out that we require PLATFORM environment variable for
detection of x86 vs Arm windows platform.
This patch adds system environment variable PLATFORM into LIT test
config for detection of win32 Arm platform.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D113165
Florian Hahn [Thu, 4 Nov 2021 12:11:17 +0000 (13:11 +0100)]
[LV] Clarify uniform worklist contains instrs demanding lane 0.
gbreynoo [Thu, 4 Nov 2021 11:01:32 +0000 (11:01 +0000)]
[llvm-objdump] Fix the Assertion failure when providing invalid --debug-vars or --dwarf values
As seen in https://bugs.llvm.org/show_bug.cgi?id=52213 llvm-objdump
asserts if either the --debug-vars or the --dwarf options are provided
with invalid values. As suggested, this fix adds use of a default value
to these options and errors when given bad input.
Differential Revision: https://reviews.llvm.org/D112183
Tim Northover [Fri, 22 Oct 2021 08:13:02 +0000 (09:13 +0100)]
Coroutines: don't infer function attrs before lowering
Coroutines have weird semantics that don't quite match normal LLVM functions,
so trying to infer even simple attributes based on thier contents can go wrong.
Markus Böck [Thu, 4 Nov 2021 09:59:35 +0000 (10:59 +0100)]
[mlir] Fix typos in comments
Valentin Clement [Thu, 4 Nov 2021 09:36:00 +0000 (10:36 +0100)]
[fir] Add fir.insert_on_range conversion
Convert fir.insert_on_range operation to corresponding
llvm.insertvalue operations.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D112896
David Green [Thu, 4 Nov 2021 09:24:27 +0000 (09:24 +0000)]
[InstCombine] Fix infinite recursion in ashr/xor vector fold.
The added test has poison lanes due to the vector shuffle. This can
cause an infinite loop of combines in instcombine where it folds
xor(ashr, -1) -> select (icmp slt 0), -1, 0 -> sext (icmp slt 0) -> xor(ashr, -1).
We usually prevent this by checking that the xor constant is not -1,
but with vectors some of the lanes may be -1, some may be poison. So
this changes the way we detect that from "!C1->isAllOnesValue()" to
"!match(C1, m_AllOnes())", which is more able to detect that some of the
lanes are poison.
Fixes PR52397
Martin Storsjö [Tue, 2 Nov 2021 16:32:09 +0000 (16:32 +0000)]
[libcxx] Remove nonstandard _FilesystemClock::{to,from}_time_t
These are not standard methods, neither libstdc++ nor MSVC STL provide
them.
In practice, one of them was untested and the other one was only used in
one single test.
Differential Revision: https://reviews.llvm.org/D113027
Lawrence D'Anna [Thu, 4 Nov 2021 07:58:31 +0000 (00:58 -0700)]
[lldb] Fix TestEchoCommands.test again
In
7f01f78593d6 [lldb] update TestEchoCommands -- I fixed this test,
but not on windows, becuase I used some unix shell syntax that
doesn't work with cmd.exe. Fixed it so it will work in both.
Test logic is the same.
This is a trivial fix, so bypassing review to get the build clean again
ASAP.
Valentin Clement [Thu, 4 Nov 2021 07:53:49 +0000 (08:53 +0100)]
[fir] Restrict array type on fir.insert_on_range
Sequence type had no restriction on the insert_on_range operation.
This patch adds a restriction for the type to have constant shape
and size.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D113092
Martin Liska [Wed, 3 Nov 2021 12:49:21 +0000 (13:49 +0100)]
Fix -Wformat warnings reported by GCC.
Differential Revision: https://reviews.llvm.org/D113099
Keith Smiley [Thu, 4 Nov 2021 04:47:49 +0000 (21:47 -0700)]
[lld-macho] Silently ignore the -objc_abi_version
This undocumented ld64 flag, based on the most recent ld64 source dump
from Xcode 12, only applies to i386. It seems like on all newer
architectures this behavior is the default.
Reviewed By: #lld-macho, int3
Differential Revision: https://reviews.llvm.org/D113070
Keith Smiley [Thu, 4 Nov 2021 04:42:04 +0000 (21:42 -0700)]
[lld-macho] Cache readFile results
In one of our links lld was reading 760k files, but the unique number of
files was only 1500. This takes that link from 30 seconds to 8.
This seems like a heavy hammer, especially since some things don't need
to be cached, like the filelist arguments and the passed static
archives (the latter is already cached as a one off), but it seems ld64
does something similar here to short circuit these duplicate reads:
https://github.com/keith/ld64/blob/
82e429e186488529111b0ef86af33a3b1b9438c7/src/ld/InputFiles.cpp#L644-L665
Of the types of files being read for our iOS app, the biggest problem
was constantly re-reading small tbd files:
```
% wc -l /tmp/read.txt
761414 /tmp/read.txt
% cat /tmp/read.txt | sort -u | wc -l
1503
% cat /tmp/read.txt | grep "\.a$" | wc -l
43721
% cat /tmp/read.txt | grep "\.tbd$" | wc -l
717656
```
We could likely hoist this logic up to not cache at this level, but it
would be a more invasive change to make sure all callers that needed it
cached the results.
I could see this being an issue with OOMs, and I'm not a linker expert so
maybe there's another way we should solve this problem? Feedback welcome!
Reviewed By: int3, #lld-macho
Differential Revision: https://reviews.llvm.org/D113153
Keith Smiley [Thu, 4 Nov 2021 04:23:04 +0000 (21:23 -0700)]
[lld-macho] Implement -arch_errors_fatal
By default with ld64, architecture mismatches are just warnings, then
this flag can be passed to make these fail. This matches that behavior.
Reviewed By: int3, #lld-macho
Differential Revision: https://reviews.llvm.org/D113082
Matthias Springer [Thu, 4 Nov 2021 04:51:30 +0000 (13:51 +0900)]
[mlir][linalg][bufferize] Generalize InitTensorOp elimination
This allows for external users of Comprehensive Bufferize to specify their own InitTensorOp elimination procedures.
Differential Revision: https://reviews.llvm.org/D112686
Jez Ng [Thu, 4 Nov 2021 04:01:49 +0000 (00:01 -0400)]
[lld-macho][nfc] Remove unnecessary -pie flags in tests
D101513 means that we no longer need to specify `-pie` in most of our
test RUN commands. Let's clean up the unused flags so as not to confuse
future test writers.
Reviewed By: #lld-macho, oontvoo, MaskRay
Differential Revision: https://reviews.llvm.org/D113114
Chuanqi Xu [Thu, 4 Nov 2021 03:50:30 +0000 (11:50 +0800)]
[Coroutines] [Frontend] Lookup in std namespace first
Now in libcxx and clang, all the coroutine components are defined in
std::experimental namespace.
And now the coroutine TS is merged into C++20. So in the working draft
like N4892, we could find the coroutine components is defined in std
namespace instead of std::experimental namespace.
And the coroutine support in clang seems to be relatively stable. So I
think it may be suitable to move the coroutine component into the
experiment namespace now.
This patch would make clang lookup coroutine_traits in std namespace
first. For the compatibility consideration, clang would lookup in
std::experimental namespace if it can't find definitions in std
namespace. So the existing codes wouldn't be break after update
compiler.
And in case the compiler found std::coroutine_traits and
std::experimental::coroutine_traits at the same time, it would emit an
error for it.
The support for looking up std::experimental::coroutine_traits would be
removed in Clang16.
Reviewed By: lxfind, Quuxplusone
Differential Revision: https://reviews.llvm.org/D108696
Muhammad Omair Javaid [Thu, 4 Nov 2021 03:44:29 +0000 (08:44 +0500)]
[LLDB] Adjust DumpDataExtractorTest.Formats for Windows
Floating point results mismtach between Visual stdio 2019 and previous
versions. This adjusts macro accordingly.
Qiu Chaofan [Thu, 4 Nov 2021 03:44:04 +0000 (11:44 +0800)]
[PowerPC] Enforce side effects to FPSCR read/set intrinsics
Currently, FPSCR is not modeled, so in some early passes (such as
early-cse), the read/set intrinsics to FPSCR may get incorrect
simplification.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D112380
Ben Vanik [Thu, 4 Nov 2021 03:30:04 +0000 (20:30 -0700)]
[ADT] Simplifying hex string parsing so it runs faster in debug modes.
This expands the lookup table statically and avoids routing through methods that
contain asserts (like StringRef/std::string element accessors and drop_front)
such that performance is more predictable across compilation environments. This
was primarily driven by slow debug mode performance but has a large benefit in
release builds as well.
```
ssd_mobilenet_v2_face_float (42MB .mlir)
Debug/MSVC (old): 5.22s
Debug/MSVC (new): 0.16s
Release/MSVC (old): 0.81s
Release/MSVC (new): 0.02s
huggingface_minilm (536MB .mlir)
Debug/MSVC (old): 65.31s
Debug/MSVC (new): 2.03s
Release/MSVC (old): 9.93s
Release/MSVC (new): 0.27s
```
Now in debug the time is split evenly between lexString, tryGetFromHex, and
element attrs hashing, with the next step to making it faster being to combine
the work (incremental hashing during conversion, etc) - but this is at least in
the right order of magnitude and retains the original API surface.
I have not profiled a build with clang but this is strictly less code and simpler
data structures so I'd expect improvements there as well.
This also fixes a bug where 0xFF bytes in the input would read out of bounds.
Reviewed By: dblaikie, stellaraccident
Differential Revision: https://reviews.llvm.org/D112105
RamNalamothu [Wed, 3 Nov 2021 16:53:39 +0000 (22:23 +0530)]
[AMDGPU] Do not add debug locations to the code inside prologue
There is no real source location for code inside prologue as it is
generated by compiler but source locations are being added to code
inside prologue as a side effect of https://reviews.llvm.org/D99269
because buildSpillLoadStore() is using source location of the real
instruction in the basic block if any.
Fixes: SWDEV-307590
Reviewed By: scott.linder, sebastian-ne
Differential Revision: https://reviews.llvm.org/D113100
Julian Lettner [Thu, 4 Nov 2021 01:21:52 +0000 (18:21 -0700)]
Revert "Mark tsan cxa_guard_acquire test as unsupported on Darwin"
This reverts commit
593275c93c5cd3e02819f012f812eee19081911b.
This test now passes again.
Matthias Springer [Thu, 4 Nov 2021 01:47:51 +0000 (10:47 +0900)]
[mlir][linalg][bufferize] Fix typo in function name
Differential Revision: https://reviews.llvm.org/D113162
Jakub Kuderski [Thu, 4 Nov 2021 00:47:57 +0000 (20:47 -0400)]
Make enum iteration with seq safe by default
By default `llvm::seq` would happily iterate over enums, which may be unsafe if the enum values are not continuous. This patch disable enum iteration with `llvm::seq` and `llvm::seq_inclusive` and adds two new functions: `enum_seq` and `enum_seq_inclusive`.
To make sure enum iteration is safe, we require users to declare their enum types as iterable by specializing `enum_iteration_traits<SomeEnum>`. Because it's not always possible to add these traits next to enum definition (e.g., for enums defined in external libraries), we provide an escape hatch to allow iteration on per-callsite basis by passing `force_iteration_on_noniterable_enum`.
The main benefit of this approach is that these global declarations via traits can appear just next to enum definitions, making easy to spot when enums are miss-labeled, e.g., after introducing new enum values, whereas `force_iteration_on_noniterable_enum` should stand out and be easy to grep for.
This emerged from a discussion with gchatelet@ about reusing llvm's `Sequence.h` in lieu of https://github.com/GPUOpen-Drivers/llpc/blob/dev/lgc/interface/lgc/EnumIterator.h.
Reviewed By: dblaikie, gchatelet, aaron.ballman
Differential Revision: https://reviews.llvm.org/D107378
Mehdi Amini [Wed, 3 Nov 2021 23:59:05 +0000 (23:59 +0000)]
Revert "Fix iterator_adaptor_base/enumerator_iter to allow composition of llvm::enumerate with llvm::make_filter_range"
This reverts commit
ba7a6b314fd14bb2c9ff5d3f4fe2b6525514cada.
Post-commit review showed that the fix implemented wasn't correct, and a
more principled fix is possible.
Volodymyr Sapsai [Tue, 21 Sep 2021 01:59:19 +0000 (18:59 -0700)]
[clang][objc] Speed up populating the global method pool from modules.
For each selector encountered in the source code, we need to load
selectors from the imported modules and check that we are calling a
selector with compatible types.
At the moment, for each module we are storing methods declared in the
headers belonging to this module and methods from the transitive closure
of imported modules. When a module is imported by a few other modules,
methods from the shared module are duplicated in each importer. As the
result, we can end up with lots of identical methods that we try to add
to the global method pool. Doing this duplicate work is useless and
relatively expensive.
Avoid processing duplicate methods by storing in each module only its
own methods and not storing methods from dependencies. Collect methods
from dependencies by walking the graph of module dependencies.
The issue was discovered and reported by Richard Howell. He has done the
hard work for this fix as he has investigated and provided a detailed
explanation of the performance problem.
Differential Revision: https://reviews.llvm.org/D110123
Michael Jones [Tue, 2 Nov 2021 21:49:38 +0000 (14:49 -0700)]
[libc][NFC] rename str_conv_utils to str_to_integer
rename str_conv_utils to str_to_integer to be more
in line with str_to_float.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/D113061
Jacques Pienaar [Wed, 3 Nov 2021 22:34:13 +0000 (15:34 -0700)]
[mlir] Use _odsPrinter for printer name in generated code
The generated name should not be load bearing, so this should be a NFC change.
Differential Revision: https://reviews.llvm.org/D113149
Philip Reames [Wed, 3 Nov 2021 22:13:31 +0000 (15:13 -0700)]
Backout must-exit based parts of
3fc9882e, and 412eb0
Not sure these are correct. I think I missed a case when porting this from the original SCEV change to the IndVar changes. I may end up reapplying this later with a comment about how this is correct, but in case the current bad feeling turns out to be true, I'm removing from tree while investigating further.
Jonas Devlieghere [Wed, 3 Nov 2021 21:55:28 +0000 (14:55 -0700)]
[lldb] Update tagged pointer command output and test.
- Use formatv to print the addresses.
- Add check for 0x0 which is treated as an invalid address.
- Use a an address that's less likely to be interpreted as a real
tagged pointer.
Arthur Eubanks [Wed, 3 Nov 2021 22:00:28 +0000 (15:00 -0700)]
[NFC] Clarify why LinkAll*.h are actually necessary
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D113074
Arthur Eubanks [Tue, 2 Nov 2021 02:49:05 +0000 (19:49 -0700)]
[ArgPromo] Preserve FunctionAnalysisManagerCGSCCProxy
We already make sure to properly clear analyses for deleted functions.
This makes investigating some future potential compile time improvements easier.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D113032
Mogball [Wed, 3 Nov 2021 21:12:41 +0000 (21:12 +0000)]
[mlir] fix Debug unittests
Flag NDEBUG needed to be changed to LLVM_ENABLE_ABI_BREAKING_CHECKS
Philip Reames [Wed, 3 Nov 2021 21:33:08 +0000 (14:33 -0700)]
[tests] Precommit for generalization of D112262
Craig Topper [Wed, 3 Nov 2021 21:11:18 +0000 (14:11 -0700)]
[RISCV] Use HasVInstructions and HasVInstructionsAnyF in more place in TableGen. NFC
Change RISCVSubtarget.hasVInstructionAnyF() to call hasVInstructionsF32
so that any changes to hasVInstructionsF32 are reflected.
The files were missed in D112496.
Matthias Braun [Tue, 28 Sep 2021 00:57:22 +0000 (17:57 -0700)]
X86InstrInfo: Support immediates that are +1/-1 different in optimizeCompareInstr
This is a re-commit of
e2c7ee0743592e39274e28dbe0d0c213ba342317 which
was reverted in
a2a58d91e82db38fbdf88cc317dcb3753d79d492. This includes
a fix to consistently check for EFLAGS being live-out. See phabricator
review.
Original Summary:
This extends `optimizeCompareInstr` to re-use previous comparison
results if the previous comparison was with an immediate that was 1
bigger or smaller. Example:
CMP x, 13
...
CMP x, 12 ; can be removed if we change the SETg
SETg ... ; x > 12 changed to `SETge` (x >= 13) removing CMP
Motivation: This often happens because SelectionDAG canonicalization
tends to add/subtract 1 often when optimizing for fallthrough blocks.
Example for `x > C` the fallthrough optimization switches true/false
blocks with `!(x > C)` --> `x <= C` and canonicalization turns this into
`x < C + 1`.
Differential Revision: https://reviews.llvm.org/D110867