platform/upstream/llvm.git
2 years ago[clang] Add clang builtins support for gfx90a
Anshil Gandhi [Thu, 5 Aug 2021 08:08:06 +0000 (02:08 -0600)]
[clang] Add clang builtins support for gfx90a

Implement target builtins for gfx90a including fadd64, fadd32, add2h,
max and min on various global, flat and ds address spaces for which
intrinsics are implemented.

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

2 years agoD106035: Remove conditional compilation for WCHAR support in libedit
Neal Sidhwaney [Thu, 20 May 2021 22:41:25 +0000 (17:41 -0500)]
D106035: Remove conditional compilation for WCHAR support in libedit

This change moves to using narrow character types and libedit APIs in
Editline, because those are the same types that the rest of LLVM/LLDB
uses, and it's generally considered better practice to use UTF-8
encoded in char than it is to use wider characters. However, for
character input, the change leaves in using a wchar to enable input of
multi-byte characters.

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

2 years ago[llvm-rc] Allow specifying language with a leading 0x prefix
Martin Storsjö [Mon, 2 Aug 2021 11:10:22 +0000 (14:10 +0300)]
[llvm-rc] Allow specifying language with a leading 0x prefix

This option is always interpreted strictly as a hexadecimal string,
even if it has no prefix that indicates the number format, hence
the existing call to StringRef::getAsInteger(16, ...).

StringRef::getAsInteger(0, ...) consumes a leading "0x" prefix is
present, but when the radix is specified, the radix shouldn't
be included.

Both MS rc.exe and GNU windres accept the language with that
prefix.

Also allow specifying the codepage to llvm-windres with a different
radix, as GNU windres allows that (but MS rc.exe doesn't).

This fixes https://llvm.org/PR51295.

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

2 years ago[llvm] [lit] Fix inconsistent test order in shtest-keyword-parse-errors
Michał Górny [Wed, 4 Aug 2021 06:58:04 +0000 (08:58 +0200)]
[llvm] [lit] Fix inconsistent test order in shtest-keyword-parse-errors

Remove test times when running shtest-keyword-parse-errors test,
in order to prevent the previous executions from impacting subtest
order and therefore causing FileCheck to fail.

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

2 years ago[ARM][llvm-objdump] Annotate PC-relative memory operands of VLDR instructions
Igor Kudrin [Thu, 5 Aug 2021 06:56:14 +0000 (13:56 +0700)]
[ARM][llvm-objdump] Annotate PC-relative memory operands of VLDR instructions

This extends D105979 and adds support for VLDR instructions.

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

2 years ago[ARM][llvm-objdump] Annotate PC-relative memory operands
Igor Kudrin [Thu, 5 Aug 2021 06:55:32 +0000 (13:55 +0700)]
[ARM][llvm-objdump] Annotate PC-relative memory operands

This implements `MCInstrAnalysis::evaluateMemoryOperandAddress()` for
Arm so that the disassembler can print the target address of memory
operands that use PC+immediate addressing.

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

2 years ago[ELF] Apply version script patterns to non-default version symbols
Fangrui Song [Thu, 5 Aug 2021 06:52:55 +0000 (23:52 -0700)]
[ELF] Apply version script patterns to non-default version symbols

Currently version script patterns are ignored for .symver produced
non-default version (single @) symbols. This makes such symbols
not localizable by `local:`, e.g.

```
.symver foo3_v1,foo3@v1
.globl foo_v1
foo3_v1:

ld.lld --version-script=a.ver -shared a.o
```

This patch adds the support:

* Move `config->versionDefinitions[VER_NDX_LOCAL].patterns` to `config->versionDefinitions[versionId].localPatterns`
* Rename `config->versionDefinitions[versionId].patterns` to `config->versionDefinitions[versionId].nonLocalPatterns`
* Allow `findAllByVersion` to find non-default version symbols when `includeNonDefault` is true. (Note: `symtab` keys do not have `@@`)
* Make each pattern check both the unversioned `pat.name` and the versioned `${pat.name}@${v.name}`
* `localPatterns` can localize `${pat.name}@${v.name}`. `nonLocalPatterns` can prevent localization by assigning `verdefIndex` (before `parseSymbolVersion`).

---

If a user notices new `undefined symbol` errors with a version script containing
`local: *;`, the issue is likely due to a missing `global:` pattern.

Reviewed By: peter.smith

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

2 years agoRevert "[ELF] Apply version script patterns to non-default version symbols"
Fangrui Song [Thu, 5 Aug 2021 05:29:30 +0000 (22:29 -0700)]
Revert "[ELF] Apply version script patterns to non-default version symbols"

This reverts commit 7ed22a6fa90cbdc70d6806c1121a0c50c1978dce.

buf is not cleared so the commit misses some cases.

2 years ago[NFCI] [LoopIdiom] Let processLoopStridedStore take StoreSize as SCEV instead of...
eopXD [Sat, 19 Jun 2021 14:26:12 +0000 (14:26 +0000)]
[NFCI] [LoopIdiom] Let processLoopStridedStore take StoreSize as SCEV instead of unsigned

Letting it take SCEV allows further modification on the function to optimize
if the StoreSize / Stride is runtime determined.

This is a preceeding of D107353.
The big picture is to let LoopIdiom deal with runtime-determined sizes.

Reviewed By: Whitney, lebedev.ri

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

2 years ago[WebAssembly] Cleanup Emscripten SjLj tests
Heejin Ahn [Wed, 4 Aug 2021 23:27:51 +0000 (16:27 -0700)]
[WebAssembly] Cleanup Emscripten SjLj tests

- Remove a redundant test: there were `longjmp_only` and `only_longjmp`,
  which do the same thing
- Add `CHECK-LABEL` lines for function names

Reviewed By: tlively

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

2 years ago[WebAssembly] Use `SDValue::getConstantOperandVal` (NFC)
Heejin Ahn [Wed, 4 Aug 2021 20:53:34 +0000 (13:53 -0700)]
[WebAssembly] Use `SDValue::getConstantOperandVal` (NFC)

Reviewed By: tlively

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

2 years ago[mlir] Clean up includes in Transforms/Passes.h
Matthias Springer [Thu, 5 Aug 2021 02:41:27 +0000 (11:41 +0900)]
[mlir] Clean up includes in Transforms/Passes.h

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

2 years agoDisable LibFuncs for stpcpy and stpncpy for Android < 21
Nathan Lanza [Wed, 4 Aug 2021 22:58:43 +0000 (18:58 -0400)]
Disable LibFuncs for stpcpy and stpncpy for Android < 21

These functions don't exist in android API levels < 21. A change in
llvm-12 (rG6dbf0cfcf789) caused Oz builds to emit this symbol assuming
it's available and thus is causing link errors. Simply disable it here.

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

2 years ago[Compiler-RT] On Apple Platforms switch to always emitting full debug info
Dan Liew [Wed, 4 Aug 2021 21:29:32 +0000 (14:29 -0700)]
[Compiler-RT] On Apple Platforms switch to always emitting full debug info

Previously the build used `-gline-tables-only` when `COMPILER_RT_DEBUG`
was off (default) and `-g` when `COMPILER_RT_DEBUG` was on. The end
result of this meant that the release build of the Sanitizer runtimes
were difficult to debug (e.g. information about variables and function
arguments were missing).

Presumably the reason for preferring `-gline-tables-only` for release
builds was to save space. However, for Apple platforms this doesn't
matter because debug info lives in separate `.dSYM` files (which aren't
shipped) rather than in the shipped `.dylib` files.

Now on Apple platforms we always emit full debug info if the compiler
supports it and we emit a fatal error if `-g` isn't supported.

rdar://79223184

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

2 years ago[AVR] emit 'MCSA_Global' references to '__do_global_ctors' and '__do_global_dtors'
Matt Jacobson [Thu, 5 Aug 2021 02:34:49 +0000 (10:34 +0800)]
[AVR] emit 'MCSA_Global' references to '__do_global_ctors' and '__do_global_dtors'

Emit references to '__do_global_ctors' and '__do_global_dtors' to allow
constructor/destructor routines to run.

Reviewed by: MaskRay

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

2 years ago[mlir] Update comment in Region.h
Matthias Springer [Thu, 5 Aug 2021 01:54:11 +0000 (10:54 +0900)]
[mlir] Update comment in Region.h

The file in which `Region::viewGraph` is defined has changed. This should have been updated with D106342.

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

2 years ago[CMake][gn] lldMachO=>lldMachOOld, lldMachO2=>lldMachO
Fangrui Song [Thu, 5 Aug 2021 01:52:41 +0000 (18:52 -0700)]
[CMake][gn] lldMachO=>lldMachOOld, lldMachO2=>lldMachO

Now that D95204 switched default to new Darwin backend, rename some CMake
targets to match.

Reviewed By: #lld-macho, smeenai, int3

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

2 years ago[Bazel] Add support for lld
Geoffrey Martin-Noble [Thu, 5 Aug 2021 00:58:06 +0000 (17:58 -0700)]
[Bazel] Add support for lld

This patch adds a Bazel configuration to build lld. That includes a
BUILD.bazel file to export the libunwind headers for use by lld. Since
the lld target itself requires libxml2 (through WindowsManifest) it's
currently disabled on Buildkite and marked manual, but all the libraries
build.

Reviewed By: MaskRay

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

2 years ago[libFuzzer] tests/examples for using libFuzzer for out-of-process targets
Kostya Serebryany [Tue, 3 Aug 2021 22:04:40 +0000 (15:04 -0700)]
[libFuzzer] tests/examples for using libFuzzer for out-of-process targets

[libFuzzer] tests/examples for using libFuzzer for out-of-process targets

Reviewed By: kostik

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

2 years ago[CSSPGO] Remove used of PseudoProbeAttributes::Reserved
modimo [Thu, 5 Aug 2021 00:23:22 +0000 (17:23 -0700)]
[CSSPGO] Remove used of PseudoProbeAttributes::Reserved

D106861 added usage of PseudoProbeAttributes::Reserved as TailCall however this usage hasn't been committed/reviewed. Removing this usage.

Testing
ninja check-all

Reviewed By: wenlei

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

2 years agoBPF: avoid NE/EQ loop exit condition
Yonghong Song [Sat, 31 Jul 2021 20:29:00 +0000 (13:29 -0700)]
BPF: avoid NE/EQ loop exit condition

Kuniyuki Iwashima reported in [1] that llvm compiler may
convert a loop exit condition with "i < bound" to "i != bound", where
"i" is the loop index variable and "bound" is the upper bound.
In case that "bound" is not a constant, verifier will always have "i != bound"
true, which will cause verifier failure since to verifier this is
an infinite loop.

The fix is to avoid transforming "i < bound" to "i != bound".
In llvm, the transformation is done by IndVarSimplify pass.
The compiler checks loop condition cost (i = i + 1) and if the
cost is lower, it may transform "i < bound" to "i != bound".
This patch implemented getArithmeticInstrCost() in BPF TargetTransformInfo
class to return a higher cost for such an operation, which
will prevent the transformation for the test case
added in this patch.

 [1] https://lore.kernel.org/netdev/1994df05-8f01-371f-3c3b-d33d7836878c@fb.com/

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

2 years agoAdding missing filter check to SourceMgrDiagnosticHandler::EmitDiagnostics
Catherine Payne [Wed, 4 Aug 2021 20:10:39 +0000 (20:10 +0000)]
Adding missing filter check to SourceMgrDiagnosticHandler::EmitDiagnostics

There is a case in EmitDiagnostics where the filter check is bypassed (when locationStack is empty).   Filter might also be bypassed when loc instead of showableLoc is added to the locationStack.

Reviewed By: rriddle

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

2 years ago[AArch64][GlobalISel] Legalize wide vector G_PHIs
Jessica Paquette [Wed, 4 Aug 2021 22:06:34 +0000 (15:06 -0700)]
[AArch64][GlobalISel] Legalize wide vector G_PHIs

Clamp the max number of elements when legalizing G_PHI. This allows us to
legalize some common fallbacks like 4 x s64.

Here's an example: https://godbolt.org/z/6YocsEYTd

Had to add -global-isel-abort=0 to legalize-phi.mir to account for the
G_EXTRACT_VECTOR_ELT from the 32 x s8 G_PHI.

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

2 years agoApply -fmacro-prefix-map to __builtin_FILE()
Pavel Asyutchenko [Wed, 4 Aug 2021 23:42:14 +0000 (16:42 -0700)]
Apply -fmacro-prefix-map to __builtin_FILE()

This matches the behavior of GCC.
Patch does not change remapping logic itself, so adding one simple smoke test should be enough.

Reviewed By: MaskRay

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

2 years ago[gwpAsan] revert minor change
Michael Jones [Wed, 4 Aug 2021 23:07:00 +0000 (23:07 +0000)]
[gwpAsan] revert minor change

This change reverts a small cmake change that was causing buildbot
failures.

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

2 years ago[mlir][sparse] Remove comment w/ code in it
Gus Smith [Wed, 4 Aug 2021 17:58:49 +0000 (17:58 +0000)]
[mlir][sparse] Remove comment w/ code in it

Reviewed By: aartbik

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

2 years ago[OpenCL] allow generic address and non-generic defs for CL3.0
Dave Airlie [Wed, 4 Aug 2021 21:32:45 +0000 (07:32 +1000)]
[OpenCL] allow generic address and non-generic defs for CL3.0

 This allows both sets of definitions to exist on CL 3.0

Reviewed By: Anastasia

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

2 years ago[llvm-nm][test] Avoid deprecated alias -M (--print-armap)
Fangrui Song [Wed, 4 Aug 2021 21:25:24 +0000 (14:25 -0700)]
[llvm-nm][test] Avoid deprecated alias -M (--print-armap)

-M was inappropriately added since -s is taken by Darwin nm.
-M is deprecated. Tests should use --print-armap instead.

2 years ago[WebAssembly] Make result of 'catch' inst variadic
Heejin Ahn [Mon, 2 Aug 2021 02:37:36 +0000 (19:37 -0700)]
[WebAssembly] Make result of 'catch' inst variadic

`catch` instruction can have any number of result values depending on
its tag, but so far we have only needed a single i32 return value for
C++ exception so the instruction was specified that way. But using the
instruction for SjLj handling requires multiple return values.

This makes `catch` instruction's results variadic and moves selection of
`throw` and `catch` instruction from ISelLowering to ISelDAGToDAG.
Moving `catch` to ISelDAGToDAG is necessary because I am not aware of
a good way to do instruction selection for variadic output instructions
in TableGen. This also moves `throw` because 1. `throw` and `catch`
share the same utility function and 2. there is really no reason we
should do that in ISelLowering in the first place. What we do is mostly
the same in both places, and moving them to ISelDAGToDAG allows us to
remove unnecessary mid-level nodes for `throw` and `catch` in
WebAssemblyISD.def and WebAssemblyInstrInfo.td.

This also adds handling for new `catch` instruction to AsmTypeCheck.

Reviewed By: dschuff, tlively

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

2 years ago[X86] Remove -x86-experimental-pref-loop-alignment in favor of -align-loops
Fangrui Song [Wed, 4 Aug 2021 20:23:56 +0000 (13:23 -0700)]
[X86] Remove -x86-experimental-pref-loop-alignment in favor of -align-loops

2 years ago[Bazel] Drop deprecated tblgen includes mechanism
Geoffrey Martin-Noble [Tue, 3 Aug 2021 19:30:31 +0000 (12:30 -0700)]
[Bazel] Drop deprecated tblgen includes mechanism

Includes can now be fully managed via td_library and specified locally
to the tablegen files that require them. This has been deprecated for a
while and is not used upstream. I'm not aware of any downstream users
either.

Reviewed By: jpienaar

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

2 years ago[mlir-lsp-server] Only use one MLIRContext per MLIRTextFile
River Riddle [Wed, 4 Aug 2021 18:15:50 +0000 (18:15 +0000)]
[mlir-lsp-server] Only use one MLIRContext per MLIRTextFile

A text file may be comprised of many different "chunks", when
the input file contains the `// -----` split markers. We don't
need to use a unique MLIRContext per chunk, as having
separate contexts is intended to allow for easy unloading of
unused data and all chunks have the same lifetime (tied to the
input file). This commit uses one context for the entire file,
greatly reducing memory consumption in certain situations (up
to 70%).

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

2 years ago[libc] add integration tests for scudo in libc
Michael Jones [Tue, 27 Jul 2021 17:44:14 +0000 (17:44 +0000)]
[libc] add integration tests for scudo in libc

This change adds tests to make sure that SCUDO is being properly
included with llvm libc. This change also adds the toggles to properly
use SCUDO, as GWP-ASan is enabled by default and must be included for
SCUDO to function.

Reviewed By: sivachandra, hctim

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

2 years ago[lld] Remove unused LLD_REPOSITORY
Fangrui Song [Wed, 4 Aug 2021 20:04:10 +0000 (13:04 -0700)]
[lld] Remove unused LLD_REPOSITORY

Remnant after D72803.

Distributions who want to customize the string can customize
LLD_VERSION_STRING instead.

Reviewed By: #lld-macho, mstorsjo, thakis

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

2 years ago[CodeGen] Add -align-loops
Fangrui Song [Wed, 4 Aug 2021 19:45:17 +0000 (12:45 -0700)]
[CodeGen] Add -align-loops

to `lib/CodeGen/CommandFlags.cpp`. It can replace
-x86-experimental-pref-loop-alignment=.

The loop alignment is only used by MachineBlockPlacement.
The implementation uses a new `llvm::TargetOptions` for now, as
an IR function attribute/module flags metadata may be overkill.

This is the llvm part of D106701.

2 years ago[amdgpu] Add an enhanced conversion from i64 to f32.
Michael Liao [Sun, 25 Jul 2021 03:42:26 +0000 (23:42 -0400)]
[amdgpu] Add an enhanced conversion from i64 to f32.

Reviewed By: arsenm

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

2 years ago[flang] runtime: For Fw.d formatting, don't oscillate forever
peter klausler [Mon, 2 Aug 2021 21:37:40 +0000 (14:37 -0700)]
[flang] runtime: For Fw.d formatting, don't oscillate forever

The algorithm for Fw.d output will drive binary to decimal conversion for
an initial fixed number of digits, then adjust that number based on the
result's exposent.  For value close to a power of ten, this adjustment
process wouldn't terminate; e.g., formatting 9.999 as F10.2 would start
with 1e2, boost the digits to 2, get 9.99e1, decrease the digits, and loop.
Solve by refusing to boost the digits a second time.

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

2 years ago[flang] Support DFLOAT legacy extension intrinsic function
peter klausler [Wed, 28 Jul 2021 23:14:17 +0000 (16:14 -0700)]
[flang] Support DFLOAT legacy extension intrinsic function

Like the similar legacy extension FLOAT(), DFLOAT() represents a
conversion from default integer to DOUBLE PRECISION.  Rewrite
into a conversion operation.

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

2 years ago[MemCpyOpt] Relax libcall checks
Nikita Popov [Sun, 25 Jul 2021 15:34:17 +0000 (17:34 +0200)]
[MemCpyOpt] Relax libcall checks

Rather than blocking the whole MemCpyOpt pass if the libcalls are
not available, only disable creation of new memset/memcpy intrinsics
where only load/stores were used previously. This only affects the
store merging and load-store conversion optimization. Other
optimizations are derived from existing intrinsics, which are
well-defined in the absence of libcalls -- not having the libcalls
just means that call simplification won't convert them to intrinsics.

This is a weaker variation of D104801, which dropped these checks
entirely. Ideally we would not couple emission of intrinsics to
libcall availability at all, but as the intrinsics may be legalized
to libcalls we need to be a bit careful right now.

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

2 years ago[MLIR][NFC] Get DiagnosticEngine as a reference in doc
Alfsonso Gregory [Wed, 4 Aug 2021 18:31:11 +0000 (18:31 +0000)]
[MLIR][NFC] Get DiagnosticEngine as a reference in doc

'mlir::DiagnosticEngine::DiagnosticEngine(const mlir::DiagnosticEngine&)' is implicitly deleted because the default definition would be ill-formed.

Reviewed By: rdzhabarov

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

2 years ago[gn build] Add cfi ignorelist to compiler-rt/lib
Arthur Eubanks [Tue, 3 Aug 2021 23:38:25 +0000 (16:38 -0700)]
[gn build] Add cfi ignorelist to compiler-rt/lib

So that building the compiler-rt target also copies the cfi ignorelist

Reviewed By: thakis

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

2 years ago[SLP][NFC]Add tests for constants/undefs used in insertelements, NFC.
Alexey Bataev [Wed, 4 Aug 2021 18:49:17 +0000 (11:49 -0700)]
[SLP][NFC]Add tests for constants/undefs used in insertelements, NFC.

2 years ago[OpenMPOpt] Expand SPMDization with guarding for target parallel regions
Giorgis Georgakoudis [Wed, 4 Aug 2021 00:15:37 +0000 (17:15 -0700)]
[OpenMPOpt] Expand SPMDization with guarding for target parallel regions

This patch expands SPMDization (converting generic execution mode to SPMD for target regions) by guarding code regions that should be executed only by the main thread. Specifically, it generates guarded regions, which only the main thread executes, and the synchronization with worker threads using simple barriers. For correctness, the patch aborts SPMDization for target regions if the same code executes in a parallel region, thus must be not be guarded. This check is implemented using the ParallelLevels AA.

Reviewed By: jhuber6

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

2 years ago[DAGCombiner][AMDGPU] Canonicalize constants to the RHS of MULHU/MULHS.
Craig Topper [Wed, 4 Aug 2021 18:39:21 +0000 (11:39 -0700)]
[DAGCombiner][AMDGPU] Canonicalize constants to the RHS of MULHU/MULHS.

This allows special constants like to 0 to be recognized. It's also
expected by isel patterns if a target had a mulh with immediate instructions.
The commuting done by tablegen won't commute patterns with immediates since it
expects DAGCombine to have done it.

Reviewed By: foad

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

2 years ago[RISCV] Add test cases for conditional add/sub. NFC
Craig Topper [Wed, 4 Aug 2021 15:49:17 +0000 (08:49 -0700)]
[RISCV] Add test cases for conditional add/sub. NFC

InstCombine canonicalizes c ? (x+y) : x to (c ? y : 0) + x. It
does the same for and/or/xor. We already reverse this transform
for those, but don't do add/sub yet.

2 years ago[nfc] [lldb] Prevent needless copies of DataExtractor
Jan Kratochvil [Wed, 4 Aug 2021 18:34:21 +0000 (20:34 +0200)]
[nfc] [lldb] Prevent needless copies of DataExtractor

lldb_private::DataExtractor contains DataBufferSP m_data_sp which is
relatively expensive to copy (due to multi-threading locking).

llvm::DataExtractor does not have this problem as it uses StringRef
instead.

The copy constructor is explicit as otherwise it is easy to make
unintended modification of a local copy instead of a caller's instance
(D107470 but that is llvm::DataExtractor).

Reviewed By: clayborg

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

2 years agoRevert "[SLP]Do not emit extra shuffle for insertelements vectorization."
Alexey Bataev [Wed, 4 Aug 2021 17:59:58 +0000 (10:59 -0700)]
Revert "[SLP]Do not emit extra shuffle for insertelements vectorization."

This reverts commit 871ea69803b1f231254ab0c560795a33b6ed0c77 to fix the
problem if the first vector is not just undef.

2 years ago[hwasan] Add __hwasan_init constructor to runtime lib.
Mitch Phillips [Wed, 4 Aug 2021 18:03:24 +0000 (11:03 -0700)]
[hwasan] Add __hwasan_init constructor to runtime lib.

Found by an Android toolchain upgrade, inherited module constructors
(like init_have_lse_atomics from the builtins) can sneak into the hwasan
runtime. If these inherited constructors call hwasanified libc
functions, then the HWASan runtime isn't setup enough, and the code
crashes.

Mark the initialized as a high-priority initializer to fix this.

Reviewed By: pcc, yabinc

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

2 years agoWork around non-existence of ElfW(type) macro on FreeBSD
Dimitry Andric [Wed, 4 Aug 2021 18:11:43 +0000 (20:11 +0200)]
Work around non-existence of ElfW(type) macro on FreeBSD

Fixes PR51331. On FreeBSD, the elf headers don't (yet) provide the
ElfW(type) macro. However, there is a similar set of macros in the
<sys/elf-generic.h> header, of which `__ElfN(type)` exactly matches the
indended purpose.

Reviewed By: gulfem

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

2 years agoRevert "[AMDGPU] Handle functions in llvm's global ctors and dtors list"
Reshabh Sharma [Wed, 4 Aug 2021 18:03:31 +0000 (23:33 +0530)]
Revert "[AMDGPU] Handle functions in llvm's global ctors and dtors list"

This reverts commit d42e70b3d315645e37f3b1455d39e68678e69525.

2 years ago[DSE][NFC] Clean up DeadStoreElimination from unused variables
Dawid Jurczak [Wed, 4 Aug 2021 15:39:51 +0000 (17:39 +0200)]
[DSE][NFC] Clean up DeadStoreElimination from unused variables

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

2 years ago[RISCV] Remove the _COMMUTABLE and _TA versions of FMA and wide FMA vector instructions.
Craig Topper [Wed, 4 Aug 2021 16:54:39 +0000 (09:54 -0700)]
[RISCV] Remove the _COMMUTABLE and _TA versions of FMA and wide FMA vector instructions.

Use a tail policy operand instead. Inspired by the work in D105092,
but without the intrinsic interface changes.

Reviewed By: frasercrmck

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

2 years ago[mlir][sparse] add doc to sparse tensor dialect passes
Aart Bik [Wed, 4 Aug 2021 16:54:27 +0000 (09:54 -0700)]
[mlir][sparse] add doc to sparse tensor dialect passes

completes my first pass of filling out missing doc parts on our webpage

Reviewed By: grosul1

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

2 years ago[gn build] Port ee7d20e84675
LLVM GN Syncbot [Wed, 4 Aug 2021 17:28:44 +0000 (17:28 +0000)]
[gn build] Port ee7d20e84675

2 years ago[gn build] (manually) port ee7d20e84675e1d255d7ae59e3bccfd320cc090d
Fangrui Song [Wed, 4 Aug 2021 17:28:27 +0000 (10:28 -0700)]
[gn build] (manually) port ee7d20e84675e1d255d7ae59e3bccfd320cc090d

2 years ago[AArch64][GlobalISel] Widen G_PHI before clamping it during legalization
Jessica Paquette [Wed, 4 Aug 2021 00:40:24 +0000 (17:40 -0700)]
[AArch64][GlobalISel] Widen G_PHI before clamping it during legalization

This allows us to handle weird types like s88; we first widen to s128, then
clamp back down to s64.

https://godbolt.org/z/9xqbP46Mz

Also this makes it possible for GISel to legalize the case in pr48188.ll. It
now does the same thing as SDAG, although regalloc chooses different registers.

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

2 years ago[AArch64][GlobalISel] Widen G_FPTO*I before clamping
Jessica Paquette [Tue, 3 Aug 2021 23:42:22 +0000 (16:42 -0700)]
[AArch64][GlobalISel] Widen G_FPTO*I before clamping

Going through our legalization rules and doing some cleanup.

Widening and then clamping is usually easier than clamping and then widening.

This allows us to legalize some weird types like s88.

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

2 years ago[InstrProfiling] Emit bias variable eagerly
Petr Hosek [Tue, 3 Aug 2021 17:39:24 +0000 (10:39 -0700)]
[InstrProfiling] Emit bias variable eagerly

Rather than emitting the bias variable lazily as needed, emit it
eagerly. This allows profile runtime to refer to this variable
unconditionally without having to use the weak reference. The bias
variable is in a COMDAT so there'll never be more than one instance,
and if it's not needed, linker should be able to GC it, so the overhead
should be minimal.

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

2 years ago[Bazel] Update build for ee7d20e846
Geoffrey Martin-Noble [Wed, 4 Aug 2021 17:01:43 +0000 (10:01 -0700)]
[Bazel] Update build for ee7d20e846

Updates the Bazel configuration for
https://github.com/llvm/llvm-project/commit/ee7d20e84675. We need to
drop the dependency from llvm-tblgen to avoid a dependency cycle:

```
.-> @llvm-project//llvm:llvm-tblgen
|   @llvm-project//llvm:tblgen
|   @llvm-project//llvm:MC
|   @llvm-project//llvm:ProfileData
|   @llvm-project//llvm:Core
|   @llvm-project//llvm:attributes_gen
|   @llvm-project//llvm:include/llvm/IR/Attributes.inc
|   @llvm-project//llvm:attributes_gen__gen_attrs_genrule
`-- @llvm-project//llvm:llvm-tblgen
```

It appears this dep was not strictly necessary though. TableGen uses MC
headers but it can get those through Support, which also exports MC
headers due to layering issues.

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

2 years ago[X86][SchedModel] Add missing ReadAdvance for some arithmetic ops (PR51318 and PR51322).
Andrea Di Biagio [Tue, 3 Aug 2021 16:10:42 +0000 (17:10 +0100)]
[X86][SchedModel] Add missing ReadAdvance for some arithmetic ops (PR51318 and PR51322).

This fixes a bug where implicit uses of EFLAGS were not marked as ReadAdvance in
the RM/MR variants of ADC/SBB (PR51318)

This also fixes the absence of ReadAdvance for the register operand of
RMW arithmetic instructions (PR51322).

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

2 years ago[OpenMP] Clean up for hidden helper task
Shilei Tian [Wed, 4 Aug 2021 16:36:34 +0000 (12:36 -0400)]
[OpenMP] Clean up for hidden helper task

This patch makes some clean up for code of hidden helper task.

Reviewed By: protze.joachim

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

2 years ago[OpenMP] Fix performance regression reported in bug #51235
Shilei Tian [Wed, 4 Aug 2021 16:34:37 +0000 (12:34 -0400)]
[OpenMP] Fix performance regression reported in bug #51235

This patch fixes the "performance regression" reported in https://bugs.llvm.org/show_bug.cgi?id=51235. In fact it has nothing to do with performance. The root cause is, the stolen task is not allowed to execute by another thread because by default it is tied task. Since hidden helper task will always be executed by hidden helper threads, it should be untied.

Reviewed By: protze.joachim

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

2 years ago[ELF] Fix typo. NFC
Fangrui Song [Wed, 4 Aug 2021 16:26:29 +0000 (09:26 -0700)]
[ELF] Fix typo. NFC

2 years ago[CSSPGO] Migrate and refactor the decoder of Pseudo Probe
jamesluox [Wed, 4 Aug 2021 15:50:28 +0000 (08:50 -0700)]
[CSSPGO] Migrate and refactor the decoder of Pseudo Probe

Migrate pseudo probe decoding logic in llvm-profgen to MC, so other LLVM-base program could reuse existing codes. Redesign object layout of encoded and decoded pseudo probes.

Reviewed By: hoy

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

2 years ago[InstCombine] Fix vscale zext/sext optimization when vscale_range is unbounded.
Sander de Smalen [Wed, 4 Aug 2021 14:04:23 +0000 (15:04 +0100)]
[InstCombine] Fix vscale zext/sext optimization when vscale_range is unbounded.

According to the LangRef, a (vscale_range) value of 0 means unbounded.

This patch additionally cleans up the test file vscale_sext_and_zext.ll.

2 years ago[clang][AArch64][SVE] Avoid going through memory for fixed/scalable predicate casts
Bradley Smith [Mon, 26 Jul 2021 10:34:08 +0000 (10:34 +0000)]
[clang][AArch64][SVE] Avoid going through memory for fixed/scalable predicate casts

For fixed SVE types, predicates are represented using vectors of i8,
where as for scalable types they are represented using vectors of i1. We
can avoid going through memory for casts between these by bitcasting the
i1 scalable vectors to/from a scalable i8 vector of matching size, which
can then use the existing vector insert/extract logic.

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

2 years ago[ELF] Combine foo@v1 and foo with the same versionId if both are defined
Fangrui Song [Wed, 4 Aug 2021 16:06:04 +0000 (09:06 -0700)]
[ELF] Combine foo@v1 and foo with the same versionId if both are defined

Due to an assembler design flaw (IMO), `.symver foo,foo@v1` produces two symbols `foo` and `foo@v1` if `foo` is defined.

* `v1 {};` produces both `foo` and `foo@v1`, but GNU ld only produces `foo@v1`
* `v1 { foo; };` produces both `foo@@v1` and `foo@v1`, but GNU ld only produces `foo@v1`
* `v2 { foo; };` produces both `foo@@v2` and `foo@v1`, matching GNU ld. (Tested by symver.s)

This patch implements the GNU ld behavior by reusing the symbol redirection mechanism
in D92259. The new test symver-non-default.s checks the first two cases.

Without the patch, the second case will produce `foo@v1` and `foo@@v1` which
looks weird and makes foo unnecessarily default versioned.

Note: `.symver foo,foo@v1,remove` exists but the unfortunate `foo` will not go
away anytime soon.

Reviewed By: peter.smith

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

2 years agotsan: remove non-existent MemoryAccessRangeStep
Dmitry Vyukov [Wed, 4 Aug 2021 15:03:44 +0000 (17:03 +0200)]
tsan: remove non-existent MemoryAccessRangeStep

Probably was used for Go at some point...

Depends on D107466.

Reviewed By: melver

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

2 years agotsan: move AccessType to tsan_defs.h
Dmitry Vyukov [Wed, 4 Aug 2021 15:00:24 +0000 (17:00 +0200)]
tsan: move AccessType to tsan_defs.h

It will be needed in more functions like ReportRace
(the plan is to pass it through MemoryAccess to ReportRace)
and this move will allow to split the huge tsan_rtl.h into parts
(e.g. move FastState/Shadow definitions to a separate header).

Depends on D107465.

Reviewed By: melver

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

2 years agotsan: introduce kAccessExternalPC
Dmitry Vyukov [Wed, 4 Aug 2021 14:56:22 +0000 (16:56 +0200)]
tsan: introduce kAccessExternalPC

Add kAccessExternal memory access flag that denotes
memory accesses with PCs that may have kExternalPCBit set.
In preparation for MemoryAccess refactoring.
Currently unused, but will allow to skip a branch.

Depends on D107464.

Reviewed By: melver

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

2 years agotsan: introduce kAccessFree
Dmitry Vyukov [Wed, 4 Aug 2021 14:42:05 +0000 (16:42 +0200)]
tsan: introduce kAccessFree

Add kAccessFree memory access flag (similar to kAccessVptr).
In preparation for MemoryAccess refactoring.

Reviewed By: melver

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

2 years ago[ELF] Apply version script patterns to non-default version symbols
Fangrui Song [Wed, 4 Aug 2021 16:02:11 +0000 (09:02 -0700)]
[ELF] Apply version script patterns to non-default version symbols

Currently version script patterns are ignored for .symver produced
non-default version (single @) symbols. This makes such symbols
not localizable by `local:`, e.g.

```
.symver foo3_v1,foo3@v1
.globl foo_v1
foo3_v1:

ld.lld --version-script=a.ver -shared a.o
# In a.out, foo3@v1 is incorrectly exported.
```

This patch adds the support:

* Move `config->versionDefinitions[VER_NDX_LOCAL].patterns` to `config->versionDefinitions[versionId].localPatterns`
* Rename `config->versionDefinitions[versionId].patterns` to `config->versionDefinitions[versionId].nonLocalPatterns`
* Allow `findAllByVersion` to find non-default version symbols when `includeNonDefault` is true. (Note: `symtab` keys do not have `@@`)
* Make each pattern check both the unversioned `pat.name` and the versioned `${pat.name}@${v.name}`
* `localPatterns` can localize `${pat.name}@${v.name}`. `nonLocalPatterns` can prevent localization by assigning `verdefIndex` (before `parseSymbolVersion`).

---

If a user notices new `undefined symbol` errors with a version script containing
`local: *;`, the issue is likely due to a missing `global:` pattern.

Reviewed By: peter.smith

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

2 years ago[openmp] Add OMPT initialization in libomptarget
Lechen Yu [Wed, 4 Aug 2021 15:17:10 +0000 (17:17 +0200)]
[openmp] Add OMPT initialization in libomptarget

When loading libomptarget, the init function in libomptarget/src/rtl.cpp
will search for the libomptarget_start_tool function using libdl.
libomptarget_start_tool will pass those OMPT callbacks related to target
constructs to libomptarget

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

2 years ago[ELF] Make dot in .tbss correct
Fangrui Song [Wed, 4 Aug 2021 15:58:50 +0000 (08:58 -0700)]
[ELF] Make dot in .tbss correct

GNU ld doesn't support multiple SHF_TLS SHT_NOBITS output sections (it restores
the address after an SHF_TLS SHT_NOBITS section, so consecutive SHF_TLS
SHT_NOBITS sections will have conflicting address ranges).

That said, `threadBssOffset` implements limited support for consecutive SHF_TLS
SHT_NOBITS sections. (SHF_TLS SHT_PROGBITS following a SHF_TLS SHT_NOBITS can still be
incorrect.)

`.` in an output section description of an SHF_TLS SHT_NOBITS section is
incorrect. (https://lists.llvm.org/pipermail/llvm-dev/2021-July/151974.html)

This patch saves the end address of the previous tbss section in
`ctx->tbssAddr`, changes `dot` in the beginning of `assignOffset` so
that `.` evaluation will be correct.

Reviewed By: peter.smith

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

2 years ago[mlir][sparse] fixed typo in sparse tensor type attribute alias
Aart Bik [Wed, 4 Aug 2021 15:53:47 +0000 (08:53 -0700)]
[mlir][sparse] fixed typo in sparse tensor type attribute alias

Reviewed By: grosul1, rriddle

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

2 years ago[AArch64][SVE] Combine bitcasts of predicate types with vector inserts/extracts of...
Bradley Smith [Thu, 22 Jul 2021 12:30:45 +0000 (12:30 +0000)]
[AArch64][SVE] Combine bitcasts of predicate types with vector inserts/extracts of loads/stores

An insert subvector that is inserting the result of a vector predicate
sized load into undef at index 0, whose result is casted to a predicate
type, can be combined into a direct predicate load. Likewise the same
applies to extract subvector but in reverse.

The purpose of this optimization is to clean up cases that will be
introduced in a later patch where casts to/from predicate types from i8
types will use insert subvector, rather than going through memory early.

This optimization is done in SVEIntrinsicOpts rather than InstCombine to
re-introduce scalable loads as late as possible, to give other
optimizations the best chance possible to do a good job.

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

2 years ago[mlir][amx] add doc to AMX dialect
Aart Bik [Wed, 4 Aug 2021 01:49:52 +0000 (18:49 -0700)]
[mlir][amx] add doc to AMX dialect

Making sure the AMX dialect webpage reads better with a short introduction on the purpose of this dialect.

Reviewed By: grosul1, bondhugula

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

2 years ago[AMDGPU][OpenMP] Wrap amdgcn declare variant inside ifdef
Pushpinder Singh [Wed, 4 Aug 2021 15:10:15 +0000 (15:10 +0000)]
[AMDGPU][OpenMP] Wrap amdgcn declare variant inside ifdef

This fixes the issue https://bugs.llvm.org/show_bug.cgi?id=51337

Reviewed By: JonChesterfield

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

2 years ago[AArch64] Fix assert AArch64TargetLowering::ReplaceNodeResults
Simon Wallis [Wed, 4 Aug 2021 15:17:20 +0000 (16:17 +0100)]
[AArch64] Fix assert AArch64TargetLowering::ReplaceNodeResults

Don't know how to custom expand this
UNREACHABLE executed at llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:16788

The fix is to provide missing expansions for:
  case ISD::STRICT_FP_TO_UINT:
  case ISD::STRICT_FP_TO_SINT:

A test case is provided.

Reviewed By: dmgreen

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

2 years ago[PowerPC][AIX] Packed zero-width bitfields do not affect alignment.
Sean Fertile [Wed, 4 Aug 2021 15:01:00 +0000 (11:01 -0400)]
[PowerPC][AIX] Packed zero-width bitfields do not affect alignment.

Zero-width bitfields on AIX pad out to the natral alignment boundary but
do not change the containing records alignment.

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

2 years ago[AMDGPU] Add cttz tests and globalisel checks for ctlz
Jay Foad [Tue, 3 Aug 2021 16:13:02 +0000 (17:13 +0100)]
[AMDGPU] Add cttz tests and globalisel checks for ctlz

2 years ago[DebugInfo][LSR] Avoid crashes on large integer inputs
Chris Jackson [Wed, 4 Aug 2021 09:37:03 +0000 (10:37 +0100)]
[DebugInfo][LSR] Avoid crashes on large integer inputs

SCEV-based salvaging in LSR translates SCEVs to DIExpressions. SCEVs may
contain very large integers but the translation does not support
integers greater than 64 bits. This patch adds checks to ensure
conversions of these large integers is not attempted. A regression test
is added to ensure no such translation is attempted.

Reviewed by: StephenTozer

PR: https://bugs.llvm.org/show_bug.cgi?id=51329

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

2 years ago[AMDGPU] Generate checks for i64 to fp conversions
Jay Foad [Wed, 4 Aug 2021 07:39:12 +0000 (08:39 +0100)]
[AMDGPU] Generate checks for i64 to fp conversions

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

2 years ago[ADT] Drop unnecessary const from return types (NFC)
Kazu Hirata [Wed, 4 Aug 2021 14:38:24 +0000 (07:38 -0700)]
[ADT] Drop unnecessary const from return types (NFC)

Identified with const-return-type-APInt.

2 years ago[AMDGPU] Handle functions in llvm's global ctors and dtors list
Reshabh Sharma [Wed, 4 Aug 2021 14:17:07 +0000 (19:47 +0530)]
[AMDGPU] Handle functions in llvm's global ctors and dtors list

This patch introduces a new code object metadata field, ".kind"
which is used to add support for init and fini kernels.

HSAStreamer will use function attributes, "device-init" and
"device-fini" to distinguish between init and fini kernels from
the regular kernels and will emit metadata with ".kind" set to
"init" and "fini" respectively.

To reduce the number of init and fini kernels, the ctors and
dtors present in the llvm's global.ctors and global.dtors lists
are called from a single init and fini kernel respectively.

Reviewed by: yaxunl

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

2 years ago[NFC][X86] combineX86ShuffleChain(): hoist Mask variable higher up
Roman Lebedev [Wed, 4 Aug 2021 14:14:57 +0000 (17:14 +0300)]
[NFC][X86] combineX86ShuffleChain(): hoist Mask variable higher up

Having `NewMask` outside of an if and rebinding `BaseMask` `ArrayRef`
to it is confusing. Instead, just move the `Mask` vector higher up,
and change the code that earlier had no access to it but now does
to use `Mask` instead of `BaseMask`.

This has no other intentional changes.

2 years ago[NFC][X86] combineX86ShuffleChain(): rename inner Mask to avoid future shadowing
Roman Lebedev [Wed, 4 Aug 2021 14:05:05 +0000 (17:05 +0300)]
[NFC][X86] combineX86ShuffleChain(): rename inner Mask to avoid future shadowing

I want to hoist `Mask` variable higher up,
but then it would clash with this one.
So let's rename this one first.

There are no other intentional changes here other than said rename.

2 years ago[ARM][atomicrmw] Fix CMP_SWAP_32 expand assert
Tomas Matheson [Tue, 3 Aug 2021 15:15:21 +0000 (16:15 +0100)]
[ARM][atomicrmw] Fix CMP_SWAP_32 expand assert

This assert is intended to ensure that the high registers are not
selected when it is passed to one of the thumb UXT instructions. However
it was triggering even for 32 bit where no UXT instruction is emitted.

Fixes PR51313.

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

2 years ago[X86] combineX86ShuffleChain(): canonicalize mask elts picking from splats
Roman Lebedev [Wed, 4 Aug 2021 13:46:29 +0000 (16:46 +0300)]
[X86] combineX86ShuffleChain(): canonicalize mask elts picking from splats

Given a shuffle mask, if it is picking from an input that is splat
given the current granularity of the shuffle, then adjust the mask
to pick from the same lane of the input as the mask element is in.
This may result in a shuffle being simplified into a blend.

I believe this is correct given that the splat detection matches the one
just above the new code,

My basic thought is that we might be able to get less regressions
by handling multiple insertions of the same value into a vector
if we form broadcasts+blend here, as opposed to D105390,
but i have not really thought this through,
and did not try implementing it yet.

Reviewed By: RKSimon

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

2 years ago[mlir] Fix gcc-5 build in ViewOpGraph.cpp
Matthias Springer [Wed, 4 Aug 2021 13:48:34 +0000 (22:48 +0900)]
[mlir] Fix gcc-5 build in ViewOpGraph.cpp

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

2 years ago[flang] Add missing FileSystem.h
Matthias Springer [Wed, 4 Aug 2021 13:11:27 +0000 (22:11 +0900)]
[flang] Add missing FileSystem.h

This file was previously included transitively via `mlir/Transforms/Passes.h`, but the include has been removed from that file.

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

2 years ago[RDA] Attempt to make RDA subreg aware
David Green [Wed, 4 Aug 2021 13:21:32 +0000 (14:21 +0100)]
[RDA] Attempt to make RDA subreg aware

This attempts to make more of RDA aware of potentially overlapping
subregisters. Some of this was already in place, with it iterating
through MCRegUnitIterators. This also replaces calls to
LiveRegs.contains(..) with !LiveRegs.available(..), and updates the
isValidRegUseOf and isValidRegDefOf to search subregs.

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

2 years ago[ARM] Test showing incorrect codegen when subreg liveness is enabled. NFC
David Green [Wed, 4 Aug 2021 10:07:00 +0000 (11:07 +0100)]
[ARM] Test showing incorrect codegen when subreg liveness is enabled. NFC

2 years ago[mlir] Include llvm/Support/Debug.h in Transforms/Passes.h
Matthias Springer [Wed, 4 Aug 2021 12:37:10 +0000 (21:37 +0900)]
[mlir] Include llvm/Support/Debug.h in Transforms/Passes.h

There are many downstream users of llvm::dbgs, which is defined in Debug.h. Before D106342, many users included that dependency transitively via the now deleted ViewRegionGraph.h. Adding it back to Transforms/Passes.h for convenience.

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

2 years ago[X86] Rename X86 tuning feature flag FeatureHasFastGather -> FeatureFastGather
Simon Pilgrim [Wed, 4 Aug 2021 12:07:35 +0000 (13:07 +0100)]
[X86] Rename X86 tuning feature flag FeatureHasFastGather -> FeatureFastGather

Match the naming style used by the other 'FeatureFast/FeatureSlow' tuning flags.

2 years ago[X86] Move FeatureFastBEXTR from bdver2 features to tuning
Simon Pilgrim [Wed, 4 Aug 2021 11:41:34 +0000 (12:41 +0100)]
[X86] Move FeatureFastBEXTR from bdver2 features to tuning

Noticed while looking at the feature flag renaming suggested in D107370

2 years ago[LLDB] Skip flaky tests on Arm/AArch64 Linux bots
Muhammad Omair Javaid [Wed, 4 Aug 2021 11:53:07 +0000 (16:53 +0500)]
[LLDB] Skip flaky tests on Arm/AArch64 Linux bots

Following LLDB tests fail randomly on LLDB Arm/AArch64 Linux buildbots.
We still not have a reliable solution for these tests to pass
consistently. I am marking them skipped for now.

TestBreakpointCallbackCommandSource.py
TestIOHandlerResize.py
TestEditline.py
TestGuiViewLarge.py
TestGuiExpandThreadsTree.py
TestGuiBreakpoints.py

2 years agotsan: don't use spinning in __cxa_guard_acquire/pthread_once
Dmitry Vyukov [Tue, 3 Aug 2021 15:18:06 +0000 (17:18 +0200)]
tsan: don't use spinning in __cxa_guard_acquire/pthread_once

Currently we use passive spinning with internal_sched_yield to wait
in __cxa_guard_acquire/pthread_once. Passive spinning tends to degrade
ungracefully under high load. Use FutexWait/Wake instead.

Depends on D107359.

Reviewed By: vitalybuka, melver

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

2 years ago[clang][deps] Substitute clang-scan-deps executable in lit tests
Jan Svoboda [Wed, 4 Aug 2021 11:47:29 +0000 (13:47 +0200)]
[clang][deps] Substitute clang-scan-deps executable in lit tests

The lit tests for `clang-scan-deps` invoke the tool without going through the substitution system. While the test runner correctly picks up the `clang-scan-deps` binary from the build directory, it doesn't print its absolute path. When copying the invocations when reproducing test failures, this can result in `command not found: clang-scan-deps` errors or worse yet: pick up the system `clang-scan-deps`. This patch adds new local `%clang-scan-deps` substitution.

Reviewed By: lxfind, dblaikie

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

2 years agotsan: refactor guard_acquire/release
Dmitry Vyukov [Wed, 4 Aug 2021 11:29:38 +0000 (13:29 +0200)]
tsan: refactor guard_acquire/release

Introduce named consts for magic values we use.

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