Commit Graph

301262 Commits

Author SHA1 Message Date
Enrico Steffinlongo a72a15a5c7 [analyzer] Small SMT API improvement
Summary: Removed const qualifier from reset method of SMTSolver and Z3Solver objects.

Reviewers: mikhail.ramalho, george.karpenkov, NoQ, ddcc

Reviewed By: NoQ

Subscribers: xazax.hun, szepet, a.sidorin, Szelethus

Differential Revision: https://reviews.llvm.org/D52031

llvm-svn: 344463
2018-10-13 19:42:10 +00:00
Hans Wennborg 2fe010473d Re-commit r344234 "clang-cl: Add /showFilenames option (PR31957)"
The test was failing on e.g. PPC which can't target Windows. Fix by
requiring X86 target in the test. Also, make sure the output goes to a
temporary directory, since CWD may not be writable.

llvm-svn: 344462
2018-10-13 19:13:14 +00:00
Simon Pilgrim 28a143f738 Pull out repeated variables from SelectionDAGLegalize::ExpandBitCount.
The CTPOP case has been changed from VT.getSizeInBits to VT.getScalarSizeInBits - but this fits in with future work for vector support (PR32655) and doesn't affect any current (scalar) uses.

llvm-svn: 344461
2018-10-13 18:40:48 +00:00
Craig Topper 189e5b4ab6 [LegalizeTypes] Prevent an assertion from PromoteIntRes_BSWAP and PromoteIntRes_BITREVERSE if the shift amount is too large for the VT returned by getShiftAmountTy
Summary:
getShiftAmountTy for X86 returns MVT::i8. If a BSWAP or BITREVERSE is created that requires promotion and the difference between the original VT and the promoted VT is more than 255 then we won't able to create the constant.

This patch adds a check to replace the result from getShiftAmountTy to MVT::i32 if the difference won't fit. This should get legalized later when the shift is ultimately expanded since its clearly an illegal type that we're only promoting to make it a power of 2 bit width. Alternatively we could base the decision completely on the largest shift amount the promoted VT could use.

Vectors should be immune here because getShiftAmountTy always returns the incoming VT for vectors. Only the scalar shift amount can be changed by the targets.

Reviewers: eli.friedman, RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D53232

llvm-svn: 344460
2018-10-13 17:47:20 +00:00
Thomas Lively ffde98de21 [WebAssembly][NFC] Fix signed/unsigned comparison warning
llvm-svn: 344459
2018-10-13 16:58:03 +00:00
Sanjay Patel 47579b21e2 [InstCombine] fix complexity canonicalization with fake unary vector ops
This is a preliminary step to avoid regressions when we add
an actual 'fneg' instruction to IR. See D52934 and D53205.

llvm-svn: 344458
2018-10-13 16:15:37 +00:00
Simon Pilgrim c5d7c6e5f6 [X86][SSE] Remove most of vector CTTZ custom lowering and use LegalizeDAG instead.
There is one remnant - AVX1 custom splitting of 256-bit vectors - which is due to a regression where the X86ISD::ANDNP is still performed as a YMM.

I've also tightened the CTLZ or CTPOP lowering in SelectionDAGLegalize::ExpandBitCount to require a legal CTLZ - it doesn't affect existing users and fixes an issue with AVX512 codegen.

llvm-svn: 344457
2018-10-13 16:11:15 +00:00
Sanjay Patel 3d22fbd785 [InstCombine] add tests for operand complexity canonicalization; NFC
The tests with undef vector elements demonstrate a hole in 
the current pattern matching.

llvm-svn: 344456
2018-10-13 16:02:47 +00:00
David Bolvansky d463e0475e [NFC] Fixed duplicated test file
llvm-svn: 344455
2018-10-13 15:26:13 +00:00
David Bolvansky e8b3bba717 [InstCombine] Fixed crash with aliased functions
Summary: Fixes PR39177

Reviewers: spatel, jbuening

Reviewed By: jbuening

Subscribers: jbuening, llvm-commits

Differential Revision: https://reviews.llvm.org/D53129

llvm-svn: 344454
2018-10-13 15:21:55 +00:00
Simon Pilgrim 1c2051ead7 [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
2018-10-13 15:16:55 +00:00
Simon Pilgrim 1c6d320351 [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
2018-10-13 14:45:44 +00:00
Simon Pilgrim a03379527a [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
2018-10-13 14:28:40 +00:00
Simon Pilgrim 10434cbae1 Pull out repeated getOperand(). NFCI.
llvm-svn: 344450
2018-10-13 13:33:32 +00:00
Simon Pilgrim bc141724c0 Remove unused variable. NFCI.
llvm-svn: 344449
2018-10-13 13:30:10 +00:00
Simon Pilgrim f64e654d62 [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
2018-10-13 13:05:19 +00:00
Simon Pilgrim afead139cf [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
2018-10-13 12:12:06 +00:00
Simon Pilgrim f3952413f7 [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
2018-10-13 11:38:10 +00:00
Adam Balogh af1f374ece [clang-tidy] Fix for typos in the tests for `bugprone-exception-escape`
llvm-svn: 344445
2018-10-13 11:17:59 +00:00
Adam Balogh d053f5c616 [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
2018-10-13 10:34:52 +00:00
Adam Balogh 45ca9b705c [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
2018-10-13 10:24:48 +00:00
Jonas Toth cd3e370504 Revert "[clang-tidy] New checker for not null-terminated result caused by strlen(), size() or equal length"
This reverts commit r344374.

llvm-svn: 344442
2018-10-13 09:30:58 +00:00
Jonas Toth bbbebeb928 Revert "[doc] fix markup in clang-tidy bugprone-not-null-terminated-result"
This reverts commit r344379.

llvm-svn: 344441
2018-10-13 09:30:46 +00:00
Miklos Vajna abfccc2cf6 [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
2018-10-13 07:58:05 +00:00
Arnaud A. de Grandmaison 162435e7b5 [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
2018-10-13 07:43:56 +00:00
Thomas Lively 3afc346dd0 [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
2018-10-13 07:26:10 +00:00
Thomas Lively 16c349d892 [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
2018-10-13 07:21:44 +00:00
Thomas Lively 0ff82ac154 [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
2018-10-13 07:09:10 +00:00
Dan Liew 74c6aaf81c [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
2018-10-12 23:36:23 +00:00
Kostya Serebryany bc504559ec 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
2018-10-12 23:21:48 +00:00
Alex Bradbury 748d080e62 [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
2018-10-12 23:18:52 +00:00
Zachary Turner 71f484c967 Add REQUIRES: lld to SymbolFileNativePDB tests.
llvm-svn: 344431
2018-10-12 23:07:32 +00:00
Fangrui Song 49c9ba1304 [llvm-readobj] Fix an error message about .llvm.call-graph-profile
.note.llvm.cgprofile was an obvious typo in rL333823

llvm-svn: 344430
2018-10-12 22:57:57 +00:00
Zachary Turner 8040eea9cb 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
2018-10-12 22:57:40 +00:00
Craig Topper a796580903 [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
2018-10-12 22:55:17 +00:00
Rui Ueyama 3d354081e0 Simplify. NFC.
- Removed redundant `llvm::`
 - Typedef a long type name
 - Initialize members by member initializers

llvm-svn: 344427
2018-10-12 22:44:06 +00:00
Evgeniy Stepanov 9ab897dcb5 [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
2018-10-12 22:07:54 +00:00
Craig Topper 3e76b2d736 [X86] Improve type legalization of (v2i32/v4i16/v8i16 (bitcast (v2f32))) to avoid a stack stack temporary.
llvm-svn: 344425
2018-10-12 22:00:04 +00:00
Craig Topper c693a23025 [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
2018-10-12 22:00:00 +00:00
Craig Topper a8a44f1bec [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
2018-10-12 21:59:58 +00:00
Craig Topper 435e38a5df [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
2018-10-12 21:59:55 +00:00
Marshall Clow d850388710 One more local type warning removed from the tests. NFC
llvm-svn: 344421
2018-10-12 21:59:32 +00:00
Jim Ingham 16aec506ae 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
2018-10-12 21:27:49 +00:00
Marshall Clow db49965a6b Update the array tests to not use a local type; removes warnings in C++03. NFC
llvm-svn: 344417
2018-10-12 21:24:44 +00:00
Marshall Clow 23145c6e08 Update all the max_size tests to eliminate signed/unsigned comparison warnings. NFC
llvm-svn: 344416
2018-10-12 21:22:15 +00:00
Samuel Benzaquen 0e6a833e46 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
2018-10-12 21:01:15 +00:00
Jason Molenda a84c7485cf Add NativePDB subdir again.
llvm-svn: 344414
2018-10-12 20:53:21 +00:00
Alexey Bataev 4ac58d1a4b [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
2018-10-12 20:19:59 +00:00
Martin Storsjo 4b75df2cca [MinGW] Allow using LTO when lld is used as linker
Differential Revision: https://reviews.llvm.org/D53195

llvm-svn: 344412
2018-10-12 20:15:51 +00:00
Michal Gorny 22297d935a [python] [tests] Re-add once again, this time without Windows
llvm-svn: 344411
2018-10-12 20:03:54 +00:00