platform/upstream/llvm.git
4 years agoFix ShapeBase.td
Sean Silva [Wed, 6 May 2020 17:37:07 +0000 (10:37 -0700)]
Fix ShapeBase.td

Summary:
- Add license header.
- Remove TODO about extracting ShapeBase.td

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

4 years ago[X86] getShuffleScalarElt - add CONCAT_VECTORS/INSERT_VECTOR_ELT support.
Simon Pilgrim [Wed, 6 May 2020 17:13:17 +0000 (18:13 +0100)]
[X86] getShuffleScalarElt - add CONCAT_VECTORS/INSERT_VECTOR_ELT support.

This helped fix some i686 vXi64 broadcast folds that were becoming v2Xi32 broadcasts because we didn't match the broadcast until after SimplifyDemandedBits worked out we only used the bottom 32-bits in PMUL(U)DQ and type legalization had split the original i64 load.

A couple of regressions occurred which required some fixups - adding concat_vectors(broadcast_load,broadcast_load) splat support and recognising (unnecessary) unary shuffles of already broadcasted vectors.

This came about as part of the work investigating vector load combining from shuffles for PR42550.

4 years ago[X86] getShuffleScalarElt - consistently use SDValue. NFC.
Simon Pilgrim [Wed, 6 May 2020 15:02:48 +0000 (16:02 +0100)]
[X86] getShuffleScalarElt - consistently use SDValue. NFC.

We never need to call this from anything but ISD::SHUFFLE_VECTOR or target shuffles so shouldn't need to address SDNode directly.

4 years ago[InstCombine] limit bitcast+insertelement transform to x86 MMX type
Sanjay Patel [Wed, 6 May 2020 15:24:59 +0000 (11:24 -0400)]
[InstCombine] limit bitcast+insertelement transform to x86 MMX type

This is unusual for the general case because we are replacing
1 instruction with 2.

Splitting from a potential conflicting transform in D79171

4 years ago[Sema] Allow function attribute patchable_function_entry on aarch64_be
Fangrui Song [Wed, 6 May 2020 15:31:28 +0000 (08:31 -0700)]
[Sema] Allow function attribute patchable_function_entry on aarch64_be

Reviewed By: nickdesaulniers

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

4 years ago[SVE] Fix invalid uses of VectorType::getNumElements() in ValueTracking
Christopher Tetreault [Wed, 6 May 2020 16:53:57 +0000 (09:53 -0700)]
[SVE] Fix invalid uses of VectorType::getNumElements() in ValueTracking

Summary:
Any function in this module that make use of DemandedElts laregely does
not work with scalable vectors. DemandedElts is used to define which
elements of the vector to look at. At best, for scalable vectors, we can
express the first N elements of the vector. However, in practice, most
code that uses these functions expect to be able to talk about the
entire vector. In principle, this module should be able to be extended
to work with scalable vectors. However, before we can do that, we should
ensure that it does not cause code with scalable vectors to miscompile.
All functions that use a DemandedElts will bail out if the vector is
scalable. Usages of getNumElements() are updated to go through
FixedVectorType pointers.

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

Reviewed By: efriedma

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

Tags: #llvm

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

4 years ago[clangd] Reland 'Handle PresumedLocations in IncludeCollector'
Kadir Cetinkaya [Wed, 6 May 2020 14:20:31 +0000 (16:20 +0200)]
[clangd] Reland 'Handle PresumedLocations in IncludeCollector'

Summary:
This will enable extraction of correct line locations in preamble patch
for includes.

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

4 years agoInstCombine: Fix return after else
Matt Arsenault [Tue, 5 May 2020 15:47:43 +0000 (11:47 -0400)]
InstCombine: Fix return after else

4 years ago[libc++] Make sure the cin/wcin tests run on remote hosts
Louis Dionne [Wed, 6 May 2020 14:42:02 +0000 (10:42 -0400)]
[libc++] Make sure the cin/wcin tests run on remote hosts

When running on remote hosts, we need the whole `echo 123 | %t.exe` command
to run on the remote host. Thus, we need to escape the pipe to make sure
the command is treated as `{ echo 123 | %t.exe } > %t.out` instead of
`{ echo 123 } | %t.exe > %t.out`m where only `echo 123` is run on the
remote host.

4 years ago[libc++] NFC: Do not print the environment on remote hosts
Louis Dionne [Wed, 6 May 2020 14:35:02 +0000 (10:35 -0400)]
[libc++] NFC: Do not print the environment on remote hosts

Running `export` when there is no environment variable to export will
cause the environment on the remote host to be printed. We don't want
that, so don't run any `export` command on the host when there's no env.

4 years agoRevert "[MIR] Fix a bug in MIR printer."
Michael Liao [Wed, 6 May 2020 15:26:33 +0000 (11:26 -0400)]
Revert "[MIR] Fix a bug in MIR printer."

This reverts commit e38018b80d8e60206268740c688236734dea7b86.

4 years ago[AMDGPU] Drop 16 bit subreg suffixes on print
Stanislav Mekhanoshin [Tue, 5 May 2020 17:25:54 +0000 (10:25 -0700)]
[AMDGPU] Drop 16 bit subreg suffixes on print

We do not want to break asm syntax. These suffixes are
quite useful for debugging, so add an option to print
them. Right now it is NFC.

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

4 years ago[AMDGPU] Don't implement GCNHazardRecognizer::PreEmitNoops(SUnit *)
Jay Foad [Wed, 6 May 2020 10:16:57 +0000 (11:16 +0100)]
[AMDGPU] Don't implement GCNHazardRecognizer::PreEmitNoops(SUnit *)

When called from the post-RA scheduler, hazards have already been
handled by getHazardType returning NoopHazard, so PreEmitNoops always
returns zero. Remove it. NFC.

Historical note: PreEmitNoops was added to the hazard recognizer
interface as an optional feature to support dispatch group formation on
the POWER target:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20131202/197470.html
So it seems right that we shouldn't need to implement it.

We do still implement the other overload PreEmitNoops(MachineInstr *)
because that is used by the PostRAHazardRecognizer pass.

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

4 years ago[RISCV][NFC] Add more constant materialization tests
Luís Marques [Wed, 6 May 2020 15:04:37 +0000 (16:04 +0100)]
[RISCV][NFC] Add more constant materialization tests

This patch adds more constant materialization tests, focusing on cases where
we could improve our materialization instruction sequences (particularly for
RV64). Various of these cases will be improved upon in follow-up patches.

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

4 years agoAdd support for #pragma clang fp reassociate(on|off)
Melanie Blower [Mon, 4 May 2020 17:48:12 +0000 (10:48 -0700)]
Add support for #pragma clang fp reassociate(on|off)

Reviewers: rjmccall, erichkeane, sepavloff

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

4 years ago[ARM] VMOVhr load -> vldr
David Green [Wed, 6 May 2020 14:41:32 +0000 (15:41 +0100)]
[ARM] VMOVhr load -> vldr

Much like the similar combine added recently for VMOVrh load, this
adds a fold for VMOVhr load turning it into a vldr.f16 as opposed to a
vldrh and vmov.f16.

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

4 years ago[MIR] Fix a bug in MIR printer.
Michael Liao [Wed, 6 May 2020 06:21:46 +0000 (02:21 -0400)]
[MIR] Fix a bug in MIR printer.

- Need to skip the assignment of `ID`, which is used to index that two
  object arrays.

4 years agoFor PAL, make sure Scratch Buffer Descriptor do not clobber GIT pointer
Ram Nalamothu [Thu, 30 Apr 2020 18:25:24 +0000 (18:25 +0000)]
For PAL, make sure Scratch Buffer Descriptor do not clobber GIT pointer

Since SRSRC has alignment requirements, first find non GIT pointer clobbered
registers for SRSRC and then if those registers clobber preloaded Scratch Wave
Offset register, copy the Scratch Wave Offset register to a free SGPR.

4 years ago[DAGCombiner] sink target-supported FP<->int cast op after concat vectors
Sanjay Patel [Wed, 6 May 2020 14:23:43 +0000 (10:23 -0400)]
[DAGCombiner] sink target-supported FP<->int cast op after concat vectors

Try to combine N short vector cast ops into 1 wide vector cast op:
concat (cast X), (cast Y)... -> cast (concat X, Y...)

This is part of solving PR45794:
https://bugs.llvm.org/show_bug.cgi?id=45794

As noted in the code comment, this is uglier than I was hoping because
the opcode determines whether we pass the source or destination type
to isOperationLegalOrCustom(). Also IIUC, there's no way to validate
what the other (dest or src) type is. Without the extra legality check
on that, there's an ARM regression test in:
test/CodeGen/ARM/isel-v8i32-crash.ll
...that will crash trying to lower an unsupported v8f32 to v8i16.

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

4 years ago[X86][SSE] combineX86ShuffleChain - remove unused shuffle(vzext_load(),undef) combine.
Simon Pilgrim [Wed, 6 May 2020 13:52:02 +0000 (14:52 +0100)]
[X86][SSE] combineX86ShuffleChain - remove unused shuffle(vzext_load(),undef) combine.

This should always be caught by the various VZEXT_MOVL handling in combineTargetShuffle and SimplifyDemandedVectorEltsForTargetNode.

4 years agoAMDGPU: Insert kernarg code after allocas
Matt Arsenault [Tue, 5 May 2020 00:41:04 +0000 (20:41 -0400)]
AMDGPU: Insert kernarg code after allocas

This produces more normal looking IR by keeping all the allocas
clustered at the start of the block.

4 years ago[ARM] VMOVrh of VMOVhr
David Green [Wed, 6 May 2020 14:02:54 +0000 (15:02 +0100)]
[ARM] VMOVrh of VMOVhr

A VMOVhr of a VMOVrh can be simply folded to the original HPR value.

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

4 years ago[libc++] Fix broken modules tests on single-threaded systems
Louis Dionne [Wed, 6 May 2020 13:58:26 +0000 (09:58 -0400)]
[libc++] Fix broken modules tests on single-threaded systems

Since c0cd106fcc9f, we add __config_site macro defines to the compiler
command line whether we are building with modules or not. This means
that the modules tests are expected to fail on single-threaded systems
whether we build with modules or not.

4 years ago[VectorCombine] add tests for possible scalarization; NFC
Sanjay Patel [Tue, 5 May 2020 21:40:45 +0000 (17:40 -0400)]
[VectorCombine] add tests for possible scalarization; NFC

4 years agoImplement _ExtInt ABI for all ABIs in Clang, enable type for ABIs
Erich Keane [Wed, 29 Apr 2020 19:48:07 +0000 (12:48 -0700)]
Implement _ExtInt ABI for all ABIs in Clang, enable type for ABIs

This is the result of an audit of all of the ABIs in clang to implement
and enable the type for those targets.

Additionally, this finds an issue with integer-promotion passing for a
few platforms when using _ExtInt of < int, so this also corrects that
resulting in signext/zeroext being on a params of those types in some
platforms.

Differential Revisions: https://reviews.llvm.org/D79118

4 years ago[ARM] Extract from a VDUP
David Green [Wed, 6 May 2020 12:58:17 +0000 (13:58 +0100)]
[ARM] Extract from a VDUP

If we get into the situation where we are extracting from a VDUP, the
extracted value is just the origin, so long as the types match or we can
bitcast between the two.

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

4 years ago[clangd] Do not offer "Add using" tweak in header files.
Adam Czachorowski [Wed, 6 May 2020 13:46:56 +0000 (15:46 +0200)]
[clangd] Do not offer "Add using" tweak in header files.

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

4 years agoCheck type for forward reference definition
Renato Golin [Tue, 5 May 2020 09:03:26 +0000 (10:03 +0100)]
Check type for forward reference definition

The types of forward references are checked that they match with other
uses, but they do not check they match with the definition.

    func @forward_reference_type_check() -> (i8) {
      br ^bb2

    ^bb1:
      return %1 : i8

    ^bb2:
      %1 = "bar"() : () -> (f32)
      br ^bb1
    }

Would be parsed and the use site of '%1' would be silently changed to
'f32'.

This commit adds a test for this case, and a check during parsing for
the types to match.

Patch by Matthew Parkinson <mattpark@microsoft.com>

Closes D79317.

4 years ago[ARM] Convert a bitcast VDUP to a VDUP
David Green [Wed, 6 May 2020 13:06:02 +0000 (14:06 +0100)]
[ARM] Convert a bitcast VDUP to a VDUP

The idea, under MVE, is to introduce more bitcasts around VDUP's in an
attempt to get the type correct across basic block boundaries. In order
to do that without other regressions we need a few fixups, of which this
is the first. If the code is a bitcast of a VDUP, we can convert that
straight into a VDUP of the new type, so long as they have the same
size.

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

4 years ago[Debug][CodeView] Emit fully qualified names for globals
Alexandre Ganea [Wed, 6 May 2020 13:11:46 +0000 (09:11 -0400)]
[Debug][CodeView] Emit fully qualified names for globals

Emit S_[L|G][THREAD32|DATA32] records with a fully qualified name (namespace + class scope).

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

4 years ago[Support] Silence warning: comparison of integers of different signs: 'const int...
Alexandre Ganea [Tue, 5 May 2020 20:01:36 +0000 (16:01 -0400)]
[Support] Silence warning: comparison of integers of different signs: 'const int' and 'const unsigned long'

4 years ago[InstrProf] Silence warnings when targeting x86 with VS2019 16.5.4
Alexandre Ganea [Mon, 4 May 2020 22:14:25 +0000 (18:14 -0400)]
[InstrProf] Silence warnings when targeting x86 with VS2019 16.5.4

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

4 years ago[Sema] Silence warnings when targeting x86 with VS2019 16.5.4
Alexandre Ganea [Mon, 4 May 2020 22:12:52 +0000 (18:12 -0400)]
[Sema] Silence warnings when targeting x86 with VS2019 16.5.4

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

4 years ago[mlir] Add a MemRefCastOp canonicalization pattern.
Nicolas Vasilache [Wed, 6 May 2020 13:05:15 +0000 (09:05 -0400)]
[mlir] Add a MemRefCastOp canonicalization pattern.

Summary:
This revision adds a conservative canonicalization pattern for MemRefCastOp that are typically inserted during ViewOp and SubViewOp canonicalization.
Ideally such canonicalizations would propagate the type to consumers but this is not a local behavior. As a consequence MemRefCastOp are introduced to keep type compatibility but need to be cleaned up later, in the case where more dynamic behavior than necessary is introduced.

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

4 years ago[X86][SSE] Move VZEXT_MOVL removal into SimplifyDemandedVectorEltsForTargetNode
Simon Pilgrim [Wed, 6 May 2020 12:58:46 +0000 (13:58 +0100)]
[X86][SSE] Move VZEXT_MOVL removal into SimplifyDemandedVectorEltsForTargetNode

This patch replaces the VZEXT_MOVL removal from combineShuffle with a more general version based in SimplifyDemandedVectorEltsForTargetNode.

By using computeKnownBits we can always remove the VZEXT_MOVL if the upper elements of the source operand are known to be zero.

This requires us to add the conversion ops to computeKnownBitsForTargetNode as well.

Reviewed By: @craig.topper

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

4 years ago[X86][SSE] getShuffleScalarElt - minor NFC cleanup.
Simon Pilgrim [Tue, 5 May 2020 17:34:45 +0000 (18:34 +0100)]
[X86][SSE] getShuffleScalarElt - minor NFC cleanup.

Use SelectionDAG::MaxRecursionDepth instead of (equal) hard coded constant.

clang-format

4 years agoReland "[CodeGen] Make logic of CCState::resultsCompatible clearer"
David Spickett [Wed, 6 May 2020 12:19:52 +0000 (13:19 +0100)]
Reland "[CodeGen] Make logic of CCState::resultsCompatible clearer"

This relands commit d782d1f898eaafee49548d5332e84c3ae11ebac4.
With a typo fixed, which was causing the x86 test failure.

4 years ago[lldb][NFC] Remove some redundant comment containing just the file name
Raphael Isemann [Wed, 6 May 2020 11:58:25 +0000 (13:58 +0200)]
[lldb][NFC] Remove some redundant comment containing just the file name

4 years ago[Sema][SVE] Fix handling of initialisers for built-in SVE types
Richard Sandiford [Mon, 2 Mar 2020 18:33:12 +0000 (18:33 +0000)]
[Sema][SVE] Fix handling of initialisers for built-in SVE types

The built-in SVE types are supposed to be treated as opaque types.
This means that for initialisation purposes they should be treated
as a single unit, much like a scalar type.

However, as Eli pointed out, actually using "scalar" in the diagnostics
is likely to cause confusion, given the types are logically vectors.
The patch therefore uses custom diagnostics or generalises existing
ones.  Some of the messages use the word "indivisible" to try to make
it clear(er) that these types can't be initialised elementwise.

I don't think it's possible to trigger warn_braces_around_(scalar_)init
for sizeless types as things stand, since the types can't be used as
members or elements of more complex types.  But it seemed better to be
consistent with ext_many_braces_around_(scalar_)init, so the patch
changes it anyway.

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

4 years agoRevert "[clangd] Handle PresumedLocations in IncludeCollector"
Kadir Cetinkaya [Wed, 6 May 2020 11:16:50 +0000 (13:16 +0200)]
Revert "[clangd] Handle PresumedLocations in IncludeCollector"

This reverts commit 4f7917c269d65cd3c85eddee19385861c4b8390c as it is
breaking windows build bots.

4 years ago[analyzer] Stability improvement for IteratorModeling
Denys Petrov [Wed, 6 May 2020 11:16:39 +0000 (14:16 +0300)]
[analyzer] Stability improvement for IteratorModeling

Summary:
Some function path may lead to crash.
Fixed using local variable outside the scope  through a pointer.
Fixed minor misspellings.
Added regression test.

This patch covers a bug https://bugs.llvm.org/show_bug.cgi?id=41485

Reviewed By: baloghadamsoftware

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

4 years ago[AMDGPU][MC][GFX9+] Enabled 21-bit signed offsets for SMEM instructions
Dmitry Preobrazhensky [Wed, 6 May 2020 11:11:02 +0000 (14:11 +0300)]
[AMDGPU][MC][GFX9+] Enabled 21-bit signed offsets for SMEM instructions

Reviewers: arsenm, rampitec

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

4 years ago[clangd] Handle PresumedLocations in IncludeCollector
Kadir Cetinkaya [Thu, 23 Apr 2020 15:48:47 +0000 (17:48 +0200)]
[clangd] Handle PresumedLocations in IncludeCollector

Summary:
This will enable extraction of correct line locations in preamble patch
for includes.

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[PowerPC] Fix missing GOT indirect variant kind
Stefan Pintilie [Wed, 6 May 2020 10:19:09 +0000 (05:19 -0500)]
[PowerPC] Fix missing GOT indirect variant kind

The function MCSymbolRefExpr::getVariantKindForName was missing the entry for
VK_PPC_GOT_PCREL. This patch adds the missing entry.

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

4 years ago[lldb] Warn the user about starting the --func-regex parameter with an asterisk
Raphael Isemann [Wed, 6 May 2020 10:21:53 +0000 (12:21 +0200)]
[lldb] Warn the user about starting the --func-regex parameter with an asterisk

Summary:
Sometimes users think that setting a function regex for all function that contain the word 'needle' in their
name looks like this: `*needle*`. However, LLDB only searches the function name and doesn't fully match
it against the regex, so the leading and trailing '*' operators don't do anything and actually just cause the
regex engine to reject the regular expression with "repetition-operator operand invalid".

This patch makes this a bit more obvious to the user by printing a warning that a leading '*' before this
regular expression here doesn't have any purpose (and will cause an error). This doesn't attempt to detect
a case where there is only a trailing '*' as that would involve parsing the regex and it seems the most
common way to end up in this situation is by doing `rbreak *needle*`.

Reviewers: JDevlieghere

Reviewed By: JDevlieghere

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

4 years ago[clang-tidy]: Add cert-str34-c alias for bugprone-signed-char-misuse.
Tamás Zolnai [Wed, 6 May 2020 08:45:03 +0000 (10:45 +0200)]
[clang-tidy]: Add cert-str34-c alias for bugprone-signed-char-misuse.

Summary:
Added `DiagnoseSignedUnsignedCharComparisons` option to
filter out unrelated use cases. The SEI cert catches explicit
integer casts (two use cases), while in the case of
`signed char` \ `unsigned char` comparison, we have implicit
conversions.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

4 years ago[Sema] Put existing warning under -Wexcess-initializers
Richard Sandiford [Fri, 1 May 2020 13:26:34 +0000 (14:26 +0100)]
[Sema] Put existing warning under -Wexcess-initializers

I have a follow-on patch that uses an alternative wording for
ext_excess_initializers in some cases.  This patch puts it and
a couple of related warnings under their own -W option in order
to avoid a regression in Misc/warning-flags.c.

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

4 years agoFix misleading comments.
Jay Foad [Wed, 6 May 2020 10:07:45 +0000 (11:07 +0100)]
Fix misleading comments.

4 years ago[clang] Fix a crash on invalid auto.
Haojian Wu [Wed, 6 May 2020 06:56:42 +0000 (08:56 +0200)]
[clang] Fix a crash on invalid auto.

Summary:
The crash is triggered on accessing a null InitExpr.

For group declaration, e.g. `auto c = a, &d = {a};`, what's happening:

1. each VarDecl is built separately during the parsing stage.
2. perform the semantic analysis (Sema::BuildDeclaratorGroup) to check
whether the type of the two VarDecl is the same, if not mark it as invalid.

in step 1, VarDecl c and d are built, both of them are valid (after D77395),
but d is without the InitExpr attached (under -fno-recovery-ast), crash
happens in step 2 when accessing the source range of d's InitExpr.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[docs] Regenerate DiagnosticsReference.rst
Richard Sandiford [Fri, 1 May 2020 15:14:18 +0000 (16:14 +0100)]
[docs] Regenerate DiagnosticsReference.rst

It looks like it has been a while since the checked-in version of
DiagnosticsReference.rst was regenerated.  I realise there probably
isn't any expectation that the checked-in version is kept up-to-date,
but now that the project is on github and the rst can be viewed directly
from the repo's web interface, it seemed worth having something a bit
more recent.

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

4 years agoQuiet some -Wdocumentation warnings.
Benjamin Kramer [Wed, 6 May 2020 09:22:31 +0000 (11:22 +0200)]
Quiet some -Wdocumentation warnings.

4 years agoRevert "[CodeGen] Make logic of CCState::resultsCompatible clearer"
David Spickett [Wed, 6 May 2020 09:13:20 +0000 (10:13 +0100)]
Revert "[CodeGen] Make logic of CCState::resultsCompatible clearer"

This reverts commit d782d1f898eaafee49548d5332e84c3ae11ebac4
which caused test CodeGen/X86/sibcall.ll to fail.

4 years agoFix error handling after [<index>] in 'frame variable'
Jaroslav Sevcik [Wed, 6 May 2020 08:59:32 +0000 (10:59 +0200)]
Fix error handling after [<index>] in 'frame variable'

Summary:
This fixes a bug where

frame var a[0]+5

returns the value a[0] without any warning because the current logic simply ignores everything after ']' as long as there is no '.', '-' or '[' in the rest of the string.

The fix simplifies the termination condition of the expression path parsing loop to check if have a non-empty remaining string to parse. Previously, the condition checked if a separator was found. That condition coincided with the remaining string-to-parse condition except for the buggy indexed case where non-empty string was left ("+5" in the example above), but the separator index was 'npos'.

Reviewed By: teemperor, labath

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

4 years ago[llvm-nm/objdump/size] Add tests for dumping symbol tables with invalid sh_size.
Xing GUO [Wed, 6 May 2020 09:00:55 +0000 (17:00 +0800)]
[llvm-nm/objdump/size] Add tests for dumping symbol tables with invalid sh_size.

This change adds tests for llvm-nm, llvm-objdump and llvm-size when dumping symbol tables with invalid sh_size (sh_size % sizeof(Elf_Sym) != 0).

Reviewed By: jhenderson, MaskRay

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

4 years ago[CodeGen] Make logic of CCState::resultsCompatible clearer
David Spickett [Wed, 6 May 2020 08:48:58 +0000 (09:48 +0100)]
[CodeGen] Make logic of CCState::resultsCompatible clearer

4 years ago[libc] Change target name for testing benchmark utils infrastructure.
Paula Toth [Wed, 6 May 2020 08:21:38 +0000 (01:21 -0700)]
[libc] Change target name for testing benchmark utils infrastructure.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: gchatelet, mgorny, tschuett, libc-commits

Tags: #libc-project

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

4 years ago[GlobalISel][InlineAsm] Add support for basic output operand constraints
Konstantin Schwarz [Wed, 8 Apr 2020 18:04:13 +0000 (20:04 +0200)]
[GlobalISel][InlineAsm] Add support for basic output operand constraints

Reviewers: arsenm, dsanders, aemerson, volkan, t.p.northover, paquette

Reviewed By: arsenm

Subscribers: gargaroff, wdng, rovka, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoFix ForRangeCopyCheck not triggering on iterators returning elements by value in...
Dmitri Gribenko [Wed, 6 May 2020 06:50:40 +0000 (08:50 +0200)]
Fix ForRangeCopyCheck not triggering on iterators returning elements by value in C++17.

Summary:
The AST is different in C++17 in that there is no MaterializeTemporaryExpr for in the AST for a loop variable that is initialized from an iterator that returns its elements by value.

Account for this by checking that the variable is not initialized by an operator* call that returns a value type.

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[MLIR][NFC] Fix/update debug messages for analysis utils and affine fusion
Uday Bondhugula [Wed, 6 May 2020 06:17:16 +0000 (11:47 +0530)]
[MLIR][NFC] Fix/update debug messages for analysis utils and affine fusion

Drop trailing period in debug messages. Add an extra line for fusion
debug info.

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

4 years ago[local-bounds] Ignore volatile operations
Vitaly Buka [Wed, 22 Apr 2020 02:22:00 +0000 (19:22 -0700)]
[local-bounds] Ignore volatile operations

Summary:
-fsanitize=local-bounds is very similar to ``object-size`` and
should also ignore volatile pointers.
https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#volatile

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits, hiraditya, llvm-commits

Tags: #llvm, #clang

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

4 years ago[lsan] Fix warnings lit config
Vitaly Buka [Wed, 6 May 2020 05:42:14 +0000 (22:42 -0700)]
[lsan] Fix warnings lit config

4 years ago[dfsan] Remove realloc from done_abilist.txt
Vitaly Buka [Wed, 6 May 2020 05:21:09 +0000 (22:21 -0700)]
[dfsan] Remove realloc from done_abilist.txt

Summary:
Currently, realloc is marked as "discard" in done_abilist.txt. As discussed in PR#45583, this is probably not the expected behavior; a custom wrapper seems to be required. Since this wrapper has not been implemented yet, realloc should not be in the done_abilist.txt file so that a warning is displayed when it is called.

Reviewers: kcc, pcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: #sanitizers

Tags: #sanitizers

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

4 years ago[X86] Add v32i16/v64i8 into the handling for 512-bit inline assembly constraints.
Craig Topper [Wed, 6 May 2020 04:16:51 +0000 (21:16 -0700)]
[X86] Add v32i16/v64i8 into the handling for 512-bit inline assembly constraints.

4 years ago[libclang] Remove duplicate dependency on LLVMSupport
Jan Korous [Tue, 5 May 2020 22:42:33 +0000 (15:42 -0700)]
[libclang] Remove duplicate dependency on LLVMSupport

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

4 years ago[Attributor][NFC] Cleanup some AAMemoryLocation code
Johannes Doerfert [Tue, 5 May 2020 20:14:36 +0000 (15:14 -0500)]
[Attributor][NFC] Cleanup some AAMemoryLocation code

This is the first step to resolve a TODO in AAMemoryLocation and to fix
a bug we have when handling `byval` arguments of `readnone` call sites.

No functional change intended.

4 years ago[Attributor][NFC] Minor code cleanups to minimize follow up diffs
Johannes Doerfert [Tue, 5 May 2020 16:20:08 +0000 (11:20 -0500)]
[Attributor][NFC] Minor code cleanups to minimize follow up diffs

4 years ago[Attributor][NFC] Avoid dependences on known information
Johannes Doerfert [Tue, 5 May 2020 16:18:03 +0000 (11:18 -0500)]
[Attributor][NFC] Avoid dependences on known information

4 years ago[X86] Allow Yz inline assembly constraint to choose ymm0 or zmm0 when avx/avx512...
Craig Topper [Wed, 6 May 2020 02:47:39 +0000 (19:47 -0700)]
[X86] Allow Yz inline assembly constraint to choose ymm0 or zmm0 when avx/avx512 are enabled and type is 256 or 512 bits

gcc supports selecting ymm0/zmm0 for the Yz constraint when used with 256 or 512 bit vector types.

Fixes PR45806

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

4 years ago[NFC] Outliner label name clean up.
Puyan Lotfi [Wed, 6 May 2020 03:25:13 +0000 (23:25 -0400)]
[NFC] Outliner label name clean up.

Just simplifying how the label name is generated while using
std::to_string instead of Twine.

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

4 years ago[AArch64][GlobalISel] Fold shifts into G_ICMP
Jessica Paquette [Fri, 1 May 2020 23:57:12 +0000 (16:57 -0700)]
[AArch64][GlobalISel] Fold shifts into G_ICMP

Since G_ICMP can be selected to a SUBS, we can fold shifts into such compares.

E.g.

```
cmp w1, w0, lsl #3
cmp w1, w0, lsr #3
cmp w1, w0, asr #3
```

This is done the same way as for adds and subtracts, using
`selectShiftedRegister`.

This gives some minor code size savings on CTMark.

https://reviews.llvm.org/D79365

4 years ago[llvm-profdata] Support -detailed-summary for Sample Profile
Wenlei He [Sat, 2 May 2020 15:34:10 +0000 (08:34 -0700)]
[llvm-profdata] Support -detailed-summary for Sample Profile

Summary: Add -detailed-summary support for sample profile dump to match that of instrumentation profile.

Reviewers: wmi, davidxl, hoyFB

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoFix SelectionDAG Graph Printing on Windows
Justice Adams [Tue, 5 May 2020 23:58:44 +0000 (16:58 -0700)]
Fix SelectionDAG Graph Printing on Windows

Currently, when compiling to IR (presumably at the clang level) LLVM
mangles symbols and sometimes they have illegal file characters
including `?`'s in them. This causes a problem when building a graph via
llc on Windows because the code currently passes the machine function
name all the way down to the Windows API which frequently returns error
123  **ERROR_INVALID_NAME**
https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-

Thus, we need to remove those illegal characters from the machine
function name before generating a graph, which is the purpose of this
patch.
https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file

I've created a static helper function replace_illegal_filename_chars
which within GraphWriter.cpp to help with replacing illegal file
character names before generating a dot graph filename.

Reviewed By: rnk

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

4 years ago[lldb/Utils] Serialize exit code in lldb-repro.py
Jonas Devlieghere [Tue, 5 May 2020 22:59:43 +0000 (15:59 -0700)]
[lldb/Utils] Serialize exit code in lldb-repro.py

After 61d5b0e66394 more shell test are expected to exit with a non-zero
status code. Because the exit status is computed in the driver and not
behind the SB API layer, reproducers don't know about it and always
return 0 unless replay failed.

This discrepancy means that these tests don't work with lldb-repro.py
and skipping them for this reason would be a pity. To solve this
problem, the script now serializes the exit code during capture and
returns that during replay.

These is an assert that ensures that replay exits with a zero exit
status to prevent replay failures from being silently ignored.

4 years agoReapply "NFC: utils/perf-training: Python 3 compatibility for lit.cfg"
Azharuddin Mohammed [Tue, 5 May 2020 22:08:12 +0000 (15:08 -0700)]
Reapply "NFC: utils/perf-training: Python 3 compatibility for lit.cfg"

This is in response to the recent move to Python 3.

This reverts commit 5f4426e517fc26d10db2fd09f3e254e80446d62d.

4 years agoLog the NSError str and object description on app launch fail
Jason Molenda [Tue, 5 May 2020 22:48:46 +0000 (15:48 -0700)]
Log the NSError str and object description on app launch fail

Update CallBoardSystemServiceOpenApplication to unconditionally log
the NSError's localizedDescription to Console on app launch failure
(as it was already doing), and also to log the NSError object's
full description to the console, which may contain additional nested
error messages.  I'm experimenting to find cases where we will get
more detailed information from app launch failures and will start
by logging both to the console.

<rdar://problem/62709160>

4 years ago[CUDA] Make NVVM builtins available with CUDA-11/PTX6.5
Artem Belevich [Tue, 5 May 2020 21:55:21 +0000 (14:55 -0700)]
[CUDA] Make NVVM builtins available with CUDA-11/PTX6.5

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

4 years ago[cmake] Allow std::filesystem tests in CrossWinToARMLinux.cmake
Sergej Jaskiewicz [Tue, 5 May 2020 22:10:57 +0000 (01:10 +0300)]
[cmake] Allow std::filesystem tests in CrossWinToARMLinux.cmake

Now that https://reviews.llvm.org/D78200 has landed, there should be
no problem with those tests. If there is, it is OK to revert this.

4 years ago[X86] Fix usage of Align constructing MachineMemOperands.
Craig Topper [Tue, 5 May 2020 21:40:01 +0000 (14:40 -0700)]
[X86] Fix usage of Align constructing MachineMemOperands.

Similar to D77687, but for the X86 specific code.

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

4 years ago[libc++] [test] Generate static_test_env on the fly
Sergej Jaskiewicz [Tue, 5 May 2020 22:22:55 +0000 (01:22 +0300)]
[libc++] [test] Generate static_test_env on the fly

Summary:
Instead of storing `static_test_env` (with all the symlinks) in the repo, we create it on the fly to be cross-toolchain-friendly. The primary use case for this are Windows-hosted cross-toolchains. Windows doesn't really have a concept of symlinks. So, when the monorepo is cloned, those symlinks turn to ordinary text files. Previously, if we cross-compiled libc++ for some symlink-friendly system (e. g. Linux) and ran tests on the target system, some tests would fail. This patch makes them pass.

Reviewers: ldionne, #libc

Reviewed By: ldionne, #libc

Subscribers: EricWF, dexonsmith, libcxx-commits

Tags: #libc

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

4 years agoRevert "[libc++] Generate symlinks in static_test_env on the fly"
Sergej Jaskiewicz [Tue, 5 May 2020 22:19:48 +0000 (01:19 +0300)]
Revert "[libc++] Generate symlinks in static_test_env on the fly"

This reverts commit 645ad5badbabdeca31de5c98ea8135c5a6e7d710.

This commit did not incorporate all the changes intended.

4 years ago[Support] Move LLD's parallel algorithm wrappers to support
Reid Kleckner [Tue, 5 May 2020 03:03:19 +0000 (20:03 -0700)]
[Support] Move LLD's parallel algorithm wrappers to support

Essentially takes the lld/Common/Threads.h wrappers and moves them to
the llvm/Support/Paralle.h algorithm header.

The changes are:
- Remove policy parameter, since all clients use `par`.
- Rename the methods to `parallelSort` etc to match LLVM style, since
  they are no longer C++17 pstl compatible.
- Move algorithms from llvm::parallel:: to llvm::, since they have
  "parallel" in the name and are no longer overloads of the regular
  algorithms.
- Add range overloads
- Use the sequential algorithm directly when 1 thread is requested
  (skips task grouping)
- Fix the index type of parallelForEachN to size_t. Nobody in LLVM was
  using any other parameter, and it made overload resolution hard for
  for_each_n(par, 0, foo.size(), ...) because 0 is int, not size_t.

Remove Threads.h and update LLD for that.

This is a prerequisite for parallel public symbol processing in the PDB
library, which is in LLVM.

Reviewed By: MaskRay, aganea

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

4 years ago[SVE] Fix invalid usage of getNumElements() in InstCombineMulDivRem
Christopher Tetreault [Tue, 5 May 2020 21:21:59 +0000 (14:21 -0700)]
[SVE] Fix invalid usage of getNumElements() in InstCombineMulDivRem

Summary:
getLogBase2 tries to iterate over the number of vector elements. Since
the number of elements of a scalable vector is unknown at compile time,
we must return null if the input type is scalable.

Identified by test LLVM.Transforms/InstCombine::nsw.ll

Reviewers: efriedma, fpetrogalli, kmclaughlin, spatel

Reviewed By: efriedma, fpetrogalli

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

Tags: #llvm

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

4 years ago[libc++] Generate symlinks in static_test_env on the fly
Sergej Jaskiewicz [Wed, 15 Apr 2020 13:21:27 +0000 (16:21 +0300)]
[libc++] Generate symlinks in static_test_env on the fly

Instead of storing static_test_env (with all the symlinks) in the repo,
we create it on the fly to be cross-toolchain-friendly. The primary
use case for this are Windows-hosted cross-toolchains. Windows doesn't
really have a concept of symlinks. So, when the monorepo is cloned,
those symlinks turn to ordinary text files. Previously, if we
cross-compiled libc++ for some symlink-friendly system (e. g. Linux) and
ran tests on the target system, some tests would fail. This patch makes
them pass.

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

4 years ago[clang/clang-tools-extra] Fix BZ44437 - add_new_check.py does not work with Python 3
Konrad Kleine [Tue, 5 May 2020 14:29:57 +0000 (10:29 -0400)]
[clang/clang-tools-extra] Fix BZ44437 - add_new_check.py does not work with Python 3

Summary:
This fixes https://bugs.llvm.org/show_bug.cgi?id=44437.

Thanks to Arnaud Desitter for providing the patch in the bug report!

A simple example program to reproduce this error is this:

```lang=python

import sys

with open(sys.argv[0], 'r') as f:
  lines = f.readlines()
lines = iter(lines)
line = lines.next()
print(line)
```

which will error with this in python python 3:

```
Traceback (most recent call last):
  File "./mytest.py", line 8, in <module>
    line = lines.next()
AttributeError: 'list_iterator' object has no attribute 'next'
```

Here's the same strategy applied to my test program as applied to the `add_new_check.py` file:

```lang=python

import sys

with open(sys.argv[0], 'r') as f:
  lines = f.readlines()
lines = iter(lines)
line = next(lines)
print(line)
```

The built-in function `next()` is new since Python 2.6: https://docs.python.org/2/library/functions.html#next

Subscribers: cfe-commits

Tags: #clang

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

4 years agoRevert D77954 -- it breaks Eigen & Tensorflow.
Artem Belevich [Tue, 5 May 2020 20:54:26 +0000 (13:54 -0700)]
Revert D77954 -- it breaks Eigen & Tensorflow.

This reverts commit 55bcb96f3154808bcb5afc3fb46d8e00bf1db847.

4 years ago[lldb/Test] Update expressions.test for non-zero exit code
Jonas Devlieghere [Tue, 5 May 2020 21:06:24 +0000 (14:06 -0700)]
[lldb/Test] Update expressions.test for non-zero exit code

Updates Windows test for 61d5b0e66394.

4 years ago[VFS][NFC] Fix typo in comment
Jan Korous [Tue, 5 May 2020 20:54:37 +0000 (13:54 -0700)]
[VFS][NFC] Fix typo in comment

4 years ago[AMDGPU] Added 'a' constraint documentation. NFC.
Stanislav Mekhanoshin [Tue, 5 May 2020 20:52:04 +0000 (13:52 -0700)]
[AMDGPU] Added 'a' constraint documentation. NFC.

AGPR inline asm constraint was missing from the LangRef.rst.

4 years ago[mlir][shape] Extract ShapeBase.td
Sean Silva [Tue, 5 May 2020 20:19:30 +0000 (13:19 -0700)]
[mlir][shape] Extract ShapeBase.td

4 years ago[MemorySSA] Make MemoryLocation unknown when phi translation cannot be performed.
Alina Sbirlea [Tue, 5 May 2020 00:25:14 +0000 (17:25 -0700)]
[MemorySSA] Make MemoryLocation unknown when phi translation cannot be performed.

Summary: When phi translation cannot be performed, be conservative and make the MemoryLocation unknown.

Reviewers: george.burgess.iv

Subscribers: Prazek, llvm-commits

Tags: #llvm

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

4 years ago[libc] Add no_sanitize("address") attribute to the getMPFRMatcher function.
Siva Chandra Reddy [Tue, 5 May 2020 20:06:49 +0000 (13:06 -0700)]
[libc] Add no_sanitize("address") attribute to the getMPFRMatcher function.

This dramtically reduces the run time of tests. For example,
sincosf_test takes over 25 minutes without this attribute but only 8
seconds with this attribute.

4 years ago[TestIndirectSymbol] This tests an Apple-specific feature.
Davide Italiano [Tue, 5 May 2020 20:13:46 +0000 (13:13 -0700)]
[TestIndirectSymbol] This tests an Apple-specific feature.

Remove a redundant check.

4 years ago[TestIndirectSymbols] This now runs and works on iOS (arm64).
Davide Italiano [Tue, 5 May 2020 20:13:16 +0000 (13:13 -0700)]
[TestIndirectSymbols] This now runs and works on iOS (arm64).

4 years ago[ValueTracking] fix CannotBeNegativeZero() to disregard 'nsz' FMF
Sanjay Patel [Tue, 5 May 2020 20:02:45 +0000 (16:02 -0400)]
[ValueTracking] fix CannotBeNegativeZero() to disregard 'nsz' FMF

The 'nsz' flag is different than 'nnan' or 'ninf' in that it does not create poison.
Make that explicit in the LangRef and fix ValueTracking analysis that misinterpreted
the definition.

This manifests as bugs in InstSimplify shown in the test diffs and as discussed in
PR45778:
https://bugs.llvm.org/show_bug.cgi?id=45778

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

4 years ago[mlir][DenseStringElementsAttr] Fix AttributeElementIterator in the case of a splat.
River Riddle [Tue, 5 May 2020 19:39:29 +0000 (12:39 -0700)]
[mlir][DenseStringElementsAttr] Fix AttributeElementIterator in the case of a splat.

4 years ago[mlir][DenseElementsAttr] Add support for opaque APFloat/APInt complex values.
River Riddle [Tue, 5 May 2020 19:39:22 +0000 (12:39 -0700)]
[mlir][DenseElementsAttr] Add support for opaque APFloat/APInt complex values.

This revision allows for creating DenseElementsAttrs and accessing elements using std::complex<APInt>/std::complex<APFloat>. This allows for opaquely accessing and transforming complex values. This is used by the printer/parser to provide pretty printing for complex values. The form for complex values matches that of std::complex, i.e.:

```
// `(` element `,` element `)`
dense<(10,10)> : tensor<complex<i64>>
```

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

4 years ago[mlir][DenseElementsAttr] Add support for ComplexType elements
River Riddle [Tue, 5 May 2020 19:39:12 +0000 (12:39 -0700)]
[mlir][DenseElementsAttr] Add support for ComplexType elements

This revision adds support for storing ComplexType elements inside of a DenseElementsAttr. We store complex objects as an array of two elements, matching the  definition of std::complex. There is no current attribute storage for ComplexType, but DenseElementsAttr provides API for access/creation using std::complex<>. Given that the internal implementation of DenseElementsAttr is already fairly opaque, the only real complexity here is in the printing/parsing. This revision keeps it simple for now and always uses hex when printing complex elements. A followup will add prettier syntax for this.

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

4 years ago[MLIR] mlir-opt needs PUBLIC dependence
Stephen Neuendorffer [Tue, 5 May 2020 19:26:48 +0000 (12:26 -0700)]
[MLIR] mlir-opt needs PUBLIC dependence

We see intermittent build errors on the windows buildbot because
mlir-opt is including Linalg headers which haven't been built yet.
This dependence should be resolved by declaring a PUBLIC dependence
on the Linalg library when building MLIROptMain.

4 years ago[clang][codegen] Hoist parameter attribute setting in function prolog.
Michael Liao [Tue, 5 May 2020 04:55:13 +0000 (00:55 -0400)]
[clang][codegen] Hoist parameter attribute setting in function prolog.

Summary:
- If the coerced type is still a pointer, it should be set with proper
  parameter attributes, such as `noalias`, `nonnull`, and etc. Hoist
  that (pointer) parameter attribute setting so that the coerced pointer
  parameter could be marked properly.

Depends on D79394

Reviewers: rjmccall, kerbowa, yaxunl

Subscribers: jvesely, nhaehnle, cfe-commits

Tags: #clang

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

4 years ago[clang][codegen] Refactor argument loading in function prolog. NFC.
Michael Liao [Tue, 5 May 2020 03:53:24 +0000 (23:53 -0400)]
[clang][codegen] Refactor argument loading in function prolog. NFC.

Summary:
- Skip copying function arguments and unnecessary casting by using them
  directly.

Reviewers: rjmccall, kerbowa, yaxunl

Subscribers: cfe-commits

Tags: #clang

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