platform/upstream/llvm.git
4 years ago[clang][unittest] Don't hardcode the string "Assertion"
Benjamin Kramer [Mon, 26 Oct 2020 17:10:56 +0000 (18:10 +0100)]
[clang][unittest] Don't hardcode the string "Assertion"

This depends on the libc implementation. Use the string from the
assertion message instead. Overly specific, but so is this entire test.

4 years ago[lld][ELF] Don't write output to the test directory. NFC.
Benjamin Kramer [Mon, 26 Oct 2020 17:10:31 +0000 (18:10 +0100)]
[lld][ELF] Don't write output to the test directory. NFC.

4 years ago[libc++] Fix indentation of buildkite-pipeline.yml
Louis Dionne [Mon, 26 Oct 2020 16:58:15 +0000 (12:58 -0400)]
[libc++] Fix indentation of buildkite-pipeline.yml

4 years agoUnconfuse gcc5.3 after 2e204e23911b1f / D87528
Nico Weber [Mon, 26 Oct 2020 16:55:33 +0000 (12:55 -0400)]
Unconfuse gcc5.3 after 2e204e23911b1f / D87528

The local variable CmpResult added in that change shadowed the
type CmpResult, which confused an older gcc. Rename the variable
CmpResult to APFloatCmpResult.

4 years ago[SVE][CodeGen][DAGCombiner] Fix TypeSize warning in redundant store elimination
Peter Waller [Mon, 19 Oct 2020 10:07:25 +0000 (10:07 +0000)]
[SVE][CodeGen][DAGCombiner] Fix TypeSize warning in redundant store elimination

The modified code in visitSTORE was missing a scalable vector check, and still
using the now deprecated implicit cast of TypeSize to uint64_t through the
overloaded operator. This patch fixes these issues.

This brings the logic in line with the comment on the context line immediately
above the added precondition.

Add a test in sve-redundant-store.ll that the warning is not triggered.

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

4 years agoRevert "[SVE][CodeGen][DAGCombiner] Fix TypeSize warning in redundant store elimination"
Peter Waller [Mon, 26 Oct 2020 16:37:00 +0000 (16:37 +0000)]
Revert "[SVE][CodeGen][DAGCombiner] Fix TypeSize warning in redundant store elimination"

This reverts commit 4604441386dc5fcd3165f4b39f5fa2e2c600f1bc.

Reverting because it was not the intended version of the patch, which
follows this patch.

4 years ago[SVE][CodeGen][DAGCombiner] Fix TypeSize warning in redundant store elimination
Peter Waller [Mon, 19 Oct 2020 10:07:25 +0000 (10:07 +0000)]
[SVE][CodeGen][DAGCombiner] Fix TypeSize warning in redundant store elimination

The modified code in visitSTORE was missing a scalable vector check, and still
using the now deprecated implicit cast of TypeSize to uint64_t through the
overloaded operator. This patch fixes these issues.

This brings the logic in line with the comment on the context line immediately
above the added precondition.

Add a test in Redundantstores.ll that the warning is not triggered.

4 years ago[libc++] Add a CI jobs to test the Standalone builds
Louis Dionne [Fri, 23 Oct 2020 20:27:41 +0000 (16:27 -0400)]
[libc++] Add a CI jobs to test the Standalone builds

4 years ago[InstCombine] Add bswap test pattern using truncates
Simon Pilgrim [Mon, 26 Oct 2020 16:11:03 +0000 (16:11 +0000)]
[InstCombine] Add bswap test pattern using truncates

4 years ago[OpenMP] changing OMP rtl to use shared memory instead of env variable
AndreyChurbanov [Mon, 26 Oct 2020 16:02:21 +0000 (19:02 +0300)]
[OpenMP] changing OMP rtl to use shared memory instead of env variable

Patch by Erdner, Todd <todd.erdner@intel.com>

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

4 years ago[AArch64] Add 2 cases where insertelement lowering could be improved.
Florian Hahn [Mon, 26 Oct 2020 15:34:29 +0000 (15:34 +0000)]
[AArch64] Add 2 cases where insertelement lowering could be improved.

4 years ago[X86] Use mtriple instead of march in MIR tests
Simon Pilgrim [Mon, 26 Oct 2020 15:20:14 +0000 (15:20 +0000)]
[X86] Use mtriple instead of march in MIR tests

4 years ago[VE] Add vector shift instructions
Kazushi (Jam) Marukawa [Mon, 26 Oct 2020 10:13:14 +0000 (19:13 +0900)]
[VE] Add vector shift instructions

Add VSLL/VSLD/VSRL/VSLA/VSLAX/VSRA/VSRAX/VSFA instructionss.  Add
additonal AsmParser for VSLD special operand.  Also add regression
tests.

Reviewed By: simoll

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

4 years ago[VE] Add vector logical instructions
Kazushi (Jam) Marukawa [Mon, 26 Oct 2020 09:58:22 +0000 (18:58 +0900)]
[VE] Add vector logical instructions

Add VAND/VOR/VXOE/VEQV/VLDZ/VPCNT/VBRV/VSEQ instrucitons and regression
tests.

Reviewed By: simoll

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

4 years ago[VE] Support atomic store
Kazushi (Jam) Marukawa [Sat, 24 Oct 2020 09:25:52 +0000 (18:25 +0900)]
[VE] Support atomic store

Support atomic store instructions and add a regression test.

Reviewed By: simoll

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

4 years ago[analyzer] [NFC] Simplify SVal::getAsLocSymbol function using existing functions
Denys Petrov [Mon, 26 Oct 2020 14:59:54 +0000 (16:59 +0200)]
[analyzer] [NFC] Simplify SVal::getAsLocSymbol function using existing functions

Summary: Method of obtaining MemRegion from LocAsInteger/MemRegionVal already exists in SVal::getAsRegion function. Replace repetitive conditions in SVal::getAsLocSymbol with SVal::getAsRegion function.

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

4 years ago[TableGen] [tests] Change integer ranges to use new '...' punctuation
Paul C. Anagnostopoulos [Fri, 23 Oct 2020 17:36:57 +0000 (13:36 -0400)]
[TableGen] [tests] Change integer ranges to use new '...' punctuation

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

4 years agoFix SBError::SetErrorToGenericError
Andy Yankovsky [Mon, 26 Oct 2020 14:31:35 +0000 (15:31 +0100)]
Fix SBError::SetErrorToGenericError

`SBError::SetErrorToGenericError` should call `Status::SetErrorToGenericError`,
not `Status::SetErrorToErrno`.

Reviewed By: teemperor

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

4 years ago[InstCombine] collectBitParts - add bitreverse intrinsic support.
Simon Pilgrim [Mon, 26 Oct 2020 14:26:14 +0000 (14:26 +0000)]
[InstCombine] collectBitParts - add bitreverse intrinsic support.

4 years ago[clangd] NFC: Update FIXME comment regarding lack of c/dtor support
Kirill Bobyrev [Mon, 26 Oct 2020 14:31:29 +0000 (15:31 +0100)]
[clangd] NFC: Update FIXME comment regarding lack of c/dtor support

Both `SymbolKind` and `indexSymbolKindToSymbolKind` support constructors and
separate them into a different category from regular methods.

Reviewed By: kadircet

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

4 years ago[lldb][NFC] Make GetShellSafeArgument simpler and faster
Raphael Isemann [Mon, 26 Oct 2020 14:03:58 +0000 (15:03 +0100)]
[lldb][NFC] Make GetShellSafeArgument simpler and faster

Escaping by inserting characters in the middle of a std::string isn't cheap.
It's much more verbose than just prepending a backslash in a loop.

4 years ago[InstCombine] Add bswap test pattern using bitreverse intrinsic
Simon Pilgrim [Mon, 26 Oct 2020 14:13:02 +0000 (14:13 +0000)]
[InstCombine] Add bswap test pattern using bitreverse intrinsic

This is mainly to help with future better bitreverse folding support but we can test it via bswap matching for now.

4 years ago[AMDGPU] Make more use of printNamedBit in AMDGPUInstPrinter. NFC.
Jay Foad [Mon, 26 Oct 2020 14:03:35 +0000 (14:03 +0000)]
[AMDGPU] Make more use of printNamedBit in AMDGPUInstPrinter. NFC.

4 years ago[LV] Add cost-model test for AArch64 select costs.
Florian Hahn [Mon, 26 Oct 2020 13:43:31 +0000 (13:43 +0000)]
[LV] Add cost-model test for AArch64 select costs.

Currently, the cost of some compare/select patterns is overestimated on
AArch64.

4 years ago[clangd] Fix remote index build failures due to lack of proto dependency
Kirill Bobyrev [Mon, 26 Oct 2020 13:14:12 +0000 (14:14 +0100)]
[clangd] Fix remote index build failures due to lack of proto dependency

Previous attempt (15f6bad6d74a993e366c8fc93a9c91f213ac6bc3) introduced
add_dependencies but unfortunately it does not actually add a dependency
between RemoteIndexProto and RemoteIndexServiceProto. This is likely due
to some requirements of it that clang_add_library violates.

As a workaround, we will link RemoteIndexProto library to
RemoteIndexServiceProto which is logical because the library can not be
without linking to RemoteIndexProto anyway.

4 years ago[MLIR][mlir-spirv-cpu-runner] A SPIR-V cpu runner prototype
George Mitenkov [Fri, 23 Oct 2020 14:46:18 +0000 (10:46 -0400)]
[MLIR][mlir-spirv-cpu-runner] A SPIR-V cpu runner prototype

This patch introduces a SPIR-V runner. The aim is to run a gpu
kernel on a CPU via GPU -> SPIRV -> LLVM conversions. This is a first
prototype, so more features will be added in due time.

- Overview
The runner follows similar flow as the other runners in-tree. However,
having converted the kernel to SPIR-V, we encode the bind attributes of
global variables that represent kernel arguments. Then SPIR-V module is
converted to LLVM. On the host side, we emulate passing the data to device
by creating in main module globals with the same symbolic name as in kernel
module. These global variables are later linked with ones from the nested
module. We copy data from kernel arguments to globals, call the kernel
function from nested module and then copy the data back.

- Current state
At the moment, the runner is capable of running 2 modules, nested one in
another. The kernel module must contain exactly one kernel function. Also,
the runner supports rank 1 integer memref types as arguments (to be scaled).

- Enhancement of JitRunner and ExecutionEngine
To translate nested modules to LLVM IR, JitRunner and ExecutionEngine were
altered to take an optional (default to `nullptr`) function reference that
is a custom LLVM IR module builder. This allows to customize LLVM IR module
creation from MLIR modules.

Reviewed By: ftynse, mravishankar

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

4 years ago[DAGCombine] Add test case showing incorrect DAGCombine optimization
Fraser Cormack [Mon, 26 Oct 2020 12:22:55 +0000 (12:22 +0000)]
[DAGCombine] Add test case showing incorrect DAGCombine optimization

This optmization produces incorrect results when the vector element type
is not byte-sized. Related to D78568.

4 years ago[llvm-ar][Object] Fix detection of need for 64-bit archive symbol tables
Andrew Ng [Wed, 21 Oct 2020 15:11:50 +0000 (16:11 +0100)]
[llvm-ar][Object] Fix detection of need for 64-bit archive symbol tables

The code to detect the requirement for 64-bit offsets in the archive
symbol table was not correctly accounting for the archive file signature
and the size of all the contents of the symbol table itself, e.g. the
symbol table's header and string table. Also was not considering the
variation in symbol table formats. This could result in the creation of
large archives with a corrupt symbol table.

Change the testing environment variable SYM64_THRESHOLD to be an
absolute value rather than a power of 2 in order to enable precise
testing of this detection code.

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

4 years ago[clang-fuzzer] CreateAndRunJITFunc - fix use after move static analyzer warning.
Simon Pilgrim [Mon, 26 Oct 2020 11:51:36 +0000 (11:51 +0000)]
[clang-fuzzer] CreateAndRunJITFunc - fix use after move static analyzer warning.

We were using the unique_ptr M to determine the triple after it had been moved in the EngineBuilder constructor.

4 years ago[MLIR][mlir-spirv-cpu-runner] A pass to emulate a call to kernel in LLVM
George Mitenkov [Fri, 23 Oct 2020 14:33:53 +0000 (10:33 -0400)]
[MLIR][mlir-spirv-cpu-runner] A pass to emulate a call to kernel in LLVM

This patch introduces a pass for running
`mlir-spirv-cpu-runner` - LowerHostCodeToLLVMPass.

This pass emulates `gpu.launch_func` call in LLVM dialect and lowers
the host module code to LLVM. It removes the `gpu.module`, creates a
sequence of global variables that are later linked to the varables
in the kernel module, as well as a series of copies to/from
them to emulate the memory transfer to/from the host or to/from the
device sides. It also converts the remaining Standard dialect into
LLVM dialect, emitting C wrappers.

Reviewed By: mravishankar

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

4 years ago[clang] Suppress "follow-up" diagnostics on recovery call expressions.
Haojian Wu [Mon, 26 Oct 2020 11:40:00 +0000 (12:40 +0100)]
[clang] Suppress "follow-up" diagnostics on recovery call expressions.

Because of typo-correction, the AST can be transformed, and the transformed
AST is marginally useful for diagnostics purpose, the following
diagnostics usually do harm than good (easily cause confusions).

Given the following code:

```
void abcc();
void test() {
  if (abc());
  // diagnostic 1 (for the typo-correction): the typo is correct to `abcc()`, so the code is treate as `if (abcc())` in AST perspective;
  // diagnostic 2 (for mismatch type): we perform an type-analysis on `if`, discover the type is not match
}
```

The secondary diagnostic "convertable to bool" is likely bogus to users.

The idea is to use RecoveryExpr (clang's dependent mechanism) to preserve the
recovery behavior but suppress all follow-up diagnostics.

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

4 years ago[InstCombine] Add support for zext(and(neg(amt),width-1)) rotate shift amount patterns
Simon Pilgrim [Mon, 26 Oct 2020 11:04:48 +0000 (11:04 +0000)]
[InstCombine] Add support for zext(and(neg(amt),width-1)) rotate shift amount patterns

Alive2: https://alive2.llvm.org/ce/z/bCvvHd

4 years ago[InstCombine] Add rotate tests where the shift amount is zero extended after masking
Simon Pilgrim [Mon, 26 Oct 2020 10:27:37 +0000 (10:27 +0000)]
[InstCombine] Add rotate tests where the shift amount is zero extended after masking

4 years agotsan: add mips64 support in lib/tsan/go/buildgo.sh
Dmitry Vyukov [Mon, 26 Oct 2020 11:18:54 +0000 (12:18 +0100)]
tsan: add mips64 support in lib/tsan/go/buildgo.sh

Enable mips64 support in buildgo.sh.

Author: mzh (Meng Zhuo)
Reviewed-in: https://reviews.llvm.org/D90130

4 years ago[llvm-mca] Add few memory instructions to cortex-a57 test
Evgeny Leviant [Mon, 26 Oct 2020 11:18:15 +0000 (14:18 +0300)]
[llvm-mca] Add few memory instructions to cortex-a57 test

4 years ago[NFC][InstrRefLDV] Fix a typo
Djordje Todorovic [Mon, 26 Oct 2020 10:59:46 +0000 (03:59 -0700)]
[NFC][InstrRefLDV] Fix a typo

4 years ago[lldb] Modernize PseudoTerminal::Fork
Pavel Labath [Wed, 14 Oct 2020 14:39:25 +0000 (16:39 +0200)]
[lldb] Modernize PseudoTerminal::Fork

4 years ago[lldb] Fix bitfield "frame var" for pointers (pr47743)
Pavel Labath [Mon, 12 Oct 2020 13:22:48 +0000 (15:22 +0200)]
[lldb] Fix bitfield "frame var" for pointers (pr47743)

Displaying large packed bitfields did not work if one was accessing them
through a pointer, and he used the "->" notation ("[0]." notation is
fine). The reason for that is that implicit dereference in -> is plumbed
all the way down to ValueObjectChild::UpdateValue, where the process of
fetching the child value was forked for this flag. The bitfield
"sliding" code was implemented only for the branch which did not require
dereferencing.

This patch restructures the function to avoid this mistake. Processing
now happens in two stages.
- first the parent is dereferenced (if needed)
- then the child value is computed (this step includes sliding and is
  common for both branches)

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

4 years ago[lldb] [Process/Linux] Reuse NativeRegisterContextWatchpoint_x86
Michał Górny [Sun, 25 Oct 2020 14:44:32 +0000 (15:44 +0100)]
[lldb] [Process/Linux] Reuse NativeRegisterContextWatchpoint_x86

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

4 years ago[lldb] [Process/NetBSD] Set xs_xstate_bv correctly when setting regs
Michał Górny [Sat, 24 Oct 2020 21:40:17 +0000 (23:40 +0200)]
[lldb] [Process/NetBSD] Set xs_xstate_bv correctly when setting regs

Ensure that xs_xstate_bv is set correctly before calling
WriteRegisterSet().  The bit can be clear if the relevant registers
were at their initial state when they were read, and it needs to be set
in order to apply changes from the XState structure.

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

4 years ago[lldb] [test/Register] Use initial state for write tests
Michał Górny [Sun, 25 Oct 2020 06:28:56 +0000 (07:28 +0100)]
[lldb] [test/Register] Use initial state for write tests

Reset registers to their 'initial' state instead of a semi-random
pattern in write tests.  While the latter might have been helpful
while debugging failures (i.e. to distinguish unmodified registers
from mistakenly written zeroes), the former makes it possible to test
whether xstate_bv field is written correctly when using XSAVE.

With this change, the four relevant tests start failing on NetBSD
without D90105.

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

4 years ago[lldb] [Process/FreeBSDRemote] Fix #include for i386 compat
Michał Górny [Sun, 25 Oct 2020 23:23:36 +0000 (00:23 +0100)]
[lldb] [Process/FreeBSDRemote] Fix #include for i386 compat

Include <x86/fpu.h> rather than <machine/fpu.h>, as the latter is not
present on i386.

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

4 years agoTry to fix buildbots after d3205bbca3e0002d76282878986993e7e7994779
Tyker [Mon, 26 Oct 2020 10:47:58 +0000 (11:47 +0100)]
Try to fix buildbots after d3205bbca3e0002d76282878986993e7e7994779

4 years ago[flang] Tighten rules to resolve procedure as intrinsic procedure
Jean Perier [Mon, 26 Oct 2020 10:25:40 +0000 (11:25 +0100)]
[flang] Tighten rules to resolve procedure as intrinsic procedure

2 Bug fixes:

- Do not resolve procedure as intrinsic if they appeared in an
  EXTERNAL attribute statement (one path was not considering this flag)

- Emit an error if a procedure resolved to be an intrinsic function
  (resp. subroutine) is used as a subroutine (resp. function).
  Lowering was attempted while the evaluate::Expression for the
  call was missing without any errors.

1 behavior change:

- Do not implicitly resolve subroutines (resp. functions) as intrinsics
  because their name is the name of an intrinsic function (resp.
  subroutine). Add justification in documentation.

Reviewed By: klausler, tskeith

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

4 years ago[Annotation] Allows annotation to carry some additional constant arguments.
Tyker [Mon, 26 Oct 2020 08:58:20 +0000 (09:58 +0100)]
[Annotation] Allows annotation to carry some additional constant arguments.

This allows using annotation in a much more contexts than it currently has.
especially when annotation with template or constexpr.

Reviewed By: aaron.ballman

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

4 years ago[VE] Add vector comparison and min/max
Kazushi (Jam) Marukawa [Sun, 18 Oct 2020 10:26:03 +0000 (19:26 +0900)]
[VE] Add vector comparison and min/max

Add VCMP/VCPS/VCPX/VCMS/VCMX vector instructions.  Also add regression
tests.

Reviewed By: simoll

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

4 years ago[VE] Add integer arithmetic vector instructions
Kazushi (Jam) Marukawa [Sun, 18 Oct 2020 10:10:43 +0000 (19:10 +0900)]
[VE] Add integer arithmetic vector instructions

Add VADD/VADS/VADX/VSUB/VSBS/VSBX/VMPY/VMPS/VMPX/VMPD/VDIV/VDVS/VDVX
instructions.  Also add regression tests.

Reviewed By: simoll

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

4 years ago[AsmPrinter] Add per BB instruction mix remark.
Florian Hahn [Mon, 26 Oct 2020 09:01:51 +0000 (09:01 +0000)]
[AsmPrinter] Add per BB instruction mix remark.

This patch adds a remarks that provides counts for each opcode per basic block.

An snippet of the generated information can be seen below.

The current implementation uses the target specific opcode for the counts. For example, on AArch64 this means we currently get 2 entries for `add` instructions if the block contains 32 and 64 bit adds. Similarly, immediate version are treated differently.

Unfortunately there seems to be no convenient way to get only the mnemonic part of the instruction as a string AFAIK. This could be improved in the future.

```
--- !Analysis
Pass:            asm-printer
Name:            InstructionMix
DebugLoc:        { File: arm64-instruction-mix-remarks.ll, Line: 30, Column: 30 }
Function:        foo
Args:
  - String:          'BasicBlock: '
  - BasicBlock:      else
  - String:          "\n"
  - String:          INST_MADDWrrr
  - String:          ': '
  - INST_MADDWrrr:   '2'
  - String:          "\n"
  - String:          INST_MOVZWi
  - String:          ': '
  - INST_MOVZWi:     '1'
```

Reviewed By: anemet, thegameg, paquette

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

4 years ago[AMDGPU] Emit new pal metadata by default
Sebastian Neubauer [Fri, 23 Oct 2020 09:21:03 +0000 (11:21 +0200)]
[AMDGPU] Emit new pal metadata by default

If no pal metadata is given, default to the msgpack format instead of
the legacy metadata. This makes tests better readable.

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

4 years ago[ARM][SchedModels] Rename and generalize predicate. NFC
Evgeny Leviant [Mon, 26 Oct 2020 09:14:55 +0000 (12:14 +0300)]
[ARM][SchedModels] Rename and generalize predicate. NFC

4 years ago[PowerPC] Add test case for pr47830. NFC.
Kai Luo [Mon, 26 Oct 2020 08:53:14 +0000 (08:53 +0000)]
[PowerPC] Add test case for pr47830. NFC.

4 years ago[VE] Support atomic load
Kazushi (Jam) Marukawa [Fri, 23 Oct 2020 13:10:34 +0000 (22:10 +0900)]
[VE] Support atomic load

Support atomic load instruction and add a regression test.
VE uses release consitency, so need to insert fence around
atomic instructions.  This patch enable AtomicExpandPass
and use emitLeadingFence and emitTrailingFence mechanism
for such purpose.

Reviewed By: simoll

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

4 years ago[ARM][SchedModels] Get rid of IsLdrAm2ScaledPred
Evgeny Leviant [Mon, 26 Oct 2020 09:01:39 +0000 (12:01 +0300)]
[ARM][SchedModels] Get rid of IsLdrAm2ScaledPred

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

4 years ago[ARM][SchedModels] Convert IsLdstsoMinusRegPred to MCSchedPredicate
Evgeny Leviant [Mon, 26 Oct 2020 08:54:08 +0000 (11:54 +0300)]
[ARM][SchedModels] Convert IsLdstsoMinusRegPred to MCSchedPredicate

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

4 years ago[ARM][SchedModels] Convert IsLdrAm3NegRegOffPred to MCSchedPredicate
Evgeny Leviant [Mon, 26 Oct 2020 08:43:02 +0000 (11:43 +0300)]
[ARM][SchedModels] Convert IsLdrAm3NegRegOffPred to MCSchedPredicate

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

4 years ago[gn build] Port 61bc18de0b2
LLVM GN Syncbot [Mon, 26 Oct 2020 08:07:25 +0000 (08:07 +0000)]
[gn build] Port 61bc18de0b2

4 years ago[Schedule] Add a MultiHazardRecognizer
David Green [Mon, 26 Oct 2020 08:06:17 +0000 (08:06 +0000)]
[Schedule] Add a MultiHazardRecognizer

This adds a MultiHazardRecognizer and starts to make use of it in the
ARM backend. The idea of the class is to allow multiple independent
hazard recognizers to be added to a single base MultiHazardRecognizer,
allowing them to all work in parallel without requiring them to be
chained into subclasses. They can then be added or not based on cpu or
subtarget features, which will become useful in the ARM backend once
more hazard recognizers are being used for various things.

This also renames ARMHazardRecognizer to ARMHazardRecognizerFPMLx in the
process, to more clearly explain what that recognizer is designed for.

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

4 years ago[VE] Support atomic fence
Kazushi (Jam) Marukawa [Sun, 25 Oct 2020 02:11:49 +0000 (11:11 +0900)]
[VE] Support atomic fence

Support atomic fence instruction and add a regression test.
Add MEMBARRIER pseudo insturction also to use it as a barrier
against to the compiler optimizations.

Reviewed By: simoll

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

4 years agoFix broken build after previous commit
Max Kazantsev [Mon, 26 Oct 2020 07:55:46 +0000 (14:55 +0700)]
Fix broken build after previous commit

4 years ago[NFC] Remove unused funciton param
Max Kazantsev [Mon, 26 Oct 2020 07:53:22 +0000 (14:53 +0700)]
[NFC] Remove unused funciton param

4 years ago[NFC] Factor out common code into lambda for further improvement
Max Kazantsev [Mon, 26 Oct 2020 07:49:37 +0000 (14:49 +0700)]
[NFC] Factor out common code into lambda for further improvement

4 years ago[IndVars] Use contextual knowledge when proving trivial conds
Max Kazantsev [Mon, 26 Oct 2020 06:47:11 +0000 (13:47 +0700)]
[IndVars] Use contextual knowledge when proving trivial conds

No exact example where it would help, but it's a generally a more
powerful way to prove predicates.

4 years ago[clangd] Add dependency on remote index service proto
Kirill Bobyrev [Mon, 26 Oct 2020 06:08:49 +0000 (07:08 +0100)]
[clangd] Add dependency on remote index service proto

It requires Index.proto to be built first. Failed builds:
https://github.com/clangd/clangd/runs/1305985916

4 years ago[AMDGPU] Avoid offset register in MUBUF for direct stack object accesses
Christudasan Devadasan [Fri, 9 Oct 2020 11:20:24 +0000 (16:50 +0530)]
[AMDGPU] Avoid offset register in MUBUF for direct stack object accesses

We use an absolute address for stack objects and
it would be necessary to have a constant 0 for soffset field.

Fixes: SWDEV-228562

Reviewed By: arsenm

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

4 years ago[X86] Don't disassemble wbinvd with 0xf2 or 0x66 prefix.
Craig Topper [Mon, 26 Oct 2020 03:40:45 +0000 (20:40 -0700)]
[X86] Don't disassemble wbinvd with 0xf2 or 0x66 prefix.

The 0xf3 prefix has been defined as wbnoinvd on Icelake Server. So
the prefix isn't ignored by the CPU. AMD documentation suggests that
wbnoinvd is treated as wbinvd on older processors. Intel documentation
is not clear. Perhaps 0xf2 and 0x66 are treated the same, but its
not documented.

This patch changes TB to PS in the td file so 0xf2 and 0x66 will
be treated as errors. This matches versions of objdump after
wbnoinvd was added.

4 years ago[X86] VEX/EVEX prefix doesn't work for inline assembly.
Liu, Chen3 [Fri, 23 Oct 2020 03:32:19 +0000 (11:32 +0800)]
[X86] VEX/EVEX prefix doesn't work for inline assembly.

For now, we lost the encoding information if we using inline assembly.
The encoding for the inline assembly will keep default even if we add
the vex/evex prefix.

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

4 years ago[X86] Use TargetConstant for immediates for VASTART_SAVE_XMM_REGS.
Craig Topper [Sun, 25 Oct 2020 19:46:53 +0000 (12:46 -0700)]
[X86] Use TargetConstant for immediates for VASTART_SAVE_XMM_REGS.

4 years ago[X86] Use TargetConstant instead of Constant for operands to X86vaarg64.
Craig Topper [Sun, 25 Oct 2020 19:19:05 +0000 (12:19 -0700)]
[X86] Use TargetConstant instead of Constant for operands to X86vaarg64.

4 years ago[CostModel] remove cost-kind predicate for some vector reduction costs
Sanjay Patel [Sun, 25 Oct 2020 19:17:52 +0000 (15:17 -0400)]
[CostModel] remove cost-kind predicate for some vector reduction costs

This is a modified 2nd try of 22d10b8ab44f
(reverted by 1c8371692d because it managed
to expose an existing crashing bug that should be fixed by
74ffc823 ).

Original commit message:

This is similar in spirit to 01ea93d85d6e (memcpy) except that
here the underlying caller assumptions were created for vectorizer
use (throughput) rather than other passes.

That meant targets could have an enormous throughput cost with no
corresponding size, latency, or blended cost increase.
The ARM costs show a small difference between throughput and
size because there's an underlying difference in cmp/sel
costs that is also predicated on cost-kind.

Paraphrasing from the previous commits:
This may not make sense for some callers, but at least now the
costs will be consistently wrong instead of mysteriously wrong.

Targets should provide better overrides if the current modeling
is not accurate.

4 years ago[CostModel] fix operand/type accounting for fadd/fmul reductions
Sanjay Patel [Sun, 25 Oct 2020 18:58:13 +0000 (14:58 -0400)]
[CostModel] fix operand/type accounting for fadd/fmul reductions

I'm not sure if/how this ever worked, but it must not be tested
currently because the basic tests added here were crashing as
noted in the post-review comments for 1c83716 (which reverted
another cost-model fix in 22d10b8ab44f).

4 years ago[SCEV] Strenthen nowrap flags after constant folding for mul exprs
Nikita Popov [Sun, 25 Oct 2020 18:39:07 +0000 (19:39 +0100)]
[SCEV] Strenthen nowrap flags after constant folding for mul exprs

Same change as 0dda6333175c1749f12be660456ecedade3bcf21, but for
mul expressions. We want to first fold any constant operans and
then strengthen the nowrap flags, as we can compute more precise
flags at that point.

4 years agoThread safety analysis: Nullability improvements in TIL, NFCI
Aaron Puchert [Sat, 25 Jul 2020 23:53:32 +0000 (01:53 +0200)]
Thread safety analysis: Nullability improvements in TIL, NFCI

The constructor of Project asserts that the contained ValueDecl is not
null, use that in the ThreadSafetyAnalyzer. In the case of LiteralPtr
it's the other way around.

Also dyn_cast<> is sufficient if we know something isn't null.

4 years agoThread safety analysis: Consider global variables in scope
Aaron Puchert [Sun, 25 Oct 2020 18:31:53 +0000 (19:31 +0100)]
Thread safety analysis: Consider global variables in scope

Instead of just mutex members we also consider mutex globals.
Unsurprisingly they are always in scope. Now the paper [1] says that

> The scope of a class member is assumed to be its enclosing class,
> while the scope of a global variable is the translation unit in
> which it is defined.

But I don't think we should limit this to TUs where a definition is
available - a declaration is enough to acquire the mutex, and if a mutex
is really limited in scope to a translation unit, it should probably be
only declared there.

The previous attempt in 9dcc82f34ea was causing false positives because
I wrongly assumed that LiteralPtrs were always globals, which they are
not. This should be fixed now.

[1] https://static.googleusercontent.com/media/research.google.com/en/us/pubs/archive/42958.pdf

Fixes PR46354.

Reviewed By: aaron.ballman

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

4 years ago[SCEV] Always constant fold mul expression operands
Nikita Popov [Sun, 25 Oct 2020 17:46:27 +0000 (18:46 +0100)]
[SCEV] Always constant fold mul expression operands

Establish parity with the handling of add expressions, by always
constant folding mul expression operands before checking the depth
limit (this is a non-recursive simplification). The code was already
unconditionally constant folding the case where all operands were
constants, but was not folding multiple constant operands together
if there were also non-constant operands.

This requires picking out a different demonstration for depth-based
folding differences in the limit-depth.ll test.

4 years ago[SCEV] Separate out constant folding in mul expr creation
Nikita Popov [Sun, 25 Oct 2020 17:14:20 +0000 (18:14 +0100)]
[SCEV] Separate out constant folding in mul expr creation

Separate out the code handling constant folding into a separate
block, that is independent of other folds that need a constant
first operand. Also make some minor adjustments to make the
constant folding look nearly identical to the same code in
getAddExpr().

The only reason this change is not strictly NFC is that the
C1*(C2+V) fold is moved below the constant folding, which means
that it now also applies to C1*C2*(C3+V), as it should.

4 years ago[SCEV] Strength nowrap flags after constant folding
Nikita Popov [Sun, 25 Oct 2020 16:13:38 +0000 (17:13 +0100)]
[SCEV] Strength nowrap flags after constant folding

We should first try to constant fold the add expression and only
strengthen nowrap flags afterwards. This allows us to determine
stronger flags if e.g. only two operands are left after constant
folding (and thus "guaranteed no wrap region" code applies) or the
resulting operands are non-negative and thus nsw->nuw strengthening
applies.

4 years ago[IndVars] Regenerate test checks (NFC)
Nikita Popov [Sun, 25 Oct 2020 16:15:55 +0000 (17:15 +0100)]
[IndVars] Regenerate test checks (NFC)

Also run the test case through -instnamer.

4 years ago[InstSimplify] peek through 'not' operand in logic-of-icmps fold
Sanjay Patel [Sun, 25 Oct 2020 15:09:35 +0000 (11:09 -0400)]
[InstSimplify] peek through 'not' operand in logic-of-icmps fold

This extends D78430 to solve cases like:
https://llvm.org/PR47858

There are still missed opportunities shown in the tests,
and as noted in the earlier patches, we have related
functionality in InstCombine, so we may want to extend
other folds in a similar way.

A semi-random sampling of test diff proofs in this patch:
https://rise4fun.com/Alive/sS4C

4 years ago[InstSimplify] add tests for logic-of-cmps with not op; NFC
Sanjay Patel [Sun, 25 Oct 2020 14:30:23 +0000 (10:30 -0400)]
[InstSimplify] add tests for logic-of-cmps with not op; NFC

One variant of this is shown in:
https://llvm.org/PR47858

4 years agoCorrect LIT test failure detected on buildbot after mibintc committed rG2e204e23911b...
Melanie Blower [Sun, 25 Oct 2020 15:10:24 +0000 (08:10 -0700)]
Correct LIT test failure detected on buildbot after mibintc committed rG2e204e23911b: [clang] Enable support for #pragma STDC FENV_ACCESS D87528

4 years ago[SLP] Add AArch64 tests with vectorizable compare/select patterns.
Florian Hahn [Sun, 25 Oct 2020 12:57:05 +0000 (12:57 +0000)]
[SLP] Add AArch64 tests with vectorizable compare/select patterns.

This patch adds an additional set of tests that can be vectorized
efficiently on AArch64, using CMxx & BFI.

4 years agoRemove superfluous whitespace around if(). NFC.
Simon Pilgrim [Sun, 25 Oct 2020 14:14:09 +0000 (14:14 +0000)]
Remove superfluous whitespace around if(). NFC.

4 years ago[clang] Enable support for #pragma STDC FENV_ACCESS
Melanie Blower [Tue, 29 Sep 2020 17:44:36 +0000 (10:44 -0700)]
[clang] Enable support for #pragma STDC FENV_ACCESS

Reviewers: rjmccall, rsmith, sepavloff

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

4 years ago[InstCombine] matchBSwapOrBitReversem - recognise or(fshl(),fshl()) bswap patterns.
Simon Pilgrim [Sun, 25 Oct 2020 10:17:45 +0000 (10:17 +0000)]
[InstCombine] matchBSwapOrBitReversem - recognise or(fshl(),fshl()) bswap patterns.

I'm not certain InstCombinerImpl::matchBSwapOrBitReverse needs to filter the or(op0(),op1()) ops - there are just too many cases that recognizeBSwapOrBitReverseIdiom/collectBitParts handle now (and quickly).

4 years ago[InstCombine] Add test for or(fshl(),fshl()) bswap pattern.
Simon Pilgrim [Sun, 25 Oct 2020 10:07:19 +0000 (10:07 +0000)]
[InstCombine] Add test for or(fshl(),fshl()) bswap pattern.

Currently InstCombinerImpl::matchBSwapOrBitReverse won't match starting from funnel shifts.

4 years ago[c++20] For P0732R2: Support string literal operator templates.
Richard Smith [Sun, 25 Oct 2020 07:28:48 +0000 (00:28 -0700)]
[c++20] For P0732R2: Support string literal operator templates.

4 years ago[X86] Use TargetConstant for FPDiff with X86::TC_RETURN.
Craig Topper [Sun, 25 Oct 2020 07:25:19 +0000 (00:25 -0700)]
[X86] Use TargetConstant for FPDiff with X86::TC_RETURN.

It's required to be a constant and can never be in a register so
make it explicit.

4 years agoRevert "[CostModel] remove cost-kind predicate for vector reduction costs"
Martin Storsjö [Sun, 25 Oct 2020 06:35:33 +0000 (08:35 +0200)]
Revert "[CostModel] remove cost-kind predicate for vector reduction costs"

This reverts commit 22d10b8ab44f703b72b8316a9b3b8adc623ca73f.

This broke compilation e.g. like this:
$ cat synth.c
*a;
float *b;
c() {
  for (;;) {
    float d = -*b * *a++;
    d -= *--b * *a++;
    d -= *--b * *a;
    d -= *--b * *a;
    e(d);
  }
}
$ clang -target x86_64-linux-gnu -c -O2 -ffast-math synth.c
clang: ../include/llvm/Support/Casting.h:104: static bool llvm::isa_impl
_cl<To, const From*>::doit(const From*) [with To = llvm::PointerType; Fr
om = llvm::Type]: Assertion `Val && "isa<> used on a null pointer"' fail
ed.

4 years ago[MemProf] Temporarily disable part of test
Teresa Johnson [Sun, 25 Oct 2020 06:07:34 +0000 (23:07 -0700)]
[MemProf] Temporarily disable part of test

Disable the part of this test that started failing only on the
llvm-avr-linux bot after 5c20d7db9f2791367b9311130eb44afecb16829c.
Unfortunately, "XFAIL: avr" does not work. Still in the process of
trying to figure out how to debug.

4 years agoFor P0732R2, P1907R1: ensure that template parameter objects don't refer
Richard Smith [Sun, 25 Oct 2020 05:08:24 +0000 (22:08 -0700)]
For P0732R2, P1907R1: ensure that template parameter objects don't refer
to disallowed objects or have non-constant destruction.

4 years ago[clangd] Add a TestWorkspace utility
Nathan Ridge [Tue, 13 Oct 2020 06:09:45 +0000 (02:09 -0400)]
[clangd] Add a TestWorkspace utility

TestWorkspace allows easily writing tests involving multiple
files that can have inclusion relationships between them.

BackgroundIndexTest.RelationsMultiFile is refactored to use
TestWorkspace, and moved to FileIndexTest as it no longer
depends on BackgroundIndex.

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

4 years agoFix typo SSC -> SCC
Arthur Eubanks [Sat, 24 Oct 2020 23:26:48 +0000 (16:26 -0700)]
Fix typo SSC -> SCC

4 years ago[ELF] Don't crash on R_X86_64_GOTPCRELX for test/binop instructions
Fangrui Song [Sat, 24 Oct 2020 22:13:47 +0000 (15:13 -0700)]
[ELF] Don't crash on R_X86_64_GOTPCRELX for test/binop instructions

While MC did not produce R_X86_64_GOTPCRELX for test/binop instructions
(movl/adcl/addl/andl/...) before the previous commit, this code path has been
exercised by -fno-integrated-as for GNU as since 2016: -no-pie relaxing
may incorrectly access loc[-3] and produce a corrupted instruction.

Simply handle test/binop R_X86_64_GOTPCRELX like R_X86_64_GOTPCREL.

4 years ago[X86] Produce R_X86_64_GOTPCRELX for test/binop instructions (MOV32rm/TEST32rm/....
Fangrui Song [Sat, 24 Oct 2020 20:48:55 +0000 (13:48 -0700)]
[X86] Produce R_X86_64_GOTPCRELX for test/binop instructions (MOV32rm/TEST32rm/...) when -Wa,-mrelax-relocations=yes is enabled

We have been producing R_X86_64_REX_GOTPCRELX (MOV64rm/TEST64rm/...) and
R_X86_64_GOTPCRELX for CALL64m/JMP64m without the REX prefix since 2016 (to be
consistent with GNU as), but not for MOV32rm/TEST32rm/...

4 years ago[asan] Fix stack-use-after-free checks on non-main thread on Fuchsia
Drew Fisher [Sat, 24 Oct 2020 21:24:10 +0000 (14:24 -0700)]
[asan] Fix stack-use-after-free checks on non-main thread on Fuchsia

While some platforms call `AsanThread::Init()` from the context of the
thread being started, others (like Fuchsia) call `AsanThread::Init()`
from the context of the thread spawning a child.  Since
`AsyncSignalSafeLazyInitFakeStack` writes to a thread-local, we need to
avoid calling it from the spawning thread on Fuchsia.  Skipping the call
here on Fuchsia is fine; it'll get called from the new thread lazily on first
attempted access.

Reviewed By: vitalybuka

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

4 years ago[asan][fuchsia] set current thread before reading thread state
Drew Fisher [Sat, 24 Oct 2020 19:26:40 +0000 (12:26 -0700)]
[asan][fuchsia] set current thread before reading thread state

When enabling stack use-after-free detection, we discovered that we read
the thread ID on the main thread while it is still set to 2^24-1.

This patch moves our call to AsanThread::Init() out of CreateAsanThread,
so that we can call SetCurrentThread first on the main thread.

Reviewed By: mcgrathr

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

4 years ago[AArch64][GlobalISel] Fix -Wunused-variable. NFC
Fangrui Song [Sat, 24 Oct 2020 19:46:47 +0000 (12:46 -0700)]
[AArch64][GlobalISel] Fix -Wunused-variable. NFC

4 years agoRevert "hwasan: Disable operator {new,delete} interceptors when interceptors are...
Nico Weber [Sat, 24 Oct 2020 19:04:22 +0000 (15:04 -0400)]
Revert "hwasan: Disable operator {new,delete} interceptors when interceptors are disabled."

This reverts commit fa66bcf4bc9467514dddacdba711a42e0a83cf9d.
Seems to break tests, see https://reviews.llvm.org/D89827#2351930

4 years ago[CostModel] remove cost-kind predicate for vector reduction costs
Sanjay Patel [Fri, 23 Oct 2020 17:44:45 +0000 (13:44 -0400)]
[CostModel] remove cost-kind predicate for vector reduction costs

This is similar in spirit to 01ea93d85d6e (memcpy) except that
here the underlying caller assumptions were created for vectorizer
use (throughput) rather than other passes.

That meant targets could have an enormous throughput cost with no
corresponding size, latency, or blended cost increase.
The ARM costs show a small difference between throughput and
size because there's an underlying difference in cmp/sel
costs that is also predicated on cost-kind.

Paraphrasing from the previous commits:
This may not make sense for some callers, but at least now the
costs will be consistently wrong instead of mysteriously wrong.

Targets should provide better overrides if the current modeling
is not accurate.

4 years ago[X86] Add a stub for Intel's alderlake.
Benjamin Kramer [Sat, 24 Oct 2020 16:00:33 +0000 (18:00 +0200)]
[X86] Add a stub for Intel's alderlake.

No scheduling, no autodetection.