platform/upstream/llvm.git
4 years ago[SCCP] Remove dead switch cases based on range information
Nikita Popov [Sun, 19 Jul 2020 19:28:14 +0000 (21:28 +0200)]
[SCCP] Remove dead switch cases based on range information

Determine whether switch edges are feasible based on range information,
and remove non-feasible edges lateron.

This does not try to determine whether the default edge is dead,
as we'd have to determine that the range is fully covered by the
cases for that.

Another limitation here is that we don't remove dead cases that
have the same successor as a live case. I'm not handling this
because I wanted to keep the edge removal based on feasible edges
only, rather than inspecting ranges again there -- this does not
seem like a particularly useful case to handle.

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

4 years ago[lldb/Test] Use self.assertIn in TestGdbRemoteTargetXmlPacket
Jonas Devlieghere [Thu, 30 Jul 2020 18:47:55 +0000 (11:47 -0700)]
[lldb/Test] Use self.assertIn in TestGdbRemoteTargetXmlPacket

On the ARM buildbot the returned architecture is `armv8l` while
getArchitecture() just returns `arm`.

4 years ago[LAA] Avoid adding pointers to the checks if they are not needed.
Florian Hahn [Thu, 30 Jul 2020 18:12:28 +0000 (19:12 +0100)]
[LAA] Avoid adding pointers to the checks if they are not needed.

Currently we skip alias sets with only reads or a single write and no
reads, but still add the pointers to the list of pointers in RtCheck.

This can lead to cases where we try to access a pointer that does not
exist when grouping checks.  In most cases, the way we access
PositionMap masked that, as the value would default to index 0.

But in the example in PR46854 it causes a crash.

This patch updates the logic to avoid adding pointers for alias sets
that do not need any checks. It makes things slightly more verbose, by
first checking the numbers of reads/writes and bailing out early if we don't
need checks for the alias set.

I think this makes the logic a bit simpler to follow.

Reviewed By: anemet

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

4 years ago[mlir] NFC: Expose `getElementPtrType` and `getSizes` methods of AllocOpLowering.
Alexander Belyaev [Thu, 30 Jul 2020 18:16:51 +0000 (20:16 +0200)]
[mlir] NFC: Expose `getElementPtrType` and `getSizes` methods of AllocOpLowering.

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

4 years ago[InstCombine] update test checks; NFC
Sanjay Patel [Thu, 30 Jul 2020 18:16:18 +0000 (14:16 -0400)]
[InstCombine] update test checks; NFC

4 years agoFix computeHostNumPhysicalCores() for Linux on POWER and Linux on Z
Ettore Tiotto [Thu, 30 Jul 2020 15:36:09 +0000 (15:36 +0000)]
Fix computeHostNumPhysicalCores() for Linux on POWER and Linux on Z

ThinLTO is run using a single thread on Linux on Power. The
compute_thread_count() routine calls getHostNumPhysicalCores which
returns -1 by default, and so `MaxThreadCount is set to 1.

unsigned llvm::ThreadPoolStrategy::compute_thread_count() const {
    int MaxThreadCount = UseHyperThreads
          ? computeHostNumHardwareThreads()
          : sys::getHostNumPhysicalCores();
     if (MaxThreadCount <= 0)
        MaxThreadCount = 1;
   …
}
Fix: provide custom implementation of getHostNumPhysicalCores for
Linux on Power and Linux on Z.

Reviewed By: Kai, uweigand

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

4 years ago[WebAssembly] Fixed 64-bit indices in br_table
Wouter van Oortmerssen [Mon, 27 Jul 2020 21:59:31 +0000 (14:59 -0700)]
[WebAssembly] Fixed 64-bit indices in br_table

LLVM selection dag assumes "switch" indices are pointer sized, which causes problems for our 32-bit br_table. The new function ensures 32-bit operands don't get unnecessarily extended, and 64-bit operands get truncated.

Note that the changes to the existing test test exactly that: the addition of -NEXT in 2 places ensures no extension is inserted (which the test previously ignored) and that the wrap is present (previously omitted in wasm64 mode).

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

4 years ago[AMDGPU] Do not use undef on indirect source
Stanislav Mekhanoshin [Thu, 30 Jul 2020 00:17:45 +0000 (17:17 -0700)]
[AMDGPU] Do not use undef on indirect source

We are using undef on the indirect move source subreg and then
using implicit super-reg. This creates a problem in RA when
Greedy decides to split the register. It reassigns the implicit
super-reg but does not bother to change undef source because
it is really does not matter. The fix is to stop lying to RA and
drop undef flag.

This has also hit a problem in SIFoldOperands as it can fold
immediate into an indirect move since there is no undef flag
anymore. That results in multiple test failures, so added the
check for this case.

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

4 years ago[lldb] Add copy ctor/assignment operator to SBCommandInterpreterRunOptions
Jonas Devlieghere [Thu, 30 Jul 2020 17:34:32 +0000 (10:34 -0700)]
[lldb] Add copy ctor/assignment operator to SBCommandInterpreterRunOptions

4 years ago[lldb][test] Move registers-target-xml-reading target to the correct test location.
Jordan Rupprecht [Thu, 30 Jul 2020 17:25:28 +0000 (10:25 -0700)]
[lldb][test] Move registers-target-xml-reading target to the correct test location.

This test was added in D74217 (and the `.categories` file later added in ccf1c30cde6e1e763e7c9cdd48a609a805166699) around the same time I moved the test tree from `lldb/packages/Python/lldbsuite/test` to `lldb/test/API` (D71151). Since this got lost in the move, it isn't running. (I introduced an intentional syntax error, and `ninja check-lldb` passes).

I moved it to the correct location, and now it runs and passes -- locally, at least -- as `ninja check-lldb-api-tools-lldb-server-registers-target-xml-reading`.

4 years agoLoopUnroll.cpp - pass std::vector by const reference to needToInsertPhisForLCSSA...
Simon Pilgrim [Thu, 30 Jul 2020 16:37:57 +0000 (17:37 +0100)]
LoopUnroll.cpp - pass std::vector by const reference to needToInsertPhisForLCSSA helper. NFCI.

Avoid an unnecessary pass by value.

4 years ago[NewPM][PassInstrument] Add PrintPass callback to StandardInstrumentations
Yuanfang Chen [Wed, 29 Jul 2020 00:08:24 +0000 (17:08 -0700)]
[NewPM][PassInstrument] Add PrintPass callback to StandardInstrumentations

Problem:
Right now, our "Running pass" is not accurate when passes are wrapped in adaptor because adaptor is never skipped and a pass could be skipped. The other problem is that "Running pass" for a adaptor is before any "Running pass" of passes/analyses it depends on. (for example, FunctionToLoopPassAdaptor). So the order of printing is not the actual order.

Solution:
Doing things like PassManager::Debuglogging is very intrusive because we need to specify Debuglogging whenever adaptor is created. (Actually, right now we're not specifying Debuglogging for some sub-PassManagers. Check PassBuilder)

This patch move debug logging for pass as a PassInstrument callback. We could be sure that all running passes are logged and in the correct order.

This could also be used to implement hierarchy pass logging in legacy PM. We could also move logging of pass manager to this if we want.

The test fixes looks messy. It includes changes:
- Remove PassInstrumentationAnalysis
- Remove PassAdaptor
- If a PassAdaptor is for a real pass, the pass is added
- Pass reorder (to the correct order), related to PassAdaptor
- Add missing passes (due to Debuglogging not passed down)

Reviewed By: asbirlea, aeubanks

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

4 years ago[WebAssembly] Fix GCC 5 build.
Craig Topper [Thu, 30 Jul 2020 16:54:02 +0000 (09:54 -0700)]
[WebAssembly] Fix GCC 5 build.

Hans' speculative fix in b7292f2db02d37c9291afc0613a3fbce0a4ad4e8
didn't work for me. This seems to.

4 years ago[MLIR][OpenMP] Fix OpenMPIRBuilder usage after D82470
Johannes Doerfert [Thu, 30 Jul 2020 16:53:06 +0000 (11:53 -0500)]
[MLIR][OpenMP] Fix OpenMPIRBuilder usage after D82470

4 years ago[lldb][NFC][test] Fix comment referring to FileCheck instead of yaml2obj
Jordan Rupprecht [Wed, 29 Jul 2020 23:58:29 +0000 (16:58 -0700)]
[lldb][NFC][test] Fix comment referring to FileCheck instead of yaml2obj

4 years ago[libc] Implements isdigit and isalnum. Adds a utility header to inline
cgyurgyik [Thu, 30 Jul 2020 16:36:28 +0000 (12:36 -0400)]
[libc] Implements isdigit and isalnum. Adds a utility header to inline
functions to avoid overhead of function calls.

Reviewed By: sivachandra

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

4 years ago[tsan] Fixup for 1260a155: Move variadic-open.cpp test into Darwin/ directory
Kuba Mracek [Thu, 30 Jul 2020 16:32:11 +0000 (09:32 -0700)]
[tsan] Fixup for 1260a155: Move variadic-open.cpp test into Darwin/ directory

4 years ago[PGO] Include the mem ops into the function hash.
Hiroshi Yamauchi [Wed, 29 Jul 2020 22:22:13 +0000 (15:22 -0700)]
[PGO] Include the mem ops into the function hash.

To avoid hash collisions when the only difference is in mem ops.

4 years ago[OpenMP][Docs] Mark `present` motion modifier as done
Joel E. Denny [Thu, 30 Jul 2020 16:20:46 +0000 (12:20 -0400)]
[OpenMP][Docs] Mark `present` motion modifier as done

4 years ago[AMDGPU/MemOpsCluster] Clean-up fixme's around mem ops clustering logic
hsmahesha [Thu, 30 Jul 2020 16:09:34 +0000 (21:39 +0530)]
[AMDGPU/MemOpsCluster] Clean-up fixme's around mem ops clustering logic

Get rid of all fixmes and base heuristic on `num-clustered-dwords`. The main intuition behind this is as
follows. The existing heuristic roughly summarizes as below:

* Assume, all the mem ops instructions participating in the clustering process,  loads/stores same num bytes
* If num bytes loaded by each mem op is 4 bytes, then cluster at max 5 mem ops, that is at max 20 bytes
* If num bytes loaded by each mem op is 8 bytes, then cluster at max 3 mem ops, that is at max 24 bytes
* If num bytes loaded by each mem op is 16 bytes, then cluster at max 2 mem ops, that is at max 32 bytes

So, we need to make sure that the new heuristic do not completey deviate away from the above one, and it
properly handles both the sub-word loads and the wide loads.

Reviewed By: arsenm, rampitec

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

4 years ago[tsan] Fix the open and open64 interceptors to have correct declarations (variadic...
Kuba Mracek [Thu, 30 Jul 2020 16:00:14 +0000 (09:00 -0700)]
[tsan] Fix the open and open64 interceptors to have correct declarations (variadic functions)

Not matching the (real) variadic declaration makes the interceptor take garbage inputs on Darwin/AArch64.

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

4 years ago[libc++] Use generator expression in Linker script generation
Louis Dionne [Fri, 11 Oct 2019 18:42:26 +0000 (14:42 -0400)]
[libc++] Use generator expression in Linker script generation

This is an alternative to the workaround in 34a3b24a90c6.

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

4 years ago[clang-tidy] Fix ODR violation in unittests.
Artem Dergachev [Thu, 30 Jul 2020 01:05:42 +0000 (18:05 -0700)]
[clang-tidy] Fix ODR violation in unittests.

Both tests define clang::tidy::test::TestCheck::registerMatchers().
This is UB and causes linker to sometimes choose the wrong overload.

Put classes into anonymous namespaces to avoid the problem.

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

4 years ago[lldb] Add SBCommandInterpreterRunOptions to LLDB.h
Jonas Devlieghere [Thu, 30 Jul 2020 15:46:02 +0000 (08:46 -0700)]
[lldb] Add SBCommandInterpreterRunOptions to LLDB.h

4 years agoAlign store conditional address
Brendon Cahoon [Thu, 30 Jul 2020 14:50:59 +0000 (09:50 -0500)]
Align store conditional address

In cases where the alignment of the datatype is smaller than
expected by the instruction, the address is aligned. The aligned
address is used for the load, but wasn't used for the store
conditional, which resulted in a run-time alignment exception.

4 years ago[X86] Parse and ignore .arch directives
Fangrui Song [Thu, 30 Jul 2020 15:30:06 +0000 (08:30 -0700)]
[X86] Parse and ignore .arch directives

We parse .arch so that some `.arch i386; .code32` code can assemble. It seems
that X86AsmParser does not do a good job tracking what features are needed to
assemble instructions. GNU as's x86 port supports a very wide range of .arch
operands. Ignore the operand for now.

Reviewed By: craig.topper

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

4 years ago[OpenMP][FIX] Consistently use OpenMPIRBuilder if requested
Johannes Doerfert [Mon, 29 Jun 2020 18:14:46 +0000 (13:14 -0500)]
[OpenMP][FIX] Consistently use OpenMPIRBuilder if requested

When we use the OpenMPIRBuilder for the parallel region we need to also
use it to get the thread ID (among other things) in the body. This is
because CGOpenMPRuntime::getThreadID() and
CGOpenMPRuntime::emitUpdateLocation implicitly assumes that if they are
called from within a parallel region there is a certain structure to the
code and certain members of the OMPRegionInfo are initialized. It might
make sense to initialize them even if we use the OpenMPIRBuilder but we
would preferably get rid of such state instead.

Bug reported by Anchu Rajendran Sudhakumari.

Depends on D82470.

Reviewed By: anchu-rajendran

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

4 years ago[OpenMP][IRBuilder] Support allocas in nested parallel regions
Johannes Doerfert [Fri, 19 Jun 2020 14:38:04 +0000 (09:38 -0500)]
[OpenMP][IRBuilder] Support allocas in nested parallel regions

We need to keep track of the alloca insertion point (which we already
communicate via the callback to the user) as we place allocas as well.

Reviewed By: fghanim, SouraVX

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

4 years ago[OPENMP]Fix PR46824: Global declare target pointer cannot be accessed in target region.
Alexey Bataev [Thu, 30 Jul 2020 15:00:21 +0000 (11:00 -0400)]
[OPENMP]Fix PR46824: Global declare target pointer cannot be accessed in target region.

Need to map the base pointer for all directives, not only target
data-based ones.
The base pointer is mapped for array sections, array subscript, array
shaping and other array-like constructs with the base pointer. Also,
codegen for use_device_ptr clause was modified to correctly handle
mapping combination of array like constructs + use_device_ptr clause.
The data for use_device_ptr clause is emitted as the last records in the
data mapping array.

Reviewed By: ye-luo

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

4 years ago[clangd] NFC: Spell out types in index callback arguments
Kirill Bobyrev [Thu, 30 Jul 2020 15:12:29 +0000 (17:12 +0200)]
[clangd] NFC: Spell out types in index callback arguments

4 years agoRevert "[OPENMP]Fix PR46824: Global declare target pointer cannot be accessed in...
Alexey Bataev [Thu, 30 Jul 2020 14:57:21 +0000 (10:57 -0400)]
Revert "[OPENMP]Fix PR46824: Global declare target pointer cannot be accessed in target region."

This reverts commit 142d0d3ed8e07aca2476bc4ecc1a12d15577a84a to
investigate undefined behavior revealed by buildbots.

4 years ago[AIX] Temporarily disable IncrementalProcessingTest partially
Xiangling Liao [Wed, 29 Jul 2020 18:05:20 +0000 (14:05 -0400)]
[AIX] Temporarily disable IncrementalProcessingTest partially

Temporarily disable IncrementalProcessingTest partially until the static
initialization implementation on AIX is recovered.

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

4 years ago[AArch64] Fix operand definitions of XPACI/XPACD
Momchil Velikov [Thu, 30 Jul 2020 13:43:15 +0000 (14:43 +0100)]
[AArch64] Fix operand definitions of XPACI/XPACD

The operand to these instructions is both input and output.

These are not yet emitted by the compiler and the assembler already
works fine, so can't test in this patch.  But D75044 will use XPACI
and provide test coverage for this patch as well.

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

4 years agoAMDGPU: Convert some tests to use new buffer intrinsics
Matt Arsenault [Thu, 30 Jul 2020 13:23:19 +0000 (09:23 -0400)]
AMDGPU: Convert some tests to use new buffer intrinsics

The legacy not struct or raw buffer intrinsics should now all be
consolidated into the tests specifically for those intrinsics.

4 years agoAttributor.h - remove unnecessary includes. NFCI.
Simon Pilgrim [Thu, 30 Jul 2020 13:25:08 +0000 (14:25 +0100)]
Attributor.h - remove unnecessary includes. NFCI.

Fix implicit cpp include dependencies.

4 years ago[PowerPC][AIX] Move the testcase to proper dir
Jinsong Ji [Thu, 30 Jul 2020 02:46:39 +0000 (02:46 +0000)]
[PowerPC][AIX] Move the testcase to proper dir

4 years agoSpeculative GCC 5 build fix
Hans Wennborg [Thu, 30 Jul 2020 14:11:15 +0000 (16:11 +0200)]
Speculative GCC 5 build fix

It's complaining about specializing the template in a different namespace.

4 years ago[flang] Create HostAssoc symbols for uplevel references
Tim Keith [Thu, 30 Jul 2020 14:12:24 +0000 (07:12 -0700)]
[flang] Create HostAssoc symbols for uplevel references

To make it easier for lowering to identify which symbols from the host
are captured by internal subprograms, create HostAssocDetails for them.

In particular, if a symbol is referenced and it is contained in a
subprogram or main program that is not the same as the containing
program unit of the reference, a HostAssocDetails symbol is created
in the current scope.

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

4 years ago[OPENMP]Fix PR46824: Global declare target pointer cannot be accessed in target region.
Alexey Bataev [Fri, 24 Jul 2020 21:46:19 +0000 (17:46 -0400)]
[OPENMP]Fix PR46824: Global declare target pointer cannot be accessed in target region.

Need to map the base pointer for all directives, not only target
data-based ones.
The base pointer is mapped for array sections, array subscript, array
shaping and other array-like constructs with the base pointer. Also,
codegen for use_device_ptr clause was modified to correctly handle
mapping combination of array like constructs + use_device_ptr clause.
The data for use_device_ptr clause is emitted as the last records in the
data mapping array.
It applies only for global pointers.

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

4 years ago[XCOFF][AIX] Enable -ffunction-sections
jasonliu [Wed, 29 Jul 2020 15:06:04 +0000 (15:06 +0000)]
[XCOFF][AIX] Enable -ffunction-sections

Summary:
This patch implements -ffunction-sections on AIX.
This patch focuses on assembly generation.
Follow-on patch needs to handle:
1. -ffunction-sections implication for jump table.
2. Object file generation path and associated testing.

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

4 years ago[ConstantFolding] add tests for abs intrinsic; NFC
Sanjay Patel [Thu, 30 Jul 2020 12:37:02 +0000 (08:37 -0400)]
[ConstantFolding] add tests for abs intrinsic; NFC

4 years ago[LoopVectorizer] Don't create unused block masks for reductions. NFC
David Green [Thu, 30 Jul 2020 13:28:08 +0000 (14:28 +0100)]
[LoopVectorizer] Don't create unused block masks for reductions. NFC

This removes some unneeded block masks when we don't have any
reductions. It should not have any effect on codegen as the values
created are dead anyway.

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

4 years ago[libc++] Add XFAIL for <float.h> and <cfloat> tests on older Clangs
Louis Dionne [Thu, 30 Jul 2020 13:26:34 +0000 (09:26 -0400)]
[libc++] Add XFAIL for <float.h> and <cfloat> tests on older Clangs

4 years ago[mlir][shape] Use memref of index in shape lowering
Stephan Herhut [Thu, 30 Jul 2020 12:38:12 +0000 (14:38 +0200)]
[mlir][shape] Use memref of index in shape lowering

Now that we can have a memref of index type, we no longer need to materialize shapes in i64 and then index_cast.

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

4 years ago[MLIR] Don't pass separate LowerToLLVMOptions when we already pass a LLVMTypeConverte...
Christian Sigg [Thu, 30 Jul 2020 08:09:29 +0000 (10:09 +0200)]
[MLIR] Don't pass separate LowerToLLVMOptions when we already pass a LLVMTypeConverter which contains those options already.

This also prevents passing inconsistent options.

Reviewed By: ftynse

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

4 years ago[MLIR] Introduce inter-procedural memref layout normalization
Abhishek Varma [Thu, 30 Jul 2020 12:36:59 +0000 (18:06 +0530)]
[MLIR] Introduce inter-procedural memref layout normalization

-- Introduces a pass that normalizes the affine layout maps to the identity layout map both within and across functions by rewriting function arguments and call operands where necessary.
-- Memref normalization is now implemented entirely in the module pass '-normalize-memrefs' and the limited intra-procedural version has been removed from '-simplify-affine-structures'.
-- Run using -normalize-memrefs.
-- Return ops are not handled and would be handled in the subsequent revisions.

Signed-off-by: Abhishek Varma <abhishek.varma@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D84490

4 years ago[mlir] Allow index as element type of memref
Stephan Herhut [Thu, 30 Jul 2020 12:02:46 +0000 (14:02 +0200)]
[mlir] Allow index as element type of memref

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

4 years ago[flang] Expose specific to generic intrinsic name mapping
Jean Perier [Thu, 30 Jul 2020 12:29:24 +0000 (14:29 +0200)]
[flang] Expose specific to generic intrinsic name mapping

The intrinsic lowering facility is based on the generic intrinsic names to avoid
duplicating implementations. Specific intrinsics call are re-written to call to
the generic versions by the front-end but this cannot be done when specific intrinsics
are passed as arguments (the rewrite would give illegal/ambiguous unparsed Fortran).
Solve the issue by making the specific to generic name mapping accessible to lowering
and can be later used to generate the unrestricted intrinsic functions.

Reviewed By: schweitz

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

4 years agoRevert "[IPConstProp] Remove and move tests to SCCP."
Florian Hahn [Thu, 30 Jul 2020 12:06:15 +0000 (13:06 +0100)]
Revert "[IPConstProp] Remove and move tests to SCCP."

This reverts commit e77624a3be942c7abba48942b3a8da3462070a3f.

Looks like some clang tests manually invoke -ipconstprop via opt.....

4 years ago[MLIR][Shape] Limit `shape.rank` lowering to its extent tensor variant
Frederik Gossen [Thu, 30 Jul 2020 11:40:16 +0000 (11:40 +0000)]
[MLIR][Shape] Limit `shape.rank` lowering to its extent tensor variant

When lowering to the standard dialect, we currently support only the extent
tensor variant of the shape.rank operation. This change lets the conversion
pattern fail in a well-defined manner.

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

4 years ago[IPConstProp] Remove and move tests to SCCP.
Florian Hahn [Thu, 30 Jul 2020 09:15:47 +0000 (10:15 +0100)]
[IPConstProp] Remove and move tests to SCCP.

As far as I know, ipconstprop has not been used in years and ipsccp has
been used instead. This has the potential for confusion and sometimes
leads people to spend time finding & reporting bugs as well as
updating it to work with the latest API changes.

This patch moves the tests over to SCCP. There's one functional difference
I am aware of: ipconstprop propagates for each call-site individually, so
for functions that are called with different constant arguments it can sometimes
produce better results than ipsccp (at much higher compile-time cost).But
IPSCCP can be thought to do so as well for internal functions and as mentioned
earlier, the pass seems unused in practice (and there are no plans on working
towards enabling it anytime).

Also discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2020-July/143773.html

Reviewed By: jdoerfert

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

4 years agoVectorUtils.h - reduce unnecessary includes. NFC.
Simon Pilgrim [Thu, 30 Jul 2020 11:11:34 +0000 (12:11 +0100)]
VectorUtils.h - reduce unnecessary includes. NFC.

Replace TargetLibraryInfo.h include with forward declaration and fix implicit dependencies.

Reduce SmallSet.h include to SmallVector.h include.

4 years ago[X86][SSE] combineExtractWithShuffle - extend extract(truncate(x),0) for any source...
Simon Pilgrim [Thu, 30 Jul 2020 10:27:37 +0000 (11:27 +0100)]
[X86][SSE] combineExtractWithShuffle - extend extract(truncate(x),0) for any source vector size

As long as we can extract the lowest 128-bit subvector from the pre-truncated source vector, then we don't care what size it is.

The next stage will be to support non-zero extraction indices, as long as its still coming from the lowest 128-bit subvector.

4 years ago[clangd] Implement Relations request for remote index
Kirill Bobyrev [Thu, 30 Jul 2020 10:57:20 +0000 (12:57 +0200)]
[clangd] Implement Relations request for remote index

This is the last missing bit in the core remote index implementation. The only
remaining bits are some API refactorings (replacing Optional with Expected and
being better at reporting errors).

Reviewed By: kadircet

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

4 years ago[AArch64] Add machine-combiner tests with instruction level FMFs.
Florian Hahn [Thu, 30 Jul 2020 10:17:52 +0000 (11:17 +0100)]
[AArch64] Add machine-combiner tests with instruction level FMFs.

4 years ago[lldb] Don't use static locals for return value storage in some *AsCString functions
Raphael Isemann [Thu, 30 Jul 2020 09:50:53 +0000 (11:50 +0200)]
[lldb] Don't use static locals for return value storage in some *AsCString functions

Let's just return a std::string to make this safe. formatv seemed overkill for formatting
the return values as they all just append an integer value to a constant string.

Reviewed By: labath

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

4 years ago[NFC] Failed cases for some patterns defined in DAGCombiner.cpp
Esme-Yi [Thu, 30 Jul 2020 10:05:04 +0000 (10:05 +0000)]
[NFC] Failed cases for some patterns defined in DAGCombiner.cpp

4 years ago[clangd] findNearbyIdentifier(): fix the word search in the token stream.
Aleksandr Platonov [Thu, 30 Jul 2020 09:45:07 +0000 (12:45 +0300)]
[clangd] findNearbyIdentifier(): fix the word search in the token stream.

Without this patch the word occurrence search always returns the first token of the file.
Despite of that, `findNeardyIdentifier()` returns the correct result (but inefficently) until there are several matched tokens with the same value `floor(log2(<token line> - <word line>))` (e.g. several matched tokens on the same line).

Reviewed By: kadircet

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

4 years ago[DWARFYAML] Make the 'Length' field of the address range table optional.
Xing GUO [Thu, 30 Jul 2020 09:42:18 +0000 (17:42 +0800)]
[DWARFYAML] Make the 'Length' field of the address range table optional.

This patch makes the 'Length' field of the address range table optional.

Reviewed By: jhenderson

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

4 years ago[DWARFYAML] Make the 'AddressSize', 'SegmentSelectorSize' fields optional.
Xing GUO [Thu, 30 Jul 2020 09:39:39 +0000 (17:39 +0800)]
[DWARFYAML] Make the 'AddressSize', 'SegmentSelectorSize' fields optional.

This patch makes the 'AddressSize' and 'SegmentSelectorSize' fields of
address range table optional.

Reviewed By: jhenderson

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

4 years ago[DAGCombiner] Fold sext_inreg of a masked load into a sign extended masked load
Sam Tebbs [Wed, 22 Jul 2020 09:36:14 +0000 (10:36 +0100)]
[DAGCombiner] Fold sext_inreg of a masked load into a sign extended masked load

This patch adds a DAG combine fold for a sext(masked_load) into a sign extended masked load.

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

4 years ago[clang-tidy] Use StringMap for ClangTidyOptions::OptionsMap
Nathan James [Thu, 30 Jul 2020 09:31:12 +0000 (10:31 +0100)]
[clang-tidy] Use StringMap for ClangTidyOptions::OptionsMap

Ordering of options isn't important so an `llvm::StringMap` is a much better container for this purpose.

Reviewed By: gribozavr2

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

4 years ago[flang] Fix multi-config generator builds.
David Truby [Thu, 16 Jul 2020 15:13:09 +0000 (16:13 +0100)]
[flang] Fix multi-config generator builds.

Summary:
Currently the binaries are output directly into the bin subdirectory of the
build directory. This doesn't work correctly with multi-config generators which
should output the binaries into <CONFIG_NAME>/bin instead.

Reviewers: sscalpone, richard.barton.arm

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

4 years ago[IPConstProp] Regenerate check lines.
Florian Hahn [Thu, 9 Jul 2020 16:29:19 +0000 (17:29 +0100)]
[IPConstProp] Regenerate check lines.

Preparation for D84447.

4 years ago[compiler-rt][cmake] Simplify COMPILER_RT_HAS_VERSION_SCRIPT tests
Rainer Orth [Thu, 30 Jul 2020 08:27:36 +0000 (10:27 +0200)]
[compiler-rt][cmake] Simplify COMPILER_RT_HAS_VERSION_SCRIPT tests

As requested in the review, this patch removes the additional conditions in
the `COMPILER_RT_HAS_VERSION_SCRIPT` tests.

Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`.

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

4 years ago[MLIR][SPIRVToLLVM] Conversion of GLSL ops to LLVM intrinsics
George Mitenkov [Thu, 30 Jul 2020 07:53:06 +0000 (10:53 +0300)]
[MLIR][SPIRVToLLVM] Conversion of GLSL ops to LLVM intrinsics

This patch introduces new intrinsics in LLVM dialect:
-  `llvm.intr.floor`
-  `llvm.intr.maxnum`
-  `llvm.intr.minnum`
-  `llvm.intr.smax`
-  `llvm.intr.smin`
These intrinsics correspond to SPIR-V ops from GLSL
extended instruction set (`spv.GLSL.Floor`, `spv.GLSL.FMax`,
`spv.GLSL.FMin`,  `spv.GLSL.SMax` and `spv.GLSL.SMin`
respectively). Also conversion patterns for them were added.

Reviewed By: antiagainst

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

4 years ago[PHIElimination] Fix the killed flag for LowerPHINode()
Kang Zhang [Thu, 30 Jul 2020 08:18:50 +0000 (08:18 +0000)]
[PHIElimination] Fix the killed flag for LowerPHINode()

Summary:
In the phi-node-elimination pass, we set the killed flag incorrectly.
When we eliminate the PHI node, we replace the PHI with a copy for the
incoming value.

Before this patch, we will set incoming value as killed(PHICopy). And
we will remove the killed flag from last using incoming value(OldKill).
This is correct, only if the new PHICopy is after the OldKill.

Reviewed By: bjope

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

4 years ago[MLIR][SPIRVToLLVM] Conversion for inverse sqrt and tanh
George Mitenkov [Thu, 30 Jul 2020 07:24:10 +0000 (10:24 +0300)]
[MLIR][SPIRVToLLVM] Conversion for inverse sqrt and tanh

This is a second patch on conversion of GLSL ops to LLVM dialect.
It introduces patterns to convert `spv.InverseSqrt` and `spv.Tanh`.

Reviewed By: antiagainst

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

4 years ago[Analyzer] Remove inclusion of uniqueing decl from diagnostic profile.
Balázs Kéri [Thu, 30 Jul 2020 06:36:05 +0000 (08:36 +0200)]
[Analyzer] Remove inclusion of uniqueing decl from diagnostic profile.

The uniqueing decl in PathDiagnostic is the declaration with the
uniqueing loc, as stated by documentation comments.
It is enough to include the uniqueing loc in the profile. It is possible
to have objects with different uniqueing decl but same location, at
least with templates. These belong to the same class and should have
same profile.

Reviewed By: vsavchenko, NoQ

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

4 years ago[SVE][CodeGen] At -O0 fallback to DAG ISel when translating alloca with scalable...
David Sherwood [Tue, 28 Jul 2020 12:28:14 +0000 (13:28 +0100)]
[SVE][CodeGen] At -O0 fallback to DAG ISel when translating alloca with scalable types

When building code at -O0 We weren't falling back to DAG ISel correctly
when encountering alloca instructions with scalable vector types. This
is because the alloca has no operands that are scalable. I've fixed this by
adding a check in AArch64ISelLowering::fallBackToDAGISel for alloca
instructions with scalable types.

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

4 years ago[Concepts] Fix a deserialization crash.
Haojian Wu [Thu, 30 Jul 2020 07:19:58 +0000 (09:19 +0200)]
[Concepts] Fix a deserialization crash.

`TemplateTypeParmDecl::hasTypeConstraint` is not a safe guard for
checking `TemplateTypeParmDecl::getTypeConstraint()` result is null.

in somecases (e.g. implicit deduction guide templates synthesized from the
constructor, immediately-declared constraint is not formed because of an error),
hasTypeConstraint returns false, and getTypeConstraint returns a nullptr.

Fix https://bugs.llvm.org/show_bug.cgi?id=46790

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

4 years ago[MLIR][SPIRVToLLVM] Conversion patterns for GLSL ops
George Mitenkov [Thu, 30 Jul 2020 06:22:44 +0000 (09:22 +0300)]
[MLIR][SPIRVToLLVM] Conversion patterns for GLSL ops

This is the first patch that adds support for GLSL extended
instruction set ops. These are direct conversions, apart from `spv.Tan`
that is lowered to `sin() / cos()`.

Reviewed By: antiagainst

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

4 years ago[clangd] Fix an assertion failure in TargetFinder's heuristic resolution of dependent...
Haojian Wu [Wed, 29 Jul 2020 11:58:12 +0000 (13:58 +0200)]
[clangd] Fix an assertion failure in TargetFinder's heuristic resolution of dependent type.

The assertion is not true anymore after D82739, this patch just removes
it, and rename related functions.

And also fixes a missing cases.

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

4 years ago[X86] Pass the OperandVector to ParseMemOperand instead of returning the operand...
Craig Topper [Thu, 30 Jul 2020 06:19:43 +0000 (23:19 -0700)]
[X86] Pass the OperandVector to ParseMemOperand instead of returning the operand. NFCI

Continue the change made to ParseATTOperand to take the vector by
reference. Let ParseMemOperand add its memory operand to the
vector and just return true/false to indicate error.

4 years ago[X86] Don't pass some many parameters to ParseMemOperand by reference.
Craig Topper [Thu, 30 Jul 2020 05:57:28 +0000 (22:57 -0700)]
[X86] Don't pass some many parameters to ParseMemOperand by reference.

Pointers and SMLocs are cheap to copy. Even though the function
modifies some of these the caller doesn't use them after the call.

4 years ago[Support] Class to facilitate file locking
Serge Pavlov [Wed, 29 Apr 2020 04:26:19 +0000 (11:26 +0700)]
[Support] Class to facilitate file locking

This change define RAII class `FileLocker` and methods `lock` and
`tryLockFor` of the class `raw_fd_stream` to facilitate using file locks.

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

4 years ago[NFC] Remove unused variable
Max Kazantsev [Thu, 30 Jul 2020 06:31:16 +0000 (13:31 +0700)]
[NFC] Remove unused variable

4 years ago[Analyzer] Use of BugType in DereferenceChecker (NFC).
Balázs Kéri [Thu, 30 Jul 2020 06:31:39 +0000 (08:31 +0200)]
[Analyzer] Use of BugType in DereferenceChecker (NFC).

Use of BuiltinBug is replaced by BugType.
Class BuiltinBug seems to have no benefits and is confusing.

Reviewed By: Szelethus, martong, NoQ, vsavchenko

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

4 years ago[AMDGPU] Fix DWARF extensions User Guide table of contents
Tony [Thu, 30 Jul 2020 05:10:21 +0000 (05:10 +0000)]
[AMDGPU] Fix DWARF extensions User Guide table of contents

4 years ago[AMDGPU] DWARF proposal changes
Tony [Fri, 3 Jul 2020 22:31:53 +0000 (22:31 +0000)]
[AMDGPU] DWARF proposal changes

- Clarify that these are extensions to DWARF 5 and not as yet a
  proposal.

Reviewed By: scott.linder

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

4 years ago[X86] Teach the assembler parser to handle a '*' between segment register and base...
Craig Topper [Thu, 30 Jul 2020 04:14:21 +0000 (21:14 -0700)]
[X86] Teach the assembler parser to handle a '*' between segment register and base/index/displacement part of an address

A '*' after the segment is equivalent to a '*' before the segment register. To make the AsmMatcher table work we need to place the '*' token into the operand vector before the full memory operand. To accomplish this I've modified some portions of operand parsing to expose the operand vector to ParseATTOperand so that the token can be pushed to the vector after parsing the segment register and before creating the memory operand using that segment register.

Fixes PR46879

Reviewed By: MaskRay

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

4 years ago[DebugInfo] Fix to ctor homing to ignore classes with trivial ctors.
Amy Huang [Thu, 30 Jul 2020 02:54:08 +0000 (19:54 -0700)]
[DebugInfo] Fix to ctor homing to ignore classes with trivial ctors.

Previously ctor homing was omitting debug info for classes if they
have both trival and nontrivial constructors, but we should only omit debug
info if the class doesn't have any trivial constructors.

retained types list.

bug: https://bugs.llvm.org/show_bug.cgi?id=46537

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

4 years agoFor some tests targeting SystemZ, -march=z13 ---> -mcpu=z13
Yuanfang Chen [Thu, 30 Jul 2020 01:34:32 +0000 (18:34 -0700)]
For some tests targeting SystemZ, -march=z13 ---> -mcpu=z13

z13 is not a target. It is a CPU.

4 years agoNFC. Fix comments
Yuanfang Chen [Tue, 28 Jul 2020 23:52:13 +0000 (16:52 -0700)]
NFC. Fix comments

4 years ago[llvm-readobj] NFC. Add -help description of --hex-dump and
Yuanfang Chen [Sat, 25 Jul 2020 19:24:37 +0000 (12:24 -0700)]
[llvm-readobj] NFC. Add -help description of --hex-dump and
--string-dump

4 years ago[PowerPC] Fix RM operands for some instructions
Kang Zhang [Thu, 30 Jul 2020 02:10:49 +0000 (02:10 +0000)]
[PowerPC] Fix RM operands for some instructions

Summary:
Some instructions have set the wrong [RM] flag, this patch is to fix it.

Instructions x(v|s)r(d|s)pi[zmp]? and fri[npzm] use fixed rounding
directions without referencing current rounding mode.

Also, the SETRNDi, SETRND, BCLRn, MTFSFI, MTFSB0, MTFSB1, MTFSFb,
MTFSFI, MTFSFI_rec, MTFSF, MTFSF_rec should also fix the RM flag.

Reviewed By: jsji

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

4 years ago[AMDGPU] DWARF proposal changes for expression context
Tony [Fri, 3 Jul 2020 22:31:53 +0000 (22:31 +0000)]
[AMDGPU] DWARF proposal changes for expression context

- Clarify what context is used in DWARF expression evaluation.

- Define location descriptions to fully resolve the context and so
  include the context in their result.

- As a consequence of location descriptions being fully resoved,
  change address spaces so only a swizzled and unswizzled private
  address space is defined. The lane is now part of the location
  description context.

- Clarify how call frame information is used to fully resolve
  expressions that specify registers.

Reviewed By: scott.linder

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

4 years agoGlobalISel: Use result of find rather than rechecking map
Matt Arsenault [Wed, 29 Jul 2020 13:42:03 +0000 (09:42 -0400)]
GlobalISel: Use result of find rather than rechecking map

4 years agoGlobalISel: Handle assorted no-op intrinsics
Matt Arsenault [Wed, 29 Jul 2020 12:55:02 +0000 (08:55 -0400)]
GlobalISel: Handle assorted no-op intrinsics

SelectionDAGBuilder just drops these, so do the same.

4 years ago[lldb] Move finish_swig logic into a function in the binding dir
Jonas Devlieghere [Thu, 30 Jul 2020 00:56:38 +0000 (17:56 -0700)]
[lldb] Move finish_swig logic into a function in the binding dir

Move the finish_swig logic into a function in the bindings directory. By
making this a function I can reuse the logic internally where we ship
two Python versions and therefore need to finish the bindings twice.

4 years agoPR46729: Reject explicit and partial specializations with C linkage.
Richard Smith [Wed, 29 Jul 2020 23:49:05 +0000 (16:49 -0700)]
PR46729: Reject explicit and partial specializations with C linkage.

4 years ago[JumpThreading] Fold br(freeze(undef))
Juneyoung Lee [Thu, 30 Jul 2020 00:38:50 +0000 (09:38 +0900)]
[JumpThreading] Fold br(freeze(undef))

This patch makes JumpThreading fold br(freeze(undef)) if the freeze instruction
is only used by the branch.

Reviewed By: efriedma

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

4 years ago[profile] Add InstrProfilingInternal.c.o to Darwin kext builtins
Vedant Kumar [Thu, 30 Jul 2020 00:22:27 +0000 (17:22 -0700)]
[profile] Add InstrProfilingInternal.c.o to Darwin kext builtins

Fixes a build failure in the Darwin kernel. Tested with:

% nm -m ./lib/libclang_rt.cc_kext_x86_64_osx.a | grep lprofSetProfileDumped

rdar://66249602

4 years ago[Darwin][compiler-rt] kern.osproductversion unavailable pre macOS 10.13
Julian Lettner [Wed, 29 Jul 2020 19:50:49 +0000 (12:50 -0700)]
[Darwin][compiler-rt] kern.osproductversion unavailable pre macOS 10.13

Add a fallback for `sysctl kern.osproductversion` for XNU 17 (macOS
10.13) and below, which do not provide this property.

Unfortunately, this means we have to take the detour via Darwin kernel
version again (at least for the fallback).

Reviewed By: delcypher

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

4 years agoGlobalISel: Handle llvm.roundeven
Matt Arsenault [Sun, 19 Jul 2020 13:56:15 +0000 (09:56 -0400)]
GlobalISel: Handle llvm.roundeven

I still think it's highly questionable that we have two intrinsics
with identical behavior and only vary by the name of the libcall used
if it happens to be lowered that way, but try to reduce the feature
delta between SDAG and GlobalISel for recently added intrinsics. I'm
not sure which opcode should be considered the canonical one, but
lower roundeven back to round.

4 years ago[llvm][NFC] TensorSpec abstraction for ML evaluator
Mircea Trofin [Wed, 29 Jul 2020 23:29:21 +0000 (16:29 -0700)]
[llvm][NFC] TensorSpec abstraction for ML evaluator

Further abstracting the specification of a tensor, to more easily
support different types and shapes of tensor, and also to perform
initialization up-front, at TFModelEvaluator construction time.

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

4 years ago[DFSan] Remove dfsan_use_fast16labels from abilist.
Matt Morehouse [Wed, 29 Jul 2020 23:18:07 +0000 (23:18 +0000)]
[DFSan] Remove dfsan_use_fast16labels from abilist.

Its implementation was scrapped in the final fast16labels
instrumentation patch.

4 years agoRevert "build: always add support for assembly targets on Darwin"
Francis Visoiu Mistrih [Wed, 29 Jul 2020 22:41:04 +0000 (15:41 -0700)]
Revert "build: always add support for assembly targets on Darwin"

This reverts commit d8e8e32d85f1cbde2a6b67af010fba3c3a3c86e9.

This breaks the build on GreenDragon:
http://green.lab.llvm.org/green/job/clang-stage1-RA/13171/console

4 years ago[lldb] Fix llvm-lit in standalone builds
Jonas Devlieghere [Wed, 29 Jul 2020 22:37:11 +0000 (15:37 -0700)]
[lldb] Fix llvm-lit in standalone builds

LLVM's make_paths_relative uses Python3_EXECUTABLE which isn't set in
standalone LLDB builds.

4 years ago[darwin] build and link with a separate compiler-rt builtins library
Alex Lorenz [Fri, 24 Jul 2020 23:01:48 +0000 (16:01 -0700)]
[darwin] build and link with a separate compiler-rt builtins library
for device simulators

This change separates out the iOS/tvOS/watchOS simulator slices from the "libclang_rt.<os>.a"
fat archive, by moving them out to their own "libclang_rt.<os>sim.a" static archive.
This allows us to build and to link with an arm64 device simulator slice for the simulators running
on Apple Silicons, and to distribute it in one archive alongside the Intel simulator slices.

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