platform/upstream/llvm.git
4 years ago[analyzer] Allow bindings of the CompoundLiteralRegion
Valeriy Savchenko [Tue, 28 Apr 2020 09:21:39 +0000 (12:21 +0300)]
[analyzer] Allow bindings of the CompoundLiteralRegion

Summary:
CompoundLiteralRegions have been properly modeled before, but
'getBindingForElement` was not changed to accommodate this change
properly.

rdar://problem/46144644

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

4 years ago[yaml2obj] - Implement the "SectionHeaderTable" tag.
Georgii Rymar [Thu, 14 May 2020 11:15:40 +0000 (14:15 +0300)]
[yaml2obj] - Implement the "SectionHeaderTable" tag.

With the "SectionHeaderTable" it is now possible to reorder
entries in the section header table.

It also allows to stop emitting the table.

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

4 years ago[DebugInfo] Use SplitTemplateClosers (foo<bar<baz> >) in DWARF too
Sam McCall [Tue, 26 May 2020 13:43:52 +0000 (15:43 +0200)]
[DebugInfo] Use SplitTemplateClosers (foo<bar<baz> >) in DWARF too

Summary:
D76801 caused some regressions in debuginfo compatibility by changing how
certain functions were named.

For CodeView we try to mirror MSVC exactly: this was fixed in a549c0d00486
For DWARF the situation is murkier. Per David Blaikie:
> In general DWARF doesn't specify this at all.
> [...]
> This isn't the only naming divergence between GCC and Clang

Nevertheless, including the space seems to provide better compatibility with
GCC and GDB. E.g. cpexprs.cc in the GDB testsuite requires this formatting.
And there was no particular desire to change the printing of names in debug
info in the first place (just in diagnostics and other more user-facing text).

Fixes PR46052

Reviewers: dblaikie, labath

Subscribers: aprantl, cfe-commits, dyung

Tags: #clang

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

4 years ago[AArch64] Precommit new fp extraction/insertion test.
Florian Hahn [Thu, 28 May 2020 09:43:47 +0000 (10:43 +0100)]
[AArch64] Precommit new fp extraction/insertion test.

4 years agoFixed bot failure after d20bf5a7258d4b6a7
Alok Kumar Sharma [Thu, 28 May 2020 09:42:28 +0000 (15:12 +0530)]
Fixed bot failure after d20bf5a7258d4b6a7

There were some bot failures due unused funtion `rotateSign`
left in code.

http://lab.llvm.org:8011/builders/clang-ppc64le-rhel/builds/3731

error: unused function 'rotateSign' [-Werror,-Wunused-function]
static uint64_t rotateSign(int64_t I)

4 years ago[AArch64][SVE] Add support for spilling/filling ZPR2/3/4
Cullen Rhodes [Thu, 28 May 2020 09:37:55 +0000 (09:37 +0000)]
[AArch64][SVE] Add support for spilling/filling ZPR2/3/4

Summary:
This patch enables the register allocator to spill/fill lists of 2, 3
and 4 SVE vectors registers to/from the stack. This is implemented with
pseudo instructions that get expanded to individual LDR_ZXI/STR_ZXI
instructions in AArch64ExpandPseudoInsts.

Patch by Sander de Smalen.

Reviewed By: efriedma

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

4 years ago[ARM] Improve codegen of volatile load/store of i64
Victor Campos [Mon, 9 Mar 2020 13:29:37 +0000 (13:29 +0000)]
[ARM] Improve codegen of volatile load/store of i64

Summary:
Instead of generating two i32 instructions for each load or store of a volatile
i64 value (two LDRs or STRs), now emit LDRD/STRD.

These improvements cover architectures implementing ARMv5TE or Thumb-2.

The code generation explicitly deviates from using the register-offset
variant of LDRD/STRD. In this variant, the register allocated to the
register-offset cannot be reused in any of the remaining operands. Such
restriction seems to be non-trivial to implement in LLVM, thus it is
left as a to-do.

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

4 years agoFileCheck [10/12]: Add support for signed numeric values
Thomas Preud'homme [Tue, 5 Mar 2019 23:20:29 +0000 (23:20 +0000)]
FileCheck [10/12]: Add support for signed numeric values

Summary:
This patch is part of a patch series to add support for FileCheck
numeric expressions. This specific patch adds support signed numeric
values, thus allowing negative numeric values.

As such, the patch adds a new class to represent a signed or unsigned
value and add the logic for type promotion and type conversion in
numeric expression mixing signed and unsigned values. It also adds
the %d format specifier to represent signed value.

Finally, it also adds underflow and overflow detection when performing a
binary operation.

Copyright:
    - Linaro (changes up to diff 183612 of revision D55940)
    - GraphCore (changes in later versions of revision D55940 and
                 in new revision created off D55940)

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar, arichardson

Reviewed By: jhenderson, arichardson

Subscribers: MaskRay, hiraditya, llvm-commits, probinson, dblaikie, grimar, arichardson, kristina, hfinkel, rogfer01, JonChesterfield

Tags: #llvm

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

4 years ago[TableGen] Fix non-standard escape warnings for braces in InstAlias
Cullen Rhodes [Thu, 28 May 2020 09:00:51 +0000 (09:00 +0000)]
[TableGen] Fix non-standard escape warnings for braces in InstAlias

Summary:
TableGen interprets braces ('{}') in the asm string of instruction aliases as
variants but when defining aliases with literal braces they have to be escaped
to prevent them being removed.

Braces are escaped with '\\', for example:

  def FooBraces : InstAlias<"foo \\{$imm\\}", (foo IntOperand:$imm)>;

Although when TableGen is emitting the assembly writer (-gen-asm-writer)
the AsmString that gets emitted is:

  AsmString = "foo \{$\x01\}";

In c/c++ braces don't need to be escaped which causes compilation
warnings:

  warning: use of non-standard escape character '\{' [-Wpedantic]

This patch fixes the issue by unescaping the flattened alias asm string
in the asm writer, by replacing '\{\}' with '{}'.

Reviewed By: hfinkel

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

4 years ago[Clang][Sanitizers] Expect test failure on {arm,thumb}v7
Marco Elver [Wed, 27 May 2020 21:55:53 +0000 (23:55 +0200)]
[Clang][Sanitizers] Expect test failure on {arm,thumb}v7

Summary:
Versions of LLVM built on {arm,thumb}v7 appear to have differently
configured pass managers, which causes restrictions on which sanitizers
we may use.

As such, expect failure of the recently added "sanitize-coverage.c" test
on these architectures until we can investigate armv7's restrictions.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=46117

Reviewers: vitalybuka, glider

Reviewed By: glider

Subscribers: glider, kristof.beyls, danielkiss, cfe-commits, vvereschaka

Tags: #clang

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

4 years agotsan: disable java_finalizer2 test on darwin
Dmitry Vyukov [Thu, 28 May 2020 09:03:02 +0000 (11:03 +0200)]
tsan: disable java_finalizer2 test on darwin

pthread_barrier_t is not supported on darwin.
Do what other tests that use pthread_barrier_t do.

4 years ago[CodeGen] Specify meaning of ISD opcodes for scalable vectors
Sander de Smalen [Thu, 28 May 2020 08:27:00 +0000 (09:27 +0100)]
[CodeGen] Specify meaning of ISD opcodes for scalable vectors

This patch contains changes to the description of EXTRACT_SUBVECTOR,
INSERT_SUBVECTOR, INSERT_VECTOR_ELT, EXTRACT_VECTOR_ELT and
CONCAT_VECTORS to specify their behaviour for scalable vectors.

For EXTRACT_SUBVECTOR it specifies that the IDX is scaled by the
same runtime scaling as the extracted (or inserted) vector. This
definition is the most natural extension to EXTRACT_SUBVECTOR for
scalable vectors, as most use-cases that work on fixed-width types
will have the same meaning for scalable types. For legalization for
example, it is common to split the vector operation to operate on
the LO and HI halfs of a vector.

For a fixed width vector <16 x i8> this would be expressed with:

  v16i8 %res = EXTRACT_SUBVECTOR v32i8 %v, i32 16

For a scalable vector, this would similarly be expressed as:

  nxv16i8 %res = EXTRACT_SUBVECTOR nxv32i8 %V, i32 16

By extending the meaning of IDX for scalable vectors, most existing
optimisations on EXTRACT/INSERT_SUBVECTOR work for scalable vectors
without any changes. This definition also allows extracting a
fixed-width subvector from a scalable vector, which is useful to
e.g. extract the low N lanes of a scalable vector.

This patch is not NFC because it sets the meaning of these nodes
for scalable vectors, which future patches will build upon.

Reviewers: efriedma, ctetreau, rogfer01, craig.topper

Reviewed By: efriedma

Tags: #llvm

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

4 years ago[DebugInfo] Upgrade DISubrange to support Fortran dynamic arrays
Alok Kumar Sharma [Thu, 28 May 2020 08:01:22 +0000 (13:31 +0530)]
[DebugInfo] Upgrade DISubrange to support Fortran dynamic arrays

This patch upgrades DISubrange to support fortran requirements.

Summary:
Below are the updates/addition of fields.
lowerBound - Now accepts signed integer or DIVariable or DIExpression,
earlier it accepted only signed integer.
upperBound - This field is now added and accepts signed interger or
DIVariable or DIExpression.
stride - This field is now added and accepts signed interger or
DIVariable or DIExpression.
This is required to describe bounds of array which are known at runtime.

Testing:
unit test cases added (hand-written)
check clang
check llvm
check debug-info

Reviewed By: aprantl

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

4 years agoHarden MLIR detection of misconfiguration when missing dialect registration
Mehdi Amini [Thu, 28 May 2020 08:08:20 +0000 (08:08 +0000)]
Harden MLIR detection of misconfiguration when missing dialect registration

This changes will catch error where C++ op are used without being
registered, either through creation with the OpBuilder or when trying to
cast to the C++ op.

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

4 years ago[gn build] Port 5921782f744
LLVM GN Syncbot [Thu, 28 May 2020 08:08:39 +0000 (08:08 +0000)]
[gn build] Port 5921782f744

4 years ago[VE] Implements minimum MC layer for VE (3/4)
Kazushi (Jam) Marukawa [Thu, 28 May 2020 08:07:21 +0000 (10:07 +0200)]
[VE] Implements minimum MC layer for VE (3/4)

Summary:
Define ELF binary code for VE and modify code where should use this new code.

Depends on D79544.

Reviewed By: jhenderson

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

4 years ago[HardwareLoops] LangRef Intrinsic descriptions
Sjoerd Meijer [Thu, 28 May 2020 07:36:04 +0000 (08:36 +0100)]
[HardwareLoops] LangRef Intrinsic descriptions

The HardwareLoop intrinsics were missing and not described in LangRef. This
adds these descriptions/definitions.

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

4 years ago[Analyzer][StreamChecker] Added check for "indeterminate file position".
Balázs Kéri [Wed, 27 May 2020 14:23:42 +0000 (16:23 +0200)]
[Analyzer][StreamChecker] Added check for "indeterminate file position".

Summary:
According to the standard, after a `wread` or `fwrite` call the file position
becomes "indeterminate". It is assumable that a next read or write causes
undefined behavior, so a (fatal error) warning is added for this case.
The indeterminate position can be cleared by some operations, for example
`fseek` or `freopen`, not with `clearerr`.

Reviewers: Szelethus, baloghadamsoftware, martong, NoQ, xazax.hun, dcoughlin

Reviewed By: Szelethus

Subscribers: rnkovacs, NoQ, 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/D80018

4 years ago[JumpThreading] Use emplace_back instead of push_back (NFC)
Kazu Hirata [Thu, 28 May 2020 05:30:10 +0000 (22:30 -0700)]
[JumpThreading] Use emplace_back instead of push_back (NFC)

Summary: This patch replaces push_back with emplace_back where appropriate.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Driver][X86] Support branch align options with LTO
Shengchen Kan [Mon, 25 May 2020 02:18:44 +0000 (10:18 +0800)]
[Driver][X86] Support branch align options with LTO

Summary: Before this patch, we use two different ways to pass options to align branch
depending on whether LTO is enabled. For example, `-mbranches-within-32B-boundaries`
w/o LTO and `-Wl,-plugin-opt=-x86-branches-within-32B-boundaries` w/ LTO.  It's
inconvenient, so this patch unifies the way: we only need to pass options like
`-mbranches-within-32B-boundaries` to align branches, no matter LTO is enabled or not.

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

4 years ago[docs] Release notes for DIModule metadata
Sourabh Singh Tomar [Wed, 27 May 2020 08:31:35 +0000 (14:01 +0530)]
[docs] Release notes for DIModule metadata

Updated the release notes for the changes in the DIModule metadata.

Reviewed By: aprantl

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

4 years ago[lldb/Test] Import all decorators.
Jonas Devlieghere [Thu, 28 May 2020 04:13:08 +0000 (21:13 -0700)]
[lldb/Test] Import all decorators.

Fixes "NameError: name 'skipIfReproducer' is not defined".

4 years ago[lldb/Reproducers] Skip or fix the remaining tests.
Jonas Devlieghere [Thu, 28 May 2020 04:01:09 +0000 (21:01 -0700)]
[lldb/Reproducers] Skip or fix the remaining tests.

After this patch all remaining tests should pass on macOS when replayed
from a reproducer.

To capture the reproducers:

  ./bin/llvm-lit ../llvm-project/lldb/test/ --param lldb-run-with-repro=capture

To replay the reproducers:

  ./bin/llvm-lit ../llvm-project/lldb/test/ --param lldb-run-with-repro=replay

4 years ago[NFC,StackSafety] Add StackSafetyGlobalInfo class
Vitaly Buka [Thu, 28 May 2020 02:28:42 +0000 (19:28 -0700)]
[NFC,StackSafety] Add StackSafetyGlobalInfo class

4 years ago[gn build] Port 660cda572d6
LLVM GN Syncbot [Thu, 28 May 2020 02:47:12 +0000 (02:47 +0000)]
[gn build] Port 660cda572d6

4 years ago[Analyzer][WebKit] NoUncountedMembersChecker
Jan Korous [Tue, 31 Mar 2020 21:05:17 +0000 (14:05 -0700)]
[Analyzer][WebKit] NoUncountedMembersChecker

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

4 years agoTemporarily disable the following failing tests on Darwin:
Dan Liew [Wed, 27 May 2020 22:50:03 +0000 (15:50 -0700)]
Temporarily disable the following failing tests on Darwin:

  AddressSanitizer-Unit :: ./Asan-i386-calls-Test/AddressSanitizer.LongJmpTest
  AddressSanitizer-Unit :: ./Asan-i386-calls-Test/AddressSanitizer.SigLongJmpTest
  AddressSanitizer-Unit :: ./Asan-i386-inline-Test/AddressSanitizer.LongJmpTest
  AddressSanitizer-Unit :: ./Asan-i386-inline-Test/AddressSanitizer.SigLongJmpTest

These failures will be examined properly when time permits.

rdar://problem/62141412

4 years ago[Statepoint] Reduce scope of usage of ImmutableStatepoint
Philip Reames [Thu, 28 May 2020 01:56:50 +0000 (18:56 -0700)]
[Statepoint] Reduce scope of usage of ImmutableStatepoint

Can't quite fully remove it yet as some more items need sunk the GCStatepointInst class from the wrapper, but we can at least reduce scope.

4 years ago[ObjectYAML][MachO] Add error handling in MachOEmitter.
Xing GUO [Wed, 27 May 2020 08:59:45 +0000 (16:59 +0800)]
[ObjectYAML][MachO] Add error handling in MachOEmitter.

Currently, `yaml2macho` doesn't support error handling. This patch helps improve it.

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

4 years ago[Statepoint] Replace uses of isX functions with idiomatic isa<X>
Philip Reames [Thu, 28 May 2020 01:31:00 +0000 (18:31 -0700)]
[Statepoint] Replace uses of isX functions with idiomatic isa<X>

Now that all of the statepoint related routines have classes with isa support, let's cleanup.

I'm leaving the (dead) utitilities in tree for a few days so that I can do the same cleanup downstream without breakage.

4 years agoSink first bit of functionality from Statepoint to GCStatepointInst
Philip Reames [Thu, 28 May 2020 01:02:49 +0000 (18:02 -0700)]
Sink first bit of functionality from Statepoint to GCStatepointInst

Starting with the obvious stuff.  I initially tried to include the inline operand sequences too, but managed to get code which confused *me*.  Since several parts of those are being entirely removed in the near future, I may defer that portion until the cleanup is done.

4 years ago[NFC,StackSafety] Cleanup alloca size calculation
Vitaly Buka [Thu, 28 May 2020 00:41:17 +0000 (17:41 -0700)]
[NFC,StackSafety] Cleanup alloca size calculation

4 years ago[ELF][test] Fix wrap-no-real.s after D51283
Fangrui Song [Thu, 28 May 2020 00:42:35 +0000 (17:42 -0700)]
[ELF][test] Fix wrap-no-real.s after D51283

Give %t3.so a DT_SONAME so that the DT_NEEDED entry in a dependent executable has a fixed length.

4 years agoDo not warn that an expression of the form (void)arr; is unused when
Richard Smith [Thu, 28 May 2020 00:20:15 +0000 (17:20 -0700)]
Do not warn that an expression of the form (void)arr; is unused when
arr is a volatile non-local array.

This fixes a recent regression exposed by removing lvalue-to-rvalue
conversion of discarded volatile arrays. In passing, regularize the
rules we use to determine whether '(void)expr;' warns when expr is a
volatile glvalue.

4 years agoIntroduce a GCStatepointInst type analogous to IntrinsicInst subclasses
Philip Reames [Thu, 28 May 2020 00:16:41 +0000 (17:16 -0700)]
Introduce a GCStatepointInst type analogous to IntrinsicInst subclasses

Back when we had CallSite, we implemented the current Statepoint/ImmutableStatepoint structure in analogous manner.  Now that CallSite has been removed, the structure used for statepoints looks decidely out of place.  gc.statepoint is one of the small handful of intrinsics which are invokable.  Because of this, it can't subclass IntrinsicInst as is idiomatic.

This change simply introduces the GCStatepointInst class, restructures the existing Statepoint/ImmutableStatepoint types to wrap it.  I will be landing a series of changes to sink functionality into GCStatepointInst and updating callers to be more idiomatic.

4 years ago[gn build] Add MLAnalysisTests after D80579
Fangrui Song [Thu, 28 May 2020 00:20:41 +0000 (17:20 -0700)]
[gn build] Add MLAnalysisTests after D80579

4 years ago[llvm][NFC] ProfileSummaryInfo - const-ify APIs
Mircea Trofin [Thu, 28 May 2020 00:04:28 +0000 (17:04 -0700)]
[llvm][NFC] ProfileSummaryInfo - const-ify APIs

Follow-up from https://reviews.llvm.org/D79920

4 years ago[gn build] Port D80579
Fangrui Song [Thu, 28 May 2020 00:12:02 +0000 (17:12 -0700)]
[gn build] Port D80579

4 years ago[ELF] --wrap: Drop __real_ symbol from the symbol table
Rui Ueyama [Wed, 27 May 2020 23:18:55 +0000 (16:18 -0700)]
[ELF] --wrap: Drop __real_ symbol from the symbol table

In D34993, we discussed and concluded that we should drop `__real_
symbol from the symbol table, but I did the opposite in D50569.
This patch is to drop `__real_` symbol.

MaskRay's note: omitting `__real_` is important if it is undefined:
otherwise a subsequent link may error due to the undefined `__real_` in .dynsym

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

4 years ago[TRE] Allow elimination when the returned value is non-constant
Layton Kifer [Wed, 27 May 2020 23:54:20 +0000 (16:54 -0700)]
[TRE] Allow elimination when the returned value is non-constant

Currently we can only eliminate call return pairs that either return the
result of the call or a dynamic constant. This patch removes that
limitation.

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

4 years agoAMDGPU/GlobalISel: Fixed insert element for non-standard vectors
Stanislav Mekhanoshin [Wed, 27 May 2020 19:21:26 +0000 (12:21 -0700)]
AMDGPU/GlobalISel: Fixed insert element for non-standard vectors

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

4 years ago[Lexer] Fix invalid suffix diagnostic for fixed-point literals
Leonard Chan [Wed, 27 May 2020 23:16:56 +0000 (16:16 -0700)]
[Lexer] Fix invalid suffix diagnostic for fixed-point literals

Committing on behalf of nagart, who authored this patch.

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

4 years agoAMDGPU: Support non-entry block static sized allocas
Matt Arsenault [Wed, 27 May 2020 14:59:14 +0000 (10:59 -0400)]
AMDGPU: Support non-entry block static sized allocas

OpenMP emits these for some reason, so handle them. Assume these use
4096 bytes by default, with a flag to override this. Also change the
related stack assumption for calls to have a flag.

4 years agoDAG: Fix expansion of DYNAMIC_STACKALLOC for StackGrowsUp targets
Matt Arsenault [Wed, 27 May 2020 16:33:55 +0000 (12:33 -0400)]
DAG: Fix expansion of DYNAMIC_STACKALLOC for StackGrowsUp targets

Can't test this since I can't directly use the default expansion for
AMDGPU. It needs to scale the amount by the wave size, rather than use
the raw byte size value.

4 years agoAMDGPU/GlobalISel: Fixed handling of non-standard vectors
Stanislav Mekhanoshin [Thu, 21 May 2020 19:41:29 +0000 (12:41 -0700)]
AMDGPU/GlobalISel: Fixed handling of non-standard vectors

We do not have register classes for all possible vector
sizes, so round it up for extract vector element.

Also fixes selection of G_MERGE_VALUES when vectors are
not a power of two.

This has required to refactor getRegSplitParts() in way
that it can handle not just power of two vectors.

Ideally we would like RegSplitParts to be generated by
tablegen.

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

4 years ago[CMake] Revert cf86a234ba86acf0bb875e21d27833be36e08be4
Fangrui Song [Wed, 27 May 2020 22:29:10 +0000 (15:29 -0700)]
[CMake] Revert cf86a234ba86acf0bb875e21d27833be36e08be4

It is unnecessary after 993bbaf6a35baed4ad3d8422a76c4311140641a8

4 years ago[MLPolicies] Fix dependency and -DBUILD_SHARED_LIBS=on builds after D80579
Fangrui Song [Wed, 27 May 2020 22:21:08 +0000 (15:21 -0700)]
[MLPolicies] Fix dependency and -DBUILD_SHARED_LIBS=on builds after D80579

4 years agoFix shared libs build break introduced in rG98ef93eabd76
Mircea Trofin [Wed, 27 May 2020 22:11:43 +0000 (15:11 -0700)]
Fix shared libs build break introduced in rG98ef93eabd76

4 years agoFix Windows command line bug when last token in response file is ""
Adrian McCarthy [Wed, 27 May 2020 20:53:47 +0000 (13:53 -0700)]
Fix Windows command line bug when last token in response file is ""

Patch by Neil Dhar <dhar@alumni.duke.edu>

Current state machine for parsing tokens from response files in Windows
does not correctly handle the case where the last token is "". The current
implementation handles the last token by only adding it if it is not empty,
however this does not cover the case where the last token is meant to be
the empty string. We can cover this case by checking whether the state
machine was last in the UNQUOTED state, which indicates that the last
character of the input was a non-whitespace character.

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

4 years ago[mlir][Linalg] Add missing library linkage for shared library builds.
MaheshRavishankar [Wed, 27 May 2020 21:12:35 +0000 (14:12 -0700)]
[mlir][Linalg] Add missing library linkage for shared library builds.

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

4 years agoFix a use-after-free in GetXcodeSDKPath
Adrian Prantl [Wed, 27 May 2020 21:26:15 +0000 (14:26 -0700)]
Fix a use-after-free in GetXcodeSDKPath

Introduced in https://reviews.llvm.org/D80595. Thanks Jonas for noticing!

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

4 years ago[NFC] Reformat TEST_FOO macros in test_macros.h
Louis Dionne [Wed, 27 May 2020 20:52:22 +0000 (16:52 -0400)]
[NFC] Reformat TEST_FOO macros in test_macros.h

To make them easier to read and to make it easier to add new ones.

4 years ago[lldb/Reproducers] Skip & add FIXME to tests failing with unexpected packet.
Jonas Devlieghere [Wed, 27 May 2020 20:49:15 +0000 (13:49 -0700)]
[lldb/Reproducers] Skip & add FIXME to tests failing with unexpected packet.

Add skip decorator to tests failing with an unexpected packet during
passive replay.

4 years ago[lldb/Reproducers] Differentiate active and passive replay unexpected packet.
Jonas Devlieghere [Wed, 27 May 2020 20:10:19 +0000 (13:10 -0700)]
[lldb/Reproducers] Differentiate active and passive replay unexpected packet.

4 years ago[mlir][shape] Use IndexElementsAttr in Shape dialect.
Sean Silva [Tue, 26 May 2020 23:45:32 +0000 (16:45 -0700)]
[mlir][shape] Use IndexElementsAttr in Shape dialect.

Summary:
Index is the proper type for storing shapes when constant folding, so
this fixes the previous code (which was using i64).

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

4 years ago[mlir][core] Add IndexElementsAttr helpers.
Sean Silva [Tue, 26 May 2020 23:44:20 +0000 (16:44 -0700)]
[mlir][core] Add IndexElementsAttr helpers.

Summary:
In a follow-up, I'll update the Shape dialect to use this instead of
I64ElementsAttr.

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

4 years ago[llvm] Add function feature extraction analysis
Mircea Trofin [Tue, 26 May 2020 19:07:08 +0000 (12:07 -0700)]
[llvm] Add function feature extraction analysis

Summary:
This patch introduces an analysis pass to extract function features,
which will be needed by the ML InlineAdvisor.

RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-April/140763.html

Reviewers: davidxl, dblaikie, jdoerfert

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoEnable `align <n>` to be used in the intrinsic definition.
Michael Liao [Wed, 27 May 2020 20:02:15 +0000 (16:02 -0400)]
Enable `align <n>` to be used in the intrinsic definition.

- This allow us to specify the (minimal) alignment on an intrinsic's
  arguments and, more importantly, the return value.

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

4 years agoRefactor argument attribute specification in intrinsic definition. NFC.
Michael Liao [Wed, 27 May 2020 19:58:07 +0000 (15:58 -0400)]
Refactor argument attribute specification in intrinsic definition. NFC.

- Argument attribute needs specifiying through `ArgIndex<n>`
  (corresponding to `FirstArgIndex`) to distinguish explicitly from the
  index number from the overloaded type list.
- In addition, `RetIndex` (corresponding to `ReturnIndex`) and
  `FuncIndex` (corresponding to `FunctionIndex`) are introduced for us
  to associate attributes on the return value and potentially function
  itself.

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

4 years ago[NFC,StackSafety] Rename some variables
Vitaly Buka [Wed, 27 May 2020 20:32:58 +0000 (13:32 -0700)]
[NFC,StackSafety] Rename some variables

4 years ago[StackSafety] Bailout more aggressively
Vitaly Buka [Wed, 27 May 2020 20:22:16 +0000 (13:22 -0700)]
[StackSafety] Bailout more aggressively
Many edge cases, e.g. wrapped ranges, can be processed
precisely without bailout. However it's very unlikely that
memory access with min/max integer offsets will be
classified as safe anyway.
Early bailout may help with ThinLTO where we can
drop unsafe parameters from summaries.

4 years agoRemove error-prone mlir::ExecutionEngine::invoke overload.
Sean Silva [Wed, 27 May 2020 03:14:34 +0000 (20:14 -0700)]
Remove error-prone mlir::ExecutionEngine::invoke overload.

I just spent a bunch of time debugging a mysterious bug that ended being due to my SmallVector getting passed to the Args&... overload instead of the MutableArrayRef overload, with disastrous results.

I appreciate the intent of this API, but for a function that does a bunch of unsafe casts, adding in potential overload confusion is just too much C++ footgun. If we end up needing this functionality, having something like a separate `packArgs(Args&...) -> SmallVector` overload would be preferable.

Turns out this API is unused and untested (even out of tree as far as I can tell, modulo the optional passing of no args to the other invoke as I fixed in this patch), so it's an easy fix -- just delete it and touch up the other overload.

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

4 years ago[TargetPassConfig] Add CanonicalizeFreezeInLoops before LSR
Juneyoung Lee [Wed, 27 May 2020 16:48:37 +0000 (01:48 +0900)]
[TargetPassConfig] Add CanonicalizeFreezeInLoops before LSR

Summary:
This patch adds CanonicalizeFreezeInLoops before LSR.
Relevant patch: https://reviews.llvm.org/D77523

Reviewers: spatel, efriedma, jdoerfert, fhahn, nikic, reames, xbolva00

Reviewed By: nikic

Subscribers: xbolva00, nikic, lebedev.ri, hiraditya, llvm-commits, sanwou01, nlopes

Tags: #llvm

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

4 years ago[mlir] Fix RunnerUtils template specialization
Nicolas Vasilache [Wed, 27 May 2020 20:14:12 +0000 (16:14 -0400)]
[mlir] Fix RunnerUtils template specialization

Undoing a spurious change that broke SFINAE for some out of core use
cases.

4 years ago[mlir][Linalg] Fix build failure from D80188
MaheshRavishankar [Wed, 27 May 2020 19:42:14 +0000 (12:42 -0700)]
[mlir][Linalg] Fix build failure from D80188

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

4 years agoFix `-Wpedantic` warning. NFC.
Michael Liao [Wed, 27 May 2020 19:57:03 +0000 (15:57 -0400)]
Fix `-Wpedantic` warning. NFC.

4 years ago[GlobalISel] Don't combine instructions which are fed by memory instructions.
Jessica Paquette [Sat, 16 May 2020 00:37:12 +0000 (17:37 -0700)]
[GlobalISel] Don't combine instructions which are fed by memory instructions.

If we have a memory instruction (e.g. a load), we shouldn't combine it away in
some trivial combine.

It's possible that, say, a call lives between the instructions. This could
modify the value loaded, making the load instructions not safe to fold.

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

4 years agotsan: fix test in debug mode
Dmitry Vyukov [Wed, 27 May 2020 19:47:13 +0000 (21:47 +0200)]
tsan: fix test in debug mode

sanitizer-x86_64-linux-autoconf has failed after the previous tsan commit:

FAIL: ThreadSanitizer-x86_64 :: java_finalizer2.cpp (245 of 403)
******************** TEST 'ThreadSanitizer-x86_64 :: java_finalizer2.cpp' FAILED ********************
Script:
--
: 'RUN: at line 1';      /b/sanitizer-x86_64-linux-autoconf/build/tsan_debug_build/./bin/clang  --driver-mode=g++ -fsanitize=thread -Wall  -m64   -gline-tables-only -I/b/sanitizer-x86_64-linux-autoconf/build/llvm-project/compiler-rt/test/tsan/../ -std=c++11 -I/b/sanitizer-x86_64-linux-autoconf/build/llvm-project/compiler-rt/test/tsan/../ -nostdinc++ -I/b/sanitizer-x86_64-linux-autoconf/build/tsan_debug_build/tools/clang/runtime/compiler-rt-bins/lib/tsan/libcxx_tsan_x86_64/include/c++/v1 -O1 /b/sanitizer-x86_64-linux-autoconf/build/llvm-project/compiler-rt/test/tsan/java_finalizer2.cpp -o /b/sanitizer-x86_64-linux-autoconf/build/tsan_debug_build/tools/clang/runtime/compiler-rt-bins/test/tsan/X86_64Config/Output/java_finalizer2.cpp.tmp &&  /b/sanitizer-x86_64-linux-autoconf/build/tsan_debug_build/tools/clang/runtime/compiler-rt-bins/test/tsan/X86_64Config/Output/java_finalizer2.cpp.tmp 2>&1 | FileCheck /b/sanitizer-x86_64-linux-autoconf/build/llvm-project/compiler-rt/test/tsan/java_finalizer2.cpp
--
Exit Code: 1

Command Output (stderr):
--
/b/sanitizer-x86_64-linux-autoconf/build/llvm-project/compiler-rt/test/tsan/java_finalizer2.cpp:82:11: error: CHECK: expected string not found in input
// CHECK: DONE
          ^
<stdin>:1:1: note: scanning from here
FATAL: ThreadSanitizer CHECK failed: /b/sanitizer-x86_64-linux-autoconf/build/llvm-project/compiler-rt/lib/tsan/rtl/tsan_sync.cpp:69 "((*meta)) == ((0))" (0x4000003e, 0x0)
^
<stdin>:5:12: note: possible intended match here
 #3 __tsan::OnUserAlloc(__tsan::ThreadState*, unsigned long, unsigned long, unsigned long, bool) /b/sanitizer-x86_64-linux-autoconf/build/llvm-project/compiler-rt/lib/tsan/rtl/tsan_mman.cpp:225:16 (java_finalizer2.cpp.tmp+0x4af407)
           ^

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/51143/steps/test%20tsan%20in%20debug%20compiler-rt%20build/logs/stdio

Fix heap object overlap by offsetting java heap as other tests are doing.

4 years ago[AMDGPU] Fix for the lost CarryOut/CarryIn register operands in S_ADD/SUB_CO_PSEUDO.
alex-t [Mon, 18 May 2020 20:40:27 +0000 (23:40 +0300)]
[AMDGPU] Fix for the lost CarryOut/CarryIn register operands in S_ADD/SUB_CO_PSEUDO.

Summary: This fixes the 5b898bddff51 bug when the carry-in and carry-out registers became lost in lowering S_ADD/SUB_CO_PSEUDO.

Reviewers: rampitec, arsenm

Reviewed By: arsenm

Subscribers: msearles, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years agoAlso cache negative results in GetXcodeSDKPath (NFC)
Adrian Prantl [Tue, 26 May 2020 22:40:43 +0000 (15:40 -0700)]
Also cache negative results in GetXcodeSDKPath (NFC)

This fixes a performance issue in the failure case.

rdar://63547920

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

4 years ago[lldb/Reproducers] Skip tests relying on timeouts
Jonas Devlieghere [Wed, 27 May 2020 19:07:08 +0000 (12:07 -0700)]
[lldb/Reproducers] Skip tests relying on timeouts

The reproducer don't model timeouts so tests that rely on them end up
with unexpected packets during replay. Skip them until we can handle
this scenario.

4 years ago[lldb/Test] Generate YAML binary in build directory
Jonas Devlieghere [Wed, 27 May 2020 19:01:36 +0000 (12:01 -0700)]
[lldb/Test] Generate YAML binary in build directory

Although it's not entirely clear to me why, this test was generating its
binary in the source directory instead of the build directory. This
patch fixes that following the same approach as other tests.

4 years ago[X86] Restore selection of MULX on BMI2 targets.
Craig Topper [Wed, 27 May 2020 18:12:05 +0000 (11:12 -0700)]
[X86] Restore selection of MULX on BMI2 targets.

Looking back over gcc and icc behavior it looks like icc does
use mulx32 on 32-bit targets and mulx64 on 64-bit targets. It's
also used when dividing i32 by constant on 32-bit targets and
i64 by constant on 64-bit targets.

gcc uses it multiplies producing a 64 bit result on 32-bit targets
and 128-bit results on a 64-bit target. gcc does not appear to use
it for division by constant.

After this patch clang is closer to the icc behavior. This
basically reverts d1c61861ddc94457b08a5a653d3908b7b38ebb22, but
there were no strong feelings at the time.

Fixes PR45518.

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

4 years ago[llvm]NFC] Simplify ProfileSummaryInfo state transitions
Mircea Trofin [Thu, 14 May 2020 02:32:40 +0000 (19:32 -0700)]
[llvm]NFC] Simplify ProfileSummaryInfo state transitions

ProfileSummaryInfo is updated seldom, as result of very specific
triggers. This patch clearly demarcates state updates from read-only uses.
This, arguably, improves readability and maintainability.

4 years ago[InstCombine] add tests for vector demanded elements of select condition; NFC
Sanjay Patel [Wed, 27 May 2020 14:26:31 +0000 (10:26 -0400)]
[InstCombine] add tests for vector demanded elements of select condition; NFC

4 years agoAMDGPU: Start adding MODE register uses to instructions
Matt Arsenault [Wed, 27 May 2020 17:25:37 +0000 (13:25 -0400)]
AMDGPU: Start adding MODE register uses to instructions

This is the groundwork required to implement strictfp. For now, this
should be NFC for regular instructoins (many instructions just gain an
extra use of a reserved register). Regalloc won't rematerialize
instructions with reads of physical registers, but we were suffering
from that anyway with the exec reads.

Should add it for all the related FP uses (possibly with some
extras). I did not add it to either the gpr index mode instructions
(or every single VALU instruction) since it's a ridiculous feature
already modeled as an arbitrary side effect.

Also work towards marking instructions with FP exceptions. This
doesn't actually set the bit yet since this would start to change
codegen. It seems nofpexcept is currently not implied from the regular
IR FP operations. Add it to some MIR tests where I think it might
matter.

4 years ago[BPF] simplify zero extension with MOV_32_64
John Fastabend [Wed, 27 May 2020 18:18:16 +0000 (11:18 -0700)]
[BPF] simplify zero extension with MOV_32_64

The current pattern matching for zext results in the following code snippet
being produced,

  w1 = w0
  r1 <<= 32
  r1 >>= 32

Because BPF implementations require zero extension on 32bit loads this
both adds a few extra unneeded instructions but also makes it a bit
harder for the verifier to track the r1 register bounds. For example in
this verifier trace we see at the end of the snippet R2 offset is unknown.
However, if we track this correctly we see w1 should have the same bounds
as r8. R8 smax is less than U32 max value so a zero extend load should keep
the same value. Adding a max value of 800 (R8=inv(id=0,smax_value=800)) to
an off=0, as seen in R7 should create a max offset of 800. However at the
end of the snippet we note the R2 max offset is 0xffffFFFF.

  R0=inv(id=0,smax_value=800)
  R1_w=inv(id=0,umax_value=2147483647,var_off=(0x0; 0x7fffffff))
  R6=ctx(id=0,off=0,imm=0) R7=map_value(id=0,off=0,ks=4,vs=1600,imm=0)
  R8_w=inv(id=0,smax_value=800,umax_value=4294967295,var_off=(0x0; 0xffffffff))
  R9=inv800 R10=fp0 fp-8=mmmm????
 58: (1c) w9 -= w8
 59: (bc) w1 = w8
 60: (67) r1 <<= 32
 61: (77) r1 >>= 32
 62: (bf) r2 = r7
 63: (0f) r2 += r1
 64: (bf) r1 = r6
 65: (bc) w3 = w9
 66: (b7) r4 = 0
 67: (85) call bpf_get_stack#67
  R0=inv(id=0,smax_value=800)
  R1_w=ctx(id=0,off=0,imm=0)
  R2_w=map_value(id=0,off=0,ks=4,vs=1600,umax_value=4294967295,var_off=(0x0; 0xffffffff))
  R3_w=inv(id=0,umax_value=800,var_off=(0x0; 0x3ff))
  R4_w=inv0 R6=ctx(id=0,off=0,imm=0)
  R7=map_value(id=0,off=0,ks=4,vs=1600,imm=0)
  R8_w=inv(id=0,smax_value=800,umax_value=4294967295,var_off=(0x0; 0xffffffff))
  R9_w=inv(id=0,umax_value=800,var_off=(0x0; 0x3ff))
  R10=fp0 fp-8=mmmm????

After this patch R1 bounds are not smashed by the <<=32 >>=32 shift and we
get correct bounds on R2 umax_value=800.

Further it reduces 3 insns to 1.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Differential Revision: https://reviews.llvm.org/D73985

4 years ago[PowerPC] Add support for -mcpu=pwr10 in both clang and llvm
Lei Huang [Wed, 27 May 2020 14:50:14 +0000 (09:50 -0500)]
[PowerPC] Add support for -mcpu=pwr10 in both clang and llvm

Summary:
This patch simply adds support for the new CPU in anticipation of
Power10. There isn't really any functionality added so there are no
associated test cases at this time.

Reviewers: stefanp, nemanjai, amyk, hfinkel, power-llvm-team, #powerpc

Reviewed By: stefanp, nemanjai, amyk, #powerpc

Subscribers: NeHuang, steven.zhang, hiraditya, llvm-commits, wuzish, shchenz, cfe-commits, kbarton, echristo

Tags: #clang, #powerpc, #llvm

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

4 years ago[mlir] [VectorOps] Add 'vector.flat_transpose' operation
aartbik [Wed, 27 May 2020 17:31:29 +0000 (10:31 -0700)]
[mlir] [VectorOps] Add 'vector.flat_transpose' operation

Summary:
Provides a representation of the linearized LLVM instrinsic.
With tests and lowering implementation to LLVM IR dialect.
Prepares better lowering for 2-D vector.transpose.

Reviewers: nicolasvasilache, ftynse, reidtatge, bkramer, dcaballe

Reviewed By: ftynse, dcaballe

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

Tags: #llvm

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

4 years ago[CodeMoverUtils] Use dominator tree level to decide the direction of
Rithik Sharma [Wed, 27 May 2020 18:00:06 +0000 (18:00 +0000)]
[CodeMoverUtils] Use dominator tree level to decide the direction of
code motion

Summary: Currently isSafeToMoveBefore uses DFS numbering for determining
the relative position of instruction and insert point which is not
always correct. This PR proposes the use of Dominator Tree depth for the
same. If a node is at a higher level than the insert point then it is
safe to say that we want to move in the forward direction.
Authored By: RithikSharma
Reviewer: Whitney, nikic, bmahjour, etiotto, fhahn
Reviewed By: Whitney
Subscribers: fhahn, hiraditya, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D80084

4 years ago[Driver] Support -fsanitize=shadow-call-stack and cfi-icall on aarch64_be
Fangrui Song [Wed, 27 May 2020 17:45:07 +0000 (10:45 -0700)]
[Driver] Support -fsanitize=shadow-call-stack and cfi-icall on aarch64_be

D80647 did not fix https://bugs.llvm.org/show_bug.cgi?id=46076
This is the fix.

4 years ago[NFC][XCOFF][AIX] Return function entry point symbol with dedicate function
jasonliu [Wed, 27 May 2020 17:52:21 +0000 (17:52 +0000)]
[NFC][XCOFF][AIX] Return function entry point symbol with dedicate function

Use getFunctionEntryPointSymbol whenever possible to enclose the
implementation detail and reduce duplicate logic.

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

4 years agoAMDGPU: Set StackPointerRegisterToSaveRestore
Matt Arsenault [Wed, 27 May 2020 15:22:46 +0000 (11:22 -0400)]
AMDGPU: Set StackPointerRegisterToSaveRestore

This will enable selecting non-entry block allocas. Skip the SP write
check in the base isSchedulingBoundary implementation to preserve the
previous scheduling behavior and avoid test churn. It's apparently for
compile time reasons, but if we were to use this more work would be
needed since in some of the failing tests, we seem to incorrectly get
hazard nops inserted.

4 years ago[Driver] Support -fsanitize=shadow-call-stack on aarch64_be
Fangrui Song [Wed, 27 May 2020 17:21:59 +0000 (10:21 -0700)]
[Driver] Support -fsanitize=shadow-call-stack on aarch64_be

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

Reviewed By: nickdesaulniers, pcc

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

4 years ago[clangd] Add access specifier information to hover contents
Daniel Martín [Wed, 27 May 2020 16:17:07 +0000 (18:17 +0200)]
[clangd] Add access specifier information to hover contents

Summary:
For https://github.com/clangd/clangd/issues/382

This commit adds access specifier information to the hover
contents. For example, the hover information of a class field or
member function will now indicate if the field or member is private,
public, or protected. This can be particularly useful when a developer
is in the implementation file and wants to know if a particular member
definition is public or private.

Reviewers: kadircet

Reviewed By: kadircet

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

Tags: #clang

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

4 years ago[lldb/Reproducers] Skip API logging in the DUMMY macro
Jonas Devlieghere [Wed, 27 May 2020 17:27:44 +0000 (10:27 -0700)]
[lldb/Reproducers] Skip API logging in the DUMMY macro

The purpose of the LLDB_RECORD_DUMMY macro is twofold: it is used in
functions that take arguments that we don't know how to serialize (e.g.
void*) and it's used by function where we want to avoid doing excessive
work because they can be called from a signal handler (e.g.
setTerminalWidth).

To support the latter case, I've disabled API logging form the Recorder
ctor used by the DUMMY macro. This ensures we don't allocate memory when
called from a signal handler.

4 years agoAMDGPU: Fix dropping MI flags when rewriting instructions
Matt Arsenault [Wed, 27 May 2020 02:08:31 +0000 (22:08 -0400)]
AMDGPU: Fix dropping MI flags when rewriting instructions

All 3 passes that change instruction encodings were dropping MI
flags. This avoids scheduling regressions caused by setting
mayRaiseFPExceptions on FP instructions for non-strictfp functions.

4 years ago[lldb] Make order of completions for expressions deterministic and sorted by Clang...
Raphael Isemann [Wed, 27 May 2020 17:21:54 +0000 (19:21 +0200)]
[lldb] Make order of completions for expressions deterministic and sorted by Clang's priority values.

Summary:

It turns out that the order in which we provide completions for expressions is
nondeterministic. This leads to confusing user experience and also breaks the
reproducer tests (as two LLDB tests can go out of sync due to the
non-determinism in the completion lists)

The reason for the non-determinism is that the CompletionConsumer informs us
about decls in the order in which it finds declarations in the lookup store of
the DeclContexts it visits (mainly this snippet in SemaLookup.cpp):

``` lang=c++
    // Enumerate all of the results in this context.
    for (DeclContextLookupResult R :
         Load ? Ctx->lookups()
              : Ctx->noload_lookups(/*PreserveInternalState=*/false)) {
       [...]
```

This storage of the lookup is sorted by pointer values (see the hash of
`DeclarationName`) and can therefore be non-deterministic. The LLDB code
completion consumer that receives these calls originally expected that the order
of declarations is defined by Clang, but it seems the API expects the client to
provide an order to the completions.

This patch fixes the issue as follows:

* We sort the completions we get from Clang alphabetically and also by the
priority value we get from Clang (with priority value sorting having precedence
over the alphabetical sorting)

* We make all the functions/variables that touch a completion before the sorting
const-qualified. The idea is that this should prevent that we never have
observable side-effect from touching these declarations in a non-deterministic
order (e.g., we don't try to complete the type by accident).

This way we behave like the other parts of Clang which also sort the results by
some deterministic value (usually the name or something computed from a name,
e.g., edit distance to a given string).

We most likely also need to fix the Clang code to make the loop I listed above
deterministic to prevent these issues in the future (tracked in rdar://63442513
). This wouldn't replace the functionality provided in this patch though as we
would still need the priority and overall alphabetical sorting.

Note: I had to increase the lldb-vscode completion limit to 100 as the tests
look for strings that aren't in the first 50 results anymore due to variable
names starting with letters like 'v' (which are now always shown much further
down in the list due to the alphabetical sorting).

Fixes rdar://63200995

Reviewers: JDevlieghere, clayborg

Reviewed By: JDevlieghere

Subscribers: mgrang, abidh

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

4 years ago[X86] Assemble movzb 1280(%rbx, %r12), %r12 after D80608
Fangrui Song [Wed, 27 May 2020 16:49:08 +0000 (09:49 -0700)]
[X86] Assemble movzb 1280(%rbx, %r12), %r12 after D80608

ffmpeg/libavcodec/x86/h264_cabac.c inline assembly may produce
movzb 1280(%rbx, %r12), %r12

After D80608, llvm-mc errors:

error: unknown use of instruction mnemonic without a size suffix

4 years ago[mlir][spirv] Lower allocation/deallocations of workgroup memory.
MaheshRavishankar [Wed, 27 May 2020 16:36:32 +0000 (09:36 -0700)]
[mlir][spirv] Lower allocation/deallocations of workgroup memory.

This allocation of a workgroup memory is lowered to a
spv.globalVariable. Only static size allocation with element type
being int or float is handled. The lowering does account for the
element type that are not supported in the lowered spv.module based on
the extensions/capabilities and adjusts the number of elements to get
the same byte length.

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

4 years ago[CodeGen] fix typo `def nxv1bf32` -> `def nxv1f32`
Ties Stuij [Wed, 27 May 2020 16:25:10 +0000 (17:25 +0100)]
[CodeGen] fix typo `def nxv1bf32` -> `def nxv1f32`

The `Add bfloat MVT type` patch introduced a typo in the nxv1f32 definition
in llvm/include/llvm/CodeGen/ValueTypes.td:
https://reviews.llvm.org/D79706/new/#inline-740433

This patch fixes that.

4 years ago[gn build] Port 0d20ed664ff
LLVM GN Syncbot [Wed, 27 May 2020 16:41:00 +0000 (16:41 +0000)]
[gn build] Port 0d20ed664ff

4 years ago[DDG] Data Dependence Graph - Add query function for memory dependencies between...
Bardia Mahjour [Wed, 27 May 2020 16:33:46 +0000 (12:33 -0400)]
[DDG] Data Dependence Graph - Add query function for memory dependencies between two nodes

Summary:
When working with the DDG it's useful to be able to query details of the
memory dependencies between two nodes connected by a memory edge. The DDG
does not hold a copy of the dependencies, but it contains a reference to a
DependenceInfo object through which dependence information can be queried.
This patch adds a query function to the DDG to obtain all the Dependence
objects that exist between instructions of two nodes.

Authored By: bmahjour

Reviewers: Meinersbur, Whitney, etiotto

Reviewed By: Whitney

Tags: #llvm

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

4 years ago[gn build] (manually) port dedaf3a2ac5
Nico Weber [Wed, 27 May 2020 16:31:59 +0000 (12:31 -0400)]
[gn build] (manually) port dedaf3a2ac5

4 years ago[MLIR] [OpenMP] Add basic OpenMP parallel operation
David Truby [Tue, 5 May 2020 12:04:32 +0000 (13:04 +0100)]
[MLIR] [OpenMP] Add basic OpenMP parallel operation

Summary:
This includes a basic implementation for the OpenMP parallel
operation without a custom pretty-printer and parser.
The if, num_threads, private, shared, first_private, last_private,
proc_bind and default clauses are included in this implementation.

Currently the reduction clause is omitted as it is more complex and
requires analysis to see if we can share implementation with the loop
dialect. The allocate clause is also omitted.

A discussion about the design of this operation can be found here:
https://llvm.discourse.group/t/openmp-parallel-operation-design-issues/686

The current OpenMP Specification can be found here:
https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5.0.pdf

Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
Reviewers: jdoerfert

Subscribers: mgorny, yaxunl, kristof.beyls, guansong, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, grosul1, frgossen, Kayjukh, llvm-commits

Tags: #llvm

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

4 years agoStart migrating away from statepoint's inline length prefixed argument bundles
Philip Reames [Wed, 27 May 2020 16:14:54 +0000 (09:14 -0700)]
Start migrating away from statepoint's inline length prefixed argument bundles

In the current statepoint design, we have four distinct groups of operands to the call: call args, gc transition args, deopt args, and gc args. This format prexisted the support in IR for operand bundles and was in fact one of the inspirations for the extension. However, we never went back and rearchitected statepoints to fully leverage bundles.

This change is the first in a small sequence to do so. All this does is extend the SelectionDAG lowering code to allow deopt and gc transition operands to be specified in either inline argument bundles or operand bundles.

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

4 years ago[VFABI] Fix parsing of uniform parameters that shouldn't expect step or positional...
Paul Walker [Tue, 26 May 2020 16:54:02 +0000 (16:54 +0000)]
[VFABI] Fix parsing of uniform parameters that shouldn't expect step or positional data.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoFix warning `-Wpedantic`. NFC.
Michael Liao [Wed, 27 May 2020 16:05:55 +0000 (12:05 -0400)]
Fix warning `-Wpedantic`. NFC.

4 years agoFix Darwin 'constinit thread_local' variables.
James Y Knight [Wed, 27 May 2020 13:55:29 +0000 (09:55 -0400)]
Fix Darwin 'constinit thread_local' variables.

Unlike other platforms using ItaniumCXXABI, Darwin does not allow the
creation of a thread-wrapper function for a variable in the TU of
users. Because of this, it can set the linkage of the thread-local
symbol to internal, with the assumption that no TUs other than the one
defining the variable will need it.

However, constinit thread_local variables do not require the use of
the thread-wrapper call, so users reference the variable
directly. Thus, it must not be converted to internal, or users will
get a link failure.

This was a regression introduced by the optimization in
00223827a952f66e7426c9881a2a4229e59bb019.

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

4 years agoCoverageFilters.h - reduce unnecessary includes to forward declarations. NFC.
Simon Pilgrim [Wed, 27 May 2020 15:57:28 +0000 (16:57 +0100)]
CoverageFilters.h - reduce unnecessary includes to forward declarations. NFC.