platform/upstream/llvm.git
4 years agoFix regression due to reviews.llvm.org/D74436 by adding option ffp-contract=off to...
Melanie Blower [Thu, 13 Feb 2020 03:05:18 +0000 (19:05 -0800)]
Fix regression due to reviews.llvm.org/D74436 by adding option ffp-contract=off to RUN line

4 years agoFix ReST syntax on link to "Bisecting LLVM code" page
Nico Weber [Thu, 13 Feb 2020 02:18:25 +0000 (21:18 -0500)]
Fix ReST syntax on link to "Bisecting LLVM code" page

Patch from nicolas17 (Nicolás Alvarez)!

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

4 years ago[MLIR][Affine] Add affine.parallel op
Frank Laub [Thu, 13 Feb 2020 01:59:57 +0000 (17:59 -0800)]
[MLIR][Affine] Add affine.parallel op

Summary:
As discussed in https://llvm.discourse.group/t/rfc-add-affine-parallel/350, this is the first in a series of patches to bring in support for the `affine.parallel` operation.

This first patch adds the IR representation along with custom printer/parser implementations.

Reviewers: bondhugula, herhut, mehdi_amini, nicolasvasilache, rriddle, earhart, jbruestle

Reviewed By: bondhugula, nicolasvasilache, rriddle, earhart, jbruestle

Subscribers: jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[AsmPrinter][ELF] Emit local alias for ExternalLinkage dso_local GlobalAlias
Fangrui Song [Wed, 12 Feb 2020 00:07:06 +0000 (16:07 -0800)]
[AsmPrinter][ELF] Emit local alias for ExternalLinkage dso_local GlobalAlias

4 years agoRevert "[X86][SSE] lowerShuffleAsBitRotate - lower to vXi8 shuffles to ROTL on pre...
Amy Huang [Thu, 13 Feb 2020 00:59:17 +0000 (16:59 -0800)]
Revert "[X86][SSE] lowerShuffleAsBitRotate - lower to vXi8 shuffles to ROTL on pre-SSSE3 targets"

This reverts commit 11c16e71598d51f15b4cfd0f719c4dabcc0bebf7 because it
causes a crash in chromium code. See
https://reviews.llvm.org/rG11c16e71598d51f15b4cfd0f719c4dabcc0bebf7.

4 years agoRevert "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"
Johannes Doerfert [Thu, 13 Feb 2020 00:50:22 +0000 (18:50 -0600)]
Revert "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"

This reverts commit 8a56d64d7620b3764f10f03f3a1e307fcdd72c2f.

Will be recommitted once the clang test problem is addressed.

4 years agoAMDGPU/GlobalISel: Select G_CTTZ_ZERO_UNDEF
Matt Arsenault [Fri, 7 Feb 2020 16:08:52 +0000 (11:08 -0500)]
AMDGPU/GlobalISel: Select G_CTTZ_ZERO_UNDEF

Directly select this rather than going through the intermediate
instruction, which may provide some combine value in the future.

4 years agoAMDGPU/GlobalISel: Select G_CTLZ_ZERO_UNDEF
Matt Arsenault [Fri, 7 Feb 2020 02:54:41 +0000 (21:54 -0500)]
AMDGPU/GlobalISel: Select G_CTLZ_ZERO_UNDEF

Directly select this rather than going through the intermediate
instruction, which may provide some combine value in the future.

4 years agoAMDGPU/GlobalISel: Fix mapping G_ICMP with constrained result
Matt Arsenault [Thu, 6 Feb 2020 21:11:45 +0000 (16:11 -0500)]
AMDGPU/GlobalISel: Fix mapping G_ICMP with constrained result

When SI_IF is inserted, it constrains the source register with a
register class, which was quite likely a G_ICMP. This was incorrectly
treating it as a scalar, and then applyMappingImpl would end up
producing invalid MIR since this was unexpected.

Also fix not using all VGPR sources for vcc outputs.

4 years agoPPC: Prepare tests for switch of default denormal-fp-math
Matt Arsenault [Fri, 8 Nov 2019 02:26:17 +0000 (18:26 -0800)]
PPC: Prepare tests for switch of default denormal-fp-math

These tests fail when the default is switched to assume IEEE denormal
handling. I'm not sure if PPC really has a way to control the denormal
input handling.

4 years agoReplace std::foo with std::foo_t in LLVM.
Caroline Lebar [Thu, 13 Feb 2020 00:14:30 +0000 (16:14 -0800)]
Replace std::foo with std::foo_t in LLVM.

This patch is replacements missed in my last change doing this across LLVM.

No functional change, although I think there was a missing typename
in struct conjunction that is now fixed.

4 years ago[GWP-ASan] [NFC] Change enum from ANDROID->BIONIC.
Mitch Phillips [Thu, 13 Feb 2020 00:06:42 +0000 (16:06 -0800)]
[GWP-ASan] [NFC] Change enum from ANDROID->BIONIC.

4 years ago[Fuzzer] Rename ExecuteCommandWithPopen to ExecuteCommandNon-Fushsia target will...
Yuanfang Chen [Wed, 12 Feb 2020 23:43:44 +0000 (15:43 -0800)]
[Fuzzer] Rename ExecuteCommandWithPopen to ExecuteCommandNon-Fushsia target will keep using popen/pclose implementation. OnFuchsia, Two-args version of `ExecuteCommand` is a simple wrapper of theone-arg version. (Hopefully) Fix D73329 build on Fuchsia.

4 years ago[OpenMP][IRBuilder] Perform finalization (incl. outlining) late
Johannes Doerfert [Mon, 10 Feb 2020 20:28:47 +0000 (14:28 -0600)]
[OpenMP][IRBuilder] Perform finalization (incl. outlining) late

In order to fix PR44560 and to prepare for loop transformations we now
finalize a function late, which will also do the outlining late. The
logic is as before but the actual outlining step happens now after the
function was fully constructed. Once we have loop transformations we
can apply them in the finalize step before the outlining.

Reviewed By: JonChesterfield

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

4 years agoFix a reentrance bug with deserializing ObjC type parameters.
John McCall [Wed, 12 Feb 2020 23:40:00 +0000 (18:40 -0500)]
Fix a reentrance bug with deserializing ObjC type parameters.

This is a longstanding bug that seems to have been hidden by
a combination of (1) the normal flow being to deserialize the
interface before deserializing its parameter and (2) a precise
ordering of work that was apparently recently disturbed,
perhaps by my abstract-serialization work or Bruno's ObjC
module merging work.

Fixes rdar://59153545.

4 years ago[Attributor] Use fine-grained liveness in all helpers
Johannes Doerfert [Sun, 12 Jan 2020 07:09:22 +0000 (01:09 -0600)]
[Attributor] Use fine-grained liveness in all helpers

We used coarse-grained liveness before, thus we looked if the
instruction was executed, but we did not use fine-grained liveness,
hence if the instruction was needed or could be deleted even if the
surrounding ones are live. This patches introduces this level of
liveness checks together with other liveness queries, e.g., for uses.

For more control we enforce that all liveness queries go through the
Attributor.

Test have been adjusted to reflect the changes or augmented to prevent
deletion of the parts we want to check.

Reviewed By: sstefan1

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

4 years ago[Attributor] Ignore uses if a value is simplified
Johannes Doerfert [Thu, 23 Jan 2020 23:12:56 +0000 (17:12 -0600)]
[Attributor] Ignore uses if a value is simplified

If we have a replacement for a value, via AAValueSimplify, the original
value will lose all its uses. Thus, as long as a value is simplified we
can skip the uses in checkForAllUses, given that these uses are
transitive uses for the simplified version and will therefore affect the
simplified version as necessary.

Since this allowed us to remove calls without side-effects and a known
return value, we need to make sure not to eliminate `musttail` calls.
Those we keep around, or later remove the entire `musttail` call chain.

4 years ago[Attributor] Use assumed information to determine side-effects
Johannes Doerfert [Sun, 12 Jan 2020 06:34:38 +0000 (00:34 -0600)]
[Attributor] Use assumed information to determine side-effects

We relied on wouldInstructionBeTriviallyDead before but that functions
does not take assumed information, especially for calls, into account.
The replacement, AAIsDead::isAssumeSideEffectFree, does.

This change makes AAIsDeadCallSiteReturn more complex as we can have
a dead call or only dead users.

The test have been modified to include a side effect where there was
none in order to keep the coverage.

Reviewed By: sstefan1

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

4 years agoChanged omp_get_max_threads() implementation to more closely match spec description.
Ethan Stewart [Wed, 12 Feb 2020 23:29:10 +0000 (23:29 +0000)]
Changed omp_get_max_threads() implementation to more closely match spec description.

Summary: The 5.0 spec states, "The omp_get_max_threads routine returns an upper bound on the number of threads that could be used to form a new team if a parallel construct without a num_threads clause were encountered after execution returns from this routine." The attached test shows Max Threads: 96, Num Threads: 128 without the proposed change. The number of threads should not exceed the (max) nthreads ICV, hence we should return the higher SPMD thread number even when omp_get_max_threads() is called in a generic kernel. This change does fail the api test, max_threads.c, because now it would return 64 instead of 32.

Reviewers: jdoerfert, ABataev, grokos, JonChesterfield

Reviewed By: jdoerfert

Subscribers: openmp-commits

Tags: #openmp

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

4 years ago[libomptarget][nfc] Change enum values to match those in cuda/rtl
JonChesterfield [Wed, 12 Feb 2020 23:25:33 +0000 (23:25 +0000)]
[libomptarget][nfc] Change enum values to match those in cuda/rtl

Summary:
[libomptarget][nfc] Change enum values to match those in cuda/rtl

support.h and cuda/rtl.cpp (and downsteam hsa/rtl.cpp) have enums for execution
mode. These are actually independent - the numbers that used within support, or
within the plugin, are never passed across the boundary.

Nevertheless, trying to work out why the values are different between the two
has generated a reasonable amount of confusion. This patch changes support to
match the values in plugin, on the basis that the plugin also has some comments
which I'd have to update if I changed that one instead. Credit to Ron for
working through this in our own fork. See rocm-developer-tools/aomp/issues/7
for that earlier diagnostic write up.

Also happy with generic = 0, spmd = 1 - provided it's the same in both places.

Reviewers: jdoerfert, grokos, ABataev, ronlieb

Reviewed By: grokos

Subscribers: openmp-commits

Tags: #openmp

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

4 years ago[GWP-ASan] Update alignment on Android.
Mitch Phillips [Wed, 12 Feb 2020 23:24:55 +0000 (15:24 -0800)]
[GWP-ASan] Update alignment on Android.

Summary:
Android has different alignment requirements. You can read more about
them here
(https://cs.android.com/android/platform/superproject/+/master:bionic/tests/malloc_test.cpp;l=808),
but the general gist is that for malloc(x <= 8), we do malloc(8), and
for everything else, we do 16-byte alignment.

Reviewers: eugenis, morehouse, cferris

Reviewed By: eugenis, morehouse

Subscribers: #sanitizers, llvm-commits, pcc

Tags: #sanitizers, #llvm

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

4 years ago[MBP] Partial tail duplication into hot predecessors
Guozhi Wei [Wed, 12 Feb 2020 23:22:33 +0000 (15:22 -0800)]
[MBP] Partial tail duplication into hot predecessors

Current tail duplication embedded in MBP duplicates a BB into all or none of its predecessors without too much cost analysis. So sometimes it is duplicated into cold predecessors, and in other cases it may miss the duplication into hot predecessors.

This patch improves tail duplication in 3 aspects:

  A successor can be duplicated into part of its predecessors.
  A more fine-grained benefit analysis, combined with 1, now a successor is duplicated into hot predecessors only.
  If a successor can't be duplicated into one predecessor, it doesn't impact the duplication into other predecessors.

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

4 years ago[CMake][Fuchsia] Enable in-process cc1
Petr Hosek [Wed, 12 Feb 2020 22:04:11 +0000 (14:04 -0800)]
[CMake][Fuchsia] Enable in-process cc1

This is now supported by Goma so we can re-enable it.

4 years ago[Clang] Limit -fintegrated-cc1 to only one TU
Alexandre Ganea [Wed, 12 Feb 2020 22:01:55 +0000 (17:01 -0500)]
[Clang] Limit -fintegrated-cc1 to only one TU

As discussed in https://reviews.llvm.org/D74447, this patch disables integrated-cc1 behavior if there's more than one job to be executed. This is meant to limit memory bloating, given that currently jobs don't clean up after execution (-disable-free is always active in cc1 mode).

I see this behavior as temporary until release 10.0 ships (to ease merging of this patch), then we'll reevaluate the situation, see if D74447 makes more sense on the long term.

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

4 years ago[Clang] When -ftime-trace is used, clean CompilerInstance::OutputFiles before exiting...
Alexandre Ganea [Wed, 12 Feb 2020 18:02:51 +0000 (13:02 -0500)]
[Clang] When -ftime-trace is used, clean CompilerInstance::OutputFiles before exiting cc_main()

This fixes cc1 execution when '-disable-free' is not used (currently not the case, that flag is always used for cc1).

4 years ago[mlir][Linalg] Fix build warnings
Nicolas Vasilache [Wed, 12 Feb 2020 21:43:33 +0000 (16:43 -0500)]
[mlir][Linalg] Fix build warnings

4 years ago[lldb/Plugins] Move DynamicLoaderMacOS into DynamicLoaderMacOSXDYLD (NFCI)
Jonas Devlieghere [Wed, 12 Feb 2020 21:44:05 +0000 (13:44 -0800)]
[lldb/Plugins] Move DynamicLoaderMacOS into DynamicLoaderMacOSXDYLD (NFCI)

Move the logic for initialization and termination for DynamicLoaderMacOS
into DynamicLoaderMacOSXDYLD so that there's one initializer for the
DynamicLoaderMacOSXDYLD plugin.

4 years ago[mlir] support creating memref descriptors from static shape with non-zero offset
Tobias Gysi [Wed, 12 Feb 2020 21:36:21 +0000 (22:36 +0100)]
[mlir] support creating memref descriptors from static shape with non-zero offset

This patch adapts the method MemRefDescriptor::fromStaticShape to
support static non-zero offsets. The updated method uses the
getStridesAndOffset method to extract strides and offset. The patch also
adapts the test cases since sizes and strides are now set in forward
instead of reverse order.

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

4 years ago[MLIR] Fix wrong header for mlir-cuda-runner
Valentin Clement [Wed, 12 Feb 2020 21:35:02 +0000 (22:35 +0100)]
[MLIR] Fix wrong header for mlir-cuda-runner

Just updated the wrong header probably copied from the mlir-cpu-runner

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

4 years agoFix type-dependency of bitfields in templates
Elizabeth Andrews [Wed, 12 Feb 2020 19:30:02 +0000 (11:30 -0800)]
Fix type-dependency of bitfields in templates

This patch is a follow up to 878a24ee244a24. Name of bitfields
with value-dependent width should be set as type-dependent. This
patch adds the required value-dependency check and sets the
type-dependency accordingly.

Patch fixes PR44886

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

4 years ago[TBLGEN] Fix subreg value overflow in DAGISelMatcher
Stanislav Mekhanoshin [Mon, 10 Feb 2020 21:37:00 +0000 (13:37 -0800)]
[TBLGEN] Fix subreg value overflow in DAGISelMatcher

Tablegen's DAGISelMatcher emits integers in a VBR format,
so if an integer is below 128 it can fit into a single
byte, otherwise high bit is set, next byte is used etc.
MatcherTable is essentially an unsigned char table. When
SelectionDAGISel parses the table it does a reverse translation.

In a situation when numeric value of an integer to emit is
unknown it can be emitted not as OPC_EmitInteger but as
OPC_EmitStringInteger using a symbolic name of the value.
In this situation the value should not exceed 127.

One of the situations when OPC_EmitStringInteger is used is
if we need to emit a subreg into a matcher table. However,
number of subregs can exceed 127. Currently last defined subreg
for AMDGPU is 192. That results in a silent bug in the ISel
with matcher reading from an invalid offset.

Fixed this bug to emit actual VBR encoded value for a subregs
which value exceeds 127.

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

4 years ago[docs] Minor updates to DeveloperPolicy due to svn to git
Jinsong Ji [Wed, 12 Feb 2020 21:07:40 +0000 (21:07 +0000)]
[docs] Minor updates to DeveloperPolicy due to svn to git

Reviewed By: efriedma

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

4 years ago[README] Add note on using cmake to perform the build
Evandro Menezes [Wed, 12 Feb 2020 20:21:02 +0000 (14:21 -0600)]
[README] Add note on using cmake to perform the build

Also, some spelling fixes.  Test commit.

4 years ago[OpenMP] update strings output of libomp.so [NFC]
Kelvin Li [Wed, 12 Feb 2020 20:38:54 +0000 (15:38 -0500)]
[OpenMP] update strings output of libomp.so [NFC]

Change the string from "Intel(R) OMP" to "LLVM OMP" in libomp.so

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

4 years ago[LoopExtractor] Fix legacy pass dependencies
Ehud Katz [Wed, 12 Feb 2020 20:39:21 +0000 (22:39 +0200)]
[LoopExtractor] Fix legacy pass dependencies

Fixes a memory leak of allocating `LoopInfoWrapperPass` and `DominatorTreeWrapperPass`.

4 years ago[llvm-exegesis] CombinationGenerator: don't store function_ref
Roman Lebedev [Wed, 12 Feb 2020 20:30:22 +0000 (23:30 +0300)]
[llvm-exegesis] CombinationGenerator: don't store function_ref

function_ref is non-owning, so if we get it as a parameter in constructor,
our reference goes out-of-scope as soon as constructor returns.
Instead, let's just take it as a parameter to the actual `generate()` call

4 years agoRevert "[IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas"
Erik Pilkington [Wed, 12 Feb 2020 20:02:58 +0000 (12:02 -0800)]
Revert "[IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas"

This reverts commit fafc6e4fdf3673dcf557d6c8ae0c0a4bb3184402.

Should fix ppc stage2 failure: http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/23546

Conflicts:
clang/lib/CodeGen/CGCall.cpp

4 years ago[mlir][Linalg] Refactor in preparation for automatic Linalg "named" ops.
Nicolas Vasilache [Wed, 12 Feb 2020 19:41:11 +0000 (14:41 -0500)]
[mlir][Linalg] Refactor in preparation for automatic Linalg "named" ops.

This revision prepares the ground for declaratively defining Linalg "named" ops.
Such named ops form the backbone of operations that are ubiquitous in the ML
application domain.

This revision closely related to the definition of a "Tensor Computation
Primitives Dialect" and demonstrates that ops can be expressed as declarative
configurations of the `linalg.generic` op.

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

4 years ago[lldb/Plugins] Move SymbolFileDWARFDebugMap into SymbolFileDWARF (NFCI)
Jonas Devlieghere [Wed, 12 Feb 2020 19:01:43 +0000 (11:01 -0800)]
[lldb/Plugins] Move SymbolFileDWARFDebugMap into SymbolFileDWARF (NFCI)

Move the logic for initialization and termination for
SymbolFileDWARFDebugMap into SymbolFileDWARF so that there's one
initializer for the SymbolFileDWARF plugin.

4 years ago[lldb/LibCxx] Have ExtractLibcxxStringInfo return an Optional result, NFC
Vedant Kumar [Wed, 5 Feb 2020 17:46:51 +0000 (09:46 -0800)]
[lldb/LibCxx] Have ExtractLibcxxStringInfo return an Optional result, NFC

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

4 years ago[lldb/StringPrinter] Avoid reading garbage in uninitialized strings
Vedant Kumar [Sat, 1 Feb 2020 07:18:17 +0000 (23:18 -0800)]
[lldb/StringPrinter] Avoid reading garbage in uninitialized strings

This patch fixes a few related out-of-bounds read bugs in the
string data formatters. These issues have to do with mishandling of un-
initialized strings. These manifest as ASan exceptions when debugging a
clang binary.

The first issue was that the std::string formatter treated strings in
"short mode" with length greater than the size of the inline buffer as
valid.

The second issue was that the StringPrinter facility did not check that
a full utf8 codepoint sequence can be read from the buffer (i.e. there
are some missing range checks). I took the opportunity here to delete
some untested code that was meant to deal with invalid input and replace
it with fail-on-invalid logic ([1][2][3]). This means we'll give up on
formatting an invalid string instead of guessing our way through it.

The third issue is that StringPrinter did not check that a utf8 sequence
could actually be fully read from the string payload. This one is especially
tricky as we may overflow the buffer pointer while reading the sequence.

I also noticed that the std::string formatter would spew the raw version of
the underlying ValueObject when garbage is detected. I've changed this to
just print "Summary Unavailable" instead, as we do elsewhere.

I've added regression tests for these issues to
test/functionalities/data-formatter/data-formatter-stl/libcxx/string.

[1]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L136
[2]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L163
[3]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L357

rdar://59080026

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

4 years ago[lldb/TypeSystemClang] Supply trivial TypeSourceInfo to NonTypeTemplateParmDecl:...
Vedant Kumar [Wed, 22 Jan 2020 22:32:20 +0000 (14:32 -0800)]
[lldb/TypeSystemClang] Supply trivial TypeSourceInfo to NonTypeTemplateParmDecl::Create

This fixes a UBSan error seen while debugging clang:

Member call on null pointer of type 'clang::TypeSourceInfo'

rdar://58783517

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

4 years ago[AddressSanitizer] Ensure only AllocaInst is passed to dbg.declare
Vedant Kumar [Tue, 11 Feb 2020 00:22:27 +0000 (16:22 -0800)]
[AddressSanitizer] Ensure only AllocaInst is passed to dbg.declare

Various parts of the LLVM code generator assume that the address
argument of a dbg.declare is not a `ptrtoint`-of-alloca. ASan breaks
this assumption, and this results in local variables sometimes being
unavailable at -O0.

GlobalISel, SelectionDAG, and FastISel all do not appear to expect
dbg.declares to have a `ptrtoint` as an operand. This means that they do
not place entry block allocas in the usual side table reserved for local
variables available in the whole function scope. This isn't always a
problem, as LLVM can try to lower the dbg.declare to a DBG_VALUE, but
those DBG_VALUEs can get dropped for all the usual reasons DBG_VALUEs
get dropped. In the ObjC test case I'm looking at, the cause happens to
be that `replaceDbgDeclare` has hoisted dbg.declares into the entry
block, causing LiveDebugValues to "kill" the DBG_VALUEs because the
lexical dominance check fails.

To address this, I propose:

1) Have ASan (always) pass an alloca to dbg.declares (this patch). This
   is a narrow bugfix for -O0 debugging.

2) Make replaceDbgDeclare not move dbg.declares around. This should be a
   generic improvement for optimized debug info, as it would prevent the
   lexical dominance check in LiveDebugValues from killing as many
   variables.

   This means reverting llvm/r227544, which fixed an assertion failure
   (llvm.org/PR22386) but no longer seems to be necessary. I was able to
   complete a stage2 build with the revert in place.

rdar://54688991

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

4 years ago[KnownBits] Introduce anyext instead of passing a flag into zext
Jay Foad [Wed, 12 Feb 2020 13:27:28 +0000 (13:27 +0000)]
[KnownBits] Introduce anyext instead of passing a flag into zext

Summary:
This was a very odd API, where you had to pass a flag into a zext
function to say whether the extended bits really were zero or not. All
callers passed in a literal true or false.

I think it's much clearer to make the function name reflect the
operation being performed on the value we're tracking (rather than on
the KnownBits Zero and One fields), so zext means the value is being
zero extended and new function anyext means the value is being extended
with unknown bits.

NFC.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir][EDSC][Linalg] Compose linalg_matmul and vector.contract
Nicolas Vasilache [Wed, 12 Feb 2020 18:43:10 +0000 (13:43 -0500)]
[mlir][EDSC][Linalg] Compose linalg_matmul and vector.contract

Summary:
This revision allows model builder to create a linalg_matmul whose body
is a vector.contract. This shows the abstractions compose nicely.

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

4 years ago[gn build] Port 6030fe01f4e
LLVM GN Syncbot [Wed, 12 Feb 2020 18:34:39 +0000 (18:34 +0000)]
[gn build] Port 6030fe01f4e

4 years ago[llvm-exegesis] Exploring X86::OperandType::OPERAND_COND_CODE
Roman Lebedev [Wed, 12 Feb 2020 17:54:39 +0000 (20:54 +0300)]
[llvm-exegesis] Exploring X86::OperandType::OPERAND_COND_CODE

Summary:
Currently, we only have nice exploration for LEA instruction,
while for the rest, we rely on `randomizeUnsetVariables()`
to sometimes generate something interesting.
While that works, it isn't very reliable in coverage :)

Here, i'm making an assumption that while we may want to explore
multi-instruction configs, we are most interested in the
characteristics of the main instruction we were asked about.

Which we can do, by taking the existing `randomizeMCOperand()`,
and turning it on it's head - instead of relying on it to randomly fill
one of the interesting values, let's pregenerate all the possible interesting
values for the variable, and then generate as much `InstructionTemplate`
combinations of these possible values for variables as needed/possible.

Of course, that requires invasive changes to no longer pass just the
naked `Instruction`, but sometimes partially filled `InstructionTemplate`.

As it can be seen from the test, this allows us to explore
`X86::OperandType::OPERAND_COND_CODE` for instructions
that take such an operand.
I'm hoping this will greatly simplify exploration.

Reviewers: courbet, gchatelet

Reviewed By: gchatelet

Subscribers: orodley, mgorny, sdardis, tschuett, jrtc27, atanasyan, mstojanovic, andreadb, RKSimon, llvm-commits

Tags: #llvm

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

4 years agoCompletely ignore strict FP model and denormal-fp-math interaction
Matt Arsenault [Wed, 12 Feb 2020 18:26:04 +0000 (13:26 -0500)]
Completely ignore strict FP model and denormal-fp-math interaction

No behavior is going to make sense here until the default is IEEE.

4 years ago[ConstantFold][SVE] Fix constant fold for FoldReinterpretLoadFromConstPtr.
Huihui Zhang [Wed, 12 Feb 2020 18:19:03 +0000 (10:19 -0800)]
[ConstantFold][SVE] Fix constant fold for FoldReinterpretLoadFromConstPtr.

Summary:
Bail out early for scalable vectors. As global variables are not expected
to be scalable.

Use explicit call of getFixedSize() to assert on places where scalable size
doesn't make sense.

Reviewers: sdesmalen, efriedma, apazos, huntergr, willlovett

Reviewed By: sdesmalen

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years agoFix fp-model flag test failure on linux
Matt Arsenault [Wed, 12 Feb 2020 18:12:50 +0000 (10:12 -0800)]
Fix fp-model flag test failure on linux

We're still in the awkward state where IEEE is not the default
denormal mode.

4 years ago[ARCMT][NFC] Reduce #include dependencies
Nicolás Alvarez [Wed, 12 Feb 2020 15:36:29 +0000 (16:36 +0100)]
[ARCMT][NFC] Reduce #include dependencies

Replace some #includes in ARCMigrate source files with more specific includes
and forward declarations. This reduces the number of files that need to be
rebuilt when a header changes (and saves like 1 second of build time). For
example, several files no longer need to be rebuilt when the list of static
analyzer checkers(!) changes.

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

4 years agoRecommit "[SCCP] Remove forcedconstant, go to overdefined instead"
Florian Hahn [Wed, 12 Feb 2020 14:22:20 +0000 (14:22 +0000)]
Recommit "[SCCP] Remove forcedconstant, go to overdefined instead"

This version includes a fix for a set of crashes caused by marking
values depending on a yet unknown & tracked call as overdefined.

In some cases, we would later discover that the call has a constant
result and try to mark a user of it as constant, although it was already
marked as overdefined. Most instruction handlers bail out early if the
instruction is already overdefined. But that is not necessary for
CastInsts for example. By skipping values that depend on skipped
calls, we resolve the crashes and also improve the precision in some
cases (see resolvedundefsin-tracked-fn.ll).

Note that we may not skip PHI nodes that may depend on a skipped call,
but they can be safely marked as overdefined, as we bail out early if
the PHI node is overdefined.

This reverts the revert commit
a74b31a3e9cd844c7ce2087978568e3f5ec8519.

4 years ago[ARM] Extra vecreduce add with accumulate tests. NFC
David Green [Wed, 12 Feb 2020 12:24:26 +0000 (12:24 +0000)]
[ARM] Extra vecreduce add with accumulate tests. NFC

4 years ago[NFC] Remove extra headers included in Loop Unroll and LoopUnrollAndJam files
Anh Tuyen Tran [Wed, 12 Feb 2020 17:57:56 +0000 (17:57 +0000)]
[NFC] Remove extra headers included in Loop Unroll and LoopUnrollAndJam files

Summary:
This refactor patch removes some header files which are not needed and also add some to meet IWYU principles.

Reviewers: rnk (Reid Kleckner), Meinersbur (Michael Kruse), dmgreen (Dave Green)

Reviewed By: dmgreen (Dave Green), rnk (Reid Kleckner), Meinersbur (Michael Kruse)

Subscribers: dmgreen (Dave Green), Whitney (Whitney Tsang), hiraditya (Aditya Kumar), zzheng (Z. Zheng), llvm-commits, LLVM

Tag: LLVM

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

4 years ago[mlir] Allow constructing a ValueRange from an ArrayRef<BlockArgument>
River Riddle [Wed, 12 Feb 2020 17:46:21 +0000 (09:46 -0800)]
[mlir] Allow constructing a ValueRange from an ArrayRef<BlockArgument>

Summary: This was a missed case when ValueRange was originally added, and allows for constructing a ValueRange from the arguments of a block.

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

4 years ago[runtimes] Add umbrella targets for runtimes
Shoaib Meenai [Wed, 12 Feb 2020 02:24:57 +0000 (18:24 -0800)]
[runtimes] Add umbrella targets for runtimes

This will create e.g. a compiler-rt target that'll build compiler-rt for
all configured targets, similar to how the runtimes umbrella target
builds all the runtimes for all configured targets.

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

4 years agoFix `-Wunused-variable` warning. NFC.
Michael Liao [Wed, 12 Feb 2020 17:43:51 +0000 (12:43 -0500)]
Fix `-Wunused-variable` warning. NFC.

4 years ago[AArch64][GlobalISel] Properly implement widening for TB(N)Z
Jessica Paquette [Tue, 11 Feb 2020 18:22:38 +0000 (10:22 -0800)]
[AArch64][GlobalISel] Properly implement widening for TB(N)Z

When we have to widen to a 64-bit register, we have to emit a SUBREG_TO_REG.

Add a general-purpose widening helpe  which emits the correct SUBREG_TO_REG
instruction based off of a desired size and add a testcase.

Also remove some asserts which are technically incorrect in `emitTestBit`.

- p0 doesn't count as a scalar type, so we need to check `!Ty.isVector()`
instead

- Whenever we have a s1, the Size/Bit checks are too conservative, so just
remove them

Replace these asserts with less conservative ones where applicable.

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

4 years agoCompute ORE, BPI, BFI in Loop passes.
Alina Sbirlea [Thu, 16 Jan 2020 23:32:30 +0000 (15:32 -0800)]
Compute ORE, BPI, BFI in Loop passes.

Summary:
Passes ORE, BPI, BFI are not being preserved by Loop passes, hence it
is incorrect to retrieve these passes as cached.
This patch makes the loop passes in question compute a new instance.

In some of these cases, however, it may be beneficial to change the Loop pass to
a Function pass instead, similar to the change for LoopUnrollAndJam.

Reviewers: chandlerc, dmgreen, jdoerfert, reames

Subscribers: mehdi_amini, hiraditya, zzheng, steven_wu, dexonsmith, Whitney, llvm-commits

Tags: #llvm

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

4 years agoclang: Guess at some platform FTZ/DAZ default settings
Matt Arsenault [Fri, 8 Nov 2019 01:14:51 +0000 (17:14 -0800)]
clang: Guess at some platform FTZ/DAZ default settings

This is to avoid performance regressions when the default attribute
behavior is fixed to assume ieee.

I tested the default on x86_64 ubuntu, which seems to default to
FTZ/DAZ, but am guessing for x86 and PS4.

4 years ago[VectorCombine] add tests for extract-binop; NFC
Sanjay Patel [Wed, 12 Feb 2020 16:33:21 +0000 (11:33 -0500)]
[VectorCombine] add tests for extract-binop; NFC

4 years agoFix SFINAE in llvm::bit_cast.
Justin Lebar [Tue, 11 Feb 2020 03:34:44 +0000 (19:34 -0800)]
Fix SFINAE in llvm::bit_cast.

Summary:
As far as I can tell, the SFINAE was broken; there is no such thing as
std::is_trivially_constructible<T>::type.

Subscribers: dexonsmith, llvm-commits

Tags: #llvm

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

4 years agoFix compilation of Any.h header.
Justin Lebar [Wed, 12 Feb 2020 16:05:00 +0000 (08:05 -0800)]
Fix compilation of Any.h header.

In a previous patch I changed `std::decay<T>::type` to `std::decay<T>`
rather than `std::decay_t<T>`.  This seems to have broken the build
*only for clang-cl*.  I don't know why.

Submitting with post-commit review because this is an obvious fix for a
build breakage and we've verified that it fixes the breakage.

4 years ago[ELF] Support INSERT [AFTER|BEFORE] for orphan sections
Fangrui Song [Mon, 10 Feb 2020 23:58:29 +0000 (15:58 -0800)]
[ELF] Support INSERT [AFTER|BEFORE] for orphan sections

D43468+D44380 added INSERT [AFTER|BEFORE] for non-orphan sections. This patch
makes INSERT work for orphan sections as well.

`SECTIONS {...} INSERT [AFTER|BEFORE] .foo` does not set `hasSectionCommands`, so the result
will be similar to a regular link without a linker script. The differences when `hasSectionCommands` is set include:

* image base is different
* -z noseparate-code/-z noseparate-loadable-segments are unavailable
* some special symbols such as `_end _etext _edata` are not defined

The behavior is similar to GNU ld:
INSERT is not considered an external linker script.

This feature makes the section layout more flexible. It can be used to:

* Place .nv_fatbin before other readonly SHT_PROGBITS sections to mitigate relocation overflows.
* Disturb the layout to expose address sensitive application bugs.

Reviewed By: grimar

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

4 years ago[ELF] Start a new PT_LOAD if LMA region is different
Fangrui Song [Sun, 9 Feb 2020 06:04:06 +0000 (22:04 -0800)]
[ELF] Start a new PT_LOAD if LMA region is different

GNU ld has a counterintuitive lang_propagate_lma_regions rule.

```
// .foo's LMA region is propagated to .bar because their VMA region is the same,
// and .bar does not have an explicit output section address (addr_tree).
.foo : { *(.foo) } >RAM AT> FLASH
.bar : { *(.bar) } >RAM

// An explicit output section address disables propagation.
.foo : { *(.foo) } >RAM AT> FLASH
.bar . : { *(.bar) } >RAM
```

In both cases, lld thinks .foo's LMA region is propagated and
places .bar in the same PT_LOAD, so lld diverges from GNU ld w.r.t. the
second case (lma-align.test).

This patch changes Writer<ELFT>::createPhdrs to disable propagation
(start a new PT_LOAD). A user of the first case can make linker scripts
portable by explicitly specifying `AT>`. By contrast, there was no
workaround for the old behavior.

This change uncovers another LMA related bug in assignOffsets() where
`ctx->lmaOffset = 0;` was omitted. It caused a spurious "load address
range overlaps" error for at2.test

The new PT_LOAD rule is complex. For convenience, I listed the origins of some subexpressions:

* rL323449: `sec->memRegion == load->firstSec->memRegion`; linkerscript/at3.test
* D43284: `load->lastSec == Out::programHeaders` (don't start a new PT_LOAD after program headers); linkerscript/at4.test
* D58892: `sec != relroEnd` (start a new PT_LOAD after PT_GNU_RELRO)

Reviewed By: psmith

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

4 years ago[ELF] Respect output section alignment for AT> (non-null lmaRegion)
Fangrui Song [Sat, 8 Feb 2020 19:07:03 +0000 (11:07 -0800)]
[ELF] Respect output section alignment for AT> (non-null lmaRegion)

When lmaRegion is non-null, respect `sec->alignment`
This rule is analogous to `switchTo(sec)` which advances sh_addr (VMA).

This fixes the p_paddr misalignment issue as reported by
https://android-review.googlesource.com/c/trusty/external/trusted-firmware-a/+/1230058

Note, `sec->alignment` is the maximum of ALIGN and input section alignments. We may overalign LMA than GNU ld.

linkerscript/align-lma.s has a FIXME that demonstrates another bug:
`.bss ... >RAM` should be placed in a different PT_LOAD (GNU ld
behavior) because its lmaRegion (nullptr) is different from the previous
section's lmaRegion (ROM).

Reviewed By: psmith

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

4 years ago[llvm-objdump] Print file format in lowercase to match GNU output.
Jordan Rupprecht [Tue, 11 Feb 2020 19:55:40 +0000 (11:55 -0800)]
[llvm-objdump] Print file format in lowercase to match GNU output.

Summary:
GNU objdump prints the file format in lowercase, e.g. `elf64-x86-64`. llvm-objdump prints `ELF64-x86-64` right now, even though piping that into llvm-objcopy refuses that as a valid arch to use.

As an example of a problem this causes, see: https://github.com/ClangBuiltLinux/linux/issues/779

Reviewers: MaskRay, jhenderson, alexshap

Reviewed By: MaskRay

Subscribers: tpimh, sbc100, grimar, jvesely, nhaehnle, kerbowa, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[X86] combineFneg - generalize FMA negations with isNegatibleForFree/getNegatedExpression
Simon Pilgrim [Wed, 12 Feb 2020 16:07:16 +0000 (16:07 +0000)]
[X86] combineFneg - generalize FMA negations with isNegatibleForFree/getNegatedExpression

This has a really interesting side effect in that it improves some UMAX/UMIN reduction code which had redundant XOR(SHUFFLE(XOR(X,SIGNMASK)),SIGNMASK) patterns - the getNegatibleCost recognises it as FNEG(SHUFFLE(FNEG(X))).... We have a lot of FNEG patterns bitcasted to the integer domain for XOR signbit twiddling which is similar to what we do to allow UMAX/UMIN to be lowered using SMAX/SMIN.

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

4 years agoAdd missing newlines at EOF; NFC
Sven van Haastregt [Wed, 12 Feb 2020 15:57:25 +0000 (15:57 +0000)]
Add missing newlines at EOF; NFC

4 years ago[clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.
Haojian Wu [Wed, 12 Feb 2020 08:47:31 +0000 (09:47 +0100)]
[clang-tidy] No misc-definitions-in-headers warning on C++14 variable templates.

Reviewers: gribozavr2

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

4 years agoTitle: [TSAN] Parameterize the hard-coded threshold of deflake in tsan test
Anh Tuyen Tran [Wed, 12 Feb 2020 15:51:57 +0000 (15:51 +0000)]
Title: [TSAN] Parameterize the hard-coded threshold of deflake in tsan test

Summary:
A number of testcases in TSAN are designed to deal with intermittent problems
not exist in all executions of the tested program. A script called deflake.bash
runs the executable up to 10 times to deal with the intermittent nature of the tests.

The purpose of this patch is to parameterize the hard-coded threshold above via
--cmake_variables=-DTSAN_TEST_DEFLAKE_THRESHOLD=SomeIntegerValue
When this cmake var is not set, the default value of 10 will be used.

Reviewer: dvyukov (Dmitry Vyukov), eugenis (Evgenii Stepanov), rnk (Reid Kleckner), hubert.reinterpretcast (Hubert Tong), vitalybuka (Vitaly Buka)

Reviewed By: vitalybuka (Vitaly Buka)

Subscribers: mgorny (Michal Gorny), jfb (JF Bastien), steven.zhang (qshanz), llvm-commits (Mailing List llvm-commits), Sanitizers

Tag: LLVM, Sanitizers

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

4 years ago[libc++][Apple] Use CLOCK_MONOTONIC_RAW instead of CLOCK_UPTIME_RAW for steady_clock
Louis Dionne [Mon, 10 Feb 2020 17:30:43 +0000 (18:30 +0100)]
[libc++][Apple] Use CLOCK_MONOTONIC_RAW instead of CLOCK_UPTIME_RAW for steady_clock

Summary:
In D27429, we switched the Apple implementation of steady_clock::now()
from clock_gettime(CLOCK_MONOTONIC) to clock_gettime(CLOCK_UPTIME_RAW).
The purpose was to get nanosecond precision, and also to improve the
performance of the implementation.

However, it appears that CLOCK_UPTIME_RAW does not satisfy the requirements
of the Standard, since it is not strictly speaking monotonic. Indeed, the
clock does not increment while the system is asleep, which had been
mentioned in D27429 but somehow not addressed.

This patch switches to CLOCK_MONOTONIC_RAW, which is monotonic, increased
during sleep, and also has nanosecond precision.

https://llvm.org/PR44773

Reviewers: bruno, howard.hinnant, EricWF

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF

Tags: #libc

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

4 years ago[AArch64][SVE] Add addsub carry long instrinsics
Danilo Carvalho Grael [Wed, 12 Feb 2020 15:36:15 +0000 (10:36 -0500)]
[AArch64][SVE] Add addsub carry long instrinsics

Summary:
Add intrinsics for the following instructions:
- adclb, adclt, sbclb, sbclt

Reviewers: kmclaughlin, c-rhodes, sdesmalen, efriedma, rengolin

Reviewed By: kmclaughlin

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years agoRevert "Revert "Change clang option -ffp-model=precise to select ffp-contract=on""
Melanie Blower [Tue, 11 Feb 2020 22:40:23 +0000 (14:40 -0800)]
Revert "Revert "Change clang option -ffp-model=precise to select ffp-contract=on""

This reverts commit 99c5bcbce89f07e68ccd89891a0300346705d013.
Change clang option -ffp-model=precise to select ffp-contract=on
Including some small touch-ups to the original commit

Reviewers: rjmccall, Andy Kaylor

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

4 years ago[PowerPC] Add options for PPC to enable/disable using non-volatile CR
Victor Huang [Wed, 12 Feb 2020 15:22:36 +0000 (09:22 -0600)]
[PowerPC] Add options for PPC to enable/disable using non-volatile CR

An option is added for PowerPC to disable use of non-volatile CR
register fields and avoid CR spilling in the prologue.

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

4 years ago[libc++] span: Guard against overflow in span::subspan
Louis Dionne [Wed, 12 Feb 2020 15:20:09 +0000 (16:20 +0100)]
[libc++] span: Guard against overflow in span::subspan

The calculation _Offset + _Count <= size() may overflow, so use
_Count <= size() - _Offset instead. Note that this is safe due to
the previous constraint that _Offset <= size().

Patch by Michael Schellenberger Costa.

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

4 years ago[PowerPC] Add support for intrinsic llvm.ppc.eieio
Anil Mahmud [Mon, 3 Feb 2020 18:34:44 +0000 (12:34 -0600)]
[PowerPC] Add support for intrinsic llvm.ppc.eieio

Add support for the intrinsic llvm.ppc.eieio to emit the instruction eieio.

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

4 years ago[PowerPC] Add support for intrinsics llvm.ppc.dcbfl and llvm.ppc.dcbflp
Anil Mahmud [Mon, 3 Feb 2020 17:03:54 +0000 (11:03 -0600)]
[PowerPC] Add support for intrinsics llvm.ppc.dcbfl and llvm.ppc.dcbflp

Added support for the intrinsic llvm.ppc.dcbfl and llvm.ppc.dcbflp.
These will be used for emitting cache control instructions dcbfl and dcbflp
which are actually mnemonics for using dcbf instruction with different
immediate arguments.

dcbfl ra, rb -> dcbf ra, rb, 1
dcbflp, ra, rb -> dcbf ra, rb, 3

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

4 years agoAMDGPU/GlobalISel: Split 96-bit load/store select tests out
Matt Arsenault [Wed, 12 Feb 2020 14:56:36 +0000 (09:56 -0500)]
AMDGPU/GlobalISel: Split 96-bit load/store select tests out

These are only legal on CI+. The test would fail in a debug build, but
not a release due to the partial selection since the pre-selection
legality assert only happens in a debug build.

4 years ago[MC][AVR] Fix AVR test following 740bc366
James Henderson [Wed, 12 Feb 2020 14:56:09 +0000 (14:56 +0000)]
[MC][AVR] Fix AVR test following 740bc366

4 years ago[DebugInfo] Add checks for v2 directory and file name table terminators
James Henderson [Wed, 12 Feb 2020 14:37:10 +0000 (14:37 +0000)]
[DebugInfo] Add checks for v2 directory and file name table terminators

The DWARFv2-4 specification for the line table header states that the
include directories and file name tables both end with a single null
byte. Prior to this change, the parser did not detect if this byte was
missing, because it also stopped reading the tables once it reached the
prologue end, as claimed by the header_length field. This change adds a
check that the terminator has been seen at the end of each table.

Reviewed by: dblaikie, MaskRay

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

4 years ago[DebugInfo] Add check for zero debug line opcode_base
James Henderson [Tue, 11 Feb 2020 12:17:33 +0000 (12:17 +0000)]
[DebugInfo] Add check for zero debug line opcode_base

The number of standard opcodes is defined to be opcode_base - 1, so a
value of 0 for the opcode_base caused a crash as an attempt was made to
reserve many entries in a vector. This change fixes the crash, by
issuing a warning and skipping reading of standard opcode lengths in the
event of an opcode_base of 0.

Reviewed by: dblaikie

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

4 years ago[DebugInfo] Print version in error message in decimal
James Henderson [Tue, 11 Feb 2020 14:11:01 +0000 (14:11 +0000)]
[DebugInfo] Print version in error message in decimal

Also remove some test duplication and add a test case that shows the
maximum version is rejected (this also shows that the value in the error
message is actually in decimal, and not just missing an 0x prefix).

Reviewed by: dblaikie

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

4 years agoRe-reapply: Recover debug intrinsics when killing duplicated/empty blocks
stozer [Wed, 12 Feb 2020 13:41:18 +0000 (13:41 +0000)]
Re-reapply: Recover debug intrinsics when killing duplicated/empty blocks

This reverts commit 636c93ed11a5f98b5c3ff88241460d61cb7785bb.

The original patch caused build failures on TSan buildbots. Commit 6ded69f294a9
fixes this issue by reducing the rate at which empty debug intrinsics
propagate, reducing the memory footprint and preventing a fatal spike.

4 years agoAMDGPU/GlobalISel: Widen non-power-of-2 load results
Matt Arsenault [Tue, 21 Jan 2020 18:23:45 +0000 (13:23 -0500)]
AMDGPU/GlobalISel: Widen non-power-of-2 load results

Load extra bits if suitably aligned. This allows using widened
3-vector loads on SI, and fixes legalization for <9 x s32> (which LSV
apparently forms frequently on lowered kernel argument lists).

Fix incorrectly treating these as legal on SI. This should emit a
64-bit store and a 32-bit store.

I think all of the load and store rules are just about complete, but
due for a rewrite.

4 years ago[Concepts] Add missing TPA commit to requires expression parsing
Saar Raz [Wed, 12 Feb 2020 14:23:55 +0000 (16:23 +0200)]
[Concepts] Add missing TPA commit to requires expression parsing

If an error had occurred when annotating a scope spec during the tentative parse
for a type-requirement, we would not revert nor commit the tentative parse, triggerring
an assertion failure.

Commit the TPA in this case and then do error recovery.

4 years agoRecommit "[DSE] Add first version of MemorySSA-backed DSE (Bottom up walk)."
Florian Hahn [Tue, 11 Feb 2020 18:27:41 +0000 (18:27 +0000)]
Recommit "[DSE] Add first version of MemorySSA-backed DSE (Bottom up walk)."

This includes a fix for the santizier failures.

This reverts the revert commit
42f8b915eb72364cc5e84adf58a2c2d4947e8b10.

4 years ago[mlir] Linalg fusion: ignore indexed_generic producers
Alex Zinenko [Wed, 12 Feb 2020 14:08:38 +0000 (15:08 +0100)]
[mlir] Linalg fusion: ignore indexed_generic producers

They are currently not supported and we should not attempt fusing them.

4 years ago[mlir] StdToLLVM: Add error when the sourceMemRef of a subview is not a llvm type.
Pierre Oechsel [Wed, 12 Feb 2020 09:26:01 +0000 (10:26 +0100)]
[mlir] StdToLLVM: Add error when the sourceMemRef of a subview is not a llvm type.

A memref_cast casting to a memref with a non identity map can't be
lowered to llvm. Take the following case:

```

func @invalid_memref_cast(%arg0: memref<?x?xf64>) {
  %c1 = constant 1 : index
  %c0 = constant 0 : index
  %5 = memref_cast %arg0 : memref<?x?xf64> to memref<?x?xf64, #map1>
  %25 = std.subview %5[%c0, %c0][%c1, %c1][] : memref<?x?xf64, #map1> to memref<?x?xf64, #map1>
  return
}
```

When lowering the subview mlir was assuming `%5` to have an llvm type
(which is not the case as mlir failed to lower the memref_cast).

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

4 years agoFix unused function warning (PR44808)
Hans Wennborg [Wed, 12 Feb 2020 14:12:31 +0000 (15:12 +0100)]
Fix unused function warning (PR44808)

4 years ago[MLIR][CUDA] Fix build file for mlir-cuda-runner
Stephan Herhut [Wed, 12 Feb 2020 13:35:32 +0000 (14:35 +0100)]
[MLIR][CUDA] Fix build file for mlir-cuda-runner

Summary:
This was broken recently when moving from dialect registration via
static initializers to explicit intialization.

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

4 years ago[Concepts] Do not check constraints if not all template arguments have been deduced
Saar Raz [Wed, 12 Feb 2020 13:58:51 +0000 (15:58 +0200)]
[Concepts] Do not check constraints if not all template arguments have been deduced

We previously checked the constraints of instantiated function templates even in cases where
PartialOverloading was true and not all template arguments have been deduced, which caused crashes
in clangd (bug 44714).

We now check if all arguments have been deduced before checking constraints in partial overloading
scenarios.

4 years ago[AggressiveInstCombine] Add test with baseline CHECKs for aggressive inst combine...
Ayman Musa [Wed, 12 Feb 2020 13:00:25 +0000 (15:00 +0200)]
[AggressiveInstCombine] Add test with baseline CHECKs for aggressive inst combine for ICmp instruction.

4 years ago[libcxx] Don't assume cwd name in std::filesystem tests
Sergej Jaskiewicz [Wed, 12 Feb 2020 13:07:30 +0000 (16:07 +0300)]
[libcxx] Don't assume cwd name in std::filesystem tests

Summary:
In `std::filesystem::proximate` tests we assume that the current working directory's name
is `fs.op.proximate`. This is fine when we're running the tests locally.

However, if we're running those tests on a remote machine via SSH, the directory layout may be
different. For example, currently we copy each test executable individually into
a temporary directory on the target board using SCP, so the assumption about the working directory name
doesn't necessarily hold.

This patch is the only thing that is necessary for all libc++ tests to pass when run remotely.

Reviewers: ldionne, EricWF, mclow.lists

Reviewed By: ldionne, EricWF

Subscribers: christof, dexonsmith, libcxx-commits

Tags: #libc

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

4 years agoRevert "[AggressiveInstCombine] Add support for ICmp instr that feeds a select intsr...
Ayman Musa [Wed, 12 Feb 2020 13:04:49 +0000 (15:04 +0200)]
Revert "[AggressiveInstCombine] Add support for ICmp instr that feeds a select intsr's condition operand."

This reverts commit cf155150f992270c88e586ffc61973d2552b72e8.

4 years ago[AggressiveInstCombine] Add support for ICmp instr that feeds a select intsr's condit...
Ayman Musa [Wed, 12 Feb 2020 12:33:31 +0000 (14:33 +0200)]
[AggressiveInstCombine] Add support for ICmp instr that feeds a select intsr's condition operand.

4 years ago[mlir][spirv] Introduce spv.func
Lei Zhang [Fri, 7 Feb 2020 16:30:19 +0000 (11:30 -0500)]
[mlir][spirv] Introduce spv.func

Thus far we have been using builtin func op to model SPIR-V functions.
It was because builtin func op used to have special treatment in
various parts of the core codebase (e.g., pass pipelines, etc.) and
it's easy to bootstrap the development of the SPIR-V dialect. But
nowadays with general op concepts and region support we don't have
such limitations and it's time to tighten the SPIR-V dialect for
completeness.

This commits introduces a spv.func op to properly model SPIR-V
functions. Compared to builtin func op, it can provide the following
benefits:

* We can control the full op so we can integrate SPIR-V information
  bits (e.g., function control) in a more integrated way and define
  our own assembly form and enforcing better verification.
* We can have a better dialect and library boundary. At the current
  moment only functions are modelled with an external op. With this
  change, all ops modelling SPIR-V concpets will be spv.* ops and
  registered to the SPIR-V dialect.
* We don't need to special-case func op anymore when creating
  ConversionTarget declaring SPIR-V dialect as legal. This is quite
  important given we'll see more and more conversions in the future.

In the process, bumps a few FuncOp methods to the FunctionLike trait.

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

4 years agoReapply "[DebugInfo] Prevent explosion of debug intrinsics during jump threading"
stozer [Wed, 12 Feb 2020 11:48:20 +0000 (11:48 +0000)]
Reapply "[DebugInfo] Prevent explosion of debug intrinsics during jump threading"

This reverts commit 6ded69f294a9a62a68b0a07aa987c8165a4b31e7.

4 years agoFix MLIR build when the NVPTX target isn't configured
Mehdi Amini [Wed, 12 Feb 2020 10:06:50 +0000 (10:06 +0000)]
Fix MLIR build when the NVPTX target isn't configured

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

4 years ago[unittests] Fix TargetLibraryInfoTest.ValidProto
Ehud Katz [Wed, 12 Feb 2020 12:13:14 +0000 (14:13 +0200)]
[unittests] Fix TargetLibraryInfoTest.ValidProto