platform/upstream/llvm.git
3 years ago[ImplicitNullChecks] NFC: Remove unused PointerReg arg in dep analysis
Anna Thomas [Thu, 10 Sep 2020 19:30:42 +0000 (15:30 -0400)]
[ImplicitNullChecks] NFC: Remove unused PointerReg arg in dep analysis

The PointerReg arg was passed into the dependence function for an
assertion which no longer exists. So, this patch updates the dependence
functions to avoid the PointerReg in the signature.

Tests-Run: make check

3 years ago[SVE] Bail from VectorUtils heuristics for scalable vectors
Christopher Tetreault [Thu, 10 Sep 2020 18:29:16 +0000 (11:29 -0700)]
[SVE] Bail from VectorUtils heuristics for scalable vectors

Bail from maskIsAllZeroOrUndef and maskIsAllOneOrUndef prior to iterating over the number of
elements for scalable vectors.

Assert that the mask type is not scalable in possiblyDemandedEltsInMask .

Assert that the types are correct in all three functions.

Reviewed By: efriedma

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

3 years ago[Hexagon] Split pair-based masked memops
Krzysztof Parzyszek [Thu, 10 Sep 2020 19:15:37 +0000 (14:15 -0500)]
[Hexagon] Split pair-based masked memops

3 years agoFix operator!= for Dialects.
Federico Lebrón [Thu, 10 Sep 2020 19:18:07 +0000 (19:18 +0000)]
Fix operator!= for Dialects.

Currently the global operator!=(bool, bool) is selected due to the implicit bool
conversion operator. Since this is never the desired semantics, we give it a
standard operator!= and make the bool conversion explicit.

Depends On D86809

Reviewed By: rriddle

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

3 years ago[gn build] (semi-manually) port 009cd4e4910
Nico Weber [Thu, 10 Sep 2020 19:10:12 +0000 (15:10 -0400)]
[gn build] (semi-manually) port 009cd4e4910

3 years agoAllow Dialects to be initialized via nullptr.
Federico Lebrón [Thu, 10 Sep 2020 19:14:42 +0000 (19:14 +0000)]
Allow Dialects to be initialized via nullptr.

This allows Dialect to follow the MLIR style of nullable objects, and in fact is expected by `Dialect::operator bool() const` which already tests whether `def == nullptr`. This just wasn't a reachable situation, because the constructor was dereferencing the pointer unconditionally.

Reviewed By: rriddle

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

3 years agoMake struct dialects have the same field name as everything else, 'dialect'.
Federico Lebrón [Thu, 10 Sep 2020 19:00:49 +0000 (19:00 +0000)]
Make struct dialects have the same field name as everything else, 'dialect'.

Also make the behavior of getting a dialect more forgiving, in the case where
there isn't a dialect associated with an attribute.

Depends On D86807

Reviewed By: mehdi_amini

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

3 years ago[WebAssembly] Set unreachable as canonical to permit disassembly
Dominic Chen [Thu, 10 Sep 2020 05:02:13 +0000 (01:02 -0400)]
[WebAssembly] Set unreachable as canonical to permit disassembly

Currently, using llvm-objdump to disassemble a function containing
unreachable will trigger an assertion while decoding the opcode, since both
unreachable and debug_unreachable have the same encoding. To avoid this, set
unreachable as the canonical decoding.

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

3 years agoRevert "[Support] Use unique_function rather than std::function for ThreadPool TaskTy."
Lang Hames [Thu, 10 Sep 2020 18:36:13 +0000 (11:36 -0700)]
Revert "[Support] Use unique_function rather than std::function for ThreadPool TaskTy."

This reverts commit d9c8b0256cfc673c2413b13993c9440be598818f.

Some MSVC std::packaged_task implementations are not compatible with move-only types.
This caused failures on some of the Windows builders (e.g.
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/69412).

Reverting until I can come up with a workaround.

3 years ago[SLPVectorizer][X86][AMDGPU] Remove fcmp+select to fmin/fmax reduction support.
Craig Topper [Wed, 9 Sep 2020 20:45:36 +0000 (13:45 -0700)]
[SLPVectorizer][X86][AMDGPU] Remove fcmp+select to fmin/fmax reduction support.

Previously we could match fcmp+select to a reduction if the fcmp had
the nonans fast math flag. But if the select had the nonans fast
math flag, InstCombine would turn it into a fminnum/fmaxnum intrinsic
before SLP gets to it. Seems fairly likely that if one of the
fcmp+select pair have the fast math flag, they both would.

My plan is to start vectorizing the fmaxnum/fminnum version soon,
but I wanted to get this code out as it had some of the strangest
fast math flag behaviors.

3 years ago[compiler-rt] [netbsd] Regenerate syscall hooks
Kamil Rytarowski [Thu, 10 Sep 2020 18:11:35 +0000 (20:11 +0200)]
[compiler-rt] [netbsd] Regenerate syscall hooks

Sync with NetBSD 9.99.72.

3 years ago[compiler-rt] [netbsd] Update generate_netbsd_syscalls.awk
Kamil Rytarowski [Thu, 10 Sep 2020 18:09:53 +0000 (20:09 +0200)]
[compiler-rt] [netbsd] Update generate_netbsd_syscalls.awk

Sync with NetBSD 9.99.72.

3 years ago[PGO] Skip if an IndirectBrInst critical edge cannot be split
Fangrui Song [Thu, 10 Sep 2020 18:03:48 +0000 (11:03 -0700)]
[PGO] Skip if an IndirectBrInst critical edge cannot be split

PGOInstrumentation runs `SplitIndirectBrCriticalEdges` but some IndirectBrInst
critical edge cannot be split. `getInstrBB` will crash when calling `SplitCriticalEdge`, e.g.

  int foo(char *p) {
    void *targets[2];
    targets[0] = &&indirect;
    targets[1] = &&end;
    for (;; p++)
      if (*p == 7) {
  indirect:
        goto *targets[p[1]]; // the self loop is critical in -O
      }
  end:
    return 0;
  }

Skip such critical edges to prevent a crash.

Reviewed By: davidxl, lebedev.ri

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

3 years ago[NFC] Fix whitespace in lldb-vscode --help
Jordan Rupprecht [Thu, 10 Sep 2020 17:57:08 +0000 (10:57 -0700)]
[NFC] Fix whitespace in lldb-vscode --help

3 years ago[Support] Use unique_function rather than std::function for ThreadPool TaskTy.
Lang Hames [Thu, 10 Sep 2020 17:05:46 +0000 (10:05 -0700)]
[Support] Use unique_function rather than std::function for ThreadPool TaskTy.

This will allow non-copyable function objects (e.g. lambdas that capture
unique_ptrs) to be used with ThreadPool.

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

3 years ago[ImplicitNullCheck] Handle instructions that preserve zero value
Anna Thomas [Thu, 10 Sep 2020 17:14:44 +0000 (13:14 -0400)]
[ImplicitNullCheck] Handle instructions that preserve zero value

This is the first in a series of patches to make implicit null checks
more general. This patch identifies instructions that preserves zero
value of a register and considers that as a valid instruction to hoist
along with the faulting load. See added testcases.

Reviewed-By: reames, dantrushin
Differential Revision: https://reviews.llvm.org/D87108

3 years ago[compiler-rt] [netbsd] Improve code formatting
Kamil Rytarowski [Thu, 10 Sep 2020 17:31:41 +0000 (19:31 +0200)]
[compiler-rt] [netbsd] Improve code formatting

No functional change.

3 years ago[compiler-rt] [netbsd] Add fallback definitions for MKISCSI=no
Kamil Rytarowski [Thu, 10 Sep 2020 17:26:59 +0000 (19:26 +0200)]
[compiler-rt] [netbsd] Add fallback definitions for MKISCSI=no

Add dev/iscsi/iscsi_ioctl.h fallback ioctl(2) operations.

3 years agoRevert D86875 "[Flang][NFC] Remove license comments from files in docs/ folder."
Sourabh Singh Tomar [Thu, 10 Sep 2020 17:34:37 +0000 (23:04 +0530)]
Revert D86875 "[Flang][NFC] Remove license comments from files in docs/ folder."

This reverts commit f787c9a90c69f, this was causing some build issues.

3 years ago[NFC][ThinLTO] Let llvm::EmbedBitcodeInModule handle serialization.
Mircea Trofin [Wed, 9 Sep 2020 00:18:04 +0000 (17:18 -0700)]
[NFC][ThinLTO] Let llvm::EmbedBitcodeInModule handle serialization.

llvm::EmbedBitcodeInModule handles serializing the passed-in module, if
the provided MemoryBufferRef is invalid. This is already the path taken
in one of the uses of the API - clang::EmbedBitcode, when called from
BackendConsumer::HandleTranslationUnit - so might as well do the same
here and reduce (by very little) code duplication.

The only difference this patch introduces is that the serialization happens
with ShouldPreserveUseListOrder set to true.

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

3 years ago[gcov] Delete flush_fn_list (unused since D83149)
Fangrui Song [Thu, 10 Sep 2020 17:15:27 +0000 (10:15 -0700)]
[gcov] Delete flush_fn_list (unused since D83149)

3 years ago[lldb, tests] Correctly configure the yaml2obj paths
Stella Stamenova [Thu, 10 Sep 2020 17:09:35 +0000 (10:09 -0700)]
[lldb, tests] Correctly configure the yaml2obj paths

They are currently not being set correctly for the case of multi-config generators like XCode and VS. There's also a typo in one of the cmake files.

Reviewed By: JDevlieghere

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

3 years ago[ArgumentPromotion]: Copy function metadata after promoting arguments
Ettore Tiotto [Thu, 10 Sep 2020 17:08:57 +0000 (13:08 -0400)]
[ArgumentPromotion]: Copy function metadata after promoting arguments

The argument promotion pass currently fails to copy function annotations
over to the modified function after promoting arguments.
This patch copies the original function annotation to the new function.

Reviewed By: fhann

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

3 years ago[PPC][GlobalISel] Add initial GlobalIsel infrastructure
Kit Barton [Mon, 17 Aug 2020 20:33:47 +0000 (15:33 -0500)]
[PPC][GlobalISel] Add initial GlobalIsel infrastructure

This adds the initial GlobalISel skeleton for PowerPC. It can only run
ir-translator and legalizer for `ret void`.

This is largely based on the initial GlobalISel patch for RISCV
(https://reviews.llvm.org/D65219).

Reviewed By: arsenm

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

3 years ago[gn build] Port c01d28dc51b
LLVM GN Syncbot [Thu, 10 Sep 2020 16:54:11 +0000 (16:54 +0000)]
[gn build] Port c01d28dc51b

3 years agoRevert "[gcov] Delete flush_fn_list (unused since D83149)"
Azharuddin Mohammed [Thu, 10 Sep 2020 16:49:45 +0000 (09:49 -0700)]
Revert "[gcov] Delete flush_fn_list (unused since D83149)"

This reverts commit 01cdab0b335e21321987505e66f34c24dc55b0d7.

It was causing the instrprof-darwin-exports.c test to fail.
```
Undefined symbols for architecture x86_64:
  "_flush_fn_list", referenced from:
     -exported_symbol[s_list] command line option
```

3 years agoIntroduce linalg.vecmat
Eugene Burmako [Thu, 10 Sep 2020 16:48:13 +0000 (18:48 +0200)]
Introduce linalg.vecmat

This patch adds a new named structured op to accompany linalg.matmul and
linalg.matvec. We needed it for our codegen, so I figured it would be useful
to add it to Linalg.

Reviewed By: nicolasvasilache, mravishankar

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

3 years agoFix typo in dsymutil.rst
YangZhihui [Thu, 10 Sep 2020 16:45:13 +0000 (09:45 -0700)]
Fix typo in dsymutil.rst

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

3 years ago[SyntaxTree] Specialize `TreeTestBase` for `BuildTreeTest`, `MutationsTest` and ...
Eduardo Caldas [Wed, 9 Sep 2020 08:36:39 +0000 (08:36 +0000)]
[SyntaxTree] Specialize `TreeTestBase` for `BuildTreeTest`, `MutationsTest` and `SynthesisTest`

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

3 years agoSwitchLoweringUtils.h - reduce TargetLowering.h include. NFCI.
Simon Pilgrim [Thu, 10 Sep 2020 16:35:02 +0000 (17:35 +0100)]
SwitchLoweringUtils.h - reduce TargetLowering.h include. NFCI.

Only include the headers we actually need, and move the remaining includes down to implicit dependent files.

3 years agoMark FMOV constant materialization as being as cheap as a move.
Owen Anderson [Tue, 8 Sep 2020 18:41:56 +0000 (18:41 +0000)]
Mark FMOV constant materialization as being as cheap as a move.

This prevents us from doing things like LICM'ing it out of a loop,
which is usually a net loss because we end up having to spill a
callee-saved FPR to accomodate it.

This does perturb instruction scheduling around this instruction,
so a number of tests had to be updated to account for it.

Reviewed By: t.p.northover

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

3 years ago[libcxx] Make sure we pass -isysroot when linking AND when compiling
Louis Dionne [Thu, 10 Sep 2020 16:20:18 +0000 (12:20 -0400)]
[libcxx] Make sure we pass -isysroot when linking AND when compiling

3 years agoHexagon.h - remove unnecessary includes. NFCI.
Simon Pilgrim [Thu, 10 Sep 2020 15:52:05 +0000 (16:52 +0100)]
Hexagon.h - remove unnecessary includes. NFCI.

Replace with forward declarations and move includes to implicit dependent files.

3 years ago[GVN] Account for masked loads/stores depending on load/store instructions
Krzysztof Parzyszek [Wed, 9 Sep 2020 23:05:00 +0000 (18:05 -0500)]
[GVN] Account for masked loads/stores depending on load/store instructions

This is a case where an intrinsic depends on a non-call instruction.

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

3 years agoSpeculatively fix the Sphinx builder.
Aaron Ballman [Thu, 10 Sep 2020 15:35:10 +0000 (11:35 -0400)]
Speculatively fix the Sphinx builder.

3 years ago[builtins] Write __divmoddi4/__divmodsi4 in terms __udivmod instead of __div and...
Craig Topper [Thu, 10 Sep 2020 13:55:00 +0000 (06:55 -0700)]
[builtins] Write __divmoddi4/__divmodsi4 in terms __udivmod instead of __div and multiply.

Previously we calculating the remainder by multiplying the
quotient and divisor and subtracting from the dividend.

__udivmod can calculate the remainder while calculating the
quotient. We just need to correct the sign afterward.

Reviewed By: MaskRay

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

3 years agoFix clangd build after 33c9dbbd380
Nico Weber [Thu, 10 Sep 2020 15:05:28 +0000 (11:05 -0400)]
Fix clangd build after 33c9dbbd380

3 years ago[X86] Use Register instead of unsigned. NFCI.
Simon Pilgrim [Thu, 10 Sep 2020 14:12:05 +0000 (15:12 +0100)]
[X86] Use Register instead of unsigned. NFCI.

Fixes llvm-prefer-register-over-unsigned clang-tidy warnings.

3 years agoAArch64MachineFunctionInfo.h - remove unnecessary TargetFrameLowering.h include....
Simon Pilgrim [Thu, 10 Sep 2020 12:09:48 +0000 (13:09 +0100)]
AArch64MachineFunctionInfo.h - remove unnecessary TargetFrameLowering.h include. NFCI.

3 years agoAdd an explicit toggle for the static analyzer in clang-tidy
Nico Weber [Thu, 3 Sep 2020 23:37:29 +0000 (19:37 -0400)]
Add an explicit toggle for the static analyzer in clang-tidy

Instead of using CLANG_ENABLE_STATIC_ANALYZER for use of the
static analyzer in both clang and clang-tidy, add a second
toggle CLANG_TIDY_ENABLE_STATIC_ANALYZER.

This allows enabling the static analyzer in clang-tidy while
disabling it in clang.

Differential Revison: https://reviews.llvm.org/D87118

3 years ago[MLIR][Standard] Simplify `tensor_from_elements`
Frederik Gossen [Thu, 10 Sep 2020 14:41:39 +0000 (14:41 +0000)]
[MLIR][Standard] Simplify `tensor_from_elements`

Define assembly format and add required traits.

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

3 years ago[TableGen] Do not construct string from nullptr
Yuriy Chernyshov [Thu, 10 Sep 2020 14:40:40 +0000 (16:40 +0200)]
[TableGen] Do not construct string from nullptr

While I am trying to forbid such usages systematically in
https://reviews.llvm.org/D79427 / P2166R0 to C++ standard,
this PR fixes this (definitelly incorrect) usage in llvm.

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

3 years ago[flang] Fix check for distinguishable operators/assignments
Tim Keith [Thu, 10 Sep 2020 14:22:52 +0000 (07:22 -0700)]
[flang] Fix check for distinguishable operators/assignments

Change how generic operators and assignments are checked for
distinguishable procedures. Because of how they are invoked, available
type-bound generics and normal generics all have to be considered
together. This is different from how generic names are checked.

Move common part of checking into DistinguishabilityHelper so that it
can be used in both cases after the appropriate procedures have been
added.

Cache result of Procedure::Characterize(Symbol) in a map in
CheckHelper so that we don't have to worry about passing the
characterized Procedures around or the cost of recomputing them.

Add MakeOpName() to construct names for defined operators and assignment
for using in error messages. This eliminates the need for different
messages in those cases.

When the procedures for a defined operator or assignment are undistinguishable,
include the type name in the error message, otherwise it may be ambiguous.

Add missing check that procedures for defined operators are functions
and that their dummy arguments are INTENT(IN) or VALUE.

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

3 years ago[InstCombine] Temporarily do not drop volatile stores before unreachable
Nikita Popov [Thu, 10 Sep 2020 14:16:44 +0000 (16:16 +0200)]
[InstCombine] Temporarily do not drop volatile stores before unreachable

See discussion in D87149. Dropping volatile stores here is legal
per LLVM semantics, but causes issues for real code and may result
in a change to LLVM volatile semantics. Temporarily treat volatile
stores as "not guaranteed to transfer execution" in just this place,
until this issue has been resolved.

3 years ago[lldb] [netbsd] Avoid comparison of signed and unsigned integers
Kamil Rytarowski [Thu, 10 Sep 2020 10:45:24 +0000 (12:45 +0200)]
[lldb] [netbsd] Avoid comparison of signed and unsigned integers

Cast ProcessID to ::pid_t.

3 years ago[gn build] Port ebf496d8055
LLVM GN Syncbot [Thu, 10 Sep 2020 13:33:11 +0000 (13:33 +0000)]
[gn build] Port ebf496d8055

3 years agoRevert "[clang-tidy] New check readability-prefer-member-initializer"
Roman Lebedev [Thu, 10 Sep 2020 13:31:56 +0000 (16:31 +0300)]
Revert "[clang-tidy] New check readability-prefer-member-initializer"

Either contains unbounded loops, or has *very* high runtime,
100+x of all the current clang-tidy checks.

This reverts commit f5fd7486d6c0debb465de3e927fcc31884874280.

3 years ago[TargetLowering] Fix comments describing XOR -> OR/AND transformations
Jay Foad [Thu, 10 Sep 2020 12:49:33 +0000 (13:49 +0100)]
[TargetLowering] Fix comments describing XOR -> OR/AND transformations

3 years ago[x86] add tests for fmax/fmin experimental intrinsics with 'fast' FMF; NFC
Sanjay Patel [Thu, 10 Sep 2020 12:45:36 +0000 (08:45 -0400)]
[x86] add tests for fmax/fmin experimental intrinsics with 'fast' FMF; NFC

D87391 proposes to change the lowerings for 'nnan'-only FMF.
That's the minimal requirement to get good codegen for x86,
but currently we have bugs hindering that output unless the
full 'fast' FMF is applied. These tests provide coverage for
the ideal lowerings.

3 years agoFix invalid link format in Clang LanguageExtension
Guillaume Chatelet [Thu, 10 Sep 2020 12:27:32 +0000 (12:27 +0000)]
Fix invalid link format in Clang LanguageExtension

3 years agoFix broken link for Sphinx installation
Guillaume Chatelet [Thu, 10 Sep 2020 12:01:18 +0000 (12:01 +0000)]
Fix broken link for Sphinx installation

3 years ago[DSE] Support eliminating memcpy.inline.
Florian Hahn [Thu, 10 Sep 2020 12:09:25 +0000 (13:09 +0100)]
[DSE] Support eliminating memcpy.inline.

MemoryLocation has been taught about memcpy.inline, which means we can
get the memory locations read and written by it. This means DSE can
handle memcpy.inline

3 years ago[libcxx] Simplify back-deployment testing
Louis Dionne [Wed, 9 Sep 2020 20:14:56 +0000 (16:14 -0400)]
[libcxx] Simplify back-deployment testing

The needs of back-deployment testing currently require two different
ways of running the test suite: one based on the deployment target,
and one based on the target triple. Since the triple includes all the
information we need, it's better to have just one way of doing things.

Furthermore, `--param platform=XXX` is also supersedded by using the
target triple. Previously, this parameter would serve the purpose of
controling XFAILs for availability markup errors, however it is possible
to achieve the same thing by using with_system_cxx_lib only and using
.verify.cpp tests instead, as explained in the documentation changes.

The motivation for this change is twofold:
1. This part of the Lit config has always been really confusing and
   complicated, and it has been a source of bugs in the past. I have
   simplified it iteratively in the past, but the complexity is still
   there.
2. The deployment-target detection started failing in weird ways in
   recent Clangs, breaking our CI. Instead of band-aid patching the
   issue, I decided to remove the complexity altogether by using target
   triples even on Apple platforms.

A follow-up to this commit will bring the test suite in line with
the recommended way of handling availability markup tests.

3 years ago[NFC] Refactoring in SCEV: add missing `const` qualifiers
Max Kazantsev [Thu, 10 Sep 2020 11:45:12 +0000 (18:45 +0700)]
[NFC] Refactoring in SCEV: add missing `const` qualifiers

3 years ago[CodeGen][X86] Move x86 builtin intrinsic/codegen tests into X86 subfolder.
Simon Pilgrim [Thu, 10 Sep 2020 11:58:03 +0000 (12:58 +0100)]
[CodeGen][X86] Move x86 builtin intrinsic/codegen tests into X86 subfolder.

There are still plenty of tests that specify x86 as a triple but most shouldn't be doing anything very target specific - we can move any ones that I have missed on a case by case basis.

3 years ago[clang-tidy] Fix reST syntax
serge-sans-paille [Tue, 8 Sep 2020 12:38:16 +0000 (14:38 +0200)]
[clang-tidy] Fix reST syntax

Authored by Eisuke Kawashima [https://github.com/llvm/llvm-project/pull/245]

3 years ago[Codegen][X86] Move AMX specific codegen tests into X86 subfolder.
Simon Pilgrim [Thu, 10 Sep 2020 11:38:23 +0000 (12:38 +0100)]
[Codegen][X86] Move AMX specific codegen tests into X86 subfolder.

3 years ago[CostModel][X86] Add vXi32 division by uniform constant costs (PR47476)
Simon Pilgrim [Thu, 10 Sep 2020 11:17:54 +0000 (12:17 +0100)]
[CostModel][X86] Add vXi32 division by uniform constant costs (PR47476)

Other types can be handled in future patches but their uniform / non-uniform costs are more similar and don't appear to cause many vectorization issues.

3 years ago[SLP][X86] Add division by uniform constant tests (PR47476)
Simon Pilgrim [Thu, 10 Sep 2020 10:52:20 +0000 (11:52 +0100)]
[SLP][X86] Add division by uniform constant tests (PR47476)

3 years ago[X86][SSE] lowerShuffleAsSplitOrBlend always returns a shuffle.
Simon Pilgrim [Thu, 10 Sep 2020 10:29:06 +0000 (11:29 +0100)]
[X86][SSE] lowerShuffleAsSplitOrBlend always returns a shuffle.

lowerShuffleAsSplitOrBlend always returns a target shuffle result (and is the default operation for lowering some shuffle types), so we don't need to check for null.

3 years ago[X86] Remove WaitInsert::TTI member. NFCI.
Simon Pilgrim [Wed, 9 Sep 2020 16:48:22 +0000 (17:48 +0100)]
[X86] Remove WaitInsert::TTI member. NFCI.

This is only ever set/used inside WaitInsert::runOnMachineFunction so don't bother storing it in the class.

3 years ago[analyzer][StdLibraryFunctionsChecker] Add better diagnostics
Gabor Marton [Thu, 10 Sep 2020 10:41:29 +0000 (12:41 +0200)]
[analyzer][StdLibraryFunctionsChecker] Add better diagnostics

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

3 years ago[SVE][CodeGen] Legalisation of truncate for scalable vectors
Kerry McLaughlin [Thu, 10 Sep 2020 08:55:54 +0000 (09:55 +0100)]
[SVE][CodeGen] Legalisation of truncate for scalable vectors

Truncating from an illegal SVE type to a legal type, e.g.
`trunc <vscale x 4 x i64> %in to <vscale x 4 x i32>`
fails after PromoteIntOp_CONCAT_VECTORS attempts to
create a BUILD_VECTOR.

This patch changes the promote function to create a sequence of
INSERT_SUBVECTORs if the return type is scalable, and replaces
these with UNPK+UZP1 for AArch64.

Reviewed By: paulwalker-arm

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

3 years ago[analyzer][StdLibraryFunctionsChecker] Remove strcasecmp
Gabor Marton [Mon, 7 Sep 2020 14:56:36 +0000 (16:56 +0200)]
[analyzer][StdLibraryFunctionsChecker] Remove strcasecmp

There are 2 reasons to remove strcasecmp and strncasecmp.
1) They are also modeled in CStringChecker and the related argumentum
   contraints are checked there.
2) The argument constraints are checked in CStringChecker::evalCall.
   This is fundamentally flawed, they should be checked in checkPreCall.
   Even if we set up CStringChecker as a weak dependency for
   StdLibraryFunctionsChecker then the latter reports the warning always.
   Besides, CStringChecker fails to discover the constraint violation
   before the call, so, its evalCall returns with `true` and then
   StdCLibraryFunctions also tries to evaluate, this causes an assertion
   in CheckerManager.

Either we fix CStringChecker to handle the call prerequisites in
checkPreCall, or we must not evaluate any pure functions in
StdCLibraryFunctions that are also handled in CStringChecker.
We do the latter in this patch.

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

3 years agoEnable InsertFreeze flag of JumpThreading when used in LTO
Juneyoung Lee [Thu, 10 Sep 2020 10:05:24 +0000 (19:05 +0900)]
Enable InsertFreeze flag of JumpThreading when used in LTO

This patch enables inserting freeze when JumpThreading converts a select to
a conditional branch when it is run in LTO.

Reviewed By: nikic

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

3 years ago[compiler-rt] [netbsd] Reintroduce __sanitizer_protoent
Kamil Rytarowski [Thu, 10 Sep 2020 09:44:12 +0000 (11:44 +0200)]
[compiler-rt] [netbsd] Reintroduce __sanitizer_protoent

Partial revert of https://reviews.llvm.org/D82424

3 years ago[ARM][LowOverheadLoops] Allow tail predication on predicated instructions with unknow...
Sam Tebbs [Wed, 9 Sep 2020 13:01:02 +0000 (14:01 +0100)]
[ARM][LowOverheadLoops] Allow tail predication on predicated instructions with unknown lane
values

The effects of unpredicated vector instruction with unknown
lanes cannot be predicted and therefore cannot be tail predicated. This
does not apply to predicated vector instructions and so this patch
allows tail predication on them.

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

3 years ago[llvm-readobj] [ARMWinEH] Fix printing of exception handlers with packed epilogues
Martin Storsjö [Tue, 8 Sep 2020 20:14:42 +0000 (23:14 +0300)]
[llvm-readobj] [ARMWinEH] Fix printing of exception handlers with packed epilogues

If there's a packed epilogue (indicated by the flag E), the EpilogueCount()
field actually should be interpreted as EpilogueOffset.

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

3 years ago[llvm-readobj] [ARMWinEH] Print set_fp/add_fp differently in epilogues
Martin Storsjö [Tue, 8 Sep 2020 06:56:45 +0000 (09:56 +0300)]
[llvm-readobj] [ARMWinEH] Print set_fp/add_fp differently in epilogues

This matches how e.g. stp/ldp and other opcodes are printed differently
for epilogues.

Also add a missing --strict-whitespace in an existing test that
was added explicitly for testing vertical alignment, and change to
using temp files for the generated object files.

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

3 years ago[mlir] [VectorOps] Enable 32-bit index optimizations
aartbik [Wed, 9 Sep 2020 18:11:52 +0000 (11:11 -0700)]
[mlir] [VectorOps] Enable 32-bit index optimizations

Rationale:
After some discussion we decided that it is safe to assume 32-bit
indices for all subscripting in the vector dialect (it is unlikely
the dialect will be used; or even work; for such long vectors).
So rather than detecting specific situations that can exploit
32-bit indices with higher parallel SIMD, we just optimize it
by default, and let users that don't want it opt-out.

Reviewed By: nicolasvasilache, bkramer

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

3 years ago[SCEV] Constant expansion cost at minsize
Sam Parker [Mon, 7 Sep 2020 11:06:02 +0000 (12:06 +0100)]
[SCEV] Constant expansion cost at minsize

As code size is the only thing we care about at minsize, query the
cost of materialising immediates when calculating the cost of a SCEV
expansion. We also modify the CostKind to TCK_CodeSize for minsize,
instead of RecipThroughput.

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

3 years ago[ARM] Tail predicate VQDMULH and VQRDMULH
Sam Parker [Wed, 9 Sep 2020 07:15:55 +0000 (08:15 +0100)]
[ARM] Tail predicate VQDMULH and VQRDMULH

Mark the family of instructions as valid for tail predication.

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

3 years ago[clang] Disallow fbasic-block-sections on non-ELF, non-x86 targets.
Snehasish Kumar [Thu, 10 Sep 2020 00:57:03 +0000 (17:57 -0700)]
[clang] Disallow fbasic-block-sections on non-ELF, non-x86 targets.

Basic block sections is untested on other platforms and binary formats apart
from x86,elf. This patch emits a warning and drops the flag if the platform
and binary format are not compatible. Add a test to ensure that
specifying an incompatible target in the driver does not enable the
feature.

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

3 years ago[mlir][Linalg] Small refactoring of ConvOpVectorization
Jakub Lichman [Thu, 10 Sep 2020 07:03:43 +0000 (07:03 +0000)]
[mlir][Linalg] Small refactoring of ConvOpVectorization

This commit addresses comments that were requested on D86619
after it was landed.

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

3 years ago[JumpThreading] Conditionally freeze its condition when unfolding select
Juneyoung Lee [Thu, 10 Sep 2020 06:49:04 +0000 (15:49 +0900)]
[JumpThreading] Conditionally freeze its condition when unfolding select

This patch fixes pr45956 (https://bugs.llvm.org/show_bug.cgi?id=45956 ).
To minimize its impact to the quality of generated code, I suggest enabling
this only for LTO as a start (it has two JumpThreading passes registered).
This patch contains a flag that makes JumpThreading enable it.

Reviewed By: efriedma

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

3 years ago[NFC] Rename variables to avoid name confusion
Max Kazantsev [Thu, 10 Sep 2020 06:38:49 +0000 (13:38 +0700)]
[NFC] Rename variables to avoid name confusion

Name `LI` is used for loop info, loop and load inst at the same
function, which causes a lot of confusion.

3 years ago[LoopLoadElim] Filter away candidates that stop being AddRecs after loop versioning...
Max Kazantsev [Thu, 10 Sep 2020 06:29:45 +0000 (13:29 +0700)]
[LoopLoadElim] Filter away candidates that stop being AddRecs after loop versioning. PR47457

The test in PR47457 demonstrates a situation when candidate load's pointer's SCEV
is no loger a SCEVAddRec after loop versioning. The code there assumes that it is
always a SCEVAddRec and crashes otherwise.

This patch makes sure that we do not consider candidates for which this requirement
is broken after the versioning.

Differential Revision: https://reviews.llvm.org/D87355
Reviewed By: asbirlea

3 years agolibclc/spirv: Add various functions
Daniel Stone [Thu, 10 Sep 2020 03:15:41 +0000 (23:15 -0400)]
libclc/spirv: Add various functions

Adds fma,fmod,ldexp.

Reviewer: jenatali jvesely

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

3 years ago[mlir][Linalg] Add Utility method to get loop ranges for a LinalgOp.
MaheshRavishankar [Thu, 10 Sep 2020 05:20:12 +0000 (22:20 -0700)]
[mlir][Linalg] Add Utility method to get loop ranges for a LinalgOp.

Also refactor the getViewSizes method to work on LinalgOp instead of
being a templated version. Keeping the templated version for
compatibility.

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

3 years ago[PowerPC] [FPEnv] Disable strict FP mutation by default
Qiu Chaofan [Thu, 10 Sep 2020 05:28:09 +0000 (13:28 +0800)]
[PowerPC] [FPEnv] Disable strict FP mutation by default

22a0edd0 introduced a config IsStrictFPEnabled, which controls the
strict floating point mutation (transforming some strict-fp operations
into non-strict in ISel). This patch disables the mutation by default
since we've finished PowerPC strict-fp enablement in backend.

Reviewed By: uweigand

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

3 years ago[lit] Use correct variable name for libxml2
Petr Hosek [Thu, 10 Sep 2020 05:03:13 +0000 (22:03 -0700)]
[lit] Use correct variable name for libxml2

This addresses an issue introduced in c4d7536136b3.

3 years ago[CMake] Simplify CMake handling for libxml2
Petr Hosek [Fri, 24 Jul 2020 22:47:38 +0000 (15:47 -0700)]
[CMake] Simplify CMake handling for libxml2

This matches the changes made to handling of zlib done in 10b1b4a
where we rely on find_package and the imported target rather than
manually appending the library and include paths. The use of
LLVM_LIBXML2_ENABLED has been replaced by LLVM_ENABLE_LIBXML2
thus reducing the number of variables.

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

3 years ago[NFC] Move definition of variable now only used in debug builds
Jordan Rupprecht [Thu, 10 Sep 2020 03:23:59 +0000 (20:23 -0700)]
[NFC] Move definition of variable now only used in debug builds

3 years agomlir/Transforms/BufferPlacement.h: Add missing override
David Blaikie [Thu, 10 Sep 2020 01:17:44 +0000 (18:17 -0700)]
mlir/Transforms/BufferPlacement.h: Add missing override

3 years ago[gcov] Delete flush_fn_list (unused since D83149)
Fangrui Song [Thu, 10 Sep 2020 00:24:45 +0000 (17:24 -0700)]
[gcov] Delete flush_fn_list (unused since D83149)

3 years ago[llvm-install-name-tool] Add -V flag
Alexander Shaposhnikov [Thu, 10 Sep 2020 00:11:08 +0000 (17:11 -0700)]
[llvm-install-name-tool] Add -V flag

This diff adds -V alias for --version to make llvm-install-name-tool
consistent with other tools (llvm-objcopy, llvm-strip, etc).

Test plan: make check-all

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

3 years ago[gcov] Delete unused llvm_gcda_increment_indirect_counter
Fangrui Song [Wed, 9 Sep 2020 23:57:33 +0000 (16:57 -0700)]
[gcov] Delete unused llvm_gcda_increment_indirect_counter

It has been unused since r157564 (2012).

3 years agoAMDGPU: Hoist check for VGPRs
Matt Arsenault [Wed, 9 Sep 2020 20:58:52 +0000 (16:58 -0400)]
AMDGPU: Hoist check for VGPRs

3 years agoAMDGPU: Skip all meta instructions in hazard recognizer
Matt Arsenault [Wed, 9 Sep 2020 22:08:48 +0000 (18:08 -0400)]
AMDGPU: Skip all meta instructions in hazard recognizer

This was not adding a necessary nop due to thinking the kill counted.

3 years agoAMDGPU: Fix inserting waitcnts before kill uses
Matt Arsenault [Wed, 9 Sep 2020 14:24:35 +0000 (10:24 -0400)]
AMDGPU: Fix inserting waitcnts before kill uses

3 years ago[Asan] Return nullptr for invalid chunks
Vitaly Buka [Wed, 9 Sep 2020 23:17:37 +0000 (16:17 -0700)]
[Asan] Return nullptr for invalid chunks

CHUNK_ALLOCATED. CHUNK_QUARANTINE are only states
which make AsanChunk useful for GetAsanChunk callers.
In either case member of AsanChunk are not useful.

Fix few cases which didn't expect nullptr. Most of the callers are already
expects nullptr.

Reviewed By: morehouse

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

3 years ago[ValueTracking] isKnownNonZero, computeKnownBits for freeze
Juneyoung Lee [Wed, 9 Sep 2020 17:55:06 +0000 (02:55 +0900)]
[ValueTracking] isKnownNonZero, computeKnownBits for freeze

This implements support for isKnownNonZero, computeKnownBits when freeze is involved.

```
  br (x != 0), BB1, BB2
BB1:
  y = freeze x
```

In the above program, we can say that y is non-zero. The reason is as follows:

(1) If x was poison, `br (x != 0)` raised UB
(2) If x was fully undef, the branch again raised UB
(3) If x was non-zero partially undef, say `undef | 1`, `freeze x` will return a nondeterministic value which is also non-zero.
(4) If x was just a concrete value, it is trivial

Reviewed By: nikic

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

3 years ago[libunwind] Bare-metal DWARF: set dso_base to 0
Ryan Prichard [Wed, 9 Sep 2020 22:43:35 +0000 (15:43 -0700)]
[libunwind] Bare-metal DWARF: set dso_base to 0

Previously, DwarfFDECache::findFDE used 0 as a special value meaning
"search the entire cache, including dynamically-registered FDEs".
Switch this special value to -1, which doesn't make sense as a DSO
base.

Fixes PR47335.

Reviewed By: compnerd, #libunwind

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

3 years ago[AMDGPU] Fix for folding v2.16 literals.
dfukalov [Fri, 4 Sep 2020 19:44:01 +0000 (22:44 +0300)]
[AMDGPU] Fix for folding v2.16 literals.

It was found some packed immediate operands (e.g. `<half 1.0, half 2.0>`) are
incorrectly processed so one of two packed values were lost.

Introduced new function to check immediate 32-bit operand can be folded.
Converted condition about current op_sel flags value to fall-through.

Fixes: SWDEV-247595

Reviewed By: rampitec

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

3 years agoMark masked.{store,scatter,compressstore} intrinsics as write-only
Krzysztof Parzyszek [Wed, 9 Sep 2020 22:27:04 +0000 (17:27 -0500)]
Mark masked.{store,scatter,compressstore} intrinsics as write-only

3 years ago[AArch64][GlobalISel] Share address mode selection code for memops
Jessica Paquette [Wed, 9 Sep 2020 16:45:54 +0000 (09:45 -0700)]
[AArch64][GlobalISel] Share address mode selection code for memops

We were missing support for the G_ADD_LOW + ADRP folding optimization in the
manual selection code for G_LOAD, G_STORE, and G_ZEXTLOAD.

As a result, we were missing cases like this:

```
@foo = external hidden global i32*
define void @baz(i32* %0) {
store i32* %0, i32** @foo
ret void
}
```

https://godbolt.org/z/16r7ad

This functionality already existed in the addressing mode functions for the
importer. So, this patch makes the manual selection code use
`selectAddrModeIndexed` rather than duplicating work.

This is a 0.2% geomean code size improvement for CTMark at -O3.

There is one code size increase (0.1% on lencod) which is likely because
`selectAddrModeIndexed` doesn't look through constants.

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

3 years ago[DSE,MemorySSA] Handle atomic stores explicitly in isReadClobber.
Florian Hahn [Wed, 9 Sep 2020 18:36:41 +0000 (19:36 +0100)]
[DSE,MemorySSA] Handle atomic stores explicitly in isReadClobber.

Atomic stores are modeled as MemoryDef to model the fact that they may
not be reordered, depending on the ordering constraints.

Atomic stores that are monotonic or weaker do not limit re-ordering, so
we do not have to treat them as potential read clobbers.

Note that llvm/test/Transforms/DeadStoreElimination/MSSA/atomic.ll
already contains a set of negative test cases.

Reviewed By: asbirlea

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

3 years ago[DAGCombiner] Fold fmin/fmax of NaN
Nikita Popov [Wed, 9 Sep 2020 20:35:02 +0000 (22:35 +0200)]
[DAGCombiner] Fold fmin/fmax of NaN

fminnum(X, NaN) is X, fminimum(X, NaN) is NaN. This mirrors the
behavior of existing InstSimplify folds.

This is expected to improve the reduction lowerings in D87391,
which use NaN as a neutral element.

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

3 years ago[ARM] Add additional fmin/fmax with nan tests (NFC)
Nikita Popov [Wed, 9 Sep 2020 21:48:44 +0000 (23:48 +0200)]
[ARM] Add additional fmin/fmax with nan tests (NFC)

Adding these to ARM which has both FMINNUM and FMINIMUM.

3 years ago[lldb] Pass the arch as part of the triple in the ARCH_CFLAGS
Jonas Devlieghere [Wed, 9 Sep 2020 21:41:00 +0000 (14:41 -0700)]
[lldb] Pass the arch as part of the triple in the ARCH_CFLAGS