Vedant Kumar [Fri, 12 Oct 2018 19:29:59 +0000 (19:29 +0000)]
[dotest] Make a missing FileCheck binary a warning, not an error
This allows bots which haven't updated to pass in --filecheck to
dotest.py to run more tests. FileCheck-dependent tests will continue to
fail.
Differential Revision: https://reviews.llvm.org/D53175
llvm-svn: 344401
Simon Pilgrim [Fri, 12 Oct 2018 19:14:43 +0000 (19:14 +0000)]
Fix a clang::driver::ArgStringList usage I missed in rL344398. NFCI.
llvm-svn: 344400
Simon Pilgrim [Fri, 12 Oct 2018 19:03:54 +0000 (19:03 +0000)]
Regenerate test. NFCI.
llvm-svn: 344399
Simon Pilgrim [Fri, 12 Oct 2018 18:55:36 +0000 (18:55 +0000)]
Consistently make llvm::opt::ArgStringList usage explicit to try and appease MSVC 2015 buildbots. NFCI.
llvm-svn: 344398
Jim Ingham [Fri, 12 Oct 2018 18:46:02 +0000 (18:46 +0000)]
Add "v" as well as "var" as an alias for "frame var".
<rdar://problem/
40066460>
llvm-svn: 344397
Rui Ueyama [Fri, 12 Oct 2018 18:29:30 +0000 (18:29 +0000)]
Replace assert() with llvm_unreachable because it's obviously a typo.
llvm-svn: 344395
Rui Ueyama [Fri, 12 Oct 2018 18:29:18 +0000 (18:29 +0000)]
Remove `Type` parameter from SymbolTable::insert(). NFC.
`Type` parameter was used only to check for TLS attribute mismatch,
but we can do that when we actually replace symbols, so we don't need
to type as an argument. This change should simplify the interface of
the symbol table a bit.
llvm-svn: 344394
Reid Kleckner [Fri, 12 Oct 2018 18:19:06 +0000 (18:19 +0000)]
[codeview] Emit S_BUILDINFO and LF_BUILDINFO with cwd and source file
Summary: We can fill in the command line and compiler path later if we want.
Reviewers: zturner
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D53179
llvm-svn: 344393
Andrea Di Biagio [Fri, 12 Oct 2018 18:18:53 +0000 (18:18 +0000)]
[llvm-mca] Correctly set aliases for register writes introduced by optimized register moves.
This fixes a problem introduced by r344334. A write from a non-zero move
eliminated at register renaming stage was not correctly handled by the PRF. This
would have led to an assertion failure if the processor model declares a PRF
that enables non-zero move elimination.
llvm-svn: 344392
Jonathan Metzman [Fri, 12 Oct 2018 18:11:47 +0000 (18:11 +0000)]
[SanitizerCoverage] Prevent /OPT:REF from stripping constructors
Summary:
Linking with the /OPT:REF linker flag when building COFF files causes
the linker to strip SanitizerCoverage's constructors. Prevent this by
giving the constructors WeakODR linkage and by passing the linker a
directive to include sancov.module_ctor.
Include a test in compiler-rt to verify libFuzzer can be linked using
/OPT:REF
Reviewers: morehouse, rnk
Reviewed By: morehouse, rnk
Subscribers: rnk, morehouse, hiraditya
Differential Revision: https://reviews.llvm.org/D52119
llvm-svn: 344391
Simon Pilgrim [Fri, 12 Oct 2018 18:10:04 +0000 (18:10 +0000)]
Fix MCBTF string array initialization so its MSVC friendly. NFCI.
llvm-svn: 344390
Reid Kleckner [Fri, 12 Oct 2018 18:08:11 +0000 (18:08 +0000)]
Revert r344375 "[Driver] check for exit code from SIGPIPE"
This doesn't build on Windows.
llvm-svn: 344389
Jonas Toth [Fri, 12 Oct 2018 17:57:18 +0000 (17:57 +0000)]
[Doc] fix second error in UsersManual
llvm-svn: 344388
Fangrui Song [Fri, 12 Oct 2018 17:57:07 +0000 (17:57 +0000)]
[BPF] Use cstdint {,u}int*_t instead of linux/types.h __u32 __u16 ...
llvm-svn: 344387
Stella Stamenova [Fri, 12 Oct 2018 17:56:01 +0000 (17:56 +0000)]
[lldbsuite] Fix the filecheck functionality to work with Python 3
Summary: This is another string/byte conversion issue between Python 2 and 3. In Python 2, the subprocess communication expects a byte string, but in Python 3, it expects bytes. Since both versions are capable of using strings when universal_newlines is set to True AND filecheck operates on strings, force the use of strings.
Reviewers: zturner, asmith, vsk
Reviewed By: zturner
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D53166
llvm-svn: 344386
Eric Liu [Fri, 12 Oct 2018 17:55:21 +0000 (17:55 +0000)]
Disambiguate: s/make_unique/llvm::make_unique/. NFC
llvm-svn: 344385
Jonas Toth [Fri, 12 Oct 2018 17:47:43 +0000 (17:47 +0000)]
[clangd] NFC fix semicolon warning
llvm-svn: 344384
Jonas Toth [Fri, 12 Oct 2018 17:44:01 +0000 (17:44 +0000)]
[Doc] fix BB, add code-block type
llvm-svn: 344382
Fangrui Song [Fri, 12 Oct 2018 17:41:12 +0000 (17:41 +0000)]
[BPF] Don't include linux/types.h and fix style
llvm-svn: 344381
Jonas Toth [Fri, 12 Oct 2018 17:36:04 +0000 (17:36 +0000)]
[doc] fix markup in clang-tidy bugprone-not-null-terminated-result
llvm-svn: 344379
Zachary Turner [Fri, 12 Oct 2018 17:28:39 +0000 (17:28 +0000)]
Fix another error related to YAML quoting.
This one occured in polly, which I didn't build / test the first
time so I didn't catch it.
llvm-svn: 344378
Zachary Turner [Fri, 12 Oct 2018 17:26:19 +0000 (17:26 +0000)]
Better support for POSIX paths in PDBs.
This a resubmission of a patch which was previously reverted
due to breaking several lld tests. The issues causing those
failures have been fixed, so the patch is now resubmitted.
---Original Commit Message---
While it doesn't make a *ton* of sense for POSIX paths to be
in PDBs, it's possible to occur in real scenarios involving
cross compilation.
The tools need to be able to handle this, because certain types
of debugging scenarios are possible without a running process
and so don't necessarily require you to be on a Windows system.
These include post-mortem debugging and binary forensics (e.g.
using a debugger to disassemble functions and examine symbols
without running the process).
There's changes in clang, LLD, and lldb in this patch. After
this the cross-platform disassembly and source-list tests pass
on Linux.
Furthermore, the behavior of LLD can now be summarized by a much
simpler rule than before: Unless you specify /pdbsourcepath and
/pdbaltpath, the PDB ends up with paths that are valid within
the context of the machine that the link is performed on.
Differential Revision: https://reviews.llvm.org/D53149
llvm-svn: 344377
Fangrui Song [Fri, 12 Oct 2018 17:23:25 +0000 (17:23 +0000)]
[BPF] Some fixes after rL344366
* Move #include outside of namespaces
* Add missing #include
* Add out-of-line virtual destructor to BTFTypeEntry
designated initializers should also be fixed
llvm-svn: 344376
Nick Desaulniers [Fri, 12 Oct 2018 17:22:46 +0000 (17:22 +0000)]
[Driver] check for exit code from SIGPIPE
Summary:
D53000 adds a special exit code for SIGPIPE (writing to a closed
reader), and rather than print a fatal warning, skips printing the
error. This can be seen commonly from piping into head, tee, or
split.
Fixes PR25349, rdar://problem/
14285346, b/
77310947.
Reviewers: jfb
Reviewed By: jfb
Subscribers: cfe-commits, thakis, srhines
Differential Revision: https://reviews.llvm.org/D53001
llvm-svn: 344375
Jonas Toth [Fri, 12 Oct 2018 17:22:36 +0000 (17:22 +0000)]
[clang-tidy] New checker for not null-terminated result caused by strlen(), size() or equal length
New checker called bugprone-not-null-terminated-result. This check finds function calls where it is possible to cause a not null-terminated result. Usually the proper length of a string is strlen(src) + 1 or equal length of this expression, because the null terminator needs an extra space. Without the null terminator it can result in undefined behaviour when the string is read.
The following function calls are checked:
memcpy, wmemcpy, memcpy_s, wmemcpy_s, memchr, wmemchr, memmove, wmemmove, memmove_s, wmemmove_s, memset, wmemset, strerror_s, strncmp, wcsncmp, strxfrm, wcsxfrm
The following is a real-world example where the programmer forgot to increase the passed third argument, which is size_t length. That is why the length of the allocated memory is problematic too.
static char *StringCpy(const std::string &str) {
char *result = reinterpret_cast<char *>(malloc(str.size()));
memcpy(result, str.data(), str.size());
return result;
}
After running the tool fix-it rewrites all the necessary code according to the given options. If it is necessary, the buffer size will be increased to hold the null terminator.
static char *StringCpy(const std::string &str) {
char *result = reinterpret_cast<char *>(malloc(str.size() + 1));
strcpy(result, str.data());
return result;
}
Patch by Charusso.
Differential ID: https://reviews.llvm.org/D45050
llvm-svn: 344374
Erik Pilkington [Fri, 12 Oct 2018 17:22:10 +0000 (17:22 +0000)]
[CodeGen] Handle extern references to OBJC_CLASS_$_*
Some ObjC users declare a extern variable named OBJC_CLASS_$_Foo, then use it's
address as a Class. I.e., one could define isInstanceOfF:
BOOL isInstanceOfF(id c) {
extern void OBJC_CLASS_$_F;
return [c class] == (Class)&OBJC_CLASS_$_F;
}
This leads to asserts in clang CodeGen if there is an @implementation of F in
the same TU as an instance of this pattern, because CodeGen assumes that a
variable named OBJC_CLASS_$_* has the right type. This commit fixes the problem
by RAUWing the old (incorrectly typed) global with a new global, then removing
the old global.
rdar://
45077269
Differential revision: https://reviews.llvm.org/D53154
llvm-svn: 344373
Nick Desaulniers [Fri, 12 Oct 2018 17:22:07 +0000 (17:22 +0000)]
[Support] exit with custom return code for SIGPIPE
Summary:
We tell the user to file a bug report on LLVM right now, and
SIGPIPE isn't LLVM's fault so our error message is wrong.
Allows frontends to detect SIGPIPE from writing to closed readers.
This can be seen commonly from piping into head, tee, or split.
Fixes PR25349, rdar://problem/
14285346, b/
77310947
Reviewers: jfb
Reviewed By: jfb
Subscribers: majnemer, kristina, llvm-commits, thakis, srhines
Differential Revision: https://reviews.llvm.org/D53000
llvm-svn: 344372
Shafik Yaghmour [Fri, 12 Oct 2018 17:20:39 +0000 (17:20 +0000)]
Adding support to step into the callable wrapped by libc++ std::function
rdar://problem/
14365983
Differential Revision: https://reviews.llvm.org/D52851
llvm-svn: 344371
Louis Dionne [Fri, 12 Oct 2018 17:12:41 +0000 (17:12 +0000)]
[NFC][libc++] Fix broken link in comment
llvm-svn: 344369
Rui Ueyama [Fri, 12 Oct 2018 17:07:32 +0000 (17:07 +0000)]
[lld] Add more complete support for the INCLUDE command.
Patch by Ian Tessier.
This change adds INCLUDE support to the MEMORY and SECTION commands, and
to output sections, as per:
https://sourceware.org/binutils/docs/ld/File-Commands.html#File-Commands
Differential Revision: https://reviews.llvm.org/D52951
llvm-svn: 344368
Dan Albert [Fri, 12 Oct 2018 17:06:31 +0000 (17:06 +0000)]
[Driver] Add defaults for Android ARM FPUs.
Summary:
Android mandates that devices have at least vfpv3-d16 until
Marshmallow and NEON after that. Still honor the user's decision, but
raise the defaults for Android targets.
Reviewers: srhines, pirama, javed.absar, kristof.beyls, peter.smith
Reviewed By: peter.smith
Subscribers: peter.smith, rengolin, kristof.beyls, chrib, cfe-commits
Differential Revision: https://reviews.llvm.org/D53121
llvm-svn: 344367
Yonghong Song [Fri, 12 Oct 2018 17:01:46 +0000 (17:01 +0000)]
[BPF] Add BTF generation for BPF target
BTF is the debug format for BPF, a kernel virtual machine
and widely used for tracing, networking and security, etc ([1]).
Currently only instruction streams are passed to kernel,
the kernel verifier verifies them before execution. In order to
provide better visibility of bpf programs to user space
tools, some debug information, e.g., function names and
debug line information are desirable for kernel so tools
can get such information with better annotation
for jited instructions for performance or other reasons.
The dwarf is too complicated in kernel and for BPF.
Hence, BTF is designed to be the debug format for BPF ([2]).
Right now, pahole supports BTF for types, which
are generated based on dwarf sections in the ELF file.
In order to annotate performance metrics for jited bpf insns,
it is necessary to pass debug line info to the kernel.
Furthermore, we want to pass the actual code to the
kernel because of the following reasons:
. bpf program typically is small so storage overhead
should be small.
. in bpf land, it is totally possible that
an application loads the bpf program into the
kernel and then that application quits, so
holding debug info by the user space application
is not practical.
. having source codes directly kept by kernel
would ease deployment since the original source
code does not need ship on every hosts and
kernel-devel package does not need to be
deployed even if kernel headers are used.
The only reliable time to get the source code is
during compilation time. This will result in both more
accurate information and easier deployment as
stated in the above.
Another consideration is for JIT. The project like bcc
use MCJIT to compile a C program into bpf insns and
load them to the kernel ([3]). The generated BTF sections
will be readily available for such cases as well.
This patch implemented generation of BTF info in llvm
compiler. The BTF related sections will be generated
when both -target bpf and -g are specified. Two sections
are generated:
.BTF contains all the type and string information, and
.BTF.ext contains the func_info and line_info.
The separation is related to how two sections are used
differently in bpf loader, e.g., linux libbpf ([4]).
The .BTF section can be loaded into the kernel directly
while .BTF.ext needs loader manipulation before loading
to the kernel. The format of the each section is roughly
defined in llvm:include/llvm/MC/MCBTFContext.h and
from the implementation in llvm:lib/MC/MCBTFContext.cpp.
A later example also shows the contents in each section.
The type and func_info are gathered during CodeGen/AsmPrinter
by traversing dwarf debug_info. The line_info is
gathered in MCObjectStreamer before writing to
the object file. After all the information is gathered,
the two sections are emitted in MCObjectStreamer::finishImpl.
With cmake CMAKE_BUILD_TYPE=Debug, the compiler can
dump out all the tables except insn offset, which
will be resolved later as relocation records.
The debug type "btf" is used for BTFContext dump.
Dwarf tests the debug info generation with
llvm-dwarfdump to decode the binary sections and
check whether the result is expected. Currently
we do not have such a tool yet. We will implement
btf dump functionality in bpftool ([5]) as the bpftool is
considered the recommended tool for bpf introspection.
The implementation for type and func_info is tested
with linux kernel test cases. The line_info is visually
checked with dump from linux kernel libbpf ([4]) and
checked with readelf dumping section raw data.
Note that the .BTF and .BTF.ext information will not
be emitted to assembly code and there is no assembler
support for BTF either.
In the below, with a clang/llvm built with CMAKE_BUILD_TYPE=Debug,
Each table contents are shown for a simple C program.
-bash-4.2$ cat -n test.c
1 struct A {
2 int a;
3 char b;
4 };
5
6 int test(struct A *t) {
7 return t->a;
8 }
-bash-4.2$ clang -O2 -target bpf -g -mllvm -debug-only=btf -c test.c
Type Table:
[1] FUNC name_off=1 info=0x0c000001 size/type=2
param_type=3
[2] INT name_off=12 info=0x01000000 size/type=4
desc=0x01000020
[3] PTR name_off=0 info=0x02000000 size/type=4
[4] STRUCT name_off=16 info=0x04000002 size/type=8
name_off=18 type=2 bit_offset=0
name_off=20 type=5 bit_offset=32
[5] INT name_off=22 info=0x01000000 size/type=1
desc=0x02000008
String Table:
0 :
1 : test
6 : .text
12 : int
16 : A
18 : a
20 : b
22 : char
27 : test.c
34 : int test(struct A *t) {
58 : return t->a;
FuncInfo Table:
sec_name_off=6
insn_offset=<Omitted> type_id=1
LineInfo Table:
sec_name_off=6
insn_offset=<Omitted> file_name_off=27 line_off=34 line_num=6 column_num=0
insn_offset=<Omitted> file_name_off=27 line_off=58 line_num=7 column_num=3
-bash-4.2$ readelf -S test.o
......
[12] .BTF PROGBITS
0000000000000000 0000028d
00000000000000c1 0000000000000000 0 0 1
[13] .BTF.ext PROGBITS
0000000000000000 0000034e
0000000000000050 0000000000000000 0 0 1
[14] .rel.BTF.ext REL
0000000000000000 00000648
0000000000000030 0000000000000010 16 13 8
......
-bash-4.2$
The latest linux kernel ([6]) can already support .BTF with type information.
The [7] has the reference implementation in linux kernel side
to support .BTF.ext func_info. The .BTF.ext line_info support is not
implemented yet. If you have difficulty accessing [6], you can
manually do the following to access the code:
git clone https://github.com/yonghong-song/bpf-next-linux.git
cd bpf-next-linux
git checkout btf
The change will push to linux kernel soon once this patch is landed.
References:
[1]. https://www.kernel.org/doc/Documentation/networking/filter.txt
[2]. https://lwn.net/Articles/750695/
[3]. https://github.com/iovisor/bcc
[4]. https://github.com/torvalds/linux/tree/master/tools/lib/bpf
[5]. https://github.com/torvalds/linux/tree/master/tools/bpf/bpftool
[6]. https://github.com/torvalds/linux
[7]. https://github.com/yonghong-song/bpf-next-linux/tree/btf
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Differential Revision: https://reviews.llvm.org/D52950
llvm-svn: 344366
Michal Gorny [Fri, 12 Oct 2018 16:55:44 +0000 (16:55 +0000)]
[tests] Readd Python binding tests to check-all
Now that both issues found out during the last iteration have been
fixed, reenable the Python binding tests on buildbots.
llvm-svn: 344365
Michal Gorny [Fri, 12 Oct 2018 16:55:39 +0000 (16:55 +0000)]
[python] [tests] Remove cdb lookup failure test
Remove the test checking for compilation db lookup failure.
Since r342228, JSONCompilationDatabasePlugin infers compile commands for
missing files, therefore making the lookup always succeed.
Differential Revision: https://reviews.llvm.org/D53202
llvm-svn: 344364
Sam McCall [Fri, 12 Oct 2018 16:51:48 +0000 (16:51 +0000)]
[clangd] Return Command objects from onCodeAction, rather than ad-hoc JSON. NFC
llvm-svn: 344363
Zachary Turner [Fri, 12 Oct 2018 16:41:37 +0000 (16:41 +0000)]
Fix one additional test broken by the YAML quoting change.
llvm-svn: 344362
Sanjay Patel [Fri, 12 Oct 2018 16:41:02 +0000 (16:41 +0000)]
[x86] add and use fast horizontal vector math subtarget feature
This is the planned follow-up to D52997. Here we are reducing horizontal vector math codegen
by default. AMD Jaguar (btver2) should have no difference with this patch because it has
fast-hops. (If we want to set that bit for other CPUs, let me know.)
The code changes are small, but there are many test diffs. For files that are specifically
testing for hops, I added RUNs to distinguish fast/slow, so we can see the consequences
side-by-side. For files that are primarily concerned with codegen other than hops, I just
updated the CHECK lines to reflect the new default codegen.
To recap the recent horizontal op story:
1. Before rL343727, we were producing hops for all subtargets for a variety of patterns.
Hops were likely not optimal for all targets though.
2. The IR improvement in r343727 exposed a hole in the backend hop pattern matching, so
we reduced hop codegen for all subtargets. That was bad for Jaguar (PR39195).
3. We restored the hop codegen for all targets with rL344141. Good for Jaguar, but
probably bad for other CPUs.
4. This patch allows us to distinguish when we want to produce hops, so everyone can be
happy. I'm not sure if we have the best predicate here, but the intent is to undo the
extra hop-iness that was enabled by r344141.
Differential Revision: https://reviews.llvm.org/D53095
llvm-svn: 344361
Nick Desaulniers [Fri, 12 Oct 2018 16:35:44 +0000 (16:35 +0000)]
[MC][ELF] fix newly added test
Summary:
Reland of
- r344197 "[MC][ELF] compute entity size for explicit sections"
- r344206 "[MC][ELF] Fix section_mergeable_size.ll"
after being reverted in r344278 due to build breakages from not
specifying a target triple.
Move test from test/CodeGen/Generic/ to test/MC/ELF/.
Add explicit target triple so we don't try to run
this test on non ELF targets.
Reported: https://reviews.llvm.org/D53056#1261707
Reviewers: fhahn, rnk, espindola, NoQ
Reviewed By: fhahn, rnk
Subscribers: NoQ, MaskRay, rengolin, emaste, arichardson, llvm-commits, pirama, srhines
Differential Revision: https://reviews.llvm.org/D53146
llvm-svn: 344360
Zachary Turner [Fri, 12 Oct 2018 16:31:20 +0000 (16:31 +0000)]
Make YAML quote forward slashes.
If you have the string /usr/bin, prior to this patch it would not
be quoted by our YAML serializer. But a string like C:\src would
be, due to the presence of a backslash. This makes the quoting
rules of basically every single file path different depending on
the path syntax (posix vs. Windows).
While technically not required by the YAML specification to quote
forward slashes, when the behavior of paths is inconsistent it
makes it difficult to portably write FileCheck lines that will
work with either kind of path.
Differential Revision: https://reviews.llvm.org/D53169
llvm-svn: 344359
Zachary Turner [Fri, 12 Oct 2018 16:31:08 +0000 (16:31 +0000)]
Revert "Make YAML quote forward slashes."
This reverts commit
b86c16ad8c97dadc1f529da72a5bb74e9eaed344.
This is being reverted because I forgot to write a useful
commit message, so I'm going to resubmit it with an actual
commit message.
llvm-svn: 344358
Zachary Turner [Fri, 12 Oct 2018 16:24:09 +0000 (16:24 +0000)]
Make YAML quote forward slashes.
llvm-svn: 344357
Alexey Bataev [Fri, 12 Oct 2018 16:04:20 +0000 (16:04 +0000)]
[OPENMP][NVPTX]Reduce memory usage in orphaned functions.
if the function has globalized variables and called in context of
target/teams/distribute regions, it does not need to globalize 32
copies of the same variables for memory coalescing, it is enough to
have just one copy, because there is parallel region.
Patch does this by adding call for `__kmpc_parallel_level` function and
checking its return value. If the code sees that the parallel level is
0, then only one variable is allocated, not 32.
llvm-svn: 344356
Simon Pilgrim [Fri, 12 Oct 2018 15:49:19 +0000 (15:49 +0000)]
Pull out repeated value types. NFCI.
llvm-svn: 344355
Simon Pilgrim [Fri, 12 Oct 2018 15:48:47 +0000 (15:48 +0000)]
Pull out repeated value types. NFCI.
llvm-svn: 344354
Sanjay Patel [Fri, 12 Oct 2018 15:22:14 +0000 (15:22 +0000)]
[AArch64][x86] add tests for trunc disguised as vector ops (PR39016); NFC
These correspond to the IR transform from:
D52439
llvm-svn: 344353
Simon Pilgrim [Fri, 12 Oct 2018 15:16:25 +0000 (15:16 +0000)]
Fix MSVC 2015 ambiguous symbol warning introduced by rL344337. NFCI.
llvm-svn: 344352
Guillaume Chatelet [Fri, 12 Oct 2018 15:12:22 +0000 (15:12 +0000)]
[llvm-exegesis][NFC] Simplify code at the cost of small code duplication
Reviewers: courbet
Subscribers: tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D53198
llvm-svn: 344351
Eric Liu [Fri, 12 Oct 2018 15:01:11 +0000 (15:01 +0000)]
Fix unused variable warning after r344348
llvm-svn: 344350
Simon Pilgrim [Fri, 12 Oct 2018 14:45:57 +0000 (14:45 +0000)]
[SelectionDAG] Move VectorLegalizer::ExpandCTLZ codegen into SelectionDAGLegalize
Generalize SelectionDAGLegalize's CTLZ expansion to handle vectors - lets VectorLegalizer::ExpandCTLZ to just pass the expansion on instead of repeating the same codegen.
llvm-svn: 344349
Simon Pilgrim [Fri, 12 Oct 2018 14:18:47 +0000 (14:18 +0000)]
[X86][SSE] LowerVectorCTPOP - pull out repeated byte sum stage.
Pull out repeated byte sum stage for popcount of vector elements > 8bits.
This allows us to simplify the LUT/BITMATH popcnt code to always assume vXi8 vectors, and also improves avx512bitalg codegen which only has access to vpopcntb/vpopcntw.
llvm-svn: 344348
Hiroshi Inoue [Fri, 12 Oct 2018 14:02:20 +0000 (14:02 +0000)]
[PowerPC] avoid masking already-zero bits in BitPermutationSelector
The current BitPermutationSelector generates a code to build a value by tracking two types of bits: ConstZero and Variable.
ConstZero means a bit we need to mask off and Variable is a bit we copy from an input value.
This patch add third type of bits VariableKnownToBeZero caused by AssertZext node or zero-extending load node.
VariableKnownToBeZero means a bit comes from an input value, but it is known to be already zero. So we do not need to mask them.
VariableKnownToBeZero enhances flexibility to group bits, since we can avoid redundant masking for these bits.
This patch also renames "HasZero" to "NeedMask" since now we may skip masking even when we have zeros (of type VariableKnownToBeZero).
Differential Revision: https://reviews.llvm.org/D48025
llvm-svn: 344347
Max Moroz [Fri, 12 Oct 2018 13:59:56 +0000 (13:59 +0000)]
[libFuzzer] Add test for SanitizerCoverage working on Mac even with -Wl,-dead_strip.
Summary:
The corresponding asncov change: https://reviews.llvm.org/D53113.
Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=892167
Reviewers: morehouse, kcc, george.karpenkov
Reviewed By: morehouse, george.karpenkov
Subscribers: delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D53114
llvm-svn: 344346
Max Moroz [Fri, 12 Oct 2018 13:59:31 +0000 (13:59 +0000)]
[SanitizerCoverage] Make Inline8bit and TracePC counters dead stripping resistant.
Summary:
Otherwise, at least on Mac, the linker eliminates unused symbols which
causes libFuzzer to error out due to a mismatch of the sizes of coverage tables.
Issue in Chromium: https://bugs.chromium.org/p/chromium/issues/detail?id=892167
Reviewers: morehouse, kcc, george.karpenkov
Reviewed By: morehouse
Subscribers: kubamracek, llvm-commits
Differential Revision: https://reviews.llvm.org/D53113
llvm-svn: 344345
George Rimar [Fri, 12 Oct 2018 13:39:35 +0000 (13:39 +0000)]
[ELF] - Remove unused variable. NFC.
It triggered a bot failture somehow today:
http://lab.llvm.org:8011/builders/lld-perf-testsuite/builds/7993
llvm-svn: 344344
Zinovy Nis [Fri, 12 Oct 2018 13:35:47 +0000 (13:35 +0000)]
[clang-tidy] Fix check_clang_tidy.py trivially passing default CHECK
Differential Revision: https://reviews.llvm.org/D53194
llvm-svn: 344343
George Rimar [Fri, 12 Oct 2018 13:25:25 +0000 (13:25 +0000)]
[ELF] - Remove dead declaration. NFC.
MipsGotSection::FileGot::isOverflow()
was a dead declararion.
llvm-svn: 344342
Simon Pilgrim [Fri, 12 Oct 2018 13:24:51 +0000 (13:24 +0000)]
[X86][AVX] Regenerate tzcnt tests
llvm-svn: 344341
Adam Balogh [Fri, 12 Oct 2018 13:05:21 +0000 (13:05 +0000)]
[clang-tidy] White List Option for performance-unnecessary-value-param, performance-unnecessary-copy-initialization and performance-for-range-copy
New option added to these three checks to be able to silence false positives on
types that are intentionally passed by value or copied. Such types are e.g.
intrusive reference counting pointer types like llvm::IntrusiveRefCntPtr. The
new option is named WhiteListTypes and can contain a semicolon-separated list of
names of these types. Regular expressions are allowed. Default is empty.
Differential Revision: https://reviews.llvm.org/D52727
llvm-svn: 344340
Andrea Di Biagio [Fri, 12 Oct 2018 12:38:27 +0000 (12:38 +0000)]
[llvm-mca] Remove method RegisterFileStatistics::initializeRegisterFileInfo(). NFC
llvm-svn: 344339
Sam Parker [Fri, 12 Oct 2018 12:26:37 +0000 (12:26 +0000)]
Fix documentation of MachineInstr::getNumOperands
The documentation stated "Access to explicit operands of the
instruction." This is misleading, as it also lists implicit operands.
Patch by Philip Ginsbach.
Differential Revision: https://reviews.llvm.org/D35481
llvm-svn: 344338
Sam McCall [Fri, 12 Oct 2018 12:21:29 +0000 (12:21 +0000)]
Remove top-level using declaration from header files, as these aliases leak.
Reviewers: ilya-biryukov
Subscribers: arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D53135
llvm-svn: 344337
Simon Pilgrim [Fri, 12 Oct 2018 12:10:34 +0000 (12:10 +0000)]
[X86][SSE] Add extract_subvector(PSHUFB) -> PSHUFB(extract_subvector()) combine
Fixes PR32160 by reducing the size of PSHUFB if we only use one of the lanes.
This approach can probably be generalized to handle any target shuffle (and any subvector index) but we have no test coverage at the moment.
llvm-svn: 344336
Eric Liu [Fri, 12 Oct 2018 11:47:36 +0000 (11:47 +0000)]
[Tooling] Expose ExecutorName option.
llvm-svn: 344335
Andrea Di Biagio [Fri, 12 Oct 2018 11:23:04 +0000 (11:23 +0000)]
[tblgen][llvm-mca] Add the ability to describe move elimination candidates via tablegen.
This patch adds the ability to identify instructions that are "move elimination
candidates". It also allows scheduling models to describe processor register
files that allow move elimination.
A move elimination candidate is an instruction that can be eliminated at
register renaming stage.
Each subtarget can specify which instructions are move elimination candidates
with the help of tablegen class "IsOptimizableRegisterMove" (see
llvm/Target/TargetInstrPredicate.td).
For example, on X86, BtVer2 allows both GPR and MMX/SSE moves to be eliminated.
The definition of 'IsOptimizableRegisterMove' for BtVer2 looks like this:
```
def : IsOptimizableRegisterMove<[
InstructionEquivalenceClass<[
// GPR variants.
MOV32rr, MOV64rr,
// MMX variants.
MMX_MOVQ64rr,
// SSE variants.
MOVAPSrr, MOVUPSrr,
MOVAPDrr, MOVUPDrr,
MOVDQArr, MOVDQUrr,
// AVX variants.
VMOVAPSrr, VMOVUPSrr,
VMOVAPDrr, VMOVUPDrr,
VMOVDQArr, VMOVDQUrr
], CheckNot<CheckSameRegOperand<0, 1>> >
]>;
```
Definitions of IsOptimizableRegisterMove from processor models of a same
Target are processed by the SubtargetEmitter to auto-generate a target-specific
override for each of the following predicate methods:
```
bool TargetSubtargetInfo::isOptimizableRegisterMove(const MachineInstr *MI)
const;
bool MCInstrAnalysis::isOptimizableRegisterMove(const MCInst &MI, unsigned
CPUID) const;
```
By default, those methods return false (i.e. conservatively assume that there
are no move elimination candidates).
Tablegen class RegisterFile has been extended with the following information:
- The set of register classes that allow move elimination.
- Maxium number of moves that can be eliminated every cycle.
- Whether move elimination is restricted to moves from registers that are
known to be zero.
This patch is structured in three part:
A first part (which is mostly boilerplate) adds the new
'isOptimizableRegisterMove' target hooks, and extends existing register file
descriptors in MC by introducing new fields to describe properties related to
move elimination.
A second part, uses the new tablegen constructs to describe move elimination in
the BtVer2 scheduling model.
A third part, teaches llm-mca how to query the new 'isOptimizableRegisterMove'
hook to mark instructions that are candidates for move elimination. It also
teaches class RegisterFile how to describe constraints on move elimination at
PRF granularity.
llvm-mca tests for btver2 show differences before/after this patch.
Differential Revision: https://reviews.llvm.org/D53134
llvm-svn: 344334
Simon Pilgrim [Fri, 12 Oct 2018 10:34:03 +0000 (10:34 +0000)]
Fix Wdocumentation warning. NFCI.
llvm-svn: 344333
Simon Pilgrim [Fri, 12 Oct 2018 10:26:59 +0000 (10:26 +0000)]
[X86][AVX] Add examples of shuffles that can be reduced to a cross-lane shuffle followed by a in-lane permute
Suitable for lowering by D53148
llvm-svn: 344332
Simon Pilgrim [Fri, 12 Oct 2018 10:20:16 +0000 (10:20 +0000)]
[X86] Ignore float/double non-temporal loads (PR39256)
Scalar non-temporal loads were asserting instead of just being ignored.
Reduced from https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10895
llvm-svn: 344331
Haojian Wu [Fri, 12 Oct 2018 10:11:02 +0000 (10:11 +0000)]
[clangd] Support hover on "aut^o *".
Reviewers: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D53186
llvm-svn: 344330
Arnaud A. de Grandmaison [Fri, 12 Oct 2018 10:01:09 +0000 (10:01 +0000)]
[TSan] Cleanup TSan runtime support for Go on linux-aarch64. NFC.
This is a follow-up patch to r342541. After further investigations, only
48bits VMA size can be supported. As this is enforced in function
InitializePlatformEarly from lib/rt1/tsan_platform_linux.cc, the access
to the global variable vmaSize variable + switch can be removed. This
also addresses a comment from https://reviews.llvm.org/D52167.
vmaSize of 39 or 42bits are not compatible with a Go program memory
layout as the Go heap will not fit in the shadow memory area.
Patch by: Fangming Fang <Fangming.Fang@arm.com>
llvm-svn: 344329
George Rimar [Fri, 12 Oct 2018 09:46:15 +0000 (09:46 +0000)]
[LLDB] - Add support for DW_FORM_implicit_const.
LLDB does not support this DWARF5 form atm.
At least gcc emits it in some cases when doing optimization
for abbreviations.
As far I can tell, clang does not support it yet, though
the rest LLVM code already knows about it.
The patch adds the support.
Differential revision: https://reviews.llvm.org/D52689
llvm-svn: 344328
Tim Northover [Fri, 12 Oct 2018 09:01:59 +0000 (09:01 +0000)]
SCCP: avoid caching DenseMap entry that might be invalidated.
Later calls to getValueState might insert entries into the ValueState map and
cause reallocation, invalidating a reference.
llvm-svn: 344327
Stefan Maksimovic [Fri, 12 Oct 2018 08:18:38 +0000 (08:18 +0000)]
[mips] Mark fmaxl as a long double emulation routine
Failure was discovered upon running
projects/compiler-rt/test/builtins/Unit/divtc3_test.c
in a stage2 compiler build.
When compiling projects/compiler-rt/lib/builtins/divtc3.c,
a call to fmaxl within the divtc3 implementation had its
return values read from registers $2 and $3 instead of $f0 and $f2.
Include fmaxl in the list of long double emulation routines
to have its return value correctly interpreted as f128.
Almost exact issue here: https://reviews.llvm.org/D17760
Differential Revision: https://reviews.llvm.org/D52649
llvm-svn: 344326
Eugene Leviant [Fri, 12 Oct 2018 07:24:02 +0000 (07:24 +0000)]
[ThinLTO] Don't import GV which contains blockaddress
Differential revision: https://reviews.llvm.org/D53139
llvm-svn: 344325
Dan Liew [Fri, 12 Oct 2018 02:36:19 +0000 (02:36 +0000)]
Fix bug where `config.asan_dynamic` in generated ASan `lit.site.cfg` files was set to `False` for macOS.
`config.asan_dynamic` should actually be `True` because dylibs are the
only supported form of the ASan runtime on Apple platforms.
Reviewers: kubamracek, george.karpenkov, samsonov
Subscribers: srhines, mgorny, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D53183
llvm-svn: 344324
Jason Molenda [Fri, 12 Oct 2018 00:53:55 +0000 (00:53 +0000)]
Remove references to source/Plugins/SymbolFile/NativePDB.
llvm-svn: 344323
George Karpenkov [Fri, 12 Oct 2018 00:52:13 +0000 (00:52 +0000)]
[analyzer] Fix a bug in unexplored_first_location_queue iteration order.
Pointed out by Artem in post-commit review for https://reviews.llvm.org/D53058
llvm-svn: 344322
Jordan Rupprecht [Fri, 12 Oct 2018 00:36:01 +0000 (00:36 +0000)]
[llvm-objcopy] Add -F|--target compatibility
Summary:
This change adds support for the GNU --target flag, which sets both --input-target and --output-target.
GNU objcopy doesn't do any checking for whether both --target and --{input,output}-target are used, and so it allows both, e.g. "--target A --output-target B" is equivalent to "--input-target A --output-target B" since the later command line flag would override earlier ones. This may be error prone, so I chose to implement it as an error if both are used. I'm not sure if anyone is actually using both.
Reviewers: jakehehrlich, jhenderson, alexshap
Reviewed By: jakehehrlich, alexshap
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53029
llvm-svn: 344321
Sanjay Patel [Thu, 11 Oct 2018 23:56:56 +0000 (23:56 +0000)]
[DAGCombiner] rearrange extract_element+bitcast fold; NFC
I want to add another pattern here that includes scalar_to_vector,
so this makes that patch smaller. I was hoping to remove the
hasOneUse() check because it shouldn't be necessary for common
codegen, but an AMDGPU test has a comment suggesting that the
extra check makes things better on one of those targets.
llvm-svn: 344320
Richard Smith [Thu, 11 Oct 2018 23:48:11 +0000 (23:48 +0000)]
Update user's manual documentation of profile remapping file to match
llvm-cxxmap documentation.
Add a hint as to how to perform off-line profile data remapping.
llvm-svn: 344319
Matthias Braun [Thu, 11 Oct 2018 23:37:58 +0000 (23:37 +0000)]
Revert "DwarfDebug: Pick next location in case of missing location at block begin"
It originally triggered a stepping problem in the debugger, which could
be fixed by adjusting CodeGen/LexicalScopes.cpp however it seems we prefer
the previous behavior anyway.
See the discussion for details: http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-
20181008/593833.html
This reverts commit r343880.
This reverts commit r343874.
llvm-svn: 344318
Tom Stellard [Thu, 11 Oct 2018 23:36:46 +0000 (23:36 +0000)]
Revert "AMDGPU/GlobalISel: Implement select for G_INSERT"
This reverts commit r344310.
The test case was failing on some bots.
llvm-svn: 344317
Erik Pilkington [Thu, 11 Oct 2018 23:30:56 +0000 (23:30 +0000)]
Override libcxxabi's .clang-format in the demangle directory
This directory uses LLVM style.
llvm-svn: 344316
Matthias Braun [Thu, 11 Oct 2018 23:14:35 +0000 (23:14 +0000)]
X86/TargetTransformInfo: Report div/rem constant immediate costs as TCC_Free
DIV/REM by constants should always be expanded into mul/shift/etc.
patterns. Unfortunately the ConstantHoisting pass runs too early at a
point where the pattern isn't expanded yet. However after
ConstantHoisting hoisted some immediate the result may not expand
anymore. Also the hoisting typically doesn't make sense because it
operates on immediates that will change completely during the expansion.
Report DIV/REM as TCC_Free so ConstantHoisting will not touch them.
Differential Revision: https://reviews.llvm.org/D53174
llvm-svn: 344315
Kostya Serebryany [Thu, 11 Oct 2018 23:03:27 +0000 (23:03 +0000)]
merge two near-identical functions createPrivateGlobalForString into one
Summary:
We have two copies of createPrivateGlobalForString (in asan and in esan).
This change merges them into one. NFC
Reviewers: vitalybuka
Reviewed By: vitalybuka
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53178
llvm-svn: 344314
George Karpenkov [Thu, 11 Oct 2018 22:59:59 +0000 (22:59 +0000)]
[analyzer] Experiment with an iteration order only based on location, and not using the stack frame
Differential Revision: https://reviews.llvm.org/D53058
llvm-svn: 344313
George Karpenkov [Thu, 11 Oct 2018 22:59:38 +0000 (22:59 +0000)]
[analyzer] Avoid unneeded invalidation in RetainCountChecker
Differential Revision: https://reviews.llvm.org/D53168
llvm-svn: 344312
George Karpenkov [Thu, 11 Oct 2018 22:59:16 +0000 (22:59 +0000)]
[analyzer] Retain count checker for OSObject: recognize OSDynamicCast
For now, tresting the cast as a no-op, and disregarding the case where
the output becomes null due to the type mismatch.
rdar://
45174557
Differential Revision: https://reviews.llvm.org/D53156
llvm-svn: 344311
Tom Stellard [Thu, 11 Oct 2018 22:49:54 +0000 (22:49 +0000)]
AMDGPU/GlobalISel: Implement select for G_INSERT
Reviewers: arsenm
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D53116
llvm-svn: 344310
Ana Pazos [Thu, 11 Oct 2018 22:49:13 +0000 (22:49 +0000)]
[RISCV] Fix disassembling of fence instruction with invalid field
Summary:
Instruction with 0 in fence field being disassembled as fence , iorw.
Printing "unknown" to match GAS behavior.
This bug was uncovered by a LLVM MC Disassembler Protocol Buffer Fuzzer
for the RISC-V assembly language.
Reviewers: asb
Subscribers: rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, jfb, PkmX, jocewei, asb
Differential Revision: https://reviews.llvm.org/D51828
llvm-svn: 344309
Richard Trieu [Thu, 11 Oct 2018 22:42:41 +0000 (22:42 +0000)]
Inline variable into assert to avoid unused variable warning.
llvm-svn: 344308
Alexander Shaposhnikov [Thu, 11 Oct 2018 22:33:50 +0000 (22:33 +0000)]
[llvm-objcopy] Factor out CopyConfig
In this diff we move out CopyConfig from llvm-oobjcopy.cpp into a separate header CopyConfig.h
to enable us (in the future) reuse this class in the other implementations of objcopy (for coff, mach-o).
Additionally this enables us to unload the complexity from llvm-objcopy.cpp a little bit.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D53006
llvm-svn: 344307
Aaron Smith [Thu, 11 Oct 2018 22:25:55 +0000 (22:25 +0000)]
[llvm-pdbutil] Add missing pdb for test
llvm-svn: 344306
Rui Ueyama [Thu, 11 Oct 2018 22:15:41 +0000 (22:15 +0000)]
Remove SymbolTable::addAbsolute().
addAbsolute() could be implemented as a non-member function.
llvm-svn: 344305
Wei Mi [Thu, 11 Oct 2018 22:14:27 +0000 (22:14 +0000)]
[SampleFDO][NFC] Remove debugging log left over in the code.
llvm-svn: 344304
Sanjay Patel [Thu, 11 Oct 2018 22:04:36 +0000 (22:04 +0000)]
[x86] add tests for extract_element; NFC
The transform for this pattern has an unnecessary one-use limitation.
llvm-svn: 344303
Rui Ueyama [Thu, 11 Oct 2018 21:57:52 +0000 (21:57 +0000)]
Remove `else` after `return`.
llvm-svn: 344302
Sanjay Patel [Thu, 11 Oct 2018 21:44:38 +0000 (21:44 +0000)]
[x86] regenerate CHECKs; NFC
llvm-svn: 344301
Eli Friedman [Thu, 11 Oct 2018 21:43:06 +0000 (21:43 +0000)]
[ELF] Fix link failure with Android compressed relocation support.
Android uses a compressed relocation format, which means the size of the
relocation section isn't predictable based on the number of relocations,
and can vary if the layout changes in any way. To deal with this, the
linker normally runs multiple passes until the layout converges.
The layout should converge if the size of the compressed
relocation section increases monotonically: if the size of an encoded
offset increases by one byte, the larget value which can be encoded is
multiplied by 128, so the representable offsets grow much faster than
the size of the section itself.
The problem here is that there is no code to ensure the size of the
section doesn't decrease. If the size of the relocation section
decreases, the relative offsets can increase due to alignment
restrictions, so that can force the size of the relocation section to
increase again. The end result is an infinite loop; the loop gets cut
off after 10 iterations with the message "thunk creation not
converged".
To avoid this issue, this patch adds padding to the end of the
relocation section if its size would decrease. The extra
padding is harmless because of the way the format is defined:
decoding stops after it reaches the number of relocations specified
in the section's header.
Differential Revision: https://reviews.llvm.org/D53003
llvm-svn: 344300
Eugene Zelenko [Thu, 11 Oct 2018 21:40:32 +0000 (21:40 +0000)]
[Documentation] Rephrase modernize-deprecated-ios-base-aliases description. Add clangd and clang-doc placeholders in Release Notes.
llvm-svn: 344299
Aaron Smith [Thu, 11 Oct 2018 21:37:18 +0000 (21:37 +0000)]
[llvm-pdbutil] Pretty print PDBSymbolUsingNamespace symbols
Reviewers: rnk, zturner, llvm-commits
Differential Revision: https://reviews.llvm.org/D52799
llvm-svn: 344298