John Regehr [Wed, 21 Nov 2018 05:24:12 +0000 (05:24 +0000)]
[LVI] run transfer function for binary operator even when the RHS isn't a constant
LVI was symbolically executing binary operators only when the RHS was
constant, missing the case where we have a ConstantRange for the RHS,
but not an actual constant. Tested using check-all and by
bootstrapping. Compile time is not impacted measurably.
Differential Revision: https://reviews.llvm.org/D19859
llvm-svn: 347379
Petr Hosek [Wed, 21 Nov 2018 04:33:44 +0000 (04:33 +0000)]
[Driver] Link sanitizer runtime deps on Fuchsia when needed
Even though these deps weren't needed, this makes Fuchsia driver
better match other drivers, and it may be necessary when trying to
use different C libraries on Fuchsia.
Differential Revision: https://reviews.llvm.org/D54741
llvm-svn: 347378
Zhihao Yuan [Wed, 21 Nov 2018 03:30:10 +0000 (03:30 +0000)]
[libc++] Implement P0487R1 - Fixing operator>>(basic_istream&, CharT*)
Summary:
Avoid buffer overflow by replacing the pointer interface with an array reference interface in C++2a.
Tentatively ready on Batavia2018.
https://wg21.link/lwg2499
https://wg21.link/p0487
Reviewers: mclow.lists, ldionne, EricWF
Reviewed By: ldionne
Subscribers: libcxx-commits, cfe-commits, christof
Differential Revision: https://reviews.llvm.org/D51268
llvm-svn: 347377
Nemanja Ivanovic [Wed, 21 Nov 2018 02:53:50 +0000 (02:53 +0000)]
[PowerPC] Do not use vectors to codegen bswap with Altivec turned off
We have efficient codegen on P9 for lowering bswap that involves moving
the value into a vector reg and moving it back. However, the check under
which we custom lowered it did not adequately reflect the actual requirements.
It required only that the subtarget be an implementation of ISA 3.0 since all
compliant implementations have to provide the vector instructions.
However, the kernel builds have a valid use case for -mno-altivec -mcpu=pwr9
(i.e. don't emit vector code, don't have to save vector regs for context
switch). So we should require the correct features for this lowering.
Fixes https://bugs.llvm.org/show_bug.cgi?id=39334
llvm-svn: 347376
Craig Topper [Wed, 21 Nov 2018 01:39:38 +0000 (01:39 +0000)]
[X86] Correct 256 vpmovzx/vpmovsx isel patterns to check HasAVX2 instead of HasAVX to prevent fast-isel from using them incorrectly.
These are AVX2 instructions, but have been incorrectly marked in tablegen for a while. This wasn't a problem until r346784 switched the patterns to use target independent ISD opcodes. This made the patterns visible to fast isel.
Fixes PR39733
llvm-svn: 347375
Craig Topper [Wed, 21 Nov 2018 01:39:35 +0000 (01:39 +0000)]
[X86] Add a copy of avx512-trunc.ll with -x86-experimental-vector-widening-legalization enabled.
llvm-svn: 347374
Alexander Kornienko [Wed, 21 Nov 2018 01:11:18 +0000 (01:11 +0000)]
[clang-tidy] Add a test for proper handling of locations in scratch space.
This test examines the behavior change of clang::tooling::Diagnostic in r347372.
llvm-svn: 347373
Alexander Kornienko [Wed, 21 Nov 2018 01:08:46 +0000 (01:08 +0000)]
clang::tooling::Diagnostic: Don't store offset in the scratch space.
These offsets are useless (and even harmful in certain cases) in exported
diagnostics. The test will be added to clang-tidy, since it's the main user of
the clang::tooling::Diagnostic class.
llvm-svn: 347372
Alexander Kornienko [Wed, 21 Nov 2018 01:06:32 +0000 (01:06 +0000)]
Implement YAML serialization of notes in clang::tooling::Diagnostic.
llvm-svn: 347371
Heejin Ahn [Wed, 21 Nov 2018 00:51:37 +0000 (00:51 +0000)]
[WebAssembly] Delete unused using statements (NFC)
Reviewers: sbc100, dschuff
Subscribers: mehdi_amini, jgravelle-google, sunfish, steven_wu, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D54683
llvm-svn: 347370
Michael Kruse [Wed, 21 Nov 2018 00:34:02 +0000 (00:34 +0000)]
[docs] Add C++ Performance Benchmark to test-suite proposals.
llvm-svn: 347369
Dean Michael Berris [Wed, 21 Nov 2018 00:30:26 +0000 (00:30 +0000)]
[XRay] Add a test for re-initialising FDR mode (NFC)
This change adds an end-to-end test that ensures FDR mode can be
re-initialised safely in the face of multiple threads being traced.
llvm-svn: 347368
Louis Dionne [Wed, 21 Nov 2018 00:03:17 +0000 (00:03 +0000)]
[NFC] Rename lit feature to '-fsized-deallocation' for consistency
The '-faligned-allocation' flag uses a feature with the same name (with a
leading dash).
llvm-svn: 347367
Bill Wendling [Tue, 20 Nov 2018 23:24:39 +0000 (23:24 +0000)]
Update EvaluateAsInt to the new syntax.
llvm-svn: 347366
Bill Wendling [Tue, 20 Nov 2018 23:24:18 +0000 (23:24 +0000)]
Update call to EvaluateAsInt() to the new syntax.
llvm-svn: 347365
Bill Wendling [Tue, 20 Nov 2018 23:24:16 +0000 (23:24 +0000)]
Reinstate 347294 with a fix for the failures.
EvaluateAsInt() is sometimes called in a constant context. When that's the
case, we need to specify it as so.
llvm-svn: 347364
Louis Dionne [Tue, 20 Nov 2018 23:18:25 +0000 (23:18 +0000)]
[NFC] Reformat availability #defines in __config
Aligning everything makes what we're doing more obvious.
llvm-svn: 347363
Louis Dionne [Tue, 20 Nov 2018 23:07:01 +0000 (23:07 +0000)]
[NFC] Fix formatting in availability documentation
llvm-svn: 347362
Craig Topper [Tue, 20 Nov 2018 22:57:48 +0000 (22:57 +0000)]
[X86] Emit a PACKUS instead of a VECTOR_SHUFFLE from LowerTRUNCATE for v16i16->v16i8.
We can't guarantee that demanded bits passing through the vector shuffle won't cause the AND in front of this to be removed. This would prevent the PACKUS from being matched during shuffle lowering.
Unfortunately, this adds a packuswb to one of the vector-reduce-mul.ll tests since we were removing the shuffle via SimplifyDemandedVectorElts. We appear to have similar issues with vpmovwb on the same test case on other targets.
llvm-svn: 347361
Marshall Clow [Tue, 20 Nov 2018 22:55:40 +0000 (22:55 +0000)]
A couple of tests were broken when clang implemented the compiler parts of P0482 (support for char8_t). Comment out those bits until we implement the corresponding bits in libc++
llvm-svn: 347360
Zachary Turner [Tue, 20 Nov 2018 22:53:40 +0000 (22:53 +0000)]
Fix pointer options mask. It was off by 1 bit.
llvm-svn: 347359
David Carlier [Tue, 20 Nov 2018 22:50:31 +0000 (22:50 +0000)]
Revert "[Sanitizer] intercept setvbuf on other platforms where it is supported"
llvm-svn: 347358
David Carlier [Tue, 20 Nov 2018 22:35:29 +0000 (22:35 +0000)]
[Sanitizer] Unbreak non NetBSD builds.
llvm-svn: 347357
Sanjay Patel [Tue, 20 Nov 2018 22:26:35 +0000 (22:26 +0000)]
[DAGCombiner] look through bitcasts when trying to narrow vector binops
This is another step in vector narrowing - a follow-up to D53784
(and hoping to eventually squash potential regressions seen in
D51553).
The x86 test diffs are wins, but the AArch64 diff is probably not.
That problem already exists independent of this patch (see PR39722), but it
went unnoticed in the previous patch because there were no regression tests
that showed the possibility.
The x86 diff in i64-mem-copy.ll is close. Given the frequency throttling
concerns with using wider vector ops, an extra extract to reduce vector
width is the right trade-off at this level of codegen.
Differential Revision: https://reviews.llvm.org/D54392
llvm-svn: 347356
David Carlier [Tue, 20 Nov 2018 22:17:23 +0000 (22:17 +0000)]
[Sanitizer] intercept setvbuf on other platforms where it is supported
Unit tests enabled only in platform tested.
Reviewers: krytarowski, vitalybuka
Reviewed By: krytarowski, vitalybuka
Differential Revision: https://reviews.llvm.org/D54739
llvm-svn: 347355
Zachary Turner [Tue, 20 Nov 2018 22:13:43 +0000 (22:13 +0000)]
[CodeView] Add support for ref-qualified member functions.
When you have a member function with a ref-qualifier, for example:
struct Foo {
void Func() &;
void Func2() &&;
};
clang-cl was not emitting this information. Doing so is a bit
awkward, because it's not a property of the LF_MFUNCTION type, which
is what you'd expect. Instead, it's a property of the this pointer
which is actually an LF_POINTER. This record has an attributes
bitmask on it, and our handling of this bitmask was all wrong. We
had some parts of the bitmask defined incorrectly, but importantly
for this bug, we didn't know about these extra 2 bits that represent
the ref qualifier at all.
Differential Revision: https://reviews.llvm.org/D54667
llvm-svn: 347354
Zachary Turner [Tue, 20 Nov 2018 22:13:23 +0000 (22:13 +0000)]
[CodeView] Mark this pointers as const.
This is for compatibility with MSVC, which also marks this pointers
as being const-qualified.
Fixes llvm.org/pr36526
Differential Revision: https://reviews.llvm.org/D54736
llvm-svn: 347353
Sam McCall [Tue, 20 Nov 2018 22:06:54 +0000 (22:06 +0000)]
[CodeComplete] Penalize inherited ObjC properties for auto-completion
Summary:
Similar to auto-completion for ObjC methods, inherited properties
should be penalized / direct class and category properties should
be prioritized.
Note that currently, the penalty for using a result from a base class
(CCD_InBaseClass) is equal to the penalty for using a method as a
property (CCD_MethodAsProperty).
Reviewers: jkorous, sammccall, akyrtzi, arphaman, benlangmuir
Reviewed By: sammccall, akyrtzi
Subscribers: arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D53900
llvm-svn: 347352
Joel E. Denny [Tue, 20 Nov 2018 22:05:23 +0000 (22:05 +0000)]
[OpenMP] Update CHECK-DAG usage in target_parallel_codegen.cpp
This patch adjusts a test not to depend on deprecated FileCheck
behavior that permits overlapping matches within a block of CHECK-DAG
directives. Thus, this patch also removes uses of FileCheck's
-allow-deprecated-dag-overlap command-line option.
There were two issues in this test:
1. There were sets of patterns for store instructions in which a
pattern X could match a superset of a pattern Y. While X appeared
before Y, Y's intended match appeared before X's intended match. The
result was that X matched Y's intended match. Under the old
overlapping behavior, Y also matched Y's intended match. Under the
new non-overlapping behavior, Y had nothing left to match. This patch
fixes this by gathering these sets in one place and putting the most
specific patterns (Y) before the more general patterns (X).
2. The CHECK-DAG patterns involving the variables CBPADDR3 and
CBPADDR4 were the same, but there was only one match in the text, so
CBPADDR4 patterns had nothing to match under the new non-overlapping
behavior. Moreover, a preceding related series of directives had
variables (SADDR0, BPADDR0, etc.) numbered only 0 through 4, but this
series had variables numbered 0 through 5. Assuming CBPADDR4's
directives were not intended, this patch removes them.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D54765
llvm-svn: 347351
Joel E. Denny [Tue, 20 Nov 2018 22:04:45 +0000 (22:04 +0000)]
[OpenMP] Update CHECK-DAG usage in for_codegen.cpp
This patch adjusts a test not to depend on deprecated FileCheck
behavior that permits overlapping matches within a block of CHECK-DAG
directives. Thus, this patch also removes uses of FileCheck's
-allow-deprecated-dag-overlap command-line option.
Specifically, the FileCheck variables DBG_LOC_START, DBG_LOC_END, and
DBG_LOC_CANCEL were all set to the same value. As a result, three
TERM_DEBUG-DAG patterns, one for each variable, all matched the same
text under the old overlapping behavior. Under the new
non-overlapping behavior, that's not permitted. This patch's solution
is to replace these variables with one variable and replace these
patterns with one pattern.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D54764
llvm-svn: 347350
Zachary Turner [Tue, 20 Nov 2018 21:30:11 +0000 (21:30 +0000)]
[CodeView] RelocPtr points to little endian data.
Don't use a uint32_t*, use a ulittle32_t* to make this correct
on big endian systems.
Patch by James Clarke
Differential Revision: https://reviews.llvm.org/D54421
llvm-svn: 347349
Craig Topper [Tue, 20 Nov 2018 21:21:52 +0000 (21:21 +0000)]
[X86] Emit a single shuffle for the v16i8->v4i32 step of a SIGN_EXTEND_VECTOR_INREG lowering on pre-sse4.1 targets.
Previously we emitted to separate shuffles, one for unpcklbw and one for unpcklwd. Instead emit a single shuffle equivalent to both of the original shuffles. Shuffle lowering seems able to handle it. This avoids a bitcast between the two shuffles which seems helpful to DAG combine.
Remove the custom type legalization for v8i8->v8i32. I had put that in to avoid some almost duplicate punpcklbw instructions I was seeing, but this lowering change seems to fix that. It also fixes some duplicate shuffles seen in vector-sext.ll
llvm-svn: 347348
Louis Dionne [Tue, 20 Nov 2018 21:14:05 +0000 (21:14 +0000)]
[libcxx] Fix threads detection on GNU/Hurd
GNU/Hurd provides standard Posix threads
Reviewed as https://reviews.llvm.org/D54339.
Thanks to Samuel Thibault for the patch.
llvm-svn: 347347
Simon Atanasyan [Tue, 20 Nov 2018 21:13:51 +0000 (21:13 +0000)]
[unittests] Fix ExpandTilde test to match handling home dirs with trailing slash
The `expandTildeExpr` routine just replaces a tilde by a home dir path.
If the home dir has a trailing slash, the result of substitution will
contain double slashes. For example, `HOME=/foo/ ~/bar` gives `/foo//bar`.
That corresponds to (at least) Bash behaviour because the following
command `$HOME=/foo/ echo ~/bar` prints `/foo//bar`.
The `ExpandTilde` test constructs a path expected as the `fs::expand_tilde`
call result by calling `path::append` and the expected path has a single
slash. This patch fixes that and allows to pass the unittest on hosts where
the `HOME` is `/`.
Differential Revision: http://reviews.llvm.org/D54752
llvm-svn: 347346
Aaron Ballman [Tue, 20 Nov 2018 20:50:04 +0000 (20:50 +0000)]
Silence C4709 in MSVC because it is buggy.
The diagnostic will trigger on code that does not have any comma operator, but instead default-constructs an object with an explicitly defaulted constructor as the array index argument.
llvm-svn: 347345
Marshall Clow [Tue, 20 Nov 2018 20:38:15 +0000 (20:38 +0000)]
Note that P0899R1 requires no work.
llvm-svn: 347344
Marshall Clow [Tue, 20 Nov 2018 20:37:07 +0000 (20:37 +0000)]
Mark P0771 as complete; we already did this - I just added tests to be sure
llvm-svn: 347343
Alexey Bataev [Tue, 20 Nov 2018 20:19:36 +0000 (20:19 +0000)]
[OPENMP][NVPTX]Improved lock/critical constructs.
Summary: Improved support for critical constructs + omp_..._lock... constructs.
Reviewers: gtbercea, kkwli0, caomhin
Subscribers: guansong, jfb, openmp-commits
Differential Revision: https://reviews.llvm.org/D54766
llvm-svn: 347342
Sanjay Patel [Tue, 20 Nov 2018 19:45:53 +0000 (19:45 +0000)]
[x86] add tests for 8-bit multiply with constant; NFC
This is based on the existing file for 16-bit. We also already have 32-bit and 64-bit variants.
llvm-svn: 347341
Sam Clegg [Tue, 20 Nov 2018 19:25:07 +0000 (19:25 +0000)]
[WebAssembly] WebAssemblyLowerEmscriptenEHSjLj: use getter/setter for accessing tempRet0
Rather than assuming that `tempRet0` exists in linear memory only assume
the getter/setter functions exist. This avoids conflicting with
binaryen which declares a wasm global for this purpose and defines it's
own getter and setter for that.
The other advantage of doing things this way is that it leaving
it up to the linker/finalizer to decide how to actually store this
temporary. As it happens binaryen uses a wasm global which is more
appropriate since it is thread safe.
This also allows us to change the way this is stored in the future
(memory, TLS memory, wasm global) without modifying LLVM.
This is part of a 4 part change:
LLVM: https://reviews.llvm.org/D53240
fastcomp: https://github.com/kripken/emscripten-fastcomp/pull/237
emscripten: https://github.com/kripken/emscripten/pull/7358
binaryen: https://github.com/WebAssembly/binaryen/pull/1709
Differential Revision: https://reviews.llvm.org/D53240
llvm-svn: 347340
Roman Lebedev [Tue, 20 Nov 2018 18:59:05 +0000 (18:59 +0000)]
[clang][Parse] Diagnose useless null statements / empty init-statements
Summary:
clang has `-Wextra-semi` (D43162), which is not dictated by the currently selected standard.
While that is great, there is at least one more source of need-less semis - 'null statements'.
Sometimes, they are needed:
```
for(int x = 0; continueToDoWork(x); x++)
; // Ugly code, but the semi is needed here.
```
But sometimes they are just there for no reason:
```
switch(X) {
case 0:
return -2345;
case 5:
return 0;
default:
return 42;
}; // <- oops
;;;;;;;;;;; <- OOOOPS, still not diagnosed. Clearly this is junk.
```
Additionally:
```
if(; // <- empty init-statement
true)
;
switch (; // empty init-statement
x) {
...
}
for (; // <- empty init-statement
int y : S())
;
}
As usual, things may or may not go sideways in the presence of macros.
While evaluating this diag on my codebase of interest, it was unsurprisingly
discovered that Google Test macros are *very* prone to this.
And it seems many issues are deep within the GTest itself, not
in the snippets passed from the codebase that uses GTest.
So after some thought, i decided not do issue a diagnostic if the semi
is within *any* macro, be it either from the normal header, or system header.
Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=39111 | PR39111 ]]
Reviewers: rsmith, aaron.ballman, efriedma
Reviewed By: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D52695
llvm-svn: 347339
Michal Gorny [Tue, 20 Nov 2018 18:41:11 +0000 (18:41 +0000)]
[cmake] Fix detecting terminfo library
Copy the fix for determining the correct terminfo library from LLVM --
use distinct variables for check_library_exists() calls. Otherwise,
the first check (for -ltinfo) populates the variable and no other checks
are performed. Effectively, systems with other libraries than the first
one listed are presumed not to have terminfo routines at all.
Also sync the check order to include the NetBSD fix from r347156.
This partially fixes undefined symbols when linking XRay tests. It's
probably not the best solution to the problem there but as long
as the terminfo check stays in config-ix, I thnk it's worth fixing.
Differential Revision: https://reviews.llvm.org/D54641
llvm-svn: 347338
Michal Gorny [Tue, 20 Nov 2018 18:38:11 +0000 (18:38 +0000)]
[unittest] Skip W+X MappedMemoryTests when MPROTECT is enabled
Skip all MappedMemoryTest variants that rely on memory pages being
mapped for MF_WRITE|MF_EXEC when MPROTECT is enabled on NetBSD. W^X
protection causes all those mmap() calls to fail, causing the tests
to fail.
Differential Revision: https://reviews.llvm.org/D54080
llvm-svn: 347337
Vitaly Buka [Tue, 20 Nov 2018 18:21:42 +0000 (18:21 +0000)]
[tsan] Add __cxa_guard_acquire hooks to support cooperative scheduling
Reviewers: dvyukov
Subscribers: krytarowski, kubamracek, llvm-commits
Differential Revision: https://reviews.llvm.org/D54664
llvm-svn: 347336
Simon Pilgrim [Tue, 20 Nov 2018 18:08:56 +0000 (18:08 +0000)]
[X86] Remove -verify-machineinstrs=0 now that PR38391 is fixed.
llvm-svn: 347335
Leonard Chan [Tue, 20 Nov 2018 18:01:24 +0000 (18:01 +0000)]
[Docs] Documentation for the saturation addition and subtraction intrinsics
Differential Revision: https://reviews.llvm.org/D54729
llvm-svn: 347334
Sanjay Patel [Tue, 20 Nov 2018 17:51:49 +0000 (17:51 +0000)]
[InstCombine] add tests for funnel shifts; NFC
These are included in D54666, so adding them first with baseline results.
Patch by: @nikic (Nikita Popov)
llvm-svn: 347333
Sanjay Patel [Tue, 20 Nov 2018 17:34:59 +0000 (17:34 +0000)]
[InstSimplify] fold funnel shifts with undef operands
Splitting these off from the D54666.
Patch by: nikic (Nikita Popov)
llvm-svn: 347332
Sanjay Patel [Tue, 20 Nov 2018 17:30:09 +0000 (17:30 +0000)]
[InstSimplify] add tests for funnel shift with undef operands; NFC
These are part of D54666, so adding them here before the patch to
show the baseline (currently unoptimized) results.
Patch by: @nikic (Nikita Popov)
llvm-svn: 347331
Sanjay Patel [Tue, 20 Nov 2018 17:20:26 +0000 (17:20 +0000)]
[InstructionSimplify] Add support for saturating add/sub
Add support for saturating add/sub in InstructionSimplify. In particular, the following simplifications are supported:
sat(X + 0) -> X
sat(X + undef) -> -1
sat(X uadd MAX) -> MAX
(and commutative variants)
sat(X - 0) -> X
sat(X - X) -> 0
sat(X - undef) -> 0
sat(undef - X) -> 0
sat(0 usub X) -> 0
sat(X usub MAX) -> 0
Patch by: @nikic (Nikita Popov)
Differential Revision: https://reviews.llvm.org/D54532
llvm-svn: 347330
Samuel Benzaquen [Tue, 20 Nov 2018 17:15:17 +0000 (17:15 +0000)]
Add benchmarks for sorting and heap functions.
Summary:
Benchmarks for std::sort, std::stable_sort, std::make_heap,
std::sort_heap, std::pop_heap and std::push_heap.
The benchmarks are run with integers and strings, and with different
sorted input.
Reviewers: EricWF
Subscribers: christof, mgrang, ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D53978
llvm-svn: 347329
Sanjay Patel [Tue, 20 Nov 2018 17:05:55 +0000 (17:05 +0000)]
[ConstantFolding] Add support for saturating add/sub
Support saturating add/sub in constant folding, based on the APInt methods introduced in D54332.
Patch by: @nikic (Nikita Popov)
Differential Revision: https://reviews.llvm.org/D54531
llvm-svn: 347328
Fangrui Song [Tue, 20 Nov 2018 17:04:11 +0000 (17:04 +0000)]
[ELF] Allow --noinhibit-exec to produce corrupted executable with relocation overflow
Summary:
When --noinhibit-exec is used, ld.bfd/gold emit errors but allow to produce corrupted executable, which is handy for debugging purpose. lld's --noinhibit-exec has a different meaning and changes some errors to warnings. This patch replaces "error" with "errorOrWarn" to exploit that property.
We may revisit this: if we should keep them as errors (as ld.bfd/gold do) but allow to produce a (corrupted) executable.
Reviewers: ruiu, grimar, espindola
Reviewed By: grimar
Subscribers: Timmmm, jhenderson, emaste, arichardson, llvm-commits
Differential Revision: https://reviews.llvm.org/D54651
llvm-svn: 347327
Simon Pilgrim [Tue, 20 Nov 2018 17:04:02 +0000 (17:04 +0000)]
[AMDGPU] Regenerate weird stores tests.
Makes an upcoming SimplifyDemandedBits optimization much easier to understand.
llvm-svn: 347326
Guozhi Wei [Tue, 20 Nov 2018 16:49:07 +0000 (16:49 +0000)]
[LoopSink] Add preheader to alias set
This patch fixes PR39695.
The original LoopSink only considers memory alias in loop body. But PR39695 shows that instructions following sink candidate in preheader should also be checked. This is a conservative patch, it simply adds whole preheader block to alias set. It may lose some optimization opportunity, but I think that is very rare because: 1 in the most common case st/ld to the same address, the load should already be optimized away. 2 usually preheader is not very large.
Differential Revision: https://reviews.llvm.org/D54659
llvm-svn: 347325
Sanjay Patel [Tue, 20 Nov 2018 16:47:59 +0000 (16:47 +0000)]
[APInt] Add methods for saturated add and sub
This adds the sadd_sat, uadd_sat, ssub_sat, usub_sat methods for performing saturating additions and subtractions to APInt.
Split out from D54237.
Patch by: nikic (Nikita Popov)
Differential Revision: https://reviews.llvm.org/D54332
llvm-svn: 347324
Stella Stamenova [Tue, 20 Nov 2018 16:44:06 +0000 (16:44 +0000)]
[lit] Build and link TestIRMemoryMapWindows explicitly
If we just invoke clang-cl without specifying the linker, the tests fail on Windows because they cannot find the correct linker to use, so it needs to be specified explicitly
llvm-svn: 347323
Erich Keane [Tue, 20 Nov 2018 16:32:46 +0000 (16:32 +0000)]
[NFC] Remove MS line endings in diagnostics file.
Change-Id: I74704acf052e2e8fe707f18230bc5655c2bf2a91
llvm-svn: 347322
Stella Stamenova [Tue, 20 Nov 2018 16:24:03 +0000 (16:24 +0000)]
[lit] Disable the stop hook tests on Windows
These tests are not able to pass on Windows as written as they don't even build
llvm-svn: 347321
Bruno Ricci [Tue, 20 Nov 2018 16:20:40 +0000 (16:20 +0000)]
[AST] Store the expressions in ParenListExpr in a trailing array
Use the newly available space in the bit-fields of Stmt
and store the expressions in a trailing array. This saves
2 pointer per ParenListExpr.
Differential Revision: https://reviews.llvm.org/D54675
Reviewed By: rjmccall
llvm-svn: 347320
Bruno Ricci [Tue, 20 Nov 2018 16:09:45 +0000 (16:09 +0000)]
[AST][NFC] Factor out some repeated code in ArraySubscriptExpr.
Factor out the test for whether the LHS is the base of the
array subscript expression into a private method lhsIsBase.
NFC.
llvm-svn: 347319
Sanjay Patel [Tue, 20 Nov 2018 16:08:19 +0000 (16:08 +0000)]
[PatternMatch] Handle undef vectors consistently
This patch fixes the issue noticed in D54532.
The problem is that cst_pred_ty-based matchers like m_Zero() currently do not match
scalar undefs (as expected), but *do* match vector undefs. This may lead to optimization
inconsistencies in rare cases.
There is only one existing test for which output changes, reverting the change from D53205.
The reason here is that vector fsub undef, %x is no longer matched as an m_FNeg(). While I
think that the new output is technically worse than the previous one, it is consistent with
scalar, and I don't think it's really important either way (generally that undef should have
been folded away prior to reassociation.)
I've also added another test case for this issue based on InstructionSimplify. It took some
effort to find that one, as in most cases undef folds are either checked first -- and in the
cases where they aren't it usually happens to not make a difference in the end. This is the
only case I was able to come up with. Prior to this patch the test case simplified to undef
in the scalar case, but zeroinitializer in the vector case.
Patch by: @nikic (Nikita Popov)
Differential Revision: https://reviews.llvm.org/D54631
llvm-svn: 347318
Bruno Ricci [Tue, 20 Nov 2018 16:03:33 +0000 (16:03 +0000)]
[AST][NFC] Pack ArraySubscriptExpr
Use the newly available space in the bit-fields of Stmt.
This saves one pointer per ArraySubscriptExpr.
llvm-svn: 347317
Sanjay Patel [Tue, 20 Nov 2018 15:49:42 +0000 (15:49 +0000)]
[AArch64, x86] add tests for shift-not (PR39657); NFC
llvm-svn: 347316
Haojian Wu [Tue, 20 Nov 2018 15:45:15 +0000 (15:45 +0000)]
[clang-tidy] Don't generate incorrect fixes for class constructed from list-initialized arguments
Summary:
Currently the smart_ptr check (modernize-make-unique) generates the
fixes that cannot compile for cases like below -- because brace list can
not be deduced in `make_unique`.
```
struct Bar { int a, b; };
struct Foo { Foo(Bar); };
auto foo = std::unique_ptr<Foo>(new Foo({1, 2}));
```
Reviewers: aaron.ballman
Subscribers: xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D54704
llvm-svn: 347315
Nico Weber [Tue, 20 Nov 2018 15:27:43 +0000 (15:27 +0000)]
Revert 347294, it turned many bots on lab.llvm.org:8011/console red.
llvm-svn: 347314
Simon Pilgrim [Tue, 20 Nov 2018 15:23:50 +0000 (15:23 +0000)]
[DAGCombine] Add calls to SimplifyDemandedVectorElts from visitINSERT_SUBVECTOR (PR37989)
This uncovered an off-by-one typo in SimplifyDemandedVectorElts's INSERT_SUBVECTOR handling as its bounds check was bailing on safe indices.
llvm-svn: 347313
Aaron Ballman [Tue, 20 Nov 2018 15:23:07 +0000 (15:23 +0000)]
Update the documentation for attribute feature tests.
This clarifies that __has_cpp_attribute is no longer always an extension since it's now available in C++2a. Also, Both __has_cpp_attribute and __has_c_attribute can accept attribute scope tokens with alternative spelling (clang vs _Clang and gnu vs __gnu__).
llvm-svn: 347312
Jinsong Ji [Tue, 20 Nov 2018 15:11:42 +0000 (15:11 +0000)]
[PowerPC] Add Itineraries for STWU/STWUX etc
When doing some instruction scheduling work, we noticed some missing itineraries.
Before we switch to machine scheduler, those missing itineraries might not have impact to actually scheduling,
because we can still get same latency due to default values.
With machine scheduler, however, itineraries will have impact to scheduling.
eg: NumMicroOps will default to be 0 if there is NO itineraries for specific instruction class.
And most of the instruction class with itineraries will have NumMicroOps default to 1.
This will has impact on the count of RetiredMOps, affects the Pending/Available Queue,
then causing different scheduling or suboptimal scheduling further.
This patch is for STWU/STWUX (IIC_LdStStoreUpd ) for P8.
Since there are already multiple IIC for store update, this patch also merge
IIC_LdStSTDU/IIC_LdStStoreUpd to IIC_LdStSTU
IIC_LdStSTDUX to IIC_LdStSTUX
and we add a new testcase in https://reviews.llvm.org/D54699 to show the difference.
Differential Revision: https://reviews.llvm.org/D54700
llvm-svn: 347311
Jinsong Ji [Tue, 20 Nov 2018 14:55:43 +0000 (14:55 +0000)]
[PowerPC][NFC]Add testcase for STWU scheduling check
This patch add a STWU testcase for scheduling check.
Currently P7/P8 which use itineraries are missing IIC_LdStStoreUpd,
We use CHECK-ITIN prefix to check P7/P8, then use default for P9 (and future).
We will fix the missing itineraries of IIC_LdStStoreUpd in following patch,
and update this testcase to show the scheduling difference only there.
Differential Revision: https://reviews.llvm.org/D54699
llvm-svn: 347310
Jinsong Ji [Tue, 20 Nov 2018 14:41:59 +0000 (14:41 +0000)]
[llvm-exegesis][NFC] Some code style cleanup
Apply review comments of https://reviews.llvm.org/D54185 to other target as well, specifically:
1. make anonymous namespaces as small as possible, avoid using static inside anonymous namespaces
2. Add missing header to some files
3. GetLoadImmediateOpcodem-> getLoadImmediateOpcode
4. Fix typo
Differential Revision: https://reviews.llvm.org/D54343
llvm-svn: 347309
Simon Pilgrim [Tue, 20 Nov 2018 14:29:40 +0000 (14:29 +0000)]
Fix MSVC 'truncation of constant value' warning. NFCI.
llvm-svn: 347308
Krasimir Georgiev [Tue, 20 Nov 2018 14:22:43 +0000 (14:22 +0000)]
[clang-format] JS: don't treat is: as a type matcher
Summary:
Clang-format is treating all occurences of `is` in js as type matchers. In some
cases this is wrong, as it might be a dict key.
Reviewers: mprobst
Reviewed By: mprobst
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D54753
llvm-svn: 347307
Gabor Marton [Tue, 20 Nov 2018 14:19:39 +0000 (14:19 +0000)]
[ASTImporter] Set redecl chain of functions before any other import
Summary:
FunctionDecl import starts with a lookup and then we create a new Decl.
Then in case of CXXConstructorDecl we further import other Decls
(base classes, members through CXXConstructorDecl::inits()) before connecting
the redecl chain. During those in-between imports structural eq fails
because the canonical decl is different. This commit fixes this.
Synthesizing a test seemed extremely hard, however, Xerces analysis
reproduces the problem.
Reviewers: a_sidorin, a.sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits
Differential Revision: https://reviews.llvm.org/D53702
llvm-svn: 347306
Stefan Granitz [Tue, 20 Nov 2018 14:10:33 +0000 (14:10 +0000)]
[CMake] Streamline code signing for debugserver and pass entitlements to extended llvm_codesign
Summary:
Use llvm_codesign to sign debugserver with entitlements.
Set global LLVM_CODESIGNING_IDENTITY from LLDB_CODESIGN_IDENTITY (if given).
Pass through ENTITLEMENTS from add_lldb_executable to add_llvm_executable.
Handle reconfigurations correctly.
We have a lot of cases, make them explicit:
(1) build and sign debugserver, if all conditions apply:
* LLDB_NO_DEBUGSERVER=OFF (default)
* On Darwin: LLDB_USE_SYSTEM_DEBUGSERVER=OFF (default)
* On Darwin: LLVM_CODESIGNING_IDENTITY == lldb_codesign
(2) use system debugserver, if on Darwin and any of:
* LLDB_USE_SYSTEM_DEBUGSERVER=ON and found on system (explicit case)
* LLVM_CODESIGNING_IDENTITY != lldb_codesign and found on system (fallback case)
(3) debugserver will not be available, in case of:
* LLDB_NO_DEBUGSERVER=ON
* On Darwin: LLVM_CODESIGNING_IDENTITY != lldb_codesign and not found on system
(4) error state, in case of:
* LLDB_USE_SYSTEM_DEBUGSERVER=ON and not found on system
* LLDB_USE_SYSTEM_DEBUGSERVER=ON and LLDB_NO_DEBUGSERVER=ON
Reviewers: xiaobai, beanz, vsk, JDevlieghere
Subscribers: mgorny, lldb-commits, llvm-commits
Differential Revision: https://reviews.llvm.org/D54476
llvm-svn: 347305
Vassil Vassilev [Tue, 20 Nov 2018 13:53:20 +0000 (13:53 +0000)]
Allow force updating the NumCreatedFIDsForFileID.
Our internal clients implement parsing cache based on FileID. In order for the
Preprocessor to reenter the cached FileID it needs to reset its
NumCreatedFIDsForFileID.
Differential Revision: https://reviews.llvm.org/D51295
llvm-svn: 347304
Simon Pilgrim [Tue, 20 Nov 2018 13:23:37 +0000 (13:23 +0000)]
[X86][SSE] Add computeKnownBits/ComputeNumSignBits support for PACKSS/PACKUS instructions.
Pull out getPackDemandedElts demanded elts remapping helper from computeKnownBitsForTargetNode and use in computeKnownBits/ComputeNumSignBits.
llvm-svn: 347303
Simon Pilgrim [Tue, 20 Nov 2018 12:17:50 +0000 (12:17 +0000)]
[X86][SSE] XFormVExtractWithShuffleIntoLoad - getVectorShuffle won't accept SM_SentinelZero
Noticed while working on improving demanded elts target shuffle shuffle combining
llvm-svn: 347302
Simon Pilgrim [Tue, 20 Nov 2018 12:02:16 +0000 (12:02 +0000)]
[TargetLowering] Improve SimplifyDemandedVectorElts/SimplifyDemandedBits support
For bitcast nodes from larger element types, add the ability for SimplifyDemandedVectorElts to call SimplifyDemandedBits by merging the elts mask to a bits mask.
I've raised https://bugs.llvm.org/show_bug.cgi?id=39689 to deal with the few places where SimplifyDemandedBits's lack of vector handling is a problem.
Differential Revision: https://reviews.llvm.org/D54679
llvm-svn: 347301
Simon Pilgrim [Tue, 20 Nov 2018 11:46:37 +0000 (11:46 +0000)]
[X86][SSE] Lower immediately to PACKUS instead of VECTOR_SHUFFLE.
As discussed on rL347240, this avoids some regressions on D54679 and also helps some combines to kick in a bit earlier.
llvm-svn: 347300
Simon Pilgrim [Tue, 20 Nov 2018 11:09:46 +0000 (11:09 +0000)]
[X86][SSE] Add SimplifyDemandedVectorElts support for PACKSS/PACKUS instructions.
As discussed on rL347240.
llvm-svn: 347299
Sam McCall [Tue, 20 Nov 2018 10:58:48 +0000 (10:58 +0000)]
[clangd] Replay preamble #includes to clang-tidy checks.
Summary:
This is needed to correctly handle checks that use IncludeInserter,
which is very common.
I couldn't find a totally safe example of a check to enable for testing,
I picked modernize-deprecated-headers which some will probably hate.
We should get configuration working...
This depends on D54691 which ensures our calls to getFile(open=false)
don't break subsequent accesses via the FileManager.
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D54694
llvm-svn: 347298
Sam McCall [Tue, 20 Nov 2018 10:56:03 +0000 (10:56 +0000)]
[clangd] Allow observation of changes to global CDBs.
Summary:
Currently, changes *within* CDBs are not tracked (CDB has no facility to do so).
However, discovery of new CDBs are tracked (all files are marked as modified).
Also, files whose compilation commands are explicitly set are marked modified.
The intent is to use this for auto-index. Newly discovered files will be indexed
with low priority.
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D54475
llvm-svn: 347297
Craig Topper [Tue, 20 Nov 2018 09:04:01 +0000 (09:04 +0000)]
[X86] Preserve undef information when creating a punpckl/hbw from a v16i8 where all the even or odd elements are undef.
Previously if V2 was unused we ended up using V1 for both inputs as part of the code that follows the new code. By using lowerVectorShuffleWithUNPCK we keep the undef nature of V2 in the output.
As near as I can tell this makes v16i8 behavior consistent with every other VT now.
This does mean that we give the register allocator freedom to fill in random registers now and create false dependencies. But like I said we're already doing that for other types.
llvm-svn: 347296
Craig Topper [Tue, 20 Nov 2018 09:03:58 +0000 (09:03 +0000)]
[X86] Add custom type legalization for v8i8->v8i32 sign extend pre-SSE4.1
This helps with a future patch and makes us less reliant on DAG combine merging shuffles.
llvm-svn: 347295
Bill Wendling [Tue, 20 Nov 2018 08:53:30 +0000 (08:53 +0000)]
Use is.constant intrinsic for __builtin_constant_p
Summary:
A __builtin_constant_p may end up with a constant after inlining. Use
the is.constant intrinsic if it's a variable that's in a context where
it may resolve to a constant, e.g., an argument to a function after
inlining.
Reviewers: rsmith, shafik
Subscribers: jfb, kristina, cfe-commits, nickdesaulniers, jyknight
Differential Revision: https://reviews.llvm.org/D54355
llvm-svn: 347294
Fangrui Song [Tue, 20 Nov 2018 08:00:00 +0000 (08:00 +0000)]
[libclang] Unify getCursorDecl and getCursorParentDecl
They do the same thing, thus the latter (which has only 2 call sites) can be deleted.
llvm-svn: 347293
Craig Topper [Tue, 20 Nov 2018 06:54:01 +0000 (06:54 +0000)]
[X86] Replace more calls to getZeroVector with regular getConstant.
getZeroVector produces a specifically canonicalized zero vector, but we can just let DAG legalization take care of it.
The test changes are because MULH lowering happens later than it should and this change gave us the opportunity to constant fold away a multiply during a DAG combine before the build_vector got legalized with a bitcast.
llvm-svn: 347290
Max Kazantsev [Tue, 20 Nov 2018 05:43:32 +0000 (05:43 +0000)]
Recommit "[LoopSimplifyCFG] Teach LoopSimplifyCFG to constant-fold branches and switches"
The initial version of patch lacked Phi nodes updates in destinations of removed
edges. This version contains this update and tests on this situation.
Differential Revision: https://reviews.llvm.org/D54021
llvm-svn: 347289
Nemanja Ivanovic [Tue, 20 Nov 2018 04:42:31 +0000 (04:42 +0000)]
[PowerPC] Don't combine to bswap store on 1-byte truncating store
Turns out that there was no check for a store that truncates down
to a single byte when combining a (store (bswap...)) into a byte-swapping
store. This patch just adds that check.
Fixes https://bugs.llvm.org/show_bug.cgi?id=39478.
llvm-svn: 347288
Craig Topper [Tue, 20 Nov 2018 04:30:26 +0000 (04:30 +0000)]
[SelectionDAG] Compute known bits and num sign bits for live out vector registers. Use it to add AssertZExt/AssertSExt in the live in basic blocks
Summary:
We already support this for scalars, but it was explicitly disabled for vectors. In the updated test cases this allows us to see the upper bits are zero to use less multiply instructions to emulate a 64 bit multiply.
This should help with this ispc issue that a coworker pointed me to https://github.com/ispc/ispc/issues/1362
Reviewers: spatel, efriedma, RKSimon, arsenm
Reviewed By: spatel
Subscribers: wdng, llvm-commits
Differential Revision: https://reviews.llvm.org/D54725
llvm-svn: 347287
Dean Michael Berris [Tue, 20 Nov 2018 03:56:04 +0000 (03:56 +0000)]
[XRay] Add a test for allocator exhaustion
Use a more representative test of allocating small chunks for
oddly-sized (small) objects from an allocator that has a page's worth of
memory.
llvm-svn: 347286
Matthew Voss [Tue, 20 Nov 2018 03:30:28 +0000 (03:30 +0000)]
Ensure FileManagerTest expects "\\" as path separator on Windows platforms
llvm-svn: 347284
Jonas Devlieghere [Tue, 20 Nov 2018 01:18:49 +0000 (01:18 +0000)]
Skip TestTargetCreateDeps
Skip this test because Windows deals differently with shared libraries.
llvm-svn: 347283
Peter Collingbourne [Tue, 20 Nov 2018 01:01:49 +0000 (01:01 +0000)]
Driver: SCS is compatible with every other sanitizer.
Because SCS relies on system-provided runtime support, we can use it
together with any other sanitizer simply by linking the runtime for
the other sanitizer.
Differential Revision: https://reviews.llvm.org/D54735
llvm-svn: 347282
Lang Hames [Tue, 20 Nov 2018 01:01:26 +0000 (01:01 +0000)]
[ExecutionEngine][Interpreter] Fix out-of-bounds array access.
If args is empty then accesing element 0 is illegal.
https://reviews.llvm.org/D53556
Patch by Eugene Sharygin. Thanks Eugene!
llvm-svn: 347281
Dean Michael Berris [Tue, 20 Nov 2018 01:00:26 +0000 (01:00 +0000)]
[XRay] Move buffer extents back to the heap
Summary:
This change addresses an issue which shows up with the synchronised race
between threads writing into a buffer, and another thread reading the
buffer.
In a lot of cases, we cannot guarantee that threads will always see the
signal to finalise their buffers in time despite the grace periods and
state machine maintained through atomic variables. This change addresses
it by ensuring that the same instance being updated to indicate how much
of the buffer is "used" by the writing thread is the same instance being
read by the thread processing the buffer to be written out to disk or
handled through the iterators.
To do this, we ensure that all the "extents" instances live in their own
the backing store, in a different contiguous page from the
buffer-specific backing store. We also take precautions to ensure that
the atomic variables are cache-line-sized to prevent false-sharing from
unnecessarily causing cache contention on unrelated writes/reads.
It's feasible that we may in the future be able to move the storage of
the extents objects into the single backing store, slightly changing the
way to compute the size(s) of the buffers, but in the meantime we'll
settle for the isolation afforded by having a different backing store
for the extents instances.
Reviewers: mboerger
Subscribers: jfb, llvm-commits
Differential Revision: https://reviews.llvm.org/D54684
llvm-svn: 347280
Petr Hosek [Tue, 20 Nov 2018 00:55:20 +0000 (00:55 +0000)]
[compiler-rt] Use zx_futex_wait_deprecated for Fuchsia sanitizer runtime
This change is part of the soft-transition to the new synchronization
primitives which implement priority inheritance.
Differential Revision: https://reviews.llvm.org/D54727
llvm-svn: 347279
Sanjay Patel [Tue, 20 Nov 2018 00:51:45 +0000 (00:51 +0000)]
[DAGCombiner] reduce code duplication in visitXOR; NFC
llvm-svn: 347278
Heejin Ahn [Tue, 20 Nov 2018 00:38:10 +0000 (00:38 +0000)]
[WebAssembly] Remove unused function return types (NFC)
Reviewers: sbc100
Subscribers: dschuff, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D54734
llvm-svn: 347277