platform/upstream/llvm.git
4 years agoFix MLIR test case failure caused by 89e0662dee5fa541f284e6be0af9e36e7f39f947
Uday Bondhugula [Tue, 14 Apr 2020 04:24:19 +0000 (09:54 +0530)]
Fix MLIR test case failure caused by 89e0662dee5fa541f284e6be0af9e36e7f39f947

Fix MLIR test case failure introduced by
89e0662dee5fa541f284e6be0af9e36e7f39f947. LLVM's IR builder
now automatically sets the alignment on alloca.

4 years ago[MLIR] Remove dead affine.applys while generating pointwise copies
Uday Bondhugula [Mon, 13 Apr 2020 19:48:37 +0000 (01:18 +0530)]
[MLIR] Remove dead affine.applys while generating pointwise copies

This makes no impact on the test cases because affine-data-copy-generate
runs whole function canonicalization at its end; however, the latter
will be removed in a pending revision. It is thus useful to clean up
these affine.applys right here, and eventually, not even generate
these (when the right API to compose by construction is in place).

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

4 years ago[X86] Use a more realisitic cost for truncate v16i64->v16i8 with avx512f.
Craig Topper [Tue, 14 Apr 2020 03:43:43 +0000 (20:43 -0700)]
[X86] Use a more realisitic cost for truncate v16i64->v16i8 with avx512f.

Still not great and we could probably codegen this better, but
11 was clearly ridiculous.

4 years ago[X86] Split AVX512 getCastInstrCost into tables that require useAVX512Regs() and...
Craig Topper [Tue, 14 Apr 2020 02:29:33 +0000 (19:29 -0700)]
[X86] Split AVX512 getCastInstrCost into tables that require useAVX512Regs() and those that just operate on 256 or smaller vectors.

Use useAVX512Regs() to skip lookups instead of using type legalization
action.

4 years ago[X86] Add a more accurate truncate cost for v8i64->v8i8
Craig Topper [Tue, 14 Apr 2020 01:59:09 +0000 (18:59 -0700)]
[X86] Add a more accurate truncate cost for v8i64->v8i8

4 years ago[X86] Add truncate cost model tests to min-legal-vector-width.ll for when we're avoid...
Craig Topper [Tue, 14 Apr 2020 01:37:23 +0000 (18:37 -0700)]
[X86] Add truncate cost model tests to min-legal-vector-width.ll for when we're avoiding 512 bit vectors.

4 years ago[lit] Update local test objects "in place" from remote test objects
Julian Lettner [Tue, 14 Apr 2020 03:44:15 +0000 (20:44 -0700)]
[lit] Update local test objects "in place" from remote test objects

Update local test object "in place" from remote test object.  We need to
do this to ensure that discovered test object which is used for printing
test results reflect the changes.

> Why are we sending back the whole test object from the worker process
> (lit.worker.execute) instead of just the result?

Unfortunately, the test result is not the only "result" of test
execution.  Other members (e.g., xfails, requires) of the Test class are
set only during execution.  Those members affect the behavior of
`isExpectedToFail` and `setResult`, and are accessed when printing
results.  For example, xunit.xml test results include missing features
for "skip reasons".  The lack of separation between an immutable "test
definition" and "generated outputs" (including the primary result and
other secondary state) is unfortunate historical design decision in lit.

> Why do we update the initial test object instead of just discarding it
> and continuing with the pickled test object?

Both of these approaches would work.  However, note that we need a fully
populated test object for printing results.  Updating the existing one
seems to be the easier path.

4 years ago[VE] Adapt D77995 CallSite removal
Fangrui Song [Tue, 14 Apr 2020 02:54:39 +0000 (19:54 -0700)]
[VE] Adapt D77995 CallSite removal

4 years agoGlobalISel: Fix casted unmerge of G_CONCAT_VECTORS
Matt Arsenault [Sat, 11 Apr 2020 17:57:15 +0000 (13:57 -0400)]
GlobalISel: Fix casted unmerge of G_CONCAT_VECTORS

This was assuming a scalarizing unmerge, and would fail assert if the
unmerge was to smaller vector types.

4 years agoAdd duplex to R_HEX_GOT_16_X
Brian Cain [Fri, 10 Apr 2020 21:19:30 +0000 (16:19 -0500)]
Add duplex to R_HEX_GOT_16_X

Building 'espresso' from llvm-test-suite revealed missing support
for duplex instructions with R_HEX_GOT_16_X.

4 years ago[gn build] Port 384ca190ae7
LLVM GN Syncbot [Tue, 14 Apr 2020 00:27:34 +0000 (00:27 +0000)]
[gn build] Port 384ca190ae7

4 years agoRevert "Move ModuleSummaryAnalysis from libAnalysis to libObject to break the depende...
Mehdi Amini [Tue, 14 Apr 2020 00:27:08 +0000 (00:27 +0000)]
Revert "Move ModuleSummaryAnalysis from libAnalysis to libObject to break the dependency from Analysis to Object"

This reverts commit 10df1563d608323a3144afc5f6038ecb81869b92.

Some buildbots are broken.

4 years ago[gn build] (manually) merge 10df1563d some more
Nico Weber [Tue, 14 Apr 2020 00:15:01 +0000 (20:15 -0400)]
[gn build] (manually) merge 10df1563d some more

4 years ago[SVE] Change return type of getNumElements to unsigned
Christopher Tetreault [Mon, 13 Apr 2020 23:00:10 +0000 (16:00 -0700)]
[SVE] Change return type of getNumElements to unsigned

Reviewers: efriedma, sdesmalen, craig.topper, dexonsmith

Reviewed By: efriedma, sdesmalen

Subscribers: tschuett, hiraditya, rkruppe, psnobl, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, grosul1, frgossen, llvm-commits

Tags: #llvm

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

4 years ago[gn build] Port 10df1563d60
LLVM GN Syncbot [Mon, 13 Apr 2020 23:18:41 +0000 (23:18 +0000)]
[gn build] Port 10df1563d60

4 years agoAMDGPU/GlobalISel: Combines for V_CVT_F32_UBYTE[0-3]
Matt Arsenault [Sun, 29 Mar 2020 16:34:35 +0000 (12:34 -0400)]
AMDGPU/GlobalISel: Combines for V_CVT_F32_UBYTE[0-3]

Ports the existing DAG combines, minus the simplify demanded bits
which seems to have no equivalent now. Without these, this isn't
particularly helpful in most of the IR sample cases.

4 years agoMove ModuleSummaryAnalysis from libAnalysis to libObject to break the dependency...
Mehdi Amini [Mon, 13 Apr 2020 04:21:40 +0000 (04:21 +0000)]
Move ModuleSummaryAnalysis from libAnalysis to libObject to break the dependency from Analysis to Object

ModuleSummaryAnalysis is the only file in libAnalysis that brings a
dependency on the CodeGen layer from libAnalysis, moving it breaks this
dependency.

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

4 years ago[AMDGPU][GlobalISel] Fix div_scale in FDIV lowering
Austin Kerbow [Mon, 13 Apr 2020 06:25:18 +0000 (23:25 -0700)]
[AMDGPU][GlobalISel] Fix div_scale in FDIV lowering

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

4 years ago[CUDA] Fix missed CUDA version mappings.
Artem Belevich [Mon, 13 Apr 2020 21:55:26 +0000 (14:55 -0700)]
[CUDA] Fix missed CUDA version mappings.

4 years ago[WebAssembly] Fix try placement in fixing unwind mismatches
Heejin Ahn [Fri, 10 Apr 2020 23:46:39 +0000 (16:46 -0700)]
[WebAssembly] Fix try placement in fixing unwind mismatches

Summary:
In CFGStackify, `fixUnwindMismatches` function fixes unwind destination
mismatches created by `try` marker placement. For example,
```
try
  ...
  call @qux  ;; This should throw to the caller!
catch
  ...
end
```
When `call @qux` is supposed to throw to the caller, it is possible that
it is wrapped inside a `catch` so in case it throws it ends up unwinding
there incorrectly. (Also it is possible `call @qux` is supposed to
unwind to another `catch` within the same function.)

To fix this, we wrap this inner `call @qux` with a nested
`try`-`catch`-`end` sequence, and within the nested `catch` body, branch
to the right destination:
```
block $l0
  try
    ...
    try                 ;; new nested try
      call @qux
    catch               ;; new nested catch
      local.set n       ;; store exnref to a local
      br $l0
    end
  catch
    ...
  end
end
local.get n             ;; retrieve exnref back
rethrow                 ;; rethrow to the caller
```

The previous algorithm placed the nested `try` right before the `call`.
But it is possible that there are stackified instructions before the
call from which the call takes arguments.
```
try
  ...
  i32.const 5
  call @qux  ;; This should throw to the caller!
catch
  ...
end
```

In this case we have to place `try` before those stackified
instructions.
```
block $l0
  try
    ...
    try                 ;; this should go *before* 'i32.const 5'
      i32.const 5
      call @qux
    catch
      local.set n
      br $l0
    end
  catch
    ...
  end
end
local.get n
rethrow
```

We correctly handle this in the first normal `try` placement phase
(`placeTryMarker` function), but failed to handle this in this
`fixUnwindMismatches`.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

4 years agoFix a typo in the error message for an incorrect prototype.
Jean-Luc Brouillet [Mon, 13 Apr 2020 22:40:56 +0000 (15:40 -0700)]
Fix a typo in the error message for an incorrect prototype.

Summary: Cut & paste error had the error message mentionning "}" rather than ")".

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

4 years ago[AVR] Support aliases in non-zero address space
Ayke van Laethem [Sat, 14 Mar 2020 17:52:01 +0000 (18:52 +0100)]
[AVR] Support aliases in non-zero address space

This fixes code like the following on AVR:

void foo(void) {
}
void bar(void) __attribute__((alias("foo")));

Code like this is present in compiler-rt, which I'm trying to build.

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

4 years ago[libunwind] Enable the new libc++ testing format by default
Louis Dionne [Wed, 8 Apr 2020 14:42:56 +0000 (10:42 -0400)]
[libunwind] Enable the new libc++ testing format by default

The new format should be equivalent to the old format, and it is now the
default format when running the libc++ and libc++abi tests. This commit
changes the libunwind tests to use the new format by default too. If
unexpected failures are discovered, it should be fine to revert this
commit until they are addressed.

Also note that it is still possible to use the old format by passing
`--param=use_old_format=True` when running Lit for the time being.

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

4 years agoRemove '<' from test for better yam2obj input consumption
jasonliu [Mon, 13 Apr 2020 21:39:10 +0000 (21:39 +0000)]
Remove '<' from test for better yam2obj input consumption

Address post-commit comment:
https://reviews.llvm.org/D77580#inline-713676

yaml2obj does not record the source filename in the output,
 which may make FileCheck tests brittle sometimes.

4 years ago[libc++] Mark test failing with macos < 10.13 as unsupported
Louis Dionne [Mon, 13 Apr 2020 21:38:40 +0000 (17:38 -0400)]
[libc++] Mark test failing with macos < 10.13 as unsupported

4 years ago[mlir][NFC] Replace mlir/Support/Functional.h with llvm equivalents.
River Riddle [Mon, 13 Apr 2020 21:07:38 +0000 (14:07 -0700)]
[mlir][NFC] Replace mlir/Support/Functional.h with llvm equivalents.

Summary: Functional.h contains many different methods that have a direct, and more efficient, equivalent in LLVM. This revision replaces all usages with the LLVM equivalent, and removes the header. This is part of larger cleanup, pr45513, merging MLIR support facilities into LLVM.

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

4 years ago[libc++] NFC: Remove unused Lit features in the test suite
Louis Dionne [Mon, 13 Apr 2020 20:52:34 +0000 (16:52 -0400)]
[libc++] NFC: Remove unused Lit features in the test suite

The libc++ test suite currently defines several features that are not
used anywhere in the tests, or that are redundant with other features.
For the purpose of simplifying config.py and to ease the bring up of a
new configuration, this commit removes some of these features:

- rename dylib-has-no-filesystem to c++filesystem-disabled, which exists
- rename apple-darwin to just darwin, which is already set
- remove useless setting of libstdc++, which is already set correctly
- remove libcpp-abi-unstable, which is not used anywhere
- remove the glibc-XXX features, which are not used anywhere

4 years ago[CHR] Clean up some code and reduce copying. NFCI.
Benjamin Kramer [Mon, 13 Apr 2020 21:03:03 +0000 (23:03 +0200)]
[CHR] Clean up some code and reduce copying. NFCI.

4 years agoRevert a few unsuccessful attempts at fixing bots.
Nico Weber [Mon, 13 Apr 2020 20:53:06 +0000 (16:53 -0400)]
Revert a few unsuccessful attempts at fixing bots.

I broke bots last week and tried a few things to fix them.
These were attempts that didn't help, so back them back out.

This reverts commit c7aff9a109b611e4954a3055061a8076b4baa385.
This reverts commit 8838d6d3566d940859fd26b20aed4cb57d490988.
This reverts commit e875ba1509955dc4b3512d820edecc0da26fa38d.

4 years agoUse a temporary file, to allow running on read-only file systems
Sterling Augustine [Mon, 13 Apr 2020 20:09:22 +0000 (13:09 -0700)]
Use a temporary file, to allow running on read-only file systems

4 years ago[libc++] NFC: Remove unused method call
Louis Dionne [Mon, 13 Apr 2020 20:50:11 +0000 (16:50 -0400)]
[libc++] NFC: Remove unused method call

4 years ago[CallSite removal][TargetLowering] Replace ImmutableCallSite with CallBase
Craig Topper [Mon, 13 Apr 2020 17:44:59 +0000 (10:44 -0700)]
[CallSite removal][TargetLowering] Replace ImmutableCallSite with CallBase

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

4 years agoMake IRBuilder automatically set alignment on load/store/alloca.
Eli Friedman [Sun, 12 Apr 2020 23:58:30 +0000 (16:58 -0700)]
Make IRBuilder automatically set alignment on load/store/alloca.

This is equivalent in terms of LLVM IR semantics, but we want to
transition away from using MaybeAlign to represent the alignment of
these instructions.

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

4 years ago[Darwin] Fix a bug where the symbolizer would examine the wrong process.
Dan Liew [Tue, 7 Apr 2020 01:57:54 +0000 (18:57 -0700)]
[Darwin] Fix a bug where the symbolizer would examine the wrong process.

Summary:
Previously `AtosSymbolizer` would set the PID to examine in the
constructor which is called early on during sanitizer init. This can
lead to incorrect behaviour in the case of a fork() because if the
symbolizer is launched in the child it will be told examine the parent
process rather than the child.

To fix this the PID is determined just before the symbolizer is
launched.

A test case is included that triggers the buggy behaviour that existed
prior to this patch. The test observes the PID that `atos` was called
on. It also examines the symbolized stacktrace. Prior to this patch
`atos` failed to symbolize the stacktrace giving output that looked
like...

```
  #0 0x100fc3bb5 in __sanitizer_print_stack_trace asan_stack.cpp:86
  #1 0x10490dd36 in PrintStack+0x56 (/path/to/print-stack-trace-in-code-loaded-after-fork.cpp.tmp_shared_lib.dylib:x86_64+0xd36)
  #2 0x100f6f986 in main+0x4a6 (/path/to/print-stack-trace-in-code-loaded-after-fork.cpp.tmp_loader:x86_64+0x100001986)
  #3 0x7fff714f1cc8 in start+0x0 (/usr/lib/system/libdyld.dylib:x86_64+0x1acc8)
```

After this patch stackframes `#1` and `#2` are fully symbolized.

This patch is also a pre-requisite refactor for rdar://problem/58789439.

Reviewers: kubamracek, yln

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years ago[Sanitizer Common] Show command used to launch symbolizer process at high verbosity...
Dan Liew [Tue, 7 Apr 2020 00:25:47 +0000 (17:25 -0700)]
[Sanitizer Common] Show command used to launch symbolizer process at high verbosity level.

Summary:
In preparation for writing a test for a bug fix we need to be able to
see the command used to launch the symbolizer process. This feature
will likely be useful for debugging how the Sanitizers use the
symbolizer in general.

This patch causes the command line used to launch the process to be
shown at verbosity level 3 and higher.

A small test case is included.

Reviewers: kubamracek, yln, vitalybuka, eugenis, kcc

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years ago[gn build] Port e823068306e
LLVM GN Syncbot [Mon, 13 Apr 2020 20:31:14 +0000 (20:31 +0000)]
[gn build] Port e823068306e

4 years ago[gn build] Port 255cc202ea6
LLVM GN Syncbot [Mon, 13 Apr 2020 20:31:14 +0000 (20:31 +0000)]
[gn build] Port 255cc202ea6

4 years ago[Support] Add missing files from e823068306e.
Lang Hames [Mon, 13 Apr 2020 20:29:59 +0000 (13:29 -0700)]
[Support] Add missing files from e823068306e.

4 years ago[LLD] [COFF] Fix alignment of thunks for ARM/ARM64
Martin Storsjö [Wed, 8 Apr 2020 21:42:50 +0000 (00:42 +0300)]
[LLD] [COFF] Fix alignment of thunks for ARM/ARM64

The alignment of ARM64 range extension thunks was fixed in
7c816492197a, but ARM range extension thunks, and import
and delay import thunks also need aligning (like all code on ARM
platforms).

I'm adding a test for alignment of ARM64 import thunks - not
specifically adding tests for misalignment of all of them though.

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

4 years ago[mlir][Linalg] NFC: Add utility function to tile, fuse and set marker to use loop...
MaheshRavishankar [Sun, 12 Apr 2020 06:02:09 +0000 (23:02 -0700)]
[mlir][Linalg] NFC: Add utility function to tile, fuse and set marker to use loop.parallel.

This change is NFC since the facility to tile and generate
loop.parallel loops already exists in Linalg.

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

4 years ago[mlir][Linalg] NFC : Fix check for scalar case handling in LinalgToLoops
MaheshRavishankar [Sun, 12 Apr 2020 06:01:40 +0000 (23:01 -0700)]
[mlir][Linalg] NFC : Fix check for scalar case handling in LinalgToLoops

The invertPermutation method does not return a nullptr anymore, but
rather returns an empty map for the scalar case. Update the check in
LinalgToLoops to reflect this.
Also add test case for generating scalar code.

4 years ago[mlir][Linalg] Add loop.parallel lowering for all Linalg Ops.
MaheshRavishankar [Mon, 13 Apr 2020 16:33:34 +0000 (09:33 -0700)]
[mlir][Linalg] Add loop.parallel lowering for all Linalg Ops.

The outer parallel loops of a linalg operation is lowered to
loop.parallel, with the other loops lowered to loop.for. This gets the
lowering to loop.parallel on par with the loop.for lowering. In future
the reduction loop could also be lowered to loop.parallel.
Also add a utility function that returns the loops that are
created.

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

4 years ago[Support] Fix CMakeLists after e823068306e98e9
Sam McCall [Mon, 13 Apr 2020 20:14:27 +0000 (22:14 +0200)]
[Support] Fix CMakeLists after e823068306e98e9

4 years agoFix target_info.test on Windows with a hack
Reid Kleckner [Mon, 13 Apr 2020 20:12:42 +0000 (13:12 -0700)]
Fix target_info.test on Windows with a hack

Add a quote character to the sed command to cause it to be quoted.
Hopefully, which will help both gnuwin and MSys versions of sed tokenize
the command line the same way.

4 years ago[clangd] Rebuild dependent files when a header is saved.
Sam McCall [Fri, 10 Apr 2020 01:27:37 +0000 (03:27 +0200)]
[clangd] Rebuild dependent files when a header is saved.

Summary:
Caveats:
 - only works when the header is changed in the editor and the editor provides
   the notification
 - we revalidate preambles for all open files (stat all their headers) rather
   than taking advantage of the fact that we know which file changed.
   This is much simpler!

Fixes https://github.com/clangd/clangd/issues/107

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Mon, 13 Apr 2020 19:30:53 +0000 (12:30 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: sdesmalen, efriedma, krememek

Reviewed By: sdesmalen, efriedma

Subscribers: dexonsmith, Charusso, cfe-commits

Tags: #clang

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

4 years ago[ORC] Update ORCv2 docs to reflect removal of ExecutionSession::getMainJITDylib.
Lang Hames [Mon, 13 Apr 2020 19:51:46 +0000 (12:51 -0700)]
[ORC] Update ORCv2 docs to reflect removal of ExecutionSession::getMainJITDylib.

Thanks to Dibyendu Majumdar for spotting the issue.

4 years ago[Support] Add support RTTI support for open class hierarchies.
Lang Hames [Sat, 11 Apr 2020 00:23:20 +0000 (17:23 -0700)]
[Support] Add support RTTI support for open class hierarchies.

This patch extracts the RTTI part of llvm::ErrorInfo into its own class
(RTTIExtends) so that it can be used in other non-error hierarchies, and makes
it compatible with the existing LLVM RTTI function templates (isa, cast,
dyn_cast, dyn_cast_or_null) by adding the classof method.

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

4 years ago[mlir][spirv] Add a `spirv::InterfaceVarABIAttr`.
Denis Khalikov [Mon, 13 Apr 2020 18:11:08 +0000 (21:11 +0300)]
[mlir][spirv] Add a `spirv::InterfaceVarABIAttr`.

Summary:
Add a proper dialect-specific attribute for interface variable ABI.

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

4 years ago[mlir][spirv] NFC: use Optional to replace SPV_Optional
Lei Zhang [Mon, 13 Apr 2020 19:33:35 +0000 (15:33 -0400)]
[mlir][spirv] NFC: use Optional to replace SPV_Optional

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

4 years agoRemove the Identifier::is() method, it is now equivalent to operator==. NFC.
Chris Lattner [Mon, 13 Apr 2020 18:51:59 +0000 (11:51 -0700)]
Remove the Identifier::is() method, it is now equivalent to operator==.  NFC.

Summary: Depends on D78042.

Reviewers: rriddle!

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

Tags: #llvm

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Mon, 13 Apr 2020 17:51:25 +0000 (10:51 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: rriddle, sdesmalen, efriedma

Reviewed By: efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoExtend BasicBlock sections to allow specifying clusters of basic blocks in the same...
Rahman Lavaee [Mon, 13 Apr 2020 19:14:42 +0000 (12:14 -0700)]
Extend BasicBlock sections to allow specifying clusters of basic blocks in the same section.

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

4 years agoRevert "Extend BasicBlock sections to allow specifying clusters of basic blocks"
Rahman Lavaee [Mon, 13 Apr 2020 19:12:34 +0000 (12:12 -0700)]
Revert "Extend BasicBlock sections to allow specifying clusters of basic blocks"

This reverts commit 0d4ec16d3db3a92514e14101f635e8536c208c4f Because
tests were not added to the commit.

4 years ago[MachinePipeliner] Refine the RecMII calculation
Lama [Mon, 13 Apr 2020 18:51:03 +0000 (18:51 +0000)]
[MachinePipeliner] Refine the RecMII calculation

In the case of more than one SDep  between two successor SUnits in the Nodeset, the current implementation sums the latencies of the dependencies, which could create a larger RecMII than necessary.

for example, in case there is both a data dependency and an output dependency (with latency > 0) between successor nodes:
SU(1) inst1:
  successors:
    SU(2): out  latency = 1
    SU(2): data latency = 1
SU(2) inst2:
  successors:
    SU(3): out  latency = 1
    SU(3): data latency = 1
SU(3) inst3:
  successors:
    SU(1): out  latency = 1
    SU(1): data latency = 1

the NodeSet latency returned would be 6, whereas it could be 3 if we take the max for each successor SUnit.
In general this can be extended to finding the shortest path in the recurrence..
thoughts?

Unfortunately I had a hard time creating a test for this in Hexagon/PowerPC, so help would be appreciated.

Reviewed By: bcahoon

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

4 years ago[AMDGPU] Fix comment for llvm.amdgcn.div.scale. NFC.
Austin Kerbow [Mon, 13 Apr 2020 18:58:15 +0000 (11:58 -0700)]
[AMDGPU] Fix comment for llvm.amdgcn.div.scale. NFC.

Update comment to reflect actual lowering.

4 years agoEliminate all uses of Identifier::is() in the source tree, this doesn't remove the...
Chris Lattner [Mon, 13 Apr 2020 18:17:35 +0000 (11:17 -0700)]
Eliminate all uses of Identifier::is() in the source tree, this doesn't remove the definition of it (yet).  NFC.

Reviewers: mravishankar, antiagainst, herhut, rriddle!

Subscribers: jholewinski, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, bader, grosul1, frgossen, llvm-commits

Tags: #llvm

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

4 years agoHIP: Fix handling of denormal mode
Matt Arsenault [Mon, 13 Apr 2020 14:14:07 +0000 (10:14 -0400)]
HIP: Fix handling of denormal mode

I didn't realize HIP was a distinct offloading kind, so the subtarget
was looking for -march, which isn't correct for HIP. We also have the
possibility of different denormal defaults in the case of multiple
offload targets, so we need to thread the JobAction through the target
hook.

4 years agoExtend BasicBlock sections to allow specifying clusters of basic blocks
Rahman Lavaee [Mon, 13 Apr 2020 18:39:23 +0000 (11:39 -0700)]
Extend BasicBlock sections to allow specifying clusters of basic blocks
in the same section.

This allows specifying BasicBlock clusters like the following example:
!foo
!!0 1 2
!!4
This places basic blocks 0, 1, and 2 in one section in this order, and
places basic block #4 in a single section of its own.

4 years ago[InstCombine] Use SmallBitVector for convienently checking if all bits are set
Benjamin Kramer [Mon, 13 Apr 2020 18:36:31 +0000 (20:36 +0200)]
[InstCombine] Use SmallBitVector for convienently checking if all bits are set

4 years ago[MLIR] NFC cleanup/modernize memref-dataflow-opt / getNestingDepth
Uday Bondhugula [Mon, 13 Apr 2020 04:48:10 +0000 (10:18 +0530)]
[MLIR] NFC cleanup/modernize memref-dataflow-opt / getNestingDepth

Bring code to date with recent changes to the core infrastructure /
coding style.

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

4 years ago[MLIR] NFC clean up simplify-affine-structures test case
Uday Bondhugula [Mon, 13 Apr 2020 14:00:35 +0000 (19:30 +0530)]
[MLIR] NFC clean up simplify-affine-structures test case

NFC clean up for simplify-affine-structures test cases. Rename sets
better; avoid suffix numbers;  move outlined definitions close to use.
This is in preparation for other functionality updates.

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

4 years ago[mlir][Transforms][docs] Add a description blurb for various passes
River Riddle [Mon, 13 Apr 2020 18:26:55 +0000 (11:26 -0700)]
[mlir][Transforms][docs] Add a description blurb for various passes

Summary: This revision adds blurbs of documentation to various different passes, namely: Canonicalizer, CSE, LocationSnapshot, StripDebugInfo, and SymbolDCE.

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

4 years agoAdd missing dependencies on the flang test target
Mehdi Amini [Mon, 13 Apr 2020 17:03:12 +0000 (17:03 +0000)]
Add missing dependencies on the flang test target

Without this, the LLVM utilities (FileCheck) aren't built when running
`ninja check-flang` and it fails with:

llvm-project/llvm/utils/lit/lit/llvm/subst.py:134: fatal: Did not find FileCheck in...

Also the modules aren't built without depending on `module_files`, which
makes multiple tests failing.

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

4 years ago[mlir][spirv] Improve stride support in array types
Lei Zhang [Mon, 13 Apr 2020 16:47:58 +0000 (12:47 -0400)]
[mlir][spirv] Improve stride support in array types

This commit added stride support in runtime array types. It also
adjusted the assembly form for the stride from `[N]` to `stride=N`.
This makes the IR more readable, especially for the cases where
one mix array types and struct types.

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

4 years ago[SanCov] Disable whitelist/blacklist test on Darwin.
Matt Morehouse [Mon, 13 Apr 2020 17:58:26 +0000 (10:58 -0700)]
[SanCov] Disable whitelist/blacklist test on Darwin.

4 years ago[gn build] (manually) merge 6dbf1a1229ba
Nico Weber [Mon, 13 Apr 2020 17:57:00 +0000 (13:57 -0400)]
[gn build] (manually) merge 6dbf1a1229ba

4 years ago[InstCombine] Fix debug variance issue in tryToMoveFreeBeforeNullTest
Vedant Kumar [Fri, 10 Apr 2020 23:47:09 +0000 (16:47 -0700)]
[InstCombine] Fix debug variance issue in tryToMoveFreeBeforeNullTest

Fix an issue where the presence of debug info could disable an
optimization in tryToMoveFreeBeforeNullTest.

4 years ago[Debugify] Strip added metadata in the -debugify-each pipeline
Vedant Kumar [Fri, 10 Apr 2020 21:58:13 +0000 (14:58 -0700)]
[Debugify] Strip added metadata in the -debugify-each pipeline

Summary:
Share logic to strip debugify metadata between the IR and MIR level
debugify passes. This makes it simpler to hunt for bugs by diffing IR
with vs. without -debugify-each turned on.

As a drive-by, fix an issue causing CallGraphNodes to become invalid
when a dead llvm.dbg.value prototype is deleted.

Reviewers: dsanders, aprantl

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[llvm-xray][test] Combine two AArch64 tests
Fangrui Song [Fri, 10 Apr 2020 16:41:41 +0000 (09:41 -0700)]
[llvm-xray][test] Combine two AArch64 tests

Rename extract-instrmap-aarch64.test to extract-instrmap.test because
the path component `AArch64` conveys the target name clearly.

Additionally, adopt a convention we start to use in LLVM binary
utilities: prepend `#` to CHECK/RUN lines and `##` to comment lines even
if the file contains no code. The notation makes CHECK/RUN/comments
stand out.

Reviewed By: dberris

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

4 years agoReimplement mlir::Identifier to be a wrapper around 'StringMapEntry*' instead of...
Chris Lattner [Mon, 13 Apr 2020 05:15:26 +0000 (22:15 -0700)]
Reimplement mlir::Identifier to be a wrapper around 'StringMapEntry*' instead of a wrapper around a 'const char*'.  This makes it so strref() can be computed without calling strlen, which is more efficient and less error-prone.  While here...

Summary:
..., reimplement DenseMapInfo<mlir::Identifier>::getHashValue in terms of mlir::hash_value(Identifier).

Both of these improvements were suggested by River, thanks!

Reviewers: rriddle!

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

Tags: #llvm

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

4 years ago[clangd] Send the correct error code when cancelling requests.
Sam McCall [Sat, 11 Apr 2020 16:19:50 +0000 (18:19 +0200)]
[clangd] Send the correct error code when cancelling requests.

Summary:
I couldn't quite bring myself to make Cancellation depend on LSP ErrorCode.
Magic numbers instead...

Reviewers: kadircet

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

Tags: #clang

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

4 years ago[CostModel][X86] Remove comments that begin with a filecheck prefix.
Simon Pilgrim [Mon, 13 Apr 2020 17:39:07 +0000 (18:39 +0100)]
[CostModel][X86] Remove comments that begin with a filecheck prefix.

Stop filecheck from confusing a general comment with a check.

4 years ago[mlir][spirv] Add missing interface storage classes in serializer
Lei Zhang [Mon, 13 Apr 2020 17:14:07 +0000 (13:14 -0400)]
[mlir][spirv] Add missing interface storage classes in serializer

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

4 years ago[ADT] Reduce the requirements for the simple loop in DenseMap::clear
Benjamin Kramer [Mon, 13 Apr 2020 17:28:20 +0000 (19:28 +0200)]
[ADT] Reduce the requirements for the simple loop in DenseMap::clear

We can use it when just the value doesn't require destruction. Empty
keys are safe to overwrite always. This gets the important case of
std::pair values.

4 years ago[OpenMP] Refined CUDA plugin to put all CUDA operations into class
Shilei Tian [Mon, 13 Apr 2020 17:32:21 +0000 (13:32 -0400)]
[OpenMP] Refined CUDA plugin to put all CUDA operations into class

Summary: Current implementation mixed everything up so that there is almost no encapsulation. In this patch, all CUDA related operations are put into a new class DeviceRTLTy and only necessary functions are exposed. In addition, all C++ code now conforms with LLVM code standard, keeping those API functions following C style.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: jfb, yaxunl, guansong, openmp-commits

Tags: #openmp

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

4 years ago[CallSite removal][GlobalISel] Use CallBase instead of CallSite in lowerCall and...
Craig Topper [Mon, 13 Apr 2020 17:17:29 +0000 (10:17 -0700)]
[CallSite removal][GlobalISel] Use CallBase instead of CallSite in lowerCall and translateCallBase.

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

4 years agoDAG: Fix wrong legality check for ISD::FMAD
Matt Arsenault [Sun, 12 Apr 2020 13:47:03 +0000 (09:47 -0400)]
DAG: Fix wrong legality check for ISD::FMAD

Since 1725f2884175ca618d29b06e35f5c6ebd618053d, this should check
isFMADLegalForFAddFSub rather than the the plain isOperationLegal.

This would assert in a subset of cases due to an oddity in how FMAD is
selected. We will allow FMA formation pre-legalize, but not FMAD even
in cases where it would be valid.

The current hook requires passing in the root fadd/fsub. However, in
this distributed case, this would be far more complicated to pass in
the relevant operand. AMDGPU doesn't get any value from the node, and
only needs the type and is the only implementor, so I'm not sure why
we have this complexity. Just rename and expand the assert to avoid
the more complicated checks spread through the distribution logic.

4 years ago[X86] Move X86ShuffleDecode.cpp/h into MCTargetDesc and remove X86Utils library. NFC
Craig Topper [Mon, 13 Apr 2020 16:33:05 +0000 (09:33 -0700)]
[X86] Move X86ShuffleDecode.cpp/h into MCTargetDesc and remove X86Utils library. NFC

The shuffle decoding is used by X86ISelLowering and
MCTargetDesc/X86InstComments. The latter used to be in a
separate InstPrinter library. The Utils library existed to allow
InstPrinter and CodeGen to share the shuffle decoding. Since
X86InstComments now lives in the MCTargetDesc, which CodeGen
already depends on, we can sink the shuffle decoding there as well.

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

4 years ago[llvm] Fix yet more missing FileCheck colons
Jon Roelofs [Mon, 13 Apr 2020 16:21:01 +0000 (10:21 -0600)]
[llvm] Fix yet more missing FileCheck colons

4 years ago[llvm] Fix another missing FileCheck colon
Jon Roelofs [Mon, 13 Apr 2020 16:19:57 +0000 (10:19 -0600)]
[llvm] Fix another missing FileCheck colon

4 years ago[llvm] Fix more missing FileCheck directive colons
Jonathan Roelofs [Thu, 2 Apr 2020 22:28:32 +0000 (16:28 -0600)]
[llvm] Fix more missing FileCheck directive colons

4 years ago[lit] Print substitutions with --show-suites
Louis Dionne [Thu, 9 Apr 2020 18:34:58 +0000 (14:34 -0400)]
[lit] Print substitutions with --show-suites

We already print available features, and it can be useful to print
substitutions as well since those are a pretty fundamental part of
a test suite. We could also consider printing other things like the
test environment, however the need doesn't appear to be as strong.

As a fly-by fix, we also always print available features, even when
there are none.

Before:

  $ lit -sv libcxx/test --show-suites
  -- Test Suites --
    libc++ - 6350 tests
      Source Root: [...]
      Exec Root  : [...]
      Available Features : -faligned-allocation -fsized-deallocation [...]

After:

  $ lit -sv libcxx/test --show-suites
  -- Test Suites --
    libc++ - 6350 tests
      Source Root: [...]
      Exec Root  : [...]
      Available Features: -faligned-allocation -fsized-deallocation [...]
      Available Substitutions: %{build_module} => [...]
                               %{build} => %{cxx} -o [...]

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

4 years agoFix an indent.
Nico Weber [Mon, 13 Apr 2020 15:53:23 +0000 (11:53 -0400)]
Fix an indent.

4 years ago[llvm-objdump] Fix incomplete relocation output for -D -r mode
jasonliu [Mon, 13 Apr 2020 15:49:36 +0000 (15:49 +0000)]
[llvm-objdump] Fix incomplete relocation output for -D -r mode

This patch intends to fix incomplete relocation printing for
XCOFF (potentially for other targets).

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

4 years ago[X86] Improve combineVectorShiftImm
Jay Foad [Thu, 2 Apr 2020 11:20:35 +0000 (12:20 +0100)]
[X86] Improve combineVectorShiftImm

Summary:
Fold (shift (shift X, C2), C1) -> (shift X, (C1 + C2)) for logical as
well as arithmetic shifts. This is needed to prevent regressions from
an upcoming funnel shift expansion change.

While we're here, fold (VSRAI -1, C) -> -1 too.

Reviewers: RKSimon, craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[clang-format] use spaces for alignment with UT_ForContinuationAndIndentation
mydeveloperday [Mon, 13 Apr 2020 14:14:26 +0000 (15:14 +0100)]
[clang-format] use spaces for alignment with UT_ForContinuationAndIndentation

Summary:
Use spaces instead of tabs for alignment with UT_ForContinuationAndIndentation to make the code aligned for any tab/indent width.

Fixes https://bugs.llvm.org/show_bug.cgi?id=38381

Reviewed By: MyDeveloperDay

Patch By: fickert

Tags: #clang-format

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

4 years ago[clang-format] A Minor change to clang-format-diff.py
mydeveloperday [Mon, 13 Apr 2020 14:08:07 +0000 (15:08 +0100)]
[clang-format] A Minor change to clang-format-diff.py

Summary: Testing for None should use the 'is' operator.

Reviewed By: MyDeveloperDay

Patch By:  eagleoflqj

Tags: #clang-format

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

4 years ago[clang-format] Always break line after enum opening brace
mydeveloperday [Mon, 13 Apr 2020 14:03:36 +0000 (15:03 +0100)]
[clang-format] Always break line after enum opening brace

Summary:
clang-format currently puts the first enumerator on the same line as the
enum keyword and opening brace if it fits (for example, for anonymous
enums if IndentWidth is 8):

  $ echo "enum { RED, GREEN, BLUE };" | clang-format -style="{BasedOnStyle: llvm, ColumnLimit: 15, IndentWidth: 8}"
  enum { RED,
         GREEN,
         BLUE };

This doesn't seem to be intentional, as I can't find any style guide that
suggests wrapping enums this way. Always force the enumerator to be on a new
line, which gets us the desired result:

  $ echo "enum { RED, GREEN, BLUE };" | ./bin/clang-format -style="{BasedOnStyle: llvm, ColumnLimit: 15, IndentWidth: 8}"
  enum {
          RED,
          GREEN,
          BLUE
  };

Test Plan:

New test added. Confirmed test failed without change and passed with change by
running:

  $ ninja FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewed By: MyDeveloperDay

Patch By: osandov

Tags: #clang-format, #clang

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

4 years ago[X86][AVX] Attempt to scale masked shuffles to match the root type
Simon Pilgrim [Mon, 13 Apr 2020 13:57:25 +0000 (14:57 +0100)]
[X86][AVX] Attempt to scale masked shuffles to match the root type

Improve the chances of folding the writemask into the combined shuffle by scaling a wider shuffle mask to match the root's original type.

This creates a few minor issues with variable shuffles, preventing combines of shuffles because of the more limited support binary shuffle types. In most cases we're probably better off combining the shuffles and losing the writemask fold, but this isn't always going to be true.

4 years ago[X86][AVX] Add some masked variable shuffle tests
Simon Pilgrim [Mon, 13 Apr 2020 13:29:57 +0000 (14:29 +0100)]
[X86][AVX] Add some masked variable shuffle tests

Now that's D77928 landed we need to try harder to match shuffle and mask widths. This is a couple of tests showing where variable shuffle masks have been widened preventing them from folding with the mask.

4 years agoAddress sphinx warnings
Benjamin Kramer [Mon, 13 Apr 2020 12:39:25 +0000 (14:39 +0200)]
Address sphinx warnings

LanguageExtensions.rst:2191: WARNING: Title underline too short.
llvm-symbolizer.rst:157: Error in "code-block" directive: maximum 1 argument(s) allowed, 30 supplied.

4 years agoCodeMetrics.h - include and forward declaration cleanup. NFC.
Simon Pilgrim [Mon, 13 Apr 2020 12:09:08 +0000 (13:09 +0100)]
CodeMetrics.h - include and forward declaration cleanup. NFC.

Remove SmallPtrSet include, replace with forward declaration and include SmallPtrSet.h in CodeMetrics.cpp directly.
Remove unused llvm::DataLayout/Instruction forward declarations.

4 years agoIVDescriptors.h - include and forward declaration cleanup. NFC.
Simon Pilgrim [Mon, 13 Apr 2020 11:01:14 +0000 (12:01 +0100)]
IVDescriptors.h - include and forward declaration cleanup. NFC.

Replace unused AliasAnalysis.h and EHPersonalities.h includes
Remove unused llvm::AliasSet/AliasSetTracker/BasicBlock/DataLayout/LoopInfo/OptimizationRemarkEmitter/PredIteratorCache/TargetLibraryInfo/TargetTransformInfo forward declarations.

4 years ago[X86][AVX] Create splitVectorIntBinary helper.
Simon Pilgrim [Sun, 12 Apr 2020 15:15:26 +0000 (16:15 +0100)]
[X86][AVX] Create splitVectorIntBinary helper.

Removes duplicate code from split256IntArith/split512IntArith.

4 years agoTypos correction.
SCOTT-HAMILTON [Mon, 13 Apr 2020 06:39:58 +0000 (08:39 +0200)]
Typos correction.

4 years agoNormalize working directory when running llvm-mc in test
serge-sans-paille [Mon, 13 Apr 2020 11:44:15 +0000 (13:44 +0200)]
Normalize working directory when running llvm-mc in test

Otherwise, depending on the lit location used to run the test, llvm-mc adds an
include_directories entry in the dwarf output, which breaks tests in some setup.

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

4 years agofix some doc typos to cycle bots
Nico Weber [Mon, 13 Apr 2020 10:28:33 +0000 (06:28 -0400)]
fix some doc typos to cycle bots

4 years ago[clangd] Update TUStatus test to handle async PreambleThread
Kadir Cetinkaya [Tue, 7 Apr 2020 18:53:56 +0000 (20:53 +0200)]
[clangd] Update TUStatus test to handle async PreambleThread

Summary:
Currently it doesn't matter because we run PreambleThread in sync mode.
Once we start running it in async, test order will become non-deterministic.

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[LV] Clean up vectorizeInterleaveGroup (NFCI)
Gil Rapaport [Mon, 13 Apr 2020 05:53:42 +0000 (08:53 +0300)]
[LV] Clean up vectorizeInterleaveGroup (NFCI)

Pass from the calling recipe the interleave group itself instead of passing the
group's insertion position and having the function query CM for its interleave
group and making sure that given instruction is the insertion point of.

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