platform/upstream/llvm.git
3 years ago[Support] Fix 'keeping' temporary files on Windows 7
Alexandre Ganea [Wed, 24 Mar 2021 16:28:00 +0000 (12:28 -0400)]
[Support] Fix 'keeping' temporary files on Windows 7

As reported here: https://bugs.llvm.org/show_bug.cgi?id=48378#c0
and here: https://github.com/rust-lang/rust/issues/81051
since 79657e2339b58bc01fe1b85a448bb073d57d90bb, some programs such as llvm-ar
don't work properly on Windows 7.

The issue is shown in the snippet by Oleksandr Prodan:
https://pastebin.com/v51m3uBU

In essence, once the 'DeleteFile' flag has been set on FILE_DISPOSITION_INFO,
the file path can't be queried anymore with GetFinalPathNameByHandleW. This
however works on Windows 10, GetFinalPathNameByHandleW would return sucessfully.

To workaround the issue, we simply reset the 'DeleteFile' flag before even
checking if we're dealing with a network file.

Tested with `llvm-ar r empty.a a.obj` ran on a network mount. At the moment, we
cannot specifically add a test coverage for this, since it requres mounting a
network drive.

3 years ago[polly] Fix build
Nikita Popov [Wed, 24 Mar 2021 16:46:05 +0000 (17:46 +0100)]
[polly] Fix build

This produced a compile error with GCC:

llvm-project/polly/lib/Transform/ScheduleOptimizer.cpp:1220:49: error: cannot convert ‘bool’ to ‘llvm::TargetTransformInfo::RegisterKind’
 1220 |     RegisterBitwidth = TTI->getRegisterBitWidth(true);

3 years agoFix false negative in -Wthread-safety-attributes
Aaron Puchert [Wed, 24 Mar 2021 16:45:22 +0000 (17:45 +0100)]
Fix false negative in -Wthread-safety-attributes

The original implementation didn't fire on non-template classes when a
base class was an instantiation of a template with a dependent base.
In that case the base of the base is dependent as seen from the base,
but not from the class we're interested in, which isn't a template.

Also it simplifies the code a lot.

Reviewed By: aaron.ballman

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

3 years ago[ARM] Enable UpperBound unrolling for all loops
David Green [Wed, 24 Mar 2021 16:39:21 +0000 (16:39 +0000)]
[ARM] Enable UpperBound unrolling for all loops

This UpperBound unrolling was already enabled so long as a series of
conditions in ARMTTIImpl::getUnrollingPreferences pass. This just always
enables it as it can help fully unroll loops that would not otherwise
pass those tests.

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

3 years ago[InstSimplify] add tests for min/max intrinsic analysis; NFC
Sanjay Patel [Wed, 24 Mar 2021 15:19:35 +0000 (11:19 -0400)]
[InstSimplify] add tests for min/max intrinsic analysis; NFC

3 years ago[dfsan] Add Origin ABI Wrappers
Jianzhou Zhao [Wed, 24 Mar 2021 16:13:09 +0000 (16:13 +0000)]
[dfsan] Add Origin ABI Wrappers

    Supported strrchr, strrstr, strto*, recvmmsg, recrmsg, nanosleep,
    memchr, snprintf, socketpair, sprintf, getocketname, getsocketopt,
    gettimeofday, getpeername.

    strcpy was added because the test of sprintf need it. It will be
    committed by D98966. Please ignore it when reviewing.

    This is a part of https://reviews.llvm.org/D95835.

    Reviewed By: gbalats

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

3 years ago[UpdateTestChecks] Fix typo & copy/paste in comments
Thomas Preud'homme [Wed, 24 Mar 2021 16:09:02 +0000 (16:09 +0000)]
[UpdateTestChecks] Fix typo & copy/paste in comments

3 years ago[sanitizer] Fix Solaris build.
Matt Morehouse [Wed, 24 Mar 2021 16:07:38 +0000 (09:07 -0700)]
[sanitizer] Fix Solaris build.

Use `#if SANITIZER_LINUX` instead of `#if defined(...)`.

3 years ago[NFCI][SimplifyCFG] Fold branch to common dest: don't check cost if no qualified...
Roman Lebedev [Wed, 24 Mar 2021 16:01:39 +0000 (19:01 +0300)]
[NFCI][SimplifyCFG] Fold branch to common dest: don't check cost if no qualified preds

3 years agoAMDGPU: Add target id and code object v4 support
Konstantin Zhuravlyov [Wed, 24 Mar 2021 15:52:10 +0000 (11:52 -0400)]
AMDGPU: Add target id and code object v4 support

  - Add target id support (https://clang.llvm.org/docs/ClangOffloadBundler.html#target-id)
  - Add code object v4 support (https://llvm.org/docs/AMDGPUUsage.html#elf-code-object)
    - Add kernarg_size to kernel descriptor
    - Change trap handler ABI to no longer move queue pointer into s[0:1]
  - Cleanup ELF definitions
    - Add V2, V3, V4 suffixes to make a clear distinction for code object version
    - Consolidate note names

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

3 years ago[flang] Save binding labels as strings
Tim Keith [Wed, 24 Mar 2021 15:52:26 +0000 (08:52 -0700)]
[flang] Save binding labels as strings

Binding labels start as expressions but they have to evaluate to
constant character of default kind, so they can be represented as an
std::string. Leading and trailing blanks have to be removed, so the
folded expression isn't exactly right anyway.

So all BIND(C) symbols now have a string binding label, either the
default or user-supplied one. This is recorded in the .mod file.

Add WithBindName mix-in for details classes that can have a binding
label so that they are all consistent. Add GetBindName() and
SetBindName() member functions to Symbol.

Add tests that verifies that leading and trailing blanks are ignored
in binding labels and that the default label is folded to lower case.

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

3 years agoUpdated LLDB for the new Clang Language enumerator 'OpenCLCXX'
Dmitri Gribenko [Wed, 24 Mar 2021 15:44:05 +0000 (16:44 +0100)]
Updated LLDB for the new Clang Language enumerator 'OpenCLCXX'

3 years ago[sanitizer] Fix Solaris build.
Matt Morehouse [Wed, 24 Mar 2021 15:43:44 +0000 (08:43 -0700)]
[sanitizer] Fix Solaris build.

mremap is only available on Linux.

3 years ago[ARM] Regenerate some test checks. NFC
David Green [Wed, 24 Mar 2021 15:34:34 +0000 (15:34 +0000)]
[ARM] Regenerate some test checks. NFC

3 years ago[mlir][linalg] Do not call region builder during vectorization.
Tobias Gysi [Wed, 24 Mar 2021 14:22:17 +0000 (14:22 +0000)]
[mlir][linalg] Do not call region builder during vectorization.

All linalg operations having a region builder shall call it during op creation. Calling it during vectorization is obsolete.

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

3 years ago[InstCombine] add tests for sub of umin; NFC
Sanjay Patel [Tue, 23 Mar 2021 16:51:55 +0000 (12:51 -0400)]
[InstCombine] add tests for sub of umin; NFC

Potential missing fold noted in D98152

3 years ago[TTI] Return a TypeSize from getRegisterBitWidth.
Sander de Smalen [Wed, 24 Mar 2021 13:50:31 +0000 (13:50 +0000)]
[TTI] Return a TypeSize from getRegisterBitWidth.

This patch changes the interface to take a RegisterKind, to indicate
whether the register bitwidth of a scalar register, fixed-width vector
register, or scalable vector register must be returned.

Reviewed By: paulwalker-arm

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

3 years ago[gn build] (manually) port 301d9261b787
Nico Weber [Wed, 24 Mar 2021 14:39:47 +0000 (10:39 -0400)]
[gn build] (manually) port 301d9261b787

This reverts commit 50fd426fd845eefe916bbeef80b509de9bdea338
and tweaks things for the reland: SystemZAsmLexer is now
SystemZAsmLexerTests.

3 years ago[SVE] Suppress vselect warning from incorrect interface call
Nashe Mncube [Mon, 8 Mar 2021 09:37:56 +0000 (09:37 +0000)]
[SVE] Suppress vselect warning from incorrect interface call

The VSelectCombine handler within AArch64ISelLowering,
uses an interface call which only expects fixed vectors.
This generates a warning when the call is made on a
scalable vector. This warning has been suppressed with this change,
by using the ElementCount interface, which supports both fixed and scalable vectors.
I have also added a regression test which recreates the warning.

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

3 years ago[Polly][DCE] clang-format DeadCodeElimination.h. NFC.
Michael Kruse [Wed, 24 Mar 2021 13:39:00 +0000 (08:39 -0500)]
[Polly][DCE] clang-format DeadCodeElimination.h. NFC.

The targets polly-update-format and check-polly-format process new files
only after running cmake again. This is why it was missed in the last
commit.

3 years ago[AsmParser][SystemZ][z/OS] Re-introduce HLASM comment syntax
Anirudh Prasad [Wed, 24 Mar 2021 14:15:15 +0000 (10:15 -0400)]
[AsmParser][SystemZ][z/OS] Re-introduce HLASM comment syntax

- https://reviews.llvm.org/rGb605cfb336989705f391d255b7628062d3dfe9c3 was reverted due to sanitizer bugs in the introduced unit-test (specifically in the Address sanitizer https://lab.llvm.org/buildbot/#/builders/5/builds/5697)
- This patch attempts to rectify that, as well as re-factor parts of the test
- The issue was previously, within the `setupCallToAsmParser` function in the unit-test, `SrcMgr` was declared as a local variable. `SrcMgr` owns a unique pointer. Since the variable goes out of scope at the end of the function, the unique pointer is released.
- This patch, moves the declaration of the `SrcMgr` variable to a class field, since the scope will remain until the class's destructor is invoked (which in this case is at the end of the unit test)
- Furthermore, this patch also moves the `MCContext Ctx` declaration from a local variable instance inside a function, to a unique pointer class field. This ensures the instantiation of the MCContext remains until the tear down of the test.

Reviewed By: abhina.sreeskantharajan

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

3 years ago[mlir] introduce data layout entry for index type
Alex Zinenko [Mon, 22 Mar 2021 13:58:26 +0000 (14:58 +0100)]
[mlir] introduce data layout entry for index type

Index type is an integer type of target-specific bitwidth present in many MLIR
operations (loops, memory accesses). Converting values of this type to
fixed-size integers has always been problematic. Introduce a data layout entry
to specify the bitwidth of `index` in a given layout scope, defaulting to 64
bits, which is a commonly used assumption, e.g., in constants.

Port builtin-to-LLVM type conversion to use this data layout entry when
converting `index` type and untie it from pointer size. This is particularly
relevant for GPU targets. Keep a possibility to forcibly override the index
type in lowerings.

Depends On D98525

Reviewed By: herhut

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

3 years ago[mlir] forward data layout query to scoping op in absence of specification
Alex Zinenko [Mon, 22 Mar 2021 13:58:13 +0000 (14:58 +0100)]
[mlir] forward data layout query to scoping op in absence of specification

Even if the layout specification is missing from an op that supports it, the op
is still expected to provide meaningful responses to data layout queries.
Forward them to the op instead of directly calling the default implementation.

Depends On D98524

Reviewed By: rriddle

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

3 years ago[mlir] provide a version of data layout size hooks in bits
Alex Zinenko [Mon, 22 Mar 2021 13:58:03 +0000 (14:58 +0100)]
[mlir] provide a version of data layout size hooks in bits

This is useful for bit-packing types such as vectors and tuples as well as for
exotic architectures that have non-8-bit bytes.

Depends On D98500

Reviewed By: rriddle

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

3 years ago[mlir] support data layout specs on ModuleOp
Alex Zinenko [Mon, 22 Mar 2021 13:57:39 +0000 (14:57 +0100)]
[mlir] support data layout specs on ModuleOp

ModuleOp is a natural place to provide scoped data layout information. However,
it is undesirable for ModuleOp to implement the entirety of
DataLayoutOpInterface because that would require either pushing the interface
inside the IR library instead of a separate library, or putting the default
implementation of the interface as inline functions in headers leading to
binary bloat. Instead, ModuleOp accepts an arbitrary data layout spec attribute
and has a dedicated hook to extract it, and DataLayout is modified to know
about ModuleOp particularities.

Reviewed By: herhut, nicolasvasilache

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

3 years ago[X86][AVX] combineBitcastvxi1 - improve handling of vectors truncated to vXi1
Simon Pilgrim [Wed, 24 Mar 2021 14:05:43 +0000 (14:05 +0000)]
[X86][AVX] combineBitcastvxi1 - improve handling of vectors truncated to vXi1

If we're truncating to vXi1 from a wider type, then prefer the original wider vector as is simplifies folding the separate truncations + extensions.

AVX1 this is only worth it for v8i1 cases, not v4i1 where we're always better off truncating down to v4i32 for movmsk.

Helps with some regressions encountered in D96609

3 years ago[clang-tidy] Ignore all spaces in the list of checks
Dmitry Polukhin [Tue, 23 Mar 2021 12:26:21 +0000 (05:26 -0700)]
[clang-tidy] Ignore all spaces in the list of checks

This diff patch fixes issue with new line character after check name and before comma. Also ignores all other types of spaces like TAB.

Test Plan: ninja check-clang-tools

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

3 years ago[clang] [C++2b] [P1102] Accept lambdas without parameter list ().
Marek Kurdej [Wed, 24 Mar 2021 13:26:02 +0000 (14:26 +0100)]
[clang] [C++2b] [P1102] Accept lambdas without parameter list ().

As an extension, accept such lambdas in previous standards with a warning.

* http://eel.is/c++draft/expr.prim.lambda
* http://wg21.link/P1102

Reviewed By: aaron.ballman

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

3 years ago[PowerPC] Add mprivileged option
Stefan Pintilie [Tue, 23 Mar 2021 15:31:52 +0000 (10:31 -0500)]
[PowerPC] Add mprivileged option

Add an option to tell the compiler that it can use privileged instructions.

This patch only adds the option. Backend implementation will be added in a
future patch.

Reviewed By: lei, amyk

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

3 years ago[llvm-objdump] Implement --prefix-strip option
Vinicius Tinti [Sat, 1 Aug 2020 01:45:05 +0000 (22:45 -0300)]
[llvm-objdump] Implement --prefix-strip option

The option `--prefix-strip` is only used when `--prefix` is not empty.
It removes N initial directories from absolute paths before adding the
prefix.

This matches GNU's objdump behavior.

Reviewed By: jhenderson

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

3 years ago[clang] Treat variable-length array of incomplete element type as
Haojian Wu [Tue, 23 Mar 2021 10:16:57 +0000 (11:16 +0100)]
[clang] Treat variable-length array of incomplete element type as
incomplete type.

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

3 years ago[OpenMP] Change OMPIRBuilder to append function attributes
Joseph Huber [Mon, 15 Mar 2021 15:52:38 +0000 (11:52 -0400)]
[OpenMP] Change OMPIRBuilder to append function attributes

Summary:
Currently the OMPIRBuilder overwrites the function's existing attributes
when it assigns the ones defined in OMPKinds.def. This changes the
behaviour to append the current function's attributes with them instead.

Reviewed By: jdoerfert

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

3 years ago[OpenCL] Added distinct file extension for C++ for OpenCL.
Anastasia Stulova [Wed, 3 Mar 2021 19:00:55 +0000 (19:00 +0000)]
[OpenCL] Added distinct file extension for C++ for OpenCL.

Files compiled with C++ for OpenCL mode can now have a distinct
file extension - clcpp, then clang driver picks the compilation
mode automatically (-x clcpp) without the use of -cl-std=clc++.

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

3 years ago[LoopAnalysis][NFC]Remove redundant code.
Alexey Bataev [Wed, 24 Mar 2021 12:35:36 +0000 (05:35 -0700)]
[LoopAnalysis][NFC]Remove redundant code.

Removed redundant code for IsConsecutive variable.

3 years ago[gn build] port 1d8fc086ae26
Nico Weber [Wed, 24 Mar 2021 12:29:34 +0000 (08:29 -0400)]
[gn build] port 1d8fc086ae26

3 years ago[mlir] Fixes to hoist padding
Nicolas Vasilache [Wed, 24 Mar 2021 11:24:22 +0000 (11:24 +0000)]
[mlir] Fixes to hoist padding

Fix the BlockAndValueMapping update that was missing entries for scf.for op's blockIterArgs.
Skip cloning subtensors of the padded tensor as the logic for these is separate.
Add a filter to drop side-effecting ops.

Tests are beefed up to verify the IR is sound in all hoisting configurations for 2-level 3-D tiled matmul.

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

3 years ago[X86][AVX] lowerShuffleAsBroadcast - MOVDDUP(SCALAR_TO_VECTOR(X)) -> BROADCAST(X)
Simon Pilgrim [Wed, 24 Mar 2021 11:31:35 +0000 (11:31 +0000)]
[X86][AVX] lowerShuffleAsBroadcast - MOVDDUP(SCALAR_TO_VECTOR(X)) -> BROADCAST(X)

Prefer broadcast from scalar on AVX targets as this makes it easier for later folds to strip away bitcasts etc.

This helps a lot with the AVX1 poor codegen from PR49658.

There's a trivial regression in bitcast-int-to-vector-bool-*ext.ll tests due to SimplifyDemandedBits not being able to see a multi-use case, but there's bigger existing codegen issues to be addressed first in those tests (unnecessary NOTs).

3 years ago[MCA] Fix for uninitialised member in constructor. NFC
Andrea Di Biagio [Wed, 24 Mar 2021 11:20:15 +0000 (11:20 +0000)]
[MCA] Fix for uninitialised member in constructor. NFC

3 years ago[X86] Remove unused 'OneUse' option from IsNOT helper. NFCI.
Simon Pilgrim [Wed, 24 Mar 2021 11:11:57 +0000 (11:11 +0000)]
[X86] Remove unused 'OneUse' option from IsNOT helper. NFCI.

3 years ago[X86][AVX] Cleanup gather_v8i32_v8i32 special test case
Simon Pilgrim [Wed, 24 Mar 2021 10:57:50 +0000 (10:57 +0000)]
[X86][AVX] Cleanup gather_v8i32_v8i32 special test case

Cleanup the gather_v8i32_v8i32 IR to more closely match how the middle-end will optimise the vector geps (exposing more splats).

This helps the gather scalarization case a lot, but shows a missed opportunity for AVX512 gathers to recognise uniform-constant indices.

And none of the cases realise that some of the gathers are really blended broadcasts....

3 years ago[AMDGPU] SIOptimizeExecMaskingPreRA should check constant bus constraint when folds...
alex-t [Thu, 18 Mar 2021 19:22:08 +0000 (22:22 +0300)]
[AMDGPU] SIOptimizeExecMaskingPreRA should check constant bus constraint when folds EXEC copy

Folding EXEC copy into it's single use may lead to constant bus constraint violation as it adds one more SGPR operand.
         This change makes it validate the user instruction with the new SGPR operand and only fold it if it is legal.

Reviewed By: rampitec, arsenm

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

3 years agoRevert "[lldb/Plugins] Add ScriptedProcess Process Plugin"
David Zarzycki [Wed, 24 Mar 2021 11:06:07 +0000 (07:06 -0400)]
Revert "[lldb/Plugins] Add ScriptedProcess Process Plugin"

This reverts commit dd391e1ef762d79f86112dc2480a89c9be066ce1.

This patch causes 17 LLDB test regressions on Fedora 33 (x86-64).

3 years ago[LV] Move exact FP math check out of Requirements.
Florian Hahn [Wed, 24 Mar 2021 10:01:20 +0000 (10:01 +0000)]
[LV] Move exact FP math check out of Requirements.

We know if the loop contains FP instructions preventing vectorization
after we are done with legality checks. This patch updates the code the
check for un-vectorizable FP operations earlier, to avoid unnecessarily
running the cost model and picking a vectorization factor. It also makes
the code more direct and moves the check to a position where similar
checks are done.

I might be missing something, but I don't see any reason to handle this
check differently to other, similar checks.

Reviewed By: lebedev.ri

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

3 years ago[clang][deps] NFC: Document collector, rename members
Jan Svoboda [Wed, 24 Mar 2021 10:58:19 +0000 (11:58 +0100)]
[clang][deps] NFC: Document collector, rename members

This patch documents how `ModuleDepCollector{,PP}` work and what their members store. Also renames somewhat vague `MainDeps` to `FileDeps` and `Deps` to `ModularDeps`.

Depends on D98943.

Reviewed By: Bigcheese

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

3 years ago[clang][deps] NFC: Extract ModuleID struct
Jan Svoboda [Wed, 24 Mar 2021 10:56:26 +0000 (11:56 +0100)]
[clang][deps] NFC: Extract ModuleID struct

This patch extracts the `ModuleName` and `ContextHash` members of `ClangModuleDep`, `FullDependencies` and `ModuleDeps` into a single struct `ModuleID`. This makes it easier to understand how the full dependency graph works.

Reviewed By: Bigcheese, dexonsmith

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

3 years ago[MCA] Disable RCU for InOrderIssueStage
Andrew Savonichev [Sun, 14 Mar 2021 22:25:51 +0000 (01:25 +0300)]
[MCA] Disable RCU for InOrderIssueStage

This is a follow-up for:
D98604 [MCA] Ensure that writes occur in-order

When instructions are aligned by the order of writes, they retire
in-order naturally. There is no need for an RCU, so it is disabled.

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

3 years ago[PowerPC] Change option to mrop-protect
Stefan Pintilie [Tue, 23 Mar 2021 13:20:08 +0000 (08:20 -0500)]
[PowerPC] Change option to mrop-protect

In order to have the same option on power PC LLVM and power PC gcc
the option will be changed from -mrop-protection to -mrop-protect.

The feature will be off by default and turned on when the option is used.

Reviewed By: lei, amyk

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

3 years ago[Analyzer][NFC] Fix typos in comments
Gabor Marton [Wed, 24 Mar 2021 10:46:10 +0000 (11:46 +0100)]
[Analyzer][NFC] Fix typos in comments

3 years ago[clang][lit] Allow test cases to use the compiler that are used to compile Clang
Ella Ma [Wed, 24 Mar 2021 10:32:57 +0000 (11:32 +0100)]
[clang][lit] Allow test cases to use the compiler that are used to compile Clang

Required by D83660.
Test cases may want to use the host compiler to compile some mocks for the
test case.

This patch adds two substitutions `%host_cc` and `%host_cxx` to use the host
compilers set via variable `CMAKE_C_COMPILER` and `CMAKE_CXX_COMPILER`.

Patch by Ella Ma!

Reviewed By: steakhal

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

3 years ago[NFC][PhaseOrdering] Add a testcase for additional LICM before LoopRotate (D99249...
Roman Lebedev [Wed, 24 Mar 2021 09:47:51 +0000 (12:47 +0300)]
[NFC][PhaseOrdering] Add a testcase for additional LICM before LoopRotate (D99249/D99204)

3 years ago[mlir][NFC] Replace `getMemorySpaceAsInt` with `getMemorySpace` where possible
Vladislav Vinogradov [Tue, 23 Mar 2021 08:45:24 +0000 (11:45 +0300)]
[mlir][NFC] Replace `getMemorySpaceAsInt` with `getMemorySpace` where possible

Use new `MemRefType::getMemorySpace` method with generic Attribute
in cases, where there is no specific logic around the memory space.

Reviewed By: rriddle

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

3 years ago[NFC] Improve debug message and test description in 4c1f74a
Ta-Wei Tu [Wed, 24 Mar 2021 10:21:13 +0000 (18:21 +0800)]
[NFC] Improve debug message and test description in 4c1f74a

3 years ago[LoopFlatten] Fix invalid assertion (PR49571)
Ta-Wei Tu [Wed, 24 Mar 2021 10:07:34 +0000 (18:07 +0800)]
[LoopFlatten] Fix invalid assertion (PR49571)

The `InductionPHI` is not necessarily the increment instruction, as
demonstrated in pr49571.ll.
This patch removes the assertion and instead bails out from the
`LoopFlatten` pass if that happens.

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

Reviewed By: SjoerdMeijer

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

3 years ago[NFC] Remove redundant `struct` prefix
Ta-Wei Tu [Wed, 24 Mar 2021 09:58:12 +0000 (17:58 +0800)]
[NFC] Remove redundant `struct` prefix

Reviewed By: SjoerdMeijer, fhahn

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

3 years ago[libcxx] [test] Add return values after assert(false) in some experimental tests
Martin Storsjö [Tue, 23 Mar 2021 16:42:32 +0000 (18:42 +0200)]
[libcxx] [test] Add return values after assert(false) in some experimental tests

When building in MSVC mode (in release mode), the assert(false) don't
make the end of the function unreachable, so add return statements to
silence compiler warnings (treated as errors).

Also change 'virtual' into 'override', which was requested in review,
as these files require C++11.

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

3 years ago[lldb] Add llgs_test decorator back to TestAutoInstallMainExecutable
Raphael Isemann [Wed, 24 Mar 2021 09:35:58 +0000 (10:35 +0100)]
[lldb] Add llgs_test decorator back to TestAutoInstallMainExecutable

This got removed in 68bb51acd572735d80d20adb2c2fc51a5cbbd88e and this enabled
the test on macOS (where it just causes lldb-server to crash). Re-adding the
decorator to get the tests passing again.

3 years agoHandle a LC_NOTE main bin spec for user process corefiles
Jason Molenda [Wed, 24 Mar 2021 09:18:17 +0000 (02:18 -0700)]
Handle a LC_NOTE main bin spec for user process corefiles

I was playing around with main bin spec LC_NOTEs and noticed
a small oversight in the parsing of user process corefile notes.

3 years ago[XCore][Test] XFAIL tests requiring 8-byte stack alignment.
Nigel Perks [Fri, 12 Feb 2021 13:02:35 +0000 (13:02 +0000)]
[XCore][Test] XFAIL tests requiring 8-byte stack alignment.

XCore default subtarget does not support 8-byte stack alignment. These failures
can be seen on builder clang-xcore-ubuntu-20-x64 on staging buildbot.

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

3 years ago[AArch64][ASAN] Re-enable fgets_fputs.cpp test.
Yvan Roux [Wed, 24 Mar 2021 09:06:04 +0000 (10:06 +0100)]
[AArch64][ASAN] Re-enable fgets_fputs.cpp test.

Now that AArch64 mapping symbols are correctly handled by
llvm-symbolizer this test can be re-enabled on that target.

3 years ago[WebAssembly][MC] Record limit constraints for table sizes
Andy Wingo [Tue, 23 Mar 2021 15:13:54 +0000 (16:13 +0100)]
[WebAssembly][MC] Record limit constraints for table sizes

This commit adds a full WasmTableType to MCSymbolWasm, differing from
the current situation (just an ElemType) in that it additionally records
a WasmLimits.

We add support for specifying the limits in .S files also, via the
following syntax variations:

  .tabletype SYM, ELEMTYPE
  .tabletype SYM, ELEMTYPE, MINSIZE
  .tabletype SYM, ELEMTYPE, MINSIZE, MAXSIZE

Depends on D99186.

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

3 years agoAdd a mechanism for Dialects to provide a fallback for OpInterface
Mehdi Amini [Wed, 24 Mar 2021 08:25:25 +0000 (08:25 +0000)]
Add a mechanism for Dialects to provide a fallback for OpInterface

This mechanism makes it possible for a dialect to not register all
operations but still answer interface-based queries.
This can useful for dialects that are "open" or connected to an external
system and still interoperate with the compiler. It can also open up the
possibility to have a more extensible compiler at runtime: the compiler
does not need a pre-registration for each operation and the dialect can
inject behavior dynamically.

Reviewed By: rriddle, jpienaar

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

3 years ago[clang][ASTImporter] Add import of DeducedTemplateSpecializationType.
Balázs Kéri [Wed, 24 Mar 2021 07:42:29 +0000 (08:42 +0100)]
[clang][ASTImporter] Add import of DeducedTemplateSpecializationType.

Reviewed By: shafik

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

3 years ago[WebAssembly] Rename WasmLimits::Initial to ::Minimum. NFC.
Andy Wingo [Tue, 23 Mar 2021 13:46:32 +0000 (14:46 +0100)]
[WebAssembly] Rename WasmLimits::Initial to ::Minimum.  NFC.

This patch renames the "Initial" member of WasmLimits to the name used
in the spec, "Minimum".

In the core WebAssembly specification, the Limits data type has one
required "min" member and one optional "max" member, indicating the
minimum required size of the corresponding table or memory, and the
maximum size, if any.

Although the WebAssembly spec does instantiate locally-defined tables
and memories with the initial size being equal to the minimum size, it
can't impose such a requirement for imports.  It doesn't make sense to
require an initial size for a memory import, for example.  The compiler
can only sensibly express the minimum and maximum sizes.

See
https://github.com/WebAssembly/js-types/blob/master/proposals/js-types/Overview.md#naming-of-size-limits
for a related discussion that agrees that the right name of "initial" is
"minimum" when querying the type of a table or memory from JavaScript.
(Of course it still makes sense for JS to speak in terms of an initial
size when it explicitly instantiates memories and tables.)

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

3 years ago[Driver] Bring back i586-linxu-gnu
Fangrui Song [Wed, 24 Mar 2021 06:37:43 +0000 (23:37 -0700)]
[Driver] Bring back i586-linxu-gnu

This is used by Fuchsia for a Debian jessie based sysroot.

3 years agoUpdate SafeMachO.h to #undefine more names
Jason Molenda [Wed, 24 Mar 2021 06:34:22 +0000 (23:34 -0700)]
Update SafeMachO.h to #undefine more names

Depending on include order, these can cause build errors when
including the llvm MachO.h where these are defined as enums.
Update the list to include some more names.

3 years ago[RISCV] Add HasStdExtD predicate to copysign from double and to double patterns
Jim Lin [Wed, 24 Mar 2021 06:29:23 +0000 (14:29 +0800)]
[RISCV] Add HasStdExtD predicate to copysign from double and to double patterns

Copysign from double and to double patterns have lack of HasStdExtD predicate.

Reviewed By: craig.topper

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

3 years ago* Fix demangling of optional template-args for vendor extended type qualifier.
Alex Orlov [Wed, 24 Mar 2021 06:21:32 +0000 (10:21 +0400)]
* Fix demangling of optional template-args for vendor extended type qualifier.

This fixes https://bugs.llvm.org/show_bug.cgi?id=48009 bug.

Reviewed By: erik.pilkington, krisb

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

3 years ago[Driver] Gnu.cpp: remove unneeded getMultiarchTriple normalization
Fangrui Song [Wed, 24 Mar 2021 06:12:18 +0000 (23:12 -0700)]
[Driver] Gnu.cpp: remove unneeded getMultiarchTriple normalization

3 years ago[Polly] Port DeadCodeElim to the NewPM.
Michael Kruse [Wed, 24 Mar 2021 05:54:37 +0000 (00:54 -0500)]
[Polly] Port DeadCodeElim to the NewPM.

3 years ago[NFC] [Support] Fix unconsistent comment with codes for ExtendSigned
Chuanqi Xu [Wed, 24 Mar 2021 05:58:54 +0000 (13:58 +0800)]
[NFC] [Support] Fix unconsistent comment with codes for ExtendSigned

3 years ago[PowerPC] Make altivec.h work with AIX which has no __int128
Nemanja Ivanovic [Wed, 24 Mar 2021 05:25:03 +0000 (00:25 -0500)]
[PowerPC] Make altivec.h work with AIX which has no __int128

There are a number of functions in altivec.h that use
vector __int128 which isn't supported on AIX. Those functions
need to be guarded for targets that don't support the type.
Furthermore, the functions that produce quadword instructions
without using the type need a builtin. This patch adds the
macro guards to altivec.h using the __SIZEOF_INT128__ which
is only defined on targets that support the __int128 type.

3 years ago[NFC] Fix comment describing what EdgeBundles is
Max Kazantsev [Wed, 24 Mar 2021 04:03:21 +0000 (11:03 +0700)]
[NFC] Fix comment describing what EdgeBundles is

The original comment says the same thing twice, and does not mention that
edges entering the block are also in the same bundle (which seems true from
what the underlying code is doing).

Differential Revision: https://reviews.llvm.org/D99144
Reviewed By: RKSimon

3 years ago[RegAlloc] Fix "ran out of regs" with uses in statepoint
Serguei Katkov [Wed, 24 Mar 2021 03:19:52 +0000 (10:19 +0700)]
[RegAlloc] Fix "ran out of regs" with uses in statepoint

Statepoint instruction is known to have a variable and big number of operands.
It is possible that Register Allocator will split live intervals in the way that all
physical registers are occupied by "zero-length" live intervals which are marked
as not-spillable.
While intervals are marked as not-spillable in the moment of creation when they are
really zero-length it is possible that in future as part of re-materialization there will
need for physical register between def and use of such tiny interval (the use is not
related to this interval at all).
As all physical registers are assigned to not-spillable intervals there is not avaialbe
registers and RA reports an error.

The idea of the fix is avoid marking tiny live intervals where there is a use in statepoint
instruction in var args section. Such interval may be perfectly spilled and folded to
operand of statepoint.

Reviewers: reames, dantrushin, qcolombet, dsanders, dmgreen
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D98766

3 years ago[X86] Bale out of X86FastISel::X86SelectCmp for vectors.
Craig Topper [Wed, 24 Mar 2021 02:34:39 +0000 (19:34 -0700)]
[X86] Bale out of X86FastISel::X86SelectCmp for vectors.

None of the code in this function was written to handle
vectors.  Most of the cases already fail for vectors for one
reason or another. The exception is an optimization that
detects identical operands. This can be triggered by vectors,
but the code always creates a 0 or 1 constants in a scalar
register which is incorrect for vectors.

Fixes PR49706.

3 years agoRevert "[Driver] Bring back "Clean up Debian multiarch /usr/include/<triplet> madness...
Zequan Wu [Wed, 24 Mar 2021 03:12:09 +0000 (20:12 -0700)]
Revert "[Driver] Bring back "Clean up Debian multiarch /usr/include/<triplet> madness" and restore i586-linux-gnu"

This breaks bots in chromium goma building.

This reverts commit 424bf5d8918f6356f1b8e99205c5fc8b4783ca22.

3 years ago[RISCV][Clang] Add RVV Vector Indexed Load intrinsic functions.
Zakk Chen [Thu, 18 Mar 2021 03:25:32 +0000 (20:25 -0700)]
[RISCV][Clang] Add RVV Vector Indexed Load intrinsic functions.

Support Complex type transformer to define more complexity legal type.

Overall our downstream implementation there are only four instructions need to
use complex type transformer, it's not a common case.
I still feel using a string for prototypes is simple and clear.

Reviewed By: craig.topper

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

3 years ago[NFC] Clang-format includes
Vitaly Buka [Wed, 24 Mar 2021 02:11:11 +0000 (19:11 -0700)]
[NFC] Clang-format includes

3 years ago[InstSimplify] Fix unused variable warning (NFC)
Yang Fan [Wed, 24 Mar 2021 01:56:36 +0000 (09:56 +0800)]
[InstSimplify] Fix unused variable warning (NFC)

GCC warning:
```
/llvm-project/llvm/lib/Analysis/InstructionSimplify.cpp: In function ‘llvm::Value* SimplifyWithOpReplaced(llvm::Value*, llvm::Value*, llvm::Value*, const llvm::SimplifyQuery&, bool, unsigned int)’:
/llvm-project/llvm/lib/Analysis/InstructionSimplify.cpp:3993:15: warning: unused variable ‘SI’ [-Wunused-variable]
 3993 |     if (auto *SI = dyn_cast<SelectInst>(I))
      |               ^~
```

3 years ago[OpenMP] Misc. changes that add or remove pointer/bound checks
Hansang Bae [Thu, 11 Mar 2021 23:34:06 +0000 (17:34 -0600)]
[OpenMP] Misc. changes that add or remove pointer/bound checks

-- Added or moved checks to appropriate places.
-- Removed ineffective null check where the pointer is already being
   dereferenced around the code.
-- Initialized variables that can be used without definitions.
-- Added call to dlclose/FreeLibrary in OMPT tool activation.
-- Added a new build compiler definition.

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

3 years agoSupport #__private_macro and #__public_macro in local submodule
Richard Smith [Tue, 23 Mar 2021 23:41:05 +0000 (16:41 -0700)]
Support #__private_macro and #__public_macro in local submodule
visibility mode.

3 years agoImprove const-correctness. NFC.
Richard Smith [Tue, 23 Mar 2021 22:45:40 +0000 (15:45 -0700)]
Improve const-correctness. NFC.

3 years ago[CGAtomic] Lift stronger requirements on cmpxch and support acquire failure mode
Bruno Cardoso Lopes [Tue, 23 Mar 2021 23:13:29 +0000 (16:13 -0700)]
[CGAtomic] Lift stronger requirements on cmpxch and support acquire failure mode

- Fix `emitAtomicCmpXchgFailureSet` to support release/acquire (succ/fail) memory order.
- Remove stronger checks for cmpxch.

Effectively, this addresses http://wg21.link/p0418

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

3 years ago[Coverage] Load records immediately
Choongwoo Han [Tue, 23 Mar 2021 22:59:45 +0000 (15:59 -0700)]
[Coverage] Load records immediately

The current implementation keeps buffers generated for each object file
until it completes loading of all files. This approach requires a lot of memory
if there are a lot of huge object files. Thus, make it to load coverage records
immediately rather than waiting for other binaries to be loaded.

This reduces memory usage of llvm-cov from >128GB to 5GB when
loading Chromium binaries in Windows.

Additional testing: check-profile, check-llvm

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

3 years ago[lld] Fix test to work with and without a vendor string
Shoaib Meenai [Tue, 23 Mar 2021 23:16:02 +0000 (16:16 -0700)]
[lld] Fix test to work with and without a vendor string

3 years ago[AArch64][GlobalISel] Add test for G_FSHR legalization.
Amara Emerson [Tue, 23 Mar 2021 23:11:45 +0000 (16:11 -0700)]
[AArch64][GlobalISel] Add test for G_FSHR legalization.

3 years ago[AArch64][GlobalISel] Lower G_FSHL and G_FSHR.
Amara Emerson [Tue, 23 Mar 2021 22:56:03 +0000 (15:56 -0700)]
[AArch64][GlobalISel] Lower G_FSHL and G_FSHR.

Codegen isn't as good as we need it, but that'll be done later.

3 years ago[mlir][tosa] Add tosa.argmax to linalg lowering
Rob Suderman [Tue, 23 Mar 2021 01:22:30 +0000 (18:22 -0700)]
[mlir][tosa] Add tosa.argmax to linalg lowering

Tosa's argmax lowering is representable as a linalg.indexed_generic
operation. Include the lowering to this type for both integer and
floating point types.

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

3 years ago[ValueTracking] Handle increasing mul recurrence in isKnownNonZero()
Jingu Kang [Mon, 22 Mar 2021 10:12:39 +0000 (10:12 +0000)]
[ValueTracking] Handle increasing mul recurrence in isKnownNonZero()

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

3 years ago[Sanitizer] Remove refactoring leftover [NFC]
Julian Lettner [Tue, 23 Mar 2021 22:09:13 +0000 (15:09 -0700)]
[Sanitizer] Remove refactoring leftover [NFC]

3 years agoAdd register size info back to MCRegisterClass
Rafael Auler [Wed, 3 Mar 2021 22:31:57 +0000 (14:31 -0800)]
Add register size info back to MCRegisterClass

This patch addresses the removal of register size information done in
commit c8b782c.

Without this change, there is no viable option to get register size
information outside libTarget. We need this information to run
analysis that know the register size from the MC layer, used by
BOLT.

Discussion D50285 and D47199.

Reviewed By: kparzysz

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

3 years ago[lld-macho] Fixed lld-version expectation in test so it works on Fuchsia.
Vy Nguyen [Tue, 23 Mar 2021 21:51:52 +0000 (17:51 -0400)]
[lld-macho] Fixed lld-version expectation in test so it works on Fuchsia.

On Fuchsia, it's called Fuchsia LLD

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

3 years ago[MSSA] Extending IsGuaranteedLoopInvariant to support an instruction defined in the...
Matteo Favaro [Tue, 23 Mar 2021 21:31:25 +0000 (21:31 +0000)]
[MSSA] Extending IsGuaranteedLoopInvariant to support an instruction defined in the entry block

As mentioned in [[ https://reviews.llvm.org/D96979 | D96979 ]], I'm extending the **IsGuaranteedLoopInvariant** check also to the `MemorySSA.cpp` file.

@fhahn For now I didn't unify the function into `MemorySSA.h` because, as you mentioned, it's not directly MSSA related. I'm open to suggestions to find a better place so we can improve the unification process.

Reviewed By: fhahn

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

3 years ago[NFC][LLDB] Removing extra semicolons to silence -Wc++98-compat-extra-semi diagnostics
Shafik Yaghmour [Tue, 23 Mar 2021 21:31:40 +0000 (14:31 -0700)]
[NFC][LLDB] Removing extra semicolons to silence -Wc++98-compat-extra-semi diagnostics

3 years ago[Analysis]Add getPointersDiff function to improve compile time.
Alexey Bataev [Tue, 23 Mar 2021 20:22:58 +0000 (13:22 -0700)]
[Analysis]Add getPointersDiff function to improve compile time.

Added getPointersDiff function to LoopAccessAnalysis and used it instead
direct calculatoin of the distance between pointers and/or
isConsecutiveAccess function in SLP vectorizer to improve compile time
and detection of stores consecutive chains.

Part of D57059

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

3 years ago[mlir][tosa] Add tosa.pad to linalg.pad operation
Rob Suderman [Fri, 19 Mar 2021 23:04:50 +0000 (16:04 -0700)]
[mlir][tosa] Add tosa.pad to linalg.pad operation

Lowers from tosa's pad op to the linalg equivalent for floating,
integer, and quantized values.

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

3 years agoRevert "[lld-macho][nfc] minor clean up, follow up to D98559"
Vy Nguyen [Tue, 23 Mar 2021 21:14:27 +0000 (17:14 -0400)]
Revert "[lld-macho][nfc] minor clean up, follow up to D98559"

This reverts commit 1bc33eb6a32bdb193a8b838df823b4563450f6b3.
tests failed on windows

3 years ago[mlir][Pattern] Add better support for using interfaces/traits to match root operatio...
River Riddle [Tue, 23 Mar 2021 20:44:14 +0000 (13:44 -0700)]
[mlir][Pattern] Add better support for using interfaces/traits to match root operations in rewrite patterns

To match an interface or trait, users currently have to use the `MatchAny` tag. This tag can be quite problematic for compile time for things like the canonicalizer, as the `MatchAny` patterns may get applied to  *every* operation. This revision adds better support by bucketing interface/trait patterns based on which registered operations have them registered. This means that moving forward we will only attempt to match these patterns to operations that have this interface registered. Two simplify defining patterns that match traits and interfaces, two new utility classes have been added: OpTraitRewritePattern and OpInterfaceRewritePattern.

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

3 years ago[ODS] Implement a new 'hasCanonicalizeMethod' bit for cann patterns.
Chris Lattner [Tue, 23 Mar 2021 05:15:39 +0000 (22:15 -0700)]
[ODS] Implement a new 'hasCanonicalizeMethod' bit for cann patterns.

This provides a simplified way to implement 'matchAndRewrite' style
canonicalization patterns for ops that don't need the full power of
RewritePatterns.  Using this style, you can implement a static method
with a signature like:

```
LogicalResult AssertOp::canonicalize(AssertOp op, PatternRewriter &rewriter) {
  return success();
}
```

instead of dealing with defining RewritePattern subclasses.  This also
adopts this for a few canonicalization patterns in the std dialect to
show how it works.

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

3 years ago[test] Add --sysroot= to make gcc-toolchain.cpp stable
Fangrui Song [Tue, 23 Mar 2021 20:32:30 +0000 (13:32 -0700)]
[test] Add --sysroot= to make gcc-toolchain.cpp stable

3 years ago[HWASan] Refactor in preparation for x86 aliasing mode. NFC
Matt Morehouse [Tue, 23 Mar 2021 18:57:12 +0000 (11:57 -0700)]
[HWASan] Refactor in preparation for x86 aliasing mode. NFC

Reviewed By: vitalybuka, eugenis

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