Sylvestre Ledru [Thu, 10 May 2018 08:45:43 +0000 (08:45 +0000)]
Add support of the next Ubuntu (Ubuntu 18.10 - Cosmic Canimal)
Patch by Adam Conrad
llvm-svn: 331965
Vitaly Buka [Thu, 10 May 2018 08:16:23 +0000 (08:16 +0000)]
[sanitizer] Attempt to fix strace_test.cc on ppc64le
llvm-svn: 331964
Eric Fiselier [Thu, 10 May 2018 08:10:57 +0000 (08:10 +0000)]
Revert "[Itanium] Emit type info names with external linkage."
This reverts commit r331957. It seems to be causing failures
on ppc64le-linux.
llvm-svn: 331963
Gabor Buella [Thu, 10 May 2018 07:28:54 +0000 (07:28 +0000)]
[X86] ptwrite intrinsic
Reviewers: craig.topper, RKSimon
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D46540
llvm-svn: 331962
Gabor Buella [Thu, 10 May 2018 07:26:05 +0000 (07:26 +0000)]
[X86] ptwrite intrinsic
Reviewers: craig.topper, RKSimon
Reviewed By: craig.topper, RKSimon
Differential Revision: https://reviews.llvm.org/D46539
llvm-svn: 331961
Tobias Grosser [Thu, 10 May 2018 07:09:10 +0000 (07:09 +0000)]
Adjust to debug info metadata format change.
Rename variable to retainedNodes. This unbreaks the Polly builds.
llvm-svn: 331960
Craig Topper [Thu, 10 May 2018 05:43:43 +0000 (05:43 +0000)]
[X86] Change the implementation of scalar masked load/store intrinsics to not use a 512-bit intermediate vector.
This is unnecessary for AVX512VL supporting CPUs like SKX. We can just emit a 128-bit masked load/store here no matter what. The backend will widen it to 512-bits on KNL CPUs.
Fixes the frontend portion of PR37386. Need to fix the backend to optimize the new sequences well.
llvm-svn: 331958
Eric Fiselier [Thu, 10 May 2018 05:25:15 +0000 (05:25 +0000)]
[Itanium] Emit type info names with external linkage.
Summary:
The Itanium ABI requires that the type info for pointer-to-incomplete types to have internal linkage, so that it doesn't interfere with the type info once completed. Currently it also marks the type info name as internal as well. However, this causes a bug with the STL implementations, which use the type info name pointer to perform ordering and hashing of type infos.
For example:
```
// header.h
struct T;
extern std::type_info const& Info;
// tu_one.cpp
#include "header.h"
std::type_info const& Info = typeid(T*);
// tu_two.cpp
#include "header.h"
struct T {};
int main() {
auto &TI1 = Info;
auto &TI2 = typeid(T*);
assert(TI1 == TI2); // Fails
assert(TI1.hash_code() == TI2.hash_code()); // Fails
}
```
This patch fixes the STL bug by emitting the type info name as linkonce_odr when the type-info is for a pointer-to-incomplete type.
Note that libc++ could fix this without a compiler change, but the quality of fix would be poor. The library would either have to:
(A) Always perform strcmp/string hashes.
(B) Determine if we have a pointer-to-incomplete type, and only do strcmp then. This would require an ABI break for libc++.
Reviewers: rsmith, rjmccall, majnemer, vsapsai
Reviewed By: rjmccall
Subscribers: smeenai, cfe-commits
Differential Revision: https://reviews.llvm.org/D46665
llvm-svn: 331957
Vitaly Buka [Thu, 10 May 2018 04:21:41 +0000 (04:21 +0000)]
[sanitizer] Fix typo in comment
llvm-svn: 331956
Vitaly Buka [Thu, 10 May 2018 04:16:44 +0000 (04:16 +0000)]
[sanitizer] Renamed local variable
llvm-svn: 331955
Vitaly Buka [Thu, 10 May 2018 04:10:09 +0000 (04:10 +0000)]
[sanitizer] Fix compilation after invalid rebase
llvm-svn: 331954
Vitaly Buka [Thu, 10 May 2018 04:02:59 +0000 (04:02 +0000)]
[sanitizer] Don't miss threads by ThreadSuspender
Summary:
Enumerating /proc/<pid>/task/ dir Linux may stop if thread is dead. In this case
we miss some alive threads and can report false memory leaks.
To solve this issue we repeat enumeration if the last thread is dead.
Do detect dead threads same way as proc_task_readdir we use
/proc/<pid>/task/<tid>/status.
Similarly it also ends enumeration of if proc_fill_cache fails, but in this case
Linux sets inode to 1 (Bad block).
And just in case re-list threads if we had to call internal_getdents more than
twice or result takes more than half of the buffer.
Reviewers: eugenis, dvyukov, glider
Subscribers: llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D46517
llvm-svn: 331953
Douglas Yung [Thu, 10 May 2018 03:06:42 +0000 (03:06 +0000)]
Fix tests added in r331924 so that they work on Windows.
The test needed to check for the optional executable extension (llvm-objcopy.EXE).
llvm-svn: 331952
Kostya Serebryany [Thu, 10 May 2018 02:02:41 +0000 (02:02 +0000)]
[libFuzzer] add a simple puzzle that is difficult for today's libFuzzer
llvm-svn: 331951
Serguei Katkov [Thu, 10 May 2018 01:42:59 +0000 (01:42 +0000)]
[SCEV] Add missed Test for rL331949.
llvm-svn: 331950
Serguei Katkov [Thu, 10 May 2018 01:40:43 +0000 (01:40 +0000)]
SCEV] Do not use induction in isKnownPredicate for simplification umax.
During simplification umax we trigger isKnownPredicate twice. As a first attempt it
tries the induction. To do that it tries to get post increment of SCEV.
Re-writing the SCEV may result in simplification of umax. If the SCEV contains a lot
of umax operations this recursion becomes very slow.
The added test demonstrates the slow behavior.
To resolve this we use only simple ways to check whether the predicate is known.
Reviewers: sanjoy, mkazantsev
Reviewed By: sanjoy
Subscribers: lebedev.ri, javed.absar, llvm-commits
Differential Revision: https://reviews.llvm.org/D46046
llvm-svn: 331949
Craig Topper [Thu, 10 May 2018 00:53:25 +0000 (00:53 +0000)]
[InstCombine] Reorder an if condition to put a cheap check in front of a computeKnownBits call. NFC
llvm-svn: 331948
Craig Topper [Thu, 10 May 2018 00:53:22 +0000 (00:53 +0000)]
[InstCombine] Use APInt::getBitsSetFrom to shortern a line and fix an 80 columns violation. NFC
Fix a similar line in the same function.
llvm-svn: 331947
Chris Matthews [Thu, 10 May 2018 00:08:39 +0000 (00:08 +0000)]
[LIT] Add the missing file
I forgot to commit this file.
llvm-svn: 331946
Chris Matthews [Thu, 10 May 2018 00:06:17 +0000 (00:06 +0000)]
Refactor test incase results are backwards
Looks like results can come in either way in this file. Loosen the ordering constraints.
llvm-svn: 331945
Philip Reames [Thu, 10 May 2018 00:05:29 +0000 (00:05 +0000)]
[Inscombine] fix a signedness warning which broke -Werror builds
llvm-svn: 331944
Craig Topper [Thu, 10 May 2018 00:05:13 +0000 (00:05 +0000)]
[Builtins] Improve the IR emitted for MSVC compatible rotr/rotl builtins to match what the middle and backends understand
Previously we emitted something like
rotl(x, n) {
n &= bitwidth-1;
return n != 0 ? ((x << n) | (x >> (bitwidth - n)) : x;
}
We use a select to avoid the undefined behavior on the (bitwidth - n) shift.
The middle and backend don't really recognize this as a rotate and end up emitting a cmov or control flow because of the select.
A better pattern is (x << (n & mask)) | (x << (-n & mask)) where mask is bitwidth - 1.
Fixes the main complaint in PR37387. There's still some work to be done if the user writes that sequence directly on a short or char where type promotion rules can prevent it from being recognized. The builtin is emitting direct IR with unpromoted types so that isn't a problem for it.
Differential Revision: https://reviews.llvm.org/D46656
llvm-svn: 331943
Chris Matthews [Wed, 9 May 2018 23:48:32 +0000 (23:48 +0000)]
[LIT] Handle xml characters in test names
Lit creates malformed xml when the test case has an & in the name.
Escape those correctly.
This also adds a test case which I will add other nasty encoding issues to in some followup commits.
llvm-svn: 331942
Artem Belevich [Wed, 9 May 2018 23:46:19 +0000 (23:46 +0000)]
[NVPTX] Added a feature to use short pointers for const/local/shared AS.
Const/local/shared address spaces are all < 4GB and we can always use
32-bit pointers to access them. This has substantial performance impact
on kernels that uses shared memory for intermediary results.
The feature is disabled by default.
Differential Revision: https://reviews.llvm.org/D46147
llvm-svn: 331941
Vitaly Buka [Wed, 9 May 2018 23:31:05 +0000 (23:31 +0000)]
[sanitizer] Use all available rounded up capacity
Reviewers: eugenis
Subscribers: kubamracek, llvm-commits
Differential Revision: https://reviews.llvm.org/D46617
llvm-svn: 331940
Sanjay Patel [Wed, 9 May 2018 23:10:46 +0000 (23:10 +0000)]
[PhaseOrdering] remove stale comments; NFC
Forgot to update this with rL331937.
llvm-svn: 331939
Artem Belevich [Wed, 9 May 2018 23:10:09 +0000 (23:10 +0000)]
[CUDA] Added -f[no-]cuda-short-ptr option
The option enables use of 32-bit pointers for accessing
const/local/shared memory. The feature is disabled by default.
Differential Revision: https://reviews.llvm.org/D46148
llvm-svn: 331938
Sanjay Patel [Wed, 9 May 2018 23:08:15 +0000 (23:08 +0000)]
[AggressiveInstCombine] convert a chain of 'and-shift' bits into masked compare
This is a follow-up to D45986. As suggested there, we should match the "all-bits-set"
pattern in addition to "any-bits-set".
This was a little more complicated than I thought it would be initially because the
"and 1" instruction can be anywhere in the chain. Hopefully, the code comments make
that logic understandable, but if you see a way to simplify or improve that, it's
most appreciated.
This transforms patterns that emerge from bitfield tests as seen in PR37098:
https://bugs.llvm.org/show_bug.cgi?id=37098
I think it would also help reduce the large test from:
D46336
D46595
but we need something to reassociate that case to the forms we're expecting here first.
Differential Revision: https://reviews.llvm.org/D46649
llvm-svn: 331937
Vitaly Buka [Wed, 9 May 2018 23:02:14 +0000 (23:02 +0000)]
[lsan] Report unsuspended threads
Summary:
Leak checker needs to suspend all process threads. If we have some running
thread in registry but not suspended we can have false leak report. So we will
report this case here for future debugging.
Reviewers: eugenis
Subscribers: kubamracek, llvm-commits
Differential Revision: https://reviews.llvm.org/D46663
llvm-svn: 331936
Philip Reames [Wed, 9 May 2018 22:56:32 +0000 (22:56 +0000)]
[InstCombine] Widen guards with conditions between
The previous handling for guard widening in InstCombine was extremely restrictive. In particular, it didn't handle the common case where we had two guards separated by a single icmp. Handle this by scanning through a small fixed window of instructions to find the next guard if needed.
Differential Revision: https://reviews.llvm.org/D46203
llvm-svn: 331935
Julie Hockett [Wed, 9 May 2018 22:28:18 +0000 (22:28 +0000)]
Revert "[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module"
This reverts commit r331930, which was landed by accident.
llvm-svn: 331934
Benjamin Kramer [Wed, 9 May 2018 22:27:34 +0000 (22:27 +0000)]
[InstCombine] Teach SimplifyDemandedBits that udiv doesn't demand low dividend bits that are zero in the divisor
This is safe as long as the udiv is not exact. The pattern is not common in
C++ code, but comes up all the time in code generated by XLA's GPU backend.
Differential Revision: https://reviews.llvm.org/D46647
llvm-svn: 331933
Julie Hockett [Wed, 9 May 2018 22:25:47 +0000 (22:25 +0000)]
Revert "[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective"
This reverts commit r331904 because of a memory leak.
llvm-svn: 331932
Julie Hockett [Wed, 9 May 2018 22:25:43 +0000 (22:25 +0000)]
Revert "[tools] Updating PPCallbacks::InclusionDirective calls"
This reverts commit r331905, since it's dependent on reverted r331905.
llvm-svn: 331931
Julie Hockett [Wed, 9 May 2018 22:25:42 +0000 (22:25 +0000)]
[clang-tidy] Adding RestrictSystemIncludes check to Fuchsia module
Adding a check to restrict system includes to a whitelist. Given a list
of includes that are explicitly allowed, the check issues a fixit to
remove any system include not on that list from the source file.
Differential Revision: https://reviews.llvm.org/D43778
llvm-svn: 331930
Amaury Sechet [Wed, 9 May 2018 22:15:51 +0000 (22:15 +0000)]
[ARM] Add support for SETCCCARRY instead of SETCCE
Summary: As per title. SETCCE is deprecated and will eventually be removed.
Reviewers: rogfer01, efriedma, rengolin, javed.absar
Subscribers: kristof.beyls, chrib, llvm-commits
Differential Revision: https://reviews.llvm.org/D46512
llvm-svn: 331929
Manoj Gupta [Wed, 9 May 2018 22:05:53 +0000 (22:05 +0000)]
Update pragma-attribute-supported-attributes-list.test.
Update the test to include the new attribute NoStackProtector
to fix the build fails.
llvm-svn: 331928
Vitaly Buka [Wed, 9 May 2018 22:03:52 +0000 (22:03 +0000)]
[sanitizer] Fix argument type and remove unneeded vector resize
llvm-svn: 331927
Roman Tereshin [Wed, 9 May 2018 21:43:30 +0000 (21:43 +0000)]
[GlobalISel][Legalizer] Widening the second src op of shifts bug fix
The second source operand of G_SHL, G_ASHR, and G_LSHR must preserve its
value as a (small) unsigned integer, therefore its incorrect to widen it
in any way but by zero extending it.
G_SHL was using G_ANYEXT and G_ASHR - G_SEXT (which is correct for their
destination and first source operands, but not the "number of bits to
shift" operand).
Generally, shifts aren't as similar to regular binary operations as it
might seem, for instance, they aren't commutative nor associative and
the second source operand usually requires a special treatment.
Reviewers: bogner, javed.absar, aivchenk, rovka
Reviewed By: bogner
Subscribers: igorb, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D46413
llvm-svn: 331926
Manoj Gupta [Wed, 9 May 2018 21:41:18 +0000 (21:41 +0000)]
[Clang] Implement function attribute no_stack_protector.
Summary:
This attribute tells clang to skip this function from stack protector
when -stack-protector option is passed.
GCC option for this is:
__attribute__((__optimize__("no-stack-protector"))) and the
equivalent clang syntax would be: __attribute__((no_stack_protector))
This is used in Linux kernel to selectively disable stack protector
in certain functions.
Reviewers: aaron.ballman, rsmith, rnk, probinson
Reviewed By: aaron.ballman
Subscribers: probinson, srhines, cfe-commits
Differential Revision: https://reviews.llvm.org/D46300
llvm-svn: 331925
Paul Semel [Wed, 9 May 2018 21:36:54 +0000 (21:36 +0000)]
[llvm-objcopy] Add --strip-symbol (-N) option
llvm-svn: 331924
Eric Liu [Wed, 9 May 2018 21:35:52 +0000 (21:35 +0000)]
Add SourceManagerForFile helper which sets up SourceManager and dependencies for a single file with code snippet
Summary: This can be used to create a virtual environment (incl. VFS, source manager) for code snippets.
Reviewers: sammccall, klimek
Reviewed By: sammccall
Subscribers: klimek, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D46176
llvm-svn: 331923
Petr Hosek [Wed, 9 May 2018 21:24:06 +0000 (21:24 +0000)]
[CMake] Build shared version of runtimes for Fuchsia
Fuchsia is no longer treated as UNIX which means we need to explicitly
enable building of shared versions of runtimes.
Differential Revision: https://reviews.llvm.org/D46609
llvm-svn: 331922
Vitaly Buka [Wed, 9 May 2018 21:21:26 +0000 (21:21 +0000)]
[sanitizer] Use tid_t in ThreadLister
llvm-svn: 331921
Farhana Aleen [Wed, 9 May 2018 21:18:34 +0000 (21:18 +0000)]
[AMDGPU] Support horizontal vectorization of min/max.
Author: FarhanaAleen
Reviewed By: rampitec
Subscribers: AMDGPU
Differential Revision: https://reviews.llvm.org/D46604
llvm-svn: 331920
Matt Arsenault [Wed, 9 May 2018 21:11:35 +0000 (21:11 +0000)]
AMDGPU: Ignore any_extend in mul24 combine
If a multiply is truncated, SimplifyDemandedBits
sometimes turns a zero_extend of the inputs into an
any_extend, which makes the known bits computation unhelpful.
Ignore these and compute known bits for the underlying value,
since we insert the correct extend type after.
llvm-svn: 331919
Krzysztof Parzyszek [Wed, 9 May 2018 21:10:41 +0000 (21:10 +0000)]
[Hexagon] Add patterns for vector shift-and-accumulate
llvm-svn: 331918
Matt Arsenault [Wed, 9 May 2018 20:52:54 +0000 (20:52 +0000)]
AMDGPU: Handle partial shift reduction for variable shifts
If the variable shift amount has known bits, we can still reduce
the shift.
llvm-svn: 331917
Matt Arsenault [Wed, 9 May 2018 20:52:43 +0000 (20:52 +0000)]
AMDGPU: Partially shrink 64-bit shifts if reduced to 16-bit
This is an extension of an existing combine to reduce wider
shls if the result fits in the final result type. This
introduces the same combine, but reduces the shift to a middle
sized type to avoid the slow 64-bit shift.
llvm-svn: 331916
Vitaly Buka [Wed, 9 May 2018 20:42:11 +0000 (20:42 +0000)]
[sanitizer] Cleanup sorting functions
llvm-svn: 331915
Stella Stamenova [Wed, 9 May 2018 19:58:51 +0000 (19:58 +0000)]
[cmake, unittests] Fix the CMake file for the LLDB unittests to support multiple configurations
Summary: The current setup for the unit tests only works correctly when the generator does not support multiple configurations. When the generator supports multiple configurations, the inputs are not copied to the correct per-configuration directory. This change sets up the build to copy the inputs in each configuration directory.
Reviewers: labath, asmith, zturner
Reviewed By: labath
Subscribers: mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D46642
llvm-svn: 331914
Simon Pilgrim [Wed, 9 May 2018 19:27:48 +0000 (19:27 +0000)]
[X86] Fix Broadwell's Shuffle256 schedule classes load latency values.
Allows us to remove some unnecessary InstRW overrides.
llvm-svn: 331913
Martin Storsjo [Wed, 9 May 2018 19:07:10 +0000 (19:07 +0000)]
[COFF] Fix dangling StringRefs from SVN 331900
llvm-svn: 331912
Simon Pilgrim [Wed, 9 May 2018 19:04:15 +0000 (19:04 +0000)]
[X86] Merge instregex patterns to reduce InstrRW compile time.
llvm-svn: 331911
David Bolvansky [Wed, 9 May 2018 18:57:17 +0000 (18:57 +0000)]
Allow copy elision in path concatenation
Summary:
Just port of libstdc++'s fix to libc++ fs: https://github.com/gcc-mirror/gcc/commit/
e6ac4004fe49d785c63bf87aec4b095b5ce1d19f
Author of fix: Jonathan Wakely
Reviewers: EricWF, mclow.lists
Reviewed By: EricWF
Subscribers: smeenai, christof, cfe-commits, llvm-commits
Differential Revision: https://reviews.llvm.org/D46593
llvm-svn: 331910
Matt Arsenault [Wed, 9 May 2018 18:37:39 +0000 (18:37 +0000)]
AMDGPU: Add combine for trunc of bitcast from build_vector
If the truncate is only accessing the first element of the vector,
we can use the original source value.
This helps with some combine ordering issues after operations are
lowered to integer operations between bitcasts of build_vector.
In particular it stops unnecessarily materializing the unused
top half of a vector in some cases.
llvm-svn: 331909
Kostya Serebryany [Wed, 9 May 2018 18:35:09 +0000 (18:35 +0000)]
[dfsan] add one more sanitizer-coverage hook to the whitelist
llvm-svn: 331908
Krzysztof Parzyszek [Wed, 9 May 2018 18:33:59 +0000 (18:33 +0000)]
[Hexagon] Check the end of the correct container (fix typo)
llvm-svn: 331907
Matt Arsenault [Wed, 9 May 2018 18:29:26 +0000 (18:29 +0000)]
AMDGPU: Stop special casing constant indexes of extract_vector_elt
The same result folds out of the dynamic expansion logic if the
index is constant.
llvm-svn: 331906
Julie Hockett [Wed, 9 May 2018 18:27:37 +0000 (18:27 +0000)]
[tools] Updating PPCallbacks::InclusionDirective calls
[revision] added SrcMgr::CharacteristicKind to the InclusionDirective
callback, this revision updates instances of it in clang-tools-extra.
Differential Revision: https://reviews.llvm.org/D46615
llvm-svn: 331905
Julie Hockett [Wed, 9 May 2018 18:27:33 +0000 (18:27 +0000)]
[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective
Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective
in PPCallbacks, and updating calls to that function. This will be useful
in https://reviews.llvm.org/D43778 to determine which includes are system
headers.
Differential Revision: https://reviews.llvm.org/D46614
llvm-svn: 331904
Martin Storsjo [Wed, 9 May 2018 18:21:03 +0000 (18:21 +0000)]
[llvm-rc] Handle C preprocessor output
When preprocessing resource scripts (which can easily be done outside
of llvm-rc), included headers can leave behind C declarations (despite
preprocessing with -DRC_INVOKED), that can't be parsed by a resource
compiler.
This is handled in all of rc.exe, by parsing the preprocessor output
line markers and ignoring content from files named *.h and *.c,
documented at [1].
In addition to this filtering, strip out any other preprocessor directive
that is left behind (like pragmas) which also can't be handled by the
tokenizer.
The added test uses both standard #line markers (supported by rc.exe) and
GNU style extended line markers, thus this test doesn't pass with rc.exe,
but passes with GNU windres. (Windres on the other hand doesn't filter
out files named *.c, only *.h.)
Differential Revision: https://reviews.llvm.org/D46579
[1] https://msdn.microsoft.com/en-us/library/windows/desktop/
aa381033(v=vs.85).aspx
llvm-svn: 331903
Martin Storsjo [Wed, 9 May 2018 18:20:56 +0000 (18:20 +0000)]
[llvm-rc] Add support for the RCDATA resource type
This is the same as any other user defined resource, but with
a specific allocated resource type number.
Differential Revision: https://reviews.llvm.org/D46636
llvm-svn: 331902
Martin Storsjo [Wed, 9 May 2018 18:20:49 +0000 (18:20 +0000)]
[llvm-rc] Allow -1 for control IDs in old style dialogs with 16 bit fields
-1 is commonly used as ID for controls that one don't want to
refer to later. For DIALOG resources, the IDs are 16 bit numbers,
and -1 gets interpreted as UINT32_MAX earlier, which then later is
too large to write into a uint16_t.
Differential Revision: https://reviews.llvm.org/D46506
llvm-svn: 331901
Martin Storsjo [Wed, 9 May 2018 18:19:41 +0000 (18:19 +0000)]
[COFF] Allow specifying export forwarding in a def file
Previously this was only supported when specified on the command line
or in directives.
Differential Revision: https://reviews.llvm.org/D46244
llvm-svn: 331900
Alexey Bataev [Wed, 9 May 2018 18:02:37 +0000 (18:02 +0000)]
[OPENMP] Generate unique names for offloading regions id.
It is required to emit unique names for offloading regions ids. Required
to support compilation and linking of several compilation units.
llvm-svn: 331899
Roman Tereshin [Wed, 9 May 2018 17:28:18 +0000 (17:28 +0000)]
Reapplying r331819 [GlobalISel][Legalizer] More concise and faster widenScalar, NFC
The commit was a suspect for clang-cmake-aarch64-global-isel and
clang-cmake-aarch64-quick bot failures, proved to be innocent.
llvm-svn: 331898
David Blaikie [Wed, 9 May 2018 17:28:10 +0000 (17:28 +0000)]
llvm-mca: Add missing includes
Move the header include in the primary source file to the top to
validate that it doesn't depend on any other inclusions.
llvm-svn: 331897
Craig Topper [Wed, 9 May 2018 17:14:27 +0000 (17:14 +0000)]
[DAGCombiner] In visitBITCAST when trying to constant fold the bitcast, only call getBitcast if its an fp->int or int->fp conversion even when before legalize ops.
Previously if !LegalOperations we would blindly call getBitcast and hope that getNode would constant fold it. But if the conversion is between a vector and a scalar, getNode has no simplification.
This means we would just get back the original N. We would then return that N which would make the caller of visitBITCAST think that we used CombineTo and did our own worklist management. This prevents target specific optimizations from being called for vector/scalar bitcasts until after legal operations.
llvm-svn: 331896
Yaxun Liu [Wed, 9 May 2018 17:07:06 +0000 (17:07 +0000)]
[OpenCL] Fix typos in emitted enqueue kernel function names
Two typos:
vaarg => vararg
get_kernel_preferred_work_group_multiple => get_kernel_preferred_work_group_size_multiple
Differential Revision: https://reviews.llvm.org/D46601
llvm-svn: 331895
Matt Morehouse [Wed, 9 May 2018 17:05:07 +0000 (17:05 +0000)]
[libFuzzer] Disable print-func.test on Darwin.
The try-lock guard change seems to be making this test fail on Mac, but
I haven't been able to reproduce the failure. Disabling the test on Mac
to fix build bot.
llvm-svn: 331894
Craig Topper [Wed, 9 May 2018 16:57:48 +0000 (16:57 +0000)]
[X86] Only enable the __ud2 and __int2c builtins if intrin.h has been included.
Differential Revision: https://reviews.llvm.org/D46332
llvm-svn: 331893
Greg Clayton [Wed, 9 May 2018 16:42:53 +0000 (16:42 +0000)]
General cleanup to minimize the .debug_types patch
This cleanup is designed to make the https://reviews.llvm.org/D32167 patch smaller and easier to read.
Cleanup in this patch:
Allow DWARFUnit subclasses to hand out the data that should be used when decoding data for a DIE. The information might be in .debug_info or could be in .debug_types. There is a new virtual function on DWARFUnit that each subclass must override:
virtual const lldb_private::DWARFDataExtractor &DWARFUnit::GetData() const;
This allows DWARFCompileUnit and eventually DWARFTypeUnit to hand out different data to be used when decoding the DIE information.
Add a new pure virtual function to get the size of the DWARF unit header:
virtual uint32_t DWARFUnit::GetHeaderByteSize() const = 0;
This allows DWARFCompileUnit and eventually DWARFTypeUnit to hand out different offsets where the first DIE starts when decoding DIE information from the unit.
Added a new function to DWARFDataExtractor to get the size of an offset:
size_t DWARFDataExtractor::GetDWARFSizeOfOffset() const;
Removed dead dumping and parsing code in the DWARFDebugInfo class.
Inlined a bunch of calls in DWARFUnit for accessors that were just returning integer member variables.
Renamed DWARFUnit::Size() to DWARFUnit::GetHeaderByteSize() as it clearly states what it is doing and makes more sense.
Differential Revision: https://reviews.llvm.org/D46606
llvm-svn: 331892
Michael Kruse [Wed, 9 May 2018 16:23:56 +0000 (16:23 +0000)]
[ScopInfo] Remove bail out condition in buildMinMaxAccess().
The condition was introduced in r267142 to mitigate a long compile-time
case. In r306087, a max-computation limit was introduced that should
handle the same case while leaving the max disjuncts heuristic it
should have replaced intact.
Today, the max disjuncts bail-out causes problems in that it prematurely
stops SCoPs from being detected, e.g. in SPEC's lbm. This would hit less
like if isl_set_coalesce would be called after isl_set_remove_divs
(which makes more basic_set likely to be coalescable) instead of before.
This patch tries to remove the premature max-disjuncts bail-out
condition by using simple_hull() to reduce the computational overhead,
instead of directly invalidating that SCoP.
Differential Revision: https://reviews.llvm.org/D45066
Contributed-by: Sahil Girish Yerawar <cs15btech11044@iith.ac.in>
llvm-svn: 331891
Kostya Kortchinsky [Wed, 9 May 2018 16:20:52 +0000 (16:20 +0000)]
[sanitizer] Correct 64-bit atomic_store on 32-bit "other" platforms
Summary:
I think there might be something to optimize in `atomic_store`.
Currently, if everything goes well (and we have a different new value), we
always iterate 3 times.
For example, `with a = 0`, `oldval = a`, `newval = 42`, we get:
```
oldval = 0, newval = 42, curval = 0
oldval = 0, newval = 42, curval = 42
oldval = 42, newval = 42, curval = 42
```
and then it breaks.
Unless I am not seeing something, I don't see a point to the third iteration.
If the current value is the one we want, we should just break.
This means that 2 iterations (with a different newval) should be sufficient to
achieve what we want.
Reviewers: dvyukov, alekseyshl
Reviewed By: dvyukov
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D46597
llvm-svn: 331890
David Bolvansky [Wed, 9 May 2018 16:09:31 +0000 (16:09 +0000)]
[InstCombine] snprintf optimizations
Reviewers: spatel, efriedma, majnemer, rja, bkramer
Reviewed By: rja, bkramer
Subscribers: rja, llvm-commits
Differential Revision: https://reviews.llvm.org/D46285
llvm-svn: 331889
Amara Emerson [Wed, 9 May 2018 15:53:06 +0000 (15:53 +0000)]
[DAGCombine] Change store merge candidates check cut off to 1024.
The previous value of 8192 resulted in severe compile time hits in
some pathological cases.
rdar://
39781410
Differential Revision: https://reviews.llvm.org/D46581
llvm-svn: 331888
Krzysztof Parzyszek [Wed, 9 May 2018 15:44:40 +0000 (15:44 +0000)]
[Hexagon] Fix sanitizer error about using -1u in variable of enum type
llvm-svn: 331887
Stella Stamenova [Wed, 9 May 2018 15:35:19 +0000 (15:35 +0000)]
[lit, lldbsuite] Add a bug reference to the failing TestLinuxCore and fix an undefined property in dotest.py
Summary:
1) In TestLinuxCore rather than skipping the tests on Windows, mark them as expected failures and add a bug reference
2) In dotest.py replace the undefined property in the exceptions with the actual property causing the exception
Reviewers: asmith, labath, zturner
Reviewed By: labath, zturner
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D46590
llvm-svn: 331886
Krzysztof Parzyszek [Wed, 9 May 2018 15:18:12 +0000 (15:18 +0000)]
[LV] Change MaxVectorSize bound to 256 in assertion, NFC otherwise
It's possible to have a vector of 256 bytes in HVX code on Hexagon
(vector pair in 128-byte mode).
llvm-svn: 331885
Pavel Labath [Wed, 9 May 2018 15:13:45 +0000 (15:13 +0000)]
APFloat/x87: Fix string conversion for "unnormal" values (pr35860)
Summary:
Unnormal values are a feature of some very old x87 processors. We handle
them correctly for the most part -- the only exception was an unnormal
value whose significand happened to be zero. In this case the APFloat
was still initialized as normal number (category = fcNormal), but a
subsequent toString operation would assert because the math would
produce nonsensical values for the zero significand.
During review, it was decided that the correct way to fix this is to
treat all unnormal values as NaNs (as that is what any >=386 processor
will do).
The issue was discovered because LLDB would crash when trying to print
some "long double" values.
Reviewers: skatkov, scanon, gottesmm
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D41868
llvm-svn: 331884
Krzysztof Parzyszek [Wed, 9 May 2018 15:02:04 +0000 (15:02 +0000)]
[Hexagon] Simplify MCCodeEmitter, move data to tables
llvm-svn: 331883
Pavel Labath [Wed, 9 May 2018 14:49:43 +0000 (14:49 +0000)]
Fix Windows build for the Predicate.h refactor in r331880
llvm-svn: 331882
Sid Manning [Wed, 9 May 2018 14:44:54 +0000 (14:44 +0000)]
Add basic compiler-rt builtins support for hexagon.
Differential Revision: https://reviews.llvm.org/D46364
llvm-svn: 331881
Pavel Labath [Wed, 9 May 2018 14:29:30 +0000 (14:29 +0000)]
Modernize and clean-up the Predicate class
Summary:
The comments on this class were out of date with the implementation, and
the implementation itself was inconsistent with our usage of the Timeout
class (I started converting everything to use this class back in D27136,
but I missed this one). I avoid duplicating the waiting logic by
introducing a templated WaitFor function, and make other functions
delegate to that. This function can be also used as a replacement for
the unused WaitForBitToBeSet functions I removed, if it turns out to be
necessary.
As this changes the meaning of a "zero" timeout, I tracked down all the
callers of these functions and updated them accordingly. Propagating the
changes to all the callers of RunShellCommand was a bit too much for
this patch, so I stopped there and will continue that in a follow-up
patch.
I also add some basic unittests for the functions I modified.
Reviewers: jingham, clayborg
Subscribers: mgorny, lldb-commits
Differential Revision: https://reviews.llvm.org/D46580
llvm-svn: 331880
Alexey Bataev [Wed, 9 May 2018 14:15:18 +0000 (14:15 +0000)]
[OPENMP] Mark global tors/dtors as used.
If the global variables are marked as declare target and they need
ctors/dtors, these ctors/dtors are emitted and then invoked by the
offloading runtime library. They are not explicitly used in the emitted
code and thus can be optimized out. Patch marks these functions as used,
so the optimizer cannot remove these function during the optimization
phase.
llvm-svn: 331879
Karl-Johan Karlsson [Wed, 9 May 2018 13:34:57 +0000 (13:34 +0000)]
[LV] Add lit testcase for bitcast problem. NFC
llvm-svn: 331878
Anastasia Stulova [Wed, 9 May 2018 13:23:26 +0000 (13:23 +0000)]
[OpenCL] Add constant address space to __func__ in AST.
Added string literal helper function to obtain the type
attributed by a constant address space.
Also fixed predefind __func__ expr to use the helper
to constract the string literal correctly.
Differential Revision: https://reviews.llvm.org/D46049
llvm-svn: 331877
Pavel Labath [Wed, 9 May 2018 13:21:16 +0000 (13:21 +0000)]
[Support/Path] Make handling of paths like "///" consistent
Summary:
Various path functions were not treating paths consisting of slashes
alone consistently. For example, the iterator-based accessors decomposed the
path "///" into two elements: "/" and ".". This is not too bad, but it
is different from the behavior specified by posix:
```
A pathname that contains ***at least one non-slash character*** and that
ends with one or more trailing slashes shall be resolved as if a single
dot character ( '.' ) were appended to the pathname.
```
More importantly, this was different from how we treated the same path
in the filename+parent_path functions, which decomposed this path into
"." and "". This was completely wrong as it lost the information that
this was an absolute path which referred to the root directory.
This patch fixes this behavior by making sure all functions treat paths
consisting of (back)slashes alone the same way as "/". I.e., the
iterator-based functions will just report one component ("/"), and the
filename+parent_path will decompose them into "/" and "".
A slightly controversial topic here may be the treatment of "//". Posix
says that paths beginning with "//" may have special meaning and indeed
we have code which parses paths like "//net/foo/bar" specially. However,
as we were already not being consistent in parsing the "//" string
alone, and any special parsing for it would complicate the code further,
I chose to treat it the same way as longer sequences of slashes (which
are guaranteed to be the same as "/").
Another slight change of behavior is in the parsing of paths like
"//net//". Previously the last component of this path was ".". However,
as in our parsing the "//net" part in this path was the same as the
"drive" part in "c:\" and the next slash was the "root directory", it
made sense to treat "//net//" the same way as "//net/" (i.e., not to add
the extra "." component at the end).
Reviewers: zturner, rnk, dblaikie, Bigcheese
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D45942
llvm-svn: 331876
Manuel Klimek [Wed, 9 May 2018 13:20:03 +0000 (13:20 +0000)]
Do not warn on unused parameters for functions with empty bodies.
If a function has an empty body, all parameters are trivially unused.
llvm-svn: 331875
Sven van Haastregt [Wed, 9 May 2018 13:16:17 +0000 (13:16 +0000)]
[OpenCL] Restrict various keywords in OpenCL C++ mode
Restrict the following keywords in the OpenCL C++ language mode,
according to Sections 2.2 & 2.9 of the OpenCL C++ 1.0 Specification.
- dynamic_cast
- typeid
- register (already restricted in OpenCL C, update the diagnostic)
- thread_local
- exceptions (try/catch/throw)
- access qualifiers read_only, write_only, read_write
Support the `__global`, `__local`, `__constant`, `__private`, and
`__generic` keywords in OpenCL C++. Leave the unprefixed address
space qualifiers such as global available, i.e., do not mark them as
reserved keywords in OpenCL C++. libclcxx provides explicit address
space pointer classes such as `global_ptr` and `global<T>` that are
implemented using the `__`-prefixed qualifiers.
Differential Revision: https://reviews.llvm.org/D46022
llvm-svn: 331874
Adhemerval Zanella [Wed, 9 May 2018 12:48:22 +0000 (12:48 +0000)]
[AArch64] Improve cost of vector division by constant
With custom lowering for vector MULLH{S,U}, it is now profitable to
vectorize a divide by constant loop for the custom types (v16i8, v8i16,
and v4i32). The cost if based on TargetLowering::Build{S,U}DIV which
uses a multiply by constant plus adjustment to express a divide by
constant.
Both {u,s}mull{2} are expressed as Instruction::Mul and shifts by
Instruction::AShr.
llvm-svn: 331873
Nico Weber [Wed, 9 May 2018 12:39:39 +0000 (12:39 +0000)]
Remove 'abi-breaking-checks' lit feature.
Its only two uses were removed in r311730.
Effectively reverts r304851 (but that code has removed around a bit since then).
https://reviews.llvm.org/D46619
clang side done in r331871.
llvm-svn: 331872
Nico Weber [Wed, 9 May 2018 12:38:51 +0000 (12:38 +0000)]
Remove unused lit setting, see https://reviews.llvm.org/D46619
llvm-svn: 331871
Alexander Kornienko [Wed, 9 May 2018 12:27:21 +0000 (12:27 +0000)]
Fixes issue introduced by r331556.
Closes bug: https://bugs.llvm.org/show_bug.cgi?id=37357
Patch by Rafael Stahl!
Differential revision: https://reviews.llvm.org/D46633
llvm-svn: 331870
Pavel Labath [Wed, 9 May 2018 12:26:19 +0000 (12:26 +0000)]
Revert "DWARFVerifier: Check "completeness" of .debug_names section"
The new verifier check has found an error in the
debug-names-name-collisions.ll test on the PS4 bot:
error: Name Index @ 0x0: Entry @ 0xdc: mismatched Name of DIE @ 0x23: index - _ZN3foo3fooE; debug_info - foo.
Reverting while I investigate whether this is a bug in the verifier or
the generator.
This reverts commit r331868.
llvm-svn: 331869
Pavel Labath [Wed, 9 May 2018 12:06:17 +0000 (12:06 +0000)]
DWARFVerifier: Check "completeness" of .debug_names section
Summary:
This patch implements a check which makes sure all entries required by
the DWARF v5 specification are present in the Name Index. The algorithm
tries to follow the wording of Section 6.1.1.1 of the spec as closely as
possible.
The main deviation from it is that instead of a whitelist-based approach
in the spec "The name index must contain an entry for each debugging
information entry that defines a named subprogram, label, variable,
type, or namespace" I chose a blacklist-based one, where I consider
everything to be "in" and then remove the entries that don't make sense.
I did this because it has more potential for catching interesting cases
and the above is a bit vague (it uses plain words like "variable" and
"subprogram", but the rest of the section speaks about specific TAGs).
This approach has raised some interesting questions, the main one being
whether enumerator values should be indexed. The consensus seems to be
that they should, although it does not follow from section 6.1.1.1.
For the time being I made the verifier ignore these, as LLVM does not do
this yet, and I wanted to get a clean run when verifying generated debug
info.
Another interesting case was the DW_TAG_imported_declaration. It was not
immediately clear to me whether this should go in or not, but currently
it is not indexed, and (unlike the enumerators) in does not seem to cause
problems for LLDB, so I've also ignored it.
Reviewers: JDevlieghere, aprantl, dblaikie
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D46583
llvm-svn: 331868
Simon Pilgrim [Wed, 9 May 2018 11:42:34 +0000 (11:42 +0000)]
[CostModel][X86] Split off SLM checks
A future patch will require this and the diff is much better if we perform the split separately.
llvm-svn: 331867
Benjamin Kramer [Wed, 9 May 2018 11:38:57 +0000 (11:38 +0000)]
Revert "[InstCombine] snprintf optimizations"
This reverts commit r331849. It miscompiles
snprintf(buf, sizeof(buf), "%s", "any constant string); into
memcpy(buf, "%s", sizeof("any constant string"));
llvm-svn: 331866
Benjamin Kramer [Wed, 9 May 2018 11:17:30 +0000 (11:17 +0000)]
[DebugInfo] Mark tests using -debug-only as REQUIRES: asserts
llvm-svn: 331865