Nico Weber [Wed, 5 Sep 2018 18:01:04 +0000 (18:01 +0000)]
Handle zero-length debug directory entries.
Part of https://reviews.llvm.org/D51652 (tests will be in the lld repo)
llvm-svn: 341485
Erich Keane [Wed, 5 Sep 2018 17:14:21 +0000 (17:14 +0000)]
Test Commit for git-svn-cleanup comment.
Removes the class name for the Expr class, which isn't necessary.
llvm-svn: 341484
Alexey Bataev [Wed, 5 Sep 2018 17:10:30 +0000 (17:10 +0000)]
[OPENMP][NVPTX] Disable runtime-type info for CUDA devices.
RTTI is not supported by the NVPTX target.
llvm-svn: 341483
Tatyana Krasnukha [Wed, 5 Sep 2018 17:07:29 +0000 (17:07 +0000)]
Hold GIL while allocating memory for PythonString.
Summary:
Swig wraps C++ code into SWIG_PYTHON_THREAD_BEGIN_ALLOW; ... SWIG_PYTHON_THREAD_END_ALLOW;
Thus, LLDB crashes with "Fatal Python error: Python memory allocator called without holding the GIL" when calls an lldb_SB***___str__ function.
Reviewers: clayborg
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D51569
llvm-svn: 341482
Sanjay Patel [Wed, 5 Sep 2018 17:01:56 +0000 (17:01 +0000)]
[DAGCombiner] try to convert pow(x, 0.25) to sqrt(sqrt(x))
This was proposed as an IR transform in D49306, but it was not clearly justifiable as a canonicalization.
Here, we only do the transform when the target tells us that sqrt can be lowered with inline code.
This is the basic case. Some potential enhancements are in the TODO comments:
1. Generalize the transform for other exponents (allow more than 2 sqrt calcs if that's really cheaper).
2. If we have less fast-math-flags, generate code to avoid -0.0 and/or INF.
3. Allow the transform when optimizing/minimizing size (might require a target hook to get that right).
Note that by default, x86 converts single-precision sqrt calcs into sqrt reciprocal estimate with
refinement. That codegen is controlled by CPU attributes and can be manually overridden. We have plenty
of test coverage for that already, so I didn't bother to include extra testing for that here. AArch uses
its full-precision ops in all cases (not sure if that's the intended behavior or not, but that should
also be covered by existing tests).
Differential Revision: https://reviews.llvm.org/D51630
llvm-svn: 341481
Kostya Serebryany [Wed, 5 Sep 2018 16:09:53 +0000 (16:09 +0000)]
[hwasan] deflake a test
llvm-svn: 341480
Dean Michael Berris [Wed, 5 Sep 2018 16:03:21 +0000 (16:03 +0000)]
[XRay] Use a function to return a constant
We do this instead of using static constexpr char arrays because MSVC
2015 cannot handle the constant initialisation of those along with the
out-of-line storage declaration.
This is a follow-up to D51672.
llvm-svn: 341479
Krzysztof Parzyszek [Wed, 5 Sep 2018 15:54:44 +0000 (15:54 +0000)]
[Hexagon] Ignore unnamed globals in HexagonConstExtenders
This replaces r337723. The global list in the module can be huge with LTO,
plus the module can change between different invocations of the pass, so
there is no easy way to deterministically cache the ordering (especially
in the presence of multiple threads).
llvm-svn: 341478
Dean Michael Berris [Wed, 5 Sep 2018 15:19:43 +0000 (15:19 +0000)]
[XRay] Use `const` instead of `constexpr` in storage declaration
This should make MSVC happy with the storage provided for static
constexpr character arrays out-of-line.
Follow-up to D51672.
llvm-svn: 341477
Eric Liu [Wed, 5 Sep 2018 14:59:17 +0000 (14:59 +0000)]
[Sema] Store MacroInfo in CodeCompletionResult for macro results.
Summary:
This provides information about the macro definition. For example, it
can be used to compute macro USRs.
Reviewers: sammccall
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D51675
llvm-svn: 341476
Diogo N. Sampaio [Wed, 5 Sep 2018 14:56:21 +0000 (14:56 +0000)]
Fix arm_neon.h and arm_fp16.h generation for compiling with std=c89
Summary:
The inline attribute is not valid for C standard 89. Replace the argument in the generation of header files with __inline, as well adding tests for both header files.
Reviewers: pbarrio, SjoerdMeijer, javed.absar, t.p.northover
Subscribers: t.p.northover, kristof.beyls, chrib, cfe-commits
Differential Revision: https://reviews.llvm.org/D51683
test/Headers/arm-fp16-header.c
test/Headers/arm-neon-header.c
utils/TableGen/NeonEmitter.cpp
llvm-svn: 341475
Max Moroz [Wed, 5 Sep 2018 14:43:38 +0000 (14:43 +0000)]
Enable symbolize-deadlock.test on Windows
Summary:
Remove unneeded #include of <unistd.h> from SymbolizeDeadlock.cpp to
enable compilation on Windows and enable symbolize-deadlock.test on
Windows.
Patch by Jonathan Metzman (@metzman).
Reviewers: Dor1s
Reviewed By: Dor1s
Subscribers: kcc, delcypher, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D51685
llvm-svn: 341473
Pavel Labath [Wed, 5 Sep 2018 14:38:44 +0000 (14:38 +0000)]
Enable DWARF accelerator tables by default when tuning for lldb (-glldb => -gpubnames)
Summary:
DWARF v5 accelerator tables provide a considerable performance
improvement for lldb and will make the default -glldb behavior same on
all targets (right now we emit apple tables on apple targets, but these
are not controlled by -gpubnames, only by -glldb).
Reviewers: dblaikie
Subscribers: probinson, clayborg, JDevlieghere, aprantl, cfe-commits
Differential Revision: https://reviews.llvm.org/D51576
llvm-svn: 341472
Raphael Isemann [Wed, 5 Sep 2018 14:27:48 +0000 (14:27 +0000)]
[www] Updated outdated download links [NFC]
Also added ubuntu and Arch Linux links.
llvm-svn: 341471
Kirill Bobyrev [Wed, 5 Sep 2018 14:15:39 +0000 (14:15 +0000)]
[benchmark] Fix 32-bit build failure
This patch applies upstream commit:
https://github.com/google/benchmark/commit/
f0901417c89d123474e6b91365029cfe32cf89dc
Tim Northover pointed out that benchmark build might be broken on 32-bit
macOS. This commit by Roman Lebedev (lebedev.ri) resolves the issue.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D51677
llvm-svn: 341469
Benjamin Kramer [Wed, 5 Sep 2018 13:51:05 +0000 (13:51 +0000)]
[ControlHeightReduction] Remove unused includes
Also clang-format them.
llvm-svn: 341468
Sam McCall [Wed, 5 Sep 2018 13:22:11 +0000 (13:22 +0000)]
[clangd] Fix type/variable name conflict on some compilers
llvm-svn: 341467
Sam McCall [Wed, 5 Sep 2018 13:17:51 +0000 (13:17 +0000)]
[clangd] Fix references.test assertions
llvm-svn: 341466
Sam McCall [Wed, 5 Sep 2018 13:17:47 +0000 (13:17 +0000)]
[clangd] make zlib compression optional for binary format
llvm-svn: 341465
Jordan Rupprecht [Wed, 5 Sep 2018 13:10:03 +0000 (13:10 +0000)]
[llvm-strip] Support stripping multiple input files
Summary:
Allow strip to be called on multiple input files, which is interpreted as stripping N files in place. Using multiple input files is incompatible with -o.
To allow this, create a `DriverConfig` struct which just wraps a list of `CopyConfigs`. objcopy will only ever have a single `CopyConfig`, but strip will have N (where N >= 1) CopyConfigs.
Reviewers: alexshap, jakehehrlich
Reviewed By: alexshap, jakehehrlich
Subscribers: MaskRay, jakehehrlich, llvm-commits
Differential Revision: https://reviews.llvm.org/D51660
llvm-svn: 341464
Haojian Wu [Wed, 5 Sep 2018 12:00:15 +0000 (12:00 +0000)]
[clangd] Sort GoToDefinition results.
Summary:
GoToDefinition returns all declaration results (implicit/explicit) that are
in the same location, and the results are returned in arbitrary order.
Some LSP clients defaultly take the first result as the final result, which
might present a bad result (implicit decl) to users.
This patch ranks the result based on whether the declarations are
referenced explicitly/implicitly. We put explicit declarations first.
This also improves the "hover" (which just take the first result) feature
in some cases.
Reviewers: ilya-biryukov
Subscribers: kadircet, ioeric, MaskRay, jkorous, mgrang, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D50438
llvm-svn: 341463
Sam McCall [Wed, 5 Sep 2018 11:53:07 +0000 (11:53 +0000)]
[clangd] Add xrefs LSP boilerplate implementation.
Reviewers: ilya-biryukov, ioeric
Subscribers: MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D50896
llvm-svn: 341462
Benjamin Kramer [Wed, 5 Sep 2018 11:41:12 +0000 (11:41 +0000)]
[Aggressive InstCombine] Move C bindings to their own header file.
llvm-svn: 341461
Simon Pilgrim [Wed, 5 Sep 2018 10:44:03 +0000 (10:44 +0000)]
Fix -Wdocumentation warning. NFCI.
llvm-svn: 341460
Sam McCall [Wed, 5 Sep 2018 10:39:58 +0000 (10:39 +0000)]
[clangd] Avoid enum class+enumValN to avoid GCC bug(?), and use consistent style.
llvm-svn: 341459
Sam McCall [Wed, 5 Sep 2018 10:33:36 +0000 (10:33 +0000)]
[clangd] Implement findReferences function
clangd will use findReferences to provide LSP's reference feature.
llvm-svn: 341458
Jonas Devlieghere [Wed, 5 Sep 2018 10:18:36 +0000 (10:18 +0000)]
[DebugInfo] Normalize common kinds of DWARF sub-expressions.
Normalize common kinds of DWARF sub-expressions to make debug info
encoding a bit more compact:
DW_OP_constu [X < 32] -> DW_OP_litX
DW_OP_constu [all ones] -> DW_OP_lit0, DW_OP_not (64-bit only)
Differential revision: https://reviews.llvm.org/D51640
llvm-svn: 341457
Max Kazantsev [Wed, 5 Sep 2018 10:10:59 +0000 (10:10 +0000)]
[NFC] Add test on full IV widening
llvm-svn: 341456
Eric Liu [Wed, 5 Sep 2018 09:45:27 +0000 (09:45 +0000)]
[VFS] Cache the current working directory for the real FS.
Reviewers: sammccall
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D51641
llvm-svn: 341455
Sander de Smalen [Wed, 5 Sep 2018 08:59:50 +0000 (08:59 +0000)]
Remove FrameAccess struct from hasLoadFromStackSlot
This removes the FrameAccess struct that was added to the interface
in D51537, since the PseudoValue from the MachineMemoryOperand
can be safely casted to a FixedStackPseudoSourceValue.
Reviewers: MatzeB, thegameg, javed.absar
Reviewed By: thegameg
Differential Revision: https://reviews.llvm.org/D51617
llvm-svn: 341454
Fangrui Song [Wed, 5 Sep 2018 08:01:37 +0000 (08:01 +0000)]
[clangd] Fix typo. NFC
llvm-svn: 341452
Sam McCall [Wed, 5 Sep 2018 07:52:49 +0000 (07:52 +0000)]
[clangd] Fix buildbot failures on older compilers from r341375
llvm-svn: 341451
Sam McCall [Wed, 5 Sep 2018 07:44:02 +0000 (07:44 +0000)]
clang-format: Fix formatting C++ namespaces with preceding 'inline' or 'export' specifier
This fixes formatting namespaces with preceding 'inline' and 'export' (Modules TS) specifiers.
This change fixes namespaces not being identified as such with preceding 'inline' or 'export' specifiers.
Motivation: I was experimenting with the Modules TS (-fmodules-ts) and found it would be useful if clang-format would correctly format 'export namespace'. While making the changes, I noticed that similar issues still exist with 'inline namespace', and addressed them as well.
Patch by Marco Elver!
Reviewers: klimek, djasper, owenpan, sammccall
Reviewed By: owenpan, sammccall
Subscribers: owenpan, cfe-commits
Differential Revision: https://reviews.llvm.org/D51036
llvm-svn: 341450
Eric Liu [Wed, 5 Sep 2018 07:40:38 +0000 (07:40 +0000)]
[clangd] Tune macro quality scoring for code completion.
x0.2 seems to be too much penalty, macros might be wanted in some cases;
changing to 0.5x instead. The tuning didn't affect ranking for non-macro
completions.
llvm-svn: 341449
Jonas Hahnfeld [Wed, 5 Sep 2018 07:26:00 +0000 (07:26 +0000)]
[libomptaret][test] Announce compiler features
This is a follow-up to r341371: The new test for PR38704 doesn't
work with Clang 6.0. It uses an UNSUPPORTED: clang-6, but that
hasn't worked because the compiler features weren't known to lit.
llvm-svn: 341448
Dean Michael Berris [Wed, 5 Sep 2018 06:57:23 +0000 (06:57 +0000)]
[XRay] Add a RecordPrinter visitor for FDR Records
Summary:
This change adds a `RecordPrinter` type which does some basic text
serialization of the FDR record instances. This is one component of the
tool we're building to dump the records from an FDR mode log as-is.
This is a small part of D50441.
Reviewers: eizan, kpw
Subscribers: mgorny, hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D51672
llvm-svn: 341447
Hsiangkai Wang [Wed, 5 Sep 2018 05:58:53 +0000 (05:58 +0000)]
[DebugInfo] Fix bug in LiveDebugVariables.
In lib/CodeGen/LiveDebugVariables.cpp, it uses std::prev(MBBI) to
get DebugValue's SlotIndex. However, the previous instruction may be
also a debug instruction. It could not use a debug instruction to query
SlotIndex in mi2iMap.
Scan all debug instructions and use the first debug instruction to query
SlotIndex for following debug instructions. Only handle DBG_VALUE in
handleDebugValue().
Differential Revision: https://reviews.llvm.org/D50621
llvm-svn: 341446
David Carlier [Wed, 5 Sep 2018 05:18:34 +0000 (05:18 +0000)]
[Xray] Darwin providing defined value for weak symbols to fix linkage issue
- Temporary hack to make the buildbot failure stop on Darwin.
llvm-svn: 341445
Richard Trieu [Wed, 5 Sep 2018 04:19:15 +0000 (04:19 +0000)]
Prevent unsigned overflow.
The sum of the weights is caculated in an APInt, which has a width smaller than
64. In certain cases, the sum of the widths would overflow when calculations
are done inside an APInt, but would not if done with uint64_t. Since the
values will be passed as uint64_t in the function call anyways, do all the math
in 64 bits. Also added an assert in case the probabilities overflow 64 bits.
llvm-svn: 341444
Fangrui Song [Wed, 5 Sep 2018 03:10:20 +0000 (03:10 +0000)]
Fix -Wunused-function in release build after rL341386
llvm-svn: 341443
Brian Cain [Wed, 5 Sep 2018 02:15:54 +0000 (02:15 +0000)]
Add glibc_prereq to platform limits mmsghdr
sendmmsg requires glibc >= 2.14.
Fixes PR38589.
Review: https://reviews.llvm.org/D51538
llvm-svn: 341442
Kostya Serebryany [Wed, 5 Sep 2018 01:29:08 +0000 (01:29 +0000)]
[hwasan] revert r341435 as it breaks the bot on aarch64
llvm-svn: 341441
Kostya Serebryany [Wed, 5 Sep 2018 01:27:48 +0000 (01:27 +0000)]
[hwasan] fix colored output
llvm-svn: 341440
Heejin Ahn [Wed, 5 Sep 2018 01:27:38 +0000 (01:27 +0000)]
[WebAssembly] clang-format (NFC)
Summary: This patch runs clang-format on all wasm-only files.
Reviewers: aardappel, dschuff, sunfish, tlively
Subscribers: MatzeB, sbc100, jgravelle-google, llvm-commits
Differential Revision: https://reviews.llvm.org/D51447
llvm-svn: 341439
Kostya Serebryany [Wed, 5 Sep 2018 01:16:50 +0000 (01:16 +0000)]
[hwasan] print thread IDs when reporting a bug (also had to fix pthread_create on Linux)
llvm-svn: 341438
Richard Smith [Wed, 5 Sep 2018 00:28:57 +0000 (00:28 +0000)]
Allow all supportable non-type attributes to be used with #pragma clang attribute.
Summary:
We previously disallowed use of undocumented attributes with #pragma clang
attribute, but the justification for doing so was weak and it prevented many
reasonable use cases.
Reviewers: aaron.ballman, arphaman
Subscribers: cfe-commits, rnk, benlangmuir, dexonsmith, erik.pilkington
Differential Revision: https://reviews.llvm.org/D51507
llvm-svn: 341437
Reid Kleckner [Wed, 5 Sep 2018 00:18:05 +0000 (00:18 +0000)]
Fix -Wunused-private-variable on non-Windows
I didn't want to use ifdefs in headers, but I'll do it to pacify a
warning.
llvm-svn: 341436
Kostya Serebryany [Wed, 5 Sep 2018 00:17:23 +0000 (00:17 +0000)]
[hwasan] use real TLS on linux to store the current thread -- this way we can call t->Destroy in __hwasan_thread_exit, same as on Android
llvm-svn: 341435
Reid Kleckner [Wed, 5 Sep 2018 00:08:56 +0000 (00:08 +0000)]
[Windows] Convert from UTF-8 to UTF-16 when writing to a Windows console
Summary:
Calling WriteConsoleW is the most reliable way to print Unicode
characters to a Windows console.
If binary data gets printed to the console, attempting to re-encode it
shouldn't be a problem, since garbage in can produce garbage out.
This breaks printing strings in the local codepage, which WriteConsoleA
knows how to handle. For example, this can happen when user source code
is encoded with the local codepage, and an LLVM tool quotes it while
emitting a caret diagnostic. This is unfortunate, but well-behaved tools
should validate that their input is UTF-8 and escape non-UTF-8
characters before sending them to raw_fd_ostream. Clang already does
this, but not all LLVM tools do this.
One drawback to the current implementation is printing a string a byte
at a time doesn't work. Consider this LLVM code:
for (char C : MyStr) outs() << C;
Because outs() is now unbuffered, we wil try to convert each byte to
UTF-16, which will fail. However, this already didn't work, so I think
we may as well update callers that do that as we find them to print
complete portions of strings. You can see a real example of this in my
patch to SourceMgr.cpp
Fixes PR38669 and PR36267.
Reviewers: zturner, efriedma
Subscribers: llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D51558
llvm-svn: 341433
Kostya Serebryany [Wed, 5 Sep 2018 00:01:45 +0000 (00:01 +0000)]
[hwasan] simplify the code, NFC
llvm-svn: 341432
Kostya Serebryany [Tue, 4 Sep 2018 23:57:09 +0000 (23:57 +0000)]
[hwasan] remove stale Thread:: data members. While doing so noticed that GetThreadStackAndTls was always called with 'at_initialization=true', fixed that.
llvm-svn: 341431
Kostya Serebryany [Tue, 4 Sep 2018 23:26:08 +0000 (23:26 +0000)]
[hwasan] add a unique id to a thread and add debug prints for thread creation/destruction
llvm-svn: 341428
Sanjay Patel [Tue, 4 Sep 2018 23:22:13 +0000 (23:22 +0000)]
[InstCombine] fix xor-or-xor fold to check uses and handle commutes
I'm probably missing some way to use m_Deferred to remove the code
duplication, but that can be a follow-up.
The improvement in demand_shrink_nsw.ll is an example of missing
the fold because the pattern matching was deficient. I didn't try
to follow the bits in that test, but Alive says it's correct:
https://rise4fun.com/Alive/ugc
llvm-svn: 341426
Frederic Riss [Tue, 4 Sep 2018 23:09:49 +0000 (23:09 +0000)]
Change TestCompletion to only ever look inside of BaseDir
TestCompletion was failing quite frequently on our Linux bots. Some tracing
revealed that when we are iterating BaseDir we are not getting all the entries.
More specifically, we are sometimes missing the entry corresponding to the
TestCompletion directory that the first test in DirCompletionAbsolute is
looking for. BaseDir is the directory where lit is creating all the temporary
files. The semantics of opendir/readdir are unclear when it comes to iterating
over a directory that changes contents, but it seems like on Linux you might
fail to list an entry even if it was there before opendir and is still present
throughout the iteration. Changing the test to only look inside of the test-
specific directory seems to fix the instability.
This commit also removes some assertions that were added to try to track down
this issue.
llvm-svn: 341425
Sanjay Patel [Tue, 4 Sep 2018 23:08:23 +0000 (23:08 +0000)]
[InstCombine] update tests checks; NFC
llvm-svn: 341424
Wouter van Oortmerssen [Tue, 4 Sep 2018 22:59:05 +0000 (22:59 +0000)]
[WebAssembly] Fixed stale assert message in WebAssemblyMCInstLower
llvm-svn: 341423
Steven Wu [Tue, 4 Sep 2018 22:54:17 +0000 (22:54 +0000)]
[ThinLTO] Fix memory corruption in ThinLTOCodeGenerator when CodeGenOnly was specified
Summary:
Issue occurs when doing ThinLTO with CodeGenOnly flag.
TMBuilder.TheTriple is assigned to by multiple threads in an unsafe way resulting in double-free of std::string memory.
Pseudocode:
if (CodeGenOnly) {
// Perform only parallel codegen and return.
ThreadPool Pool;
int count = 0;
for (auto &ModuleBuffer : Modules) {
Pool.async([&](int count) {
...
/// Now call OutputBuffer = codegen(*TheModule);
/// Which turns into initTMBuilder(moduleTMBuilder, Triple(TheModule.getTargetTriple()));
/// Which turns into
TMBuilder.TheTriple = std::move(TheTriple); // std::string = "....."
/// So, basically std::string assignment to same string on multiple threads = memory corruption
}
return;
}
Patch by Alex Borcan
Reviewers: llvm-commits, steven_wu
Reviewed By: steven_wu
Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D51651
llvm-svn: 341422
Richard Trieu [Tue, 4 Sep 2018 22:53:19 +0000 (22:53 +0000)]
[ODRHash] Extend hash to support all Type's.
llvm-svn: 341421
Kostya Serebryany [Tue, 4 Sep 2018 22:43:30 +0000 (22:43 +0000)]
[sanitizer] optimize internal_memset for the most performance critical case (16-byte-aligned)
llvm-svn: 341420
Jordan Rupprecht [Tue, 4 Sep 2018 22:28:49 +0000 (22:28 +0000)]
[llvm-strip] Allow copying relocation sections without symbol tables.
Summary:
Fixes the error "Link field value 0 in section .rela.plt is invalid" when copying/stripping certain binaries. Minimal repro:
```
$ cat /tmp/a.c
int main() { return 0; }
$ clang -static /tmp/a.c -o /tmp/a
$ llvm-strip /tmp/a -o /tmp/b
llvm-strip: error: Link field value 0 in section .rela.plt is invalid.
```
Reviewers: jakehehrlich, alexshap
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51493
llvm-svn: 341419
Tim Shen [Tue, 4 Sep 2018 22:20:11 +0000 (22:20 +0000)]
Revert r341373, since it fails on some targets.
Differential Revision: https://reviews.llvm.org/D51354
llvm-svn: 341418
Zhaoshi Zheng [Tue, 4 Sep 2018 22:17:03 +0000 (22:17 +0000)]
Revert "Revert r341269: [Constant Hoisting] Hoisting Constant GEP Expressions"
Reland r341269. Use std::stable_sort when sorting constant condidates.
Reverting commit, r341365:
Revert r341269: [Constant Hoisting] Hoisting Constant GEP Expressions
One of the tests is failing 50% of the time when expensive checks are
enabled. Not sure how deep the problem is so just reverting while the
author can investigate so that the bots stop repeatedly failing and
blaming things incorrectly. Will respond with details on the original
commit.
Original commit, r341269:
[Constant Hoisting] Hoisting Constant GEP Expressions
Leverage existing logic in constant hoisting pass to transform constant GEP
expressions sharing the same base global variable. Multi-dimensional GEPs are
rewritten into single-dimensional GEPs.
https://reviews.llvm.org/D51396
Differential Revision: https://reviews.llvm.org/D51654
llvm-svn: 341417
Anna Thomas [Tue, 4 Sep 2018 22:12:23 +0000 (22:12 +0000)]
[LV] First order recurrence phis should not be treated as uniform
This is fix for PR38786.
First order recurrence phis were incorrectly treated as uniform,
which caused them to be vectorized as uniform instructions.
Patch by Ayal Zaks and Orivej Desh!
Reviewed by: Anna
Differential Revision: https://reviews.llvm.org/D51639
llvm-svn: 341416
Sanjay Patel [Tue, 4 Sep 2018 22:10:23 +0000 (22:10 +0000)]
[InstCombine] add tests for xor-or-xor fold; NFC
There are 2 bugs shown here that were untested before:
1. We fail to perform the fold in 1/2 the possible commuted variants.
2. When the fold is done, it disregards extra uses.
llvm-svn: 341415
Thomas Lively [Tue, 4 Sep 2018 21:51:32 +0000 (21:51 +0000)]
[WebAssembly][NFC] Add colon to label in test
llvm-svn: 341414
Scott Linder [Tue, 4 Sep 2018 21:50:47 +0000 (21:50 +0000)]
[AMDGPU] Legalize VGPR Rsrc operands for MUBUF instructions
Emit a waterfall loop in the general case for a potentially-divergent Rsrc
operand. When practical, avoid this by using Addr64 instructions.
Differential Revision: https://reviews.llvm.org/D50982
llvm-svn: 341413
Hiroshi Yamauchi [Tue, 4 Sep 2018 21:28:22 +0000 (21:28 +0000)]
Fix a memory leak after rL341386.
Reviewers: davidxl
Reviewed By: davidxl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51658
llvm-svn: 341412
Thomas Lively [Tue, 4 Sep 2018 21:26:17 +0000 (21:26 +0000)]
[WebAssembly][NFC] Fix formatting and tests
Summary: Small fixes
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D51656
llvm-svn: 341411
Sanjay Patel [Tue, 4 Sep 2018 21:17:14 +0000 (21:17 +0000)]
[InstCombine] make ((X & C) ^ C) form consistent for vectors
It would be better to create a 'not' here, but that's not possible yet.
llvm-svn: 341410
Krzysztof Parzyszek [Tue, 4 Sep 2018 21:07:27 +0000 (21:07 +0000)]
[Hexagon] Don't packetize new-value stores with any other stores
llvm-svn: 341409
Sterling Augustine [Tue, 4 Sep 2018 21:06:59 +0000 (21:06 +0000)]
When a relocation to an undefined symbol is an R_X86_64_PC32, an input
section will not have an input file. Don't crash under those circumstances.
Neither clang nor llvm-mc generates R_X86_64_PC32 relocations due to
https://reviews.llvm.org/D43383, which makes it hard to write a test case.
However, gcc does generate such relocations. I want to get a fix in now,
but will figure out a way to actually exercise this code path as soon
as I can.
llvm-svn: 341408
Jessica Paquette [Tue, 4 Sep 2018 21:03:43 +0000 (21:03 +0000)]
[NFC] Improve clarity in emitInstrCountChangedRemark
Add a "CouldOnlyImpactOneFunction" bool that's true when we pass in a function.
Just cleaning up a little bit, since I'm going to add in the per-function
remarks soon from D51467.
llvm-svn: 341407
JF Bastien [Tue, 4 Sep 2018 21:02:00 +0000 (21:02 +0000)]
NFC: expand memset inline arm64 coverage
I'm looking at some codegen optimization in this area and want to make sure I understand the current codegen and don't regress it. This patch simply expands the two existing tests to capture more of the current code generation when it comes to heap-based and stack-based small memset on arm64. The tested code is already pretty good, notably when it comes to using STP, FP stores, FP immediate generation, and folding one of the stores into a stack spill when possible. The uses of STUR could be improved, and some more pairing could occur. Straying from bzero patterns currently yield suboptimal code, and I expect a variety of small changes could make things way better.
llvm-svn: 341406
Sanjay Patel [Tue, 4 Sep 2018 21:00:13 +0000 (21:00 +0000)]
[InstCombine] simplify code for xor folds; NFCI
This is just a cleanup step. The TODO comments show
what is wrong with the 'and' version of the fold.
Fixing this should be part of recommitting:
rL300977
llvm-svn: 341405
Charles Davis [Tue, 4 Sep 2018 20:57:50 +0000 (20:57 +0000)]
[CMake] Don't use -rtlib=compiler-rt with -nodefaultlibs.
Summary:
This switch only has an effect at link time. It changes the default
compiler support library to `compiler-rt`. With `-nodefaultlibs`, this
library won't get linked anyway; Clang actually warns about that.
Reviewers: mstorsjo, rnk
Subscribers: dberris, mgorny, christof, cfe-commits
Differential Revision: https://reviews.llvm.org/D51645
llvm-svn: 341404
Martin Storsjo [Tue, 4 Sep 2018 20:56:56 +0000 (20:56 +0000)]
[COFF] Allow exporting all symbols from system libraries specfied with -wholearchive:
When building a shared libc++.dll, it pulls in libc++abi.a statically
with the --wholearchive flag. If such a build is done with
--export-all-symbols, it's reasonable to assume that everything
from that library also should be exported with the same rules as normal
local object files, even though we normally avoid autoexporting things
from libc++abi.a in other cases when linking a DLL (user code).
Differential Revision: https://reviews.llvm.org/D51529
llvm-svn: 341403
Martin Storsjo [Tue, 4 Sep 2018 20:56:28 +0000 (20:56 +0000)]
[MinGW] Move code for indicating "potentially not DSO local" into shouldAssumeDSOLocal. NFC.
On Windows, if shouldAssumeDSOLocal returns false, it's either a
dllimport reference, or a reference that we should treat as non-local
and create a stub for.
Clean up AArch64Subtarget::ClassifyGlobalReference a little while
touching the flag handling relating to dllimport.
Differential Revision: https://reviews.llvm.org/D51590
llvm-svn: 341402
Martin Storsjo [Tue, 4 Sep 2018 20:56:21 +0000 (20:56 +0000)]
[MinGW] [AArch64] Add stubs for potential automatic dllimported variables
The runtime pseudo relocations can't handle the AArch64 format PC
relative addressing in adrp+add/ldr pairs. By using stubs, the potentially
dllimported addresses can be touched up by the runtime pseudo relocation
framework.
Differential Revision: https://reviews.llvm.org/D51452
llvm-svn: 341401
Reid Kleckner [Tue, 4 Sep 2018 20:34:47 +0000 (20:34 +0000)]
Fix unused variable warning
llvm-svn: 341400
Sergey Dmitriev [Tue, 4 Sep 2018 20:23:09 +0000 (20:23 +0000)]
[libomptarget] Remove `Devices` from `RTLInfoTy`
This patch removes unused field `Devices` from `RTLInfoTy`.
Differential Revision: https://reviews.llvm.org/D51653
llvm-svn: 341399
Fedor Sergeev [Tue, 4 Sep 2018 20:19:41 +0000 (20:19 +0000)]
[SimpleLoopUnswitch] remove a chain of dead blocks at once
Recent change to deleteDeadBlocksFromLoop was not enough to
fix all the problems related to dead blocks after nontrivial
unswitching of switches.
We need to delete all the dead blocks that were created during
unswitching, otherwise we will keep having problems with phi's
or dead blocks.
This change removes all the dead blocks that are reachable from the loop,
not trying to track whether these blocks are newly created by unswitching
or not. While not completely correct, we are unlikely to get loose but
reachable dead blocks that do not belong to our loop nest.
It does fix all the failures currently known, in particular PR38778.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D51519
llvm-svn: 341398
Jordan Rupprecht [Tue, 4 Sep 2018 20:19:17 +0000 (20:19 +0000)]
[Codegen] Fix test added in rL341380: AArch64SelectionDAGTest needs to link against Analysis lib.
llvm-svn: 341397
David Bolvansky [Tue, 4 Sep 2018 19:23:05 +0000 (19:23 +0000)]
Set console mode when -fansi-escape-codes is enabled
Summary:
Windows console now supports supports ANSI escape codes, but we need to enable it using SetConsoleMode with ENABLE_VIRTUAL_TERMINAL_PROCESSING flag.
Fixes https://bugs.llvm.org/show_bug.cgi?id=38817
Tested on Windows 10, screenshot:
https://i.imgur.com/bqYq0Uy.png
Reviewers: zturner, chandlerc
Reviewed By: zturner
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51611
llvm-svn: 341396
Petr Hosek [Tue, 4 Sep 2018 19:10:37 +0000 (19:10 +0000)]
[CMake] Provide a custom target to install LLVM libraries
This simplifies installing all LLVM libraries when doing component
build; now you can include llvm-libraries in distribution components.
Differential Revision: https://reviews.llvm.org/D51603
llvm-svn: 341395
Sanjay Patel [Tue, 4 Sep 2018 19:06:46 +0000 (19:06 +0000)]
[InstCombine] improve xor+and/or tests
The tests attempted to check for commuted variants
of these folds, but complexity-based canonicalization
meant we had no coverage for at least 1/2 of the cases.
Also, the folds correctly check hasOneUse(), but there
was no coverage for that.
llvm-svn: 341394
Matt Arsenault [Tue, 4 Sep 2018 18:58:19 +0000 (18:58 +0000)]
AMDGPU: Fix DAG divergence not reporting flat loads
Match behavior in DAG of r340343
llvm-svn: 341393
Matt Arsenault [Tue, 4 Sep 2018 18:47:43 +0000 (18:47 +0000)]
DAG: Factor out helper function for odd vector sizes
llvm-svn: 341392
Hiroshi Yamauchi [Tue, 4 Sep 2018 18:10:54 +0000 (18:10 +0000)]
Fix build failures after rL341386.
Reviewers: davidxl
Reviewed By: davidxl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D51647
llvm-svn: 341391
Nico Weber [Tue, 4 Sep 2018 18:00:14 +0000 (18:00 +0000)]
clang-cl: Pass /Brepro to linker if it was passed to the compiler
Differential Revision: https://reviews.llvm.org/D51635
llvm-svn: 341390
Dan Gohman [Tue, 4 Sep 2018 17:46:12 +0000 (17:46 +0000)]
[WebAssembly] Fix operand rewriting in inline asm lowering.
Use MachineOperand::ChangeToImmediate rather than reassigning
MachineOperands to new values created from MachineOperand::CreateImm,
so that their parent pointers are preserved.
This fixes "Instruction has operand with wrong parent set" errors
reported by the MachineVerifier.
llvm-svn: 341389
Charles Davis [Tue, 4 Sep 2018 17:40:26 +0000 (17:40 +0000)]
[CMake] Remove variable reference that isn't used.
Summary:
This variable is never defined, so its value is always empty. Since
`libunwind` is needed to build the C++ ABI library in the first place,
it should never be linked to the C++ ABI library anyway.
Reviewers: mstorsjo, rnk
Subscribers: mgorny, christof, cfe-commits
Differential Revision: https://reviews.llvm.org/D51644
llvm-svn: 341388
David Bolvansky [Tue, 4 Sep 2018 17:19:15 +0000 (17:19 +0000)]
Terminate debugger if an assert was hit
Reviewers: JDevlieghere, teemperor, #lldb
Reviewed By: JDevlieghere
Subscribers: clayborg, lemo, lldb-commits
Differential Revision: https://reviews.llvm.org/D51604
llvm-svn: 341387
Hiroshi Yamauchi [Tue, 4 Sep 2018 17:19:13 +0000 (17:19 +0000)]
[PGO] Control Height Reduction
Summary:
Control height reduction merges conditional blocks of code and reduces the
number of conditional branches in the hot path based on profiles.
if (hot_cond1) { // Likely true.
do_stg_hot1();
}
if (hot_cond2) { // Likely true.
do_stg_hot2();
}
->
if (hot_cond1 && hot_cond2) { // Hot path.
do_stg_hot1();
do_stg_hot2();
} else { // Cold path.
if (hot_cond1) {
do_stg_hot1();
}
if (hot_cond2) {
do_stg_hot2();
}
}
This speeds up some internal benchmarks up to ~30%.
Reviewers: davidxl
Reviewed By: davidxl
Subscribers: xbolva00, dmgreen, mehdi_amini, llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D50591
llvm-svn: 341386
Matt Morehouse [Tue, 4 Sep 2018 17:08:47 +0000 (17:08 +0000)]
[libFuzzer] Enable tests on Windows
Summary:
Enable tests on Windows and make check-fuzzer pass on it. Make
check-fuzzer pass on Windows by fixing libFuzzer, fixing tests, and by
disabling tests on Windows. Most of these are disabled temporarily as
support for the tests and the features they test will be added
incrementally. Other tests will not be enabled since they require
things that are not on Windows (eg: afl_driver tests). Every test
that was explicitly disabled on Windows has a comment explaining why
(unless obvious like merge-posix.test).
The lit.cfg file was modified to support running tests on windows.
fuzzer-dirs.test was fixed by making the Windows implementation print
the same error message as the posix version.
merge-control-file.test was fixed by making the test binary end with
the ".exe" extension (on all platforms).
Patch By: metzman
Reviewers: morehouse
Reviewed By: morehouse
Subscribers: srhines, mgorny
Differential Revision: https://reviews.llvm.org/D51549
llvm-svn: 341385
Matt Morehouse [Tue, 4 Sep 2018 17:04:30 +0000 (17:04 +0000)]
[TSan] Update assembly test again.
Previous commit incorrectly updated the read1 case.
llvm-svn: 341384
Matt Morehouse [Tue, 4 Sep 2018 16:34:26 +0000 (16:34 +0000)]
[TSan] Update assembly code check.
The new assembly makes our benchmark faster, so it should be safe to
update the check.
llvm-svn: 341381
Scott Linder [Tue, 4 Sep 2018 16:33:34 +0000 (16:33 +0000)]
[CodeGen] Fix remaining zext() assertions in SelectionDAG
Fix remaining cases not committed in https://reviews.llvm.org/D49574
Differential Revision: https://reviews.llvm.org/D50659
llvm-svn: 341380
Francis Visoiu Mistrih [Tue, 4 Sep 2018 16:31:53 +0000 (16:31 +0000)]
[MachO] Fix inconsistency between error messages when validating LC_DYSYMTAB
llvm-svn: 341379
Francis Visoiu Mistrih [Tue, 4 Sep 2018 16:31:48 +0000 (16:31 +0000)]
[MachO] Fix LC_DYSYMTAB validation for external symbols
We were validating the same index (ilocalsym) twice, while iextdefsym
was never validated.
llvm-svn: 341378
Jonas Devlieghere [Tue, 4 Sep 2018 16:21:37 +0000 (16:21 +0000)]
[dwarfdump] Improve -diff option by hiding more data.
The -diff option makes it easy to diff dwarf by hiding addresses and
offsets. However not all of them were hidden, which should be fixed by
this patch.
Differential revision: https://reviews.llvm.org/D51593
llvm-svn: 341377