platform/upstream/llvm.git
3 years ago[flang][nfc] Fix variable names in `FrontendOptions` & `PreprocessorOptions`
Andrzej Warzynski [Thu, 29 Jul 2021 12:39:10 +0000 (12:39 +0000)]
[flang][nfc] Fix variable names in `FrontendOptions` & `PreprocessorOptions`

As all member variables in `FrontendOptions` and `PreprocessorOptions`
are public, we should be naming them as `variable` rather than
`variable_` [1]. This patch fixes that.

Also, `FrontendOptions` & `PreprocessorOptions` are re-defined as a
structs rather than classes (all fields are meant to be public).

[1]
https://github.com/llvm/llvm-project/blob/main/flang/docs/C%2B%2Bstyle.md#naming

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

3 years ago[ARM] Revert WLSTP to DLSTP if the target block is out of range
David Green [Mon, 2 Aug 2021 09:59:52 +0000 (10:59 +0100)]
[ARM] Revert WLSTP to DLSTP if the target block is out of range

If the block target for a WLSTP instruction is known to be out of range,
and cannot be fixed by the ARMBlockPlacementPass, we can relax it to a
DLSTP (and cmp/branch) to still allow the creation of tail predicated
loops. That is what this patch does, adding extra revert code to the
fallback path of ARMBlockPlacementPass.

Due to the code produced when reverting, this creates a DLSTP between a
Bcc and a Br. As a DLS isn't necessarily a terminator we need to split
the block to move the DLS/Br into.

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

3 years ago[OpenMPIRBuilder] Add a constructor to ReductionInfo to appease gcc5
Alex Zinenko [Mon, 2 Aug 2021 09:47:29 +0000 (11:47 +0200)]
[OpenMPIRBuilder] Add a constructor to ReductionInfo to appease gcc5

Otherwise, it produces wrong code for brace initializers.

3 years ago[AArch64][AsmParser] NFC: Parser.Lex() -> Lex()
Cullen Rhodes [Mon, 2 Aug 2021 08:30:55 +0000 (08:30 +0000)]
[AArch64][AsmParser] NFC: Parser.Lex() -> Lex()

Reviewed By: tmatheson

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

3 years ago[clang-tidy] Always open files using UTF-8 encoding
Andy Yankovsky [Mon, 26 Jul 2021 14:36:51 +0000 (16:36 +0200)]
[clang-tidy] Always open files using UTF-8 encoding

The encoding used for opening files depends on the OS and might be different
from UTF-8 (e.g. on Windows it can be CP-1252). The documentation files use
UTF-8 and might be incompatible with other encodings. For example, right now
`clang-tools-extra/docs/clang-tidy/checks/abseil-no-internal-dependencies.rst`
has non-ASCII quotes and running `add_new_check.py` fails on Windows, because
it tries to read the file with incompatible encoding.

Use `io.open` for compatibility with both Python 2 and Python 3.

Reviewed By: kbobyrev

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

3 years agotsan: minor IgnoreSet refactoring
Dmitry Vyukov [Sat, 31 Jul 2021 07:51:57 +0000 (09:51 +0200)]
tsan: minor IgnoreSet refactoring

1. Move kMaxSize declaration to private section.
2. Inline Reset, it's trivial and called semi-frequently.

Reviewed By: melver

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

3 years agotsan: inline ProcessPendingSignals check
Dmitry Vyukov [Sat, 31 Jul 2021 09:43:32 +0000 (11:43 +0200)]
tsan: inline ProcessPendingSignals check

ProcessPendingSignals is called in all interceptors
and user atomic operations. Make the fast-path check
(no pending signals) inlinable.

Reviewed By: melver

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

3 years ago[mlir][linalg] Fix comments around ConstraintsSet
Matthias Springer [Mon, 2 Aug 2021 08:52:48 +0000 (17:52 +0900)]
[mlir][linalg] Fix comments around ConstraintsSet

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

3 years agoRevert "[libcxx][CI] Work around Arm buildkite failures"
David Spickett [Fri, 30 Jul 2021 15:36:33 +0000 (16:36 +0100)]
Revert "[libcxx][CI] Work around Arm buildkite failures"

This reverts commit f8bef4734845226c079900de3c273c8ab1915b49.

Buildkite agent 3.32.0 includes a fix for the PATH issue.
https://github.com/buildkite/agent/releases/tag/v3.32.0

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

3 years ago[mlir] Remove invalid DeallocOpLowering pattern insertion
Butygin [Wed, 28 Jul 2021 19:31:26 +0000 (22:31 +0300)]
[mlir] Remove invalid DeallocOpLowering pattern insertion

It is inserted later under then condition.

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

3 years ago[ARM] Add trackLiveness to block-placement.mir. NFC
David Green [Mon, 2 Aug 2021 08:03:22 +0000 (09:03 +0100)]
[ARM] Add trackLiveness to block-placement.mir. NFC

Also move the test to mve-wls-block-placement.mir, to better fit what it
tests.

3 years ago[GC][NFC] Make getGCStrategy by name available in IR
Max Kazantsev [Mon, 2 Aug 2021 05:00:56 +0000 (12:00 +0700)]
[GC][NFC] Make getGCStrategy by name available in IR

We might want to use info from GC strategy in middle end analysis.
The motivation for this is provided in D99135: we may want to ask
a GC if it's going to work with a given pointer (currently this code
makes naive check by the method name).

Differetial Revision: https://reviews.llvm.org/D100559
Reviewed By: reames

3 years ago[clangd] Fix the crash in getQualification
Kirill Bobyrev [Mon, 2 Aug 2021 07:08:09 +0000 (09:08 +0200)]
[clangd] Fix the crash in getQualification

Happens when DestContext is LinkageSpecDecl and hense CurContext happens to be
both not TagDecl and NamespaceDecl.

Minimal reproducer: trigger define outline in

```
namespace ns {
extern "C" {
typedef int foo;
}
foo Fo^o(int id) { return id; }
}
```

Reviewed By: kadircet

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

3 years ago[docs]Update meeeting frequency to match new cal entry
Alina Sbirlea [Mon, 2 Aug 2021 06:48:25 +0000 (23:48 -0700)]
[docs]Update meeeting frequency to match new cal entry

3 years ago[examples] Fix incomplete_type on ZLinux when compiling RemoteJITUtils.
Lang Hames [Mon, 2 Aug 2021 05:15:15 +0000 (15:15 +1000)]
[examples] Fix incomplete_type on ZLinux when compiling RemoteJITUtils.

When compiling on ZLinux, we got this error:

/llvm-project/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/ \
RemoteJITUtils.h:80:65:   required from here...
/usr/include/c++/7/bits/unique_ptr.h:76:22: error: invalid application of
'sizeof' to incomplete type 'llvm::orc::RemoteExecutorProcessControl'
  static_assert(sizeof(_Tp)>0,

This patch just removes nullptr from the initialization of
std::unique_ptr<RemoteExecutorProcessControl> to avoid the issue.

Patch by Tung D. Le (tung@jp.ibm.com). Thanks Tung!

Reviewed By: lhames

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

3 years ago[AMDGPU][GlobalISel] Add missing default mapping for BVH intrinsics
Carl Ritson [Mon, 2 Aug 2021 02:46:09 +0000 (11:46 +0900)]
[AMDGPU][GlobalISel] Add missing default mapping for BVH intrinsics

Application of default mapping to BVH intrinsics was missing.
Copy parts of SelectionDAG test to GlobalISel test as these would
have indicated this error.

Reviewed By: arsenm

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

3 years ago[X86] Support auto-detect for tigerlake and alderlake
Freddy Ye [Mon, 2 Aug 2021 00:56:36 +0000 (08:56 +0800)]
[X86] Support auto-detect for tigerlake and alderlake

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

3 years ago[LLDB] Change pexpect timeout to 30 to 60
Muhammad Omair Javaid [Mon, 2 Aug 2021 01:31:52 +0000 (06:31 +0500)]
[LLDB] Change pexpect timeout to 30 to 60

Test dependent on pexpect fail randomly with timeouts on Arm/AArch64 Linux
buildbots. I am setting pexpect timeout from 30 to 60.

I will revert this back if this doesnt improve random failures.

3 years agoRevert "Revert "[LLDB][GUI] Expand selected thread tree item by default""
Muhammad Omair Javaid [Mon, 2 Aug 2021 00:15:59 +0000 (05:15 +0500)]
Revert "Revert "[LLDB][GUI] Expand selected thread tree item by default""

This reverts commit fd18f0e84cca023df6cb19e88c07c0e2059f659b.

I reverted this change to see its effect on failing GUI tests on LLDB
Arm/AArch64 Linux buildbots. I could not find any evidence against this
particular change so reverting it back.

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

3 years ago[LLDB] Skip random failing tests on Arm/AArch64 Linux bots
Muhammad Omair Javaid [Mon, 2 Aug 2021 00:20:19 +0000 (05:20 +0500)]
[LLDB] Skip random failing tests on Arm/AArch64 Linux bots

Following tests have been failing randomly on LLDB Arm and AArch64 Linux
builtbots:

TestMultilineNavigation.py
TestMultilineCompletion.py
TestIOHandlerCompletion.py
TestGuiBasic.py

I have increased allocated CPU resources to these bots but it has not
improved situation to an acceptable level. This patch marks them as
skipped on Arm/AArch64 for now.

3 years ago[Preprocessor] Ensure newline after #pragma introduced by -fms-extensions.
Michael Kruse [Sun, 1 Aug 2021 23:50:40 +0000 (18:50 -0500)]
[Preprocessor] Ensure newline after #pragma introduced by -fms-extensions.

The -fms-extensions converts __pragma (and _Pragma) into a #pragma that
has to occur at the beginning of a line and end with a newline. This
patch ensures that the newline after the #pragma is added even if
Token::isAtStartOfLine() indicated that we should not start a newline.

Committing relying post-commit review since the change is small, some
downstream uses might be blocked without this fix, and to make clear the
decision of the new -fminimize-whitespace feature (fix on main, revert
on clang-13.x branch) suggested by @aaron.ballman in D104601.

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

3 years ago[clang-tidy] Add new case type to check variables with Hungarian notation
Douglas Chen [Sun, 1 Aug 2021 22:20:12 +0000 (15:20 -0700)]
[clang-tidy] Add new case type to check variables with Hungarian notation

Add IdentifierNamingCheck::CaseType, CT_HungarianNotation, supporting
naming check with Hungarian notation.

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

3 years ago[LLD][MinGW] Accept joined format for --stack
Mateusz Mikuła [Sun, 1 Aug 2021 20:26:25 +0000 (23:26 +0300)]
[LLD][MinGW] Accept joined format for --stack

Postgresql uses `--stack=` in its Makefile.

Downstream issue: https://github.com/msys2/MINGW-packages/pull/9167

Reviewed By: mstorsjo

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

3 years ago[clang-repl] Fix building with win32 dylibs
Martin Storsjö [Sat, 31 Jul 2021 19:58:29 +0000 (22:58 +0300)]
[clang-repl] Fix building with win32 dylibs

Use `clang_target_link_libraries` to avoid duplicate libraries when
the same symbol is provided both by a static library and a larger
dylib, fixing linking with win32 dylibs. This fixes errors like
these:

    ld.lld: error: duplicate symbol: llvm::createStringError(std::__1::error_code, char const*)
    >>> defined at libLLVMSupport.a(Error.cpp.obj)
    >>> defined at libLLVM-14git.dll

This matches how other clang tools declare their dependencies.

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

3 years ago[lldb] Avoid moving ThreadPlanSP from plans vector
Dave Lee [Fri, 16 Jul 2021 18:04:27 +0000 (11:04 -0700)]
[lldb] Avoid moving ThreadPlanSP from plans vector

Change `ThreadPlanStack::PopPlan` and `::DiscardPlan` to not do the following:

1. Move the last plan, leaving a moved `ThreadPlanSP` in the plans vector
2. Operate on the last plan
3. Pop the last plan off the plans vector

This leaves a period of time where the last element in the plans vector has been moved. I am not sure what, if any, guarantees there are when doing this, but it seems like it would/could leave a null `ThreadPlanSP` in the container. There are asserts in place to prevent empty/null `ThreadPlanSP` instances from being pushed on to the stack, and so this could break that invariant during multithreaded access to the thread plan stack.

An open question is whether this use of `std::move` was the result of a measure performance problem.

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

3 years ago[InstCombine] Precommit tests for D106872 (NFC)
Krishna [Sun, 1 Aug 2021 13:22:37 +0000 (18:52 +0530)]
[InstCombine] Precommit tests for D106872 (NFC)

3 years ago[Analysis] Remove unused declaration isGEPBaseAtNegativeOffset (NFC)
Kazu Hirata [Sun, 1 Aug 2021 14:53:16 +0000 (07:53 -0700)]
[Analysis] Remove unused declaration isGEPBaseAtNegativeOffset (NFC)

The corresponding function definition was removed on Mar 3, 2021 in
commit ea7d208b780657c236986d7dfd7ba577583fd99a.

3 years ago[mlir] Change ABI breaking use of NDEBUG to LLVM_ENABLE_ABI_BREAKING_CHECKS
Markus Böck [Sun, 1 Aug 2021 12:01:20 +0000 (14:01 +0200)]
[mlir] Change ABI breaking use of NDEBUG to LLVM_ENABLE_ABI_BREAKING_CHECKS

The `DataLayout` class currently contains the member `layoutStack` which is hidden behind a preprocessor region dependant on the NDEBUG macro. Code wise this makes a lot of sense, as the `layoutStack` is used for extra assertions that users will want when compiling a debug build.
It however has the uncomfortable consequence of leading to a different ABI in Debug and Release builds. This I think is a bit annoying for downstream projects and others as they may want to build against a stable Release of MLIR in Release mode, but be able to debug their own project depending on MLIR.

This patch changes the related uses of NDEBUG to LLVM_ENABLE_ABI_BREAKING_CHECKS. As the macro is computed at configure time of LLVM, it may not change based on compiler settings of a downstream projects like NDEBUG would.

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

3 years ago[mlir] Add populateGpuToLLVMConversionPatterns function
Butygin [Wed, 28 Jul 2021 19:31:26 +0000 (22:31 +0300)]
[mlir] Add populateGpuToLLVMConversionPatterns function

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

3 years ago[docs] Update outdated doxygen download link
Tommy Chiang [Sun, 1 Aug 2021 08:50:00 +0000 (16:50 +0800)]
[docs] Update outdated doxygen download link

3 years ago[ELF][test] Improve .symver & --version-script tests
Fangrui Song [Sun, 1 Aug 2021 01:57:19 +0000 (18:57 -0700)]
[ELF][test] Improve .symver & --version-script tests

And delete redundant tests.

3 years ago[RISCV] Add some tests for SimplifyCFG's switch to lookup table transform
Craig Topper [Sat, 31 Jul 2021 22:44:39 +0000 (15:44 -0700)]
[RISCV] Add some tests for SimplifyCFG's switch to lookup table transform

These are some of the basic cases taken from X86.

We currently fail to use lookup tables on many of these cases
because SimplifyCFG requires a legal type to do the transform and
RISCV only has one legal integer type.

3 years ago[GlobalOpt] support ConstantExpr use of global address for OptimizeGlobalAddressOfMalloc
Shimin Cui [Sat, 31 Jul 2021 22:42:02 +0000 (18:42 -0400)]
[GlobalOpt] support ConstantExpr use of global address for OptimizeGlobalAddressOfMalloc

I'm working on extending the OptimizeGlobalAddressOfMalloc to handle some more general cases. This is to add support of the ConstantExpr use of the global variables. The function allUsesOfLoadedValueWillTrapIfNull is now iterative with the added CE use of GV. Also, the recursive function valueIsOnlyUsedLocallyOrStoredToOneGlobal is changed to iterative using a worklist with the GEP case added.

Reviewed By: efriedma

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

3 years ago[nfc] [lldb] Removed unused DWARFDebugInfo::GetDIEForDIEOffset
Jan Kratochvil [Sat, 31 Jul 2021 22:37:10 +0000 (00:37 +0200)]
[nfc] [lldb] Removed unused DWARFDebugInfo::GetDIEForDIEOffset

Its last use was removed by D63428.

3 years ago[RISCV][Docs] Add description about inline asm constraint for V.
Hsiangkai Wang [Fri, 23 Jul 2021 03:26:58 +0000 (11:26 +0800)]
[RISCV][Docs] Add description about inline asm constraint for V.

Add inline asm constraint 'vr' for vector registers and 'vm' for vector
mask registers.

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

3 years ago[RISCV] Rename vector inline constraint from 'v' to 'vr' and 'vm' in IR.
Hsiangkai Wang [Fri, 30 Jul 2021 09:10:30 +0000 (17:10 +0800)]
[RISCV] Rename vector inline constraint from 'v' to 'vr' and 'vm' in IR.

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

3 years agoFix the default alignment of i1 vectors.
Eli Friedman [Sat, 31 Jul 2021 21:09:59 +0000 (14:09 -0700)]
Fix the default alignment of i1 vectors.

Currently, the default alignment is much larger than the actual size of
the vector in memory.  Fix this to use a sane default.

For SVE, temporarily remove lowering of load/store operations for
predicates with less than 16 elements. The layout the backend was
assuming for SVE predicates with less than 16 elements doesn't agree
with the frontend. More work probably needs to be done here.

This change is, strictly speaking, not backwards-compatible at the
bitcode level. But probably nobody is actually depending on that; i1
vectors in memory are rare, and the code that does use them probably
ends up forcing the alignment to something sane anyway.  If we think
this is a concern, I can restrict this to scalable vectors for now
(where it's actually causing issues for me at the moment).

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

3 years agoFix a couple regression tests I missed updating in 2a284782
Eli Friedman [Sat, 31 Jul 2021 20:41:15 +0000 (13:41 -0700)]
Fix a couple regression tests I missed updating in 2a284782

3 years ago[ConstantFold] Get rid of special cases for sizeof etc.
Eli Friedman [Sat, 31 Jul 2021 20:20:47 +0000 (13:20 -0700)]
[ConstantFold] Get rid of special cases for sizeof etc.

Target-dependent constant folding will fold these down to simple
constants (or at least, expressions that don't involve a GEP).  We don't
need heroics to try to optimize the form of the expression before that
happens.

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

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

3 years ago[mlir][sparse] add sparse tensor type conversion operation
Aart Bik [Sat, 31 Jul 2021 00:52:39 +0000 (17:52 -0700)]
[mlir][sparse] add sparse tensor type conversion operation

Introduces a conversion from one (sparse) tensor type to another
(sparse) tensor type. See the operation doc for details. Actual
codegen for all cases is still TBD.

Reviewed By: ThomasRaoux

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

3 years ago[Analysis] improve function signature checking for snprintf
Sanjay Patel [Sat, 31 Jul 2021 19:13:42 +0000 (15:13 -0400)]
[Analysis] improve function signature checking for snprintf

The check for size_t parameter 1 was already here for snprintf_chk,
but it wasn't applied to regular snprintf. This could lead to
mismatching and eventually crashing as shown in:
https://llvm.org/PR50885

3 years ago[RISCV] Rename RISCVISD::FCVT_W_RV64 to FCVT_W_RTZ_RV64. NFC
Craig Topper [Sat, 31 Jul 2021 18:05:55 +0000 (11:05 -0700)]
[RISCV] Rename RISCVISD::FCVT_W_RV64 to FCVT_W_RTZ_RV64. NFC

fcvt.w(u) supports multiple rounding modes, but the ISD node
doesn't encode that. So name it to match the rounding mode it uses.

3 years ago[SROA] prevent crash on large memset length (PR50910)
Sanjay Patel [Sat, 31 Jul 2021 18:07:30 +0000 (14:07 -0400)]
[SROA] prevent crash on large memset length (PR50910)

I don't know much about this pass, but we need a stronger
check on the memset length arg to avoid an assert. The
current code was added with D59000.
The test is reduced from:
https://llvm.org/PR50910

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

3 years ago[InstCombine] canonicalize cmp-of-bitcast-of-vector-cmp to use zero constant
Sanjay Patel [Sat, 31 Jul 2021 17:16:25 +0000 (13:16 -0400)]
[InstCombine] canonicalize cmp-of-bitcast-of-vector-cmp to use zero constant

We can invert a compare constant and preserve the logic
as shown in this sampling:
https://alive2.llvm.org/ce/z/YAXbfs
(In theory, we could deal with non-all-ones/zero as well,
but it doesn't seem worthwhile.)

I noticed this as a part of the x86 codegen difference in
https://llvm.org/PR51259 - it ends up using "test"
instead of "not + cmp" in that example.

This pattern also shows up in https://llvm.org/PR41312
and https://llvm.org/PR50798 .

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

3 years ago[TTI] Make SK_ExtractSubvector matching length-changing only and simplify nested...
Simon Pilgrim [Sat, 31 Jul 2021 17:05:13 +0000 (18:05 +0100)]
[TTI] Make SK_ExtractSubvector matching length-changing only and simplify nested shuffle mask detection chain.

Match style and don't use an else after a return.

Minor cleanup for an upcoming SK_InsertSubvector patch.

3 years agoFixed syntax error that occured in the patch D104974
pooja2299 [Sat, 31 Jul 2021 07:50:43 +0000 (13:20 +0530)]
Fixed syntax error that occured in the patch D104974

3 years ago[ARM] Switch order of creating VADDV and VMLAV.
David Green [Sat, 31 Jul 2021 15:28:52 +0000 (16:28 +0100)]
[ARM] Switch order of creating VADDV and VMLAV.

It can be beneficial to attempt to try the larger VMLAV patterns before
VADDV, in case both may match the same code.

3 years ago[ARM] Regenerate Thumb PR35481.ll test. NFC
David Green [Sat, 31 Jul 2021 10:02:52 +0000 (11:02 +0100)]
[ARM] Regenerate Thumb PR35481.ll test. NFC

3 years ago[VPlan] Add interleave group printing test.
Florian Hahn [Sat, 31 Jul 2021 14:59:49 +0000 (15:59 +0100)]
[VPlan] Add interleave group printing test.

3 years agoGlobalISel: Scalarize unaligned vector stores
Matt Arsenault [Tue, 27 Jul 2021 15:08:06 +0000 (11:08 -0400)]
GlobalISel: Scalarize unaligned vector stores

This has the same problems and limitations as the load path.

3 years agoAMDGPU/GlobalISel: Check some remarks for failed legalizations
Matt Arsenault [Tue, 27 Jul 2021 21:47:31 +0000 (17:47 -0400)]
AMDGPU/GlobalISel: Check some remarks for failed legalizations

The load/store tests are giant and have some cases that fail in them,
but it's hard to tell which ones are really failing. Check the remarks
to make it easier to track.

3 years ago[ADT] Remove set_is_strict_subset (NFC)
Kazu Hirata [Sat, 31 Jul 2021 14:24:53 +0000 (07:24 -0700)]
[ADT] Remove set_is_strict_subset (NFC)

The last use was removed on Mar 13, 2020 in commit
6b57d7f57d2cec7ec717757a6a52f2203d6e9db7.

3 years ago[DAG] isGuaranteedNotToBeUndefOrPoison - handle ISD::BUILD_VECTOR nodes
Simon Pilgrim [Sat, 31 Jul 2021 14:08:13 +0000 (15:08 +0100)]
[DAG] isGuaranteedNotToBeUndefOrPoison - handle ISD::BUILD_VECTOR nodes

If all demanded elements of the BUILD_VECTOR pass a isGuaranteedNotToBeUndefOrPoison check, then we can treat this specific demanded use of the BUILD_VECTOR as guaranteed not to be undef or poison either.

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

3 years agoGlobalISel: Have lowerStore handle some unaligned stores
Matt Arsenault [Mon, 26 Jul 2021 23:41:48 +0000 (19:41 -0400)]
GlobalISel: Have lowerStore handle some unaligned stores

This is NFC until some of the AMDGPU legalization rules are ripped
out.

3 years ago[MLIR] NFC Clean up doc comments on memref replacement utility
Uday Bondhugula [Fri, 30 Jul 2021 09:47:43 +0000 (15:17 +0530)]
[MLIR] NFC Clean up doc comments on memref replacement utility

NFC. Clean up stale doc comments on memref replacement utility and some
variable renaming in it to avoid confusion.

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

3 years ago[AArch64] Legalize MVT::i64x8 in DAG isel lowering
Alexandros Lamprineas [Sat, 31 Jul 2021 07:59:19 +0000 (08:59 +0100)]
[AArch64] Legalize MVT::i64x8 in DAG isel lowering

This patch legalizes the Machine Value Type introduced in D94096 for loads
and stores. A new target hook named getAsmOperandValueType() is added which
maps i512 to MVT::i64x8. GlobalISel falls back to DAG for legalization.

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

3 years ago[AArch64] Add a Machine Value Type for 8 consecutive registers
Alexandros Lamprineas [Sat, 31 Jul 2021 07:46:20 +0000 (08:46 +0100)]
[AArch64] Add a Machine Value Type for 8 consecutive registers

Adds MVT::i64x8, a Machine Value Type needed for lowering inline assembly
operands which materialize a sequence of eight general purpose registers.

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

3 years ago[Clang][AArch64] Inline assembly support for the ACLE type 'data512_t'
Alexandros Lamprineas [Wed, 28 Jul 2021 15:40:59 +0000 (16:40 +0100)]
[Clang][AArch64] Inline assembly support for the ACLE type 'data512_t'

In LLVM IR terms the ACLE type 'data512_t' is essentially an aggregate
type { [8 x i64] }. When emitting code for inline assembly operands,
clang tries to scalarize aggregate types to an integer of the equivalent
length, otherwise it passes them by-reference. This patch adds a target
hook to tell whether a given inline assembly operand is scalarizable
so that clang can emit code to pass/return it by-value.

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

3 years ago[lldb] [DWARF-5] Be lazier about loading .dwo files
Eric Leese [Fri, 30 Jul 2021 11:08:00 +0000 (13:08 +0200)]
[lldb] [DWARF-5] Be lazier about loading .dwo files

This change makes sure that DwarfUnit does not load a .dwo file until
necessary. I also take advantage of DWARF 5's guarantee that the first
support file is also the primary file to make it possible to create
a compile unit without loading the .dwo file.

Testcases now require Linux as it is needed for -gsplit-dwarf.

Review By: jankratochvil, dblaikie

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

3 years ago[profile][test] Delete --path-equivalence=/tmp,%S
Fangrui Song [Sat, 31 Jul 2021 07:36:16 +0000 (00:36 -0700)]
[profile][test] Delete --path-equivalence=/tmp,%S

This causes the test to fail if %S is under /tmp

3 years agotsan: prevent insertion of memset into BenignRaceImpl
Dmitry Vyukov [Sat, 31 Jul 2021 07:09:01 +0000 (09:09 +0200)]
tsan: prevent insertion of memset into BenignRaceImpl

Some bots started failing with the following error
after changing Alloc to New. Change it back.

ThreadSanitizer: CHECK failed: ((locked[i].recursion)) == ((0))
 4 __sanitizer::CheckedMutex::CheckNoLocks()
 5 __tsan::ScopedInterceptor::~ScopedInterceptor()
 6 memset
 7 __tsan::New<__tsan::ExpectRace>()
 8 __tsan::AddExpectRace()
 9 BenignRaceImpl()

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

3 years agotsan: introduce Tid and StackID typedefs
Dmitry Vyukov [Fri, 30 Jul 2021 11:50:15 +0000 (13:50 +0200)]
tsan: introduce Tid and StackID typedefs

Currently we inconsistently use u32 and int for thread ids,
there are also "unique tid" and "os tid" and just lots of other
things identified by integers.
Additionally new tsan runtime will introduce yet another
thread identifier that is very different from current tids.
Similarly for stack IDs, it's easy to confuse u32 with other
integer identifiers. And when a function accepts u32 or a struct
contains u32 field, it's not always clear what it is.

Add Tid and StackID typedefs to make it clear what is what.

Reviewed By: melver

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

3 years agosanitizers: build tests with -g
Dmitry Vyukov [Fri, 30 Jul 2021 14:56:36 +0000 (16:56 +0200)]
sanitizers: build tests with -g

We currently build tests without -g, which is quite inconvenient.
Crash stacks don't have line numbers, gdb don't how line numbers either.
Always build tests with -g.

Reviewed By: vitalybuka

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

3 years agotsan: remove "expected" races
Dmitry Vyukov [Fri, 30 Jul 2021 16:05:47 +0000 (18:05 +0200)]
tsan: remove "expected" races

"Expected" races is a very ancient facility used in tsanv1 tests.
It's not used/needed anymore. Remove it.

Reviewed By: vitalybuka

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

3 years agotsan: always setup sigaction signal handler
Dmitry Vyukov [Fri, 30 Jul 2021 17:52:48 +0000 (19:52 +0200)]
tsan: always setup sigaction signal handler

Currently we setup either sigaction signal handler with 3 arguments
or old style signal handler with 1 argument depending on user handler type.
This unnecessarily complicates code. Always setup sigaction handler.

Reviewed By: vitalybuka

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

3 years ago[NFC][sanitizer] clang-format few files
Vitaly Buka [Sat, 31 Jul 2021 02:24:45 +0000 (19:24 -0700)]
[NFC][sanitizer] clang-format few files

3 years agoRevert "[clang][cache] Update Fuchsia-stage2.cmake to create hwasan multilibs"
Petr Hosek [Sat, 31 Jul 2021 01:56:51 +0000 (18:56 -0700)]
Revert "[clang][cache] Update Fuchsia-stage2.cmake to create hwasan multilibs"

This reverts commit bb438f6cbfc08eaa2cd9124a0ad581dd29f819b4 since
it broke our Windows builders and we need more time to investigate
the issue.

3 years ago[profile] Fix profile merging with binary IDs
Petr Hosek [Fri, 30 Jul 2021 09:40:27 +0000 (02:40 -0700)]
[profile] Fix profile merging with binary IDs

This fixes support for merging profiles which broke as a consequence
of e50a38840dc3db5813f74b1cd2e10e6d984d0e67. The issue was missing
adjustment in merge logic to account for the binary IDs which are
now included in the raw profile just after header.

In addition, this change also:
* Includes the version in module signature that's used for merging
to avoid accidental attempts to merge incompatible profiles.
* Moves the binary IDs size field after version field in the header
as was suggested in the review.

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

3 years agoRevert "[profile] Fix profile merging with binary IDs"
Petr Hosek [Sat, 31 Jul 2021 01:53:48 +0000 (18:53 -0700)]
Revert "[profile] Fix profile merging with binary IDs"

This reverts commit dcadd64986b8a84dc244d4e7faa848fb4c18cea6.

3 years agoRevert "[lldb] [DWARF-5] Be lazier about loading .dwo files"
Stella Stamenova [Sat, 31 Jul 2021 01:33:13 +0000 (18:33 -0700)]
Revert "[lldb] [DWARF-5] Be lazier about loading .dwo files"

This reverts commit 8dfd6cae9bd62ae5ef056b994ece2e98f1558830.

This change broke the windows lldb bot:
https://lab.llvm.org/buildbot/#/builders/83/builds/8842

3 years ago[libc] Add trigonometric and exponential functions to the windows config.
Siva Chandra Reddy [Sat, 31 Jul 2021 01:30:26 +0000 (01:30 +0000)]
[libc] Add trigonometric and exponential functions to the windows config.

3 years ago[sanitizer] Remove cpplint annotations
Vitaly Buka [Fri, 30 Jul 2021 22:24:59 +0000 (15:24 -0700)]
[sanitizer] Remove cpplint annotations

cpplint was removed by D107197

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

3 years ago[vscode-mlir] Fix the package repo url.
River Riddle [Sat, 31 Jul 2021 00:49:47 +0000 (00:49 +0000)]
[vscode-mlir] Fix the package repo url.

It should be llvm/vscode-mlir not llvm-project/vscode-mlir.

3 years ago[profile] Fix profile merging with binary IDs
Petr Hosek [Fri, 30 Jul 2021 09:40:27 +0000 (02:40 -0700)]
[profile] Fix profile merging with binary IDs

This fixes support for merging profiles which broke as a consequence
of e50a38840dc3db5813f74b1cd2e10e6d984d0e67. The issue was missing
adjustment in merge logic to account for the binary IDs which are
now included in the raw profile just after header.

In addition, this change also:
* Includes the version in module signature that's used for merging
to avoid accidental attempts to merge incompatible profiles.
* Moves the binary IDs size field after version field in the header
as was suggested in the review.

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

3 years ago[mlir-vscode] Create a proper output channel for the MLIRContext
River Riddle [Fri, 30 Jul 2021 23:53:01 +0000 (23:53 +0000)]
[mlir-vscode] Create a proper output channel for the MLIRContext

This allows for reusing the same output channel when the extension reloads after updating the server. Currently, whenever the extension restarts a new output channel is created (which can lead to a large number of seemingly dead output channels).

3 years ago[vscode-mlir] Update package.json in preparation for publishing
River Riddle [Fri, 30 Jul 2021 23:52:47 +0000 (23:52 +0000)]
[vscode-mlir] Update package.json in preparation for publishing

Quite a few things were out-of-date, or just not
organized well. This revision updates the extension
name, repo, icon, and many other components in
preperation for publishing the extension to the
marketplace.

3 years ago[libc] Move FPExceptMatcher out of TestHelpers.h
Siva Chandra Reddy [Fri, 30 Jul 2021 05:22:20 +0000 (05:22 +0000)]
[libc] Move FPExceptMatcher out of TestHelpers.h

TestHelpers.h pulls few pieces from LLVM libc's unittest framework
which aren't available on platforms like Fuchsia which use their own
unittest framework. So, by moving FPExceptMatcher to a different file
we can exclude LLVM libc specific pieces in a cleaner way.

In a later pass, it might make more sense to rename TestHelpers.h also
to FPMatcher.h. That way, we can make macros like EXPECT_FP_EQ to be
equivalent to EXPECT_EQ on platforms like Fuchsia.

Reviewed By: michaelrj

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

3 years ago[sanitizer] Remove cpplint
Vitaly Buka [Fri, 30 Jul 2021 21:53:09 +0000 (14:53 -0700)]
[sanitizer] Remove cpplint

As code diverge from Google style we need
to add more and more exceptions to suppress
conflicts with clang-format and clang-tidy.
As this point it does not provide a additional value.

Reviewed By: morehouse

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

3 years ago[flang] Produce proper "preprocessor output" for -E option
peter klausler [Fri, 23 Jul 2021 23:41:04 +0000 (16:41 -0700)]
[flang] Produce proper "preprocessor output" for -E option

Rename the current -E option to "-E -Xflang -fno-reformat".

Add a new Parsing::EmitPreprocessedSource() routine to convert the
cooked character stream output of the prescanner back to something
more closely resembling output from a traditional preprocessor;
call this new routine when -E appears.

The new -E output is suitable for use as fixed form Fortran source to
compilation by (one hopes) any Fortran compiler.  If the original
top-level source file had been free form source, the output will be
suitable for use as free form source as well; otherwise there may be
diagnostics about missing spaces if they were indeed absent in the
original fixed form source.

Unless the -P option appears, #line directives are interspersed
with the output (but be advised, f18 will ignore these if presented
with them in a later compilation).

An effort has been made to preserve original alphabetic character case
and source indentation.

Add -P and -fno-reformat to the new drivers.

Tweak test options to avoid confusion with prior -E output; use
-fno-reformat where needed, but prefer to keep -E, sometimes
in concert with -P, on most, updating expected results accordingly.

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

3 years ago[libcxx][docs] Take locks on the last three views.
zoecarver [Fri, 30 Jul 2021 22:07:35 +0000 (15:07 -0700)]
[libcxx][docs] Take locks on the last three views.

3 years ago[mlir][spirv] Add support for i8 serialization
Lei Zhang [Fri, 30 Jul 2021 21:39:32 +0000 (17:39 -0400)]
[mlir][spirv] Add support for i8 serialization

Reviewed By: hanchung

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

3 years ago[mlir][spirv] Fix loading bool with proper storage capabilities
Lei Zhang [Fri, 30 Jul 2021 00:22:01 +0000 (20:22 -0400)]
[mlir][spirv] Fix loading bool with proper storage capabilities

If the source value to load is bool, and we have native storage
capability support for the source bitwidth, we still cannot directly
rewrite uses; we need to perform casting to bool first.

Reviewed By: hanchung

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

3 years ago[mlir][spirv] Fix storing bool with proper storage capabilities
Lei Zhang [Fri, 30 Jul 2021 00:21:44 +0000 (20:21 -0400)]
[mlir][spirv] Fix storing bool with proper storage capabilities

If the source value to store is bool, and we have native storage
capability support for the target bitwidth, we still cannot directly
store; we need to perform casting to match the target memref
element's bitwidth.

Reviewed By: hanchung

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

3 years ago[libomptarget][nfc] Only set cuda-path for nvptx tests
Jon Chesterfield [Fri, 30 Jul 2021 22:01:07 +0000 (23:01 +0100)]
[libomptarget][nfc] Only set cuda-path for nvptx tests

Remove --cuda-path=CUDA_TOOLKIT_ROOT_DIR-NOTFOUND
from the invocation of non-nvptx test cases. Better signal
to noise ratio on other architectures.

Reviewed By: tianshilei1992

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

3 years ago[builtins] Try to ensure single copy of emulated TLS state
Shoaib Meenai [Fri, 30 Jul 2021 01:39:04 +0000 (18:39 -0700)]
[builtins] Try to ensure single copy of emulated TLS state

Multiple copies of emulated TLS state means inconsistent results when
accessing the same thread-local variable from different shared objects
(https://github.com/android/ndk/issues/1551). Making `__emutls_get_address`
be a weak default visibility symbol should make the dynamic linker
ensure only a single copy gets used at runtime. This is best-effort, but
the more robust approach of putting emulated TLS into its own shared
object would (a) be a much bigger change, and (b) shared objects are
pretty heavyweight, and adding a new one to a space-constrained
environment isn't an easy sell. Given the expected rarity of direct
accesses to emulated TLS variables across different shared objects, the
best-effort approach should suffice.

Reviewed By: danalbert, rprichard

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

3 years agoRevert "[profile] Fix profile merging with binary IDs"
Petr Hosek [Fri, 30 Jul 2021 21:32:15 +0000 (14:32 -0700)]
Revert "[profile] Fix profile merging with binary IDs"

This reverts commit 89d6eb6f8c5d94093f30a5f37b193a2422491642, this
seemed to have break a few builders.

3 years agoRevert "[hwasan] Detect use after scope within function."
Florian Mayer [Fri, 30 Jul 2021 21:32:04 +0000 (22:32 +0100)]
Revert "[hwasan] Detect use after scope within function."

This reverts commit 84705ed913659d1d5e0ee6b5ae7b298914ec87d4.

3 years ago[LoopStrengthReduction] Fix pointer extend asserts
Brendon Cahoon [Fri, 30 Jul 2021 16:45:04 +0000 (12:45 -0400)]
[LoopStrengthReduction] Fix pointer extend asserts

Additional asserts were added to ScalarEvolution to enforce
pointer/int type rules. An assert is triggered when the LSR pass
attempts to extend a pointer SCEV in GenerateTruncates.

This patch changes GenerateTruncates to exit early if the Formaula
contains a ScaledReg or BaseReg with a pointer type.

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

3 years ago[lldb] [DWARF-5] Be lazier about loading .dwo files
Eric Leese [Fri, 30 Jul 2021 11:08:00 +0000 (13:08 +0200)]
[lldb] [DWARF-5] Be lazier about loading .dwo files

This change makes sure that DwarfUnit does not load a .dwo file until
necessary. I also take advantage of DWARF 5's guarantee that the first
support file is also the primary file to make it possible to create
a compile unit without loading the .dwo file.

Review By: jankratochvil, dblaikie

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

3 years agoRevert "[OpenMP][AMDGCN] Initial math headers support"
Jon Chesterfield [Fri, 30 Jul 2021 21:03:23 +0000 (22:03 +0100)]
Revert "[OpenMP][AMDGCN] Initial math headers support"

Broke nvptx compilation on files including <complex>

This reverts commit 12da97ea10a941f0123340831300d09a2121e173.

3 years ago[polly] Fix up regression test config with current features.
Eli Friedman [Fri, 30 Jul 2021 20:17:45 +0000 (13:17 -0700)]
[polly] Fix up regression test config with current features.

Primarily, configure substitutions so we can copy-paste the "RUN" line
of failed tests without worrying about the paths.

3 years ago[profile] Fix profile merging with binary IDs
Petr Hosek [Fri, 30 Jul 2021 09:40:27 +0000 (02:40 -0700)]
[profile] Fix profile merging with binary IDs

This fixes support for merging profiles which broke as a consequence
of e50a38840dc3db5813f74b1cd2e10e6d984d0e67. The issue was missing
adjustment in merge logic to account for the binary IDs which are
now included in the raw profile just after header.

In addition, this change also:
* Includes the version in module signature that's used for merging
to avoid accidental attempts to merge incompatible profiles.
* Moves the binary IDs size field after version field in the header
as was suggested in the review.

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

3 years ago[AMDGPU] Autogenerate checks in kernel-args.ll
Jay Foad [Thu, 29 Jul 2021 08:43:49 +0000 (09:43 +0100)]
[AMDGPU] Autogenerate checks in kernel-args.ll

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

3 years ago[mlir][sparse] move comments from cpp files into dialect doc
Aart Bik [Fri, 30 Jul 2021 19:59:20 +0000 (12:59 -0700)]
[mlir][sparse] move comments from cpp files into dialect doc

Reviewed By: rriddle

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

3 years ago[lldb] Fix remote macOS debugging on Apple Silicon
Jonas Devlieghere [Fri, 30 Jul 2021 16:35:44 +0000 (09:35 -0700)]
[lldb] Fix remote macOS debugging on Apple Silicon

Update ARMGetSupportedArchitectureAtIndex to consider remote macOS
debugging. Currently, it defaults to an iOS triple when IsHost() returns
false. This fixes TestPlatformSDK.py on Apple Silicon.

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

3 years ago[z/OS]Remove overriding default attribute aligned value
Fanbo Meng [Fri, 30 Jul 2021 19:03:40 +0000 (15:03 -0400)]
[z/OS]Remove overriding default attribute aligned value

Make DefaultAlignForAttributeAligned consistent with SystemZ.

Reviewed By: abhina.sreeskantharajan, anirudhp

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

3 years ago[PowerPC] Fix byte ordering of ld/st with length on BE
Nemanja Ivanovic [Fri, 30 Jul 2021 19:33:55 +0000 (14:33 -0500)]
[PowerPC] Fix byte ordering of ld/st with length on BE

The builtins vec_xl_len_r and vec_xst_len_r actually use the
wrong side of the vector on big endian Power9 systems. We never
spotted this before because there was no such thing as a big
endian distro that supported Power9. Now we have AIX and the
elements are in the wrong part of the vector. This just fixes
it so the elements are loaded to and stored from the right
side of the vector.

3 years ago[doc]Added examples for generic opcodes
pooja2299 [Thu, 29 Jul 2021 11:21:28 +0000 (16:51 +0530)]
[doc]Added examples for generic opcodes

Added examples to G_BR, G_BRCOND, G_BRJT, G_BRINDIRECT

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

3 years agoExplain the symbols of basic block clusters with an example in the header comments.
Rahman Lavaee [Fri, 30 Jul 2021 02:20:12 +0000 (19:20 -0700)]
Explain the symbols of basic block clusters with an example in the header comments.

This prevents from confusion with the ``labels`` option.

Reviewed By: snehasish

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

3 years ago[clang][cache] Update Fuchsia-stage2.cmake to create hwasan multilibs
Leonard Chan [Fri, 30 Jul 2021 18:52:27 +0000 (11:52 -0700)]
[clang][cache] Update Fuchsia-stage2.cmake to create hwasan multilibs

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