Kostya Kortchinsky [Thu, 14 Jun 2018 14:33:28 +0000 (14:33 +0000)]
[scudo] Make Secondary linker-initialized compliant
Summary:
As a follow up to D48142 for Scudo, switch the `SpinMutex` to its static
counterpart, and ensure zero-initialization by memset'ing the whole class.
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D48148
llvm-svn: 334716
Simon Pilgrim [Thu, 14 Jun 2018 14:22:03 +0000 (14:22 +0000)]
[EarlyCSE] Fix MSVC build. NFCI.
MSVC doesn't let you assign different lambdas through a ternary operator.
llvm-svn: 334715
Simon Pilgrim [Thu, 14 Jun 2018 14:20:20 +0000 (14:20 +0000)]
[CostModel][AArch64] Add cost tests for ALTERNATE/SELECT style shuffle masks
Precursor to fixing a regression with SLP vectorizer for supporting SELECT shuffles (vs the current ALTERNATE)
llvm-svn: 334714
Sam Clegg [Thu, 14 Jun 2018 14:04:23 +0000 (14:04 +0000)]
[MC] Move MCAssembler::dump into the correct cpp file. NFC
Differential Revision: https://reviews.llvm.org/D46556
llvm-svn: 334713
Sam McCall [Thu, 14 Jun 2018 13:50:30 +0000 (13:50 +0000)]
[clangd] FuzzyMatch: forbid tail-tail matches after a miss: [pat] !~ "panther"
Summary:
This is a small code change but vastly reduces noise in code completion results.
The intent of allowing this was to let [sc] ~ "strncpy" and [strcpy] ~ "strncpy"
however the benefits for unsegmented names aren't IMO worth the costs.
Test cases should be representative of the changes here.
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, cfe-commits
Differential Revision: https://reviews.llvm.org/D47950
llvm-svn: 334712
Sam McCall [Thu, 14 Jun 2018 13:42:21 +0000 (13:42 +0000)]
[clangd] Boost keyword completions.
Summary: These have few signals other than being keywords, so the boost is high.
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, cfe-commits
Differential Revision: https://reviews.llvm.org/D48083
llvm-svn: 334711
Paul Robinson [Thu, 14 Jun 2018 13:38:20 +0000 (13:38 +0000)]
[DWARFv5] Tolerate files not all having an MD5 checksum.
In some cases, for example when compiling a preprocessed file, the
front-end is not able to provide an MD5 checksum for all files. When
that happens, omit the MD5 checksums from the final DWARF, because
DWARF doesn't have a way to indicate that some but not all files have
a checksum.
When assembling a .s file, and some but not all .file directives
provide an MD5 checksum, issue a warning and don't emit MD5 into the
DWARF.
Fixes PR37623.
Differential Revision: https://reviews.llvm.org/D48135
llvm-svn: 334710
Francois Ferrand [Thu, 14 Jun 2018 13:32:14 +0000 (13:32 +0000)]
clang-format: Fix documentation generation
Summary:
It seems that the changes done to `ClangFormatStyleOptions.rst` @334408 are causing the generation of the documentation to fail, with the following error:
Warning, treated as error:
/llvm/tools/clang/docs/ClangFormatStyleOptions.rst:1060: WARNING: Definition list ends without a blank line; unexpected unindent.
This is due to missing indent in some code block, and fixed by this patch.
Reviewers: krasimir, djasper, klimek
Reviewed By: krasimir
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D48161
llvm-svn: 334709
Simon Dardis [Thu, 14 Jun 2018 13:03:53 +0000 (13:03 +0000)]
[mips] Correct predicates for MSA pseudo instructions
llvm-svn: 334708
Max Kazantsev [Thu, 14 Jun 2018 13:02:13 +0000 (13:02 +0000)]
[EarlyCSE] Propagate conditions of AND and OR instructions
This patches teaches EarlyCSE to figure out that if `and i1 %x, %y` is true then both
`%x` and `%y` are true in the taken branch, and if `or i1 %x, %y` is false then both
`%x` and `%y` are false in non-taken branch. Fix for PR37635.
Differential Revision: https://reviews.llvm.org/D47574
Reviewed By: reames
llvm-svn: 334707
Florian Hahn [Thu, 14 Jun 2018 11:56:19 +0000 (11:56 +0000)]
[TableGen] Move some shared_ptrs to avoid unnecessary copies (NFC).
Those changes were suggested post-commit for D47463.
llvm-svn: 334706
Simon Atanasyan [Thu, 14 Jun 2018 11:53:31 +0000 (11:53 +0000)]
[ELF][MIPS] Replace calls to MapVector::find by MapVector::lookup. NFC
llvm-svn: 334705
Bjorn Pettersson [Thu, 14 Jun 2018 11:23:42 +0000 (11:23 +0000)]
[DebugInfo] Check size of variable in ConvertDebugDeclareToDebugValue
Summary:
Do not convert a DbgDeclare to DbgValue if the store
instruction only refer to a fragment of the variable
described by the DbgDeclare.
Problem was seen when for example having an alloca for an
array or struct, and there were stores to individual elements.
In the past we inserted a DbgValue intrinsics for each store,
just as if the store wrote the whole variable.
When handling store instructions we insert a DbgValue that
indicates that the variable is "undefined", as we do not know
which part of the variable that is updated by the store.
When ConvertDebugDeclareToDebugValue is used with a load/phi
instruction we assert that the referenced value is large enough
to cover the whole variable. Afaict this should be true for all
scenarios where those methods are used on trunk. If the assert
blows in the future I guess we could simply skip to insert a
dbg.value instruction.
In the future I think we should examine which part of the variable
that is accessed, and add a DbgValue instrinsic with an appropriate
DW_OP_LLVM_fragment expression.
Reviewers: dblaikie, aprantl, rnk
Reviewed By: aprantl
Subscribers: JDevlieghere, llvm-commits
Tags: #debug-info
Differential Revision: https://reviews.llvm.org/D48024
llvm-svn: 334704
Peter Wu [Thu, 14 Jun 2018 10:42:54 +0000 (10:42 +0000)]
[ASAN] fix startup crash in dlsym for long paths since glibc 2.27
Summary:
Error messages for dlsym used to be stored on the stack, but since
commit
2449ae7b ("ld.so: Introduce struct dl_exception") in glibc 2.27
these are now stored on the heap (and thus use the dlsym alloc pool).
Messages look like "undefined symbol: __isoc99_printf\0/path/to/a.out".
With many missing library functions and long object paths, the pool is
quickly exhausted. Implement a simple mechanism to return freed memory
to the pool (clear it in case it is used for calloc).
Fixes https://github.com/google/sanitizers/issues/957
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D47995
llvm-svn: 334703
Pavel Labath [Thu, 14 Jun 2018 10:31:06 +0000 (10:31 +0000)]
Fix PathMappingListTest on windows
r334615 changed the the value of FileSpec.IsRelative("/") for windows
path syntax. We previously considered it absolute but now it is
considered relative (I guess because it's interpretation depends on the
current drive).
This cause a failure in PathMappingList test, which assumed that "/"
will not get remapped as it is an absolute path. As this is no longer
true on windows, I replace "/" with a really absolute path.
llvm-svn: 334702
Simon Pilgrim [Thu, 14 Jun 2018 10:25:19 +0000 (10:25 +0000)]
[SLPVectorizer] Remove RawInstructionsData/getMainOpcode and merge into getSameOpcode
This is part of the work to cleanup use of 'alternate' ops so we can use the more general SK_Select shuffle type.
Only getSameOpcode calls getMainOpcode and much of the logic is repeated in both functions. This will require some reworking of D28907 but that patch has hit trouble and is unlikely to be completed anytime soon.
Differential Revision: https://reviews.llvm.org/D48120
llvm-svn: 334701
Sven van Haastregt [Thu, 14 Jun 2018 09:51:54 +0000 (09:51 +0000)]
[OpenCL] Support new/delete in Sema
Reject uses of the default new/delete operators with a diagnostic
instead of a crash in OpenCL C++ mode and accept user-defined forms.
Differential Revision: https://reviews.llvm.org/D46651
llvm-svn: 334700
Simon Pilgrim [Thu, 14 Jun 2018 09:48:19 +0000 (09:48 +0000)]
[CostModel] Cleanup isSingleSourceVectorMask to match other shuffle matchers. NFCI.
llvm-svn: 334699
Simon Pilgrim [Thu, 14 Jun 2018 09:35:00 +0000 (09:35 +0000)]
[CostModel] Recognise REVERSE shuffle mask if the elements come from the second src
llvm-svn: 334698
Pavel Labath [Thu, 14 Jun 2018 09:08:54 +0000 (09:08 +0000)]
Fix includes in PlatformAppleSimulator.h
This unbreaks the cmake build. Other plugins also use the include paths
starting with Plugins/..., so I am hoping this will work for the xcode build
too.
llvm-svn: 334697
Luke Geeson [Thu, 14 Jun 2018 08:59:33 +0000 (08:59 +0000)]
[AArch64] reverting rC334693 due to build failures
llvm-svn: 334696
Philip Pfaffe [Thu, 14 Jun 2018 08:54:55 +0000 (08:54 +0000)]
Simplify the implementation of getCUDALibDeviceFunction. NFC.
Summary:
The function is currently awfully complicated. Drop the IILE and use
StringRef over std::string.
Reviewers: Meinersbur, grosser, bollu
Reviewed By: Meinersbur
Subscribers: nemanjai, kbarton, bollu, llvm-commits, pollydev
Differential Revision: https://reviews.llvm.org/D48070
llvm-svn: 334695
Luke Geeson [Thu, 14 Jun 2018 08:51:52 +0000 (08:51 +0000)]
Removed trunk-Codegen directory added in error
llvm-svn: 334694
Luke Geeson [Thu, 14 Jun 2018 08:28:56 +0000 (08:28 +0000)]
[AArch64] Added support for the vcvta_u16_f16 instrinsic for FP16 Armv8.2-A
llvm-svn: 334693
Hans Wennborg [Thu, 14 Jun 2018 08:01:09 +0000 (08:01 +0000)]
[clang-format] Add SpaceBeforeCpp11BracedList option.
WebKit C++ style for object initialization is as follows:
Foo foo { bar };
Yet using clang-format -style=webkit changes this to:
Foo foo{ bar };
As there is no existing combination of rules that will ensure a space
before a braced list in this fashion, this patch adds a new
SpaceBeforeCpp11BracedList rule.
Patch by Ross Kirsling!
Differential Revision: https://reviews.llvm.org/D46024
llvm-svn: 334692
Clement Courbet [Thu, 14 Jun 2018 06:57:52 +0000 (06:57 +0000)]
[llvm-exegesis] Use BenchmarkResult::Instructions instead of OpcodeName
Summary:
Get rid of OpcodeName.
To remove the opcode name from an old file:
```
cat old_file | sed '/opcode_name.*/d'
```
Reviewers: gchatelet
Subscribers: tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D48121
llvm-svn: 334691
Hiroshi Inoue [Thu, 14 Jun 2018 05:41:49 +0000 (05:41 +0000)]
[NFC] fix trivial typos in comments
llvm-svn: 334687
David Carlier [Thu, 14 Jun 2018 04:51:26 +0000 (04:51 +0000)]
[Sanitizer] fix compilation warning
In most of systems, this field is a signed type but in some it is an unsigned.
Reviewers: vitalybuka
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D48118
llvm-svn: 334686
Craig Topper [Thu, 14 Jun 2018 03:16:58 +0000 (03:16 +0000)]
[x86] fix mappings of cvttp2si/cvttp2ui x86 intrinsics to x86-specific nodes and isel patterns (PR37551)
Summary:
The tests in:
https://bugs.llvm.org/show_bug.cgi?id=37751
...show miscompiles because we wrongly mapped and folded x86-specific intrinsics into generic DAG nodes.
This patch corrects the mappings in X86IntrinsicsInfo.h and adds isel matching corresponding to the new patterns. The complete tests for the failure cases should be in avx-cvttp2si.ll and sse-cvttp2si.ll and avx512-cvttp2i.ll
Reviewers: RKSimon, gbedwell, spatel
Reviewed By: spatel
Subscribers: mcrosier, llvm-commits
Differential Revision: https://reviews.llvm.org/D47993
llvm-svn: 334685
Artem Dergachev [Thu, 14 Jun 2018 01:59:35 +0000 (01:59 +0000)]
[analyzer] Re-enable C++17-specific RVO construction contexts.
Not contexts themselves, but rather support for them in the analyzer.
Such construction contexts appear when C++17 mandatory copy elision occurs
while returning an object from a function, and presence of a destructor causes
a CXXBindTemporaryExpr to appear in the AST.
Additionally, such construction contexts may be chained, because a return-value
construction context doesn't really explain where the object is being returned
into, but only points to the parent stack frame, where the object may be
consumed by literally anything including another return statement. This
behavior is now modeled correctly by the analyzer as long as the object is not
returned beyond the boundaries of the analysis.
Differential Revision: https://reviews.llvm.org/D47405
llvm-svn: 334684
Artem Dergachev [Thu, 14 Jun 2018 01:54:21 +0000 (01:54 +0000)]
[analyzer] Re-enable C++17-specific variable and member construction contexts.
Not contexts themselves, but rather support for them in the analyzer.
Such construction contexts appear when C++17 mandatory copy elision occurs
during initialization, and presence of a destructor causes a
CXXBindTemporaryExpr to appear in the AST.
Similar C++17-specific constructors for return values are still to be supported.
Differential Revision: https://reviews.llvm.org/D47351
llvm-svn: 334683
Artem Dergachev [Thu, 14 Jun 2018 01:40:49 +0000 (01:40 +0000)]
[analyzer] Track class member initializer constructors path-sensitively.
The reasoning behind this change is similar to the previous commit, r334681.
Because members are already in scope when construction occurs, we are not
suffering from liveness problems, but we still want to figure out if the object
was constructed with construction context, because in this case we'll be able
to avoid trivial copy, which we don't always model perfectly. It'd also have
more importance when copy elision is implemented.
This also gets rid of the old CFG look-behind mechanism.
Differential Revision: https://reviews.llvm.org/D47350
llvm-svn: 334682
Artem Dergachev [Thu, 14 Jun 2018 01:32:46 +0000 (01:32 +0000)]
[analyzer] pr37270: Track constructor target region, even if just a variable.
The very idea of construction context implies that first the object is
constructed, and then later, in a separate moment of time, the constructed
object goes into scope, i.e. becomes "live".
Most construction contexts require path-sensitive tracking of the constructed
object region in order to compute the outer expressions accordingly before
the object becomes live.
Semantics of simple variable construction contexts don't immediately require
that such tracking happens in path-sensitive manner, but shortcomings of the
analyzer force us to track it path-sensitively as well. Namely, whether
construction context was available at all during construction is a
path-sensitive information. Additionally, path-sensitive tracking takes care of
our liveness problems that kick in as the temporal gap between construction and
going-into-scope becomes larger (eg., due to copy elision).
Differential Revision: https://reviews.llvm.org/D47305
llvm-svn: 334681
Jason Molenda [Thu, 14 Jun 2018 01:29:18 +0000 (01:29 +0000)]
fix cmake include path.
llvm-svn: 334680
Matt Davis [Thu, 14 Jun 2018 01:20:18 +0000 (01:20 +0000)]
[llvm-mca] Introduce the ExecuteStage (was originally the Scheduler class).
Summary: This patch transforms the Scheduler class into the ExecuteStage. Most of the logic remains.
Reviewers: andreadb, RKSimon, courbet
Reviewed By: andreadb
Subscribers: mgorny, javed.absar, tschuett, gbedwell, llvm-commits
Differential Revision: https://reviews.llvm.org/D47246
llvm-svn: 334679
Artem Dergachev [Thu, 14 Jun 2018 01:20:12 +0000 (01:20 +0000)]
[analyzer] NFC: Merge code for finding and tracking construction target.
When analyzing C++ code, a common operation in the analyzer is to discover
target region for object construction by looking at CFG metadata ("construction
contexts"), and then track the region path-sensitively until object construction
is resolved, where the amount of information, again, depends on construction
context.
Scan construction context only once for both purposes.
Differential Revision: https://reviews.llvm.org/D47304
llvm-svn: 334678
Richard Smith [Thu, 14 Jun 2018 00:40:20 +0000 (00:40 +0000)]
P0096R5, P0941R2: Update to match latest feature test macro specification.
llvm-svn: 334677
Stephan T. Lavavej [Thu, 14 Jun 2018 00:12:20 +0000 (00:12 +0000)]
[libcxx] [test] Strip trailing whitespace. NFC.
llvm-svn: 334676
Stephan T. Lavavej [Thu, 14 Jun 2018 00:12:14 +0000 (00:12 +0000)]
[libcxx] [test] Update msvc_stdlib_force_include.hpp.
MSVC's STL removed _SCL_SECURE_NO_WARNINGS.
MSVC's STL implemented feature-test macros.
llvm-svn: 334675
Richard Smith [Thu, 14 Jun 2018 00:05:28 +0000 (00:05 +0000)]
[www] Update cxx_status page for Rapperswil motions.
llvm-svn: 334674
Peter Collingbourne [Thu, 14 Jun 2018 00:03:41 +0000 (00:03 +0000)]
Driver: De-duplicate some code. NFCI.
llvm-svn: 334673
Fangrui Song [Wed, 13 Jun 2018 23:29:28 +0000 (23:29 +0000)]
[ELF][X86_64] Use R_GOTREL_FROM_END instead of R_GOTREL for R_X86_64_GOTOFF64
Summary:
R_X86_64_GOTOFF64: S + A - GOT
R_X86_64_GOTPC{32,64}: GOT + A - P (R_GOTONLY_PC_FROM_END)
R_X86_64_GOTOFF64 should use R_GOTREL_FROM_END so that in conjunction with
R_X86_64_GOTPC{32,64}, the `GOT` term is neutralized. This also matches
the handling of R_386_GOTOFF (S + A - GOT).
Reviewers: ruiu, espindola
Subscribers: emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D48095
llvm-svn: 334672
Peter Collingbourne [Wed, 13 Jun 2018 23:21:02 +0000 (23:21 +0000)]
docs: Add a missing LTO visibility reference.
llvm-svn: 334671
Peter Wu [Wed, 13 Jun 2018 23:19:21 +0000 (23:19 +0000)]
[ASAN] Fix fputs interception for 32-bit macOS
On 32-bit macOS, "_fputs$UNIX2003" is called instead of "fputs" and the
"fgets_fputs" test fails. Apparently previous versions still passed the
test due to the internal implementation calling "strlen", but that does
not seem to be the case with macOS 10.13.3. Fixes r334450.
llvm-svn: 334670
Peter Collingbourne [Wed, 13 Jun 2018 23:18:26 +0000 (23:18 +0000)]
docs: Correct some misstatements in the control flow integrity docs.
These were true at one point but haven't been true for a long time.
llvm-svn: 334669
Jonas Devlieghere [Wed, 13 Jun 2018 22:54:52 +0000 (22:54 +0000)]
[FileSpec] Make style argument mandatory for SetFile. NFC
Update SetFile uses in the unittests.
llvm-svn: 334668
Jason Molenda [Wed, 13 Jun 2018 22:37:01 +0000 (22:37 +0000)]
Move the header file to be in the same new place as the .mm file.
llvm-svn: 334667
Jason Molenda [Wed, 13 Jun 2018 22:33:27 +0000 (22:33 +0000)]
Fix group entry.
llvm-svn: 334666
Tom Stellard [Wed, 13 Jun 2018 22:30:47 +0000 (22:30 +0000)]
AMDGPU/GlobalISel: Implement select() for 32-bit G_FADD and G_FMUL
Reviewers: arsenm, nhaehnle
Reviewed By: arsenm
Subscribers: kzhuravl, wdng, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D46171
llvm-svn: 334665
Jonas Devlieghere [Wed, 13 Jun 2018 22:23:48 +0000 (22:23 +0000)]
[FileSpec] Make style argument mandatory for SetFile. NFC
Fix SetFile uses in hosts that I missed in r334663.
llvm-svn: 334664
Jonas Devlieghere [Wed, 13 Jun 2018 22:08:14 +0000 (22:08 +0000)]
[FileSpec] Make style argument mandatory for SetFile. NFC
SetFile has an optional style argument which defaulted to the native
style. This patch makes that argument mandatory so clients of the
FileSpec class are forced to think about the correct syntax.
At the same time this introduces a (protected) convenience method to
update the file from within the FileSpec class that keeps the current
style.
These two changes together prevent a potential pitfall where the style
might be forgotten, leading to the path being updated and the style
unintentionally being changed to the host style.
llvm-svn: 334663
Jason Molenda [Wed, 13 Jun 2018 22:05:38 +0000 (22:05 +0000)]
Fix macos xcode build.
llvm-svn: 334662
Tobias Grosser [Wed, 13 Jun 2018 21:46:29 +0000 (21:46 +0000)]
[test] Fix a typo in a test case [NFCI]
Also remove an undef value that does not add any value to the test case.
llvm-svn: 334661
Alex Shlyapnikov [Wed, 13 Jun 2018 21:45:01 +0000 (21:45 +0000)]
[Sanitizers] Make sanitizer allocator linker-initialize compliant.
Summary:
These four SpinMutex ctors was the only code executed in the ctor for
the static __asan::Allocator instance (same for the other sanitizers
allocators), which is supposed to be fully linker-initialized.
Also, when the global ctor for this allocator instance is executed,
this instance might already be initialized by __asan_init called from
.preinit_array.
Issue: https://github.com/google/sanitizers/issues/194
Reviewers: morehouse, eugenis, cryptoad
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D48142
llvm-svn: 334660
Dimitry Andric [Wed, 13 Jun 2018 21:37:49 +0000 (21:37 +0000)]
Disable MSan tests of prlimit on FreeBSD
Like NetBSD, FreeBSD does not have prlimit(2), so do not attempt to use
it during the MSan tests.
llvm-svn: 334659
Zachary Turner [Wed, 13 Jun 2018 21:24:19 +0000 (21:24 +0000)]
Revert "Enable ThreadPool to queue tasks that return values."
This is failing to compile when LLVM_ENABLE_THREADS is false,
and the fix is not immediately obvious, so reverting while I look
into it.
llvm-svn: 334658
Francis Visoiu Mistrih [Wed, 13 Jun 2018 21:03:56 +0000 (21:03 +0000)]
Reland: [Timers] Use the pass argument name for JSON keys in time-passes
When using clang --save-stats -mllvm -time-passes, both timers and stats
end up in the same json file.
We could end up with things like:
{
"asm-printer.EmittedInsts": 1,
"time.pass.Virtual Register Map.wall": 2.
9015541076660156e-04,
"time.pass.Virtual Register Map.user": 2.
0500000000000379e-04,
"time.pass.Virtual Register Map.sys": 8.
5000000000001741e-05,
}
This patch makes use of the pass argument name (if available) in the
JSON key to end up with things like:
{
"asm-printer.EmittedInsts": 1,
"time.pass.virtregmap.wall": 2.
9015541076660156e-04,
"time.pass.virtregmap.user": 2.
0500000000000379e-04,
"time.pass.virtregmap.sys": 8.
5000000000001741e-05,
}
This also helps avoiding to write another JSON printer to handle all the
cases that we could have in our pass names.
Fixed test instead of adding a new one originally from r334649.
Differential Revision: https://reviews.llvm.org/D48109
llvm-svn: 334657
Florian Hahn [Wed, 13 Jun 2018 20:59:53 +0000 (20:59 +0000)]
[TableGen] Make getOnlyTree return a const ref (NFC)
This avoids some unnecessary copies of shared_ptrs.
Those changes were suggested post-commit for D47463.
llvm-svn: 334656
George Karpenkov [Wed, 13 Jun 2018 20:48:53 +0000 (20:48 +0000)]
Update comments of CheckedArithmetic API based on Philip Reames feedback.
llvm-svn: 334655
Shoaib Meenai [Wed, 13 Jun 2018 20:48:30 +0000 (20:48 +0000)]
[compiler-rt] Use CMAKE_LINKER instead of hardcoding ld
Respect a custom linker path provided by the user if one is present
(otherwise CMAKE_LINKER will have been set to the right value by CMake).
llvm-svn: 334654
Reid Kleckner [Wed, 13 Jun 2018 20:47:21 +0000 (20:47 +0000)]
[WinASan] Don't instrument globals in sections containing '$'
Such globals are very likely to be part of a sorted section array, such
the .CRT sections used for dynamic initialization. The uses its own
sorted sections called ATL$__a, ATL$__m, and ATL$__z. Instead of special
casing them, just look for the dollar sign, which is what invokes linker
section sorting for COFF.
Avoids issues with ASan and the ATL uncovered after we started
instrumenting comdat globals on COFF.
llvm-svn: 334653
Erich Keane [Wed, 13 Jun 2018 20:47:12 +0000 (20:47 +0000)]
Simplify test from r334650
No reason to have the 'bool' as an intermediary value,
simply use the fact that curley braces enforce eval order.
llvm-svn: 334652
Francis Visoiu Mistrih [Wed, 13 Jun 2018 20:44:02 +0000 (20:44 +0000)]
Revert r334649 "[Timers] Use the pass argument name for JSON keys in time-passes"
This reverts commit r334649.
This breaks a test.
llvm-svn: 334651
Erich Keane [Wed, 13 Jun 2018 20:43:27 +0000 (20:43 +0000)]
Implement constexpr __builtin_*_overflow
As requested here:https://bugs.llvm.org/show_bug.cgi?id=37633
permit the __builtin_*_overflow builtins in constexpr functions.
Differential Revision: https://reviews.llvm.org/D48040
llvm-svn: 334650
Francis Visoiu Mistrih [Wed, 13 Jun 2018 20:09:59 +0000 (20:09 +0000)]
[Timers] Use the pass argument name for JSON keys in time-passes
When using clang --save-stats -mllvm -time-passes, both timers and stats
end up in the same json file.
We could end up with things like:
{
"asm-printer.EmittedInsts": 1,
"time.pass.Virtual Register Map.wall": 2.
9015541076660156e-04,
"time.pass.Virtual Register Map.user": 2.
0500000000000379e-04,
"time.pass.Virtual Register Map.sys": 8.
5000000000001741e-05,
}
This patch makes use of the pass argument name (if available) in the
JSON key to end up with things like:
{
"asm-printer.EmittedInsts": 1,
"time.pass.virtregmap.wall": 2.
9015541076660156e-04,
"time.pass.virtregmap.user": 2.
0500000000000379e-04,
"time.pass.virtregmap.sys": 8.
5000000000001741e-05,
}
This also helps avoiding to write another JSON printer to handle all the
cases that we could have in our pass names.
Differential Revision: https://reviews.llvm.org/D48109
llvm-svn: 334649
Craig Topper [Wed, 13 Jun 2018 20:03:42 +0000 (20:03 +0000)]
[X86] Move RCPSSr_Int, RSQRTSSr_Int, SQRTSDr_Int, SQRTSSr_Int to the correct load folding table.
They were in the operand 1 folding table, but their foldable operand is operand 2.
llvm-svn: 334648
Rui Ueyama [Wed, 13 Jun 2018 19:58:33 +0000 (19:58 +0000)]
Remove needless bitwise-AND.
Because applyMask ignores upper bits, we don't need to mask them.
llvm-svn: 334647
Rui Ueyama [Wed, 13 Jun 2018 19:50:10 +0000 (19:50 +0000)]
Make a function non-member because it doesn't depend on any class.
llvm-svn: 334646
Rui Ueyama [Wed, 13 Jun 2018 19:49:58 +0000 (19:49 +0000)]
Apply clang-format.
llvm-svn: 334645
Zachary Turner [Wed, 13 Jun 2018 19:37:41 +0000 (19:37 +0000)]
Add missing #include.
llvm-svn: 334644
Zachary Turner [Wed, 13 Jun 2018 19:29:16 +0000 (19:29 +0000)]
Enable ThreadPool to support tasks that return values.
Previously ThreadPool could only queue async "jobs", i.e. work
that was done for its side effects and not for its result. It's
useful occasionally to queue async work that returns a value.
From an API perspective, this is very intuitive. The previous
API just returned a shared_future<void>, so all we need to do is
make it return a shared_future<T>, where T is the type of value
that the operation returns.
Making this work required a little magic, but ultimately it's not
too bad. Instead of keeping a shared queue<packaged_task<void()>>
we just keep a shared queue<unique_ptr<TaskBase>>, where TaskBase
is a class with a pure virtual execute() method, then have a
templated derived class that stores a packaged_task<T()>. Everything
else works out pretty cleanly.
Differential Revision: https://reviews.llvm.org/D48115
llvm-svn: 334643
Stella Stamenova [Wed, 13 Jun 2018 19:02:44 +0000 (19:02 +0000)]
[lit] Split test_set_working_dir TestProcessLaunch into two tests and fix it on Windows
Summary:
test_set_working_dir was testing two scenario: failure to set the working dir because of a non existent directory and succeeding to set the working directory. Since the negative case fails on both Linux and Windows, the positive case was never tested. I split the test into two which allows us to always run both the negative and positive cases. The positive case now succeeds on Linux and the negative case still fails.
During the investigation, it turned out that lldbtest.py will try to execute a process launch command up to 3 times if the command failed. This means that we could be covering up intermittent failures by running any test that does process launch multiple times without ever realizing it. I've changed the counter to 1 (though it can still be overwritten with the environment variable).
This change also fixes both the positive and negative cases on Windows. There were a few issues:
1) In ProcessLauncherWindows::LaunchProcess, the error was not retrieved until CloseHandle was possibly called. Since CloseHandle is also a system API, its success would overwrite any existing error that could be retrieved using GetLastError. So by the time the error was retrieved, it was now a success.
2) In DebuggerThread::StopDebugging TerminateProcess was called on the process handle regardless of whether it was a valid handle. This was causing the process to crash when the handle was LLDB_INVALID_PROCESS (0xFFFFFFFF).
3) In ProcessWindows::DoLaunch we need to check that the working directory exists before launching the process to have the same behavior as other platforms which first check the directory and then launch process. This way we also control the exact error string.
Reviewers: labath, zturner, asmith, jingham
Reviewed By: labath
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D48050
llvm-svn: 334642
Brian Gesiak [Wed, 13 Jun 2018 18:59:14 +0000 (18:59 +0000)]
[Darwin] Do not error on '-lto_library' option
Summary:
Any invocation of `clang -fuse-ld=lld` that results in a link command
on a macOS host currently fails, because the Darwin lld driver does not
recognize the `-lto_library` option that Clang passes it. Fix the error
by having the Darwin driver ignore the option.
The Clang driver's macOS toolchain is written such that it will always
pass the `-lto_library` option to the linker invocation on a macOS host.
And although the DarwinLdDriver is written to ignore any unknown arguments,
because `-lto_library` begins with `-l`, the DarwinLdDriver interprets it
as a library search command, for a library named "to_library". When the
DarwinLdDriver is unable to find a library specified via `-l`, it exits
with a hard error. This causes any invocation of `clang -fuse-ld=lld`
that results in a link command on a macOS host to fail with an error.
To fix the issue, I considered two alternatives:
1. Modify the Clang Darwin toolchain to only pass `-lto_library` if lld
is *not* being used. lld doesn't support LTO on Darwin anyway, so it
can't use the option. However, I opted against this because, if and
when lld *does* support LTO on Darwin, I'll have to make another
commit to Clang in order to get it to pass the option to lld again.
2. Modify the Darwin lld driver to ignore the `-lto_library` option.
Just in case users may take this to mean LTO is supported, I also
added a warning. If and when lld supports LTO on Darwin, the same
commit that adds support for this option can remove the warning.
Option (2) seemed better to me, and is the rationale behind this commit.
Test Plan: check-lld
Reviewers: ruiu, smeenai, pcc
Reviewed By: smeenai
Subscribers: JDevlieghere, pcc, mehdi_amini, inglorion, steven_wu, llvm-commits
Differential Revision: https://reviews.llvm.org/D47994
llvm-svn: 334641
Stanislav Mekhanoshin [Wed, 13 Jun 2018 18:52:54 +0000 (18:52 +0000)]
[AMDGPU] Corrected computeKnownBits for V_PERM_B32
Differential Revision: https://reviews.llvm.org/D48133
llvm-svn: 334640
Mandeep Singh Grang [Wed, 13 Jun 2018 18:49:35 +0000 (18:49 +0000)]
[COFF] Add ARM64 intrinsics: __yield, __wfe, __wfi, __sev, __sevl
Summary: These intrinsics result in hint instructions. They are provided here for MSVC ARM64 compatibility.
Reviewers: mstorsjo, compnerd, javed.absar
Reviewed By: mstorsjo
Subscribers: kristof.beyls, chrib, cfe-commits
Differential Revision: https://reviews.llvm.org/D48132
llvm-svn: 334639
Jonas Devlieghere [Wed, 13 Jun 2018 18:47:04 +0000 (18:47 +0000)]
[ObjC] Add dataformatter for NSDecimalNumber
This patch adds a data formatter for NSDecimalNumber. The latter is a
Foundation object used for representing and performing arithmetic on
base-10 numbers that bridges to Decimal.
Differential revision: https://reviews.llvm.org/D48114
llvm-svn: 334638
Sid Manning [Wed, 13 Jun 2018 18:45:25 +0000 (18:45 +0000)]
Add Hexagon Support
Differential Revision: https://reviews.llvm.org/D47791
llvm-svn: 334637
George Karpenkov [Wed, 13 Jun 2018 18:32:19 +0000 (18:32 +0000)]
[analyzer] Fix offset overflow check in MemRegion
rdar://
39593879
https://bugs.llvm.org/show_bug.cgi?id=37142
Differential Revision: https://reviews.llvm.org/D48139
llvm-svn: 334636
George Karpenkov [Wed, 13 Jun 2018 18:32:02 +0000 (18:32 +0000)]
Add checkMulAdd helper function to CheckedArithmetic
Multiplication followed by addition
(https://en.wikipedia.org/wiki/Multiply–accumulate_operation) is a
sufficiently common use-case to warrant a separate helper.
Differential Revision: https://reviews.llvm.org/D48138
llvm-svn: 334635
George Karpenkov [Wed, 13 Jun 2018 18:31:43 +0000 (18:31 +0000)]
Change checked arithmetic functions API to return Optional
Returning optional is much safer.
The previous API had potential to cause use of undefined variables, if
the value passed by pointer was accidentally read afterwards.
Differential Revision: https://reviews.llvm.org/D48137
llvm-svn: 334634
Andrea Di Biagio [Wed, 13 Jun 2018 18:30:14 +0000 (18:30 +0000)]
[llvm-mca] Fixed a bug in the logic that checks if a memory operation is ready to execute.
Fixes PR37790.
In some (very rare) cases, the LSUnit (Load/Store unit) was wrongly marking a
load (or store) as "ready to execute" effectively bypassing older memory barrier
instructions.
To reproduce this bug, the memory barrier must be the first instruction in the
input assembly sequence, and it doesn't have to perform any register writes.
llvm-svn: 334633
Jordan Rose [Wed, 13 Jun 2018 18:21:47 +0000 (18:21 +0000)]
[CMake] Handle 'libtool' being at a path with spaces in it.
This can happen on macOS if the user's Xcode is at a path with spaces in it.
llvm-svn: 334632
Jonas Devlieghere [Wed, 13 Jun 2018 18:15:14 +0000 (18:15 +0000)]
[ObjC] Use llvm::StringRef in summary providers
Replace const char pointers with llvm::StringRef and use its equality
operator for string comparisons.
llvm-svn: 334631
Peter Collingbourne [Wed, 13 Jun 2018 18:03:14 +0000 (18:03 +0000)]
LTO: Keep file handles open for memory mapped files.
On Windows we've observed that if you open a file, write to it, map it into
memory and close the file handle, the contents of the memory mapping can
sometimes be incorrect. That was what we did when adding an entry to the
ThinLTO cache using the TempFile and MemoryBuffer classes, and it was causing
intermittent build failures on Chromium's ThinLTO bots on Windows. More
details are in the associated Chromium bug (crbug.com/786127).
We can prevent this from happening by keeping a handle to the file open while
the mapping is active. So this patch changes the mapped_file_region class to
duplicate the file handle when mapping the file and close it upon unmapping it.
One gotcha is that the file handle that we keep open must not have been
created with FILE_FLAG_DELETE_ON_CLOSE, as otherwise the operating system
will prevent other processes from opening the file. We can achieve this
by avoiding the use of FILE_FLAG_DELETE_ON_CLOSE altogether. Instead,
we use SetFileInformationByHandle with FileDispositionInfo to manage the
delete-on-close bit. This lets us remove the hack that we used to use to
clear the delete-on-close bit on a file opened with FILE_FLAG_DELETE_ON_CLOSE.
A downside of using SetFileInformationByHandle/FileDispositionInfo as
opposed to FILE_FLAG_DELETE_ON_CLOSE is that it prevents us from using
CreateFile to open the file while the flag is set, even within the same
process. This doesn't seem to matter for almost every client of TempFile,
except for LockFileManager, which calls sys::fs::create_link to create a
hard link from the lock file, and in the process of doing so tries to open
the file. To prevent this change from breaking LockFileManager I changed it
to stop using TempFile by effectively reverting r318550.
Differential Revision: https://reviews.llvm.org/D48051
llvm-svn: 334630
Craig Topper [Wed, 13 Jun 2018 17:55:13 +0000 (17:55 +0000)]
[X86] Add one more intrinsic and test cases to avx512-cvttp2i.ll.
spatel noticed it was missing in D47993.
llvm-svn: 334629
Sanjay Patel [Wed, 13 Jun 2018 17:54:52 +0000 (17:54 +0000)]
[CodeGen] make nan builtins pure rather than const (PR37778)
https://bugs.llvm.org/show_bug.cgi?id=37778
...shows a miscompile resulting from marking nan builtins as 'const'.
The nan libcalls/builtins take a pointer argument:
http://www.cplusplus.com/reference/cmath/nan-function/
...and the chars dereferenced by that arg are used to fill in the NaN constant payload bits.
"const" means that the pointer argument isn't dereferenced. That's translated to "readnone" in LLVM.
"pure" means that the pointer argument may be dereferenced. That's translated to "readonly" in LLVM.
This change prevents the IR optimizer from killing the lead-up to the nan call here:
double a() {
char buf[4];
buf[0] = buf[1] = buf[2] = '9';
buf[3] = '\0';
return __builtin_nan(buf);
}
...the optimizer isn't currently able to simplify this to a constant as we might hope,
but this patch should solve the miscompile.
Differential Revision: https://reviews.llvm.org/D48134
llvm-svn: 334628
Saleem Abdulrasool [Wed, 13 Jun 2018 17:51:27 +0000 (17:51 +0000)]
IR: fix documentation markup
Use `\brief` instead of `\Brief`. NFC.
llvm-svn: 334627
Ahmed Bougacha [Wed, 13 Jun 2018 17:46:17 +0000 (17:46 +0000)]
[ASAN] Re-enable fgets_fputs test for darwin.
It seems to be passing, at least on the bots I've seen.
llvm-svn: 334626
Yaxun Liu [Wed, 13 Jun 2018 17:31:51 +0000 (17:31 +0000)]
[AMDGPU] Change enqueue kernel handle type
Currently the handle type is a global pointer which holds 8 bytes.
We need a larger type which hold 16 bytes, therefore change it
to [i64 x 2].
Differential Revision: https://reviews.llvm.org/D48094
llvm-svn: 334625
Alex Shlyapnikov [Wed, 13 Jun 2018 17:18:41 +0000 (17:18 +0000)]
[TSan] Fix madvise(MADV_NOHUGEPAGE) for meta shadow memory
Summary:
Move madvise(MADV_NOHUGEPAGE) for the meta shadow memory after the meta
shadow memory is mapped (currently it silently fails with ENOMEM).
Add a diagnostic message to detect similar problems in the future.
Reviewers: dvyukov
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D48097
llvm-svn: 334624
Simon Pilgrim [Wed, 13 Jun 2018 17:12:11 +0000 (17:12 +0000)]
[CostModel][X86] Test showing failure to recognise REVERSE shuffle mask if the elements come from the second src
llvm-svn: 334623
Dmitry Preobrazhensky [Wed, 13 Jun 2018 17:02:03 +0000 (17:02 +0000)]
[AMDGPU][MC] Enabled parsing of relocations on VALU instructions
See bug 37566: https://bugs.llvm.org/show_bug.cgi?id=37566
Reviewers: artem.tamazov, arsenm, nhaehnle
Differential Revision: https://reviews.llvm.org/D47884
llvm-svn: 334622
Simon Pilgrim [Wed, 13 Jun 2018 16:52:02 +0000 (16:52 +0000)]
[CostModel] Recognise BROADCAST shuffle mask if the elements come from the second src
llvm-svn: 334620
Benjamin Kramer [Wed, 13 Jun 2018 16:45:12 +0000 (16:45 +0000)]
[Basic] Fix -Wreorder warning
Just use field initializers that don't suffer from this problem
llvm-svn: 334619
Jonas Devlieghere [Wed, 13 Jun 2018 16:36:07 +0000 (16:36 +0000)]
[FileSpec] Simplify getting extension and stem.
As noted by Pavel on lldb-commits, we don't need the temp path, we can
just pass the filename directly into extension() and path().
llvm-svn: 334618
Andrea Di Biagio [Wed, 13 Jun 2018 16:33:52 +0000 (16:33 +0000)]
Revert: [llvm-mca] Flush the output stream before we start the analysis of a new code region. NFC
Not sure why, but it breaks buildbot clang-cmake-armv8-full.
It causes a failure in TEST 'Xray-armhf-linux :: TestCases/Posix/profiling-single-threaded.cc'.
llvm-svn: 334617
Simon Pilgrim [Wed, 13 Jun 2018 16:33:42 +0000 (16:33 +0000)]
[CostModel][X86] Test showing failure to recognise BROADCAST shuffle mask if the elements come from the second src
llvm-svn: 334616
Jonas Devlieghere [Wed, 13 Jun 2018 16:23:21 +0000 (16:23 +0000)]
[FileSpec] Delegate common operations to llvm::sys::path
With the recent changes in FileSpec to use LLVM's path style, it is
possible to delegate a bunch of common path operations to LLVM's path
helpers. This means we only have to maintain a single implementation and
at the same time can benefit from the efforts made by the rest of the
LLVM community.
This is part one of a set of patches. There was no obvious way to split
this so I just worked from top to bottom.
Differential revision: https://reviews.llvm.org/D48084
llvm-svn: 334615
Adrian Prantl [Wed, 13 Jun 2018 16:21:24 +0000 (16:21 +0000)]
Fix/unify the spelling of Objective-C.
llvm-svn: 334614
Stefan Pintilie [Wed, 13 Jun 2018 16:05:05 +0000 (16:05 +0000)]
[PowerPC] The __float128 type should only be available on Power9
Diasble the use of the type __float128 for PPC machines older
than Power9.
The use of -mfloat128 for PPC machine older than Power9 will result
in an error.
Differential Revision: https://reviews.llvm.org/D48088
llvm-svn: 334613