Louis Dionne [Wed, 17 Apr 2019 21:57:49 +0000 (21:57 +0000)]
[libc++][CMake] Remove unnecessary conditional for defining new handlers
It turns out that whether the new handlers should be provided is orthogonal
to whether new/delete are provided in libc++ or libc++abi. The reason why
I initially added this conditional is because of an incorrect understanding
of the path we're taking when building on Apple platforms. In fact, we
always build libc++ on top of libc++abi on Apple platforms, so we take
the branch for `LIBCXX_BUILDING_LIBCXXABI` there.
llvm-svn: 358616
Davide Italiano [Wed, 17 Apr 2019 21:51:55 +0000 (21:51 +0000)]
[crashlog] Use the right path for dsymforUUID and remove an unnecessary import.
<rdar://problem/
49925960>
llvm-svn: 358615
Petr Hosek [Wed, 17 Apr 2019 21:41:09 +0000 (21:41 +0000)]
[CMake] Split linked libraries for shared and static libc++
Some linker libraries are only needed for shared libc++, some only
for static libc++, combining these together in LIBCXX_LIBRARIES and
LIBCXX_INTERFACE_LIBRARIES can introduce unnecessary dependencies.
This changes splits those up into LIBCXX_SHARED_LIBRARIES and
LIBCXX_STATIC_LIBRARIES matching what libc++abi already does.
Differential Revision: https://reviews.llvm.org/D57872
llvm-svn: 358614
Amara Emerson [Wed, 17 Apr 2019 21:30:07 +0000 (21:30 +0000)]
[GlobalISel] Add legalization support for non-power-2 loads and stores
Legalize things like i24 load/store by splitting them into smaller power of 2 operations.
This matches how SelectionDAG handles these operations.
Differential Revision: https://reviews.llvm.org/D59971
llvm-svn: 358613
Sam McCall [Wed, 17 Apr 2019 20:15:08 +0000 (20:15 +0000)]
[clangd] Strip the ' [some-check-name]' suffix from clang-tidy diagnostics. The check name is reported in Diagnostic.code.
Reviewers: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60819
llvm-svn: 358612
Sam McCall [Wed, 17 Apr 2019 20:12:03 +0000 (20:12 +0000)]
[clangd] Use shorter, more recognizable codes for diagnostics.
Summary:
- for warnings, use the flag the warning is controlled by (-Wfoo)
- for errors, keep using the internal name (there's nothing better) but
drop the err_ prefix
This comes at the cost of uniformity, it's no longer totally obvious
exactly what the code field contains. But the -Wname flags are so much
more useful to end-users than the internal warn_foo that this seems worth it.
Reviewers: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60822
llvm-svn: 358611
Louis Dionne [Wed, 17 Apr 2019 20:07:39 +0000 (20:07 +0000)]
[libc++] (Take 2) Add a test that uses the debug database from multiple threads
In r358591, I added a test that uses the debug database from multiple
threads and that helped us uncover the problem that was fixed in r355367.
However, the test broke the tsan CI bots, and I think the problem is the
test allocator that was used in the test (which is not thread safe).
I'm committing again without using the test allocator, and in a separate
test file.
llvm-svn: 358610
Kristof Umann [Wed, 17 Apr 2019 19:56:40 +0000 (19:56 +0000)]
[analyzer] PR41185: Fix regression where __builtin_* functions weren't recognized
For the following code snippet:
void builtin_function_call_crash_fixes(char *c) {
__builtin_strncpy(c, "", 6);
__builtin_memset(c, '\0', (0));
__builtin_memcpy(c, c, 0);
}
security.insecureAPI.DeprecatedOrUnsafeBufferHandling caused a regression, as it
didn't recognize functions starting with __builtin_. Fixed exactly that.
I wanted to modify an existing test file, but the two I found didn't seem like
perfect candidates. While I was there, I prettified their RUN: lines.
Differential Revision: https://reviews.llvm.org/D59812
llvm-svn: 358609
Louis Dionne [Wed, 17 Apr 2019 19:47:27 +0000 (19:47 +0000)]
[libc++][CMake] Allow building neither the shared nor the static library
It's possible to build just the headers, and we actually do it.
llvm-svn: 358608
Kit Barton [Wed, 17 Apr 2019 18:53:27 +0000 (18:53 +0000)]
Add basic loop fusion pass.
This patch adds a basic loop fusion pass. It will fuse loops that conform to the
following 4 conditions:
1. Adjacent (no code between them)
2. Control flow equivalent (if one loop executes, the other loop executes)
3. Identical bounds (both loops iterate the same number of iterations)
4. No negative distance dependencies between the loop bodies.
The pass does not make any changes to the IR to create opportunities for fusion.
Instead, it checks if the necessary conditions are met and if so it fuses two
loops together.
The pass has not been added to the pass pipeline yet, and thus is not enabled by
default. It can be run stand alone using the -loop-fusion option.
Differential Revision: https://reviews.llvm.org/D55851
llvm-svn: 358607
Sam McCall [Wed, 17 Apr 2019 18:33:07 +0000 (18:33 +0000)]
[clangd] Recognize "don't include me directly" pattern, and suppress include insertion.
Summary:
Typically used with umbrella headers, e.g. GTK:
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
Heuristic is fairly conservative, a quick code search over github showed
a fair number of hits and few/no false positives. (Not all were umbrella
headers, but I'd be happy avoiding include insertion for all of them).
We may want to relax the heuristic later to catch more cases.
Reviewers: ioeric
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60815
llvm-svn: 358605
Frederic Riss [Wed, 17 Apr 2019 18:23:22 +0000 (18:23 +0000)]
[CMake] Remove Apple-specific version logic.
We were using the LLDB-Info.plist as the canonical holder of the
version number, but there is really no good reason to do this. If
anything the plist should be generated using the information provided
to CMake.
For now just remove the logic extracting the version from the plist
and rely on LLDB_VERSION_STRING.
llvm-svn: 358604
Nick Desaulniers [Wed, 17 Apr 2019 18:22:48 +0000 (18:22 +0000)]
[AsmPrinter] defer %c to base class for ARM, PPC, and Hexagon. NFC
Summary:
None of these derived classes do anything that the base class cannot.
If we remove these case statements, then the base class can handle them
just fine.
Reviewers: peter.smith, echristo
Reviewed By: echristo
Subscribers: nemanjai, javed.absar, eraman, kristof.beyls, hiraditya, kbarton, jsji, llvm-commits, srhines
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60803
llvm-svn: 358603
Louis Dionne [Wed, 17 Apr 2019 18:20:19 +0000 (18:20 +0000)]
[libc++] Use the no_destroy attribute to avoid destroying debug DB statics
Summary:
Otherwise, we can run into problems when the program has static variables
that need to use the debug database during their deinitialization, if
the debug DB has already been deinitialized.
Reviewers: EricWF
Subscribers: christof, jkorous, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D60830
llvm-svn: 358602
Steven Wu [Wed, 17 Apr 2019 17:38:09 +0000 (17:38 +0000)]
[ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols
Summary:
Reapply r357931 with fixes to ThinLTO testcases and llvm-lto tool.
ThinLTOCodeGenerator currently does not preserve llvm.used symbols and
it can internalize them. In order to pass the necessary information to the
legacy ThinLTOCodeGenerator, the input to the code generator is
rewritten to be based on lto::InputFile.
Now ThinLTO using the legacy LTO API will requires data layout in
Module.
"internalize" thinlto action in llvm-lto is updated to run both
"promote" and "internalize" with the same configuration as
ThinLTOCodeGenerator. The old "promote" + "internalize" option does not
produce the same output as ThinLTOCodeGenerator.
This fixes: PR41236
rdar://problem/
49293439
Reviewers: tejohnson, pcc, kromanova, dexonsmith
Reviewed By: tejohnson
Subscribers: ormris, bd1976llvm, mehdi_amini, inglorion, eraman, hiraditya, jkorous, dexonsmith, arphaman, dang, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60421
llvm-svn: 358601
Philip Reames [Wed, 17 Apr 2019 17:37:58 +0000 (17:37 +0000)]
[InstCombine] Factor out unreachable inst idiom creation [NFC]
In InstCombine, we use an idiom of "store i1 true, i1 undef" to indicate we've found a path which we've proven unreachable. We can't actually insert the unreachable instruction since that would require changing the CFG. We leave that to simplifycfg later.
This just factors out that idiom creation so we don't duplicate the same mostly undocument idiom creation in multiple places.
llvm-svn: 358600
Nikita Popov [Wed, 17 Apr 2019 16:57:42 +0000 (16:57 +0000)]
[LVI][CVP] Constrain values in with.overflow branches
If a branch is conditional on extractvalue(op.with.overflow(%x, C), 1)
then we can constrain the value of %x inside the branch based on
makeGuaranteedNoWrapRegion(). We do this by extending the edge-value
handling in LVI. This allows CVP to then fold comparisons against %x,
as illustrated in the tests.
Differential Revision: https://reviews.llvm.org/D60650
llvm-svn: 358597
Dmitry Preobrazhensky [Wed, 17 Apr 2019 16:56:34 +0000 (16:56 +0000)]
[AMDGPU][MC] Corrected handling of "-" before expressions
See bug 41156: https://bugs.llvm.org/show_bug.cgi?id=41156
Reviewers: artem.tamazov, arsenm
Differential Revision: https://reviews.llvm.org/D60622
llvm-svn: 358596
Alexey Bataev [Wed, 17 Apr 2019 16:53:08 +0000 (16:53 +0000)]
[OPENMP][NVPTX]Run combined constructs with if clause in SPMD mode.
All target-parallel-based constructs can be run in SPMD mode from now
on. Even if num_threads clauses or if clauses are used, such constructs
can be executed in SPMD mode.
llvm-svn: 358595
Sanjay Patel [Wed, 17 Apr 2019 16:51:09 +0000 (16:51 +0000)]
[ARM] tighten test checks; NFC
llvm-svn: 358594
Louis Dionne [Wed, 17 Apr 2019 16:43:03 +0000 (16:43 +0000)]
Revert "[libc++] Add a test that uses the debug database from multiple threads"
This reverts r358591, which seems to have uncovered an actual bug and
causes the tsan CI to fail. We need to fix the bug and re-commit the
test.
llvm-svn: 358593
Rhys Perry [Wed, 17 Apr 2019 16:31:52 +0000 (16:31 +0000)]
AMDGPU: Force skip over SMRD, VMEM and s_waitcnt instructions
Summary: This fixes a large Dawn of War 3 performance regression with RADV from Mesa 19.0 to master which was caused by creating less code in some branches.
Reviewers: arsen, nhaehnle
Reviewed By: nhaehnle
Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60824
llvm-svn: 358592
Louis Dionne [Wed, 17 Apr 2019 16:21:55 +0000 (16:21 +0000)]
[libc++] Add a test that uses the debug database from multiple threads
This test helped us concurrently discover the problem that was fixed
in r355367.
llvm-svn: 358591
Amy Huang [Wed, 17 Apr 2019 16:20:56 +0000 (16:20 +0000)]
Remove --show-includes flag in crash reduce script
llvm-svn: 358590
Alexander Kornienko [Wed, 17 Apr 2019 16:19:47 +0000 (16:19 +0000)]
[clang-tidy] Fix invalid location in readability-misleading-indentation diagnostic
Before this patch readability-misleading-indentation could issue diagnostics
with an invalid location, which would lead to an assertion failure in
ClangTidyContext::diag()
llvm-svn: 358589
Louis Dionne [Wed, 17 Apr 2019 16:11:41 +0000 (16:11 +0000)]
[libc++][NFC] Make size of allocation more self-documenting
llvm-svn: 358588
Sanjay Patel [Wed, 17 Apr 2019 16:02:07 +0000 (16:02 +0000)]
[ARM] make test checks more thorough; NFC
This will change with the proposal in D60214.
Unfortunately, the triple is not supported for auto-generation
via script, and the multiple RUN lines have diffs on this test,
but I can't tell exactly what is required by this test.
PR7162 was an assert/crash, so hopefully, this is good enough.
llvm-svn: 358587
Florian Hahn [Wed, 17 Apr 2019 15:57:43 +0000 (15:57 +0000)]
[LoopUnroll] Allow unrolling if the unrolled size does not exceed loop size.
Summary:
In the following cases, unrolling can be beneficial, even when
optimizing for code size:
1) very low trip counts
2) potential to constant fold most instructions after fully unrolling.
We can unroll in those cases, by setting the unrolling threshold to the
loop size. This might highlight some cost modeling issues and fixing
them will have a positive impact in general.
Reviewers: vsk, efriedma, dmgreen, paquette
Reviewed By: paquette
Differential Revision: https://reviews.llvm.org/D60265
llvm-svn: 358586
Simon Pilgrim [Wed, 17 Apr 2019 15:45:44 +0000 (15:45 +0000)]
[DAGCombine] Add SimplifyDemandedBits helper that handles demanded elts mask as well
The other SimplifyDemandedBits helpers become wrappers to this new demanded elts variant.
llvm-svn: 358585
Lang Hames [Wed, 17 Apr 2019 15:38:27 +0000 (15:38 +0000)]
[Support] Add LEB128 support to BinaryStreamReader/Writer.
Summary:
This patch adds support for ULEB128 and SLEB128 encoding and decoding to
BinaryStreamWriter and BinaryStreamReader respectively.
Support for ULEB128/SLEB128 will be used for eh-frame parsing in the JITLink
library currently under development (see https://reviews.llvm.org/D58704).
Reviewers: zturner, dblaikie
Subscribers: kristina, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60810
llvm-svn: 358584
Florian Hahn [Wed, 17 Apr 2019 15:05:29 +0000 (15:05 +0000)]
[ScheduleDAGRRList] Recompute topological ordering on demand.
Currently there is a single point in ScheduleDAGRRList, where we
actually query the topological order (besides init code). Currently we
are recomputing the order after adding a node (which does not have
predecessors) and then we add predecessors edge-by-edge.
We can avoid adding edges one-by-one after we added a new node. In that case, we can
just rebuild the order from scratch after adding the edges to the DAG
and avoid all the updates to the ordering.
Also, we can delay updating the DAG until we query the DAG, if we keep a
list of added edges. Depending on the number of updates, we can either
apply them when needed or recompute the order from scratch.
This brings down the geomean compile time for of CTMark with -O1 down 0.3% on X86,
with no regressions.
Reviewers: MatzeB, atrick, efriedma, niravd, paquette
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D60125
llvm-svn: 358583
Louis Dionne [Wed, 17 Apr 2019 14:58:59 +0000 (14:58 +0000)]
Explicitly say we don't define new/delete in libc++ during Apple stage1 bootstrap
This is not necessary in stage2 because we don't even build libc++.dylib
there.
llvm-svn: 358582
Dmitry Preobrazhensky [Wed, 17 Apr 2019 14:44:01 +0000 (14:44 +0000)]
[AMDGPU][MC] Corrected parsing of registers
See bug 41280: https://bugs.llvm.org/show_bug.cgi?id=41280
Reviewers: artem.tamazov, arsenm
Differential Revision: https://reviews.llvm.org/D60621
llvm-svn: 358581
Tim Renouf [Wed, 17 Apr 2019 14:04:31 +0000 (14:04 +0000)]
[AMDGPU] Flag new raw/struct atomic ops as source of divergence
Differential Revision: https://reviews.llvm.org/D60731
Change-Id: I821d93dec8b9cdd247b8172d92fb5e15340a9e7d
llvm-svn: 358579
Nico Weber [Wed, 17 Apr 2019 13:40:57 +0000 (13:40 +0000)]
gn build: Merge r358554
llvm-svn: 358578
Robert Widmann [Wed, 17 Apr 2019 13:29:14 +0000 (13:29 +0000)]
[LLVM-C] Add DIFile Field Accesssors
Summary:
Add accessors for the file, directory, source file name (curiously, an `Optional` value?), of a DIFile.
This is intended to replace the LLVMValueRef-based accessors used in D52239
Reviewers: whitequark, jberdine, deadalnix
Reviewed By: whitequark, jberdine
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60489
llvm-svn: 358577
Haojian Wu [Wed, 17 Apr 2019 12:53:59 +0000 (12:53 +0000)]
[clang-tidy] Add fix descriptions to clang-tidy checks.
Summary:
Motivation/Context: in the code review system integrating with clang-tidy,
clang-tidy doesn't provide a human-readable description of the fix. Usually
developers have to preview a code diff (before vs after apply the fix) to
understand what the fix does before applying a fix.
This patch proposes that each clang-tidy check provides a short and
actional fix description that can be shown in the UI, so that users can know
what the fix does without previewing diff.
This patch extends clang-tidy framework to support fix descriptions (will add implementations for
existing checks in the future). Fix descriptions and fixes are emitted via diagnostic::Note (rather than
attaching the main warning diagnostic).
Before this patch:
```
void MyCheck::check(...) {
...
diag(loc, "my check warning") << FixtItHint::CreateReplacement(...);
}
```
After:
```
void MyCheck::check(...) {
...
diag(loc, "my check warning"); // Emit a check warning
diag(loc, "fix description", DiagnosticIDs::Note) << FixtItHint::CreateReplacement(...); // Emit a diagnostic note and a fix
}
```
Reviewers: sammccall, alexfh
Reviewed By: alexfh
Subscribers: MyDeveloperDay, Eugene.Zelenko, aaron.ballman, JonasToth, xazax.hun, jdoerfert, cfe-commits
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D59932
llvm-svn: 358576
Sam McCall [Wed, 17 Apr 2019 12:35:16 +0000 (12:35 +0000)]
[clangd] Include textual diagnostic ID as Diagnostic.code.
Reviewers: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58291
llvm-svn: 358575
Simon Pilgrim [Wed, 17 Apr 2019 10:58:19 +0000 (10:58 +0000)]
[CostModel][X86] Add bool anyof/allof reduction costs
On pre-AVX512 targets we can use MOVMSK to extract reduced boolean results. This is properly optimized, annoyingly AVX512 isn't and produces code that is almost as bad as the (unchanged) costs suggest......
Differential Revision: https://reviews.llvm.org/D60403
llvm-svn: 358574
Andrey Churbanov [Wed, 17 Apr 2019 10:44:28 +0000 (10:44 +0000)]
Fixed memory leak reported in Bugzilla:
https://bugs.llvm.org/show_bug.cgi?id=41494
Freed th_cg_roots structure at exit from uber thread.
Differential Revision: https://reviews.llvm.org/D60729
llvm-svn: 358572
Sam McCall [Wed, 17 Apr 2019 10:36:02 +0000 (10:36 +0000)]
[clangd] Include insertion: require header guards, drop other heuristics, treat .def like .inc.
Summary:
We do have some reports of include insertion behaving badly in some
codebases. Requiring header guards both makes sense in principle, and is
likely to disable this "nice-to-have" feature in codebases where headers don't
follow the expected pattern.
With this we can drop some other heuristics, such as looking at file
extensions to detect known non-headers - implementation files have no guards.
One wrinkle here is #import - objc headers may not have guards because
they're intended to be used via #import. If the header is the main file
or is #included, we won't collect locations - merge should take care of
this if we see the file #imported somewhere. Seems likely to be OK.
Headers which have a canonicalization (stdlib, IWYU) are exempt from this check.
*.inc files continue to be handled by looking up to the including file.
This patch also adds *.def here - tablegen wants this pattern too.
In terms of code structure, the division between SymbolCollector and
CanonicalIncludes has shifted: SymbolCollector is responsible for more.
This is because SymbolCollector has all the SourceManager/HeaderSearch access
needed for checking for guards, and we interleave these checks with the *.def
checks in a loop (potentially).
We could hand all the info into CanonicalIncludes and put the logic there
if that's preferable.
Reviewers: ioeric
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60316
llvm-svn: 358571
Hans Wennborg [Wed, 17 Apr 2019 10:05:58 +0000 (10:05 +0000)]
clang-cl: Parse /openmp:experimental
It was added to the MS docs recently here:
https://github.com/MicrosoftDocs/cpp-docs/commit/
3951085ab722fbb488ca40864f4a0553f7b71855
llvm-svn: 358570
Fangrui Song [Wed, 17 Apr 2019 09:11:08 +0000 (09:11 +0000)]
[DWARF] llvm::Error -> Error. NFC
The unqualified name is more common and is used in the file as well.
llvm-svn: 358567
Sven van Haastregt [Wed, 17 Apr 2019 09:08:50 +0000 (09:08 +0000)]
[libclang] Expose ext_vector_type
Differential Revision: https://reviews.llvm.org/D60775
llvm-svn: 358566
Fangrui Song [Wed, 17 Apr 2019 08:00:46 +0000 (08:00 +0000)]
[ELF] Use llvm::bsearch. NFC
Differential Revision: https://reviews.llvm.org/D60813
llvm-svn: 358565
Fangrui Song [Wed, 17 Apr 2019 07:58:05 +0000 (07:58 +0000)]
Change some llvm::{lower,upper}_bound to llvm::bsearch. NFC
llvm-svn: 358564
Jordan Rupprecht [Wed, 17 Apr 2019 07:42:31 +0000 (07:42 +0000)]
[llvm-objcopy] Support full list of bfd targets that lld uses.
Summary:
This change takes the full list of bfd targets that lld supports (see `ScriptParser.cpp`), including generic handling for `*-freebsd` targets (which uses the same settings but with a FreeBSD OSABI). In particular this adds mips support for `--output-target` (but not yet via `--binary-architecture`).
lld and llvm-objcopy use their own different custom data structures, so I'd prefer to check this in as-is (add support directly in llvm-objcopy, including all the test coverage) and do a separate NFC patch(s) that consolidate the two by putting this mapping into libobject.
See [[ https://bugs.llvm.org/show_bug.cgi?id=41462 | PR41462 ]].
Reviewers: jhenderson, jakehehrlich, espindola, alexshap, arichardson
Reviewed By: arichardson
Subscribers: fedor.sergeev, emaste, sdardis, krytarowski, atanasyan, llvm-commits, MaskRay, arichardson
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60773
llvm-svn: 358562
Sam McCall [Wed, 17 Apr 2019 07:00:36 +0000 (07:00 +0000)]
[clangd] lower_bound -> bsearch, NFC
llvm-svn: 358561
Roman Lebedev [Wed, 17 Apr 2019 06:35:07 +0000 (06:35 +0000)]
[CVP] processOverflowIntrinsic(): don't crash if constant-holding happened
As reported by Mikael Holmén in post-commit review in
https://reviews.llvm.org/D60791#1469765
llvm-svn: 358559
Fangrui Song [Wed, 17 Apr 2019 06:33:52 +0000 (06:33 +0000)]
[DWARF] Pass ReferenceToDIEOffsets elements by reference
llvm-svn: 358558
Dmitri Gribenko [Wed, 17 Apr 2019 06:11:27 +0000 (06:11 +0000)]
Fixed error message printing in write_cmake_config.py
Summary:
Previously, write_cmake_config.py would raise an error while printing
the error, because `leftovers` in "'\n'.join(leftovers)" is a tuple.
Subscribers: mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60766
llvm-svn: 358557
Craig Topper [Wed, 17 Apr 2019 06:09:16 +0000 (06:09 +0000)]
[X86] Autogenerate complete checks. NFC
llvm-svn: 358556
Craig Topper [Wed, 17 Apr 2019 06:09:11 +0000 (06:09 +0000)]
[X86] In CopyToFromAsymmetricReg, use VR128 instead of FR32 instructions for GR32<->XMM register copies.
We have two versions of some instructions, VR128 versions and FR32 versions that
are marked as CodeGenOnly.
This change switches to using the VR128 versions for these copies. It's after
register allocation so the class size no longer matters. This matches how GR64
works.
llvm-svn: 358555
Andrea Di Biagio [Wed, 17 Apr 2019 06:02:05 +0000 (06:02 +0000)]
[MCA] Moved the bottleneck analysis to its own file. NFCI
llvm-svn: 358554
Eric Christopher [Wed, 17 Apr 2019 04:55:24 +0000 (04:55 +0000)]
Revert "Add basic loop fusion pass." Per request.
This reverts commit r358543/
ab70da07286e618016e78247e4a24fcb84077fda.
llvm-svn: 358553
Eric Christopher [Wed, 17 Apr 2019 04:52:47 +0000 (04:52 +0000)]
Revert "Temporarily Revert "Add basic loop fusion pass.""
The reversion apparently deleted the test/Transforms directory.
Will be re-reverting again.
llvm-svn: 358552
Eric Fiselier [Wed, 17 Apr 2019 04:31:46 +0000 (04:31 +0000)]
Fix visibility for coroutine types on Windows
llvm-svn: 358551
Aaron Smith [Wed, 17 Apr 2019 03:13:06 +0000 (03:13 +0000)]
Clear the output string passed to GetHostName()
LLVM's wchar to UTF8 conversion routine expects an empty string to store the output.
GetHostName() on Windows is sometimes called with a non-empty string which triggers
an assert. The simple fix is to clear the output string before the conversion.
llvm-svn: 358550
Peter Collingbourne [Wed, 17 Apr 2019 03:02:18 +0000 (03:02 +0000)]
clangd: Change Windows.h to windows.h.
This makes the file more cross compilation friendly.
llvm-svn: 358549
Eric Christopher [Wed, 17 Apr 2019 02:26:27 +0000 (02:26 +0000)]
Remove the run-slp-after-loop-vectorization option.
It's been on by default for 4 years and cleans up the pass
hierarchy.
llvm-svn: 358548
Rui Ueyama [Wed, 17 Apr 2019 02:12:47 +0000 (02:12 +0000)]
Fix a crash bug caused by a nested call of parallelForEach.
parallelForEach is not reentrant. We use parallelForEach to call
each section's writeTo(), so calling the same function within writeTo()
is not safe.
Fixes https://bugs.llvm.org/show_bug.cgi?id=41508
Differential Revision: https://reviews.llvm.org/D60757
llvm-svn: 358547
Eric Christopher [Wed, 17 Apr 2019 02:12:23 +0000 (02:12 +0000)]
Temporarily Revert "Add basic loop fusion pass."
As it's causing some bot failures (and per request from kbarton).
This reverts commit r358543/
ab70da07286e618016e78247e4a24fcb84077fda.
llvm-svn: 358546
Rui Ueyama [Wed, 17 Apr 2019 01:47:16 +0000 (01:47 +0000)]
lld: Fix initial Mach-O load commands size calculation omitting LC_FUNCTION_STARTS
Patch by Nicholas Allegra.
The Mach-O writer calculates the size of load commands multiple times.
First, Util::assignAddressesToSections() (in MachONormalizedFileFromAtoms.cpp)
calculates the size using headerAndLoadCommandsSize() (in
MachONormalizedFileBinaryWriter.cpp), which creates a temporary
MachOFileLayout for the NormalizedFile, only to retrieve its
headerAndLoadCommandsSize. Later, writeBinary() (in
MachONormalizedFileBinaryWriter.cpp) creates a new layout and uses the offsets
from that layout to actually write out everything in the NormalizedFile.
But the NormalizedFile changes between the first computation and the second.
When Util::assignAddressesToSections is called, file.functionStarts is always
empty because Util::addFunctionStarts has not yet been called. Yet
MachOFileLayout decides whether to include a LC_FUNCTION_STARTS command based
on whether file.functionStarts is nonempty. Therefore, the initial computation
always omits it.
Because padding for the __TEXT segment (to make its size a multiple of the
page size) is added between the load commands and the first section, LLD still
generates a valid binary as long as the amount of padding happens to be large
enough to fit LC_FUNCTION_STARTS command, which it usually is.
However, it's easy to reproduce the issue by adding a section of a precise
size. Given foo.c:
__attribute__((section("__TEXT,__foo")))
char foo[0xd78] = {0};
Run:
clang -dynamiclib -o foo.dylib foo.c -fuse-ld=lld -install_name
/usr/lib/foo.dylib
otool -lvv foo.dylib
This should produce:
truncated or malformed object (offset field of section 1 in LC_SEGMENT_64
command 0 not past the headers of the file)
This commit:
- Changes MachOFileLayout to always assume LC_FUNCTION_STARTS is present for
the initial computation, as long as generating LC_FUNCTION_STARTS is
enabled. It would be slightly better to check whether there are actually
any functions, since no LC_FUNCTION_STARTS will be generated if not, but it
doesn't cause a problem if the initial computation is too high.
- Adds a test.
- Adds an assert in MachOFileLayout::writeSectionContent() that we are not
writing section content into the load commands region (which would happen
if the offset was calculated too low due to the initial load commands size
calculation being too low). Adds an assert in
MachOFileLayout::writeLoadCommands to validate a similar situation where
two size-of-load-commands computations are expected to be equivalent.
llvm-svn: 358545
Fangrui Song [Wed, 17 Apr 2019 01:46:27 +0000 (01:46 +0000)]
[Driver] Simplify -g level computation and its interaction with -gsplit-dwarf
Summary:
When -gsplit-dwarf is used together with other -g options, in most cases
the computed debug info level is decided by the last -g option, with one
special case (see below). This patch drops that special case and thus
makes it easy to reason about:
// If a lower debug level -g comes after -gsplit-dwarf, in some cases
// -gsplit-dwarf is cancelled.
-gsplit-dwarf -g0 => 0
-gsplit-dwarf -gline-directives-only => DebugDirectivesOnly
-gsplit-dwarf -gmlt -fsplit-dwarf-inlining => 1
-gsplit-dwarf -gmlt -fno-split-dwarf-inlining => 1 + split
// If -gsplit-dwarf comes after -g options, with this patch, the net
// effect is 2 + split for all combinations
-g0 -gsplit-dwarf => 2 + split
-gline-directives-only -gsplit-dwarf => 2 + split
-gmlt -gsplit-dwarf -fsplit-dwarf-inlining => 2 + split
-gmlt -gsplit-dwarf -fno-split-dwarf-inlining => 1 + split (before) 2 + split (after)
The last case has been changed. In general, if the user intends to lower
debug info level, place that -g option after -gsplit-dwarf.
Some context:
In gcc, the last of -gsplit-dwarf -g0 -g1 -g2 -g3 -ggdb[0-3] -gdwarf-*
... decides the debug info level (-gsplit-dwarf -gdwarf-* have level 2).
It is a bit unfortunate that -gsplit-dwarf -gdwarf-* ... participate in
the level computation but that is the status quo.
Reviewers: dblaikie, echristo, probinson
Reviewed By: dblaikie, probinson
Subscribers: probinson, aprantl, jdoerfert, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D59923
llvm-svn: 358544
Kit Barton [Wed, 17 Apr 2019 01:37:00 +0000 (01:37 +0000)]
Add basic loop fusion pass.
This patch adds a basic loop fusion pass. It will fuse loops that conform to the
following 4 conditions:
1. Adjacent (no code between them)
2. Control flow equivalent (if one loop executes, the other loop executes)
3. Identical bounds (both loops iterate the same number of iterations)
4. No negative distance dependencies between the loop bodies.
The pass does not make any changes to the IR to create opportunities for fusion.
Instead, it checks if the necessary conditions are met and if so it fuses two
loops together.
The pass has not been added to the pass pipeline yet, and thus is not enabled by
default. It can be run stand alone using the -loop-fusion option.
Phabricator: https://reviews.llvm.org/D55851
llvm-svn: 358543
Yi Kong [Wed, 17 Apr 2019 01:30:33 +0000 (01:30 +0000)]
[builtins] Add __cmpsf2 for ARM version of comparesf2
The generic version of comparesf2 defines __cmpsf2 alias for libgcc
compatibility, but the ARM overlay is missing the alias.
Differential Revision: https://reviews.llvm.org/D60805
llvm-svn: 358542
Marshall Clow [Wed, 17 Apr 2019 00:11:00 +0000 (00:11 +0000)]
Add tests for stability to list::sort and forward_list::sort. Thanks to Jonathan Wakely for the notice
llvm-svn: 358541
Sam McCall [Tue, 16 Apr 2019 23:53:28 +0000 (23:53 +0000)]
[ADT] llvm::bsearch, binary search for mere mortals
Summary:
Add to STLExtras a binary search function with a simple mental model:
You provide a range and a predicate which is true above a certain point.
bsearch() tells you that point.
Overloads are provided for integers, iterators, and containers.
This is more suitable than std:: alternatives in many cases:
- std::binary_search only indicates presence/absence
- upper_bound/lower_bound give you the opportunity to pick the wrong one
- all of the options have confusing names and definitions when your predicate
doesn't have simple "less than" semantics
- all of the options require iterators
- we plumb around a useless `value` parameter that should be a lambda capture
The API is inspired by Go's standard library, but we add an extra parameter as
well as some overloads and templates to show how clever C++ is.
Reviewers: ilya-biryukov, gribozavr
Subscribers: dexonsmith, kristina, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60779
llvm-svn: 358540
Sanjay Patel [Tue, 16 Apr 2019 23:10:41 +0000 (23:10 +0000)]
[x86] adjust LEA tests for better coverage; NFC
The scale can 1, 2, or 3.
llvm-svn: 358539
Leonard Chan [Tue, 16 Apr 2019 22:59:39 +0000 (22:59 +0000)]
[NFC] Remove unused function (Sema::pushExternalDeclIntoScope)
llvm-svn: 358538
Douglas Yung [Tue, 16 Apr 2019 22:52:05 +0000 (22:52 +0000)]
Modify test to use -S instead of -c so that it works when an external assembler is used that is not present.
llvm-svn: 358537
Peter Collingbourne [Tue, 16 Apr 2019 22:45:14 +0000 (22:45 +0000)]
ELF: Move build id computation to Writer. NFCI.
With partitions, each partition should have the same build id. This means
that the build id needs to be only computed once, otherwise we will end up
with different build ids in each partition as a result of the file contents
changing. This change moves the computation of the build id into Writer so
that it only happens once.
Differential Revision: https://reviews.llvm.org/D60342
llvm-svn: 358536
Mitch Phillips [Tue, 16 Apr 2019 22:16:01 +0000 (22:16 +0000)]
[HWASan] Fixed slow DWARF unwinding.
Summary: CFA was setup incorrectly, as there is an 8-byte gap at the top of the stack for SP 16-byte alignment purposes.
Reviewers: eugenis
Reviewed By: eugenis
Subscribers: kubamracek, javed.absar, #sanitizers, llvm-commits, pcc
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D60798
llvm-svn: 358535
Marshall Clow [Tue, 16 Apr 2019 22:11:26 +0000 (22:11 +0000)]
Fix list/forward_list implementations of remove_if and unique to deal with predicates that are part of the sequence passed in. We already do this for remove.
llvm-svn: 358534
Davide Italiano [Tue, 16 Apr 2019 21:56:07 +0000 (21:56 +0000)]
[tools] Only build lldb-test when needed.
llvm-svn: 358533
Robert Widmann [Tue, 16 Apr 2019 21:39:48 +0000 (21:39 +0000)]
[LLVM-C] Add Accessors For Global Variable Metadata Properties
Summary: Metadata for a global variable is really a (GlobalVariable, Expression) tuple. Allow access to these, then allow retrieving the file, scope, and line for a DIVariable, whether global or local. This should be the last of the accessors required for uniform access to location and file information metadata.
Reviewers: jberdine, whitequark, deadalnix
Reviewed By: jberdine, whitequark
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60725
llvm-svn: 358532
Ali Tamur [Tue, 16 Apr 2019 21:37:43 +0000 (21:37 +0000)]
Fix a typo in comments. [NFC]
llvm-svn: 358531
Alex Langford [Tue, 16 Apr 2019 21:21:28 +0000 (21:21 +0000)]
[Process] Fix linux arm64 single step compilation failure
This was updated in r356703 to use llvm::sys::RetryAfterSignal, which
comes from llvm/Support/Errno.h. The header wasn't added, so it fails if
you compile for arm64/aarch64.
llvm-svn: 358530
Louis Dionne [Tue, 16 Apr 2019 21:16:58 +0000 (21:16 +0000)]
[NFC] Build libc++ verbosely in the macOS CI
llvm-svn: 358529
Davide Italiano [Tue, 16 Apr 2019 21:15:28 +0000 (21:15 +0000)]
[tools] Make vscode and lldb-instr optional.
Summary:
Saves some build times, and they're not part of the usual
developer workflow.
Reviewers: JDevlieghere, friss
Subscribers: mgorny, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D60780
llvm-svn: 358528
Nick Desaulniers [Tue, 16 Apr 2019 21:04:34 +0000 (21:04 +0000)]
[NVPTXAsmPrinter] clean up dead code. NFC
Summary:
The printOperand function takes a default parameter, for which there are
zero call sites that explicitly pass such a parameter. As such, there
is no case to support. This means that the method
printVecModifiedImmediate is purly dead code, and can be removed.
The eventual goal for some of these AsmPrinter refactoring is to have
printOperand be a virtual method; making it easier to print operands
from the base class for more generic Asm printing. It will help if all
printOperand methods have the same function signature (ie. no Modifier
argument when not needed).
Reviewers: echristo, tra
Reviewed By: echristo
Subscribers: jholewinski, hiraditya, llvm-commits, craig.topper, srhines
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60727
llvm-svn: 358527
Simon Pilgrim [Tue, 16 Apr 2019 20:57:28 +0000 (20:57 +0000)]
[TargetLowering] Rename preferShiftsToClearExtremeBits and shouldFoldShiftPairToMask (PR41359)
As discussed on PR41359, this patch renames the pair of shift-mask target feature functions to make their purposes more obvious.
shouldFoldShiftPairToMask -> shouldFoldConstantShiftPairToMask
preferShiftsToClearExtremeBits -> shouldFoldMaskToVariableShiftPair
llvm-svn: 358526
Frederic Riss [Tue, 16 Apr 2019 20:54:42 +0000 (20:54 +0000)]
[debugserver] Relax the codesigning identity check
In an effort to help new LLDB developers, we added checks and messaging around
the selection of your codesigning identity on macOS. While helpful, it is not
actually correct. It's perfectly valid to codesign with an identity that is
not named lldb_codesign. Currently this fails the build.
This patch keeps a warning that informs developers how to setup lldb_codesign
and how to pass it to cmake, but it allows the build to proceed with a
different identity.
llvm-svn: 358525
Louis Dionne [Tue, 16 Apr 2019 20:46:03 +0000 (20:46 +0000)]
[libc++] Make sure we use new/delete from libc++abi on CI for Apple platforms
llvm-svn: 358524
Sanjay Patel [Tue, 16 Apr 2019 20:41:20 +0000 (20:41 +0000)]
[EarlyCSE] detect equivalence of selects with inverse conditions and commuted operands (PR41101)
This is 1 of the problems discussed in the post-commit thread for:
rL355741 / http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-
20190311/635516.html
and filed as:
https://bugs.llvm.org/show_bug.cgi?id=41101
Instcombine tries to canonicalize some of these cases (and there's room for improvement
there independently of this patch), but it can't always do that because of extra uses.
So we need to recognize these commuted operand patterns here in EarlyCSE. This is similar
to how we detect commuted compares and commuted min/max/abs.
Differential Revision: https://reviews.llvm.org/D60723
llvm-svn: 358523
Anton Afanasyev [Tue, 16 Apr 2019 20:36:56 +0000 (20:36 +0000)]
Time profiler: optimize json output time
Summary:
Use llvm::json::Array.reserve() to optimize json output time. Here is motivation:
https://reviews.llvm.org/D60609#1468941. In short: for the json array
with ~32K entries, pushing back each entry takes ~4% of whole time compared
to the method of preliminary memory reservation: (3995-3845)/3995 = 3.75%.
Reviewers: lebedev.ri
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60792
llvm-svn: 358522
Nikita Popov [Tue, 16 Apr 2019 20:31:41 +0000 (20:31 +0000)]
[CVP] Simplify umulo and smulo that cannot overflow
If a umul.with.overflow or smul.with.overflow operation cannot
overflow, simplify it to a simple mul nuw / mul nsw. After the
refactoring in D60668 this is just a matter of removing an
explicit check against multiplications.
Differential Revision: https://reviews.llvm.org/D60791
llvm-svn: 358521
Anton Afanasyev [Tue, 16 Apr 2019 19:43:18 +0000 (19:43 +0000)]
[Support][JSON] Add reserve() to json Array
Summary:
Space reservation increases json lib performance for the arrays with large number of entries.
Here is the example and discussion: https://reviews.llvm.org/D60609#1468941
Reviewers: lebedev.ri, sammccall
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60788
llvm-svn: 358520
Simon Pilgrim [Tue, 16 Apr 2019 19:27:00 +0000 (19:27 +0000)]
[SLP] Refactoring of the operand reordering code.
This is a refactoring patch which should have all the functionality of the current code. Its goal is twofold:
i. Cleanup and simplify the reordering code, and
ii. Generalize reordering so that it will work for an arbitrary number of operands, not just 2.
This is the second patch in a series of patches that will enable operand reordering across chains of operations. An example of this was presented in EuroLLVM'18 https://www.youtube.com/watch?v=gIEn34LvyNo .
Committed on behalf of @vporpo (Vasileios Porpodas)
Differential Revision: https://reviews.llvm.org/D59973
llvm-svn: 358519
Louis Dionne [Tue, 16 Apr 2019 19:26:56 +0000 (19:26 +0000)]
[libc++] Remove old workaround for buildit
Summary:
I'm not sure what the problem was at the time, however I don't think
this is necessary since buildit doesn't exist anymore.
Instead of the workaround, the correct thing to do is to leave out
the get_new_handler/set_new_handler definitions from libc++ when
we're getting them from libc++abi.
Reviewers: EricWF
Subscribers: christof, jkorous, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D60717
llvm-svn: 358518
Nikita Popov [Tue, 16 Apr 2019 19:25:35 +0000 (19:25 +0000)]
[CVP] Add tests for non-overflowing mulo; NFC
Should be simplified to simple mul.
llvm-svn: 358517
Simon Pilgrim [Tue, 16 Apr 2019 19:18:53 +0000 (19:18 +0000)]
[X86][AVX] X86ISD::PERMV/PERMV3 node types can never fold index ops
Improves codegen demonstrated by D60512 - instructions represented by X86ISD::PERMV/PERMV3 can never memory fold the operand used for their index register.
This patch updates the 'isUseOfShuffle' helper into the more capable 'isFoldableUseOfShuffle' that recognises that the op is used for a X86ISD::PERMV/PERMV3 index mask and can't be folded - allowing us to use broadcast/subvector-broadcast ops to reduce the size of the mask constant pool data.
Differential Revision: https://reviews.llvm.org/D60562
llvm-svn: 358516
Nikita Popov [Tue, 16 Apr 2019 19:05:49 +0000 (19:05 +0000)]
[InstCombine] Prune fshl/fshr with masked operands
If a constant shift amount is used, then only some of the LHS/RHS
operand bits are demanded and we may be able to simplify based on
that. InstCombineSimplifyDemanded already had the necessary support
for that, we just weren't calling it with fshl/fshr as root.
In particular, this allows us to relax some masked funnel shifts
into simple shifts, as shown in the tests.
Patch by Shawn Landden.
Differential Revision: https://reviews.llvm.org/D60660
llvm-svn: 358515
Nikita Popov [Tue, 16 Apr 2019 19:05:40 +0000 (19:05 +0000)]
[InstCombine] Add tests for fshl/fshr with masked operands; NFC
Baseline tests for D60660.
Patch by Shawn Landden.
Differential Revision: https://reviews.llvm.org/D60688
llvm-svn: 358514
Sanjay Patel [Tue, 16 Apr 2019 18:58:03 +0000 (18:58 +0000)]
[x86] add more tests for LEA formation; NFC
Promoting the shift to the wider type should allow LEA.
llvm-svn: 358513
Nikita Popov [Tue, 16 Apr 2019 18:55:16 +0000 (18:55 +0000)]
[IR] Add WithOverflowInst class
This adds a WithOverflowInst class with a few helper methods to get
the underlying binop, signedness and nowrap type and makes use of it
where sensible. There will be two more uses in D60650/D60656.
The refactorings are all NFC, though I left some TODOs where things
could be improved. In particular we have two places where add/sub are
handled but mul isn't.
Differential Revision: https://reviews.llvm.org/D60668
llvm-svn: 358512
Harlan Haskins [Tue, 16 Apr 2019 18:00:43 +0000 (18:00 +0000)]
[FileSystemStatCache] Update test for new FileSystemStatCache API
Summary: Update this test to return std::error_code instead of LookupResult.
Reviewers: arphaman
Subscribers: dexonsmith, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60786
llvm-svn: 358511
Matt Morehouse [Tue, 16 Apr 2019 17:38:19 +0000 (17:38 +0000)]
[libFuzzer] Remove tautological compare.
llvm-svn: 358510
Harlan Haskins [Tue, 16 Apr 2019 17:34:26 +0000 (17:34 +0000)]
[FileSystemStatCache] Return std::error_code from stat cache methods
Summary:
Previously, we would return true/false signifying if the cache/lookup
succeeded or failed. Instead, provide clients with the underlying error
that was thrown while attempting to look up in the cache.
Since clang::FileManager doesn't make use of this information, it discards the
error that's received and casts away to bool.
This change is NFC.
Reviewers: benlangmuir, arphaman
Subscribers: dexonsmith, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D60735
llvm-svn: 358509
Pavel Labath [Tue, 16 Apr 2019 16:57:41 +0000 (16:57 +0000)]
Fix symtab-macho.test broken by r358500
Put the correct UUID string into the breakpad file.
llvm-svn: 358508