platform/upstream/llvm.git
5 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Mon, 15 Oct 2018 01:51:50 +0000 (01:51 +0000)]
[X86] Autogenerate complete checks. NFC

llvm-svn: 344485

5 years ago[InstCombine] Add PR27343 test cases
Simon Pilgrim [Sun, 14 Oct 2018 20:14:33 +0000 (20:14 +0000)]
[InstCombine] Add PR27343 test cases

llvm-svn: 344484

5 years ago[LV] Fix comments reported when not vectorizing single iteration loops; NFC
Ayal Zaks [Sun, 14 Oct 2018 17:53:02 +0000 (17:53 +0000)]
[LV] Fix comments reported when not vectorizing single iteration loops; NFC

Landing this as a separate part of https://reviews.llvm.org/D50480, being a
seemingly unrelated change ([LV] Vectorizing loops of arbitrary trip count
without remainder under opt for size).

llvm-svn: 344483

5 years ago[Hexagon] Update tests account for non-hardcoded linker name.
Sid Manning [Sun, 14 Oct 2018 17:51:36 +0000 (17:51 +0000)]
[Hexagon] Update tests account for non-hardcoded linker name.

Tests should not assume the linker's name, CLANG_DEFAULT_LINKER could
change it.

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

llvm-svn: 344482

5 years ago[X86][AVX] Enable lowerVectorShuffleAsLanePermuteAndPermute v16i16/v32i8 shuffle...
Simon Pilgrim [Sun, 14 Oct 2018 17:34:20 +0000 (17:34 +0000)]
[X86][AVX] Enable lowerVectorShuffleAsLanePermuteAndPermute v16i16/v32i8 shuffle lowering

Extends D53148 from v4f64 now that we have test coverage for v16i16/v32i8 shuffles.

llvm-svn: 344481

5 years ago[libfuzzer][Windows] Silence linker warning in unittest
Jonathan Metzman [Sun, 14 Oct 2018 17:07:40 +0000 (17:07 +0000)]
[libfuzzer][Windows] Silence linker warning in unittest

Summary:
Silence warning when linking unittest binary by not passing
-lstdc++ to the linker since it is ignored.

Reviewers: morehouse

Reviewed By: morehouse

Subscribers: mgorny

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

llvm-svn: 344480

5 years ago[ARM] Regenerate cttz tests
Simon Pilgrim [Sun, 14 Oct 2018 16:49:04 +0000 (16:49 +0000)]
[ARM] Regenerate cttz tests

Improve codegen view as part of PR32655

llvm-svn: 344479

5 years ago[ORC] Remove XXLayer::add methods that default to using the main JITDylib.
Lang Hames [Sun, 14 Oct 2018 16:09:59 +0000 (16:09 +0000)]
[ORC] Remove XXLayer::add methods that default to using the main JITDylib.

They're not currently used and may complicate upcoming changes to add's
signature and behavior.

llvm-svn: 344478

5 years ago[LegalizeDAG] Don't bother with final MUL+SRL stage for byte CTPOP.
Simon Pilgrim [Sun, 14 Oct 2018 15:56:28 +0000 (15:56 +0000)]
[LegalizeDAG] Don't bother with final MUL+SRL stage for byte CTPOP.

The final stage of CTPOP expansion (v = (v * 0x01010101...) >> (Len - 8)) is completely pointless for the byte (Len = 8) case as it reduces to (v = (v * 0x01...) >> 0), but annoyingly this doesn't always get optimized away.

Found while investigating generic vector CTPOP expansion (PR32655).

llvm-svn: 344477

5 years ago[InstCombine] combine a shuffle and an extract subvector shuffle
Sanjay Patel [Sun, 14 Oct 2018 15:25:06 +0000 (15:25 +0000)]
[InstCombine] combine a shuffle and an extract subvector shuffle

This is part of the missing IR-level folding noted in D52912.
This should be ok as a canonicalization because the new shuffle mask can't
be any more complicated than the existing shuffle mask. If there's some
target where the shorter vector shuffle is not legal, it should just end up
expanding to something like the pair of shuffles that we're starting with here.

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

llvm-svn: 344476

5 years agorecommit 344472 after fixing build failure on ARM and PPC.
Dorit Nuzman [Sun, 14 Oct 2018 08:50:06 +0000 (08:50 +0000)]
recommit 344472 after fixing build failure on ARM and PPC.

llvm-svn: 344475

5 years agoFix double import of _lldb module.
Vadim Chugunov [Sun, 14 Oct 2018 07:24:56 +0000 (07:24 +0000)]
Fix double import of _lldb module.

Fix llvm.org/pr39054:
- Register _lldb as a built-in module during initialization of script interpreter,
- Reverse the order of imports in __init__.py: first try to import by absolute name, which will find the built-in module in the context of lldb (and other hosts that embed liblldb), then try relative import, in case the module is being imported from Python interpreter.

This works for SWIG>=3.0.11; before that, SWIG did not support custom module import code.

Differential revision: https://reviews.llvm.org/D52404

llvm-svn: 344474

5 years agorevert 344472 due to failures.
Dorit Nuzman [Sun, 14 Oct 2018 07:21:20 +0000 (07:21 +0000)]
revert  344472 due to failures.

llvm-svn: 344473

5 years ago[IAI,LV] Add support for vectorizing predicated strided accesses using masked
Dorit Nuzman [Sun, 14 Oct 2018 07:06:16 +0000 (07:06 +0000)]
[IAI,LV] Add support for vectorizing predicated strided accesses using masked
interleave-group

The vectorizer currently does not attempt to create interleave-groups that
contain predicated loads/stores; predicated strided accesses can currently be
vectorized only using masked gather/scatter or scalarization. This patch makes
predicated loads/stores candidates for forming interleave-groups during the
Loop-Vectorizer's analysis, and adds the proper support for masked-interleave-
groups to the Loop-Vectorizer's planning and transformation stages. The patch
also extends the TTI API to allow querying the cost of masked interleave groups
(which each target can control); Targets that support masked vector loads/
stores may choose to enable this feature and allow vectorizing predicated
strided loads/stores using masked wide loads/stores and shuffles.

Reviewers: Ayal, hsaito, dcaballe, fhahn, javed.absar

Reviewed By: Ayal

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

llvm-svn: 344472

5 years ago[X86] Fix bad indentation. NFC
Craig Topper [Sun, 14 Oct 2018 04:01:40 +0000 (04:01 +0000)]
[X86] Fix bad indentation. NFC

llvm-svn: 344471

5 years ago[X86] Type legalize v2f32 stores by widening to v4f32, casting to v2f64, extracting...
Craig Topper [Sun, 14 Oct 2018 03:36:27 +0000 (03:36 +0000)]
[X86] Type legalize v2f32 stores by widening to v4f32, casting to v2f64, extracting f64 and storing.

Summary: This is similar to what D52528 did for loads. It should match what generic type legalization does in 64-bit mode where it uses a v2i64 cast and an i64 store.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 344470

5 years agoTry harder to fix test/Driver/cl-showfilenames.c
Hans Wennborg [Sat, 13 Oct 2018 22:22:03 +0000 (22:22 +0000)]
Try harder to fix test/Driver/cl-showfilenames.c

Follow-up to r344462.

llvm-svn: 344469

5 years agoMove some helpers from the global namespace into anonymous ones.
Benjamin Kramer [Sat, 13 Oct 2018 22:18:22 +0000 (22:18 +0000)]
Move some helpers from the global namespace into anonymous ones.

llvm-svn: 344468

5 years ago[ORC] During lookup, do not match against hidden symbols in other JITDylibs.
Lang Hames [Sat, 13 Oct 2018 21:53:40 +0000 (21:53 +0000)]
[ORC] During lookup, do not match against hidden symbols in other JITDylibs.

This adds two arguments to the main ExecutionSession::lookup method:
MatchNonExportedInJD, and MatchNonExported. These control whether and where
hidden symbols should be matched when searching a list of JITDylibs.

A similar effect could have been achieved by filtering search results, but
this would have involved materializing symbol definitions (since materialization
is triggered on lookup) only to throw the results away, among other issues.

llvm-svn: 344467

5 years ago[AARCH64] Regenerate popcnt tests
Simon Pilgrim [Sat, 13 Oct 2018 21:50:15 +0000 (21:50 +0000)]
[AARCH64] Regenerate popcnt tests

Improve codegen view as part of PR32655

llvm-svn: 344466

5 years ago[ARM] Regenerate popcnt tests
Simon Pilgrim [Sat, 13 Oct 2018 21:32:49 +0000 (21:32 +0000)]
[ARM] Regenerate popcnt tests

Improve codegen view as part of PR32655

llvm-svn: 344465

5 years ago[analyzer] Improved cmake configuration for Z3
Enrico Steffinlongo [Sat, 13 Oct 2018 19:45:48 +0000 (19:45 +0000)]
[analyzer] Improved cmake configuration for Z3

Summary:
Enhanced support for Z3 in the cmake configuration of clang; now it is possible to specify any arbitrary Z3 install prefix (CLANG_ANALYZER_Z3_PREFIX) to cmake with lib (or bin) and include folders. Before the patch only in cmake default locations
were searched (https://cmake.org/cmake/help/v3.4/command/find_path.html).

Specifying any CLANG_ANALYZER_Z3_PREFIX will force also CLANG_ANALYZER_BUILD_Z3 to ON.

Removed also Z3 4.5 version requirement since it was not checked, and now Clang works with Z3 4.7

Reviewers: NoQ, george.karpenkov, mikhail.ramalho

Reviewed By: george.karpenkov

Subscribers: rnkovacs, NoQ, esteffin, george.karpenkov, delcypher, ddcc, mgorny, xazax.hun, szepet, a.sidorin, Szelethus

Tags: #clang

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

llvm-svn: 344464

5 years ago[analyzer] Small SMT API improvement
Enrico Steffinlongo [Sat, 13 Oct 2018 19:42:10 +0000 (19:42 +0000)]
[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

5 years agoRe-commit r344234 "clang-cl: Add /showFilenames option (PR31957)"
Hans Wennborg [Sat, 13 Oct 2018 19:13:14 +0000 (19:13 +0000)]
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

5 years agoPull out repeated variables from SelectionDAGLegalize::ExpandBitCount.
Simon Pilgrim [Sat, 13 Oct 2018 18:40:48 +0000 (18:40 +0000)]
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

5 years ago[LegalizeTypes] Prevent an assertion from PromoteIntRes_BSWAP and PromoteIntRes_BITRE...
Craig Topper [Sat, 13 Oct 2018 17:47:20 +0000 (17:47 +0000)]
[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

5 years ago[WebAssembly][NFC] Fix signed/unsigned comparison warning
Thomas Lively [Sat, 13 Oct 2018 16:58:03 +0000 (16:58 +0000)]
[WebAssembly][NFC] Fix signed/unsigned comparison warning

llvm-svn: 344459

5 years ago[InstCombine] fix complexity canonicalization with fake unary vector ops
Sanjay Patel [Sat, 13 Oct 2018 16:15:37 +0000 (16:15 +0000)]
[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

5 years ago[X86][SSE] Remove most of vector CTTZ custom lowering and use LegalizeDAG instead.
Simon Pilgrim [Sat, 13 Oct 2018 16:11:15 +0000 (16:11 +0000)]
[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

5 years ago[InstCombine] add tests for operand complexity canonicalization; NFC
Sanjay Patel [Sat, 13 Oct 2018 16:02:47 +0000 (16:02 +0000)]
[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

5 years ago[NFC] Fixed duplicated test file
David Bolvansky [Sat, 13 Oct 2018 15:26:13 +0000 (15:26 +0000)]
[NFC] Fixed duplicated test file

llvm-svn: 344455

5 years ago[InstCombine] Fixed crash with aliased functions
David Bolvansky [Sat, 13 Oct 2018 15:21:55 +0000 (15:21 +0000)]
[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

5 years ago[X86][SSE] Begin removing vector CTTZ custom lowering and use LegalizeDAG instead.
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

5 years ago[X86][SSE] combineIncDecVector - use isConstantSplat
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

5 years ago[X86] Pull out target constant splat helper function. NFCI.
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

5 years agoPull out repeated getOperand(). NFCI.
Simon Pilgrim [Sat, 13 Oct 2018 13:33:32 +0000 (13:33 +0000)]
Pull out repeated getOperand(). NFCI.

llvm-svn: 344450

5 years agoRemove unused variable. NFCI.
Simon Pilgrim [Sat, 13 Oct 2018 13:30:10 +0000 (13:30 +0000)]
Remove unused variable. NFCI.

llvm-svn: 344449

5 years ago[X86][SSE] Improve CTTZ lowering when CTLZ is legal
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

5 years ago[X86][SSE] Change CTTZ vector lowering to cttz(x) = ctpop(~x & (x - 1))
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

5 years ago[X86][AVX] Add lowerVectorShuffleAsLanePermuteAndPermute for v4f64 shuffles (PR39161)
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

5 years ago[clang-tidy] Fix for typos in the tests for `bugprone-exception-escape`
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

5 years ago[clang-tidy] Optimize query in bugprone-exception-escape
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

5 years ago[Analyzer] Iterator Checker - Part 10: Tests for iterators passed as parameter
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

5 years agoRevert "[clang-tidy] New checker for not null-terminated result caused by strlen...
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

5 years agoRevert "[doc] fix markup in clang-tidy bugprone-not-null-terminated-result"
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

5 years ago[clang-tidy] add IgnoreMacros option to modernize-use-equals-delete
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

5 years ago[AArch64] Swap comparison operands if that enables some folding.
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

5 years ago[WebAssembly] SIMD min and max
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

5 years ago[Intrinsic] Add llvm.minimum and llvm.maximum instrinsic functions
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

5 years ago[WebAssembly][NFC] Unify ARGUMENT classes
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

5 years ago[lit] Support the `%shared_libasan` lit substitution on Apple platforms.
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

5 years agomove GetOrCreateFunctionComdat to Instrumentation.cpp/Instrumentation.h
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

5 years ago[RISCV] Eliminate unnecessary masking of promoted shift amounts
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

5 years agoAdd REQUIRES: lld to SymbolFileNativePDB tests.
Zachary Turner [Fri, 12 Oct 2018 23:07:32 +0000 (23:07 +0000)]
Add REQUIRES: lld to SymbolFileNativePDB tests.

llvm-svn: 344431

5 years ago[llvm-readobj] Fix an error message about .llvm.call-graph-profile
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

5 years agoTry to fix some failures on MacOSX with the NativePDB patch.
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

5 years ago[LegalizeVectorTypes] Use TLI.getVectorIdxTy instead of DAG.getIntPtrConstant.
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

5 years agoSimplify. NFC.
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

5 years ago[sanitizer] Avoid extra newlines in syslog.
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

5 years ago[X86] Improve type legalization of (v2i32/v4i16/v8i16 (bitcast (v2f32))) to avoid...
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

5 years ago[X86] Simplify the end of custom type legalization for (v2i32/v4i16/v8i8 (bitcast...
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

5 years ago[X86] Skip (v2i32/v4i16/v8i8 (bitcast (f64))) handling in ReplaceNodeResults if the...
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

5 years ago[LegalizeVectorTypes] When widening the result of a bitcast from a scalar type, use...
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

5 years agoOne more local type warning removed from the tests. NFC
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

5 years agoChange the default handling for SIGPIPE to pass/,no-stop/no-notify.
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

5 years agoUpdate the array tests to not use a local type; removes warnings in C++03. NFC
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

5 years agoUpdate all the max_size tests to eliminate signed/unsigned comparison warnings. NFC
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

5 years agoAdd benchmarks for std::function.
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

5 years agoAdd NativePDB subdir again.
Jason Molenda [Fri, 12 Oct 2018 20:53:21 +0000 (20:53 +0000)]
Add NativePDB subdir again.

llvm-svn: 344414

5 years ago[OPENMP][NVPTX]Reduce memory usage in target region.
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

5 years ago[MinGW] Allow using LTO when lld is used as linker
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

5 years ago[python] [tests] Re-add once again, this time without Windows
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

5 years agoFix failure in get_filecheck_path when filecheck is None
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

5 years agoResubmit "Add SymbolFileNativePDB plugin."
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

5 years agoRevert rL344365: [tests] Readd Python binding tests to check-all
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

5 years agoChanging test names in TestDataFormatterLibcxxVariant.py and TestStdFunctionStepIntoC...
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

5 years ago[clang-format] Fix BraceWrapping AfterFunction for ObjC methods
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

5 years agoRevert BTF commit series.
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

5 years ago[LegalizeVectorTypes] When widening the operands to a concat_vectors, see if we can...
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

5 years ago[LegalizeVectorTypes] When unrolling in WidenVecRes_Convert, make sure we use the...
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

5 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Fri, 12 Oct 2018 19:30:43 +0000 (19:30 +0000)]
Fix Wdocumentation warning. NFCI.

llvm-svn: 344402

5 years ago[dotest] Make a missing FileCheck binary a warning, not an error
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

5 years agoFix a clang::driver::ArgStringList usage I missed in rL344398. NFCI.
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

5 years agoRegenerate test. NFCI.
Simon Pilgrim [Fri, 12 Oct 2018 19:03:54 +0000 (19:03 +0000)]
Regenerate test. NFCI.

llvm-svn: 344399

5 years agoConsistently make llvm::opt::ArgStringList usage explicit to try and appease MSVC...
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

5 years agoAdd "v" as well as "var" as an alias for "frame var".
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

5 years agoReplace assert() with llvm_unreachable because it's obviously a typo.
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

5 years agoRemove `Type` parameter from SymbolTable::insert(). NFC.
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

5 years ago[codeview] Emit S_BUILDINFO and LF_BUILDINFO with cwd and source file
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

5 years ago[llvm-mca] Correctly set aliases for register writes introduced by optimized register...
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

5 years ago[SanitizerCoverage] Prevent /OPT:REF from stripping constructors
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

5 years agoFix MCBTF string array initialization so its MSVC friendly. NFCI.
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

5 years agoRevert r344375 "[Driver] check for exit code from SIGPIPE"
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

5 years ago[Doc] fix second error in UsersManual
Jonas Toth [Fri, 12 Oct 2018 17:57:18 +0000 (17:57 +0000)]
[Doc] fix second error in UsersManual

llvm-svn: 344388

5 years ago[BPF] Use cstdint {,u}int*_t instead of linux/types.h __u32 __u16 ...
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

5 years ago[lldbsuite] Fix the filecheck functionality to work with Python 3
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

5 years agoDisambiguate: s/make_unique/llvm::make_unique/. NFC
Eric Liu [Fri, 12 Oct 2018 17:55:21 +0000 (17:55 +0000)]
Disambiguate: s/make_unique/llvm::make_unique/. NFC

llvm-svn: 344385

5 years ago[clangd] NFC fix semicolon warning
Jonas Toth [Fri, 12 Oct 2018 17:47:43 +0000 (17:47 +0000)]
[clangd] NFC fix semicolon warning

llvm-svn: 344384

5 years ago[Doc] fix BB, add code-block type
Jonas Toth [Fri, 12 Oct 2018 17:44:01 +0000 (17:44 +0000)]
[Doc] fix BB, add code-block type

llvm-svn: 344382

5 years ago[BPF] Don't include linux/types.h and fix style
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