platform/upstream/llvm.git
4 years ago[MLIR][Shape] Add custom assembly format for `shape.any`
Frederik Gossen [Fri, 14 Aug 2020 08:33:58 +0000 (08:33 +0000)]
[MLIR][Shape] Add custom assembly format for `shape.any`

Add custom assembly format for `shape.any` with variadic operands.

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

4 years ago[lldb/Utility] Simplify Scalar::PromoteToMaxType
Pavel Labath [Thu, 13 Aug 2020 13:49:03 +0000 (15:49 +0200)]
[lldb/Utility] Simplify Scalar::PromoteToMaxType

The function had very complicated signature, because it was trying to
avoid making unnecessary copies of the Scalar object. However, this
class is not hot enough to worry about these kinds of optimizations. My
making copies unconditionally, we can simplify the function and all of
its call sites.

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

4 years ago[clangd] Clarify comments regarding gRPC linking
Kirill Bobyrev [Fri, 14 Aug 2020 09:02:03 +0000 (11:02 +0200)]
[clangd] Clarify comments regarding gRPC linking

4 years ago[clangd] Fix find_program() result check when searching for gRPC
Aleksandr Platonov [Fri, 14 Aug 2020 08:33:00 +0000 (11:33 +0300)]
[clangd] Fix find_program() result check when searching for gRPC

`find_program(<VAR> ...)` sets <VAR> to <VAR>-NOTFOUND if nothing was found.
So we need to compare <VAR> with "<VAR>-NOTFOUND" or just use `if([NOT] <VAR>)`, because `if(<VAR>)` is false if `<VAR>` ends in the suffix -NOTFOUND.

Reviewed By: kbobyrev

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

4 years ago[OpenMP] Fix releasing of stack memory
Joachim Protze [Fri, 14 Aug 2020 08:13:31 +0000 (10:13 +0200)]
[OpenMP] Fix releasing of stack memory

Starting with 787eb0c637b I got spurious segmentation faults for some testcases. I could nail it down to `brel` trying to release the "memory" of the node allocated on the stack of __kmpc_omp_wait_deps. With this patch, you will see the assertion triggering for some of the tests in the test suite.

My proposed solution for the issue is to just patch __kmpc_omp_wait_deps:
```
  __kmp_init_node(&node);
-  node.dn.on_stack = 1;
+  // the stack owns the node
+  __kmp_node_ref(&node);
```

What do you think?

Reviewed By: AndreyChurbanov

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

4 years ago[clangd] Warn developers when trying to link system-installed gRPC statically
Kirill Bobyrev [Fri, 14 Aug 2020 08:22:06 +0000 (10:22 +0200)]
[clangd] Warn developers when trying to link system-installed gRPC statically

Reviewed By: sammccall

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

4 years ago[NFC][StackSafety] Dedup callees
Vitaly Buka [Fri, 14 Aug 2020 08:14:02 +0000 (01:14 -0700)]
[NFC][StackSafety] Dedup callees

4 years agoRemove spurious empty line at the beginning of source file (NFC)
Mehdi Amini [Fri, 14 Aug 2020 08:02:35 +0000 (08:02 +0000)]
Remove spurious empty line at the beginning of source file (NFC)

4 years agoFix BufferPlacement Pass to derive from the TableGen generated parent class (NFC)
Mehdi Amini [Fri, 14 Aug 2020 07:55:57 +0000 (07:55 +0000)]
Fix BufferPlacement Pass to derive from the TableGen generated parent class (NFC)

4 years ago[CGAtomic] Mark atomic libcall functions `nounwind`
Gui Andrade [Fri, 14 Aug 2020 07:34:01 +0000 (07:34 +0000)]
[CGAtomic] Mark atomic libcall functions `nounwind`

These functions won't ever unwind. This is useful for MemorySanitizer
as it simplifies handling __atomic_load in particular.

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

4 years ago[gn build] Port 2e4a20fd706
LLVM GN Syncbot [Fri, 14 Aug 2020 07:42:49 +0000 (07:42 +0000)]
[gn build] Port 2e4a20fd706

4 years ago[SyntaxTree] Split `TreeTestBase` into header and source
Eduardo Caldas [Thu, 13 Aug 2020 16:10:50 +0000 (16:10 +0000)]
[SyntaxTree] Split `TreeTestBase` into header and source

* Switch to using directive on source files.
* Remove unused `SyntaxTreeTest::addFile`

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

4 years ago[lldb] Fix a crash when tab-completion an empty line in a function with only one...
Raphael Isemann [Fri, 14 Aug 2020 06:49:01 +0000 (08:49 +0200)]
[lldb] Fix a crash when tab-completion an empty line in a function with only one local variable

When LLDB sees only one possible completion for an input, it will add a trailing
space to the completion to signal that to the user. If the current argument is
quoted, that also means LLDB needs to add the trailing quote to finish the
current argument first.

In case the user is in a function with only one local variable and is currently
editing an empty line in the multiline expression editor, then we are in the
unique situation where we can have a unique completion for an empty input line.
(In a normal LLDB session this would never occur as empty input would just list
all the possible commands).

In this special situation our check if the current argument needs to receive a
trailing quote will crash LLDB as there is no current argument and the
completion code just unconditionally tries to access the current argument. This
just adds the missing check if we even have a current argument before we check
if we need to add a terminating quote character.

Reviewed By: labath

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

4 years ago[AMDGPU] Enable .rodata for amdpal os
Sebastian Neubauer [Thu, 13 Aug 2020 10:37:37 +0000 (12:37 +0200)]
[AMDGPU] Enable .rodata for amdpal os

PAL recently got support for multiple ELF sections and relocations,
therefore we can now use .rodata sections instead of forcing constants
into .text.

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

4 years ago[SVE] Fix bug in SVEIntrinsicOpts::optimizePTest
David Sherwood [Thu, 13 Aug 2020 09:44:12 +0000 (10:44 +0100)]
[SVE] Fix bug in SVEIntrinsicOpts::optimizePTest

The code wasn't taking into account that the two operands
passed to ptest could be identical and was trying to erase
them twice.

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

4 years ago[NFCI][SimpleLoopUnswitch] Adjust CostKind query
Sam Parker [Fri, 14 Aug 2020 06:53:43 +0000 (07:53 +0100)]
[NFCI][SimpleLoopUnswitch] Adjust CostKind query

When getUserCost was transitioned to use an explicit CostKind,
TCK_CodeSize was used even though the original kind was implicitly
SizeAndLatency so restore this behaviour. We now only query for
CodeSize when optimising for minsize.

I expect this to not change anything as, I think all, targets will
currently return the same value for CodeSize and SizeLatency. Indeed
I see no changes in the test suite for Arm, AArch64 and X86.

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

4 years ago[DebugInfo] Avoid an infinite loop with a truncated pre-v5 .debug_str_offsets.dwo.
Igor Kudrin [Fri, 14 Aug 2020 06:11:37 +0000 (13:11 +0700)]
[DebugInfo] Avoid an infinite loop with a truncated pre-v5 .debug_str_offsets.dwo.

dumpStringOffsetsSection() expects the size of a contribution to be
correctly aligned. The patch adds the corresponding verifications for
pre-v5 cases.

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

4 years agoRevert "[SLC] sprintf(dst, "%s", str) -> strcpy(dst, str)"
Arthur Eubanks [Fri, 14 Aug 2020 04:05:03 +0000 (21:05 -0700)]
Revert "[SLC] sprintf(dst, "%s", str) -> strcpy(dst, str)"

This reverts commit ab9fc8bae805c785066779e76e7846aabad5609e.

Incorrect transformation if the result is used.
Causes breakages, e.g.
http://green.lab.llvm.org/green/job/test-suite-verify-machineinstrs-x86_64-O3/8193/

4 years ago[NFC] Remove unused function.
Chris Kennelly [Fri, 14 Aug 2020 01:16:46 +0000 (21:16 -0400)]
[NFC] Remove unused function.

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

4 years ago[mlir] [VectorOps] Canonicalization of 1-D memory operations
aartbik [Thu, 13 Aug 2020 22:53:57 +0000 (15:53 -0700)]
[mlir] [VectorOps] Canonicalization of 1-D memory operations

Masked loading/storing in various forms can be optimized
into simpler memory operations when the mask is all true
or all false. Note that the backend does similar optimizations
but doing this early may expose more opportunities for further
optimizations. This further prepares progressively lowering
transfer read and write into 1-D memory operations.

Reviewed By: ThomasRaoux

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

4 years ago[WebAssembly] Add missing lit.local.cfg
Thomas Lively [Thu, 13 Aug 2020 23:33:52 +0000 (16:33 -0700)]
[WebAssembly] Add missing lit.local.cfg

4 years agohwasan: Emit the globals note even when globals are uninstrumented.
Peter Collingbourne [Thu, 13 Aug 2020 01:44:31 +0000 (18:44 -0700)]
hwasan: Emit the globals note even when globals are uninstrumented.

This lets us support the scenario where a binary is linked from a mix
of object files with both instrumented and non-instrumented globals.
This is likely to occur on Android where the decision of whether to use
instrumented globals is based on the API level, which is user-facing.

Previously, in this scenario, it was possible for the comdat from
one of the object files with non-instrumented globals to be selected,
and since this comdat did not contain the note it would mean that the
note would be missing in the linked binary and the globals' shadow
memory would be left uninitialized, leading to a tag mismatch failure
at runtime when accessing one of the instrumented globals.

It is harmless to include the note when targeting a runtime that does
not support instrumenting globals because it will just be ignored.

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

4 years ago[NewPM][CodeGen] Add machine code verification callback
Yuanfang Chen [Thu, 13 Aug 2020 19:52:35 +0000 (12:52 -0700)]
[NewPM][CodeGen] Add machine code verification callback

D83608 need this.

Reviewed By: aeubanks

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

4 years ago[X86][ELF] Prefer lowering MC_GlobalAddress operands to .Lfoo$local for STV_DEFAULT...
Ben Dunbobbin [Thu, 13 Aug 2020 22:58:40 +0000 (23:58 +0100)]
[X86][ELF] Prefer lowering MC_GlobalAddress operands to .Lfoo$local for STV_DEFAULT only

This patch restricts the behaviour of referencing via .Lfoo$local
local aliases, introduced in https://reviews.llvm.org/D73230, to
STV_DEFAULT globals only.

Hidden symbols via --fvisiblity=hidden (https://gcc.gnu.org/wiki/Visibility)
is an important scenario.

Benefits:

- Improves the size of object files by using fewer STT_SECTION symbols.

- The code reads a bit better (it was not obvious to me without going
  back to the code reviews why the canBenefitFromLocalAlias function
  currently doesn't consider visibility).

- There is also a side benefit in restoring the effectiveness of the
  --wrap linker option and making the behavior of --wrap consistent
  between LTO and normal builds for references within a translation-unit.
  Note: this --wrap behavior (which is specific to LLD) should not be
  considered reliable. See comments on https://reviews.llvm.org/D73230
  for more.

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

4 years ago[ConstProp] Handle insertelement constants
Arthur Eubanks [Mon, 10 Aug 2020 19:53:30 +0000 (12:53 -0700)]
[ConstProp] Handle insertelement constants

Previously ConstantFoldExtractElementInstruction() would only work with
insertelement instructions, not contants. This properly handles
insertelement constants as well.

Reviewed By: efriedma

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

4 years ago[DebugInfo] Add -fuse-ctor-homing cc1 flag so we can turn on constructor homing only...
Amy Huang [Thu, 13 Aug 2020 22:48:55 +0000 (15:48 -0700)]
[DebugInfo] Add -fuse-ctor-homing cc1 flag so we can turn on constructor homing only if limited debug info is already on.

This adds a cc1 flag to enable constructor homing but doesn't turn on debug
info if it wasn't enabled already (which is what using
-debug-info-kind=constructor does). This will be used for testing, and won't
be needed anymore once ctor homing is used as default / merged into =limited.

Bug to enable ctor homing: https://bugs.llvm.org/show_bug.cgi?id=46537

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

4 years ago[SLC] sprintf(dst, "%s", str) -> strcpy(dst, str)
Dávid Bolvanský [Thu, 13 Aug 2020 22:03:54 +0000 (00:03 +0200)]
[SLC] sprintf(dst, "%s", str) -> strcpy(dst, str)

Solves 46489

4 years ago[NFC] Remove unused variables.
Chris Kennelly [Thu, 13 Aug 2020 21:49:19 +0000 (17:49 -0400)]
[NFC] Remove unused variables.

These were no longer needed following
96855125e77044b1a5d3c7f0ae90ea3a5cb035c0.

Reviewed By: rupprecht

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

4 years agoRevert "[ARM] Fix IT block generation after Thumb2SizeReduce with -Oz"
David Green [Thu, 13 Aug 2020 21:40:36 +0000 (22:40 +0100)]
Revert "[ARM] Fix IT block generation after Thumb2SizeReduce with -Oz"

This reverts commit 18279a54b5d3382874924d6a3c7775b7e22598dc as it is
causing some chromium android test problems.

4 years ago[lldb] Improve diagnostics in lldb-repro when replay fails
Jonas Devlieghere [Thu, 13 Aug 2020 21:36:17 +0000 (14:36 -0700)]
[lldb] Improve diagnostics in lldb-repro when replay fails

 - Print the replay invocation.
 - Keep the reproducer around.
 - Return the "opposite" exit code so we don't have to rely on FileCheck
   to fail the test when the expected exit code is non-zero.

4 years ago[AMDGPU] Fix FP/BP spills when MUBUF constant offset exceeded
Austin Kerbow [Tue, 11 Aug 2020 19:04:17 +0000 (12:04 -0700)]
[AMDGPU] Fix FP/BP spills when MUBUF constant offset exceeded

If we need a scratch register for the spill don't use the same scratch
register that is being used for the MBUF offset.

Reviewed By: arsenm

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

4 years ago[WebAssembly] Allow inlining functions with different features
Thomas Lively [Thu, 13 Aug 2020 20:57:43 +0000 (13:57 -0700)]
[WebAssembly] Allow inlining functions with different features

Allow inlining only when the Callee has a subset of the Caller's
features. In principle, we should be able to inline regardless of any
features because WebAssembly supports features at module granularity,
not function granularity, but without this restriction it would be
possible for a module to "forget" about features if all the functions
that used them were inlined.

Requested in PR46812.

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

4 years ago[clang][Driver] Default to /usr/bin/ld on Solaris
Rainer Orth [Thu, 13 Aug 2020 20:42:58 +0000 (22:42 +0200)]
[clang][Driver] Default to /usr/bin/ld on Solaris

`clang` currently requires the native linker on Solaris:

  - It passes `-C` to `ld` which GNU `ld` doesn't understand.

  - To use `gld`, one needs to pass the correct `-m EMU` option to select
    the right emulation.  Solaris `ld` cannot handle that option.

So far I've worked around this by passing `-DCLANG_DEFAULT_LINKER=/usr/bin/ld`
to `cmake`.  However, if someone forgets this, it depends on the user's
`PATH` whether or not `clang` finds the correct linker, which doesn't make
for a good user experience.

While it would be nice to detect the linker flavor at runtime, this is more
involved.  Instead, this patch defaults to `/usr/bin/ld` on Solaris.  This
doesn't work on its own, however: a link fails with

  clang-12: error: unable to execute command: Executable "x86_64-pc-solaris2.11-/usr/bin/ld" doesn't exist!

I avoid this by leaving absolute paths alone in `ToolChain::GetLinkerPath`.

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

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

4 years ago[Tests] Update strncpy tests
Dávid Bolvanský [Thu, 13 Aug 2020 20:37:24 +0000 (22:37 +0200)]
[Tests] Update strncpy tests

4 years agoRe-apply "[llvm-jitlink] Don't demote unreferenced definitions in -harness mode"
Lang Hames [Thu, 13 Aug 2020 19:25:05 +0000 (12:25 -0700)]
Re-apply "[llvm-jitlink] Don't demote unreferenced definitions in -harness mode"

This reapplies commit e137b550587a85b0d9c9c539edc79de0122b6946 with
fixes for the broken test case: Non-global symbols should only be
skipped after checking that they're not referenced by the harness.

4 years ago[SLC] Optimize strncpy(a, a, C) to memcpy(a, a000, C)
Dávid Bolvanský [Thu, 13 Aug 2020 20:22:33 +0000 (22:22 +0200)]
[SLC] Optimize strncpy(a, a, C) to memcpy(a, a000, C)
Solves PR47154

4 years ago[InstSimplify] Add tests for assume with min/max intrinsic (NFC)
Nikita Popov [Thu, 13 Aug 2020 20:08:40 +0000 (22:08 +0200)]
[InstSimplify] Add tests for assume with min/max intrinsic (NFC)

If we assume one of the operands is smaller/greater, then min/max
may be simplified.

4 years agosanitizer_common: Introduce internal_madvise and start using it.
Peter Collingbourne [Thu, 13 Aug 2020 02:32:15 +0000 (19:32 -0700)]
sanitizer_common: Introduce internal_madvise and start using it.

A recent change to sanitizer_common caused us to issue the syscall
madvise(MADV_HUGEPAGE) during HWASAN initialization. This may lead to a
problem if madvise is instrumented (e.g. because libc is instrumented
or the user intercepted it). For example, on Android the syscall may
fail if the kernel does not support transparent hugepages, which leads
to an attempt to set errno in a HWASAN instrumented function. Avoid
this problem by introducing a syscall wrapper and using it to issue
this syscall.

Tested only on Linux; includes untested updates for the other
platforms.

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

4 years agoAdd "status" to the list of absl libraries.
Vy Nguyen [Wed, 12 Aug 2020 16:23:37 +0000 (12:23 -0400)]
Add "status" to the list of absl libraries.

The Abseil-NoInternalDependenciesCheck currently mistakenly triggers on any usage of internal helpers even if it is within absl/status.

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

4 years ago[SystemZ][z/OS] enable trigraphs by default on z/OS
Abhina Sreeskantharajan [Thu, 13 Aug 2020 18:33:04 +0000 (14:33 -0400)]
[SystemZ][z/OS] enable trigraphs by default on z/OS

This patch enables trigraphs on z/OS.

Reviewed By: hubert.reinterpretcast, fanbo-meng

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

4 years ago[tsan] Respect no_huge_pages_for_shadow.
Chris Kennelly [Wed, 12 Aug 2020 16:13:32 +0000 (12:13 -0400)]
[tsan] Respect no_huge_pages_for_shadow.

Disable huge pages in the TSan shadow regions when no_huge_pages_for_shadow == true (default).

Reviewed By: eugenis

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

4 years ago[libc] Add strtok_r implementation.
parallels [Thu, 13 Aug 2020 19:51:16 +0000 (15:51 -0400)]
[libc] Add strtok_r implementation.

Reviewed By: sivachandra

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

4 years ago[SVE] Lower fixed length vector integer UMIN/UMAX
Cameron McInally [Thu, 13 Aug 2020 19:47:34 +0000 (14:47 -0500)]
[SVE] Lower fixed length vector integer UMIN/UMAX

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

4 years ago[gn build] (manually) port d650cbc349ccc4 better
Nico Weber [Thu, 13 Aug 2020 19:48:03 +0000 (15:48 -0400)]
[gn build] (manually) port d650cbc349ccc4 better

4 years ago[gn build] (manually) port d650cbc349ccc4
Nico Weber [Thu, 13 Aug 2020 19:43:43 +0000 (15:43 -0400)]
[gn build] (manually) port d650cbc349ccc4

4 years ago[ORC][NFC] Fix typo in comment
Stefan Gränitz [Tue, 11 Aug 2020 11:39:54 +0000 (13:39 +0200)]
[ORC][NFC] Fix typo in comment

4 years ago[darwin][driver] fix isMacosxVersionLT minimum supported OS version check
Alex Lorenz [Thu, 13 Aug 2020 19:05:57 +0000 (12:05 -0700)]
[darwin][driver] fix isMacosxVersionLT minimum supported OS version check

The previous Driver's triple check only worked for -target, but not for -arch -mmacosx-version-min invocations

4 years ago[mlir][docs] Update/Add documentation for MLIRs Pattern Rewrite infrastructure
River Riddle [Thu, 13 Aug 2020 19:05:04 +0000 (12:05 -0700)]
[mlir][docs] Update/Add documentation for MLIRs Pattern Rewrite infrastructure

This infrastructure has evolved a lot over the course of MLIRs lifetime, and has never truly been documented outside of rationale or proposals. This revision aims to document the infrastructure and user facing API, with the rationale specific portions moved to the Rationale folder and updated.

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

4 years ago[mlir][DialectConversion] Update the documentation for dialect conversion
River Riddle [Thu, 13 Aug 2020 19:04:57 +0000 (12:04 -0700)]
[mlir][DialectConversion] Update the documentation for dialect conversion

This revision updates the documentation for dialect conversion, as many concepts have changed/evolved over time.

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

4 years ago[ORC] cloneToNewContext() can work with a const-ref to ThreadSafeModule
Stefan Gränitz [Sun, 2 Aug 2020 12:37:33 +0000 (14:37 +0200)]
[ORC] cloneToNewContext() can work with a const-ref to ThreadSafeModule

4 years ago[ORC] Fix SymbolLookupSet::containsDuplicates()
Stefan Gränitz [Sun, 2 Aug 2020 12:36:02 +0000 (14:36 +0200)]
[ORC] Fix SymbolLookupSet::containsDuplicates()

4 years ago[LLDB] Fix how ValueObjectChild handles bit-fields stored in a Scalar in UpdateValue()
shafik [Thu, 13 Aug 2020 17:49:40 +0000 (10:49 -0700)]
[LLDB] Fix how ValueObjectChild handles bit-fields stored in a Scalar in UpdateValue()

When bit-field data was stored in a Scalar in ValueObjectChild during UpdateValue()
it was extracting the bit-field value. Later on in lldb_private::DumpDataExtractor(…)
we were again attempting to extract the bit-field. Which would then not obtain the
correct value. This will remove the extra extraction in UpdateValue().
We hit this specific case when values are passed in registers, which we could only
reproduce in an optimized build.

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

4 years ago[elfabi] Move llvm-elfabi related code to InterfaceStub library
Haowei Wu [Tue, 11 Aug 2020 18:44:22 +0000 (11:44 -0700)]
[elfabi] Move llvm-elfabi related code to InterfaceStub library

This change moves elfabi related code to llvm/InterfaceStub library
so it can be shared by multiple llvm tools without causing cyclic
dependencies.

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

4 years agoRevert "[llvm-jitlink] Don't demote unreferenced definitions in -harness mode."
Lang Hames [Thu, 13 Aug 2020 18:44:42 +0000 (11:44 -0700)]
Revert "[llvm-jitlink] Don't demote unreferenced definitions in -harness mode."

This reverts commit e137b550587a85b0d9c9c539edc79de0122b6946.

This commit broke a test case. Reverting while I investigate.

4 years ago[AMDGPU] Inhibit SDWA if target instruction has FI
Stanislav Mekhanoshin [Thu, 13 Aug 2020 18:15:44 +0000 (11:15 -0700)]
[AMDGPU] Inhibit SDWA if target instruction has FI

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

4 years ago[AMDGPU] Fix misleading SDWA verifier error. NFC.
Stanislav Mekhanoshin [Thu, 13 Aug 2020 18:22:01 +0000 (11:22 -0700)]
[AMDGPU] Fix misleading SDWA verifier error. NFC.

The old error from GFX9 shall be updated to GFX9+.

4 years agoFix PR45442: Bail out when MemorySSA information is not available
Aditya Kumar [Thu, 13 Aug 2020 07:06:22 +0000 (00:06 -0700)]
Fix PR45442: Bail out when MemorySSA information is not available

Reviewers: sebpop, uabelho, fhahn
Reviewed by: fhahn

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

4 years ago[Tests] Removed debug copy command
Dávid Bolvanský [Thu, 13 Aug 2020 18:21:19 +0000 (20:21 +0200)]
[Tests] Removed debug copy command

4 years ago[Diagnostics] Skip var decl of structs for -Wstring-concatenation
Dávid Bolvanský [Thu, 13 Aug 2020 18:19:21 +0000 (20:19 +0200)]
[Diagnostics] Skip var decl of structs for -Wstring-concatenation

4 years ago[llvm-jitlink] Don't demote unreferenced definitions in -harness mode.
Lang Hames [Thu, 13 Aug 2020 03:44:05 +0000 (20:44 -0700)]
[llvm-jitlink] Don't demote unreferenced definitions in -harness mode.

Demoting unreferenced externals is unsafe if multiple interdependent test
objects are used, including objects loaded from archives.

4 years ago[JITLink][MachO] Return an error when MachO TLV relocations are encountered.
Lang Hames [Thu, 13 Aug 2020 00:43:28 +0000 (17:43 -0700)]
[JITLink][MachO] Return an error when MachO TLV relocations are encountered.

MachO TLV relocations aren't supported yet. Error out rather than falling
through to llvm_unreachable.

4 years ago[llvm-libtool-darwin] Add support for -arch_only
Sameer Arora [Tue, 28 Jul 2020 16:50:51 +0000 (09:50 -0700)]
[llvm-libtool-darwin] Add support for -arch_only

Add support for -arch_only option for llvm-libtool-darwin. This diff
also adds support for accepting universal files as input and flattening
them to create the required static library. Supports input universal
files contaning both Mach-O object files or archives.

Differences from cctools' libtool:
- `-arch_only` can be specified multiple times
- archives containing universal files are considered invalid (libtool
allows such archives)

Reviewed by jhenderson, smeenai

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

4 years ago[flang][openacc] Handle optional end directive in combined construct
Valentin Clement [Thu, 13 Aug 2020 18:04:43 +0000 (14:04 -0400)]
[flang][openacc] Handle optional end directive in combined construct

OpenACC combined construct can have an optional end directive. This patch handle this
case in the parsing/unparsing with a canonicalization step. Unlike OmpEndLoopDirective,
this doesn't need a special treatment in the pre-fir tree as there is no clause attached to
a AccEndCombinedDirective.

Reviewed By: klausler

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

4 years ago[llvm-libtool-darwin] Refactor ArchiveWriter
Sameer Arora [Wed, 29 Jul 2020 14:40:11 +0000 (07:40 -0700)]
[llvm-libtool-darwin] Refactor ArchiveWriter

Refactoring function `writeArchive` in ArchiveWriter. Added a new
function `writeArchiveBuffer` that returns the archive in a memory
buffer instead of writing it out to the disk. This refactor is necessary
so as to allow `llvm-libtool-darwin` to write universal files containing
archives.

Reviewed by jhenderson, MaskRay, smeenai

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

4 years ago[BPI] Improve static heuristics for integer comparisons
Dávid Bolvanský [Thu, 13 Aug 2020 10:45:14 +0000 (12:45 +0200)]
[BPI] Improve static heuristics for integer comparisons

Similarly as for pointers, even for integers a == b is usually false.

GCC also uses this heuristic.

Reviewed By: ebrevnov

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

4 years ago[llvm-install-name-tool] Add more documentation
Sameer Arora [Mon, 10 Aug 2020 01:58:02 +0000 (18:58 -0700)]
[llvm-install-name-tool] Add more documentation

Add documentation for the remaining options of
`llvm-install-name-tool`.

Reviewed by jhenderson, smeenai

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

4 years ago[flang] Descriptor-based I/O using wrong size for contiguous unformatted I/O
peter klausler [Wed, 12 Aug 2020 23:25:26 +0000 (16:25 -0700)]
[flang] Descriptor-based I/O using wrong size for contiguous unformatted I/O

The descriptor-based I/O routine was using the size of the descriptor
rather than the size of the described data for the transfer.  Fix,
and add a comment to the relevant API.

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

4 years ago[X86][SSE] Add HADD combine regression case from rG9bd97d036398
Simon Pilgrim [Thu, 13 Aug 2020 15:56:08 +0000 (16:56 +0100)]
[X86][SSE] Add HADD combine regression case from rG9bd97d036398

rG9bd97d036398 caused a miscompile of this internal test case

4 years ago[lldb] Set the launch flags to GetLaunchInfo().GetLaunchFlags()
Jonas Devlieghere [Thu, 13 Aug 2020 17:23:52 +0000 (10:23 -0700)]
[lldb] Set the launch flags to GetLaunchInfo().GetLaunchFlags()

Instead of clearing the launch flags, always pass the target's current
launch flags.

4 years ago[mlir] Test CallOp STD->LLVM conversion.
Alexander Belyaev [Thu, 13 Aug 2020 16:53:07 +0000 (18:53 +0200)]
[mlir] Test CallOp STD->LLVM conversion.

This exercises the corner case that was fixed in
https://reviews.llvm.org/rG8979a9cdf226066196f1710903d13492e6929563.

The bug can be reproduced when there is a @callee with a custom type argument and @caller has a producer of this argument passed to the @callee.

Example:
func @callee(!test.test_type) -> i32
func @caller() -> i32 {
  %arg = "test.type_producer"() : () -> !test.test_type
  %out = call @callee(%arg) : (!test.test_type) -> i32
  return %out : i32
}

Even though there is a type conversion for !test.test_type, the output IR (before the fix) contained a DialectCastOp:

module {
  llvm.func @callee(!llvm.ptr<i8>) -> !llvm.i32
  llvm.func @caller() -> !llvm.i32 {
    %0 = llvm.mlir.null : !llvm.ptr<i8>
    %1 = llvm.mlir.cast %0 : !llvm.ptr<i8> to !test.test_type
    %2 = llvm.call @callee(%1) : (!test.test_type) -> !llvm.i32
    llvm.return %2 : !llvm.i32
  }
}

instead of

module {
  llvm.func @callee(!llvm.ptr<i8>) -> !llvm.i32
  llvm.func @caller() -> !llvm.i32 {
    %0 = llvm.mlir.null : !llvm.ptr<i8>
    %1 = llvm.call @callee(%0) : (!llvm.ptr<i8>) -> !llvm.i32
    llvm.return %1 : !llvm.i32
  }
}

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

4 years ago[ARM] Mark VMINNMA/VMAXNMA as commutative
David Green [Thu, 13 Aug 2020 17:01:11 +0000 (18:01 +0100)]
[ARM] Mark VMINNMA/VMAXNMA as commutative

These operations take Qda and Rn register operands, which are
commutative so long as the instruction is not predicated.

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

4 years ago[flang] Implement shape analysis of TRANSFER intrinsic function result
peter klausler [Wed, 12 Aug 2020 23:38:28 +0000 (16:38 -0700)]
[flang] Implement shape analysis of TRANSFER intrinsic function result

The shape (esp. the size) of the result of a call to TRANSFER
is implemented according to the definition in the standard.

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

4 years ago[lldb] Skip TestStepScripted with reproducers
Jonas Devlieghere [Thu, 13 Aug 2020 16:41:52 +0000 (09:41 -0700)]
[lldb] Skip TestStepScripted with reproducers

Some of the test methods were already skipped because of an unexpected
packet. The test started failing after it was expanded. Skip the whole
test with reproducers so we don't have to add the decorator for every
method.

4 years ago[SVE] Lower fixed length vector integer SMIN/SMAX
Cameron McInally [Thu, 13 Aug 2020 16:00:37 +0000 (11:00 -0500)]
[SVE] Lower fixed length vector integer SMIN/SMAX

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

4 years ago[clangd] Move clang-tidy check modifications into ClangdServer
Kadir Cetinkaya [Mon, 6 Jul 2020 13:44:16 +0000 (15:44 +0200)]
[clangd] Move clang-tidy check modifications into ClangdServer

Summary:
This enables sharing the logic between standalone clangd and embedders
of it. The new approach should be same performance-wise, as it is only called
once per addDocument call.

This patch also introduces a blacklisting code path for disabling crashy or
high-noise tests, until we figure out a way to make them work with clangd-setup.

The biggest difference is the way we make use of preambles, hence those checks
can't see directives coming from the preamble section of the file. The second
thing is the fact that code might-not be compiling while clangd is trying to
build an AST, hence some checks might choke on those incomplete ASTs.

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[clangd] Send EOF before resetting diagnostics consumer
Kadir Cetinkaya [Sun, 5 Jul 2020 19:12:11 +0000 (21:12 +0200)]
[clangd] Send EOF before resetting diagnostics consumer

Summary:
Some clang-tidy checkers, e.g. llvm-include-order can emit diagnostics
at this callback (as mentioned in the comments).

Clangd was resetting diag consumer to IgnoreDiags before sending EOF, hence we
were unable to emit diagnostics for such checkers.

This patch changes the order of that reset and preprocosser event to make sure
we emit that diag.

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

Reviewers: sammccall

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

Tags: #clang

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

4 years agoFix PR45442: Bail out when MemorySSA information is not available
Aditya Kumar [Thu, 13 Aug 2020 07:06:22 +0000 (00:06 -0700)]
Fix PR45442: Bail out when MemorySSA information is not available

4 years agoAdd cold attribute to one time construction APIs
Aditya Kumar [Thu, 13 Aug 2020 05:11:50 +0000 (22:11 -0700)]
Add cold attribute to one time construction APIs

_cxa_guard_acquire is used for only one purpose,
namely guarding local static variable initialization,
and since that purpose is definitionally cold,
it should be attributed as cold

Reviewed By: ldionne

Reviewers: mclow.lists, ldionne, jfb, yfeldblum

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

4 years ago[VectorCombine] Fix for non-zero addrspace when creating vector load from scalar...
Bjorn Pettersson [Thu, 13 Aug 2020 15:43:12 +0000 (17:43 +0200)]
[VectorCombine] Fix for non-zero addrspace when creating vector load from scalar load

This is a fixup to commit 43bdac290663f4424f9fb, to make sure the
address space from the original load pointer is retained in the
vector pointer.

Resolves problem with
  Assertion `castIsValid(op, S, Ty) && "Invalid cast!"' failed.
due to address space mismatch.

Reviewed By: spatel

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

4 years ago[InstCombine] Handle gc.relocate(null) in one iteration
Serguei Katkov [Wed, 12 Aug 2020 07:25:18 +0000 (14:25 +0700)]
[InstCombine] Handle gc.relocate(null) in one iteration

InstCombine adds users of transformed instruction to working list to
process on the same iteration. However gc.relocate may have a hidden
user (next gc.relocate) which is connected through gc.statepoint intrinsic and
there is no direct def-use chain between them.

In this case if the next gc.relocation is already processed it will not be added
to worklist and will not be able to be processed on the same iteration.
Let's we have the following case:
A = gc.relocate(null)
B = statepoint(A)
C = gc.relocate(B, hidden(A))
If C is already considered then after replacement of A with null, statepoint B
instruction will be added to the queue but not C.
C can be processed only on the next iteration.

If the chain of relocation is pretty long the many iteration may be required.
This change is to reduce the number of iteration to meet the latest changes
related to reducing infinite loop threshold.

This is a quick (not best) fix. In the follow up patches I plan to move gc relocation
handling into statepoint handler. This should also help to remove unused gc live
entries in statepoint bundle.

Reviewers: reames, dantrushin
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D75598

4 years ago[clangd] Extract BackgroundIndex::Options struct. NFC
Sam McCall [Thu, 13 Aug 2020 16:01:47 +0000 (18:01 +0200)]
[clangd] Extract BackgroundIndex::Options struct. NFC

I've dropped the background context parameter, since we in practice just pass the
current context there, and we now have a different way to specify context too.
While here, clean up a couple of comments.

Reviewed By: kadircet

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

4 years ago[ELF] --gdb-index: skip SHF_GROUP .debug_info
Fangrui Song [Thu, 13 Aug 2020 03:50:59 +0000 (20:50 -0700)]
[ELF] --gdb-index: skip SHF_GROUP .debug_info

-gdwarf-5 -fdebug-types-section may produce multiple .debug_info sections.  All
except one are type units (.debug_types before DWARF v5). When constructing
.gdb_index, we should ignore these type units. We use a simple heuristic: the
compile unit does not have the SHF_GROUP flag. (This needs to be revisited if
people place compile unit .debug_info in COMDAT groups.)

This issue manifests as a data race: because an object file may have multiple
.debug_info sections, we may concurrently construct `LLDDwarfObj` for the same
file in multiple threads. The threads may access `InputSectionBase::data()`
concurrently on the same input section. `InputSectionBase::data()` does a lazy
uncompress() and rewrites the member variable `rawData`. A thread running zlib
`inflate()` (transitively called by uncompress()) on a buffer with `rawData`
tampered by another thread may fail with `uncompress failed: zlib error: Z_DATA_ERROR`.

Even if no data race occurred in an optimistic run, if there are N .debug_info,
one CU entry and its address ranges will be replicated N times. The result
.gdb_index can be much larger than a correct one.

The new test gdb-index-dwarf5-type-unit.s actually has two compile units. This
cannot be produced with regular approaches (it can be produced with -r
--unique). This is used to demonstrate that the .gdb_index construction code
only considers the last non-SHF_GROUP .debug_info

Reviewed By: grimar

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

4 years ago[flang] Fix assert on character literal substrings as arguments
Peter Steinfeld [Thu, 13 Aug 2020 15:07:58 +0000 (08:07 -0700)]
[flang] Fix assert on character literal substrings as arguments

Character literal substrings used as arguments were causing asserts.  This
happened when the code was trying to get the DynamicType of the substring.  We
were only recording the DynamicType of the Designator on which the substring
was based.  For character literal substrings, the Designator was a character
literal, and we weren't handling getting its type.

I fixed this by changing the `GetType()` method for `DynamicType` to check to
see if we were getting the type of a `Substring` and calculating the type of
the substring by getting the number of bytes in an element of the string.

I also changed the test `resolve49.f90` with some tests, one of which causes
the original crash.

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

4 years ago[flang] Correct manipulation of mixed complex expressions
peter klausler [Wed, 12 Aug 2020 23:35:26 +0000 (16:35 -0700)]
[flang] Correct manipulation of mixed complex expressions

Ensure that mixed complex expressions (one operand complex,
the other not) are properly manipulated; add test.

4 years ago[flang] Ensure Preprocessor::Define saves macro names correctly
peter klausler [Wed, 12 Aug 2020 23:20:20 +0000 (16:20 -0700)]
[flang] Ensure Preprocessor::Define saves macro names correctly

This fixes problems with macros defined with -D on the command line
and predefined macros defined in the throwaway driver program.

4 years ago[flang] Correct the default value for PAD= to PAD='YES'.
peter klausler [Wed, 12 Aug 2020 23:09:51 +0000 (16:09 -0700)]
[flang] Correct the default value for PAD= to PAD='YES'.

4 years ago[clangd] Clean up old test fixture/names a little. NFC
Sam McCall [Thu, 13 Aug 2020 15:42:58 +0000 (17:42 +0200)]
[clangd] Clean up old test fixture/names a little. NFC

4 years ago[AArch64][x86] add tests for x/sqrt(x); NFC
Sanjay Patel [Thu, 13 Aug 2020 14:52:38 +0000 (10:52 -0400)]
[AArch64][x86] add tests for x/sqrt(x); NFC

4 years ago[ELF] -r: allow SHT_X86_64_UNWIND to be merged into SHT_PROGBITS
Fangrui Song [Thu, 13 Aug 2020 03:14:00 +0000 (20:14 -0700)]
[ELF] -r: allow SHT_X86_64_UNWIND to be merged into SHT_PROGBITS

* For .cfi_*, GCC/GNU as emits SHT_PROGBITS type .eh_frame sections.
* Since rL252300, clang emits SHT_X86_64_UNWIND type .eh_frame sections
  (originated from Solaris, documented in the x86-64 psABI).
* Some assembly use `.section .eh_frame,"a",@unwind` to generate
  SHT_X86_64_UNWIND .eh_frame sections.

In a non-relocatable link, input .eh_frame are combined and there is
only one SyntheticSection .eh_frame in the output section, so the
"section type mismatch" diagnostic does not fire.

In a relocatable link, there is no SyntheticSection .eh_frame. .eh_frame of
mixed types can trigger the diagnostic. This patch fixes it by adding another
special case 0x70000001 (= SHT_X86_64_UNWIND) to canMergeToProgbits().

    ld.lld -r gcc.o clang.o => error: section type mismatch for .eh_frame

There was a discussion "RFC: Usefulness of SHT_X86_64_UNWIND" on the x86-64-abi
mailing list. Folks are not wild about making the psABI value 0x70000001 into
gABI, but a few think defining 0x70000001 for .eh_frame may be a good idea for a
new architecture.

Reviewed By: grimar

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

4 years ago[llvm-objdump] Change symbol name/PLT decoding errors to warnings
Fangrui Song [Thu, 13 Aug 2020 15:13:26 +0000 (08:13 -0700)]
[llvm-objdump] Change symbol name/PLT decoding errors to warnings

If the referenced symbol of a J[U]MP_SLOT is invalid (e.g. symbol index 0), llvm-objdump -d will bail out:

```
error: 'a': st_name (0x326600) is past the end of the string table of size 0x7
```

where 0x326600 is the st_name field of the first entry past the end of .symtab

Change it to a warning to continue dumping.
`X86/plt.test` uses a prebuilt executable, so I pick `ELF/AArch64/plt.test`
which has a YAML input and can be easily modified.

Reviewed By: jhenderson

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

4 years ago[libc++] Ensure the CI scripts can find Ninja
Louis Dionne [Thu, 13 Aug 2020 15:10:13 +0000 (11:10 -0400)]
[libc++] Ensure the CI scripts can find Ninja

Ninja isn't necessarily installed on macOS out of the box, so make sure
we use the SDK Ninja instead of relying on one being available on the
system.

4 years ago[clangd] Revert "[clangd] Fix crash-bug in preamble indexing when using modules."
Adam Czachorowski [Thu, 13 Aug 2020 14:59:34 +0000 (16:59 +0200)]
[clangd] Revert "[clangd] Fix crash-bug in preamble indexing when using modules."

This reverts commit 4061d9e42cff621462931ac7df9666806c77a237.
Tests are failing in some configuration, likely due to not cleaning up
module cache path before running the test.

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

4 years ago[analyzer] Fix crash with pointer to members values
Valeriy Savchenko [Wed, 12 Aug 2020 08:04:56 +0000 (11:04 +0300)]
[analyzer] Fix crash with pointer to members values

This fix unifies all of the different ways we handled pointer to
members into one.  The crash was caused by the fact that the type
of pointer-to-member values was `void *`, and while this works
for the vast majority of cases it breaks when we actually need
to explain the path for the report.

rdar://problem/64202361

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

4 years agoFix unused variable warning. NFC.
Simon Pilgrim [Thu, 13 Aug 2020 14:43:20 +0000 (15:43 +0100)]
Fix unused variable warning. NFC.

Reduce the dyn_cast<> to a isa<> as that's all non-assert builds require, and move the cast<> inside the assert.

4 years agorG9bd97d0363987b582 - Revert "[X86][SSE] Fold HOP(SHUFFLE(X),SHUFFLE(Y)) --> SHUFFLE...
Simon Pilgrim [Thu, 13 Aug 2020 13:48:51 +0000 (14:48 +0100)]
rG9bd97d0363987b582 - Revert "[X86][SSE] Fold HOP(SHUFFLE(X),SHUFFLE(Y)) --> SHUFFLE(HOP(X,Y))"

This reverts commit 9bd97d0363987b582e4a92b354b02e86ac068407.

Seeing some codegen issues in internal testing.

4 years agoclang: Fix minor grammar-o in diag added in c354b2e3b
Nico Weber [Thu, 13 Aug 2020 14:06:27 +0000 (10:06 -0400)]
clang: Fix minor grammar-o in diag added in c354b2e3b

4 years ago[mlir][openacc] Introduce OpenACC dialect with parallel, data, loop operations
Valentin Clement [Wed, 12 Aug 2020 15:48:24 +0000 (11:48 -0400)]
[mlir][openacc] Introduce OpenACC dialect with parallel, data, loop operations

This patch introduces the OpenACC dialect with three operation defined
parallel, data and loop operations with custom parsing and printing.

OpenACC dialect RFC can be find here: https://llvm.discourse.group/t/rfc-openacc-dialect/546/2

Reviewed By: rriddle, kiranchandramohan

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

4 years ago[libc++][test] Fix another -Wstring-concatenation warning
Louis Dionne [Thu, 13 Aug 2020 13:51:20 +0000 (09:51 -0400)]
[libc++][test] Fix another -Wstring-concatenation warning

4 years ago[MLIR] Support for ReturnOps in memref map layout normalization
avarmapml [Thu, 13 Aug 2020 13:39:22 +0000 (19:09 +0530)]
[MLIR] Support for ReturnOps in memref map layout normalization

-- This commit handles the returnOp in memref map layout normalization.
-- An initial filter is applied on FuncOps which helps us know which functions can be
   a suitable candidate for memref normalization which doesn't lead to invalid IR.
-- Handles memref map normalization for external function assuming the external function
   is normalizable.

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

4 years ago[gn build] Port d17437d2bd8
LLVM GN Syncbot [Thu, 13 Aug 2020 13:35:44 +0000 (13:35 +0000)]
[gn build] Port d17437d2bd8