platform/upstream/llvm.git
4 years ago[llvm][TableGen] Define FieldInit::isConcrete overload
River Riddle [Tue, 11 Feb 2020 01:51:26 +0000 (17:51 -0800)]
[llvm][TableGen] Define FieldInit::isConcrete overload

Summary:
There are a few field init values that are concrete but not complete/foldable (e.g. `?`). This allows for using those values as initializers without erroring out.

Example:

```
class A {
  string value = ?;
}
class B<A impl> : A {
  let value = impl.value; // This currently emits an error.
  let value = ?;          // This doesn't emit an error.
}
```

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

4 years agoFix Sphinx failure on ReadabilityQualifiedAuto docs
Nathan James [Tue, 11 Feb 2020 02:03:37 +0000 (02:03 +0000)]
Fix Sphinx failure on ReadabilityQualifiedAuto docs

4 years ago[Polly] Silence mixed signed/unsigned comparison warnings. NFC.
Michael Kruse [Tue, 11 Feb 2020 00:50:51 +0000 (18:50 -0600)]
[Polly] Silence mixed signed/unsigned comparison warnings. NFC.

ISL changed some return types from unsigned to
isl_size (typedef of int), which results in such warnings.

4 years ago[Polly] Update ISL to isl-0.22.1-87-gfee05a13.
Michael Kruse [Mon, 10 Feb 2020 20:51:33 +0000 (14:51 -0600)]
[Polly] Update ISL to isl-0.22.1-87-gfee05a13.

The primary motivation is to fix an assertion failure in
isl_basic_map_alloc_equality:

    isl_assert(ctx, room_for_con(bmap, 1), return -1);

Although the assertion does not occur anymore, I could not identify
which of ISL's commits fixed it.

Compared to the previous ISL version, Polly requires some changes for this update

 * Since ISL commit
   20d3574 "perform parameter alignment by modifying both arguments to function"
   isl_*_gist_* and similar functions do not always align the paramter
   list anymore. This caused the parameter lists in JScop files to
   become out-of-sync. Since many regression tests use JScop files with
   a fixed parameter list and order, we explicitly call align_params to
   ensure a predictable parameter list.

 * ISL changed some return types to isl_size, a typedef of (signed) int.
   This caused some issues where the return type was unsigned int before:
   - No overload for std::max(unsigned,isl_size)
   - It cause additional 'mixed signed/unsigned comparison' warnings.
     Since they do not break compilation, and sizes larger than 2^31
     were never supported, I am going to fix it separately.

 * With the change to isl_size, commit
   57d547 "isl_*_list_size: return isl_size"
   also changed the return value in case of an error from 0 to -1. This
   caused undefined looping over isl_iterator since the 'end iterator'
   got index -1, never reached from the 'begin iterator' with index 0.

 * Some internal changes in ISL caused the number of operations to
   increase when determining access ranges to determine aliasing
   overlaps. In one test, this caused exceeding the default limit of
   800000. The operations-limit was disabled for this test.

4 years agoscudo: Fix Android build.
Peter Collingbourne [Mon, 10 Feb 2020 23:53:07 +0000 (15:53 -0800)]
scudo: Fix Android build.

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

4 years ago[NFC][libFuzzer] Prefix TempPath with string showing the work it is doing.
Yuanfang Chen [Mon, 10 Feb 2020 22:33:27 +0000 (14:33 -0800)]
[NFC][libFuzzer] Prefix TempPath with string showing the work it is doing.

4 years ago[libFuzzer] communicate through pipe to subprocess for MinimizeCrashInput
Yuanfang Chen [Mon, 10 Feb 2020 22:31:47 +0000 (14:31 -0800)]
[libFuzzer] communicate through pipe to subprocess for MinimizeCrashInput

For CleanseCrashInput, discards stdout output anyway since it is not used.

These changes are to defend against aggressive PID recycle on windows to reduce the chance of contention on files.

Using pipe instead of file also workaround the problem that when the
process is spawned by llvm-lit, the aborted process keeps a handle to the
output file such that the output file can not be removed. This will
cause random test failures.

https://devblogs.microsoft.com/oldnewthing/20110107-00/?p=11803

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

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

4 years ago[NFC] Refactor the tuple of symbol information with structure for llvm-objdump
diggerlin [Tue, 11 Feb 2020 00:23:01 +0000 (19:23 -0500)]
[NFC] Refactor the tuple of symbol information with structure for llvm-objdump

SUMMARY:

refator the std::tuple<uint64_t, StringRef, uint8_t> to structor

Reviewers: daltenty
Subscribers: wuzish, nemanjai, hiraditya

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

4 years agoDebugInfo: Avoid truncating addr_base to 32 bits
David Blaikie [Mon, 10 Feb 2020 23:47:38 +0000 (15:47 -0800)]
DebugInfo: Avoid truncating addr_base to 32 bits

I'm /guessing/ this isn't terribly testable without a very large input
file. Even generated from a more compact assembly file, it's probably
best not to generate a giant temporary test file - if I'm wrong about
that/anyone has good suggestions for testing, I'm all ears!

Based on post-commit review feedback from Igor Kudrin on
eed0242330926815d19dd0d54f393576bcffc762

4 years ago[GlobalISel][CallLowering] Use stripPointerCasts().
Amara Emerson [Mon, 10 Feb 2020 23:41:53 +0000 (15:41 -0800)]
[GlobalISel][CallLowering] Use stripPointerCasts().

A downstream test exposed a simple logic bug with the manual pointer
stripping code, fix that by just using stripPointerCasts() on the value.

I don't think there's a way to expose this issue upstream.

4 years ago[TestKernVerStrLCNOTE] Check the *right* architecture.
Davide Italiano [Mon, 10 Feb 2020 23:17:31 +0000 (15:17 -0800)]
[TestKernVerStrLCNOTE] Check the *right* architecture.

4 years agoFix you->your typo.
Eric Christopher [Mon, 10 Feb 2020 23:06:32 +0000 (15:06 -0800)]
Fix you->your typo.

4 years agoscudo: Add a dump of primary allocation sizes to malloc_info output.
Peter Collingbourne [Wed, 5 Feb 2020 22:49:19 +0000 (14:49 -0800)]
scudo: Add a dump of primary allocation sizes to malloc_info output.

This will be useful for optimizing the size class map.

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

4 years agoscudo: Table driven size classes for Android allocator.
Peter Collingbourne [Wed, 5 Feb 2020 03:50:25 +0000 (19:50 -0800)]
scudo: Table driven size classes for Android allocator.

Add an optional table lookup after the existing logarithm computation
for MidSize < Size <= MaxSize during size -> class lookups. The lookup is
O(1) due to indexing a precomputed (via constexpr) table based on a size
table. Switch to this approach for the Android size class maps.

Other approaches considered:
- Binary search was found to have an unacceptable (~30%) performance cost.
- An approach using NEON instructions (see older version of D73824) was found
  to be slightly slower than this approach on newer SoCs but significantly
  slower on older ones.

By selecting the values in the size tables to minimize wastage (for example,
by passing the malloc_info output of a target program to the included
compute_size_class_config program), we can increase the density of allocations
at a small (~0.5% on bionic malloc_sql_trace as measured using an identity
table) performance cost.

Reduces RSS on specific Android processes as follows (KB):

                             Before  After
zygote (median of 50 runs)    26836  26792 (-0.2%)
zygote64 (median of 50 runs)  30384  30076 (-1.0%)
dex2oat (median of 3 runs)   375792 372952 (-0.8%)

I also measured the amount of whole-system idle dirty heap on Android by
rebooting the system and then running the following script repeatedly until
the results were stable:

for i in $(seq 1 50); do grep -A5 scudo: /proc/*/smaps | grep Pss: | cut -d: -f2 | awk '{s+=$1} END {print s}' ; sleep 1; done

I did this 3 times both before and after this change and the results were:

Before: 365650, 356795, 372663
After:  344521, 356328, 342589

These results are noisy so it is hard to make a definite conclusion, but
there does appear to be a significant effect.

On other platforms, increase the sizes of all size classes by a fixed offset
equal to the size of the allocation header. This has also been found to improve
density, since it is likely for allocation sizes to be a power of 2, which
would otherwise waste space by pushing the allocation into the next size class.

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

4 years agoscudo: Instead of exporting a pointer to the allocator, export the allocator directly...
Peter Collingbourne [Mon, 10 Feb 2020 21:36:49 +0000 (13:36 -0800)]
scudo: Instead of exporting a pointer to the allocator, export the allocator directly. NFCI.

This lets us remove two pointer indirections (one by removing the pointer,
and another by making the AllocatorPtr declaration hidden) in the C++ wrappers.

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

4 years ago[Sanitizers] Get link map on FreeBSD and NetBSD via documented API
Dimitry Andric [Mon, 10 Feb 2020 22:43:12 +0000 (23:43 +0100)]
[Sanitizers] Get link map on FreeBSD and NetBSD via documented API

Summary:
Instead of hand-crafting an offset into the structure returned by
dlopen(3) to get at the link map, use the documented API.  This is
described in dlinfo(3): by calling it with `RTLD_DI_LINKMAP`, the
dynamic linker ensures the right address is returned.

This is a recommit of 92e267a94dc4272511be674062f8a3e8897b7083, with
dlinfo(3) expliclity being referenced only for FreeBSD, non-Android
Linux, NetBSD and Solaris.  Other OSes will have to add their own
implementation.

Reviewers: devnexen, emaste, MaskRay, krytarowski

Reviewed By: krytarowski

Subscribers: krytarowski, vitalybuka, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years agoRevert "[Host.mm] Check for the right macro instead of inlining it"
Vedant Kumar [Mon, 10 Feb 2020 22:33:44 +0000 (14:33 -0800)]
Revert "[Host.mm] Check for the right macro instead of inlining it"

This breaks macOS, because TARGET_OS_EMBEDDED is always defined. Thanks
to Jason Molenda for pointing this out.

Revert "Do not define AcceptPIDFromInferior when it will not be used"

This reverts commit d23c15a687ff15327b88fa64da3184395012c2dc.
This reverts commit 936d1427da1432d724dfa5851097347bcdf7c521.

4 years agoRevert "[Sanitizers] Get link map on FreeBSD via documented API"
Dimitry Andric [Mon, 10 Feb 2020 22:24:26 +0000 (23:24 +0100)]
Revert "[Sanitizers] Get link map on FreeBSD via documented API"

This reverts commit 92e267a94dc4272511be674062f8a3e8897b7083, as it
appears Android is missing dlinfo(3).

4 years ago[EarlyCSE] avoid crashing when detecting min/max/abs patterns (PR41083)
Sanjay Patel [Mon, 10 Feb 2020 22:13:26 +0000 (17:13 -0500)]
[EarlyCSE] avoid crashing when detecting min/max/abs patterns (PR41083)

As discussed in PR41083:
https://bugs.llvm.org/show_bug.cgi?id=41083
...we can assert/crash in EarlyCSE using the current hashing scheme and
instructions with flags.

ValueTracking's matchSelectPattern() may rely on overflow (nsw, etc) or
other flags when detecting patterns such as min/max/abs composed of
compare+select. But the value numbering / hashing mechanism used by
EarlyCSE intersects those flags to allow more CSE.

Several alternatives to solve this are discussed in the bug report.
This patch avoids the issue by doing simple matching of min/max/abs
patterns that never requires instruction flags. We give up some CSE
power because of that, but that is not expected to result in much
actual performance difference because InstCombine will canonicalize
these patterns when possible. It even has this comment for abs/nabs:

  /// Canonicalize all these variants to 1 pattern.
  /// This makes CSE more likely.

(And this patch adds PhaseOrdering tests to verify that the expected
transforms are still happening in the standard optimization pipelines.

I left this code to use ValueTracking's "flavor" enum values, so we
don't have to change the callers' code. If we decide to go back to
using the ValueTracking call (by changing the hashing algorithm
instead), it should be obvious how to replace this chunk.

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

4 years ago[ubsan] Null-check and adjust TypeLoc before using it
Vedant Kumar [Mon, 10 Feb 2020 21:10:47 +0000 (13:10 -0800)]
[ubsan] Null-check and adjust TypeLoc before using it

Null-check and adjut a TypeLoc before casting it to a FunctionTypeLoc.
This fixes a crash in -fsanitize=nullability-return, and also makes the
location of the nonnull type available when the return type is adjusted.

rdar://59263039

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

4 years agoRemove lit feature object-emission
Ted Woodward [Mon, 10 Feb 2020 20:42:48 +0000 (14:42 -0600)]
Remove lit feature object-emission

Summary: The lit feature object-emission was added because Hexagon did not support the integrated assembler, so some tests needed to be turned off with a Hexagon target. Hexagon now supports the integrated assembler, so this feature can be removed.

Reviewers: bcain, kparzysz, jverma, whitequark, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: mehdi_amini, hiraditya, steven_wu, dexonsmith, arphaman, llvm-commits

Tags: #llvm

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

4 years ago[gn build] Port bb383ae6120
LLVM GN Syncbot [Mon, 10 Feb 2020 21:43:41 +0000 (21:43 +0000)]
[gn build] Port bb383ae6120

4 years ago[CallPromotionUtils] Add tryPromoteCall.
Hiroshi Yamauchi [Thu, 30 Jan 2020 21:05:31 +0000 (13:05 -0800)]
[CallPromotionUtils] Add tryPromoteCall.

Summary: It attempts to devirtualize a call on alloca through vtable loads.

Reviewers: davidxl

Subscribers: mgorny, Prazek, hiraditya, llvm-commits

Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71308

4 years agoRevert "[lldb] Fix+re-enable Assert StackFrame Recognizer on Linux"
Davide Italiano [Mon, 10 Feb 2020 20:43:59 +0000 (12:43 -0800)]
Revert "[lldb] Fix+re-enable Assert StackFrame Recognizer on Linux"

This reverts commit 1a39f1b966a8d8f15ed0d5a832d5097cccefe93b as
it breaks macOS.

4 years ago[mlir][spirv] Use spv.entry_point_abi in GPU to SPIR-V conversions
Lei Zhang [Wed, 5 Feb 2020 01:58:10 +0000 (20:58 -0500)]
[mlir][spirv] Use spv.entry_point_abi in GPU to SPIR-V conversions

We have spv.entry_point_abi for specifying the local workgroup size.
It should be decorated onto input gpu.func ops to drive the SPIR-V
CodeGen to generate the proper SPIR-V module execution mode. Compared
to using command-line options for specifying the configuration, using
attributes also has the benefits that 1) we are now able to use
different local workgroup for different entry points and 2) the
tests contains the configuration directly.

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

4 years ago[OPENMP50]Add support for 'release' clause.
Alexey Bataev [Mon, 10 Feb 2020 20:49:05 +0000 (15:49 -0500)]
[OPENMP50]Add support for 'release' clause.

Added full support for 'release' clause in flush|atomic directives.

4 years ago[mlir][Linalg] Add a roundtrip test for indexed_generic op with tensors.
Hanhan Wang [Sat, 8 Feb 2020 00:30:55 +0000 (19:30 -0500)]
[mlir][Linalg] Add a roundtrip test for indexed_generic op with tensors.

Summary:
After D72555 has been landed, `linalg.indexed_generic` also accepts ranked
tensor as input and output. Add a test for it.

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

4 years ago[test] Disable the Passes/PluginsTest cases on windows with BUILD_SHARED_LIBS
Martin Storsjö [Wed, 5 Feb 2020 11:53:56 +0000 (13:53 +0200)]
[test] Disable the Passes/PluginsTest cases on windows with BUILD_SHARED_LIBS

The plugin expects to have undefined references to symbols exported
by the loading process, which isn't supported by shared libraries
on windows.

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

4 years agogit bisect docs: formatting tweaks
Nico Weber [Mon, 10 Feb 2020 20:47:46 +0000 (15:47 -0500)]
git bisect docs: formatting tweaks

4 years ago[AIX] Enable frame pointer for AIX and add related test suite
Xiangling Liao [Mon, 10 Feb 2020 18:52:08 +0000 (13:52 -0500)]
[AIX] Enable frame pointer for AIX and add related test suite

This patch:
   - enable frame pointer for AIX;
   - update some of red zone comments;
   - add/update testcases;

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

4 years agoRegisterCoalescer: Add LaneMask to debug printing
Matt Arsenault [Mon, 10 Feb 2020 20:18:30 +0000 (15:18 -0500)]
RegisterCoalescer: Add LaneMask to debug printing

4 years agoadd GitBisecting to toctrees to try and placate the sphinx bot
Nico Weber [Mon, 10 Feb 2020 20:33:20 +0000 (15:33 -0500)]
add GitBisecting to toctrees to try and placate the sphinx bot

4 years ago[DebugInfo] Support file-level include directories when generating DWARFv5 LineTable...
Sterling Augustine [Mon, 10 Feb 2020 20:19:35 +0000 (12:19 -0800)]
[DebugInfo] Support file-level include directories when generating DWARFv5 LineTable prologues.

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

4 years agogit bisect docs: try to make commit ascii art show up
Nico Weber [Mon, 10 Feb 2020 20:18:15 +0000 (15:18 -0500)]
git bisect docs: try to make commit ascii art show up

4 years agoReland "[clangd][test] Disable a particular testcase in FindExplicitReferencesTest...
Jan Korous [Mon, 10 Feb 2020 20:11:47 +0000 (12:11 -0800)]
Reland "[clangd][test] Disable a particular testcase in FindExplicitReferencesTest when LLVM_ENABLE_EXPENSIVE_CHECKS""

The test got re-enabled after d54d71b67e60 landed.

However it seems that the order is still not deterministic as it
currently passes with -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF but randomly
fails with expensive checks ON.

4 years ago[Transforms] add phase ordering tests for min/max/abs; NFC
Sanjay Patel [Mon, 10 Feb 2020 20:10:47 +0000 (15:10 -0500)]
[Transforms] add phase ordering tests for min/max/abs; NFC

Test that instcombine and early-cse can cooperate
to reduce sequences of select patterns that are not
composed of the same underlying instructions.

There's a bug in EarlyCSE (PR41083), and we can test
how much a possible fix (D74285) may affect optimization.

4 years agoDo not define AcceptPIDFromInferior when it will not be used
Vedant Kumar [Mon, 10 Feb 2020 20:06:46 +0000 (12:06 -0800)]
Do not define AcceptPIDFromInferior when it will not be used

4 years ago[mlir][VectorOps][EDSC] Add EDSC for VectorOps
Nicolas Vasilache [Sat, 8 Feb 2020 18:51:10 +0000 (13:51 -0500)]
[mlir][VectorOps][EDSC] Add EDSC for VectorOps

Summary:
This revision adds EDSC support for VectorOps to enable the creation of a `vector_matmul` declaratively. The `vector_matmul` is a simple configuration
 of the `vector.contract` op that follows the StructuredOps abstraction.

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

4 years ago[InstCombine] fix use check when canonicalizing abs/nabs
Sanjay Patel [Mon, 10 Feb 2020 19:50:51 +0000 (14:50 -0500)]
[InstCombine] fix use check when canonicalizing abs/nabs

We were checking for extra uses of the negated operand even
if we were not going to create it as part of this canonicalization.

This was showing up as a regression when we limit EarlyCSE as
proposed in D74285.

4 years ago[InstCombine] add tests for abs with extra use of operand; NFC
Sanjay Patel [Mon, 10 Feb 2020 19:42:50 +0000 (14:42 -0500)]
[InstCombine] add tests for abs with extra use of operand; NFC

4 years ago[OPENMP50]Support for acquire clause.
Alexey Bataev [Mon, 10 Feb 2020 19:30:39 +0000 (14:30 -0500)]
[OPENMP50]Support for acquire clause.

Added full support for acquire clause in flush|atomic directives.

4 years ago[AIX][XCOFF] Support Mergeable2ByteCString and Mergeable4ByteCString
diggerlin [Mon, 10 Feb 2020 19:45:54 +0000 (14:45 -0500)]
[AIX][XCOFF] Support Mergeable2ByteCString and Mergeable4ByteCString

SUMMARY:
The patch is enable to support Mergeable2ByteCString and Mergeable4ByteCString

Reviewers: daltenty
Subscribers: wuzish, nemanjai, hiraditya

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

4 years agoDon't fail step out if remote server doesn't implement qMemoryRegionInfo
Ted Woodward [Mon, 10 Feb 2020 19:40:17 +0000 (13:40 -0600)]
Don't fail step out if remote server doesn't implement qMemoryRegionInfo

Summary:
The return address validation in D71372 will fail if the memory permissions can't be determined. Many embedded stubs either don't implement the qMemoryRegionInfo packet, or don't have memory permissions at all.

Remove the return from the if clause that calls GetLoadAddressPermissions, so this call failing doesn't cause the step out to abort. Instead, assume that the memory permission check doesn't apply to this type of target.

Reviewers: labath, jingham, clayborg, mossberg

Reviewed By: labath, jingham

Subscribers: lldb-commits

Tags: #lldb

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

4 years agoAdd documentation on git bisecting across the MLIR merge
Nico Weber [Tue, 4 Feb 2020 20:44:09 +0000 (15:44 -0500)]
Add documentation on git bisecting across the MLIR merge

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

4 years agoPrefer __vector over vector keyword for altivec
serge-sans-paille [Thu, 6 Feb 2020 14:58:29 +0000 (15:58 +0100)]
Prefer __vector over vector keyword for altivec

`vector' uses the keyword-and-predefine mode from gcc, while __vector is
reliably supported.

As a side effect, it also makes the code consistent in its usage of __vector.

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

4 years ago[clang] Add `forceReload` clangd extension to 'textDocument/didChange'
David Goldman [Mon, 3 Feb 2020 20:14:49 +0000 (15:14 -0500)]
[clang] Add `forceReload` clangd extension to 'textDocument/didChange'

Summary:
- This option forces a preamble rebuild to handle the odd case
  of a missing header file being added

Reviewers: sammccall

Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, jfb, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years agofix some typos to cycle bots
Nico Weber [Mon, 10 Feb 2020 18:51:23 +0000 (13:51 -0500)]
fix some typos to cycle bots

4 years agoContinue removing llgo.
Eric Christopher [Mon, 10 Feb 2020 18:31:19 +0000 (10:31 -0800)]
Continue removing llgo.

4 years ago[compiler-rt] Follow up fix for the refactoring in https://reviews.llvm.org/D74137.
Max Moroz [Mon, 10 Feb 2020 18:19:03 +0000 (10:19 -0800)]
[compiler-rt] Follow up fix for the refactoring in https://reviews.llvm.org/D74137.

Summary:
The refactoring has caused a failure in
http://lab.llvm.org:8011/builders/clang-ppc64le-linux/builds/29265

The idea of failing the symbolization when the symbolizer bufer is too small
was incorrect. The symbolizer can be invoked for other frames that may fit into
the buffer and get symbolized.

Reviewers: vitalybuka, eugenis

Subscribers: dberris, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[ValueLattice] Remove obsolete getConstantInt (NFC).
Florian Hahn [Mon, 10 Feb 2020 18:19:13 +0000 (18:19 +0000)]
[ValueLattice] Remove obsolete getConstantInt (NFC).

ConstantInt values are always represented as constant ranges with a
single element. getConstantInt is obsolete, as pointed out by @nikic
during D60581.

Reviewers: nikic

Reviewed By: nikic

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

4 years ago[MLIR] Fix lib/Dialect/Linalg/EDSC for BUILD_SHARED_LIBS=on
Stephen Neuendorffer [Mon, 10 Feb 2020 18:13:46 +0000 (10:13 -0800)]
[MLIR] Fix lib/Dialect/Linalg/EDSC for BUILD_SHARED_LIBS=on

4 years ago[MLIR] Fix lib/ExecutionEngine for BUILD_SHARED_LIBS=on
Stephen Neuendorffer [Mon, 10 Feb 2020 16:55:27 +0000 (08:55 -0800)]
[MLIR] Fix lib/ExecutionEngine for BUILD_SHARED_LIBS=on

4 years ago[MLIR][Standard] Implement constant folding for IndexCast
Stephen Neuendorffer [Tue, 10 Dec 2019 19:59:13 +0000 (11:59 -0800)]
[MLIR][Standard] Implement constant folding for IndexCast

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

4 years ago[MLIR][Standard] Add folding for indexCast(indexCast(x)) -> x
Stephen Neuendorffer [Thu, 5 Dec 2019 00:15:10 +0000 (16:15 -0800)]
[MLIR][Standard] Add folding for indexCast(indexCast(x)) -> x

Allow this only if the types are the same.  e.g.:
i16 -> index -> i16  or
index -> i16 -> index

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

4 years ago[MLIR] Allow non-binary operations to be commutative
Stephen Neuendorffer [Mon, 9 Dec 2019 22:27:11 +0000 (14:27 -0800)]
[MLIR] Allow non-binary operations to be commutative

NFC for binary operations.

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

4 years ago[LoopCacheAnalysis]: Add support for negative stride
Rachel Craik [Mon, 10 Feb 2020 18:14:59 +0000 (13:14 -0500)]
[LoopCacheAnalysis]: Add support for negative stride

LoopCacheAnalysis currently assumes the loop will be iterated over in
a forward direction. This patch addresses the issue by using the
absolute value of the stride when iterating backwards.

Note: this patch will treat negative and positive array access the
same, resulting in the same cost being calculated for single and
bi-directional access patterns. This should be improved in a
subsequent patch.

Reviewed By: jdoerfert

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

4 years ago[Sanitizers] Get link map on FreeBSD via documented API
Dimitry Andric [Thu, 6 Feb 2020 22:18:19 +0000 (23:18 +0100)]
[Sanitizers] Get link map on FreeBSD via documented API

Summary:
Instead of hand-crafting an offset into the structure returned by
dlopen(3) to get at the link map, use the documented API.  This is
described in dlinfo(3): by calling it with `RTLD_DI_LINKMAP`, the
dynamic linker ensures the right address is returned.

Reviewers: devnexen, emaste, MaskRay, krytarowski

Reviewed By: krytarowski

Subscribers: krytarowski, vitalybuka, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years agodebugserver: Rely on mig architectures being specified externally
Vedant Kumar [Mon, 10 Feb 2020 18:10:10 +0000 (10:10 -0800)]
debugserver: Rely on mig architectures being specified externally

Look up the -arch flags to pass to the mig invocation from an
optionally-defined MIG_ARCHS variable. We can't use CMAKE_OSX_ARCHS
because the {i,tv,watch}OS builds don't use this mechanism to achieve
fat builds (they build each slice separately & then lipo them together).

This supercedes the mig -arch/-isysroot fix from
510758dae2a8fa4b0b26dea89d4d1efd576b8ad6.

4 years ago[SystemZ] Add a subtarget cache like some other targets already have.
Jonas Paulsson [Wed, 5 Feb 2020 13:43:35 +0000 (14:43 +0100)]
[SystemZ]  Add a subtarget cache like some other targets already have.

Each function is with this compiled with the SystemZSubtarget initialized
from the functions attributes.

Review: Ulrich Weigand.

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

4 years agoRemove llgo per discussion on llvm-dev:
Eric Christopher [Mon, 10 Feb 2020 18:07:37 +0000 (10:07 -0800)]
Remove llgo per discussion on llvm-dev:

http://lists.llvm.org/pipermail/llvm-dev/2020-February/139058.html

Approved by dblaikie, pcc.

4 years ago[Host.mm] Check for the right macro instead of inlining it
Vedant Kumar [Mon, 10 Feb 2020 18:06:14 +0000 (10:06 -0800)]
[Host.mm] Check for the right macro instead of inlining it

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

4 years agoAMDGPU: Move R600 test compatability hack
Matt Arsenault [Sun, 9 Feb 2020 21:38:56 +0000 (16:38 -0500)]
AMDGPU: Move R600 test compatability hack

Instead of handling the r600 intrinsics on amdgcn, handle the amdgcn
intrinsics on r600.

4 years ago[X86] combineConcatVectorOps - combine X86ISD::PACKSS ops
Simon Pilgrim [Mon, 10 Feb 2020 17:47:46 +0000 (17:47 +0000)]
[X86] combineConcatVectorOps - combine X86ISD::PACKSS ops

4 years ago[X86] combineConcatVectorOps - combine X86ISD::VPERMI ops
Simon Pilgrim [Mon, 10 Feb 2020 17:32:58 +0000 (17:32 +0000)]
[X86] combineConcatVectorOps - combine X86ISD::VPERMI ops

4 years agoSilence compiler warning. NFC.
Michael Kruse [Mon, 10 Feb 2020 17:13:00 +0000 (11:13 -0600)]
Silence compiler warning. NFC.

The idiom

    for (auto i = n - n; i < n; i += 1)

was intended to automatically derive the type of i from n
(signed/unsigned int) and avoid the 'mixed signed/unsigned comparison'
warning. However, almost-always-auto was never used in the LLVM coding
style (although we used it in Polly for some time) and I did never
intended to use this idiom upstream.

PVS Studio may warns about this idiom as 'warning: both sides of
operator are equivalent [misc-redundant-expression]'.

Remove the use of auto and directly use unsigned.

Also see http://llvm.org/PR44768

4 years ago[mlir] [LLVMIR] add all vector reduction intrinsics to LLVM IR dialect
aartbik [Fri, 7 Feb 2020 22:32:08 +0000 (14:32 -0800)]
[mlir] [LLVMIR] add all vector reduction intrinsics to LLVM IR dialect

Summary:
This allows for lowering of VectorOps (and others) into a LLVM IR
that maps directly to efficient implementations on the target machines.

http://llvm.org/docs/LangRef.html#experimental-vector-reduction-intrinsics

Reviewers: ftynse, andydavis1, nicolasvasilache, rriddle

Reviewed By: ftynse, rriddle

Subscribers: jfb, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[mlir][EDSC] Almost NFC - Refactor and untangle EDSC dependencies
Nicolas Vasilache [Mon, 10 Feb 2020 16:55:02 +0000 (11:55 -0500)]
[mlir][EDSC] Almost NFC - Refactor and untangle EDSC dependencies

This CL refactors EDSCs to layer them better and break unnecessary
dependencies. After this refactoring, the top-level EDSC target only
depends on IR but not on Dialects anymore and each dialect has its
own EDSC directory.

This simplifies the layering and breaks cyclic dependencies.
In particular, the declarative builder + folder are made explicit and
are now confined to Linalg.

As the refactoring occurred, certain classes and abstractions that were not
paying for themselves have been removed.

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

4 years ago[X86] combineConcatVectorOps - combine VSHLI/VSRAI/VSRLI ops
Simon Pilgrim [Mon, 10 Feb 2020 16:48:39 +0000 (16:48 +0000)]
[X86] combineConcatVectorOps - combine VSHLI/VSRAI/VSRLI ops

Non-AVX512BW targets failed to concatenate 256-bit shifts back to 512-bits (split during 512-bit shuffle lowering as they don't have v32i16/v64i8 types).

4 years agoRevert "[InstCombine][DebugInfo] Fold constants wrapped in metadata"
David Stenberg [Mon, 10 Feb 2020 16:14:15 +0000 (17:14 +0100)]
Revert "[InstCombine][DebugInfo] Fold constants wrapped in metadata"

This reverts commit b54a8ec1bcd3689771c847cb37515b627034e518.

The commit triggered debug invariance (different output with/without
-g). The patch seems to have exposed a pre-existing invariance problem
in GlobalOpt, which I'll write a bug report for.

4 years ago[mlir] Delete unused header
Kadir Cetinkaya [Mon, 10 Feb 2020 16:54:00 +0000 (17:54 +0100)]
[mlir] Delete unused header

4 years agounwind: rename `__personality_routine` to `_Unwind_Personality_Fn`
Saleem Abdulrasool [Mon, 10 Feb 2020 16:52:31 +0000 (08:52 -0800)]
unwind: rename `__personality_routine` to `_Unwind_Personality_Fn`

This patch renames `__personality_routine` to `_Unwind_Personality_Fn`
in `unwind.h`. Both `unwind.h` from clang and GCC headers use this name
instead of `__personality_routine`. With this patch one is also able to
build libc++abi with libunwind support on Windows.

Patch by Markus Böck!

4 years ago[mlir] subview op lowering for target memrefs with const offset
Tobias Gysi [Mon, 10 Feb 2020 16:29:50 +0000 (17:29 +0100)]
[mlir] subview op lowering for target memrefs with const offset

The current standard to llvm conversion pass lowers subview ops only if
dynamic offsets are provided. This commit extends the lowering with a
code path that uses the constant offset of the target memref for the
subview op lowering (see Example 3 of the subview op definition for an
example) if no dynamic offsets are provided.

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

4 years ago[AMDGPU] Split R600 and GCN subregs
Stanislav Mekhanoshin [Fri, 7 Feb 2020 20:08:32 +0000 (12:08 -0800)]
[AMDGPU] Split R600 and GCN subregs

These are generated and do not need to have the same values.
We are defining separate subregs for R600 and GCN but then
using AMDGPU subregs on R600.

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

4 years ago[DebugInfo][test] Fix host endian test issue
James Henderson [Mon, 10 Feb 2020 16:21:46 +0000 (16:21 +0000)]
[DebugInfo][test] Fix host endian test issue

The test previously assumed that the host was little endian, which broke
the big endian build bots.

4 years ago[X86] Add lowerShuffleAsBitRotate (PR44379)
Simon Pilgrim [Mon, 10 Feb 2020 16:16:16 +0000 (16:16 +0000)]
[X86] Add lowerShuffleAsBitRotate (PR44379)

As noted on PR44379, we didn't attempt to lower vector shuffles using bit rotations on XOP/AVX512F targets.

This patch lowers to uniform ISD:ROTL nodes - ROTR isn't supported by XOP and they are interchangeable for constant values anyway.

There might be cases where targets without ISD:ROTL support would benefit from this (expanding to SRL+SHL+OR), which I'll investigate in a future patch.

REAPPLIED rGe82e17d4d4ca after reversion at rG39eade73a567 - fixed offset matching in matchShuffleAsBitRotate.

4 years ago[gn build] Port 0151ddc2e83
LLVM GN Syncbot [Mon, 10 Feb 2020 15:56:57 +0000 (15:56 +0000)]
[gn build] Port 0151ddc2e83

4 years agoCreate a clang-tidy check to warn when -dealloc is implemented inside an ObjC class...
Michael Wyman [Fri, 7 Feb 2020 23:08:17 +0000 (16:08 -0700)]
Create a clang-tidy check to warn when -dealloc is implemented inside an ObjC class category.

Summary: Such implementations may override the class's own implementation, and even be a danger in case someone later comes and adds one to the class itself. Most times this has been encountered have been a mistake.

Reviewers: stephanemoore, benhamilton, dmaclach

Reviewed By: stephanemoore, benhamilton, dmaclach

Subscribers: dmaclach, mgorny, cfe-commits

Tags: #clang-tools-extra, #clang

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

4 years ago[analyzer] StdLibraryFunctionsChecker refactor: remove macros
Gabor Marton [Mon, 10 Feb 2020 15:16:44 +0000 (16:16 +0100)]
[analyzer] StdLibraryFunctionsChecker refactor: remove macros

Reviewers: NoQ

Tags: #clang

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

4 years agoRevert "[OpenMP] Fix unused variable"
Kadir Cetinkaya [Mon, 10 Feb 2020 13:44:51 +0000 (14:44 +0100)]
Revert "[OpenMP] Fix unused variable"

This breaks under asan, see http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/38597/steps/check-clang%20asan/logs/stdio

This reverts commit bb5045429545f47a76980864322a637c31594c7f.

Revert "[FIX] Ordering problem accidentally introduced with D72304"

This reverts commit 08c0a06d8f375e48d4acebac886bfdf19a2276ed.

Revert "[OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder."

This reverts commit e8a436c5ea26f69378e4c1cf3ddb5b647b201e0f.

4 years ago[DSE,MSSA] Adjust mda-with-dbg-values.ll to MSSA backed DSE.
Florian Hahn [Mon, 10 Feb 2020 15:18:46 +0000 (15:18 +0000)]
[DSE,MSSA] Adjust mda-with-dbg-values.ll to MSSA backed DSE.

-memdep-block-scan-limit is not relevant with MSSA.

4 years ago[DebugInfo][test] Fix(?) build bots due to incorrect type usage
James Henderson [Mon, 10 Feb 2020 15:09:16 +0000 (15:09 +0000)]
[DebugInfo][test] Fix(?) build bots due to incorrect type usage

4 years agoRevert "Remove redundant "std::move"s in return statements"
Bill Wendling [Mon, 10 Feb 2020 15:06:45 +0000 (07:06 -0800)]
Revert "Remove redundant "std::move"s in return statements"

The build failed with

  error: call to deleted constructor of 'llvm::Error'

errors.

This reverts commit 1c2241a7936bf85aa68aef94bd40c3ba77d8ddf2.

4 years ago[compiler-rt] Some clean up / refactoring in sanitizer_symbolizer_libcdep.cpp.
Max Moroz [Thu, 6 Feb 2020 16:44:42 +0000 (08:44 -0800)]
[compiler-rt] Some clean up / refactoring in sanitizer_symbolizer_libcdep.cpp.

Summary:
Nothing critical, just a few potential improvements I've noticed while reading
the code:
- return `false` when symbolizer buffer is too small to read all data
- invert some conditions to reduce indentation
- prefer `nullptr` over `0` for pointers; init some pointers on stack;
- remove minor code duplication

Reviewers: eugenis, vitalybuka

Subscribers: dberris, #sanitizers, llvm-commits, kcc

Tags: #sanitizers, #llvm

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

4 years ago[DebugInfo] Reject line tables of version > 5
James Henderson [Mon, 10 Feb 2020 14:17:46 +0000 (14:17 +0000)]
[DebugInfo] Reject line tables of version > 5

If a debug line section with version of greater than 5 is encountered,
prior to this change the parser would accept it and treat it as version
5. This might work to some extent, but then it might not at all, as it
really depends on the format of the unspecified future version, which
will be different (otherwise there would be no point in changing the
version number). Any information we could provide has a good chance of
being invalid, so we should just refuse to parse such tables.

Reviewed by: dblaikie, MaskRay

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

4 years ago[NFC] Fix line endings
James Henderson [Mon, 10 Feb 2020 14:40:47 +0000 (14:40 +0000)]
[NFC] Fix line endings

4 years agoRemove redundant "std::move"s in return statements
Bill Wendling [Mon, 10 Feb 2020 13:18:09 +0000 (05:18 -0800)]
Remove redundant "std::move"s in return statements

4 years ago[AArch64] Make Read Write System Registers Read Only
Luke Geeson [Mon, 10 Feb 2020 14:29:59 +0000 (14:29 +0000)]
[AArch64] Make Read Write System Registers Read Only

This patch makes the following System Registers Read Only:

 - CurrentEL
 - ICH_MISR_EL2
 - PMBIDR_EL1
 - PMSIDR_EL1

as found in:
https://developer.arm.com/docs/ddi0595/e/aarch64-system-registers

Relative line numbers were also added to the tests so we get more
informative error messages on failure.

Change-Id: I963b4f01ca5737b58f9e8e7abe9ca1d99e328758

4 years agoCWG2445: For function template partial ordering, take reversal of
Richard Smith [Mon, 10 Feb 2020 14:05:59 +0000 (06:05 -0800)]
CWG2445: For function template partial ordering, take reversal of
function arguments into account when forming P/A pairs.

4 years ago[SelectionDAG] Optimize build_vector of truncates and shifts
Sebastian Neubauer [Fri, 31 Jan 2020 13:18:18 +0000 (14:18 +0100)]
[SelectionDAG] Optimize build_vector of truncates and shifts

Add a simplification to fuse a manual vector extract with shifts and
truncate into a bitcast.

Unpacking and packing values into vectors is only optimized with
extractelement instructions, not when manually unpacked using shifts
and truncates.
This patch simplifies shifts and truncates into a bitcast if possible.

Simplify (build_vec (trunc $1)
                    (trunc (srl $1 width))
                    (trunc (srl $1 (2 * width))) ...)
to (bitcast $1)

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

4 years ago[mlir] use unpacked memref descriptors at function boundaries
Alex Zinenko [Mon, 10 Feb 2020 13:12:47 +0000 (14:12 +0100)]
[mlir] use unpacked memref descriptors at function boundaries

The existing (default) calling convention for memrefs in standard-to-LLVM
conversion was motivated by interfacing with LLVM IR produced from C sources.
In particular, it passes a pointer to the memref descriptor structure when
calling the function. Therefore, the descriptor is allocated on stack before
the call. This convention leads to several problems. PR44644 indicates a
problem with stack exhaustion when calling functions with memref-typed
arguments in a loop. Allocating outside of the loop may lead to concurrent
access problems in case the loop is parallel. When targeting GPUs, the contents
of the stack-allocated memory for the descriptor (passed by pointer) needs to
be explicitly copied to the device. Using an aggregate type makes it impossible
to attach pointer-specific argument attributes pertaining to alignment and
aliasing in the LLVM dialect.

Change the default calling convention for memrefs in standard-to-LLVM
conversion to transform a memref into a list of arguments, each of primitive
type, that are comprised in the memref descriptor. This avoids stack allocation
for ranked memrefs (and thus stack exhaustion and potential concurrent access
problems) and simplifies the device function invocation on GPUs.

Provide an option in the standard-to-LLVM conversion to generate auxiliary
wrapper function with the same interface as the previous calling convention,
compatible with LLVM IR porduced from C sources. These auxiliary functions
pack the individual values into a descriptor structure or unpack it. They also
handle descriptor stack allocation if necessary, serving as an allocation
scope: the memory reserved by `alloca` will be freed on exiting the auxiliary
function.

The effect of this change on MLIR-generated only LLVM IR is minimal. When
interfacing MLIR-generated LLVM IR with C-generated LLVM IR, the integration
only needs to require auxiliary functions and change the function name to call
the wrapper function instead of the original function.

This also opens the door to forwarding aliasing and alignment information from
memrefs to LLVM IR pointers in the standrd-to-LLVM conversion.

4 years ago[DebugInfo][test] Replace pre-canned binary test
James Henderson [Fri, 7 Feb 2020 09:18:43 +0000 (09:18 +0000)]
[DebugInfo][test] Replace pre-canned binary test

The DebugInfo/dwarfdump-invalid-line-table test used a pre-canned binary
generated by a fuzzer to demonstrate a bug fix. Unfortunately, the
binary is rigid and requires hand-editing if we change behaviour, such
as rejecting certain properties within it (as I plan on doing in another
change).

Rather than hand-edit the binary, I have replaced it with two tests. The
first tests the high-level code path from the debug line parser that
produces the same error as this test previously did, and the second is a
set of unit test cases that comprehensively cover the
FormValue::skipValue method, which in turn covers the area that the
original bug fix touched.

Reviewed by: MaskRay, dblaikie

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

4 years ago[SystemZ] Add implementation for the intrinsic llvm.read_register
Kai Nacke [Wed, 8 Jan 2020 19:26:12 +0000 (14:26 -0500)]
[SystemZ] Add implementation for the intrinsic llvm.read_register

This change implements the llvm intrinsic llvm.read_register for
the SystemZ platform which returns the value of the specified
register
(http://llvm.org/docs/LangRef.html#llvm-read-register-and-llvm-write-register-intrinsics).
This implementation returns the value of the stack register, and
can be extended to return the value of other registers. The
implementation for this intrinsic exists on various other platforms
including Power, x86, ARM, etc. but missing on SystemZ.

Reviewers: uweigand

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

4 years agoFix an unused variable warning
Hans Wennborg [Mon, 10 Feb 2020 13:07:41 +0000 (14:07 +0100)]
Fix an unused variable warning

4 years ago[llvm-readobj] - Change the error to warning when a section name is unknown.
Georgii Rymar [Wed, 5 Feb 2020 13:53:27 +0000 (16:53 +0300)]
[llvm-readobj] - Change the error to warning when a section name is unknown.

We reported the error in this case.
But it was asked (https://reviews.llvm.org/D73193#inline-665595) to convert it
to a warning. This patch does it.

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

4 years agoFix compiler warning when compiling without asserts [NFC]
Mikael Holmen [Mon, 10 Feb 2020 12:32:44 +0000 (13:32 +0100)]
Fix compiler warning when compiling without asserts [NFC]

4 years ago[libc++][span] Add failing tests for span::first and span::last
Louis Dionne [Mon, 10 Feb 2020 12:47:27 +0000 (13:47 +0100)]
[libc++][span] Add failing tests for span::first and span::last

Both methods have compile time constraints that we should test against.

Patch by Michael Schellenberger Costa

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

4 years ago[OpenMP] Fix unused variable
Kadir Cetinkaya [Mon, 10 Feb 2020 12:38:58 +0000 (13:38 +0100)]
[OpenMP] Fix unused variable

4 years ago[gn build] make 'clang' target depend on libcxx/include on mac
Nico Weber [Mon, 10 Feb 2020 12:42:27 +0000 (07:42 -0500)]
[gn build] make 'clang' target depend on libcxx/include on mac

On macOS, libc++ headers are distributed with the compiler, not
the sysroot. Without this, compiling a file that includes something
like <string> won't compile with gn-built clang without manual tweaks.

I used to do the manual tweaks, but now that other people are starting
to use this on mac, let's make it Just Work.

(This is marginally nicer than the cmake build now in that you can
just build 'clang' and it'll do the right thing.)

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

4 years ago[libc++] Protect <span> against min/max macro
Louis Dionne [Mon, 10 Feb 2020 12:38:04 +0000 (13:38 +0100)]
[libc++] Protect <span> against min/max macro

Patch by Corentin Jabot
Differential Revision: https://reviews.llvm.org/D73855

4 years ago[DSE,MSSA] Move more passing test cases from todo to simple.ll.
Florian Hahn [Mon, 10 Feb 2020 12:37:22 +0000 (12:37 +0000)]
[DSE,MSSA] Move more passing test cases from todo to simple.ll.