platform/upstream/llvm.git
3 years ago[RISCV] Add -mattr=+c command lines to add-before-shl.ll to prepare for D105417. NFC
Craig Topper [Tue, 20 Jul 2021 16:09:46 +0000 (09:09 -0700)]
[RISCV] Add -mattr=+c command lines to add-before-shl.ll to prepare for D105417. NFC

3 years ago[Driver] Detect libstdc++ include paths for native gcc on 32-bit non-Debian Linux
Fangrui Song [Tue, 20 Jul 2021 16:18:24 +0000 (09:18 -0700)]
[Driver] Detect libstdc++ include paths for native gcc on 32-bit non-Debian Linux

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

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

3 years ago[PowerPC] Semachecking for XL compat builtin icbt
Quinn Pham [Tue, 20 Jul 2021 14:42:14 +0000 (09:42 -0500)]
[PowerPC] Semachecking for XL compat builtin icbt

This patch is in a series of patches to provide builtins for compatibility with the XL compiler.
This patch adds semachecking for an already implemented builtin, `__icbt`. `__icbt` is only
valid for Power8 and up.

Reviewed By: #powerpc, nemanjai

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

3 years ago[RISCV] Add custom isel to select (and (srl X, C1), C2) and (and (shl X, C1), C2)
Craig Topper [Tue, 20 Jul 2021 15:46:21 +0000 (08:46 -0700)]
[RISCV] Add custom isel to select (and (srl X, C1), C2) and (and (shl X, C1), C2)

Replace some existing isel patterns that are covered by the new
code. SLLIUWPat has been removed in favor of folding its root case
into the new code. The other uses in isel patterns for shXadd.uw
have been switched to using hardcoded AND masks.

This is based on the original version of D49585 from ARM. The final
version of that was made a DAG combine, but I've chosen to keep it
as custom isel. I'm not convinced DAG combine is as good with
shift pairs as it is with and+shift. I saw some issues optimizing
the shifts created by vscale lowering if an and isn't created for
from a shift pair.

Reviewed By: luismarques

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

3 years ago[PowerPC] Inefficient register allocation of ACC registers results in many copies.
Stefan Pintilie [Mon, 12 Jul 2021 17:47:44 +0000 (12:47 -0500)]
[PowerPC] Inefficient register allocation of ACC registers results in many copies.

ACC registers are a combination of four consecutive vector registers.
If the vector registers are assigned first this often forces a number
of copies to appear just before the ACC register is created. If the ACC
register is assigned first then fewer copies are generated when the vector
registers are assigned.

This patch tries to force the register allocator to assign the ACC registers first
and then the UACC registers and then the vector pair registers. It does this
by changing the priority of the register classes.

This patch also adds hints to help the register allocator assign UACC registers from
known ACC registers and vector pair registers from known UACC registers.

Reviewed By: nemanjai

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

3 years agoAvoid keeping internal string_views in Twine.
Sterling Augustine [Fri, 16 Jul 2021 20:17:16 +0000 (13:17 -0700)]
Avoid keeping internal string_views in Twine.

This is a follow-up to https://reviews.llvm.org/D103935

A Twine's internal layout should not depend on which version of the
C++ standard is in use. Dynamically linking binaries compiled with two
different layouts (eg, --std=c++14 vs --std=c++17) ends up
problematic.

This change avoids that issue by immediately converting a
string_view to a pointer-and-length at the cost of an extra eight-bytes
in Twine.

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

3 years ago[RISCV] Use unordered indexed loads for MGATHER.
Craig Topper [Tue, 20 Jul 2021 15:32:15 +0000 (08:32 -0700)]
[RISCV] Use unordered indexed loads for MGATHER.

I don't think the semantics of the llvm masked gather intrinsic care
about the order the elements are loaded. For example, type legalization
by splitting will chain them in parallel. This is different than
scatter which we do chain in order.

Reviewed By: frasercrmck

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

3 years ago[LV] Change interface of getReductionPatternCost to return Optional
David Green [Tue, 20 Jul 2021 15:44:50 +0000 (16:44 +0100)]
[LV] Change interface of getReductionPatternCost to return Optional

Currently the Instruction cost of getReductionPatternCost returns an
Invalid cost to specify "did not find the pattern". This changes that to
return an Optional with None specifying not found, allowing Invalid to
mean an infinite cost as is used elsewhere.

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

3 years ago[Bazel] Update for bc1a2979fc
Geoffrey Martin-Noble [Tue, 20 Jul 2021 15:33:51 +0000 (08:33 -0700)]
[Bazel] Update for bc1a2979fc

Update Bazel build configuration for
https://github.com/llvm/llvm-project/commit/bc1a2979fc70
by adding missing dep to clang tooling unit tests.

3 years ago[UpdateCCTestChecks] Implement --global-hex-value-regex
Joel E. Denny [Tue, 20 Jul 2021 15:17:56 +0000 (11:17 -0400)]
[UpdateCCTestChecks] Implement --global-hex-value-regex

For example, in OpenMP offload codegen tests, global variables like
`.offload_maptypes*` are much easier to read in hex.

Reviewed By: jdoerfert

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

3 years ago[UpdateCCTestChecks] Implement --global-value-regex
Joel E. Denny [Tue, 20 Jul 2021 15:17:50 +0000 (11:17 -0400)]
[UpdateCCTestChecks] Implement --global-value-regex

`--check-globals` activates checks for all global values, and
`--global-value-regex` filters them.  For example, I'd like to use it
in OpenMP offload codegen tests to check only global variables like
`.offload_maptypes*`.

Reviewed By: jdoerfert

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

3 years ago[gn build] Port 1a29403d2f8a
LLVM GN Syncbot [Tue, 20 Jul 2021 15:13:51 +0000 (15:13 +0000)]
[gn build] Port 1a29403d2f8a

3 years ago[libcxx][ranges] Add common_iterator.
zoecarver [Thu, 27 May 2021 16:23:19 +0000 (09:23 -0700)]
[libcxx][ranges] Add common_iterator.

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

3 years ago[SampleProfile] Remove ProfileIsValid (NFC)
Kazu Hirata [Tue, 20 Jul 2021 15:07:04 +0000 (08:07 -0700)]
[SampleProfile] Remove ProfileIsValid (NFC)

The last use was removed on Jan 22, 2021 in commit
c9cd9a006632419ce7346e50564e6347a93181cc.

3 years ago[NFC] Fix some comments and only look at terminators when looking for ReturnLike ops
Rahul Joshi [Tue, 20 Jul 2021 00:19:29 +0000 (17:19 -0700)]
[NFC] Fix some comments and only look at terminators when looking for ReturnLike ops

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

3 years ago[clang][patch][NFC] Refactor calculation of FunctionDecl to avoid duplicate code
Melanie Blower [Tue, 20 Jul 2021 14:56:33 +0000 (10:56 -0400)]
[clang][patch][NFC] Refactor calculation of FunctionDecl to avoid duplicate code

3 years ago[NFC][LoopVectorizer] Remove VF.isScalable() assertion from collectInstsToScalarize...
Caroline Concatto [Wed, 5 May 2021 14:20:16 +0000 (15:20 +0100)]
[NFC][LoopVectorizer] Remove VF.isScalable() assertion from collectInstsToScalarize and getInstructionCost

This patch removes the assertion when VF is scalable and replaces
getKnownMinValue() by getFixedValue(),  so it still guards the code against
scalable vector types.
The assertions were used to guarantee that getknownMinValue were not used for
scalable vectors.

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

3 years ago[SystemZ][z/OS] Add GOFF support to file magic identification
Anirudh Prasad [Tue, 20 Jul 2021 14:50:18 +0000 (10:50 -0400)]
[SystemZ][z/OS] Add GOFF support to file magic identification

- This patch adds in the GOFF format to the file magic identification logic in LLVM
- Currently, for the object file support, GOFF is marked as having as an error
- However, this is only temporary until https://reviews.llvm.org/D98437 is merged in

Reviewed By: abhina.sreeskantharajan

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

3 years ago[PowerPC] Restore FastMathFlags of Builder for Vector FDiv Builtins
Quinn Pham [Tue, 20 Jul 2021 13:57:18 +0000 (08:57 -0500)]
[PowerPC] Restore FastMathFlags of Builder for Vector FDiv Builtins

This patch fixes `__builtin_ppc_recipdivf`, `__builtin_ppc_recipdivd`,
`__builtin_ppc_rsqrtf`, and `__builtin_ppc_rsqrtd`. FastMathFlags are
set to fast immediately before emitting these builtins. Now the flags
are restored to their previous values after the builtins are emitted.

Reviewed By: nemanjai, #powerpc

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

3 years ago[CostModel] Templatize EntryCost::Cost to allow custom cost metrics
Simon Pilgrim [Tue, 20 Jul 2021 14:31:24 +0000 (15:31 +0100)]
[CostModel] Templatize EntryCost::Cost to allow custom cost metrics

We currently use an unsigned value for our CostTblEntry and TypeConversionCostTblEntry cost tables which is limiting depending on how the target wishes to handle various CostKinds etc.

For instance, targets might wish to store separate instruction count, latency or throughput values etc. On D46276 we have been investigating storing a code snippet to improve latency/throughput cost calculations.

There is a slight problem in that template argument deduction was struggling to match the now templatized Costs[] tables in a ArrayRef constructor - I've added helper wrappers for CostTableLookup/ConvertCostTableLookup which avoids us having to update all existing calls with a template hint.

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

3 years ago[Attributor] Initialize effectively unused value to appease UBSAN
Johannes Doerfert [Tue, 20 Jul 2021 14:16:56 +0000 (09:16 -0500)]
[Attributor] Initialize effectively unused value to appease UBSAN

3 years ago[AArch64][SVE] Move instcombine like transforms out of SVEIntrinsicOpts
Bradley Smith [Tue, 13 Jul 2021 14:42:36 +0000 (14:42 +0000)]
[AArch64][SVE] Move instcombine like transforms out of SVEIntrinsicOpts

Instead move them to the instcombine that happens in AArch64TargetTransformInfo.

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

3 years ago[VPlan] Fix formatting glitch from d2a73fb44ea0b8.
Florian Hahn [Tue, 20 Jul 2021 14:15:59 +0000 (16:15 +0200)]
[VPlan] Fix formatting glitch from d2a73fb44ea0b8.

3 years ago[VPlan] Add recipe for first-order rec phis, make splicing explicit.
Florian Hahn [Tue, 20 Jul 2021 10:06:31 +0000 (12:06 +0200)]
[VPlan] Add recipe for first-order rec phis, make splicing explicit.

This patch adds a VPFirstOrderRecurrencePHIRecipe, to further untangle
VPWidenPHIRecipe into distinct recipes for distinct use cases/lowering.
See D104989 for a new recipe for reduction phis.

This patch also introduces a new `FirstOrderRecurrenceSplice`
VPInstruction opcode, which is used to make the forming of the vector
recurrence value explicit in VPlan. This more accurately models def-uses
in VPlan and also simplifies code-generation. Now, the vector recurrence
values are created at the right place during VPlan-codegeneration,
rather than during post-VPlan fixups.

Reviewed By: Ayal

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

3 years ago[gn build] remove stray character in a comment
Nico Weber [Tue, 20 Jul 2021 14:13:39 +0000 (10:13 -0400)]
[gn build] remove stray character in a comment

3 years agoReland Produce warning for performing pointer arithmetic on a null pointer.
Jamie Schmeiser [Tue, 20 Jul 2021 14:12:20 +0000 (10:12 -0400)]
Reland Produce warning for performing pointer arithmetic on a null pointer.

Summary:
Test and produce warning for subtracting a pointer from null or subtracting
null from a pointer.

This reland adds the functionality that the warning is no longer reusing an
existing warning, it has different wording for C vs C++ to refect the fact
that nullptr-nullptr has defined behaviour in C++,  it is suppressed
when the warning is triggered by a system header and adds
-Wnull-pointer-subtraction to allow the warning to be controlled.  -Wextra
implies -Wnull-pointer-subtraction.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: efriedma (Eli Friedman), nickdesaulniers (Nick Desaulniers)
Differential Revision: https://reviews.llvm.org/D98798

3 years ago[PowerPC][Builtins] Added a number of builtins for compatibility with XL.
Stefan Pintilie [Wed, 16 Jun 2021 13:36:25 +0000 (08:36 -0500)]
[PowerPC][Builtins] Added a number of builtins for compatibility with XL.

Added a number of different builtins that exist in the XL compiler. Most of
these builtins already exist in clang under a different name.

Reviewed By: nemanjai, #powerpc

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

3 years agoExclude pybind11 2.7.0 from MLIR python requirements.
Stella Laurenzo [Tue, 20 Jul 2021 13:56:05 +0000 (06:56 -0700)]
Exclude pybind11 2.7.0 from MLIR python requirements.

Appears to have a broken CMake installation. Reported bug: https://github.com/pybind/pybind11/issues/3136

3 years ago[AArch64] Regenerate some tests checks. NFC
David Green [Tue, 20 Jul 2021 13:52:36 +0000 (14:52 +0100)]
[AArch64] Regenerate some tests checks. NFC

3 years ago[libc++][NFC] Add missing commits to the ABI changelog
Louis Dionne [Tue, 20 Jul 2021 13:19:52 +0000 (09:19 -0400)]
[libc++][NFC] Add missing commits to the ABI changelog

3 years ago[linalg] Add TensorDimOp to list of ops known by bufferization.
Tobias Gysi [Tue, 20 Jul 2021 12:21:15 +0000 (12:21 +0000)]
[linalg] Add TensorDimOp to list of ops known by bufferization.

Bufferization handles all unknown ops conservative. The patch ensures accessing the dimension of an output tensor does not prevent in place bufferization.

Reviewed By: nicolasvasilache

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

3 years ago[X86] X86InstCombineIntrinsic.cpp - silence clang-tidy warnings about incorrect uses...
Simon Pilgrim [Tue, 20 Jul 2021 12:37:24 +0000 (13:37 +0100)]
[X86] X86InstCombineIntrinsic.cpp - silence clang-tidy warnings about incorrect uses of auto. NFCI.

We were using auto instead of auto* in a number of places which failed the llvm-qualified-auto check.

Additionally we were using auto in some places where the type wasn't immediately obvious - the style guide rule of thumb is only to use auto from casts etc. where the type is already explicitly stated.

3 years ago[MIPS][MSA] Regenerate basic operations test checks
Simon Pilgrim [Tue, 20 Jul 2021 11:54:50 +0000 (12:54 +0100)]
[MIPS][MSA] Regenerate basic operations test checks

Cleanup the check prefixes to make refresh a lot easier

3 years ago[Lex] Consider a PCH header-guarded even with #endif truncated
Sam McCall [Sat, 17 Jul 2021 00:23:51 +0000 (02:23 +0200)]
[Lex] Consider a PCH header-guarded even with #endif truncated

This seems to be a more useful behavior for tools that use preambles.
I believe it doesn't affect real compiles: the PCH is only included once
when used, and recursive inclusion of the main-file *within* the PCH
isn't supported in any case.

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

3 years ago[clang-tidy] Don't suggest "inline" fix for main function in
Haojian Wu [Tue, 20 Jul 2021 08:31:11 +0000 (10:31 +0200)]
[clang-tidy] Don't suggest "inline" fix for main function in
definitions-in-headers check.

3 years ago[clangd] Propagate header-guarded flag from preamble to main AST
Sam McCall [Sat, 17 Jul 2021 00:17:44 +0000 (02:17 +0200)]
[clangd] Propagate header-guarded flag from preamble to main AST

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

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

3 years ago[clangd] Add tests covering existing header-guard behavior. NFC
Sam McCall [Sat, 17 Jul 2021 00:10:16 +0000 (02:10 +0200)]
[clangd] Add tests covering existing header-guard behavior. NFC

A few different mechanisms here that will need some work to untangle:
 - self-include in a preamble being an error even if the file is ifdef-guarded
 - the is-include-guarded flag not being propagated from preamble to main ast
 - preambles containing the first half on an include guard discard that info

For now just record current behavior.

Relevant to:
- https://github.com/clangd/clangd/issues/811
- https://github.com/clangd/clangd/issues/377
- https://github.com/clangd/clangd/issues/262

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

3 years ago[gn build] Port 2b08f6af62af
LLVM GN Syncbot [Tue, 20 Jul 2021 12:00:01 +0000 (12:00 +0000)]
[gn build] Port 2b08f6af62af

3 years ago[AMDGPU] Improve register computation for indirect calls
Sebastian Neubauer [Mon, 19 Jul 2021 13:55:39 +0000 (15:55 +0200)]
[AMDGPU] Improve register computation for indirect calls

First, collect the register usage in each function, then apply the
maximum register usage of all functions to functions with indirect
calls.

This is more accurate than guessing the maximum register usage without
looking at the actual usage.

As before, assume that indirect calls will hit a function in the
current module.

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

3 years ago[SystemZ] Fix invalid assumption in getCPUNameFromS390Model
Ulrich Weigand [Tue, 20 Jul 2021 11:36:33 +0000 (13:36 +0200)]
[SystemZ] Fix invalid assumption in getCPUNameFromS390Model

Code in getCPUNameFromS390Model currently assumes that the
numerical value of the model number always increases with
future hardware.  While this has happened to be the case
with the last few machines, it is not guaranteed -- that
assumption was violated with (much) older machines, and
it can be violated again with future machines.

Fix by explicitly listing model numbers for all supported
machine models.

3 years ago[llvm][tools] Hide more unrelated tool options
Timm Bäder [Mon, 19 Jul 2021 09:51:00 +0000 (11:51 +0200)]
[llvm][tools] Hide more unrelated tool options

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

3 years ago[clang][deps] Fix test by checking ignored files correctly
Jan Svoboda [Tue, 20 Jul 2021 11:17:45 +0000 (13:17 +0200)]
[clang][deps] Fix test by checking ignored files correctly

After a rebase, bc1a2979fc70d954ae97122205c71c8404a1b17e accidentally changed `shouldIgnoreFile(Filename)` to incorrect `IgnoredFiles.count(Filename)`. This avoided using native filenames, which the patch intended to solve in the first place.

Failing Windows builds:
* https://lab.llvm.org/buildbot#builders/123/builds/5147
* https://lab.llvm.org/buildbot#builders/86/builds/17177

3 years ago[AMDGPU] Pre-commit test case for D106284
Jay Foad [Mon, 19 Jul 2021 15:20:44 +0000 (16:20 +0100)]
[AMDGPU] Pre-commit test case for D106284

This test case shows the scheduler wrongly reordering two buffer
accesses that might alias.

3 years ago[DebugInfo][InstrRef] Fix a broken substitution method, add test coverage
Jeremy Morse [Tue, 20 Jul 2021 09:43:21 +0000 (10:43 +0100)]
[DebugInfo][InstrRef] Fix a broken substitution method, add test coverage

This patch fixes a clearly-broken function that I absent-mindedly bodged
many months ago.

Over in D85749 I landed the substituteDebugValuesForInst, that creates
substitution records for all the def operands from one debug-labelled
instruction to the new one. Unfortunately it would crash if the two
instructions had different numbers of operands; I tried to fix this in
537f0fbe82 by adding a "max operand" parameter to the method, but then
didn't actually change the loop bound to take account of this. It passed
all the tests because.... well there wasn't any real test coverage of this
method.

This patch fixes up the loop to be bounded by the MaxOperand bound; and
adds test coverage for the x86-fixup-LEAs calls to this method, so that
it's actually tested.

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

3 years ago[gn build] (manually) port bc1a2979fc70
Nico Weber [Tue, 20 Jul 2021 10:43:30 +0000 (06:43 -0400)]
[gn build] (manually) port bc1a2979fc70

3 years ago[PowerPC][NFC] add more cases for lfiwzx/lfiwax
Chen Zheng [Tue, 20 Jul 2021 10:27:47 +0000 (10:27 +0000)]
[PowerPC][NFC] add more cases for lfiwzx/lfiwax

3 years ago[clang][deps] Avoid minimizing PCH input files
Jan Svoboda [Tue, 20 Jul 2021 10:12:40 +0000 (12:12 +0200)]
[clang][deps] Avoid minimizing PCH input files

This patch avoid minimizing input files that contributed to a PCH or its modules. This prevents the implicit modular build to fail on unexpected file size. Depends on D106146.

Reviewed By: dexonsmith

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

3 years ago[clang][deps] Separate filesystem caches for minimized and original files
Jan Svoboda [Tue, 20 Jul 2021 09:42:34 +0000 (11:42 +0200)]
[clang][deps] Separate filesystem caches for minimized and original files

This patch separates the local and global caches of `DependencyScanningFilesystem` into two buckets: minimized files and original files. This is necessary to deal with precompiled modules/headers.

Consider a single worker with its instance of filesystem:
1. Build system uses the worker to scan dependencies of module A => filesystem cache gets populated with minimized input files.
2. Build system uses the results to explicitly build module A => explicitly built module captures the state of the real filesystem (containing non-minimized input files).
3. Build system uses the prebuilt module A as an explicit precompiled dependency for another compile job B.
4. Build system uses the same worker to scan dependencies for job B => worker uses implicit modular build to discover dependencies, which validates the filesystem state embedded in the prebuilt module (non-minimized files) to the current view of the filesystem (minimized files), resulting in validation failures.

This problem can be avoided in step 4 by collecting input files from the precompiled module and marking them as "ignored" in the minimizing filesystem. This way, the validation should succeed, since we should be always dealing with the original (non-minized) input files. However, the filesystem already minimized the input files in step 1 and put it in the cache, which gets used in step 4 as well even though it's marked ignored (do not minimize). This patch essentially fixes this oversight by making the `"file is minimized"` part of the cache key (from high level).

Depends on D106064.

Reviewed By: dexonsmith

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

3 years ago[AMDGPU] Disable LDS lowering for GFX shaders
Stanislav Mekhanoshin [Fri, 16 Jul 2021 16:15:10 +0000 (09:15 -0700)]
[AMDGPU] Disable LDS lowering for GFX shaders

Apparently these need external LDS symbols to remain.

Fixes: SC1-3279

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

3 years ago[DSE] Transform memset + malloc --> calloc (PR25892)
Dawid Jurczak [Mon, 5 Jul 2021 09:42:17 +0000 (11:42 +0200)]
[DSE] Transform memset + malloc --> calloc (PR25892)

After this change DSE can eliminate malloc + memset and emit calloc.
It's https://reviews.llvm.org/D101440 follow-up.

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

3 years agoRevert "[hwasan] Use stack safety analysis."
Florian Mayer [Tue, 20 Jul 2021 09:36:26 +0000 (10:36 +0100)]
Revert "[hwasan] Use stack safety analysis."

This reverts commit e9c63ed10b3bdf6eb3fa76d1a3eb403d6fc6a118.

3 years ago[clang][deps] Normalize ignored filenames in minimizing file system
Jan Svoboda [Tue, 20 Jul 2021 08:57:12 +0000 (10:57 +0200)]
[clang][deps] Normalize ignored filenames in minimizing file system

This patch normalizes filenames in `DependencyScanningWorkerFilesystem` so that lookup of ignored files works correctly on Windows (where `/` and `\` are equivalent).

Reviewed By: dexonsmith

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

3 years ago[NFC] run clang-format on hwasan use-after-scope tests.
Florian Mayer [Mon, 19 Jul 2021 10:16:38 +0000 (11:16 +0100)]
[NFC] run clang-format on hwasan use-after-scope tests.

Reviewed By: vitalybuka

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

3 years ago[PowerPC] Add lit.local.cfg in AtomicExpand tests
Kai Luo [Tue, 20 Jul 2021 09:11:01 +0000 (09:11 +0000)]
[PowerPC] Add lit.local.cfg in AtomicExpand tests

Fixed build errors on other platforms.

3 years ago[hwasan] [NFC] copy and disable ASAN tests to hwasan.
Florian Mayer [Fri, 16 Jul 2021 15:30:37 +0000 (16:30 +0100)]
[hwasan] [NFC] copy and disable ASAN tests to hwasan.

Reviewed By: vitalybuka

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

3 years ago[hwasan] Use stack safety analysis.
Florian Mayer [Mon, 19 Jul 2021 11:52:17 +0000 (12:52 +0100)]
[hwasan] Use stack safety analysis.

This avoids unnecessary instrumentation.

Reviewed By: eugenis, vitalybuka

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

3 years ago[AArch64][SVE][InstCombine] last{a,b} of a splat vector
Sander de Smalen [Mon, 19 Jul 2021 09:48:42 +0000 (10:48 +0100)]
[AArch64][SVE][InstCombine] last{a,b} of a splat vector

Replace last{a,b}(splat(X)) with X, irrespective of the predicate.

Patch by/Committing on behalf of: Usman Nadeem (mnadeem)

Reviewed By: sdesmalen

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

3 years ago[lldb] Remove unused variable. NFCI
Benjamin Kramer [Tue, 20 Jul 2021 08:34:05 +0000 (10:34 +0200)]
[lldb] Remove unused variable. NFCI

3 years ago[AArch64][SME] Add system registers and related instructions
Cullen Rhodes [Tue, 20 Jul 2021 07:19:10 +0000 (07:19 +0000)]
[AArch64][SME] Add system registers and related instructions

This patch adds the new system registers introduced in SME:

  - ID_AA64SMFR0_EL1 (ro) SME feature identifier.
  - SMCR_ELx (r/w) streaming mode control register for configuring
    effective SVE Streaming SVE Vector length when the PE is in
    Streaming SVE mode.
  - SVCR (r/w) streaming vector control register, visible at all
    exception levels. Provides access to PSTATE.SM and PSTATE.ZA
    using MSR and MRS instructions.
  - SMPRI_EL1 (r/w) streaming mode execution priority register.
  - SMPRIMAP_EL2 (r/w) streaming mode priority mapping register.
  - SMIDR_EL1 (ro) streaming mode identification register.
  - TPIDR2_EL0 (r/w) for use by SME software to manage per-thread
    SME context.
  - MPAMSM_EL1 (r/w) MPAM (v8.4) streaming mode register, for
    labelling memory accesses performed in streaming mode.

Also added in this patch are the SME mode change instructions.
Three MSR immediate instructions are implemented to set or clear
PSTATE.SM, PSTATE.ZA, or both respectively:

  - MSR SVCRSM, #<imm1>
  - MSR SVCRZA, #<imm1>
  - MSR SVCRSMZA, #<imm1>

The following smstart/smstop aliases are also implemented for
convenience:

  smstart    -> MSR SVCRSMZA, #1
  smstart sm -> MSR SVCRSM,   #1
  smstart za -> MSR SVCRZA,   #1

  smstop     -> MSR SVCRSMZA, #0
  smstop sm  -> MSR SVCRSM,   #0
  smstop za  -> MSR SVCRZA,   #0

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-06

Reviewed By: david-arm

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

3 years ago[mlir-tblgen] Fix failed matching when binds same operand of an op in different depth
Chia-hung Duan [Tue, 20 Jul 2021 07:26:23 +0000 (15:26 +0800)]
[mlir-tblgen] Fix failed matching when binds same operand of an op in different depth

For example, we will generate incorrect code for the pattern,

def : Pat<((FooOp (FooOp, $a, $b), $b)), (...)>;

We didn't allow $b to be bond twice with same operand of same op.

Reviewed By: jpienaar

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

3 years agoRemove the DarwinLog functionality from debguserver
Jason Molenda [Tue, 20 Jul 2021 07:31:19 +0000 (00:31 -0700)]
Remove the DarwinLog functionality from debguserver

Remove the DarwinLog and qStructuredDataPlugins support
from debugserver.  The DarwinLog plugin was never debugged
fully and made reliable, and the underlying private APIs
it uses have migrated since 2016 so none of them exist
any longer.

Differential Revision: https://reviews.llvm.org/D106324
rdar://75073283

3 years ago[AArch64][GlobalISel] Don't form truncstores in postlegalizer-lowering for s128.
Amara Emerson [Tue, 20 Jul 2021 07:03:37 +0000 (00:03 -0700)]
[AArch64][GlobalISel] Don't form truncstores in postlegalizer-lowering for s128.

We don't support truncating s128 stores, so don't form them.

3 years ago[Attributor] Use set vector instead of vector to prevent duplicates
Johannes Doerfert [Wed, 14 Jul 2021 03:54:52 +0000 (22:54 -0500)]
[Attributor] Use set vector instead of vector to prevent duplicates

3 years ago[Attributor] Simplify to values in the genericValueTraversal
Johannes Doerfert [Tue, 13 Jul 2021 03:14:36 +0000 (22:14 -0500)]
[Attributor] Simplify to values in the genericValueTraversal

We already simplified to a constant, given the new interface we can also
simplify to a generic value.

3 years ago[Attributor] Use checkForAllUses instead of custom use tracking
Johannes Doerfert [Wed, 14 Jul 2021 03:50:57 +0000 (22:50 -0500)]
[Attributor] Use checkForAllUses instead of custom use tracking

AAMemoryBehaviorFloating used a custom use tracking mechanism even
though checkForAllUses exists and is already more powerful. Further,
AAMemoryBehaviorFloating uses AANoCapture to guarantee that there are no
aliases and following the uses is sufficient. This is an OK assumption
if checkForAllUses is used but custom tracking is easily out of sync
with AANoCapture and problems follow.

3 years agosanitizer_common: add new mutex
Dmitry Vyukov [Sun, 18 Jul 2021 08:19:37 +0000 (10:19 +0200)]
sanitizer_common: add new mutex

We currently have 3 different mutexes:
 - RWMutex
 - BlockingMutex
 - __tsan::Mutex

RWMutex and __tsan::Mutex are roughly the same,
except that tsan version supports deadlock detection.
BlockingMutex degrades better under heavy contention
from lots of threads (blocks in OS), but much slower
for light contention and has non-portable performance
and has larger static size and is not reader-writer.

Add a new mutex that combines all advantages of these
mutexes: it's reader-writer, has fast non-contended path,
supports blocking to gracefully degrade under higher contention,
has portable size/performance.

For now it's named Mutex2 for incremental submission. The plan is to:
 - land this change
 - then move deadlock detection logic from tsan
 - then rename it to Mutex and remove tsan Mutex
 - then typedef RWMutex/BlockingMutex to this mutex

SpinMutex stays as separate type because it has faster fast path:
1 atomic RMW per lock/unlock as compared to 2 for this mutex.

Reviewed By: vitalybuka, melver

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

3 years ago[PowerPC] Fallback to base's implementation of shouldExpandAtomicCmpXchgInIR and...
Kai Luo [Tue, 20 Jul 2021 06:14:08 +0000 (06:14 +0000)]
[PowerPC] Fallback to base's implementation of shouldExpandAtomicCmpXchgInIR and shouldExpandAtomicCmpXchgInIR

If we can't decide `shouldExpandAtomicCmpXchgInIR` or `shouldExpandAtomicCmpXchgInIR` in PPC's implementation after https://reviews.llvm.org/rGb9c3941cd61de1e1b9e4f3311ddfa92394475f4b, resort to base's implementation.

This fixes internal build of OpenMP which uses atomic operations on float.

Reviewed By: jsji

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

3 years ago[NFC][profile] Move writeMMappedFile to ELF ifdef block
Petr Hosek [Tue, 20 Jul 2021 05:45:33 +0000 (22:45 -0700)]
[NFC][profile] Move writeMMappedFile to ELF ifdef block

This avoids the compiler warning on Darwin where that function is unused.

3 years ago[RISCV] Add test cases to show an issue with our fcvt.wu isel patterns on RV64.
Craig Topper [Tue, 20 Jul 2021 05:52:05 +0000 (22:52 -0700)]
[RISCV] Add test cases to show an issue with our fcvt.wu isel patterns on RV64.

The pattern we match is (sext_inreg (assertzexti32 (fp_to_uint)), i32). If
the assertzexti32 has an additional user we'll end up emitting
an fcvt.wu and an fcvt.lu.

This can happen if the original fp_to_uint before type legalization
has one user that causes a sext_inreg to be emitted and one that
doesn't.

3 years ago[gn build] Port adb55d7c3265
LLVM GN Syncbot [Tue, 20 Jul 2021 05:51:14 +0000 (05:51 +0000)]
[gn build] Port adb55d7c3265

3 years ago[lldb] Make WatchpointList iterable
Michał Górny [Mon, 19 Jul 2021 11:17:52 +0000 (13:17 +0200)]
[lldb] Make WatchpointList iterable

Based on de448c0a9e5088979526e2e67152fe547ae4ccf0.

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

3 years agotsan: remove the stats subsystem
Dmitry Vyukov [Mon, 19 Jul 2021 14:19:07 +0000 (16:19 +0200)]
tsan: remove the stats subsystem

I don't think the stat subsystem was ever used since tsan
development in 2012. But it adds lots of code and this
effectively dead code needs to be updated if the runtime
code changes, which adds maintanance cost for no benefit.
Normal profiler usually gives enough info and that info
is more trustworthy.
Remove the stats subsystem.

Reviewed By: vitalybuka

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

3 years ago[Attributor] Gracefully handle interprocedural reachability queries
Johannes Doerfert [Tue, 20 Jul 2021 05:30:20 +0000 (00:30 -0500)]
[Attributor] Gracefully handle interprocedural reachability queries

This does ensure `InformationCache::getPotentiallyReachable` will not
crash/assert on instructions from different functions but simply return
that one is reachable, which is conservatively correct.

3 years ago[Attributor] Ensure to simplify operands in AAValueConstantRange
Johannes Doerfert [Thu, 15 Jul 2021 21:09:33 +0000 (16:09 -0500)]
[Attributor] Ensure to simplify operands in AAValueConstantRange

As with other patches before, the simplification callback interface
requires us to go through the Attributor::getAssumedSimplified API first
before we recurs.

It is unclear if the problem can be explicitly tested with our current
infrastructure.

3 years ago[Attributor] Extend the AAValueSimplify compare simplification logic
Johannes Doerfert [Thu, 15 Jul 2021 20:41:46 +0000 (15:41 -0500)]
[Attributor] Extend the AAValueSimplify compare simplification logic

We first simplify the operands of a compare and then reason on the
simplified versions, e.g., with AANonNull.

This does improve the simplification capabilities but also fixes a
potential problem that has not yet been observed by simplifying the
operands first.

3 years ago[Attributor][NFCI] Expose `getAssumedUnderlyingObjects` API
Johannes Doerfert [Tue, 13 Jul 2021 03:22:31 +0000 (22:22 -0500)]
[Attributor][NFCI] Expose `getAssumedUnderlyingObjects` API

3 years ago[OpenMP] Remove XFAIL and update check lines properly
Johannes Doerfert [Tue, 20 Jul 2021 05:26:52 +0000 (00:26 -0500)]
[OpenMP] Remove XFAIL and update check lines properly

Undo 15c5701c8324d2dea519fa379c04d5c619a570ab and update check lines.

3 years ago[Attributor][NFC] Fix function name spelling
Johannes Doerfert [Tue, 20 Jul 2021 04:50:20 +0000 (23:50 -0500)]
[Attributor][NFC] Fix function name spelling

3 years agotsan: add pragma line to buildgo.sh
Dmitry Vyukov [Mon, 19 Jul 2021 13:54:44 +0000 (15:54 +0200)]
tsan: add pragma line to buildgo.sh

Add pragma line so that errors messages point to the actual
source files rather than to the concatenated gotsan.cpp.

Reviewed By: vitalybuka, melver

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

3 years ago[OpenMP][FIX] Temporarily XFAIL tests waiting for new check lines
Johannes Doerfert [Tue, 20 Jul 2021 04:14:35 +0000 (23:14 -0500)]
[OpenMP][FIX] Temporarily XFAIL tests waiting for new check lines

The test is not wrong nor is the current main broken, it just an
interplay issue. Check lines will be updated in shortly.

3 years ago[Attributor][FIX] Do not simplify byval arguments
Johannes Doerfert [Wed, 14 Jul 2021 21:06:57 +0000 (16:06 -0500)]
[Attributor][FIX] Do not simplify byval arguments

A byval argument is a different value in the caller and callee, we
cannot propagate the information as part of AAValueSimplify. Users that
want to deal with byval arguments need to specifically perform the
argument -> call site step. We do not do this for now.

3 years ago[Attributor] Introduce AAPointerInfo
Johannes Doerfert [Mon, 12 Jul 2021 00:27:26 +0000 (19:27 -0500)]
[Attributor] Introduce AAPointerInfo

This patch introduces AAPointerInfo which tracks the uses of a pointer
and places them in "bins" based on their offset from the base and access
size.

As with other AAs, any pointer can be tracked but it is up to the user
to make sense of the results. The user in this patch is AAValueSimplify
and AAPotentialValues which both utilize AAPointerInfo to determine the
value of a load. For now, this is restricted to loads of allocas and
internal globals. Through the use of AAPointerInfo and the "bins" we can
track struct members separately. The users also know that storing only
zeros (at unknown indices) will result in loading only 0 (from unknown
indices). Other than that, the users are flow and context insensitive
(for now).

To deal with the "bins" more easily, AAPointerInfo provides a
forallInterfearingAccesses that applies a callback on all accesses
that might interfere with a given load or store.

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

3 years ago[Attributor] Simplify loads
Johannes Doerfert [Mon, 10 May 2021 06:11:06 +0000 (01:11 -0500)]
[Attributor] Simplify loads

As a first step to simplify loads we only handle `null` and `undef`
underlying objects, as well as objects that have the load as a single user.
Loads of those values can be replaced by the initializer, if any.
Proper reasoning is introduced in a follow up patch

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

3 years ago[OpenMP] Fix carefully track SPMDCompatibilityTracker
Johannes Doerfert [Thu, 15 Jul 2021 18:12:00 +0000 (13:12 -0500)]
[OpenMP] Fix carefully track SPMDCompatibilityTracker

We did not properly use SPMDCompatibilityTracker in various places.
This patch makes sure we look at the validity properly and also fix
the state if we can.

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

3 years agoRevert "[PowerPC] Extra test case for LDARX"
Albion Fung [Tue, 20 Jul 2021 02:27:02 +0000 (21:27 -0500)]
Revert "[PowerPC] Extra test case for LDARX"

This reverts commit 1d3e77e7a8421a9d2dd13e3ef499ea967ea8f85c as
some buildbots seem to be unable to obtain the target
powerpc64le-unknown-linux-gnu.

3 years ago[NFC] Correct documentation error in OpenMP release ReleaseNotes
Tony Tye [Tue, 20 Jul 2021 01:20:22 +0000 (01:20 +0000)]
[NFC] Correct documentation error in OpenMP release ReleaseNotes

Reviewed By: tianshilei1992

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

3 years ago[ORC-RT] Introduce a ORC_RT_JIT_DISPATCH_TAG macro.
Lang Hames [Mon, 19 Jul 2021 23:06:39 +0000 (09:06 +1000)]
[ORC-RT] Introduce a ORC_RT_JIT_DISPATCH_TAG macro.

This macro can be used to define tag variables for use with jit-dispatch.

3 years ago[ORC-RT] Add ORC_RT prefix to WEAK_IMPORT macro.
Lang Hames [Mon, 19 Jul 2021 22:52:21 +0000 (08:52 +1000)]
[ORC-RT] Add ORC_RT prefix to WEAK_IMPORT macro.

3 years ago[Clang][RISCV] Correct the alignment of stores generated by vlseg/vlsegff.
Hsiangkai Wang [Mon, 19 Jul 2021 08:57:41 +0000 (16:57 +0800)]
[Clang][RISCV] Correct the alignment of stores generated by vlseg/vlsegff.

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

3 years agoRevert D106128 "[lld-macho] Use DO_BIND_ADD_ADDR_IMM_SCALED for bind opcodes"
Fangrui Song [Tue, 20 Jul 2021 01:13:52 +0000 (18:13 -0700)]
Revert D106128 "[lld-macho] Use DO_BIND_ADD_ADDR_IMM_SCALED for bind opcodes"

This reverts commit 321b2bef098553ec648e4174aae92c63a6e1a810.

`for (BindIR *p = &opcodes[0]; p->opcode != BIND_OPCODE_DONE; ++p) {` has a heap-buffer-overflow with test/MachO/bind-opcodes.

3 years ago[OpenMP] Fixed a segmentation fault when using taskloop and target nowait
Shilei Tian [Tue, 20 Jul 2021 01:08:40 +0000 (21:08 -0400)]
[OpenMP] Fixed a segmentation fault when using taskloop and target nowait

The synchronization of task loop misses hidden helper tasks, causing segmentation
fault reported in https://bugs.llvm.org/show_bug.cgi?id=50002.

Reviewed By: ye-luo

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

3 years agoCodeGen: Make MachineOptimizationRemarkEmitterPass a CFG analysis
Matt Arsenault [Wed, 12 May 2021 21:10:24 +0000 (17:10 -0400)]
CodeGen: Make MachineOptimizationRemarkEmitterPass a CFG analysis

This avoids rerunning it a few times.

3 years ago[PowerPC] Extra test case for LDARX
Albion Fung [Tue, 20 Jul 2021 01:03:22 +0000 (20:03 -0500)]
[PowerPC] Extra test case for LDARX

An extra test case added for the builtin __LDARX.

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

3 years agoGlobalISel: Remove some mystery code that clears isReturned
Matt Arsenault [Fri, 16 Jul 2021 23:59:22 +0000 (19:59 -0400)]
GlobalISel: Remove some mystery code that clears isReturned

I don't understand what this is going for, and haven't found an analog
in DAG code. No tests fail with this removed.

3 years agoAArch64/GlobalISel: Preserve memory types
Matt Arsenault [Fri, 16 Jul 2021 13:54:52 +0000 (09:54 -0400)]
AArch64/GlobalISel: Preserve memory types

3 years agoRevert D105519 "[WebAssembly] Deduplicate imports of the same module name, field...
Fangrui Song [Tue, 20 Jul 2021 00:09:01 +0000 (17:09 -0700)]
Revert D105519 "[WebAssembly] Deduplicate imports of the same module name, field name, and type" and its followup

This reverts commit 4ae575b9997e0903d1c2ec01a43e3f3f2db5df16 and 9b965b37c75d626c01951184088314590e38d299.

There is an use-of-uninitialized-value bug in the `else` branch in ImportSection::addImport.

3 years ago[Libomptarget] Remove volatile from NVPTX work function
Joseph Huber [Mon, 19 Jul 2021 20:54:31 +0000 (16:54 -0400)]
[Libomptarget] Remove volatile from NVPTX work function

Currently the NPVTX work function is marked volatile. This prevents some
optimizations from using this value.

Reviewed By: jdoerfert

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

3 years ago[gn build] Fix llvm_build_instrumented_coverage=true builds with goma/rbe
Nico Weber [Mon, 19 Jul 2021 23:57:02 +0000 (19:57 -0400)]
[gn build] Fix llvm_build_instrumented_coverage=true builds with goma/rbe

3 years ago[libc++] Tidy-up instances of __STDCPP_DEFAULT_NEW_ALIGNMENT__ in the tests
Louis Dionne [Fri, 16 Jul 2021 19:52:42 +0000 (15:52 -0400)]
[libc++] Tidy-up instances of __STDCPP_DEFAULT_NEW_ALIGNMENT__ in the tests

See https://reviews.llvm.org/D105905 for context.

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

3 years ago[libc++] Add a bunch of missing _LIBCPP_HIDE_FROM_ABI in <ranges>
Louis Dionne [Mon, 19 Jul 2021 16:34:56 +0000 (12:34 -0400)]
[libc++] Add a bunch of missing _LIBCPP_HIDE_FROM_ABI in <ranges>

We've been forgetting to add those to most of the <ranges> review.
To avoid forgetting in the future, I added an item in the pre-commit
checklist.

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