platform/upstream/llvm.git
4 years agoRename arrow -> arrowToken for unified naming
Eduardo Caldas [Thu, 4 Jun 2020 14:12:15 +0000 (16:12 +0200)]
Rename arrow -> arrowToken for unified naming

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[Analyzer][StreamChecker] Updated initialization of BugType's.
Balázs Kéri [Thu, 4 Jun 2020 13:24:08 +0000 (15:24 +0200)]
[Analyzer][StreamChecker] Updated initialization of BugType's.

Summary:
BugType objects are initialized in-class instead of by lazy initialization.
FuchsiaHandleChecker does this already.

Reviewers: Szelethus, baloghadamsoftware, martong

Reviewed By: Szelethus

Subscribers: rnkovacs, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, gamesh411, Charusso, martong, ASDenysPetrov, cfe-commits

Tags: #clang

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

4 years agoRevert "Relands "[YAMLVFSWriter][Test][NFC] Add couple tests" vol. 2"
Russell Gallop [Thu, 4 Jun 2020 13:56:09 +0000 (14:56 +0100)]
Revert "Relands "[YAMLVFSWriter][Test][NFC] Add couple tests" vol. 2"

This reverts commit 30949926f98576fbff8d5ad0390be5124ffacd7e.

This was failing on bot here:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/32749

4 years agoRegAllocFast: Remove dead code
Matt Arsenault [Wed, 3 Jun 2020 21:14:54 +0000 (17:14 -0400)]
RegAllocFast: Remove dead code

4 years ago[OPENMP]Fix PR45383: type dependent array subscripts are diagnosed erroneously.
Alexey Bataev [Wed, 22 Apr 2020 14:18:04 +0000 (10:18 -0400)]
[OPENMP]Fix PR45383: type dependent array subscripts are diagnosed erroneously.

Summary:
If the array subscript expression is type depent, its analysis must be
delayed before its instantiation.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, caomhin, cfe-commits

Tags: #clang

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

4 years ago[x86] add test/code comment for chain value use (PR46195); NFC
Sanjay Patel [Thu, 4 Jun 2020 12:50:42 +0000 (08:50 -0400)]
[x86] add test/code comment for chain value use (PR46195); NFC

4 years ago[TableGen] Handle (outs variable_ops)
Denis Antrushin [Wed, 3 Jun 2020 14:08:48 +0000 (17:08 +0300)]
[TableGen] Handle (outs variable_ops)

When `variable_ops` is specified in `InOperandList` of instruction,
it behaves as expected, i.e., does not count as operand.
So for `(ins variable_ops)` instruction description will have 0
operands.  However when used in OutOperandList it is counted as
operand. So `(outs variable_ops)` results in instruction with
one def.
This patch makes behavior of `variable_ops` in `out` list to match
that of `in` list.

Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D81095

4 years ago[gn build] Port 48cd9d9dd86
LLVM GN Syncbot [Thu, 4 Jun 2020 12:56:45 +0000 (12:56 +0000)]
[gn build] Port 48cd9d9dd86

4 years ago[Support] Use outs() in ToolOutputFile
Pavel Labath [Wed, 3 Jun 2020 10:08:45 +0000 (12:08 +0200)]
[Support] Use outs() in ToolOutputFile

Summary:
If the output filename was specified as "-", the ToolOutputFile class
would create a brand new raw_ostream object referring to the stdout.
This patch changes it to reuse the llvm::outs() singleton.

At the moment, this change should be "NFC", but it does enable other
enhancements, like the automatic stdout/stderr synchronization as
discussed on D80803.

I've checked the history, and I did not find any indication that this
class *has* to use a brand new stream object instead of outs() --
indeed, it is special-casing "-" in a number of places already, so this
change fits the pattern pretty well. I suspect the main reason for the
current state of affairs is that the class was originally introduced
(r111595, in 2010) as a raw_fd_ostream subclass, which made any other
solution impossible.

Another potential benefit of this patch is that it makes it possible to
move the raw_ostream class out of the business of special-casing "-" for
stdout handling. That state of affairs does not seem appropriate because
"-" is a valid filename (albeit hard to access with a lot of command
line tools) on most systems. Handling "-" in ToolOutputFile seems more
appropriate.

To make this possible, this patch changes the return type of
llvm::outs() and errs() to raw_fd_ostream&. Previously the functions
were constructing objects of that type, but returning a generic
raw_ostream reference. This makes it possible for new ToolOutputFile and
other code to use raw_fd_ostream methods like error() on the outs()
object. This does not seem like a bad thing (since stdout is a file
descriptor which can be redirected to anywhere, it makes sense to ask it
whether the writing was successful or if it supports seeking), and
indeed a lot of code was already depending on this fact via the
ToolOutputFile "back door".

Reviewers: dblaikie, JDevlieghere, MaskRay, jhenderson

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[openmp] Fixed nonmonotonic schedule implementation.
AndreyChurbanov [Thu, 4 Jun 2020 12:39:45 +0000 (15:39 +0300)]
[openmp] Fixed nonmonotonic schedule implementation.

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

4 years ago[x86] add FileCheck / assertions to test; NFC
Sanjay Patel [Thu, 4 Jun 2020 12:33:24 +0000 (08:33 -0400)]
[x86] add FileCheck / assertions to test; NFC

4 years ago[OpenCL] Add cl_khr_extended_subgroup extensions.
Anastasia Stulova [Thu, 4 Jun 2020 11:29:02 +0000 (12:29 +0100)]
[OpenCL] Add cl_khr_extended_subgroup extensions.

Added extensions and their function declarations into
the standard header.

Patch by Piotr Fusik!

Tags: #clang

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

4 years ago[analyzer] Ignore calculated indices of <= 0 in VLASizeChecker
Vince Bridgers [Mon, 1 Jun 2020 00:03:16 +0000 (19:03 -0500)]
[analyzer] Ignore calculated indices of <= 0 in VLASizeChecker

Summary:
See https://bugs.llvm.org/show_bug.cgi?id=46128. The checker does not
yet comprehend constraints involving multiple symbols, so it's possible
to calculate a VLA size that's negative or 0. A LIT is added to catch
regressions, and this change simply bails if a VLA size of 0 or less is
calculated.

Reviewers: balazske, NoQ, martong, baloghadamsoftware, Szelethus, gamesh411

Reviewed By: balazske, NoQ, Szelethus

Subscribers: xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, Charusso, ASDenysPetrov, cfe-commits, dkrupp

Tags: #clang

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

4 years ago[PhaseOrdering] add more tests for vector reductions; NFC
Sanjay Patel [Thu, 4 Jun 2020 12:17:53 +0000 (08:17 -0400)]
[PhaseOrdering] add more tests for vector reductions; NFC

More coverage for D80867.

4 years ago[VP][Fix] canIgnoreVectorLength for scalable types
Simon Moll [Thu, 4 Jun 2020 09:09:48 +0000 (11:09 +0200)]
[VP][Fix] canIgnoreVectorLength for scalable types

This patch fixes VPIntrinsic::canIgnoreVectorLength when used on a
VPIntrinsic with scalable vector types. Also includes new unittest cases
for the '<vscale x 1 x whatever>' and '%evl == vscale' corner cases.

4 years ago[ARM] FP16 conversion tests. NFC
David Green [Thu, 4 Jun 2020 11:31:42 +0000 (12:31 +0100)]
[ARM] FP16 conversion tests. NFC

4 years ago[gn build] port some -Wno flags for gcc from the cmake build.
Nico Weber [Thu, 4 Jun 2020 12:10:16 +0000 (08:10 -0400)]
[gn build] port some -Wno flags for gcc from the cmake build.

4 years agoAdd support for IntegerLiteral in SyntaxTree
Eduardo Caldas [Thu, 4 Jun 2020 12:03:04 +0000 (14:03 +0200)]
Add support for IntegerLiteral in SyntaxTree

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[InstCombine][NFC] Factor out constant check
Max Kazantsev [Thu, 4 Jun 2020 11:54:23 +0000 (18:54 +0700)]
[InstCombine][NFC] Factor out constant check

We plan to add more transforms here. Besides, this check should be
done in the beginning just from function's name.

4 years ago[Test] Add test showing missing opportunity of folding ICmp(Phi(Consts...))
Max Kazantsev [Thu, 4 Jun 2020 11:14:30 +0000 (18:14 +0700)]
[Test] Add test showing missing opportunity of folding ICmp(Phi(Consts...))

4 years ago[ObjectYAML] - Remove unused function. NFC.
Georgii Rymar [Thu, 4 Jun 2020 11:22:06 +0000 (14:22 +0300)]
[ObjectYAML] - Remove unused function. NFC.

Was introduced in D81005 by mistake.

Catched by BB:
http://lab.llvm.org:8011/builders/clang-ppc64le-rhel/builds/4070/steps/build%20stage%201/logs/stdio

4 years ago[FileCheck] Implement equality operators for ExpressionValue.
Paul Walker [Mon, 1 Jun 2020 10:09:58 +0000 (10:09 +0000)]
[FileCheck] Implement equality operators for ExpressionValue.

Subscribers: hiraditya, thopre, llvm-commits

Tags: #llvm

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

4 years ago[ARM][MachineOutliner] Remove unneeded dynamic allocation.
Yvan Roux [Thu, 4 Jun 2020 11:12:26 +0000 (13:12 +0200)]
[ARM][MachineOutliner] Remove unneeded dynamic allocation.

4 years ago[DAG] scalarizeBinOpOfSplats - extract from the source of splat vector (PR46189)
Simon Pilgrim [Thu, 4 Jun 2020 10:49:28 +0000 (11:49 +0100)]
[DAG] scalarizeBinOpOfSplats - extract from the source of splat vector (PR46189)

D79003/rG9fa58d1bf2f8 exposed an issue with scalarizeBinOpOfSplats that we were extracting from the splatted vector result instead of the source, the splat index is only valid for the source vector not the result, which may contain undefs, including at the splat index.

4 years agoRevert "[DAGCombiner] avoid unnecessary indirection from SDNode/SDValue; NFCI"
Tim Northover [Thu, 4 Jun 2020 10:15:03 +0000 (11:15 +0100)]
Revert "[DAGCombiner] avoid unnecessary indirection from SDNode/SDValue; NFCI"

This reverts commit 21dadd774f56778ef68c1ce307205dfbdacc793a.

In at least PromoteIntBinOps, they wanted to know about users of *all* values
produced by the node not just the integer being promoted. For example not
replacing chain users if the operation was a load breaks the ordering of the
DAG.

4 years ago[yaml2obj] - Add a way to exclude specified sections from the section header.
Georgii Rymar [Mon, 1 Jun 2020 09:13:02 +0000 (12:13 +0300)]
[yaml2obj] - Add a way to exclude specified sections from the section header.

This implements a new "Excluded" key that can be used
to exclude entries from section header:

```
SectionHeaderTable:
  Sections:
    ...
  Excluded:
    - Name: .foo
```

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

4 years ago[CSInfo][MIPS] Describe parameter value loaded by ADDiu
Djordje Todorovic [Thu, 4 Jun 2020 09:59:04 +0000 (11:59 +0200)]
[CSInfo][MIPS] Describe parameter value loaded by ADDiu

Describe parameter's value loaded by MIPS ADDiu instruction.
When parameter's value is loaded into a register by mips ADDiu/DADDiu
instruction, it could be described correctly and emitted as
DW_AT_GNU_call_site_value.

Patch by Nikola Tesic

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

4 years ago[Sema] Remove unused matrix_begin/end helpers (NFC).
Florian Hahn [Thu, 4 Jun 2020 10:15:01 +0000 (11:15 +0100)]
[Sema] Remove unused matrix_begin/end helpers (NFC).

The matrix_types() helper returning an iterator range is used instead.

4 years ago[X86] Add test case for PR46189
Simon Pilgrim [Thu, 4 Jun 2020 09:43:19 +0000 (10:43 +0100)]
[X86] Add test case for PR46189

4 years agoRevert "[yaml2obj] - Allocate the file space for SHT_NOBITS sections in some cases."
Georgii Rymar [Thu, 4 Jun 2020 10:10:43 +0000 (13:10 +0300)]
Revert "[yaml2obj] - Allocate the file space for SHT_NOBITS sections in some cases."

This reverts commit aa3a85cdaa4432ca389bdbf48049eaa64dc6e266.

There are problems with it. See here: https://reviews.llvm.org/D80629

4 years ago[PowerPC][NFC] Testing ROTL of v1i128.
Esme-Yi [Thu, 4 Jun 2020 10:09:06 +0000 (10:09 +0000)]
[PowerPC][NFC] Testing ROTL of v1i128.

Summary: A bug is reported in bugzilla-45628, where the swap_with_shift case can’t be matched to a single HW instruction xxswapd as expected. In fact the case matches the idiom of rotate, but PPC doesn’t support ROTL v1i128.
This is a NFC patch for testing ROTL with v1i128 at master.

Reviewed By: steven.zhang

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

4 years ago[clangd] Fix build for gcc 7.4
Kadir Cetinkaya [Thu, 4 Jun 2020 10:02:49 +0000 (12:02 +0200)]
[clangd] Fix build for gcc 7.4

4 years ago[StackSafety] Rename testing opts
Vitaly Buka [Thu, 4 Jun 2020 09:38:58 +0000 (02:38 -0700)]
[StackSafety] Rename testing opts

4 years ago[StackSafety,NFC] Remove SCEVRewriteVisitor
Vitaly Buka [Tue, 2 Jun 2020 04:40:47 +0000 (21:40 -0700)]
[StackSafety,NFC] Remove SCEVRewriteVisitor

Summary: Depends on D80956.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[AMDGPU] More accurate gfx10 latencies
Jay Foad [Wed, 11 Mar 2020 11:33:30 +0000 (11:33 +0000)]
[AMDGPU] More accurate gfx10 latencies

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

4 years ago[AMDGPU] Introduce new sched classes for transcendental instructions
Jay Foad [Tue, 10 Mar 2020 13:08:58 +0000 (13:08 +0000)]
[AMDGPU] Introduce new sched classes for transcendental instructions

This is in preparation for scheduling them slightly differently on
gfx10. NFC.

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

4 years ago[VE] Clean SDNodeXForm stuff
Kazushi (Jam) Marukawa [Thu, 4 Jun 2020 09:27:57 +0000 (11:27 +0200)]
[VE] Clean SDNodeXForm stuff

Summary:
Gather definitions of SDNodeXForm and change them to call C functions
instead of copying C expressions in td files.  Doing this solved some
bugs in mimm detections.

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

4 years ago[llvm-readelf] - Do not try to read past the end of the file when dumping the the...
Georgii Rymar [Wed, 3 Jun 2020 15:19:05 +0000 (18:19 +0300)]
[llvm-readelf] - Do not try to read past the end of the file when dumping the the SHT_GNU_HASH.

We have unobvious issue in the condition that is used to check
that we do not read past the EOF.

The problem is that the result of "GnuHashTable->nbuckets * 4" expression is uint32.
Because of that it was still possible to overflow it and pass the check.

There was no such problem with the "GnuHashTable->maskwords * sizeof(typename ELFT::Off)"
condition, because of `sizeof` on the right (which gives 64-bits value on x64),
but I've added an explicit conversion to 64-bit value for `GnuHashTable->maskwords` too.

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

4 years agoMake syntax tree test print the line number when it fails
Dmitri Gribenko [Thu, 4 Jun 2020 08:35:43 +0000 (10:35 +0200)]
Make syntax tree test print the line number when it fails

Summary:
The syntax tree test uses a helper function that executes all testing
assertions. When an assertion fails, the only line number that gets
printed to the log refers to the helper function. After this change, we
would also get the line number of the EXPECT_TRUE macro invocation
(unfortunately, the line number of the last token of it, not the first
one, but there's not much I can do about it).

Reviewers: hlopko, eduucaldas

Reviewed By: hlopko, eduucaldas

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[PowerPC] Require nsz flag for c-a*b to FNMSUB
Qiu Chaofan [Thu, 4 Jun 2020 08:30:17 +0000 (16:30 +0800)]
[PowerPC] Require nsz flag for c-a*b to FNMSUB

On PowerPC, FNMSUB (both VSX and non-VSX version) means -(a*b-c). But
the backend used to generate these instructions regardless whether nsz
flag exists or not. If a*b-c==0, such transformation changes sign of
zero.

This patch introduces PPC specific FNMSUB ISD opcode, which may help
improving combined FMA code sequence.

Reviewed By: steven.zhang

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

4 years agoExtend InvokeInst !prof branch_weights metadata to unwind branches
Yevgeny Rouban [Thu, 4 Jun 2020 08:34:14 +0000 (15:34 +0700)]
Extend InvokeInst !prof branch_weights metadata to unwind branches

Allow InvokeInst to have the second optional prof branch weight for
its unwind branch. InvokeInst is a terminator with two successors.
It might have its unwind branch taken many times. If so
the BranchProbabilityInfo unwind branch heuristic can be inaccurate.
This patch allows a higher accuracy calculated with both branch
weights set.

Changes:
 - A new section about InvokeInst is added to
   the BranchWeightMetadata page. It states the old information that
   missed in the doc and adds new about the second branch weight.
 - Verifier is changed to allow either 1 or 2 branch weights
   for InvokeInst.
 - A new test is written for BranchProbabilityInfo to demonstrate
   the main improvement of the simple fix in calcMetadataWeights().
 - Several new testcases are created for Inliner. Those check that
    both weights are accounted for invoke instruction weight
    calculation.
 - PGOUseFunc::setBranchWeights() is fixed to be applicable to
   InvokeInst.

Reviewers: davidxl, reames, xur, yamauchi
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80618

4 years ago[lldb][NFC] Address some review feedback for D80775 ('command script delete' completion)
Raphael Isemann [Thu, 4 Jun 2020 08:27:03 +0000 (10:27 +0200)]
[lldb][NFC] Address some review feedback for D80775 ('command script delete' completion)

In the similar review D81128, Jonas pointed out some style errors that also
apply to D80775 (which is already committed). Also applying the changes
suggested there to this code.

4 years agoRelands "[YAMLVFSWriter][Test][NFC] Add couple tests" vol. 2
Jan Korous [Thu, 4 Jun 2020 04:39:55 +0000 (21:39 -0700)]
Relands "[YAMLVFSWriter][Test][NFC] Add couple tests" vol. 2

This reverts commit e4e3e41905d182c0f3d5b0b9406e3cbf2aabb30f.

Fixed dangling StringRef in test.

4 years ago[lldb] tab completion for `command script delete'
Gongyu Deng [Thu, 4 Jun 2020 07:53:05 +0000 (09:53 +0200)]
[lldb] tab completion for `command script delete'

Summary: Added the tab completion for `command script delete`.

Reviewers: teemperor, JDevlieghere

Reviewed By: teemperor

Tags: #lldb

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

4 years ago[Support][NFC] Tests for root_name(), root_directory() and root_path()
Jan Korous [Thu, 4 Jun 2020 08:10:49 +0000 (01:10 -0700)]
[Support][NFC] Tests for root_name(), root_directory() and root_path()

It's literally just doc comments converted to unittests.

4 years ago[Instruction] Remove setProfWeight()
Yevgeny Rouban [Thu, 4 Jun 2020 07:30:58 +0000 (14:30 +0700)]
[Instruction] Remove setProfWeight()

Remove the function Instruction::setProfWeight() and make
use of Instruction::copyMetadata(.., {LLVMContext::MD_prof}).
This is correct for all use cases of setProfWeight() as it
is applied to CallBase instructions only.
This change results in prof metadata copied intact even if
the source has "VP". The old pair of calls
extractProfTotalWeight() + setProfWeight() resulted in
setting branch_weights if the source had "VP" data.

Reviewers: yamauchi, davidxl
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D80987

4 years ago[WebAssembly] Fix gcc warning [NFC]
Mikael Holmen [Thu, 4 Jun 2020 07:38:56 +0000 (09:38 +0200)]
[WebAssembly] Fix gcc warning [NFC]

gcc 7.4 complained with
../lib/Target/WebAssembly/WebAssemblyFixBrTableDefaults.cpp:125:23: warning: extra ';' [-Wpedantic]
                 false);
                       ^

4 years ago[NFCI][CostModel][AMDGPU] Simplify getUserCost
Sam Parker [Tue, 2 Jun 2020 11:29:42 +0000 (12:29 +0100)]
[NFCI][CostModel][AMDGPU] Simplify getUserCost

Casts and intrinsics are now handled by the default implementation
of getUserCost, so remove them from the backends switch statement.

https://reviews.llvm.org/D80994

4 years ago[flang] Fix IsConstantExpr for division expressions
Jean Perier [Thu, 4 Jun 2020 07:41:28 +0000 (09:41 +0200)]
[flang] Fix IsConstantExpr for division expressions

Summary:
Fortran::evaluate::IsConstantExpr did not check that the numerator
was a constant expression. This patch fixes the issue.

Reviewers: DavidTruby, klausler, schweitz, PeteSteinfeld, jdoerfert, sscalpone

Reviewed By: klausler, PeteSteinfeld, sscalpone

Subscribers: llvm-commits

Tags: #llvm, #flang

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

4 years ago[Inlining] Introduce -enable-npm-pgo-inline-deferral
Kazu Hirata [Thu, 4 Jun 2020 07:40:17 +0000 (00:40 -0700)]
[Inlining] Introduce -enable-npm-pgo-inline-deferral

Summary:
Experiments show that inline deferral past pre-inlining slightly
pessimizes the performance.

This patch introduces an option to control inline deferral during PGO.
The option defaults to true for now (that is, NFC).

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: eraman, hiraditya, haicheng, llvm-commits

Tags: #llvm

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

4 years ago[X86] Remove (V)MOVHPDrm patterns that involve bitcast+scalar_to_vec+loadi64.
Craig Topper [Thu, 4 Jun 2020 06:19:03 +0000 (23:19 -0700)]
[X86] Remove (V)MOVHPDrm patterns that involve bitcast+scalar_to_vec+loadi64.

I think these are left over from when we used to type legalize
v2f32 loads using bitcast+scalar_to_vec+loadi64 on 64-bit targets.
These days we use loadf64. If this becomes a problem a better
solution would be a DAG combine to turn it into scalar_to_vec+loadf64.

4 years ago[VE] Change to use EXTRACT_SUBREG instead of COPY_TO_REGCLASS
Kazushi (Jam) Marukawa [Thu, 4 Jun 2020 07:05:19 +0000 (09:05 +0200)]
[VE] Change to use EXTRACT_SUBREG instead of COPY_TO_REGCLASS

Summary:
Change to use EXTRACT_SUBREG instead of COPY_TO_REGCLASS in order to
remove unnecessary copy instructions.

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

4 years ago[SVE] Fix ubsan issues in DecodeIITType
David Sherwood [Tue, 2 Jun 2020 13:44:24 +0000 (14:44 +0100)]
[SVE] Fix ubsan issues in DecodeIITType

In an earlier patch I removed the need for
IITDescriptor::ScalableVecArgument, which involved changing
DecodeIITType to pull out the last IIT_Info from the list. However,
it turns out this is unsafe and causes ubsan failures. I've tried to
fix this a different way by simply passing the last IIT_Info as an
additional argument to DecodeIITType.

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

4 years ago[clang] Always allow including builtin headers in [no_undeclared_headers] modules.
Martin Boehme [Fri, 29 May 2020 08:36:19 +0000 (10:36 +0200)]
[clang] Always allow including builtin headers in [no_undeclared_headers] modules.

Previously, this would fail if the builtin headers had been "claimed" by
a different module that wraps these builtin headers. libc++ does this,
for example.

This change adds a test demonstrating this situation; the test fails
without the fix.

4 years agoUtility to dump .dot representation of SelectionDAG without firing viewer
Madhur Amilkanthwar [Thu, 4 Jun 2020 04:21:18 +0000 (09:51 +0530)]
Utility to dump .dot representation of SelectionDAG without firing viewer

Summary:
This patch adds support for dumping .dot
representation of SelectionDAG. It is inspired from the fact that,
a developer may want to just dump the graph at
a predictable path with a simple name to compare.
The exisitng utility (i.e. viewGraph) are overkill
for this motive hence this patch adds the requires support
while using the core routines from GraphWriter.

Example usage: DAG.dumpDotGraph("/tmp/graph.dot", "MyGraph")
will create /tmp/graph.dot file when DAG is an
object of SelectionDAG class.

Reviewed By: arsenm

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

4 years ago[libc][NFC] Add ceil[f], floor[f] and trunc[f] to the spec and config files.
Siva Chandra Reddy [Thu, 4 Jun 2020 05:39:34 +0000 (22:39 -0700)]
[libc][NFC] Add ceil[f], floor[f] and trunc[f] to the spec and config files.

4 years ago[gcov] Don't error 'unexpected end of memory buffe'
Fangrui Song [Thu, 4 Jun 2020 05:05:15 +0000 (22:05 -0700)]
[gcov] Don't error 'unexpected end of memory buffe'

4 years ago[gcov] Make `Creating 'filename'` compatible with gcov
Fangrui Song [Thu, 4 Jun 2020 04:14:54 +0000 (21:14 -0700)]
[gcov] Make `Creating 'filename'` compatible with gcov

And clean up llvm-cov.test a bit

4 years ago[Statepoint] Remove last of old ImmutableStatepoint code
Philip Reames [Thu, 4 Jun 2020 03:31:17 +0000 (20:31 -0700)]
[Statepoint] Remove last of old ImmutableStatepoint code

To do so, I had to sink the old school inline operand handling into GCStatepointInst which is non ideal.  This code should be removed shortly and I was able to at least clean it up a bunch.

4 years ago[Statepoint] Delete more dead code from old wrappers
Philip Reames [Thu, 4 Jun 2020 03:05:19 +0000 (20:05 -0700)]
[Statepoint] Delete more dead code from old wrappers

The verify() routine duplicates IR/Verifier.cpp checks, so while not technically dead it doesn't add any value either.

4 years ago[Statepoint] Start the process of removing old interfaces
Philip Reames [Thu, 4 Jun 2020 02:49:25 +0000 (19:49 -0700)]
[Statepoint] Start the process of removing old interfaces

We introduced the GCStatepointInst class and have migrated almost all users of Statepoint/ImmutableStatepoint to the new API.  Given downstream consumers have had a week to migrate, remove code which is now dead.

4 years agoReplace integer usage with enumeration.
Eric Christopher [Thu, 4 Jun 2020 02:59:26 +0000 (19:59 -0700)]
Replace integer usage with enumeration.

4 years ago[gcov] Delete XFAIL: host-byteorder-big-endian
Fangrui Song [Thu, 4 Jun 2020 02:58:28 +0000 (19:58 -0700)]
[gcov] Delete XFAIL: host-byteorder-big-endian

Add two to function-numbering.ll and exit-block.ll

4 years ago[gcov] Improve .gcno compatibility with gcov and use DataExtractor
Fangrui Song [Thu, 4 Jun 2020 02:29:21 +0000 (19:29 -0700)]
[gcov] Improve .gcno compatibility with gcov and use DataExtractor

llvm-cov.test and many Inputs/test* files contain wrong tests.
This patch rewrites a large portion of these files.
The pre-canned .gcno & .gcda are replaced by binaries produced by
clang --coverage (compatible with gcov 4.8~7)
(after some GCDAProfiling.c bugs were fixed by my previous commits).

Also make llvm-cov gcov on a little-endian host capable to parse big-endian .gcno and .gcda,
and make llvm-cov gcov on big-endian host capable to parse little-endian .gcno and .gcda

4 years ago[CUDA][HIP] Fix constexpr variables for C++17
Yaxun (Sam) Liu [Fri, 1 May 2020 15:30:24 +0000 (11:30 -0400)]
[CUDA][HIP] Fix constexpr variables for C++17

constexpr variables are compile time constants and implicitly const, therefore
they are safe to emit on both device and host side. Besides, in many cases
they are intended for both device and host, therefore it makes sense
to emit them on both device and host sides if necessary.

In most cases constexpr variables are used as rvalue and the variables
themselves do not need to be emitted. However if their address is taken,
then they need to be emitted.

For C++14, clang is able to handle that since clang emits them with
available_externally linkage together with the initializer.

However for C++17, the constexpr static data member of a class or template class
become inline variables implicitly. Therefore they become definitions with
linkonce_odr or weak_odr linkages. As such, they can not have available_externally
linkage.

This patch fixes that by adding implicit constant attribute to
file scope constexpr variables and constexpr static data members
in device compilation.

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

4 years ago[ObjectYAML][ELF] Let the endianness of DWARF sections be inferred from FileHeader.
Xing GUO [Thu, 4 Jun 2020 01:25:26 +0000 (09:25 +0800)]
[ObjectYAML][ELF] Let the endianness of DWARF sections be inferred from FileHeader.

This patch helps infer the endianness of DWARF sections from `FileHeader`.

Reviewed By: jhenderson, grimar

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

4 years ago[ObjectYAML][DWARF] Support emitting the .debug_aranges section in ELFYAML.
Xing GUO [Thu, 4 Jun 2020 00:53:40 +0000 (08:53 +0800)]
[ObjectYAML][DWARF] Support emitting the .debug_aranges section in ELFYAML.

This patch enables yaml2obj to emit the .debug_aranges section in ELFYAML.

Known issues:
- The current implementation of `debug_aranges` doesn't support emitting `segment` in the `(segment, address, length)` tuple. I will fix it in a follow-up patch.

Reviewed By: jhenderson

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

4 years ago[Darwin] Add tests for OS version checking
Julian Lettner [Thu, 21 May 2020 18:14:55 +0000 (11:14 -0700)]
[Darwin] Add tests for OS version checking

Extract ParseVersion helper function for testing.

Reviewed By: delcypher

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

4 years agoGlobalISel: Start defining strict FP instructions
Matt Arsenault [Sun, 31 May 2020 15:58:56 +0000 (11:58 -0400)]
GlobalISel: Start defining strict FP instructions

The AMDGPU lowering for unconstrained G_FDIV sometimes needs to
introduce a mode switch in the middle, so it's helpful to have
constrained instructions available to legalize this. Right now nothing
is preventing reordering of the mode switch with the other
instructions in the expansion.

4 years ago[RegisterCoalescer] Update empty subranges when rematerializing
Quentin Colombet [Wed, 3 Jun 2020 23:15:23 +0000 (16:15 -0700)]
[RegisterCoalescer] Update empty subranges when rematerializing

When we rematerialize a value as part of the coalescing, we may
widen the register class of the destination register.
When this happens, updateRegDefUses may create additional subranges
to account for the wider register class.
The created subranges are empty and if they are not defined by
the rematerialized instruction we clean them up.
However, if they are defined by the rematerialized instruction but
unused, we failed to flag them as dead definition and would leave
them as empty live-range.
This is wrong because empty live-ranges don't interfere with anything,
thus if we don't fix them, we would fail to account that the
rematerialized instruction clobbers some lanes.

E.g., let us consider the following pseudo code:
def.lane_low64:reg128 = ldimm
newdef:reg32 = COPY def.lane_low64_low32

When rematerialization happens for newdef, we end up with:
newdef.lane_low64:reg128 = ldimm
 = use newdef.lane_low64_low32

Let's look at the live interval of newdef.
Before rematerialization, we would get:
newdef [defIdx, useIdx:0) 0@defIdx

Right after updateRegDefUses, newdef register class is widen to reg128
and the subrange definitions will be augmented to fill the subreg that
is used at the definition point, here lane_low64.
The resulting live interval would be:
newdef [newDefIdx, useIdx:0) 0@newDefIdx
 * lane_low64_high32 EMPTY
 * lane_low64_low32 [newDefIdx, useIdx:0)

Before this patch this would be the final status of the live interval.
Therefore we miss that lane_low64_high32 is actually live on the
definition point of newdef.

With this patch, after rematerializing, we check all the added subranges
and for the ones that are defined but empty, we flag them as dead def.
Thus, in that case, newdef would look like this:
newdef [newDefIdx, useIdx:0) 0@newDefIdx
 * lane_low64_high32 [newDefIdx, newDefIdxDead) ; <-- instead of EMPTY
 * lane_low64_low32 [newDefIdx, useIdx:0)

This fixes https://www.llvm.org/PR46154

4 years agoMake linter happy
Julian Lettner [Wed, 3 Jun 2020 23:59:59 +0000 (16:59 -0700)]
Make linter happy

Fixup for ba6b1b4353e33a7a36bcbad1d1c1157826197fd2.

4 years agoconsitfy and auto -> auto * a few places to clean up uses.
Eric Christopher [Wed, 3 Jun 2020 23:59:36 +0000 (16:59 -0700)]
consitfy and auto -> auto * a few places to clean up uses.

4 years agoAArch64/GlobalISel: Fix assert on call returning 0 sized type
Matt Arsenault [Sun, 31 May 2020 20:18:52 +0000 (16:18 -0400)]
AArch64/GlobalISel: Fix assert on call returning 0 sized type

I don't know why this is considered valid IR, but it probably should
not be.

4 years agoAMDGPU/GlobalISel: Handle uniform G_DYN_STACKALLOC
Matt Arsenault [Sat, 30 May 2020 15:04:15 +0000 (11:04 -0400)]
AMDGPU/GlobalISel: Handle uniform G_DYN_STACKALLOC

4 years agoGlobalISel: Fail expansion of G_DYN_STACKALLOC for StackGrowsUp
Matt Arsenault [Sat, 30 May 2020 14:54:43 +0000 (10:54 -0400)]
GlobalISel: Fail expansion of G_DYN_STACKALLOC for StackGrowsUp

4 years agolld: add basic static library search
Saleem Abdulrasool [Wed, 3 Jun 2020 19:20:35 +0000 (19:20 +0000)]
lld: add basic static library search

This is a very basic static library search addition. This is the pre-Xcode4
behaviour of searching all paths for the shared version before searching for
the static version of the library. This behaviour is supposed to be inverted
with `-search_paths_first` being the default. This adds the library search
with the intention of providing the setup to merge the paths into one path
and making it controllable by `OPT_search_paths_first`.

4 years ago[StackSafety,NFC] Add statistic counters
Vitaly Buka [Wed, 3 Jun 2020 23:12:08 +0000 (16:12 -0700)]
[StackSafety,NFC] Add statistic counters

4 years agoFix "Statistics are disabled"
Vitaly Buka [Wed, 3 Jun 2020 22:30:03 +0000 (15:30 -0700)]
Fix "Statistics are disabled"

There is no -DLLVM_ENABLE_STATS, only
-DLLVM_FORCE_ENABLE_STATS.
It was renamed by 6cf299cf01e4a83844126f7faf17cbeb78e88da9

4 years agoFix typo in filename comment.
Eric Christopher [Wed, 3 Jun 2020 21:20:46 +0000 (14:20 -0700)]
Fix typo in filename comment.

4 years ago[Statepoints][CGP] Minor parameter type cleanup
Philip Reames [Wed, 3 Jun 2020 22:21:11 +0000 (15:21 -0700)]
[Statepoints][CGP] Minor parameter type cleanup

4 years ago[AArch64][NFC] Regenerate arm64-rev.ll
Jessica Paquette [Wed, 3 Jun 2020 22:48:22 +0000 (15:48 -0700)]
[AArch64][NFC] Regenerate arm64-rev.ll

Test had some GISel stuff in it which was changed by 969d2d1ea94.

4 years ago[WebAssembly] Fix ISel crash in SIGN_EXTEND_INREG lowering
Thomas Lively [Wed, 3 Jun 2020 22:36:44 +0000 (15:36 -0700)]
[WebAssembly] Fix ISel crash in SIGN_EXTEND_INREG lowering

Summary:
The code previously assumed that the index of a vector extract was
constant, but this was not always true. This patch fixes the problem
by bailing out of the lowering if the index is nonconstant and also
replaces `static_cast`s in the lowering function with `cast`s because
the latter contain type-checking asserts that would make similar
issues easier to find and debug.

Reviewers: aheejin

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

Tags: #llvm

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

4 years ago[AArch64][GlobalISel] Add selection support for rev16, rev32, and rev64
Jessica Paquette [Tue, 2 Jun 2020 18:13:56 +0000 (11:13 -0700)]
[AArch64][GlobalISel] Add selection support for rev16, rev32, and rev64

This does three things:

1) Adds G_REV16, G_REV32, and G_REV64. These are equivalent to AArch64rev16,
   AArch64rev32, and AArch64rev64 respectively.

2) Adds support for producing G_REV64 in the postlegalizer combiner.
   We don't legalize any of the shuffles which could give us a G_REV32 or
   G_REV16 yet. Since the function for detecting the rev mask is lifted from
   AArch64ISelLowering, it should work for G_REV32 and G_REV16 when we get
   there.

3) Adds a selection test for a good portion of the patterns imported for the rev
   family. The only ones which are not tested are the ones with bitconvert.

This also does a little cleanup, and adds a struct for shuffle vector pseudo
matchdata. This lets us still use `applyShuffleVectorPseudo` rather than adding
a new function.

It should also make it a bit easier to port some of the other masks from
AArch64ISelLowering. (e.g. `isZIP_v_undef_Mask` and friends)

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

4 years agoFix bug in newly added VersionBase::operator>=
Julian Lettner [Wed, 3 Jun 2020 22:24:53 +0000 (15:24 -0700)]
Fix bug in newly added VersionBase::operator>=

Fixup for ba6b1b4353e33a7a36bcbad1d1c1157826197fd2.

4 years ago[Statepoint] Fix signed vs unsigned in index handling
Philip Reames [Wed, 3 Jun 2020 22:09:03 +0000 (15:09 -0700)]
[Statepoint] Fix signed vs unsigned in index handling

As noted in a comment on D80937, all of these are specified as unsigned values, but the verifier code was using signed.  Given the practical values involved, the different in range didn't matter, but we might as well clean it up.

4 years ago[AArch64][GlobalISel] Select uzp1 and uzp2
Jessica Paquette [Tue, 2 Jun 2020 16:30:04 +0000 (09:30 -0700)]
[AArch64][GlobalISel] Select uzp1 and uzp2

Porting the mask stuff for uzp1 and uzp2 from AArch64ISelLowering.

Add two custom opcodes: G_UZP1 and G_UZP2.

Produce them in the post-legalizer combiner when the mask checks out.

Tests:

- postlegalizer-combiner-uzp.mir verifies that we create G_UZP1 and G_UZP2.
The testcases that check that we create them come from neon-perm.ll.

- select-uzp.mir verifies that we can select G_UZP1 and G_UZP2.

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

4 years ago[mlir][StandardToSPIRV] Handle i1 case for lowering std.zexti to SPIR-V.
Hanhan Wang [Wed, 3 Jun 2020 22:00:33 +0000 (15:00 -0700)]
[mlir][StandardToSPIRV] Handle i1 case for lowering std.zexti to SPIR-V.

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

4 years agoIntroduce a "gc-live" bundle for the gc arguments of a statepoint
Philip Reames [Wed, 3 Jun 2020 21:56:24 +0000 (14:56 -0700)]
Introduce a "gc-live" bundle for the gc arguments of a statepoint

Currently, gc.relocates are defined in terms of indices into the statepoint's operand list. Given the gc args are at the end of a variable length list of operands, this makes interpreting their indices by hand a tad challenging. We can simplify the statepoint sequence and improve readability quite a bit by pulling these new operands into their own named operand bundle.

This patch defines a new operand bundle tag "gc-live". The semantics of the bundle are the same as the existing gc arguments of a statepoint. This patch simply introduces the definition and codegen for the bundle, future patches will migrate RS4GC to emitting the new form.

Interestingly, with this done and the recent migration to using deopt and gc-transition bundles, we really don't have much left in the statepoint itself. It really looks like the existing ID and flags fields are redundant; we have (existing!) attributes for all of them. I think we'll be able to reduce the gc.statepoint signature to simply a wrapped call (e.g. actual target and actual arguments).

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

4 years ago[mlir][Linalg] Add support for fusion between indexed_generic ops and tensor_reshape ops
Hanhan Wang [Wed, 3 Jun 2020 21:55:10 +0000 (14:55 -0700)]
[mlir][Linalg] Add support for fusion between indexed_generic ops and tensor_reshape ops

Summary:
The fusion for tensor_reshape is embedding the information to indexing maps,
thus the exising pattenr also works for indexed_generic ops.

Depends On D80347

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

4 years ago[mlir][Linalg] Add support for fusion between indexed_generic ops and generic ops...
Hanhan Wang [Wed, 3 Jun 2020 21:58:19 +0000 (14:58 -0700)]
[mlir][Linalg] Add support for fusion between indexed_generic ops and generic ops on tensors.

Summary:
Different from the fusion between generic ops, indices are involved. In this
context, we need to re-map the indices for producer since the fused op is built
on consumer's perspective. This patch supports all combination of the fusion
between indexed_generic ops and generic ops, which includes tests case:
  1) generic op as producer and indexed_generic op as consumer.
  2) indexed_generic op as producer and generic op as consumer.
  3) indexed_generic op as producer and indexed_generic op as consumer.

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

4 years ago[clangd] Fix forgotten propagation of AsnycPreamble flag
Kadir Cetinkaya [Wed, 3 Jun 2020 21:50:26 +0000 (23:50 +0200)]
[clangd] Fix forgotten propagation of AsnycPreamble flag

4 years ago[mlir] [VectorOps] Use 'vector.flat_transpose' for 2-D 'vector.tranpose'
aartbik [Wed, 3 Jun 2020 21:13:22 +0000 (14:13 -0700)]
[mlir] [VectorOps] Use 'vector.flat_transpose' for 2-D 'vector.tranpose'

Summary:
Progressive lowering of vector.transpose into an operation that
is closer to an intrinsic, and thus the hardware ISA. Currently
under the common vector transform testing flag, as we prepare
deploying this transformation in the LLVM lowering pipeline.

Reviewers: nicolasvasilache, reidtatge, andydavis1, ftynse

Reviewed By: nicolasvasilache, ftynse

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

Tags: #llvm, #mlir

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

4 years ago[lldb/Test] Python <3.5 requires **kwargs to come last
Jonas Devlieghere [Wed, 3 Jun 2020 21:53:30 +0000 (14:53 -0700)]
[lldb/Test] Python <3.5 requires **kwargs to come last

Thanks Martin Böhme for pointing this out.

4 years ago[lldb/Test] Remove un(used|needed|maintained) files from lldbsuite.
Jonas Devlieghere [Wed, 3 Jun 2020 20:14:08 +0000 (13:14 -0700)]
[lldb/Test] Remove un(used|needed|maintained) files from lldbsuite.

4 years agoAdd a test for preserving state on the non-expr thread across expression evaluation.
Jim Ingham [Wed, 3 Jun 2020 21:29:22 +0000 (14:29 -0700)]
Add a test for preserving state on the non-expr thread across expression evaluation.

There may be another test that tests this but I couldn't find one.

4 years ago[gn build] Port e636e6b79ac
LLVM GN Syncbot [Wed, 3 Jun 2020 21:16:03 +0000 (21:16 +0000)]
[gn build] Port e636e6b79ac

4 years ago[gn build] Port 7f50c15be5c
LLVM GN Syncbot [Wed, 3 Jun 2020 21:16:02 +0000 (21:16 +0000)]
[gn build] Port 7f50c15be5c

4 years ago[X86] Separate X86_CPU_TYPE_COMPAT_WITH_ALIAS from X86_CPU_TYPE_COMPAT. NFC
Craig Topper [Wed, 3 Jun 2020 18:57:03 +0000 (11:57 -0700)]
[X86] Separate X86_CPU_TYPE_COMPAT_WITH_ALIAS from X86_CPU_TYPE_COMPAT. NFC

Add a separate X86_CPU_TYPE_COMPAT_ALIAS that carries alias string
and the enum from X86_CPU_TYPE_COMPAT.

4 years ago[gn build] Fix link with ld.bfd and gold.
Nico Weber [Wed, 3 Jun 2020 21:05:34 +0000 (17:05 -0400)]
[gn build] Fix link with ld.bfd and gold.

lld's symbol resolution algorithm makes it not depend on
the order of object files and libraries, but ld.bfd and
gold require listing dependencies later on the link line.
Put {{libs}} after {{inputs}} so that e.g. -lpthreads
appears after the object files, not before it.

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

4 years agoReland "[WebAssembly] Eliminate range checks on br_tables"
Thomas Lively [Wed, 3 Jun 2020 21:04:59 +0000 (14:04 -0700)]
Reland "[WebAssembly] Eliminate range checks on br_tables"

This reverts commit 755a89591528b692315ad0325347e2fd4637271b.
Although I was not able to reproduce any test failures locally,
aheejin was able to reproduce them and found a fix, applied here.