Cameron McInally [Fri, 6 Oct 2017 22:31:29 +0000 (22:31 +0000)]
[AVX512] Fix TERNLOG when folding broadcast
Patch to fix ternlog instructions with a folded
broadcast. The broadcast decorator, e.g. {1toX}, was missing.
Differential Revision: https://reviews.llvm.org/D38649
llvm-svn: 315122
Jonas Devlieghere [Fri, 6 Oct 2017 22:27:31 +0000 (22:27 +0000)]
[dwarfdump] Verify that unit type matches root DIE
This patch adds two new verifiers:
- It checks that the root DIE of a CU is actually a valid unit DIE.
(based on its tag)
- For DWARF5 which contains a unit type int he CU header, it checks that
this matches the type of the unit DIE.
Differential revision: https://reviews.llvm.org/D38453
llvm-svn: 315121
Chris Bieneman [Fri, 6 Oct 2017 22:21:36 +0000 (22:21 +0000)]
[CMake] Add LLDB_INCLUDE_TESTS variable
This behaves like the other *_INCLUDE_TESTS variables in CMake and is tied to LLVM_INCLUDE_TESTS so that if you're building in-tree and not building the LLVM tests, you also won't build the LLDB tests.
llvm-svn: 315120
Peter Collingbourne [Fri, 6 Oct 2017 22:09:03 +0000 (22:09 +0000)]
Reland r315114, "ELF: Export preempted symbols even if there is a dynamic list." which was reverted in r315116.
I hadn't synced past the change that changed the default hash style
to --hash-style=both, so my test had the symbols in the wrong order.
llvm-svn: 315119
Zachary Turner [Fri, 6 Oct 2017 22:05:15 +0000 (22:05 +0000)]
[llvm-rc] Implement escape sequences in .rc files.
This allows the escape sequences (\a, \n, \r, \t, \\, \x[0-9a-f]*,
\[0-7]*, "") to appear in .rc scripts. These are parsed and output in
the same way as it's done in original MS implementation.
The way these sequences are processed depends on the type of the
resource it resides in, and on whether the user declared the string to
be "wide" or "narrow".
I tried to maintain the maximum compatibility with the original tool
(and fail in some erroneous situations that are accepted by .rc).
However, there are some (extremely rare) cases where Microsoft tool
outputs nonsense. I found it infeasible to detect such casses.
Patch by Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D38426
llvm-svn: 315118
Zachary Turner [Fri, 6 Oct 2017 21:52:15 +0000 (21:52 +0000)]
[llvm-rc] Serialize user-defined resources to .res files.
This allows rc to serialize user-defined resources, as
documented at:
msdn.microsoft.com/en-us/library/windows/desktop/
aa381054.aspx
Escape sequences are yet unavailable, and are to be added in one of
child patches.
Patch by: Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D38423
llvm-svn: 315117
Peter Collingbourne [Fri, 6 Oct 2017 21:48:39 +0000 (21:48 +0000)]
Revert r315114, "ELF: Export preempted symbols even if there is a dynamic list."
For some reason the symbols get emitted in the wrong order on one of the
buildbots: http://bb9.pgr.jp/#builders/15/builds/180
llvm-svn: 315116
Rui Ueyama [Fri, 6 Oct 2017 21:42:37 +0000 (21:42 +0000)]
Make a few member varaibles/functions private.
llvm-svn: 315115
Peter Collingbourne [Fri, 6 Oct 2017 21:33:59 +0000 (21:33 +0000)]
ELF: Export preempted symbols even if there is a dynamic list.
Dynamic lists in an executable are additive, not restrictive, so we
must continue to export preempted symbols even with a dynamic list.
This fixes sanitizer interception of libc symbols (and should also fix
symbol preemption by users of sanitizers).
Differential Revision: https://reviews.llvm.org/D38647
llvm-svn: 315114
Rui Ueyama [Fri, 6 Oct 2017 21:32:23 +0000 (21:32 +0000)]
Inline a small function.
llvm-svn: 315113
Zachary Turner [Fri, 6 Oct 2017 21:30:55 +0000 (21:30 +0000)]
[llvm-rc] Serialize STRINGTABLE statements to .res file.
This allows llvm-rc to serialize STRINGTABLE resources.
These are output in an unusual way: we locate them at the end of the
file, and strings are merged into bundles of max 16 strings, depending
on their IDs, language, and characteristics.
Ref: msdn.microsoft.com/en-us/library/windows/desktop/
aa381050.aspx
Patch by: Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D38420
llvm-svn: 315112
Reid Kleckner [Fri, 6 Oct 2017 21:28:21 +0000 (21:28 +0000)]
Revert "For dllexport class templates, export specializations of member functions (PR34849)"
This reverts r315025, it caused http://crbug.com/772461
llvm-svn: 315111
Zachary Turner [Fri, 6 Oct 2017 21:26:06 +0000 (21:26 +0000)]
[llvm-rc] Serialize VERSIONINFO resources to .res files.
This is now able to dump VERSIONINFO resources.
Ref: msdn.microsoft.com/en-us/library/windows/desktop/
aa381058.aspx
Differential Revision: https://reviews.llvm.org/D38410
Patch by: Marek Sokolowski
llvm-svn: 315110
Zachary Turner [Fri, 6 Oct 2017 21:25:44 +0000 (21:25 +0000)]
[llvm-rc] Serialize CURSOR and ICON resources to .res
This is part 6 of llvm-rc serialization.
This adds ability to output cursors and icons as resources.
Unfortunately, we can't just copy .cur or .ico files to output - as each
file might contain multiple images, each of them needs to be unpacked
and stored as a separate resource. This forces us to parse cursor and
icon contents. (Fortunately, these formats are pretty similar and can be
processed by mostly common code).
As test files are binary, here is a short explanation of .cur and .ico
files stored:
cursor.cur, cursor-8.cur, cursor-32.cur are sample correct cursor files,
differing in their bit depth.
icon-old.ico, icon-new.ico are sample correct icon files;
icon-png.ico is a sample correct icon file in PNG format (instead of
usual BMP);
cursor-eof.cur is an incorrect cursor file - this is cursor.cur with
some of its final bytes removed.
cursor-bad-offset.cur is an incorrect cursor file - image header states
that image data begins at offset 0xFFFFFFFF.
Sample correct cursors and icons were created by Nico Weber.
Patch by Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D37878
llvm-svn: 315109
Reid Kleckner [Fri, 6 Oct 2017 21:17:51 +0000 (21:17 +0000)]
Revert "Roll forward r314928"
This appears to be miscompiling Clang, as shown on two Windows bootstrap
bots:
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/7611
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/6870
Nothing else is in the blame list. Both emit errors on this valid code
in the Windows ucrt headers:
C:\...\ucrt\malloc.h:95:32: error: invalid operands to binary expression ('char *' and 'int')
_Ptr = (char*)_Ptr + _ALLOCA_S_MARKER_SIZE;
~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~
I am attempting to reproduce this now.
This reverts r315044
llvm-svn: 315108
Reid Kleckner [Fri, 6 Oct 2017 21:02:28 +0000 (21:02 +0000)]
[MS] Raise the default value of _MSC_VER to 1911, which is VS 2017
Summary:
This raises our default past 1900, which controls whether char16_t is a
builtin type or not.
Implements PR34243
Reviewers: hans
Subscribers: STL_MSFT, rsmith, cfe-commits
Differential Revision: https://reviews.llvm.org/D38646
llvm-svn: 315107
Evgeniy Stepanov [Fri, 6 Oct 2017 20:53:40 +0000 (20:53 +0000)]
Factor out default_(a|ub)sanitizer_opts in lit.
Reviewers: vitalybuka
Subscribers: srhines, llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D38644
llvm-svn: 315106
Evgeniy Stepanov [Fri, 6 Oct 2017 20:51:51 +0000 (20:51 +0000)]
[sanitizer] Test ubsan and cfi on android.
Summary:
Enable check-cfi and check-ubsan on Android.
Check-ubsan includes standalone and ubsan+asan, but not tsan or msan.
Cross-dso cfi tests are disabled for now.
Reviewers: vitalybuka, pcc
Subscribers: srhines, kubamracek, llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D38608
llvm-svn: 315105
Zachary Turner [Fri, 6 Oct 2017 20:51:20 +0000 (20:51 +0000)]
[llvm-rc] Add optional serialization support for DIALOG(EX) resources.
This is part 5 of llvm-rc serialization support.
This allows DIALOG and DIALOGEX to serialize if dialog-specific optional
statements are provided. These are (as of now): CAPTION, FONT, and
STYLE.
Notably, FONT statement can take more than two arguments when describing
DIALOGEX resources (as in
msdn.microsoft.com/en-us/library/windows/desktop/
aa381013.aspx). I made
some changes to the parser to reflect this fact.
Patch by Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D37864
llvm-svn: 315104
Alex Lorenz [Fri, 6 Oct 2017 20:51:04 +0000 (20:51 +0000)]
-Wdocumentation should allow '...' params in variadic function type aliases
rdar://
34811344
llvm-svn: 315103
Adrian Prantl [Fri, 6 Oct 2017 20:24:35 +0000 (20:24 +0000)]
Unify spelling.
llvm-svn: 315102
Adrian Prantl [Fri, 6 Oct 2017 20:24:34 +0000 (20:24 +0000)]
llvm-dwarfdump: Add an option to collect debug info quality metrics.
At the last LLVM dev meeting we had a debug info for optimized code
BoF session. In that session I presented some graphs that showed how
the quality of the debug info produced by LLVM changed over the last
couple of years. This is a cleaned up version of the patch I used to
collect the this data. It is implemented as an extension of
llvm-dwarfdump, adding a new --statistics option. The intended
use-case is to automatically run this on the debug info produced by,
e.g., our bots, to identify eyebrow-raising changes or regressions
introduced by new transformations that we could act on.
In the current form, two kinds of data are being collected:
- The number of variables that have a debug location versus the number
of variables in total (this takes into account inlined instances of
the same function, so if a variable is completely missing form only
one instance it will be found).
- The PC range covered by variable location descriptions versus the PC
range of all variables' containing lexical scopes.
The output format is versioned and extensible, so I'm looking forward
to both bug fixes and ideas for other data that would be interesting
to track.
Differential Revision: https://reviews.llvm.org/D36627
llvm-svn: 315101
Rui Ueyama [Fri, 6 Oct 2017 20:12:43 +0000 (20:12 +0000)]
Revert r314616: Run writeTo() concurrently.
This reverts commit r314616 because nested parallel-for loops can hang.
Our ThreadPoolExecutor is not necessarily able to handle nested calls.
llvm-svn: 315098
Rafael Espindola [Fri, 6 Oct 2017 20:09:34 +0000 (20:09 +0000)]
Refine our --wrap implementation.
Before this patch we would copy foo into real_foo and wrap_foo into
foo. The net result is that __wrap_foo shows up twice in the symbol
table.
With this patch we:
* save a copy of __real_foo before copying foo.
* drop one of the __wrap_foo from the symbol table.
* if __real_foo was not undefined, add a *new* symbol with that content to
the symbol table.
The net result is that
Anything using foo now uses __wrap_foo
Anything using __real_foo now uses foo.
Anything using __wrap_foo still does.
And the symbol table has foo, __wrap_foo and __real_foo (if defined).
Which I think is the desired behavior.
llvm-svn: 315097
Rui Ueyama [Fri, 6 Oct 2017 20:08:51 +0000 (20:08 +0000)]
Inline a small function. NFC.
llvm-svn: 315096
Alex Lorenz [Fri, 6 Oct 2017 19:49:29 +0000 (19:49 +0000)]
Revert r315087
clang-refactor crashes on some bots after this commit
llvm-svn: 315095
Matt Arsenault [Fri, 6 Oct 2017 19:34:40 +0000 (19:34 +0000)]
OpenCL: Assume functions are convergent
This was done for CUDA functions in r261779, and for the same
reason this also needs to be done for OpenCL. An arbitrary
function could have a barrier() call in it, which in turn
requires the calling function to be convergent.
llvm-svn: 315094
Alex Lorenz [Fri, 6 Oct 2017 19:24:26 +0000 (19:24 +0000)]
[ObjC] Don't warn on readwrite properties with custom setters that
override readonly properties from protocols
rdar://
34192541
llvm-svn: 315093
Amara Emerson [Fri, 6 Oct 2017 19:24:15 +0000 (19:24 +0000)]
[GlobalISel] Fix legalizer trying to process a deleted instruction.
In some cases an instruction is deleted from the block during combining,
however it can still exist in the legalizer worklist.
This change modifies the combiner routines to add the given MI to the
dead instruction list rather than trying to remove it from the block
themselves. The responsibility is then on the caller to delete the instruction
from the block and any worklists.
Differential Revision: https://reviews.llvm.org/D38622
llvm-svn: 315092
Jonathan Peyton [Fri, 6 Oct 2017 19:23:19 +0000 (19:23 +0000)]
KMP_HW_SUBSET vs KMP_PLACE_THREADS rival envirables fix
If both KMP_HW_SUBSET and KMP_PLACE_THREADS are set and KMP_PLACE_THREADS gets
parsed first, then the current environment variable parser rejects both and
neither get used. This patch uses the rivals mechanism that is used for other
environment variable groups (e.g., KMP_STACKSIZE, GOMP_STACKSIZE, OMP_STACKSIZE).
If both are set, then it tells the user that it is ignoring KMP_PLACE_THREADS in
favor of KMP_HW_SUBSET. The message about deprecating KMP_PLACE_THREADS when it
is set is still printed regardless.
Differential Revision: https://reviews.llvm.org/D38292
llvm-svn: 315091
Martin Storsjo [Fri, 6 Oct 2017 19:14:07 +0000 (19:14 +0000)]
[docs] Mention that SjLj works on any OS on the archs where supported by the compiler
Differential Revision: https://reviews.llvm.org/D38576
llvm-svn: 315090
Reid Kleckner [Fri, 6 Oct 2017 18:21:19 +0000 (18:21 +0000)]
[PEI] Remove required properties and use 'if' instead of std::function
Summary:
After r303360, we initialize UsesCalleeSaves in runOnMachineFunction,
which runs after getRequiredProperties. UsesCalleeSaves was initialized
to 'false', so getRequiredProperties would always return an empty set.
We don't have a TargetMachine available early anymore after r303360.
Just removing the requirement of NoVRegs seems to make things work, so
let's do that.
Reviewers: thegameg, dschuff, MatzeB
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D38597
llvm-svn: 315089
Francis Ricci [Fri, 6 Oct 2017 18:19:52 +0000 (18:19 +0000)]
Revert "[dsymutil] Emit valid debug locations when no symbol flags are set"
This reverts commit r315082, which fails on non-darwin buildbots.
llvm-svn: 315088
Alex Lorenz [Fri, 6 Oct 2017 18:12:29 +0000 (18:12 +0000)]
[refactor] add support for refactoring options
This commit adds initial support for refactoring options. One can now use
optional and required std::string options.
This commit also adds a NewNameOption for the local-rename refactoring action to
allow rename to work with custom names.
Differential Revision: https://reviews.llvm.org/D37856
llvm-svn: 315087
Saleem Abdulrasool [Fri, 6 Oct 2017 18:06:59 +0000 (18:06 +0000)]
Bitcode: add an auto-upgrade for LTO section name
The bitcode reader looks specifically for `__DATA, __objc_catlist` as a
section name. However, SVN r304661 removed the spaces (the two names
are functionally equivalent but do not compare equally
lexicographically). This causes compatibility issues. Add an
auto-upgrade path for removing the spaces as well as use the new name in
the LTO plugin.
llvm-svn: 315086
Zachary Turner [Fri, 6 Oct 2017 17:54:46 +0000 (17:54 +0000)]
[lit] Improve tool substitution in lit.
This addresses two sources of inconsistency in test configuration
files.
1. Substitution boundaries. Previously you would specify a
substitution, such as 'lli', and then additionally a set
of characters that should fail to match before and after
the tool. This was used, for example, so that matches that
are parts of full paths would not be replaced. But not all
tools did this, and those that did would often re-invent
the set of characters themselves, leading to inconsistency.
Now, every tool substitution defaults to using a sane set
of reasonable defaults and you have to explicitly opt out
of it. This actually fixed a few latent bugs that were
never being surfaced, but only on accident.
2. There was no standard way for the system to decide how to
locate a tool. Sometimes you have an explicit path, sometimes
we would search for it and build up a path ourselves, and
sometimes we would build up a full command line. Furthermore,
there was no standardized way to handle missing tools. Do we
warn, fail, ignore, etc? All of this is now encapsulated in
the ToolSubst class. You either specify an exact command to
run, or an instance of FindTool('<tool-name>') and everything
else just works. Furthermore, you can specify an action to
take if the tool cannot be resolved.
Differential Revision: https://reviews.llvm.org/D38565
llvm-svn: 315085
Zachary Turner [Fri, 6 Oct 2017 17:54:27 +0000 (17:54 +0000)]
Run pyformat on lit code.
llvm-svn: 315084
Diana Picus [Fri, 6 Oct 2017 17:47:27 +0000 (17:47 +0000)]
[ARM] GlobalISel: Make tests less strict
These are intended as integration tests, so they shouldn't be too
specific about what they're checking.
llvm-svn: 315083
Francis Ricci [Fri, 6 Oct 2017 17:43:37 +0000 (17:43 +0000)]
[dsymutil] Emit valid debug locations when no symbol flags are set
Summary:
swiftc emits symbols without flags set, which led dsymutil to ignore
them when searching for global symbols, causing dwarf location data
to be omitted. Xcode's dsymutil handles this case correctly, and emits
valid location data. Add this functionality to llvm-dsymutil by
allowing parsing of symbols with no flags set.
Reviewers: aprantl, friss, JDevlieghere
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38587
llvm-svn: 315082
Stanislav Mekhanoshin [Fri, 6 Oct 2017 17:24:45 +0000 (17:24 +0000)]
[AMDGPU] New 64 bit div/rem expansion
Old expansion was 20 VGPRs, 78 SGPRs and ~380 instructions.
This expansion is 11 VGPRs, 12 SGPRs and ~120 instructions.
Passes OpenCL conformance test_integer_ops quick_[u]long_math
Differential Revision: https://reviews.llvm.org/D38607
llvm-svn: 315081
Reid Kleckner [Fri, 6 Oct 2017 17:21:49 +0000 (17:21 +0000)]
[MC] Use unique_ptr to manage WinFrameInfos, NFC
The FrameInfo cannot be stored directly in the vector because chained
frames may refer to parent frames, so we need pointers that are stable
across a vector resize.
llvm-svn: 315080
Peter Collingbourne [Fri, 6 Oct 2017 17:14:36 +0000 (17:14 +0000)]
Support: Rewrite Windows implementation of sys::fs::rename to be more POSIXy.
The current implementation of rename uses ReplaceFile if the
destination file already exists. According to the documentation for
ReplaceFile, the source file is opened without a sharing mode. This
means that there is a short interval of time between when ReplaceFile
renames the file and when it closes the file during which the
destination file cannot be opened.
This behaviour is not POSIX compliant because rename is supposed
to be atomic. It was also causing intermittent link failures when
linking with a ThinLTO cache; the ThinLTO cache implementation expects
all cache files to be openable.
This patch addresses that problem by re-implementing rename
using CreateFile and SetFileInformationByHandle. It is roughly a
reimplementation of ReplaceFile with a better sharing policy as well
as support for renaming in the case where the destination file does
not exist.
This implementation is still not fully POSIX. Specifically in the case
where the destination file is open at the point when rename is called,
there will be a short interval of time during which the destination
file will not exist. It isn't clear whether it is possible to avoid
this using the Windows API.
Differential Revision: https://reviews.llvm.org/D38570
llvm-svn: 315079
Paul Robinson [Fri, 6 Oct 2017 17:12:28 +0000 (17:12 +0000)]
For Windows, allow .exe extension in a test.
llvm-svn: 315078
Dehao Chen [Fri, 6 Oct 2017 17:04:55 +0000 (17:04 +0000)]
Directly return promoted direct call instead of rely on stripPointerCast.
Summary: stripPointerCast is not reliably returning the value that's being type-casted. Instead it may look further at function attributes to further propagate the value. Instead of relying on stripPOintercast, the more reliable solution is to directly use the pointer to the promoted direct call.
Reviewers: tejohnson, davidxl
Reviewed By: tejohnson
Subscribers: llvm-commits, sanjoy
Differential Revision: https://reviews.llvm.org/D38603
llvm-svn: 315077
Alexey Bataev [Fri, 6 Oct 2017 17:00:28 +0000 (17:00 +0000)]
[OPENMP] Do not capture local static variables.
Previously we may erroneously try to capture locally declared static
variables, which will lead to crash for target-based constructs.
Patch fixes this problem.
llvm-svn: 315076
Erich Keane [Fri, 6 Oct 2017 16:40:45 +0000 (16:40 +0000)]
Split X86::BI__builtin_cpu_init handling into own function[NFC]
The Cpu Init functionality is required for the target
attribute, so this patch simply splits it out into its own
function, exactly like CpuIs and CpuSupports.
llvm-svn: 315075
Alexey Bataev [Fri, 6 Oct 2017 16:17:25 +0000 (16:17 +0000)]
[OPENMP] Capture references to global variables.
In C++11 variable to global variables are considered as constant
expressions and these variables are not captured in the outlined
regions. Patch allows capturing of such variables in the OpenMP regions.
llvm-svn: 315074
Alexander Richardson [Fri, 6 Oct 2017 16:15:59 +0000 (16:15 +0000)]
[ELF][MIPS] Check for overflow when writing R_MIPS_CALL16 and R_MIPS_TLS_GOTTPREL
Summary:
These are 16 bit relocations and not part of a HI/LO pair so we need to
check that they don't overflow.
Reviewers: atanasyan
Reviewed By: atanasyan
Subscribers: ruiu, llvm-commits, emaste, sdardis
Tags: #lld
Differential Revision: https://reviews.llvm.org/D38614
llvm-svn: 315073
Francis Ricci [Fri, 6 Oct 2017 15:54:20 +0000 (15:54 +0000)]
Guard xar RAII behind HAVE_LIBXAR
llvm-svn: 315072
Diana Picus [Fri, 6 Oct 2017 15:39:16 +0000 (15:39 +0000)]
[ARM] GlobalISel: Select shifts
Unfortunately TableGen doesn't handle this yet:
Unable to deduce gMIR opcode to handle Src (which is a leaf).
Just add some temporary hand-written code to generate the proper MOVsr.
llvm-svn: 315071
Simon Pilgrim [Fri, 6 Oct 2017 15:33:55 +0000 (15:33 +0000)]
Strip trailing whitespace
llvm-svn: 315070
Francis Ricci [Fri, 6 Oct 2017 15:33:28 +0000 (15:33 +0000)]
[llvm-objdump] Add RAII for xar apis
Summary:
xar_open and xar_iter_new require manual calls to close/free functions
to deallocate resources. This makes it easy to introduce memory leaks,
so add RAII struct wrappers for these resources.
Reviewers: enderby, rafael, compnerd, lhames, dblaikie
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D38598
llvm-svn: 315069
Javed Absar [Fri, 6 Oct 2017 15:25:04 +0000 (15:25 +0000)]
[TableGen] Simplify SubtargetEmitter
Remove unnecessary duplicate if-condition.
llvm-svn: 315068
Diana Picus [Fri, 6 Oct 2017 14:52:43 +0000 (14:52 +0000)]
[ARM] GlobalISel: Map shift operands to GPRs
llvm-svn: 315067
Francis Ricci [Fri, 6 Oct 2017 14:49:20 +0000 (14:49 +0000)]
[llvm-dsymutil] Add support for __swift_ast MachO DWARF section
Summary:
Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging,
and which contains a byte-for-byte dump of the swiftmodule file.
Add this feature to llvm-dsymutil.
Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of
`__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil
(Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the
__swift_ast section).
Reviewers: aprantl, friss
Subscribers: llvm-commits, JDevlieghere
Differential Revision: https://reviews.llvm.org/D38504
llvm-svn: 315066
Ilya Biryukov [Fri, 6 Oct 2017 14:39:39 +0000 (14:39 +0000)]
[clangd] Run clang-format on the source code. NFC.
llvm-svn: 315065
Diana Picus [Fri, 6 Oct 2017 14:30:05 +0000 (14:30 +0000)]
[ARM] GlobalISel: Mark shifts as legal for s32
The new legalize combiner introduces shifts all over the place, so we
should support them sooner rather than later.
llvm-svn: 315064
Jonas Paulsson [Fri, 6 Oct 2017 13:59:28 +0000 (13:59 +0000)]
[SystemZ] Enable machine scheduler.
The machine scheduler (before register allocation) is enabled by default for
SystemZ.
The SelectionDAG scheduling preference now becomes source order scheduling
(was regpressure).
Review: Ulrich Weigand
https://reviews.llvm.org/D37977
llvm-svn: 315063
Clement Courbet [Fri, 6 Oct 2017 13:45:16 +0000 (13:45 +0000)]
[MergeICmp][NFC] Make test tuple-four-int8.ll more readable.
llvm-svn: 315062
Simon Pilgrim [Fri, 6 Oct 2017 13:40:29 +0000 (13:40 +0000)]
[X86][SSE] Add SKX cpu tests to SSE/AVX scheduling tests (D38443)
llvm-svn: 315061
Aaron Ballman [Fri, 6 Oct 2017 13:27:59 +0000 (13:27 +0000)]
Renaming a test to start with the name of the check based on post-commit review feedback; NFC.
llvm-svn: 315060
Aaron Ballman [Fri, 6 Oct 2017 13:14:28 +0000 (13:14 +0000)]
Fixing the command line for a test and switching from tabs to spaces.
llvm-svn: 315059
Clement Courbet [Fri, 6 Oct 2017 13:02:24 +0000 (13:02 +0000)]
Revert "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion."
Still a few stability issues on windows.
This reverts commit
67e3db9bc121ba244e20337aabc7cf341a62b545.
llvm-svn: 315058
Aaron Ballman [Fri, 6 Oct 2017 12:57:28 +0000 (12:57 +0000)]
Fix nested namespaces in google-readability-nested-namespace-comments.
Fixes PR34701.
Patch by Alexandru Octavian Buțiu.
llvm-svn: 315057
Clement Courbet [Fri, 6 Oct 2017 12:12:35 +0000 (12:12 +0000)]
Re-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion."
(fixed unit tests by making comparisons stable)
This reverts commit
1b2d359ce256fd6737da4e93833346a0bd6d7583.
llvm-svn: 315056
Ilya Biryukov [Fri, 6 Oct 2017 11:54:17 +0000 (11:54 +0000)]
[clangd] Add textDocument/signatureHelp
Summary:
Makes clangd respond to a client's "textDocument/signatureHelp" request by
presenting function/method overloads.
Patch by Raoul Wols.
Reviewers: bkramer, ilya-biryukov, krasimir
Reviewed By: ilya-biryukov
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D38048
llvm-svn: 315055
George Rimar [Fri, 6 Oct 2017 10:06:13 +0000 (10:06 +0000)]
[ELF] - Do not produce broken .dynamic section with --no-rosegment
LLD produces broken .dynamic section when --no-rosegment and at least
one of following options is present:
1) -z rodynamic is given.
2) MIPS target.
That happens because code that writes .dynamic assumes target buffer
is zero-filled, what can be not true after LLD fills it with trap
instructions. With one of two options above, .dynamic becomes
SHF_ALLOC section, so can be affected.
Differential revision: https://reviews.llvm.org/D38580
llvm-svn: 315054
George Rimar [Fri, 6 Oct 2017 09:56:24 +0000 (09:56 +0000)]
[ELF] - Do not produce broken .dynsym with --no-rosegment.
We produce broken output currently.
Code that writes .dynsym assumes output buffer is zero-filled,
though that is not always true. When --no-rosegment is given,
buffer can be filled with trap instructions. Patch fixes the issue.
It is relative with PR34705.
Differential revision: https://reviews.llvm.org/D38579
llvm-svn: 315053
George Rimar [Fri, 6 Oct 2017 09:46:04 +0000 (09:46 +0000)]
[ELF] - Fix BB after r315051.
Testcase has "zlib" requirement, which is unsupported on
windows, so that it was not run locally for me.
llvm-svn: 315052
George Rimar [Fri, 6 Oct 2017 09:37:44 +0000 (09:37 +0000)]
[ELF] - Do --hash-style=both by default.
Its PR34712,
GNU linkers recently changed default values to "both" of "sysv".
Patch do the same for all targets except MIPS, where .gnu.hash
section is not yet supported.
Code suggested by Rui Ueyama.
Differential revision: https://reviews.llvm.org/D38407
llvm-svn: 315051
Javed Absar [Fri, 6 Oct 2017 09:32:45 +0000 (09:32 +0000)]
[TableGen] : CodeGenInsrtuction modify to range loop. NFC.
llvm-svn: 315050
Akira Hatanaka [Fri, 6 Oct 2017 08:19:31 +0000 (08:19 +0000)]
Fix one more check string after r315045.
llvm-svn: 315049
Ivan A. Kosarev [Fri, 6 Oct 2017 08:17:48 +0000 (08:17 +0000)]
Refine generation of TBAA information in clang
This patch is an attempt to clarify and simplify generation and
propagation of TBAA information. The idea is to pack all values
that describe a memory access, namely, base type, access type and
offset, into a single structure. This is supposed to make further
changes, such as adding support for unions and array members,
easier to prepare and review.
DecorateInstructionWithTBAA() is no more responsible for
converting types to tags. These implicit conversions not only
complicate reading the code, but also suggest assigning scalar
access tags while we generally prefer full-size struct-path tags.
TBAAPathTag is replaced with TBAAAccessInfo; the latter is now
the type of the keys of the cache map that translates access
descriptors to metadata nodes.
Fixed a bug with writing to a wrong map in
getTBAABaseTypeMetadata() (former getTBAAStructTypeInfo()).
We now check for valid base access types every time we
dereference a field. The original code only checks the top-level
base type. See isValidBaseType() / isTBAAPathStruct() calls.
Some entities have been renamed to sound more adequate and less
confusing/misleading in presence of path-aware TBAA information.
Now we do not lookup twice for the same cache entry in
getAccessTagInfo().
Refined relevant comments and descriptions.
Differential Revision: https://reviews.llvm.org/D37826
llvm-svn: 315048
Akira Hatanaka [Fri, 6 Oct 2017 08:05:34 +0000 (08:05 +0000)]
Fix one more check string after r315045.
llvm-svn: 315047
Akira Hatanaka [Fri, 6 Oct 2017 07:47:47 +0000 (07:47 +0000)]
Fix check strings in test case and use llvm::to_string instead of
std::to_string.
These changes were needed to fix bots that started failing after
r315045.
llvm-svn: 315046
Akira Hatanaka [Fri, 6 Oct 2017 07:12:46 +0000 (07:12 +0000)]
[CodeGen] Emit a helper function for __builtin_os_log_format to reduce
code size.
Currently clang expands a call to __builtin_os_log_format into a long
sequence of instructions at the call site, causing code size to
increase in some cases.
This commit attempts to reduce code size by emitting a helper function
that can be shared by calls to __builtin_os_log_format with similar
formats and arguments. The helper function has linkonce_odr linkage to
enable the linker to merge identical functions across translation units.
Attribute 'noinline' is attached to the helper function at -Oz so that
the inliner doesn't inline functions that can potentially be merged.
This commit also fixes a bug where the generated IR writes past the end
of the buffer when "%m" is the last specifier appearing in the format
string passed to __builtin_os_log_format.
Original patch by Duncan Exon Smith.
rdar://problem/
34065973
rdar://problem/
34196543
Differential Revision: https://reviews.llvm.org/D38606
llvm-svn: 315045
Xinliang David Li [Fri, 6 Oct 2017 05:15:25 +0000 (05:15 +0000)]
Roll forward r314928
Fixed ThinLTO bootstrap failure : track new
bitcast per incomingVal. Added new tests.
llvm-svn: 315044
Davide Italiano [Fri, 6 Oct 2017 04:39:40 +0000 (04:39 +0000)]
[PM] Retire disable unit-at-a-time switch.
This is a vestige from the GCC-3 days, which disables IPO passes
when set. I don't think anybody actually uses it as there are
several IPO passes which still run with this flag set and
nobody complained/noticed. This reduces the delta between
current and new pass manager and allows us to easily review
the difference when we decide to flip the switch (or audit
which passes should run, FWIW).
llvm-svn: 315043
Rui Ueyama [Fri, 6 Oct 2017 04:32:08 +0000 (04:32 +0000)]
Fix typo.
llvm-svn: 315042
Jakub Kuderski [Fri, 6 Oct 2017 03:37:06 +0000 (03:37 +0000)]
[CodeExtractor] Fix multiple bugs under certain shape of extracted region
Summary:
If the extracted region has multiple exported data flows toward the same BB which is not included in the region, correct resotre instructions and PHI nodes won't be generated inside the exitStub. The solution is simply put the restore instructions right after the definition of output values instead of putting in exitStub.
Unittest for this bug is included.
Author: myhsu
Reviewers: chandlerc, davide, lattner, silvas, davidxl, wmi, kuhar
Subscribers: dberlin, kuhar, mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D37902
llvm-svn: 315041
Daniel Berlin [Fri, 6 Oct 2017 01:33:06 +0000 (01:33 +0000)]
NewGVN: Factor out duplicate parts of OpIsSafeForPHIOfOps
llvm-svn: 315040
Evgeniy Stepanov [Fri, 6 Oct 2017 00:00:53 +0000 (00:00 +0000)]
[asan] Use gold linker in android tests.
Replace a partial workaround for ld.bfd strangeness with the ultimate one: -fuse-ld=gold.
Reason: ld.bfd problem gets worse with libc++-based NDK toolchain.
llvm-svn: 315039
Alexander Richardson [Thu, 5 Oct 2017 23:48:29 +0000 (23:48 +0000)]
[ELF] Add missing REQUIRES: mips to the test added in r315035
llvm-svn: 315038
Leonard Mosescu [Thu, 5 Oct 2017 23:41:28 +0000 (23:41 +0000)]
Implement interactive command interruption
The core of this change is the new CommandInterpreter::m_command_state,
which models the state transitions for interactive commands, including
an "interrupted" state transition.
In general, command interruption requires cooperation from the code
executing the command, which needs to poll for interruption requests
through CommandInterpreter::WasInterrupted().
CommandInterpreter::PrintCommandOutput() implements an optionally
interruptible printing of the command output, which for large outputs
was likely the longest blocking part.
(ex. target modules dump symtab on a complex binary could take 10+ minutes)
Differential Revision: https://reviews.llvm.org/D37923
llvm-svn: 315037
Alexander Richardson [Thu, 5 Oct 2017 23:28:34 +0000 (23:28 +0000)]
[ELF] Don't crash when parsing a file with out-of-bounds version references
Summary:
We were crashing when linking telnetd in FreeBSD because lld was emitting
corrupted output files for --norosegment. In this file the version index of some symbols
was set to 9 but lld only found 8 version definitions.
I am not sure how to create a minimal .so file that also exposes this behaviour so I just added the one that initially caused the error to Inputs/
This partially addresses https://bugs.llvm.org/show_bug.cgi?id=34705
Reviewers: ruiu, rafael, pcc, grimar
Reviewed By: ruiu
Subscribers: emaste, krytarowski
Tags: #lld
Differential Revision: https://reviews.llvm.org/D38397
llvm-svn: 315036
Alexander Richardson [Thu, 5 Oct 2017 23:28:29 +0000 (23:28 +0000)]
[ELF] Don't crash when parsing a file with external version definition references
Summary:
We were crashing when linking telnetd in FreeBSD because lld was emitting
corrupted output files for --norosegment. In this file the version index of some symbols
was set to 9 but lld only found 8 version definitions.
I am not sure how to create a minimal .so file that also exposes this behaviour so I just added the one that initially caused the error to Inputs/
This partially addresses https://bugs.llvm.org/show_bug.cgi?id=34705
Reviewers: ruiu, rafael, pcc, grimar
Reviewed By: ruiu
Subscribers: emaste, krytarowski
Tags: #lld
Differential Revision: https://reviews.llvm.org/D38397
llvm-svn: 315035
Francis Ricci [Thu, 5 Oct 2017 23:09:17 +0000 (23:09 +0000)]
Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"
Breaks aarch64 builders
This reverts commit r315014.
llvm-svn: 315034
Rui Ueyama [Thu, 5 Oct 2017 23:01:11 +0000 (23:01 +0000)]
Wait for all threads to terminate before exitting.
I think it is not defined what would happen to detached threads
when the main thread tries to exit. That means it was not guaranteed
that unlinkAsync correctly removes a temporary file. It was also
reported that this unlinkAsync caused a crash on Windows.
This patch adds a few new functions so that the main thread always
waits for non-main threads before exitting.
I don't actually like the new two functions, runBackground and
waitForBackgroundThreads, because it looks like it is a bit
overdesigned. After all, what we are doing with these functions
is to just remove a file.
An alternative would be to do fork(2) and make the child process
remove a file asynchronously. However, it has its own problems.
Correctly forking and reclaiming a resource using waitpid(2) is not
doable unless we know our process-wide settings (such as signal mask),
but we can't make any assumption on it when lld is embedded to other
process. So I chose to stick with threads instead of multi-processes.
Differential Revision: https://reviews.llvm.org/D38571
llvm-svn: 315033
Xin Tong [Thu, 5 Oct 2017 23:00:04 +0000 (23:00 +0000)]
[MBP] Remove an invalid assert.
The patch that this assert comes with is fixing a bug in MBP. The assert is
invalid however.
Thanks to @sergey.k.okunev for finding this
Currently this fails SPECCPU2006 LTO. I will add a test case when I do more
investigation and have one.
llvm-svn: 315032
Alex Shlyapnikov [Thu, 5 Oct 2017 22:53:17 +0000 (22:53 +0000)]
Revert "[LSan] Detect dynamic loader by its base address."
This reverts commit r315024.
Breaks sysconf_interceptor_bypass_test.cc
llvm-svn: 315031
Chris Bieneman [Thu, 5 Oct 2017 22:48:34 +0000 (22:48 +0000)]
[CMake] Add install-distribution-toolchain to stage2 target list
This allows generating toolchains with just the distribution components instead of toolchains with everything.
llvm-svn: 315030
Max Moroz [Thu, 5 Oct 2017 22:41:03 +0000 (22:41 +0000)]
[libFuzzer] Disable experimental clang coverage support by default.
Summary:
It can be enabled via "-use_clang_coverage=1" flag. Reason for disabling:
libFuzzer resets Clang Counters and makes it impossible to generate coverage
report for a regular fuzz target (i.e. not standalone build).
Reviewers: kcc
Reviewed By: kcc
Subscribers: kcc
Differential Revision: https://reviews.llvm.org/D38604
llvm-svn: 315029
Ilya Biryukov [Thu, 5 Oct 2017 22:15:15 +0000 (22:15 +0000)]
[clangd] Attempt to fix compilation with MSVC.
llvm-svn: 315028
Evgeniy Stepanov [Thu, 5 Oct 2017 22:07:21 +0000 (22:07 +0000)]
[cfi] Disable tests with lld on i386.
bin/ld.lld: error: ubsan_handlers.cc:(.debug_info+0x80D5D): has non-ABS reloc
Bug pending.
llvm-svn: 315027
Peter Collingbourne [Thu, 5 Oct 2017 21:54:53 +0000 (21:54 +0000)]
ModuleUtils: Stop using comdat members to generate unique module ids.
It is possible for two modules to define the same set of external
symbols without causing a duplicate symbol error at link time,
as long as each of the symbols is a comdat member. So we cannot
use them as part of a unique id for the module.
Differential Revision: https://reviews.llvm.org/D38602
llvm-svn: 315026
Hans Wennborg [Thu, 5 Oct 2017 21:45:27 +0000 (21:45 +0000)]
For dllexport class templates, export specializations of member functions (PR34849)
llvm-svn: 315025
Alex Shlyapnikov [Thu, 5 Oct 2017 21:38:33 +0000 (21:38 +0000)]
[LSan] Detect dynamic loader by its base address.
Summary:
Relanding D33859, which was reverted because it has "broken LOTS of
ARM/AArch64 bots for two days".
If it breaks something again, please provide some pointers to broken
bots, not just revert it, otherwise it's very hard to reason what's
wrong with this commit.
Whenever possible (Linux + glibc 2.16+), detect dynamic loader module by
its base address, not by the module name matching. The current name
matching approach fails on some configurations.
Reviewers: eugenis
Subscribers: aemerson, kubamracek, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D38600
llvm-svn: 315024
Reid Kleckner [Thu, 5 Oct 2017 21:37:39 +0000 (21:37 +0000)]
[X86] Extract CATCHRET handling from emitEpilogue, NFC
llvm-svn: 315023
Derek Schuff [Thu, 5 Oct 2017 21:18:42 +0000 (21:18 +0000)]
[WebAssembly] Add the rest of the atomic loads
Add extending loads and constant offset patterns
A bit more refactoring of the tablegen to make the patterns fairly nice and
uniform between the regular and atomic loads.
Differential Revision: https://reviews.llvm.org/D38523
llvm-svn: 315022
Sanjay Patel [Thu, 5 Oct 2017 21:11:49 +0000 (21:11 +0000)]
[InstCombine] improve folds for icmp gt/lt (shr X, C1), C2
We can always eliminate the shift in: icmp gt/lt (shr X, C1), C2 --> icmp gt/lt X, C'
This patch was supposed to just be an efficiency improvement because we were doing this 3-step process to fold:
IC: Visiting: %c = icmp ugt i4 %s, 1
IC: ADD: %s = lshr i4 %x, 1
IC: ADD: %1 = udiv i4 %x, 2
IC: Old = %c = icmp ugt i4 %1, 1
New = <badref> = icmp uge i4 %x, 4
IC: ADD: %c = icmp uge i4 %x, 4
IC: ERASE %2 = icmp ugt i4 %1, 1
IC: Visiting: %c = icmp uge i4 %x, 4
IC: Old = %c = icmp uge i4 %x, 4
New = <badref> = icmp ugt i4 %x, 3
IC: ADD: %c = icmp ugt i4 %x, 3
IC: ERASE %2 = icmp uge i4 %x, 4
IC: Visiting: %c = icmp ugt i4 %x, 3
IC: DCE: %1 = udiv i4 %x, 2
IC: ERASE %1 = udiv i4 %x, 2
IC: DCE: %s = lshr i4 %x, 1
IC: ERASE %s = lshr i4 %x, 1
IC: Visiting: ret i1 %c
When we could go directly to canonical icmp form:
IC: Visiting: %c = icmp ugt i4 %s, 1
IC: Old = %c = icmp ugt i4 %s, 1
New = <badref> = icmp ugt i4 %x, 3
IC: ADD: %c = icmp ugt i4 %x, 3
IC: ERASE %1 = icmp ugt i4 %s, 1
IC: ADD: %s = lshr i4 %x, 1
IC: DCE: %s = lshr i4 %x, 1
IC: ERASE %s = lshr i4 %x, 1
IC: Visiting: %c = icmp ugt i4 %x, 3
...but then I noticed that the folds were incomplete too:
https://godbolt.org/g/aB2hLE
Here are attempts to prove the logic with Alive:
https://rise4fun.com/Alive/92o
Name: lshr_ult
Pre: ((C2 << C1) u>> C1) == C2
%sh = lshr i8 %x, C1
%r = icmp ult i8 %sh, C2
=>
%r = icmp ult i8 %x, (C2 << C1)
Name: ashr_slt
Pre: ((C2 << C1) >> C1) == C2
%sh = ashr i8 %x, C1
%r = icmp slt i8 %sh, C2
=>
%r = icmp slt i8 %x, (C2 << C1)
Name: lshr_ugt
Pre: (((C2+1) << C1) u>> C1) == (C2+1)
%sh = lshr i8 %x, C1
%r = icmp ugt i8 %sh, C2
=>
%r = icmp ugt i8 %x, ((C2+1) << C1) - 1
Name: ashr_sgt
Pre: (C2 != 127) && ((C2+1) << C1 != -128) && (((C2+1) << C1) >> C1) == (C2+1)
%sh = ashr i8 %x, C1
%r = icmp sgt i8 %sh, C2
=>
%r = icmp sgt i8 %x, ((C2+1) << C1) - 1
Name: ashr_exact_sgt
Pre: ((C2 << C1) >> C1) == C2
%sh = ashr exact i8 %x, C1
%r = icmp sgt i8 %sh, C2
=>
%r = icmp sgt i8 %x, (C2 << C1)
Name: ashr_exact_slt
Pre: ((C2 << C1) >> C1) == C2
%sh = ashr exact i8 %x, C1
%r = icmp slt i8 %sh, C2
=>
%r = icmp slt i8 %x, (C2 << C1)
Name: lshr_exact_ugt
Pre: ((C2 << C1) u>> C1) == C2
%sh = lshr exact i8 %x, C1
%r = icmp ugt i8 %sh, C2
=>
%r = icmp ugt i8 %x, (C2 << C1)
Name: lshr_exact_ult
Pre: ((C2 << C1) u>> C1) == C2
%sh = lshr exact i8 %x, C1
%r = icmp ult i8 %sh, C2
=>
%r = icmp ult i8 %x, (C2 << C1)
We did something similar for 'shl' in D28406.
Differential Revision: https://reviews.llvm.org/D38514
llvm-svn: 315021