Simon Pilgrim [Sat, 13 Oct 2018 15:16:55 +0000 (15:16 +0000)]
[X86][SSE] Begin removing vector CTTZ custom lowering and use LegalizeDAG instead.
Adds CTTZ vector legalization support and begins the removal of the X86/SSE custom lowering.
llvm-svn: 344453
Simon Pilgrim [Sat, 13 Oct 2018 14:45:44 +0000 (14:45 +0000)]
[X86][SSE] combineIncDecVector - use isConstantSplat
Use isConstantSplat instead of ISD::isConstantSplatVector to let us us peek through to illegal types (in this case for i686 targets to recognise i64 constants)
llvm-svn: 344452
Simon Pilgrim [Sat, 13 Oct 2018 14:28:40 +0000 (14:28 +0000)]
[X86] Pull out target constant splat helper function. NFCI.
The code in LowerScalarImmediateShift is just a more powerful version of ISD::isConstantSplatVector.
llvm-svn: 344451
Simon Pilgrim [Sat, 13 Oct 2018 13:33:32 +0000 (13:33 +0000)]
Pull out repeated getOperand(). NFCI.
llvm-svn: 344450
Simon Pilgrim [Sat, 13 Oct 2018 13:30:10 +0000 (13:30 +0000)]
Remove unused variable. NFCI.
llvm-svn: 344449
Simon Pilgrim [Sat, 13 Oct 2018 13:05:19 +0000 (13:05 +0000)]
[X86][SSE] Improve CTTZ lowering when CTLZ is legal
If we have better CTLZ support than CTPOP, then use cttz(x) = width - ctlz(~x & (x - 1)) - and remove the CTTZ_ZERO_UNDEF handling as it no longer gives better codegen.
Similar to rL344447, this is also closer to LegalizeDAG's approach
llvm-svn: 344448
Simon Pilgrim [Sat, 13 Oct 2018 12:12:06 +0000 (12:12 +0000)]
[X86][SSE] Change CTTZ vector lowering to cttz(x) = ctpop(~x & (x - 1))
This patch changes the vector CTTZ lowering from:
cttz(x) = ctpop((x & -x) - 1)
to:
cttz(x) = ctpop(~x & (x - 1))
Not only does this make better use of the PANDN instruction, but it also matches the LegalizeDAG method which should allow us to remove the x86 specific code at some point in the future (we need to fix some issues with the bitcasted logic ops and CTPOP lowering first).
Differential Revision: https://reviews.llvm.org/D53214
llvm-svn: 344447
Simon Pilgrim [Sat, 13 Oct 2018 11:38:10 +0000 (11:38 +0000)]
[X86][AVX] Add lowerVectorShuffleAsLanePermuteAndPermute for v4f64 shuffles (PR39161)
Add shuffle lowering for the case where we can shuffle the lanes into place followed by an in-lane permute.
This is mainly for cases where we can have non-repeating permutes in each lane, but for now I've just enabled it for v4f64 unary shuffles to fix PR39161 - there is no test coverage for other shuffles that might benefit yet.
We now have several cross-lane shuffle lowering methods that all do something similar - I've looked at merging some of these (notably by making the repeated mask mechanism in lowerVectorShuffleByMerging128BitLanes optional), but there is a lot of assertions/assumptions in the way that makes this tricky - I ended up going for adding yet another relatively simple method instead.
Differential Revision: https://reviews.llvm.org/D53148
llvm-svn: 344446
Adam Balogh [Sat, 13 Oct 2018 11:17:59 +0000 (11:17 +0000)]
[clang-tidy] Fix for typos in the tests for `bugprone-exception-escape`
llvm-svn: 344445
Adam Balogh [Sat, 13 Oct 2018 10:34:52 +0000 (10:34 +0000)]
[clang-tidy] Optimize query in bugprone-exception-escape
Checking whether a functions throws indirectly may be very expensive because it
needs to visit its whole call graph. Therefore we should first check whether the
function is forbidden to throw and only check whether it throws afterward. This
also seems to solve bug https://bugs.llvm.org/show_bug.cgi?id=39167 where the
execution time is so long that it seems to hang.
Differential Revision: https://reviews.llvm.org/D53187
llvm-svn: 344444
Adam Balogh [Sat, 13 Oct 2018 10:24:48 +0000 (10:24 +0000)]
[Analyzer] Iterator Checker - Part 10: Tests for iterators passed as parameter
In earlier Clang Static Analyzer versions `check::Bind() was not invoked for
parameter passing, so we needed a trick which is not needed anymore. However
add the tests to ensure its working.
Differential Revision: https::/reviews.llvm.org/D32906
llvm-svn: 344443
Jonas Toth [Sat, 13 Oct 2018 09:30:58 +0000 (09:30 +0000)]
Revert "[clang-tidy] New checker for not null-terminated result caused by strlen(), size() or equal length"
This reverts commit r344374.
llvm-svn: 344442
Jonas Toth [Sat, 13 Oct 2018 09:30:46 +0000 (09:30 +0000)]
Revert "[doc] fix markup in clang-tidy bugprone-not-null-terminated-result"
This reverts commit r344379.
llvm-svn: 344441
Miklos Vajna [Sat, 13 Oct 2018 07:58:05 +0000 (07:58 +0000)]
[clang-tidy] add IgnoreMacros option to modernize-use-equals-delete
And also enable it by default to be consistent with e.g. modernize-use-using.
This improves consistency inside the check itself as well: both checks are now
disabled in macros by default.
This helps e.g. when running this check on client code where the macro is
provided by the system, so there is no easy way to modify it.
Reviewed By: alexfh
Differential Revision: https://reviews.llvm.org/D53217
llvm-svn: 344440
Arnaud A. de Grandmaison [Sat, 13 Oct 2018 07:43:56 +0000 (07:43 +0000)]
[AArch64] Swap comparison operands if that enables some folding.
Summary:
AArch64 can fold some shift+extend operations on the RHS operand of
comparisons, so swap the operands if that makes sense.
This provides a fix for https://bugs.llvm.org/show_bug.cgi?id=38751
Reviewers: efriedma, t.p.northover, javed.absar
Subscribers: mcrosier, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D53067
llvm-svn: 344439
Thomas Lively [Sat, 13 Oct 2018 07:26:10 +0000 (07:26 +0000)]
[WebAssembly] SIMD min and max
Summary: Depends on D52324 and D52764.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D52325
llvm-svn: 344438
Thomas Lively [Sat, 13 Oct 2018 07:21:44 +0000 (07:21 +0000)]
[Intrinsic] Add llvm.minimum and llvm.maximum instrinsic functions
Summary:
These new intrinsics have the semantics of the `minimum` and `maximum`
operations specified by the latest draft of IEEE 754-2018. Unlike
llvm.minnum and llvm.maxnum, these new intrinsics propagate NaNs and
always treat -0.0 as less than 0.0. `minimum` and `maximum` lower
directly to the existing `fminnan` and `fmaxnan` ISel DAG nodes. It is
safe to reuse these DAG nodes because before this patch were only
emitted in situations where there were known to be no NaN arguments or
where NaN propagation was correct and there were known to be no zero
arguments. I know of only four backends that lower fminnan and
fmaxnan: WebAssembly, ARM, AArch64, and SystemZ, and each of these
lowers fminnan and fmaxnan to instructions that are compatible with
the IEEE 754-2018 semantics.
Reviewers: aheejin, dschuff, sunfish, javed.absar
Subscribers: kristof.beyls, dexonsmith, kristina, llvm-commits
Differential Revision: https://reviews.llvm.org/D52764
llvm-svn: 344437
Thomas Lively [Sat, 13 Oct 2018 07:09:10 +0000 (07:09 +0000)]
[WebAssembly][NFC] Unify ARGUMENT classes
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D53172
llvm-svn: 344436
Dan Liew [Fri, 12 Oct 2018 23:36:23 +0000 (23:36 +0000)]
[lit] Support the `%shared_libasan` lit substitution on Apple platforms.
Summary:
The previous value looks Linux specific so that has been guarded with
the host OS being Linux.
On Apple platforms `%shared_libasan` expands to the absolute path of the
ASan dylib.
Previously on Linux `%shared_libasan` expanded to just the file name
of the shared library rather than the absolute path to the library.
This is likely a bug because it would rely on the OS's dynamic linker
to find the shared library which could accidentally pick up a system copy
rather than the shared library that was just built.
For other platforms we emit a warning if `config.asan_dynamic` is true.
This patch also only defines the substitution when `config.asan_dynamic`
is true because using this substitution only makes sense when the
dynamic library is available.
Reviewers: kubamracek, george.karpenkov, mgorny, phosek, etienneb, samsonov, kcc
Subscribers: #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D53111
llvm-svn: 344434
Kostya Serebryany [Fri, 12 Oct 2018 23:21:48 +0000 (23:21 +0000)]
move GetOrCreateFunctionComdat to Instrumentation.cpp/Instrumentation.h
Summary:
GetOrCreateFunctionComdat is currently used in SanitizerCoverage,
where it's defined. I'm planing to use it in HWASAN as well,
so moving it into a common location.
NFC
Reviewers: morehouse
Reviewed By: morehouse
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53218
llvm-svn: 344433
Alex Bradbury [Fri, 12 Oct 2018 23:18:52 +0000 (23:18 +0000)]
[RISCV] Eliminate unnecessary masking of promoted shift amounts
SelectionDAGBuilder::visitShift will always zero-extend a shift amount when it
is promoted to the ShiftAmountTy. This results in zero-extension (masking)
which is unnecessary for RISC-V as the shift operations only read the lower 5
or 6 bits (RV32 or RV64).
I initially proposed adding a getExtendForShiftAmount hook so the shift amount
can be any-extended (D52975). @efriedma explained this was unsafe, so I have
instead eliminate the unnecessary and operations at instruction selection time
in a manner similar to X86InstrCompiler.td.
Differential Revision: https://reviews.llvm.org/D53224
llvm-svn: 344432
Zachary Turner [Fri, 12 Oct 2018 23:07:32 +0000 (23:07 +0000)]
Add REQUIRES: lld to SymbolFileNativePDB tests.
llvm-svn: 344431
Fangrui Song [Fri, 12 Oct 2018 22:57:57 +0000 (22:57 +0000)]
[llvm-readobj] Fix an error message about .llvm.call-graph-profile
.note.llvm.cgprofile was an obvious typo in rL333823
llvm-svn: 344430
Zachary Turner [Fri, 12 Oct 2018 22:57:40 +0000 (22:57 +0000)]
Try to fix some failures on MacOSX with the NativePDB patch.
This adds -- before any filenames, so that /U doesn't get interpreted
as a command line.
It also adds better error checking, so that we don't get assertions
on the failure path when a file fails to parse as a PDB.
llvm-svn: 344429
Craig Topper [Fri, 12 Oct 2018 22:55:17 +0000 (22:55 +0000)]
[LegalizeVectorTypes] Use TLI.getVectorIdxTy instead of DAG.getIntPtrConstant.
There's no guarantee that vector indices should use pointer types. So use the correct query method.
llvm-svn: 344428
Rui Ueyama [Fri, 12 Oct 2018 22:44:06 +0000 (22:44 +0000)]
Simplify. NFC.
- Removed redundant `llvm::`
- Typedef a long type name
- Initialize members by member initializers
llvm-svn: 344427
Evgeniy Stepanov [Fri, 12 Oct 2018 22:07:54 +0000 (22:07 +0000)]
[sanitizer] Avoid extra newlines in syslog.
Fix line splitting logic to avoid sending empty lines to syslog, as
that adds extra newlines.
llvm-svn: 344426
Craig Topper [Fri, 12 Oct 2018 22:00:04 +0000 (22:00 +0000)]
[X86] Improve type legalization of (v2i32/v4i16/v8i16 (bitcast (v2f32))) to avoid a stack stack temporary.
llvm-svn: 344425
Craig Topper [Fri, 12 Oct 2018 22:00:00 +0000 (22:00 +0000)]
[X86] Simplify the end of custom type legalization for (v2i32/v4i16/v8i8 (bitcast (f64))) by just emitting an EXTRACT_SUBVECTOR instead of a BUILD_VECTOR.
Generic legalization should be able to finish legalizing the EXTRACT_SUBVECTOR probably by turning it into a BUILD_VECTOR. But we should emit the simplest sequence.
llvm-svn: 344424
Craig Topper [Fri, 12 Oct 2018 21:59:58 +0000 (21:59 +0000)]
[X86] Skip (v2i32/v4i16/v8i8 (bitcast (f64))) handling in ReplaceNodeResults if the dest type can be widened by generic legalization. NFCI
The algorithm we would do previously was identical to generic legalization. If we ever switch to legalizing integer vectors via widening we'll be able to kill off the code since it now only runs for promotion.
llvm-svn: 344423
Craig Topper [Fri, 12 Oct 2018 21:59:55 +0000 (21:59 +0000)]
[LegalizeVectorTypes] When widening the result of a bitcast from a scalar type, use a scalar_to_vector to turn the scalar into a vector intead of a build vector full of mostly undefs.
This is more consistent with what we usually do and matches some code X86 custom emits in some cases that I think I can cleanup.
The MIPS test change just looks to be an instruction ordering change.
llvm-svn: 344422
Marshall Clow [Fri, 12 Oct 2018 21:59:32 +0000 (21:59 +0000)]
One more local type warning removed from the tests. NFC
llvm-svn: 344421
Jim Ingham [Fri, 12 Oct 2018 21:27:49 +0000 (21:27 +0000)]
Change the default handling for SIGPIPE to pass/,no-stop/no-notify.
Most of the time SIGPIPE is just annoying, and so we should
pass it on silently it by default.
<rdar://problem/
39359145>
llvm-svn: 344418
Marshall Clow [Fri, 12 Oct 2018 21:24:44 +0000 (21:24 +0000)]
Update the array tests to not use a local type; removes warnings in C++03. NFC
llvm-svn: 344417
Marshall Clow [Fri, 12 Oct 2018 21:22:15 +0000 (21:22 +0000)]
Update all the max_size tests to eliminate signed/unsigned comparison warnings. NFC
llvm-svn: 344416
Samuel Benzaquen [Fri, 12 Oct 2018 21:01:15 +0000 (21:01 +0000)]
Add benchmarks for std::function.
Summary:
Benchmarks for construct, copy, move, swap, destroy and invoke, with 8
different input states.
For the cases that matter, it tests with and without allowing constant
value propagation from construction into the operation tested.
This also adds helper functions to generate the cartesian product of
different configurations and generate benchmarks for all of them.
Reviewers: EricWF
Subscribers: christof, ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D53087
llvm-svn: 344415
Jason Molenda [Fri, 12 Oct 2018 20:53:21 +0000 (20:53 +0000)]
Add NativePDB subdir again.
llvm-svn: 344414
Alexey Bataev [Fri, 12 Oct 2018 20:19:59 +0000 (20:19 +0000)]
[OPENMP][NVPTX]Reduce memory usage in target region.
Additional reduction of the global memory usage in the target regions
without parallel regions.
llvm-svn: 344413
Martin Storsjo [Fri, 12 Oct 2018 20:15:51 +0000 (20:15 +0000)]
[MinGW] Allow using LTO when lld is used as linker
Differential Revision: https://reviews.llvm.org/D53195
llvm-svn: 344412
Michal Gorny [Fri, 12 Oct 2018 20:03:54 +0000 (20:03 +0000)]
[python] [tests] Re-add once again, this time without Windows
llvm-svn: 344411
Stella Stamenova [Fri, 12 Oct 2018 20:00:20 +0000 (20:00 +0000)]
Fix failure in get_filecheck_path when filecheck is None
If the path was not specified (and it's None), lexists throws an exception rather than returning False. get_filecheck_path now checks whether filecheck is set before calling lexists
llvm-svn: 344410
Zachary Turner [Fri, 12 Oct 2018 19:47:13 +0000 (19:47 +0000)]
Resubmit "Add SymbolFileNativePDB plugin."
This was originally reverted due to some test failures on
Linux. Those problems turned out to require several additional
patches to lld and clang in order to fix, which have since been
submitted. This patch is resubmitted unchanged. All tests now
pass on both Linux and Windows.
llvm-svn: 344409
Simon Pilgrim [Fri, 12 Oct 2018 19:46:40 +0000 (19:46 +0000)]
Revert rL344365: [tests] Readd Python binding tests to check-all
Windows buildbots are still not happy
Now that both issues found out during the last iteration have been
fixed, reenable the Python binding tests on buildbots.
........
llvm-svn: 344408
Shafik Yaghmour [Fri, 12 Oct 2018 19:46:17 +0000 (19:46 +0000)]
Changing test names in TestDataFormatterLibcxxVariant.py and TestStdFunctionStepIntoCallable.py to be unique, NFC
llvm-svn: 344407
Ben Hamilton [Fri, 12 Oct 2018 19:43:01 +0000 (19:43 +0000)]
[clang-format] Fix BraceWrapping AfterFunction for ObjC methods
Summary:
> clang-format --version
> clang-format version 7.0.0 (tags/RELEASE_700/final)
> echo "@implementation Foo\n- (void)foo:(id)bar\n{\n}\n@end\n" |clang-format -style='{BreakBeforeBraces: Custom, BraceWrapping: {AfterFunction: true}}'
```
@implementation Foo
- (void)foo:(id)bar {
}
@end
```
with patch:
> bin/clang-format --version
> clang-format version 8.0.0 (trunk 344285)
> echo "@implementation Foo\n- (void)foo:(id)bar\n{\n}\n@end\n" |bin/clang-format -style='{BreakBeforeBraces: Custom, BraceWrapping: {AfterFunction: true}}'
```
@implementation Foo
- (void)foo:(id)bar
{
}
@end
```
Contributed by hultman@.
Reviewers: benhamilton, jolesiak, klimek, Wizard
Reviewed By: benhamilton
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D53197
llvm-svn: 344406
Eli Friedman [Fri, 12 Oct 2018 19:41:05 +0000 (19:41 +0000)]
Revert BTF commit series.
The initial patch was not reviewed, and does not have any tests;
it should not have been merged.
This reverts 344395, 344390, 344387, 344385, 344381, 344376,
and 344366.
llvm-svn: 344405
Craig Topper [Fri, 12 Oct 2018 19:37:49 +0000 (19:37 +0000)]
[LegalizeVectorTypes] When widening the operands to a concat_vectors, see if we can use the widened operand 0 if the width matches and the other operands are undef.
This saves a conversion to extracts and build_vector. We already do this when both the result and the input need to be widened to the same type.
This changed the sse-intrinsics-fast-isel test because we don't lower (insert_vector_elt (scalar_to_vector X), Y, 1) well. We turn it into (vector_shuffle (scalar_to_vector X), (scalar_to_vector Y), <0, 4, 2, 3>) losing track of the fact that the upper elts could be undef.
We should probably find a way to prevent the scalarization of the <2 x f32> load on these tests.
llvm-svn: 344404
Craig Topper [Fri, 12 Oct 2018 19:37:47 +0000 (19:37 +0000)]
[LegalizeVectorTypes] When unrolling in WidenVecRes_Convert, make sure we use the original vector element count. Not min of the widened result type and the possibly widened input type.
If the input type is widened as well, but we still were forced to unroll, we shouldn't be considering the widened input element count. We should only create as many scalar operations as the original type called for.
This will be important for an upcoming patch.
llvm-svn: 344403
Simon Pilgrim [Fri, 12 Oct 2018 19:30:43 +0000 (19:30 +0000)]
Fix Wdocumentation warning. NFCI.
llvm-svn: 344402
Vedant Kumar [Fri, 12 Oct 2018 19:29:59 +0000 (19:29 +0000)]
[dotest] Make a missing FileCheck binary a warning, not an error
This allows bots which haven't updated to pass in --filecheck to
dotest.py to run more tests. FileCheck-dependent tests will continue to
fail.
Differential Revision: https://reviews.llvm.org/D53175
llvm-svn: 344401
Simon Pilgrim [Fri, 12 Oct 2018 19:14:43 +0000 (19:14 +0000)]
Fix a clang::driver::ArgStringList usage I missed in rL344398. NFCI.
llvm-svn: 344400
Simon Pilgrim [Fri, 12 Oct 2018 19:03:54 +0000 (19:03 +0000)]
Regenerate test. NFCI.
llvm-svn: 344399
Simon Pilgrim [Fri, 12 Oct 2018 18:55:36 +0000 (18:55 +0000)]
Consistently make llvm::opt::ArgStringList usage explicit to try and appease MSVC 2015 buildbots. NFCI.
llvm-svn: 344398
Jim Ingham [Fri, 12 Oct 2018 18:46:02 +0000 (18:46 +0000)]
Add "v" as well as "var" as an alias for "frame var".
<rdar://problem/
40066460>
llvm-svn: 344397
Rui Ueyama [Fri, 12 Oct 2018 18:29:30 +0000 (18:29 +0000)]
Replace assert() with llvm_unreachable because it's obviously a typo.
llvm-svn: 344395
Rui Ueyama [Fri, 12 Oct 2018 18:29:18 +0000 (18:29 +0000)]
Remove `Type` parameter from SymbolTable::insert(). NFC.
`Type` parameter was used only to check for TLS attribute mismatch,
but we can do that when we actually replace symbols, so we don't need
to type as an argument. This change should simplify the interface of
the symbol table a bit.
llvm-svn: 344394
Reid Kleckner [Fri, 12 Oct 2018 18:19:06 +0000 (18:19 +0000)]
[codeview] Emit S_BUILDINFO and LF_BUILDINFO with cwd and source file
Summary: We can fill in the command line and compiler path later if we want.
Reviewers: zturner
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D53179
llvm-svn: 344393
Andrea Di Biagio [Fri, 12 Oct 2018 18:18:53 +0000 (18:18 +0000)]
[llvm-mca] Correctly set aliases for register writes introduced by optimized register moves.
This fixes a problem introduced by r344334. A write from a non-zero move
eliminated at register renaming stage was not correctly handled by the PRF. This
would have led to an assertion failure if the processor model declares a PRF
that enables non-zero move elimination.
llvm-svn: 344392
Jonathan Metzman [Fri, 12 Oct 2018 18:11:47 +0000 (18:11 +0000)]
[SanitizerCoverage] Prevent /OPT:REF from stripping constructors
Summary:
Linking with the /OPT:REF linker flag when building COFF files causes
the linker to strip SanitizerCoverage's constructors. Prevent this by
giving the constructors WeakODR linkage and by passing the linker a
directive to include sancov.module_ctor.
Include a test in compiler-rt to verify libFuzzer can be linked using
/OPT:REF
Reviewers: morehouse, rnk
Reviewed By: morehouse, rnk
Subscribers: rnk, morehouse, hiraditya
Differential Revision: https://reviews.llvm.org/D52119
llvm-svn: 344391
Simon Pilgrim [Fri, 12 Oct 2018 18:10:04 +0000 (18:10 +0000)]
Fix MCBTF string array initialization so its MSVC friendly. NFCI.
llvm-svn: 344390
Reid Kleckner [Fri, 12 Oct 2018 18:08:11 +0000 (18:08 +0000)]
Revert r344375 "[Driver] check for exit code from SIGPIPE"
This doesn't build on Windows.
llvm-svn: 344389
Jonas Toth [Fri, 12 Oct 2018 17:57:18 +0000 (17:57 +0000)]
[Doc] fix second error in UsersManual
llvm-svn: 344388
Fangrui Song [Fri, 12 Oct 2018 17:57:07 +0000 (17:57 +0000)]
[BPF] Use cstdint {,u}int*_t instead of linux/types.h __u32 __u16 ...
llvm-svn: 344387
Stella Stamenova [Fri, 12 Oct 2018 17:56:01 +0000 (17:56 +0000)]
[lldbsuite] Fix the filecheck functionality to work with Python 3
Summary: This is another string/byte conversion issue between Python 2 and 3. In Python 2, the subprocess communication expects a byte string, but in Python 3, it expects bytes. Since both versions are capable of using strings when universal_newlines is set to True AND filecheck operates on strings, force the use of strings.
Reviewers: zturner, asmith, vsk
Reviewed By: zturner
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D53166
llvm-svn: 344386
Eric Liu [Fri, 12 Oct 2018 17:55:21 +0000 (17:55 +0000)]
Disambiguate: s/make_unique/llvm::make_unique/. NFC
llvm-svn: 344385
Jonas Toth [Fri, 12 Oct 2018 17:47:43 +0000 (17:47 +0000)]
[clangd] NFC fix semicolon warning
llvm-svn: 344384
Jonas Toth [Fri, 12 Oct 2018 17:44:01 +0000 (17:44 +0000)]
[Doc] fix BB, add code-block type
llvm-svn: 344382
Fangrui Song [Fri, 12 Oct 2018 17:41:12 +0000 (17:41 +0000)]
[BPF] Don't include linux/types.h and fix style
llvm-svn: 344381
Jonas Toth [Fri, 12 Oct 2018 17:36:04 +0000 (17:36 +0000)]
[doc] fix markup in clang-tidy bugprone-not-null-terminated-result
llvm-svn: 344379
Zachary Turner [Fri, 12 Oct 2018 17:28:39 +0000 (17:28 +0000)]
Fix another error related to YAML quoting.
This one occured in polly, which I didn't build / test the first
time so I didn't catch it.
llvm-svn: 344378
Zachary Turner [Fri, 12 Oct 2018 17:26:19 +0000 (17:26 +0000)]
Better support for POSIX paths in PDBs.
This a resubmission of a patch which was previously reverted
due to breaking several lld tests. The issues causing those
failures have been fixed, so the patch is now resubmitted.
---Original Commit Message---
While it doesn't make a *ton* of sense for POSIX paths to be
in PDBs, it's possible to occur in real scenarios involving
cross compilation.
The tools need to be able to handle this, because certain types
of debugging scenarios are possible without a running process
and so don't necessarily require you to be on a Windows system.
These include post-mortem debugging and binary forensics (e.g.
using a debugger to disassemble functions and examine symbols
without running the process).
There's changes in clang, LLD, and lldb in this patch. After
this the cross-platform disassembly and source-list tests pass
on Linux.
Furthermore, the behavior of LLD can now be summarized by a much
simpler rule than before: Unless you specify /pdbsourcepath and
/pdbaltpath, the PDB ends up with paths that are valid within
the context of the machine that the link is performed on.
Differential Revision: https://reviews.llvm.org/D53149
llvm-svn: 344377
Fangrui Song [Fri, 12 Oct 2018 17:23:25 +0000 (17:23 +0000)]
[BPF] Some fixes after rL344366
* Move #include outside of namespaces
* Add missing #include
* Add out-of-line virtual destructor to BTFTypeEntry
designated initializers should also be fixed
llvm-svn: 344376
Nick Desaulniers [Fri, 12 Oct 2018 17:22:46 +0000 (17:22 +0000)]
[Driver] check for exit code from SIGPIPE
Summary:
D53000 adds a special exit code for SIGPIPE (writing to a closed
reader), and rather than print a fatal warning, skips printing the
error. This can be seen commonly from piping into head, tee, or
split.
Fixes PR25349, rdar://problem/
14285346, b/
77310947.
Reviewers: jfb
Reviewed By: jfb
Subscribers: cfe-commits, thakis, srhines
Differential Revision: https://reviews.llvm.org/D53001
llvm-svn: 344375
Jonas Toth [Fri, 12 Oct 2018 17:22:36 +0000 (17:22 +0000)]
[clang-tidy] New checker for not null-terminated result caused by strlen(), size() or equal length
New checker called bugprone-not-null-terminated-result. This check finds function calls where it is possible to cause a not null-terminated result. Usually the proper length of a string is strlen(src) + 1 or equal length of this expression, because the null terminator needs an extra space. Without the null terminator it can result in undefined behaviour when the string is read.
The following function calls are checked:
memcpy, wmemcpy, memcpy_s, wmemcpy_s, memchr, wmemchr, memmove, wmemmove, memmove_s, wmemmove_s, memset, wmemset, strerror_s, strncmp, wcsncmp, strxfrm, wcsxfrm
The following is a real-world example where the programmer forgot to increase the passed third argument, which is size_t length. That is why the length of the allocated memory is problematic too.
static char *StringCpy(const std::string &str) {
char *result = reinterpret_cast<char *>(malloc(str.size()));
memcpy(result, str.data(), str.size());
return result;
}
After running the tool fix-it rewrites all the necessary code according to the given options. If it is necessary, the buffer size will be increased to hold the null terminator.
static char *StringCpy(const std::string &str) {
char *result = reinterpret_cast<char *>(malloc(str.size() + 1));
strcpy(result, str.data());
return result;
}
Patch by Charusso.
Differential ID: https://reviews.llvm.org/D45050
llvm-svn: 344374
Erik Pilkington [Fri, 12 Oct 2018 17:22:10 +0000 (17:22 +0000)]
[CodeGen] Handle extern references to OBJC_CLASS_$_*
Some ObjC users declare a extern variable named OBJC_CLASS_$_Foo, then use it's
address as a Class. I.e., one could define isInstanceOfF:
BOOL isInstanceOfF(id c) {
extern void OBJC_CLASS_$_F;
return [c class] == (Class)&OBJC_CLASS_$_F;
}
This leads to asserts in clang CodeGen if there is an @implementation of F in
the same TU as an instance of this pattern, because CodeGen assumes that a
variable named OBJC_CLASS_$_* has the right type. This commit fixes the problem
by RAUWing the old (incorrectly typed) global with a new global, then removing
the old global.
rdar://
45077269
Differential revision: https://reviews.llvm.org/D53154
llvm-svn: 344373
Nick Desaulniers [Fri, 12 Oct 2018 17:22:07 +0000 (17:22 +0000)]
[Support] exit with custom return code for SIGPIPE
Summary:
We tell the user to file a bug report on LLVM right now, and
SIGPIPE isn't LLVM's fault so our error message is wrong.
Allows frontends to detect SIGPIPE from writing to closed readers.
This can be seen commonly from piping into head, tee, or split.
Fixes PR25349, rdar://problem/
14285346, b/
77310947
Reviewers: jfb
Reviewed By: jfb
Subscribers: majnemer, kristina, llvm-commits, thakis, srhines
Differential Revision: https://reviews.llvm.org/D53000
llvm-svn: 344372
Shafik Yaghmour [Fri, 12 Oct 2018 17:20:39 +0000 (17:20 +0000)]
Adding support to step into the callable wrapped by libc++ std::function
rdar://problem/
14365983
Differential Revision: https://reviews.llvm.org/D52851
llvm-svn: 344371
Louis Dionne [Fri, 12 Oct 2018 17:12:41 +0000 (17:12 +0000)]
[NFC][libc++] Fix broken link in comment
llvm-svn: 344369
Rui Ueyama [Fri, 12 Oct 2018 17:07:32 +0000 (17:07 +0000)]
[lld] Add more complete support for the INCLUDE command.
Patch by Ian Tessier.
This change adds INCLUDE support to the MEMORY and SECTION commands, and
to output sections, as per:
https://sourceware.org/binutils/docs/ld/File-Commands.html#File-Commands
Differential Revision: https://reviews.llvm.org/D52951
llvm-svn: 344368
Dan Albert [Fri, 12 Oct 2018 17:06:31 +0000 (17:06 +0000)]
[Driver] Add defaults for Android ARM FPUs.
Summary:
Android mandates that devices have at least vfpv3-d16 until
Marshmallow and NEON after that. Still honor the user's decision, but
raise the defaults for Android targets.
Reviewers: srhines, pirama, javed.absar, kristof.beyls, peter.smith
Reviewed By: peter.smith
Subscribers: peter.smith, rengolin, kristof.beyls, chrib, cfe-commits
Differential Revision: https://reviews.llvm.org/D53121
llvm-svn: 344367
Yonghong Song [Fri, 12 Oct 2018 17:01:46 +0000 (17:01 +0000)]
[BPF] Add BTF generation for BPF target
BTF is the debug format for BPF, a kernel virtual machine
and widely used for tracing, networking and security, etc ([1]).
Currently only instruction streams are passed to kernel,
the kernel verifier verifies them before execution. In order to
provide better visibility of bpf programs to user space
tools, some debug information, e.g., function names and
debug line information are desirable for kernel so tools
can get such information with better annotation
for jited instructions for performance or other reasons.
The dwarf is too complicated in kernel and for BPF.
Hence, BTF is designed to be the debug format for BPF ([2]).
Right now, pahole supports BTF for types, which
are generated based on dwarf sections in the ELF file.
In order to annotate performance metrics for jited bpf insns,
it is necessary to pass debug line info to the kernel.
Furthermore, we want to pass the actual code to the
kernel because of the following reasons:
. bpf program typically is small so storage overhead
should be small.
. in bpf land, it is totally possible that
an application loads the bpf program into the
kernel and then that application quits, so
holding debug info by the user space application
is not practical.
. having source codes directly kept by kernel
would ease deployment since the original source
code does not need ship on every hosts and
kernel-devel package does not need to be
deployed even if kernel headers are used.
The only reliable time to get the source code is
during compilation time. This will result in both more
accurate information and easier deployment as
stated in the above.
Another consideration is for JIT. The project like bcc
use MCJIT to compile a C program into bpf insns and
load them to the kernel ([3]). The generated BTF sections
will be readily available for such cases as well.
This patch implemented generation of BTF info in llvm
compiler. The BTF related sections will be generated
when both -target bpf and -g are specified. Two sections
are generated:
.BTF contains all the type and string information, and
.BTF.ext contains the func_info and line_info.
The separation is related to how two sections are used
differently in bpf loader, e.g., linux libbpf ([4]).
The .BTF section can be loaded into the kernel directly
while .BTF.ext needs loader manipulation before loading
to the kernel. The format of the each section is roughly
defined in llvm:include/llvm/MC/MCBTFContext.h and
from the implementation in llvm:lib/MC/MCBTFContext.cpp.
A later example also shows the contents in each section.
The type and func_info are gathered during CodeGen/AsmPrinter
by traversing dwarf debug_info. The line_info is
gathered in MCObjectStreamer before writing to
the object file. After all the information is gathered,
the two sections are emitted in MCObjectStreamer::finishImpl.
With cmake CMAKE_BUILD_TYPE=Debug, the compiler can
dump out all the tables except insn offset, which
will be resolved later as relocation records.
The debug type "btf" is used for BTFContext dump.
Dwarf tests the debug info generation with
llvm-dwarfdump to decode the binary sections and
check whether the result is expected. Currently
we do not have such a tool yet. We will implement
btf dump functionality in bpftool ([5]) as the bpftool is
considered the recommended tool for bpf introspection.
The implementation for type and func_info is tested
with linux kernel test cases. The line_info is visually
checked with dump from linux kernel libbpf ([4]) and
checked with readelf dumping section raw data.
Note that the .BTF and .BTF.ext information will not
be emitted to assembly code and there is no assembler
support for BTF either.
In the below, with a clang/llvm built with CMAKE_BUILD_TYPE=Debug,
Each table contents are shown for a simple C program.
-bash-4.2$ cat -n test.c
1 struct A {
2 int a;
3 char b;
4 };
5
6 int test(struct A *t) {
7 return t->a;
8 }
-bash-4.2$ clang -O2 -target bpf -g -mllvm -debug-only=btf -c test.c
Type Table:
[1] FUNC name_off=1 info=0x0c000001 size/type=2
param_type=3
[2] INT name_off=12 info=0x01000000 size/type=4
desc=0x01000020
[3] PTR name_off=0 info=0x02000000 size/type=4
[4] STRUCT name_off=16 info=0x04000002 size/type=8
name_off=18 type=2 bit_offset=0
name_off=20 type=5 bit_offset=32
[5] INT name_off=22 info=0x01000000 size/type=1
desc=0x02000008
String Table:
0 :
1 : test
6 : .text
12 : int
16 : A
18 : a
20 : b
22 : char
27 : test.c
34 : int test(struct A *t) {
58 : return t->a;
FuncInfo Table:
sec_name_off=6
insn_offset=<Omitted> type_id=1
LineInfo Table:
sec_name_off=6
insn_offset=<Omitted> file_name_off=27 line_off=34 line_num=6 column_num=0
insn_offset=<Omitted> file_name_off=27 line_off=58 line_num=7 column_num=3
-bash-4.2$ readelf -S test.o
......
[12] .BTF PROGBITS
0000000000000000 0000028d
00000000000000c1 0000000000000000 0 0 1
[13] .BTF.ext PROGBITS
0000000000000000 0000034e
0000000000000050 0000000000000000 0 0 1
[14] .rel.BTF.ext REL
0000000000000000 00000648
0000000000000030 0000000000000010 16 13 8
......
-bash-4.2$
The latest linux kernel ([6]) can already support .BTF with type information.
The [7] has the reference implementation in linux kernel side
to support .BTF.ext func_info. The .BTF.ext line_info support is not
implemented yet. If you have difficulty accessing [6], you can
manually do the following to access the code:
git clone https://github.com/yonghong-song/bpf-next-linux.git
cd bpf-next-linux
git checkout btf
The change will push to linux kernel soon once this patch is landed.
References:
[1]. https://www.kernel.org/doc/Documentation/networking/filter.txt
[2]. https://lwn.net/Articles/750695/
[3]. https://github.com/iovisor/bcc
[4]. https://github.com/torvalds/linux/tree/master/tools/lib/bpf
[5]. https://github.com/torvalds/linux/tree/master/tools/bpf/bpftool
[6]. https://github.com/torvalds/linux
[7]. https://github.com/yonghong-song/bpf-next-linux/tree/btf
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Differential Revision: https://reviews.llvm.org/D52950
llvm-svn: 344366
Michal Gorny [Fri, 12 Oct 2018 16:55:44 +0000 (16:55 +0000)]
[tests] Readd Python binding tests to check-all
Now that both issues found out during the last iteration have been
fixed, reenable the Python binding tests on buildbots.
llvm-svn: 344365
Michal Gorny [Fri, 12 Oct 2018 16:55:39 +0000 (16:55 +0000)]
[python] [tests] Remove cdb lookup failure test
Remove the test checking for compilation db lookup failure.
Since r342228, JSONCompilationDatabasePlugin infers compile commands for
missing files, therefore making the lookup always succeed.
Differential Revision: https://reviews.llvm.org/D53202
llvm-svn: 344364
Sam McCall [Fri, 12 Oct 2018 16:51:48 +0000 (16:51 +0000)]
[clangd] Return Command objects from onCodeAction, rather than ad-hoc JSON. NFC
llvm-svn: 344363
Zachary Turner [Fri, 12 Oct 2018 16:41:37 +0000 (16:41 +0000)]
Fix one additional test broken by the YAML quoting change.
llvm-svn: 344362
Sanjay Patel [Fri, 12 Oct 2018 16:41:02 +0000 (16:41 +0000)]
[x86] add and use fast horizontal vector math subtarget feature
This is the planned follow-up to D52997. Here we are reducing horizontal vector math codegen
by default. AMD Jaguar (btver2) should have no difference with this patch because it has
fast-hops. (If we want to set that bit for other CPUs, let me know.)
The code changes are small, but there are many test diffs. For files that are specifically
testing for hops, I added RUNs to distinguish fast/slow, so we can see the consequences
side-by-side. For files that are primarily concerned with codegen other than hops, I just
updated the CHECK lines to reflect the new default codegen.
To recap the recent horizontal op story:
1. Before rL343727, we were producing hops for all subtargets for a variety of patterns.
Hops were likely not optimal for all targets though.
2. The IR improvement in r343727 exposed a hole in the backend hop pattern matching, so
we reduced hop codegen for all subtargets. That was bad for Jaguar (PR39195).
3. We restored the hop codegen for all targets with rL344141. Good for Jaguar, but
probably bad for other CPUs.
4. This patch allows us to distinguish when we want to produce hops, so everyone can be
happy. I'm not sure if we have the best predicate here, but the intent is to undo the
extra hop-iness that was enabled by r344141.
Differential Revision: https://reviews.llvm.org/D53095
llvm-svn: 344361
Nick Desaulniers [Fri, 12 Oct 2018 16:35:44 +0000 (16:35 +0000)]
[MC][ELF] fix newly added test
Summary:
Reland of
- r344197 "[MC][ELF] compute entity size for explicit sections"
- r344206 "[MC][ELF] Fix section_mergeable_size.ll"
after being reverted in r344278 due to build breakages from not
specifying a target triple.
Move test from test/CodeGen/Generic/ to test/MC/ELF/.
Add explicit target triple so we don't try to run
this test on non ELF targets.
Reported: https://reviews.llvm.org/D53056#1261707
Reviewers: fhahn, rnk, espindola, NoQ
Reviewed By: fhahn, rnk
Subscribers: NoQ, MaskRay, rengolin, emaste, arichardson, llvm-commits, pirama, srhines
Differential Revision: https://reviews.llvm.org/D53146
llvm-svn: 344360
Zachary Turner [Fri, 12 Oct 2018 16:31:20 +0000 (16:31 +0000)]
Make YAML quote forward slashes.
If you have the string /usr/bin, prior to this patch it would not
be quoted by our YAML serializer. But a string like C:\src would
be, due to the presence of a backslash. This makes the quoting
rules of basically every single file path different depending on
the path syntax (posix vs. Windows).
While technically not required by the YAML specification to quote
forward slashes, when the behavior of paths is inconsistent it
makes it difficult to portably write FileCheck lines that will
work with either kind of path.
Differential Revision: https://reviews.llvm.org/D53169
llvm-svn: 344359
Zachary Turner [Fri, 12 Oct 2018 16:31:08 +0000 (16:31 +0000)]
Revert "Make YAML quote forward slashes."
This reverts commit
b86c16ad8c97dadc1f529da72a5bb74e9eaed344.
This is being reverted because I forgot to write a useful
commit message, so I'm going to resubmit it with an actual
commit message.
llvm-svn: 344358
Zachary Turner [Fri, 12 Oct 2018 16:24:09 +0000 (16:24 +0000)]
Make YAML quote forward slashes.
llvm-svn: 344357
Alexey Bataev [Fri, 12 Oct 2018 16:04:20 +0000 (16:04 +0000)]
[OPENMP][NVPTX]Reduce memory usage in orphaned functions.
if the function has globalized variables and called in context of
target/teams/distribute regions, it does not need to globalize 32
copies of the same variables for memory coalescing, it is enough to
have just one copy, because there is parallel region.
Patch does this by adding call for `__kmpc_parallel_level` function and
checking its return value. If the code sees that the parallel level is
0, then only one variable is allocated, not 32.
llvm-svn: 344356
Simon Pilgrim [Fri, 12 Oct 2018 15:49:19 +0000 (15:49 +0000)]
Pull out repeated value types. NFCI.
llvm-svn: 344355
Simon Pilgrim [Fri, 12 Oct 2018 15:48:47 +0000 (15:48 +0000)]
Pull out repeated value types. NFCI.
llvm-svn: 344354
Sanjay Patel [Fri, 12 Oct 2018 15:22:14 +0000 (15:22 +0000)]
[AArch64][x86] add tests for trunc disguised as vector ops (PR39016); NFC
These correspond to the IR transform from:
D52439
llvm-svn: 344353
Simon Pilgrim [Fri, 12 Oct 2018 15:16:25 +0000 (15:16 +0000)]
Fix MSVC 2015 ambiguous symbol warning introduced by rL344337. NFCI.
llvm-svn: 344352
Guillaume Chatelet [Fri, 12 Oct 2018 15:12:22 +0000 (15:12 +0000)]
[llvm-exegesis][NFC] Simplify code at the cost of small code duplication
Reviewers: courbet
Subscribers: tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D53198
llvm-svn: 344351
Eric Liu [Fri, 12 Oct 2018 15:01:11 +0000 (15:01 +0000)]
Fix unused variable warning after r344348
llvm-svn: 344350
Simon Pilgrim [Fri, 12 Oct 2018 14:45:57 +0000 (14:45 +0000)]
[SelectionDAG] Move VectorLegalizer::ExpandCTLZ codegen into SelectionDAGLegalize
Generalize SelectionDAGLegalize's CTLZ expansion to handle vectors - lets VectorLegalizer::ExpandCTLZ to just pass the expansion on instead of repeating the same codegen.
llvm-svn: 344349
Simon Pilgrim [Fri, 12 Oct 2018 14:18:47 +0000 (14:18 +0000)]
[X86][SSE] LowerVectorCTPOP - pull out repeated byte sum stage.
Pull out repeated byte sum stage for popcount of vector elements > 8bits.
This allows us to simplify the LUT/BITMATH popcnt code to always assume vXi8 vectors, and also improves avx512bitalg codegen which only has access to vpopcntb/vpopcntw.
llvm-svn: 344348
Hiroshi Inoue [Fri, 12 Oct 2018 14:02:20 +0000 (14:02 +0000)]
[PowerPC] avoid masking already-zero bits in BitPermutationSelector
The current BitPermutationSelector generates a code to build a value by tracking two types of bits: ConstZero and Variable.
ConstZero means a bit we need to mask off and Variable is a bit we copy from an input value.
This patch add third type of bits VariableKnownToBeZero caused by AssertZext node or zero-extending load node.
VariableKnownToBeZero means a bit comes from an input value, but it is known to be already zero. So we do not need to mask them.
VariableKnownToBeZero enhances flexibility to group bits, since we can avoid redundant masking for these bits.
This patch also renames "HasZero" to "NeedMask" since now we may skip masking even when we have zeros (of type VariableKnownToBeZero).
Differential Revision: https://reviews.llvm.org/D48025
llvm-svn: 344347