platform/upstream/llvm.git
4 years ago[ARM][MachineOutliner] Add NoLRSave mode.
Yvan Roux [Thu, 11 Jun 2020 06:45:46 +0000 (08:45 +0200)]
[ARM][MachineOutliner] Add NoLRSave mode.

Outline chunks of code which don't need a save/restore mechanism of the
link register.

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

4 years agoRestore part of D80450 [CUDA][HIP] Fix implicit HD function resolution
Fangrui Song [Thu, 11 Jun 2020 05:32:43 +0000 (22:32 -0700)]
Restore part of D80450 [CUDA][HIP] Fix implicit HD function resolution

The "if (S.getLangOpts().CUDA && Cand1.Function && Cand2.Function) {"
part is known to be problematic but the root cause isn't clear yet.

4 years ago[X86] Use X86AS enum constants to replace hardcoded numbers in more places. NFC
Craig Topper [Thu, 11 Jun 2020 05:31:21 +0000 (22:31 -0700)]
[X86] Use X86AS enum constants to replace hardcoded numbers in more places. NFC

4 years ago[X86] Move X86 stuff out of TargetParser.h and into the recently created X86TargetPar...
Craig Topper [Thu, 11 Jun 2020 04:25:15 +0000 (21:25 -0700)]
[X86] Move X86 stuff out of TargetParser.h and into the recently created X86TargetParser.h. NFC

4 years ago[libc] Fix integration test header dependency.
Paula Toth [Thu, 11 Jun 2020 04:33:56 +0000 (21:33 -0700)]
[libc] Fix integration test header dependency.

4 years agoRevert "[X86] Move X86 stuff out of TargetParser.h and into the recently created...
Craig Topper [Thu, 11 Jun 2020 04:24:44 +0000 (21:24 -0700)]
Revert "[X86] Move X86 stuff out of TargetParser.h and into the recently created X86TargetParser.h. NFC"

This reverts commit 874800b4f7e4312a283b0638e832ec92a88540f4.

Forgot to update the clang includes

4 years ago[X86] Move X86 stuff out of TargetParser.h and into the recently created X86TargetPar...
Craig Topper [Thu, 11 Jun 2020 00:57:47 +0000 (17:57 -0700)]
[X86] Move X86 stuff out of TargetParser.h and into the recently created X86TargetParser.h. NFC

4 years ago[StackSafety] Pass summary into codegen
Vitaly Buka [Tue, 2 Jun 2020 08:19:57 +0000 (01:19 -0700)]
[StackSafety] Pass summary into codegen

Summary:
The patch wraps ThinLTO index into immutable
pass which can be used by StackSafety analysis.

Reviewers: eugenis, pcc

Reviewed By: eugenis

Subscribers: hiraditya, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

4 years agoRevert "[PowerPC][NFC] Testing ROTL of v1i128."
Kai Luo [Thu, 11 Jun 2020 03:45:33 +0000 (11:45 +0800)]
Revert "[PowerPC][NFC] Testing ROTL of v1i128."

This reverts commit c79ab63e839b2621405f4472c46f88bfc7a30257 which is
committed by accident.

4 years agoFix __clang_cuda_math_forward_declares.h
Yaxun (Sam) Liu [Thu, 11 Jun 2020 03:41:51 +0000 (23:41 -0400)]
Fix __clang_cuda_math_forward_declares.h

Recent change from `#if !defined(__CUDA__)` to `#if !__CUDA__` caused
regression on ROCm 3.5 since there is `#define __CUDA__`
before inclusion of the header file, which causes `#if !__CUDA__`
to be invalid.

Change `#if !__CUDA__` back to `#if !defined(__CUDA__)` for backward
compatibility.

4 years ago[PowerPC][NFC] Testing ROTL of v1i128.
Esme-Yi [Thu, 11 Jun 2020 02:40:58 +0000 (02:40 +0000)]
[PowerPC][NFC] Testing ROTL of v1i128.

Summary: Add RUN lines for pwr8.

4 years ago[libc++] Consider everything inside %T to be a dependency of each test
Louis Dionne [Wed, 10 Jun 2020 18:41:47 +0000 (14:41 -0400)]
[libc++] Consider everything inside %T to be a dependency of each test

Instead of passing file dependencies individually, assume that the
whole content of the unique test directory is a dependency. This
simplifies the test harness significantly, by making %T the directory
that contains everything required to run a test. This also removes the
need for the %{file_dependencies} substitution, which is removed by this
patch.

Furthermore, this patch also changes the harness to execute tests locally
inside %T, so as to avoid creating a separate directory for no purpose.

4 years ago[SPARC] Lower fp16 ops to libcalls
LemonBoy [Wed, 10 Jun 2020 02:17:43 +0000 (19:17 -0700)]
[SPARC] Lower fp16 ops to libcalls

The fp16 ops are legalized by extending/chopping them as needed.
The tests are shamelessly stolen from the RISC-V backend.

Recommit with fixed RUN lines for the test.

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

4 years agoAMDGPU/GlobalISel: Fix porting error in 32-bit division
Matt Arsenault [Thu, 11 Jun 2020 01:27:03 +0000 (21:27 -0400)]
AMDGPU/GlobalISel: Fix porting error in 32-bit division

The baffling thing is this passed the OpenCL conformance test for
32-bit integer divisions, but only failed in the 32-bit path of
BypassSlowDivisions for the 64-bit tests.

4 years ago[Debugger] Use FileSystem instead of calling openFileForWrite directly.
Jonas Devlieghere [Thu, 11 Jun 2020 01:12:59 +0000 (18:12 -0700)]
[Debugger] Use FileSystem instead of calling openFileForWrite directly.

This replaces the (only) call to llvm::sys::fs::openFileForWrite with
FileSystem::Open. This guarantees that we include log files in the
reproducers.

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

4 years agoRevert "[mlir][spirv] Enhance structure type member decoration handling"
Mehdi Amini [Thu, 11 Jun 2020 00:45:33 +0000 (00:45 +0000)]
Revert "[mlir][spirv] Enhance structure type member decoration handling"

This reverts commit 4b7aa6c8c1b0f68c6800225b39b3b389adf31332.

This broke gcc builds.

4 years agoRevert D80450 "[CUDA][HIP] Fix implicit HD function resolution"
Fangrui Song [Thu, 11 Jun 2020 00:40:04 +0000 (17:40 -0700)]
Revert D80450 "[CUDA][HIP] Fix implicit HD function resolution"

This reverts commit 263390d4f5f23967a31af09eb6e0c12e633d6104.

This can still cause bogus errors:

eigen3/Eigen/src/Core/CoreEvaluators.h:94:38: error: call to implicitly-deleted copy constructor of 'unary_evaluator<Eigen::Inverse<Eigen::Matrix<double, 4, 4, 0, 4, 4>>>'

thrust/system/detail/generic/for_each.h:49:3: error: implicit instantiation of undefined template
'thrust::detail::STATIC_ASSERTION_FAILURE<false>'

4 years ago[MLIR] Emit debug message if inlining fails
Rahul Joshi [Thu, 11 Jun 2020 00:37:59 +0000 (17:37 -0700)]
[MLIR] Emit debug message if inlining fails

Summary: Emit a debug message if inlining fails.

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

4 years ago[MLIR] Add ArrayAttr::empty()
Rahul Joshi [Thu, 11 Jun 2020 00:34:02 +0000 (17:34 -0700)]
[MLIR] Add ArrayAttr::empty()

Summary: Add ArrayAttr::empty() to check for an empty ArrayAttr

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

4 years ago[DWARFYAML][debug_ranges] Make the "Offset" field optional.
Xing GUO [Thu, 11 Jun 2020 00:36:06 +0000 (08:36 +0800)]
[DWARFYAML][debug_ranges] Make the "Offset" field optional.

Before this patch, we have to calculate the offset for the current range list entry. This patch helps make the "Offset" field optional.

Reviewed By: jhenderson

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

4 years ago[DWARFYAML] Add support for emitting DWARF64 .debug_aranges section.
Xing GUO [Thu, 11 Jun 2020 00:34:11 +0000 (08:34 +0800)]
[DWARFYAML] Add support for emitting DWARF64 .debug_aranges section.

The `debug_info_offset`(`CuOffset`) should be 64-bit width rather than 32-bit width in DWARF64 .debug_aranges section. This patch helps resolve it.

Reviewed By: jhenderson

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

4 years agoSupport other llc-like tools in update_llc_test_checks.py
Daniel Sanders [Mon, 1 Jun 2020 18:50:53 +0000 (11:50 -0700)]
Support other llc-like tools in update_llc_test_checks.py

Summary:
If you have downstream tools that are llc-like (e.g, llc with different
defaults), it's convenient to still be able to use
`update_llc_test_checks` with them. Refactor slightly to allow such tools
to be supported by adding them to LLC_LIKE_TOOLS

Reviewers: bogner

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[MLIR] Print function name when ReturnOp verification fails
Rahul Joshi [Thu, 11 Jun 2020 00:22:30 +0000 (17:22 -0700)]
[MLIR] Print function name when ReturnOp verification fails

Summary:
- Print function name when ReturnOp verification fails
- This helps easily finding the invalid ReturnOp in an IR dump.

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

4 years ago[mlir][StandardOps] Updated IndexCastOp to support tensor<index> cast
Rob Suderman [Thu, 11 Jun 2020 00:18:33 +0000 (17:18 -0700)]
[mlir][StandardOps] Updated IndexCastOp to support tensor<index> cast

Summary:
We now support index casting for tensor<index> to tensor<int>. This
better supports compatibility with the Shape dialect.

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

4 years ago[mlir][NFC] Split Parser into several different files.
River Riddle [Wed, 10 Jun 2020 23:58:55 +0000 (16:58 -0700)]
[mlir][NFC] Split Parser into several different files.

Summary: At this point Parser has grown to be over 5000 lines and can be very difficult to navigate/update/etc. This commit splits Parser.cpp into several sub files focused on parsing specific types of entities; e.g., Attributes, Types, etc.

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

4 years ago[InstCombine] Remove some repeated calls to getOperand. NFCI
Craig Topper [Wed, 10 Jun 2020 23:54:09 +0000 (16:54 -0700)]
[InstCombine] Remove some repeated calls to getOperand. NFCI

We had alread loaded operand 1 and 2 of the select as TV and FV
using the more the readable getTrueValue/getFalseValue.

4 years ago[mlir][spirv] Enhance structure type member decoration handling
HazemAbdelhafez [Wed, 10 Jun 2020 23:15:55 +0000 (19:15 -0400)]
[mlir][spirv] Enhance structure type member decoration handling

Modify structure type in SPIR-V dialect to support:
1) Multiple decorations per structure member
2) Key-value based decorations (e.g., MatrixStride)

This commit kept the Offset decoration separate from members'
decorations container for easier implementation and logical clarity.
As such, all references to Structure layoutinfo are now offsetinfo,
and any member layout defining decoration (e.g., RowMajor for Matrix)
will be add to the members' decorations container along with its
value if any.

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

4 years ago[MLIR][SPIRVToLLVM] Implemented conversion for arithmetic ops and 3 bitwise ops.
George Mitenkov [Wed, 10 Jun 2020 23:10:26 +0000 (19:10 -0400)]
[MLIR][SPIRVToLLVM] Implemented conversion for arithmetic ops and 3 bitwise ops.

Following the previous revision `D81100`, this commit implements a templated class
that would provide conversion patterns for “straightforward” SPIR-V ops into
LLVM dialect. Templating allows to abstract away from concrete implementation
for each specific op. Those are mainly binary operations. Currently supported
and tested ops are:
- Arithmetic ops: `IAdd`, `ISub`, `IMul`, `FAdd`, `FSub`, `FMul`, `FDiv`,  `FNegate`,
  `SDiv`, `SRem` and  `UDiv`
- Bitwise ops: `BitwiseAnd`, `BitwiseOr`, `BitwiseXor`

The implementation relies on `SPIRVToLLVMConversion` class that makes use of
`OpConversionPattern`.

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

4 years ago[LLD][ThinLTO] Add --thinlto-single-module to allow compiling partial modules.
Hongtao Yu [Thu, 21 May 2020 20:19:44 +0000 (13:19 -0700)]
[LLD][ThinLTO] Add --thinlto-single-module to allow compiling partial modules.

This change introduces an LLD switch --thinlto-single-module to allow compiling only a part of the input modules. This is specifically enables:

  1. Fast investigating/debugging modules of interest without spending time on compiling unrelated modules.
  2. Compiler debug dump with -mllvm -debug-only= for specific modules.

It will be useful for large applications which has 1K+ input modules for thinLTO.

The switch can be combined with `--lto-obj-path=` or `--lto-emit-asm` to obtain intermediate object files or assembly files. So far the module name matching is implemented as a fuzzy name lookup where the modules with name containing the switch value are compiled.

E.g,
Command:
     ld.lld main.o thin.a --thinlto-single-module=thin.a --lto-obj-path=single.o
log:
     [ThinLTO] Selecting thin.a(thin1.o at 168) to compile
     [ThinLTO] Selecting thin.a(thin2.o at 228) to compile
Command:
     ld.lld main.o thin.a --thinlto-single-module=thin1.o --lto-obj-path=single.o
log:
     [ThinLTO] Selecting thin.a(thin1.o at 168) to compile

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

4 years ago[X86] Add an Unoptimized Load Value Injection (LVI) Load Hardening Pass
Scott Constable [Wed, 10 Jun 2020 22:31:47 +0000 (15:31 -0700)]
[X86] Add an Unoptimized Load Value Injection (LVI) Load Hardening Pass

@nikic raised an issue on D75936 that the added complexity to the O0 pipeline was causing noticeable slowdowns for `-O0` builds. This patch addresses the issue by adding a pass with equal security properties, but without any optimizations (and more importantly, without the need for expensive analysis dependencies).

Reviewers: nikic, craig.topper, mattdr

Reviewed By: craig.topper, mattdr

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

4 years ago[libc][Obvious] Use full path with cmake's if(EXISTS ...).
Siva Chandra Reddy [Wed, 10 Jun 2020 22:06:50 +0000 (15:06 -0700)]
[libc][Obvious] Use full path with cmake's if(EXISTS ...).

That if(EXISTS ...) works only with full paths was missed in couple of
places a in recent cleanup.

4 years ago[lldb/Test] Add 'std-module' category and skip them with reproducers
Jonas Devlieghere [Wed, 10 Jun 2020 21:58:06 +0000 (14:58 -0700)]
[lldb/Test] Add 'std-module' category and skip them with reproducers

These tests are flaky on the reproducer bot. I suspect it has something
to do with the module cache. Skipping the whole category while I
investigate the issue.

4 years ago[mlir][linalg] Add a builder for `linalg.(indexed_)generic`.
Alexander Belyaev [Wed, 10 Jun 2020 19:45:18 +0000 (21:45 +0200)]
[mlir][linalg] Add a builder for `linalg.(indexed_)generic`.

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

4 years ago[X86] Call LowerADDRSPACECAST directly from ReplaceNodeResults to avoid repeating...
Craig Topper [Wed, 10 Jun 2020 21:39:02 +0000 (14:39 -0700)]
[X86] Call LowerADDRSPACECAST directly from ReplaceNodeResults to avoid repeating identical code. NFC

4 years ago[X86] Add a 32-bit version of mixed-ptr-sizes.ll to make sure we get code coverage...
Craig Topper [Wed, 10 Jun 2020 21:18:00 +0000 (14:18 -0700)]
[X86] Add a 32-bit version of mixed-ptr-sizes.ll to make sure we get code coverage on the ADDRSPACECAST handling in ReplaceNodeResults. NFC

4 years agoDisallow trivial_abi on a class if all copy and move constructors are
Akira Hatanaka [Tue, 9 Jun 2020 19:02:25 +0000 (12:02 -0700)]
Disallow trivial_abi on a class if all copy and move constructors are
deleted

Instead of forcing the class to be passed in registers, which was what
r350920 did, issue a warning and inform the user that the attribute
cannot be used.

For more background, see this discussion:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20190128/259907.html

This fixes PR39683.

rdar://problem/47308221

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

4 years agodebugserver: Enable -DLLDB_ENERGY when compiling against an internal SDK
Adrian Prantl [Wed, 10 Jun 2020 21:09:23 +0000 (14:09 -0700)]
debugserver: Enable -DLLDB_ENERGY when compiling against an internal SDK

This brings over functionality from the xcodeproject that went missing during the CMake transition.

rdar://problem/63840635

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

4 years ago[libcxx][test] MSVC's __is_trivially_copyable is fixed in VS 16.7
Casey Carter [Wed, 10 Jun 2020 20:55:33 +0000 (13:55 -0700)]
[libcxx][test] MSVC's __is_trivially_copyable is fixed in VS 16.7

... so we can disable `TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE`.

4 years agoRevert "[clang] Frontend components for the relative vtables ABI"
Leonard Chan [Wed, 10 Jun 2020 20:50:05 +0000 (13:50 -0700)]
Revert "[clang] Frontend components for the relative vtables ABI"

This reverts commit 2e009dbcb3e373a59e6e84dce6d51ae8a29f60a5.

Reverting since there were some test failures on buildbots that used the
new pass manager. ASan and MSan are also finding some bugs in this that
I'll need to address.

4 years ago[clang] Use IsVolatile=true and RequiresNullTerminator=false for PCMs
Michael Spencer [Wed, 10 Jun 2020 20:37:03 +0000 (14:37 -0600)]
[clang] Use IsVolatile=true and RequiresNullTerminator=false for PCMs

This change got missed while upstreaming
https://reviews.llvm.org/D77772. This is the part of that change that
actually passes the correct arguments when opening a PCM.

The test didn't catch this because it starts at the
`MemoryBuffer::getOpenFile` level. It's not really possible to test
`ModuleManager::addModule` itself to verify how the file was opened.

4 years ago[libc++] Make sure tests are run in a unique directory
Louis Dionne [Wed, 10 Jun 2020 18:11:25 +0000 (14:11 -0400)]
[libc++] Make sure tests are run in a unique directory

This will allow simplifying executors by always just copying the whole
%T, and assuming that all file dependencies are contained in it.

Superseeds https://reviews.llvm.org/D78245, which tried to make %T unique
in Lit, but which encountered push back.

4 years agoAMDGPU/GlobalISel: cmp/select method for insert element
Stanislav Mekhanoshin [Wed, 3 Jun 2020 18:19:49 +0000 (11:19 -0700)]
AMDGPU/GlobalISel: cmp/select method for insert element

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

4 years agoRegister printer and context CL options with the toyc example
Mehdi Amini [Wed, 10 Jun 2020 18:18:43 +0000 (18:18 +0000)]
Register printer and context CL options with the toyc example

The tutorial refers to invoking toyc with '-mlir-print-debuginfo' but
it wasn't registered anymore.

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

4 years ago[clang] Frontend components for the relative vtables ABI
Leonard Chan [Wed, 10 Jun 2020 19:48:10 +0000 (12:48 -0700)]
[clang] Frontend components for the relative vtables ABI

This patch contains all of the clang changes from D72959.

- Generalize the relative vtables ABI such that it can be used by other targets.
- Add an enum VTableComponentLayout which controls whether components in the
  vtable should be pointers to other structs or relative offsets to those structs.
  Other ABIs can change this enum to restructure how components in the vtable
  are laid out/accessed.
- Add methods to ConstantInitBuilder for inserting relative offsets to a
  specified position in the aggregate being constructed.

See D72959 for background info.

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

4 years ago[X86] Enable masked GPR broadcasts to be formed even if the broadcast has more than...
Craig Topper [Wed, 10 Jun 2020 18:49:23 +0000 (11:49 -0700)]
[X86] Enable masked GPR broadcasts to be formed even if the broadcast has more than one use.

This is a cheap instruction. It's better to repeat it than to do
two separate operations.

There are probably more cases like this, but this one was reported
as a regression in our internal benchmarking.

4 years agoFixed false ThinLTO cache misses problem (PR 45819).
romanova-ekaterina [Tue, 9 Jun 2020 20:46:28 +0000 (13:46 -0700)]
Fixed false ThinLTO cache misses problem (PR 45819).

We relied on the fact that the iterators walks through the elements of a
DenseSet in a deterministic order (which is not true). This caused
ThinLTO cache misses. This patch addresses this problem.
See PR 45819 for additional information
https://bugs.llvm.org/show_bug.cgi?id=45819

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

4 years agoFix dynamic probing scheme
serge-sans-paille [Wed, 3 Jun 2020 08:18:29 +0000 (10:18 +0200)]
Fix dynamic probing scheme

If we probe *after* each static stack allocation, we need to probe *before* each
dynamic stack allocation. Provide a scheme to describe the possible scenario.

Thanks a lot to @jonpa for motivating this fix.

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

4 years agoRegAllocFast: Avoid unused method warning in release builds
Matt Arsenault [Wed, 10 Jun 2020 19:11:19 +0000 (15:11 -0400)]
RegAllocFast: Avoid unused method warning in release builds

4 years ago[clang][Attribute] Fix noderef attribute false-negatives
Leonard Chan [Wed, 10 Jun 2020 19:20:54 +0000 (12:20 -0700)]
[clang][Attribute] Fix noderef attribute false-negatives

`noderef` was failing to trigger warnings in some cases related to c++ style
casting. This patch addresses them.

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

4 years ago[NFC] Rename variable to workaround old gcc bug
Arthur Eubanks [Wed, 10 Jun 2020 17:38:39 +0000 (10:38 -0700)]
[NFC] Rename variable to workaround old gcc bug

Summary:
gcc 5.1 is still supported according to
https://releases.llvm.org/10.0.0/docs/GettingStarted.html

We're hitting the following bug due to a variable created in the loop header being the same as a variable used in the loop header:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54430

Reviewers: hctim, pcc

Subscribers: #sanitizers

Tags: #sanitizers

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

4 years ago[hip] Fix the failed test case due to the additional backend phase.
Michael Liao [Wed, 10 Jun 2020 19:04:47 +0000 (15:04 -0400)]
[hip] Fix the failed test case due to the additional backend phase.

4 years ago[AVR] Implement disassembly support for I/O instructions
Ayke van Laethem [Wed, 5 Feb 2020 14:04:47 +0000 (15:04 +0100)]
[AVR] Implement disassembly support for I/O instructions

The in, out, and sbi/cbi family of instructions seem to require a custom
decoder. I'm not exactly sure why and would prefer to convince TableGen
to provide the correct decoders for these, but I can't seem to convince
it to do so. They simply disassemble without any operands.

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

4 years ago[AMDGPU] Fixed promote alloca with ptr/int casts
Stanislav Mekhanoshin [Wed, 10 Jun 2020 18:22:59 +0000 (11:22 -0700)]
[AMDGPU] Fixed promote alloca with ptr/int casts

There is an invalid cast produced when a pointee is a pointer
and the alloca type is cast to a pointer to int.

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

4 years ago[llvm][ELF][AArch64] Handle R_AARCH64_PLT32 relocation
Leonard Chan [Wed, 10 Jun 2020 18:34:16 +0000 (11:34 -0700)]
[llvm][ELF][AArch64] Handle R_AARCH64_PLT32 relocation

This patch allows for usage of the @PLT modifier in AArch64 assembly which
lowers to an R_AARCH64_PLT32 relocation. See D81184 for handling this
relocation in lld.

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

4 years ago[ASan][Test] Fix expected strings for globals test
Marco Elver [Wed, 10 Jun 2020 18:20:23 +0000 (20:20 +0200)]
[ASan][Test] Fix expected strings for globals test

The expected strings would previously not catch bugs when redzones were
added when they were not actually expected. Fix by adding "global "
before the type.

4 years ago[libc] Add a simple linux aarch64 config.
Siva Chandra [Tue, 9 Jun 2020 18:34:11 +0000 (11:34 -0700)]
[libc] Add a simple linux aarch64 config.

Summary:
With this change, "ninja check-libc" on linux/aarch64 succeeds.

However, all entrypoints with machine dependent implementations
have been skipped. A good number of these skipped entrypoints can
be enabled once we have aarch64 syscall support available.

Reviewers: abrachet, asteinhauser

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

4 years ago[X86] Split imm handling out of selectMOV64Imm32 and add a separate isel pattern.
Craig Topper [Wed, 10 Jun 2020 17:36:45 +0000 (10:36 -0700)]
[X86] Split imm handling out of selectMOV64Imm32 and add a separate isel pattern.

This makes the pattern available to global isel.

4 years ago[libc][NFC] Make cpu feature check tolerate non-x86 architectures.
Siva Chandra [Wed, 10 Jun 2020 17:55:00 +0000 (10:55 -0700)]
[libc][NFC] Make cpu feature check tolerate non-x86 architectures.

The feature check should probably be enhanced for non-x86 architectures,
but this change shields them from x86 specific pieces until then.

This patch has been split out from https://reviews.llvm.org/D81533.

4 years ago[hip] Fix device-only relocatable code compilation.
Michael Liao [Mon, 8 Jun 2020 19:37:06 +0000 (15:37 -0400)]
[hip] Fix device-only relocatable code compilation.

Summary:
- In HIP, just as the regular device-only compilation, the device-only
  relocatable code compilation should not involve offload bundle.
- In addition, that device-only relocatable code compilation should have
  the similar 3 steps, namely preprocessor, compile, and backend, to the
  regular code generation with `-emit-llvm`.

Reviewers: yaxunl, tra

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[OpenMP][AMDGCN] Support OpenMP offloading for AMDGCN architecture - Part 2
Saiyedul Islam [Wed, 10 Jun 2020 17:58:15 +0000 (17:58 +0000)]
[OpenMP][AMDGCN] Support OpenMP offloading for AMDGCN architecture - Part 2

Summary:
New file include to support platform dependent grid constants. It will be
used by clang, libomptarget plugins, and deviceRTLs to access constant
values consistently and with fast access in the deviceRTLs.

Originally authored by Greg Rodgers (@gregrodgers).

Reviewers: arsenm, sameerds, jdoerfert, yaxunl, b-sumner, scchan, JonChesterfield

Reviewed By: arsenm

Subscribers: llvm-commits, pdhaliwal, jholewinski, jvesely, wdng, nhaehnle, guansong, kerbowa, sstefan1, cfe-commits, ronlieb, gregrodgers

Tags: #clang, #llvm

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

4 years ago[ASan][Test] Split out global alias test
Marco Elver [Wed, 10 Jun 2020 17:55:51 +0000 (19:55 +0200)]
[ASan][Test] Split out global alias test

Some platforms do not support aliases. Split the test, and pass explicit
triple to avoid test failure.

Reviewed By: thakis

Tags: #clang

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

4 years agoAMDGPU: Stop using getSelectCC in division lowering
Matt Arsenault [Wed, 10 Jun 2020 17:01:57 +0000 (13:01 -0400)]
AMDGPU: Stop using getSelectCC in division lowering

This was promoting booleans to i32 to perform a comparison against
them to feed to a select condition. Just use the booleans
directly. This produces the same final code, since the combiner is
unable to undo the mess this creates. I untangled this logic when I
ported this code to GlobalISel, so port the cleanups back.

4 years agoGlobalISel: Move LegalizerHelper members around
Matt Arsenault [Tue, 9 Jun 2020 20:47:37 +0000 (16:47 -0400)]
GlobalISel: Move LegalizerHelper members around

MIRBuilder was in the middle of of a bunch of methods and not group
with the other member variables, which made it harder to see what
state this carries around. Move these to the top as is the usual
convention.

4 years ago[WebAssembly] Fix a warning for an unused variable
Heejin Ahn [Wed, 10 Jun 2020 16:51:21 +0000 (09:51 -0700)]
[WebAssembly] Fix a warning for an unused variable

`ErasedUncondBr` is used only in an `assert`, so it triggers a warning
on builds without assertions. Fixed.

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from X86
Christopher Tetreault [Wed, 10 Jun 2020 16:41:42 +0000 (09:41 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from X86

Reviewers: efriedma, craig.topper, RKSimon, samparker, kmclaughlin, david-arm

Reviewed By: david-arm

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[ARM] Update fp16-insert-extract.ll test checks. NFC
David Green [Wed, 10 Jun 2020 10:22:10 +0000 (11:22 +0100)]
[ARM] Update fp16-insert-extract.ll test checks. NFC

4 years ago[AST] Mangle LambdaContextDecl for top level decl
Zequan Wu [Wed, 10 Jun 2020 16:37:58 +0000 (09:37 -0700)]
[AST] Mangle LambdaContextDecl for top level decl

Summary:

Bug filed here: https://bugs.llvm.org/show_bug.cgi?id=45213

To resolve it, we let the checks for mangling LambdaContextDecl to be analogous to ItaniumMangle strategy: https://github.com/llvm/llvm-project/blob/master/clang/lib/AST/ItaniumMangle.cpp#L1829

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

4 years ago[libc++] Work around gcc/Power9 bug in `include/thread`
Joel E. Denny [Wed, 10 Jun 2020 16:40:43 +0000 (12:40 -0400)]
[libc++] Work around gcc/Power9 bug in `include/thread`

This fixes PR39696, which breaks the libcxx build with gcc (I tested
7.5.0) on Power9.  This fix was suggested at

https://bugs.llvm.org/show_bug.cgi?id=39696#c38

but never applied.  It just reverts 0583d9ea8d5e, which reverses
components of the original fix in 3bf63cf3b366, which is correct.

Fixes https://llvm.org/PR39696

Reviewed By: ldionne

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

4 years ago[FileCheck] Add missing %ProtectFileCheckOutput to FileCheck tests
Joel E. Denny [Wed, 10 Jun 2020 14:22:24 +0000 (10:22 -0400)]
[FileCheck] Add missing %ProtectFileCheckOutput to FileCheck tests

This is a continuation of D65121 (committed at f471eb8e99b5).

4 years ago[flang] Add the complex expression helper class.
Eric Schweitz [Fri, 5 Jun 2020 18:23:22 +0000 (11:23 -0700)]
[flang] Add the complex expression helper class.

The complex expression helper class can be used to generate small,
short-lived instances of a "helper" that can be used to aid the
construction of complex expressions in FIR. The helper class bundles
together these functionally related operations.

Included in this diff is the header for the FIR builder. The
implementation has other dependences and will follow.

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

4 years agoFix MLIR test: -dump-input-on-failure is no longer a valid option
Mehdi Amini [Wed, 10 Jun 2020 15:58:10 +0000 (15:58 +0000)]
Fix MLIR test: -dump-input-on-failure is no longer a valid option

4 years agoRevert "[analyzer] On-demand parsing capability for CTU"
Endre Fülöp [Wed, 10 Jun 2020 15:34:41 +0000 (17:34 +0200)]
Revert "[analyzer] On-demand parsing capability for CTU"

This reverts commit 97e07d0c352ca469eb07a0cb3162c2807ff1099d.
Reason: OSX broke for a different reason, this really only seem to work
on linux and very generic windows builds

4 years ago[X86][SSE] Cleanup tests based on feedback from D81547
Simon Pilgrim [Wed, 10 Jun 2020 15:38:33 +0000 (16:38 +0100)]
[X86][SSE] Cleanup tests based on feedback from D81547

Simplify tests to return i1 bool, removing superfluous function calls.

Use nounwind to remove cfi

4 years ago[lldb] XFAIL TestForwardDeclaration.test_debug_names on windows
Pavel Labath [Wed, 10 Jun 2020 15:07:31 +0000 (17:07 +0200)]
[lldb] XFAIL TestForwardDeclaration.test_debug_names on windows

Before 539b47c9 this test was not actually using the debug_names section
because the -gdwarf added by Makefile.rules on windows overrode the
-gdwarf-5 flag from CFLAGS_EXTRAS. Now that -gdwarf-5 is respected, the
test is failing.

4 years agoGlobalISel: Make default implementation of legalizeCustom unreachable
Matt Arsenault [Tue, 9 Jun 2020 20:57:53 +0000 (16:57 -0400)]
GlobalISel: Make default implementation of legalizeCustom unreachable

If the target explicitly requested custom legalization, it should be
required to implement this. Also move default legalizeIntrinsic
implementation into the header so it's next to the related
legalizeCustom.

4 years agoAMDGPU/GlobalISel: Make G_IMPLICIT_DEF legality more consistent
Matt Arsenault [Sun, 31 May 2020 04:14:56 +0000 (00:14 -0400)]
AMDGPU/GlobalISel: Make G_IMPLICIT_DEF legality more consistent

Makes <6 x s16> legal, <4 x s8> illegal, and clamps the maximum size
to 1024.

4 years agoFileCheck [11/12]: Add matching constraint specification
Thomas Preud'homme [Wed, 17 Jul 2019 15:15:52 +0000 (16:15 +0100)]
FileCheck [11/12]: Add matching constraint specification

This patch is part of a patch series to add support for FileCheck
numeric expressions. This specific patch adds support for specifying the
matching constraint for a numeric expression, ie. how the value being
matched should relate to the numeric expression.

This commit only adds the equality constraint where the numeric value
matched must be equal to the numeric expression. It is the default
matching constraint used when not specified. It is added to provision
other matching constraint (e.g. inequality relations).

Copyright:
    - Linaro (changes up to diff 183612 of revision D55940)
    - GraphCore (changes in later versions of revision D55940 and
                 in new revision created off D55940)

Reviewed By: jhenderson

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

4 years agoCorrectly update Changed status for SimplifyCFG
serge-sans-paille [Thu, 4 Jun 2020 07:56:11 +0000 (09:56 +0200)]
Correctly update Changed status for SimplifyCFG

Interestingly, this leads to better output in one of the test case.

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

4 years agoFix the -Wsign-compare warning.
Haojian Wu [Wed, 10 Jun 2020 14:51:54 +0000 (16:51 +0200)]
Fix the -Wsign-compare warning.

4 years agoADT: Fix that APSInt's string constructor claims it requires 5 bits to store a zero
Raphael Isemann [Wed, 10 Jun 2020 14:35:42 +0000 (16:35 +0200)]
ADT: Fix that APSInt's string constructor claims it requires 5 bits to store a zero

Summary:

When constructing an APSInt from a string, the constructor doesn't correctly
truncate the bit width of the result if the passed in string was "0" (or any
alternative way to express 0 like "-0" or "000"). Instead of 1 (which is the
smallest allowed bit width) it returns an APSInt with a bit width of 5.

The reason is that the constructor checks that it never truncates the result to
the invalid bit width of 0, so when it calculates that storing a "0" doesn't
require any bits it just keeps the original overestimated bit width (which
happens to be 5).

This patch just sets the bit width of the result to 1 if the required bit width
is 0.

Reviewers: arphaman, dexonsmith

Reviewed By: dexonsmith

Subscribers: hiraditya, dexonsmith, JDevlieghere, llvm-commits

Tags: #llvm

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

4 years ago[lld] Fix test/ELF/undef.s for 6f55b5a1
Pavel Labath [Wed, 10 Jun 2020 14:34:56 +0000 (16:34 +0200)]
[lld] Fix test/ELF/undef.s for 6f55b5a1

There's been a slight change in wording for the warning message about
debug_line problems.

4 years ago[lldb] Replace the LEB128 decoding logic in LLDB's DataExtractor with calls to LLVM...
Raphael Isemann [Wed, 10 Jun 2020 14:34:54 +0000 (16:34 +0200)]
[lldb] Replace the LEB128 decoding logic in LLDB's DataExtractor with calls to LLVM's LEB128 implementation

Reviewers: labath, JDevlieghere

Reviewed By: labath

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

4 years ago[CostModel][X86] Add broadcast costs for vXi1 bool vectors
Simon Pilgrim [Wed, 10 Jun 2020 14:14:24 +0000 (15:14 +0100)]
[CostModel][X86] Add broadcast costs for vXi1 bool vectors

Doesn't mean much on non-AVX512 targets but better to keep with the other shuffles

4 years agoFix version of c-general.profdata.v5 test case
serge-sans-paille [Wed, 10 Jun 2020 14:16:14 +0000 (16:16 +0200)]
Fix version of c-general.profdata.v5 test case

de02a75e398415bad4df27b4547c25b896c8bf3b incorrectly upgraded it to v6

4 years ago[DWARFDebugLine] Use truncating data extractors for prologue parsing
Pavel Labath [Thu, 2 Apr 2020 13:32:59 +0000 (15:32 +0200)]
[DWARFDebugLine] Use truncating data extractors for prologue parsing

Summary:
This makes the code easier to reason about, as it will behave the same
way regardless of whether there is any more data coming after the
presumed end of the prologue.

Reviewers: jhenderson, dblaikie, probinson, ikudrin

Subscribers: hiraditya, MaskRay, llvm-commits

Tags: #llvm

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

4 years ago[clangd] Disable new errs()-tie behavior, it's racy.
Sam McCall [Wed, 10 Jun 2020 07:36:58 +0000 (09:36 +0200)]
[clangd] Disable new errs()-tie behavior, it's racy.

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[MLIR][Standard] Make the `dim` operation index an operand.
Frederik Gossen [Wed, 10 Jun 2020 13:52:43 +0000 (13:52 +0000)]
[MLIR][Standard] Make the `dim` operation index an operand.

Allow for dynamic indices in the `dim` operation.
Rather than an attribute, the index is now an operand of type `index`.
This allows to apply the operation to dynamically ranked tensors.
The correct lowering of dynamic indices remains to be implemented.

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

4 years ago[libc++] Install locales in the build bot Docker images
Louis Dionne [Wed, 10 Jun 2020 13:36:39 +0000 (09:36 -0400)]
[libc++] Install locales in the build bot Docker images

This allows running the locale tests on the build bots.

4 years ago[libcxx] Fix std::vector construct_iter_iter.pass.cpp test (C++98/03)
Mikhail Maltsev [Wed, 10 Jun 2020 13:26:58 +0000 (14:26 +0100)]
[libcxx] Fix std::vector construct_iter_iter.pass.cpp test (C++98/03)

The test is failing on 32-bit targets in C++03 mode. Clang produces
the following warning: 'integer literal is too large to be represented
in type 'long' and is subject to undefined behavior under C++98,
interpreting as 'unsigned long'; this literal will have type 'long
long' in C++11 onwards [-Wc++11-compat]' which is promoted to an error
and causes the test to fail.

There have been no changes in the test itself since 2019, so it looks
like the diagnostic has been updated.

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

4 years agoReland: [Attributor] Split the Attributor::run() into multiple functions.
Kuter Dinel [Wed, 10 Jun 2020 13:08:56 +0000 (13:08 +0000)]
Reland: [Attributor] Split the Attributor::run() into multiple functions.

Summary:
This patch splits the Attributor::run() function into multiple
functions.

Simple Logic changes to make this possible:
  # Moved iteration count verification earlier.
  # NumFinalAAs get set a little bit later.

Reviewers: jdoerfert, sstefan1, uenoku

Reviewed By: jdoerfert

Subscribers: hiraditya, uenoku, llvm-commits

Tags: #llvm

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

4 years ago[ELF][AArch64] Correct relocation codes for R_<CLS>_PLT32
Peter Smith [Mon, 8 Jun 2020 07:58:13 +0000 (08:58 +0100)]
[ELF][AArch64] Correct relocation codes for R_<CLS>_PLT32

The relocation codes for R_<CLS>_PLT32 are incorrectly in the dynamic
relocation range that starts at 1024 for AArch64 and 180 for AArch64_32.

Correct these so that they start at the next available static relocation
code in the non-TLS range. The R_<CLS>_PLT32 description is currently in
unpublished so this change corrects LLVM to match the values that will
appear in the final ELF for the 64-bit Arm Architecture document.

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

4 years ago[lldb/Utility] Remove m_ieee_quad from Scalar
Pavel Labath [Wed, 10 Jun 2020 13:04:31 +0000 (15:04 +0200)]
[lldb/Utility] Remove m_ieee_quad from Scalar

This field is unused (the only way to change its value is via a
constructor which is never called), and as far as I can tell it has been
unused since it was introduced in D12100. It also has some soundness
issues -- e.g.  operator= does not reinitialize it, but uses the old
value from the overwritten object.

It sounds like this class should be able to support different floating
point semantics, but if that is needed, it would be better to start
afresh -- probably by passing in an APFloat::fltSemantics object instead
of a bool flag.

4 years agoCreate a warning flag for 'warn_conv_*_not_used'
Ronald Wampler [Wed, 10 Jun 2020 12:55:42 +0000 (08:55 -0400)]
Create a warning flag for 'warn_conv_*_not_used'

These warnings are grouped under '-Wclass-conversion' to be compatiable with GCC 9.

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

4 years ago[KernelAddressSanitizer] Make globals constructors compatible with kernel [v2]
Marco Elver [Wed, 10 Jun 2020 13:01:40 +0000 (15:01 +0200)]
[KernelAddressSanitizer] Make globals constructors compatible with kernel [v2]

[ v1 was reverted by c6ec352a6bde1995794c523adc2ebab802ccdf0a due to
  modpost failing; v2 fixes this. More info:
  https://github.com/ClangBuiltLinux/linux/issues/1045#issuecomment-640381783 ]

This makes -fsanitize=kernel-address emit the correct globals
constructors for the kernel. We had to do the following:

* Disable generation of constructors that rely on linker features such
  as dead-global elimination.

* Only instrument globals *not* in explicit sections. The kernel uses
  sections for special globals, which we should not touch.

* Do not instrument globals that are prefixed with "__" nor that are
  aliased by a symbol that is prefixed with "__". For example, modpost
  relies on specially named aliases to find globals and checks their
  contents. Unfortunately modpost relies on size stored as ELF debug info
  and any padding of globals currently causes the debug info to cause size
  reported to be *with* redzone which throws modpost off.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203493

Tested:
* With 'clang/test/CodeGen/asan-globals.cpp'.

* With test_kasan.ko, we can see:

   BUG: KASAN: global-out-of-bounds in kasan_global_oob+0xb3/0xba [test_kasan]

* allyesconfig, allmodconfig (x86_64)

Reviewed By: glider

Tags: #clang, #llvm

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

4 years ago[lld][test] Expand testing for dynamic-list and export-dynamic
gbreynoo [Wed, 10 Jun 2020 13:06:30 +0000 (14:06 +0100)]
[lld][test] Expand testing for dynamic-list and export-dynamic

- Expanded testing for --dynamic-list and --export-dynamic
- Fixed invalid-dynamic-list.test

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

4 years ago[AArch64][SVE] Change pointer type of struct load/store intrinsics.
Sander de Smalen [Wed, 10 Jun 2020 08:15:13 +0000 (09:15 +0100)]
[AArch64][SVE] Change pointer type of struct load/store intrinsics.

Instead of loading from e.g. `<vscale x 16 x i8>*`, load from element
pointer `i8*`. This is more in line with the other load/store
intrinsics for SVE.

Reviewers: fpetrogalli, c-rhodes, rengolin, efriedma

Reviewed By: efriedma

Tags: #llvm

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

4 years ago[libc++] Translate the enable_filesystem parameter to the DSL
Louis Dionne [Wed, 10 Jun 2020 12:46:49 +0000 (08:46 -0400)]
[libc++] Translate the enable_filesystem parameter to the DSL

4 years ago[lldb/Makefile.rules] Apply CFLAGS_EXTRAS after debug-info mode flags
Pavel Labath [Wed, 10 Jun 2020 11:38:35 +0000 (13:38 +0200)]
[lldb/Makefile.rules] Apply CFLAGS_EXTRAS after debug-info mode flags

This makes it possible to conditionally override some of these flags via
CFLAGS_EXTRAS. It should be NFC right now, but this seems the logical
order in which to apply these things, and I am going to make use of this
in another patch.

4 years ago[yaml2obj] - Introduce a 10 Mb limit of the output by default and a --max-size option.
Georgii Rymar [Fri, 5 Jun 2020 12:50:59 +0000 (15:50 +0300)]
[yaml2obj] - Introduce a 10 Mb limit of the output by default and a --max-size option.

Multiple times we faced an issue of huge outputs due to unexpected behavior
or incorrect test cases. The last one was https://reviews.llvm.org/D80629#2073066.

This patch limits the output to 10 Mb for ELF and introduces the --max-size to change this
limit.

I've tried to keep the implementation non-intrusive.

The current logic we have is that we prepare section content in a buffer first and write
it to the output later. This patch checks the available limit on each writing attempt to this buffer
and stops writing when the limit is reached and raises the internal error flag.
Later, this flag is is checked before the actual writing to a file happens and
an error is reported.

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

4 years ago[libc++] Define the no-exceptions Lit feature using the DSL
Louis Dionne [Wed, 10 Jun 2020 12:03:51 +0000 (08:03 -0400)]
[libc++] Define the no-exceptions Lit feature using the DSL

Instead of using logic in config.py, use the DSL to grab the no-exceptions
user-configurable parameter from the Lit command-line invocation.