platform/upstream/llvm.git
4 years ago[DebugInfo] Fix build failure on the mingw
Djordje Todorovic [Wed, 11 Mar 2020 07:25:01 +0000 (08:25 +0100)]
[DebugInfo] Fix build failure on the mingw

Add the workaround for the X86::MOV16ri when describing call site
parameters.

4 years agoRevert "[AVR] Include AVR by default in LLVM builds"
Dylan McKay [Thu, 12 Mar 2020 06:53:21 +0000 (19:53 +1300)]
Revert "[AVR] Include AVR by default in LLVM builds"

This reverts commit dfecec65e6796c075aebe50e88260a33aa2efd06.

Merging the change revealed that there is a failure on the memory
sanitizer bots.

    Command Output (stderr):
    --
    ==3569==WARNING: MemorySanitizer: use-of-uninitialized-value
        #0 0x1d71bff in
           llvm::AVRSubtarget::ParseSubtargetFeatures(llvm::StringRef,
    llvm::StringRef)
    /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/lib/Target/AVR/AVRGenSubtargetInfo.inc:471:7
        #1 0x1d721f8 in initializeSubtargetDependencies
           /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Target/AVR/AVRSubtarget.cpp:50:3
        #2 0x1d721f8 in llvm::AVRSubtarget::AVRSubtarget(llvm::Triple
           const&, std::__1::basic_string<char, std::__1::char_traits<char>,
    std::__1::allocator<char> > const&, std::__1::basic_string<char,
    std::__1::char_traits<char>, std::__1::allocator<char> > const&,
    llvm::AVRTargetMachine const&)
    /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Target/AVR/AVRSubtarget.cpp:33:18
        #3 0x1d3077f in
           llvm::AVRTargetMachine::AVRTargetMachine(llvm::Target const&,
    llvm::Triple const&, llvm::StringRef, llvm::StringRef,
    llvm::TargetOptions const&, llvm::Optional<llvm::Reloc::Model>,
    llvm::Optional<llvm::CodeModel::Model>, llvm::CodeGenOpt::Level, bool)
    /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Target/AVR/AVRTargetMachine.cpp:52:7
        #4 0x1d3169d in
           llvm::RegisterTargetMachine<llvm::AVRTargetMachine>::Allocator(llvm::Target
    const&, llvm::Triple const&, llvm::StringRef, llvm::StringRef,
    llvm::TargetOptions const&, llvm::Optional<llvm::Reloc::Model>,
    llvm::Optional<llvm::CodeModel::Model>, llvm::CodeGenOpt::Level, bool)
    /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/Support/TargetRegistry.h:1121:16
        #5 0x86662f in createTargetMachine
           /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/Support/TargetRegistry.h:402:12
        #6 0x86662f in compileModule(char**, llvm::LLVMContext&)
           /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/llc/llc.cpp:473:52
        #7 0x861f42 in main
           /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/tools/llc/llc.cpp:356:22
        #8 0x7f76f7b072e0 in __libc_start_main
           (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)
        #9 0x7ebbc9 in _start
           (/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/llc+0x7ebbc9)

    SUMMARY: MemorySanitizer: use-of-uninitialized-value
    /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/lib/Target/AVR/AVRGenSubtargetInfo.inc:471:7
    in llvm::AVRSubtarget::ParseSubtargetFeatures(llvm::StringRef,
    llvm::StringRef)
    Exiting
    FileCheck error: '<stdin>' is empty.
    --

The patch wiill be re-committed once fixed.

4 years ago[AVR] Include AVR by default in LLVM builds
Dylan McKay [Thu, 12 Mar 2020 06:07:01 +0000 (19:07 +1300)]
[AVR] Include AVR by default in LLVM builds

Summary:
This patch makes the AVR backend an official target of LLVM, serving
as a request for comments for moving the AVR backend out of
experimental.

A future patch will move the LLVM AVR buildbot (llvm-avr-linux) from the
staging buildmaster to the production buildmaster, so error emails will
start to go out.

Summary of the backend
----------------------

  - 16-bit little endian
  - AsmParser based assembly parser
  - uses the MC library for generating AVR ELFs
  - most logic driven from standard TableGen-erated tables like other
    backends
  - passes all of the test suite under `check-all`, including generic
    CodeGen and DebugInfo tests
  - Used in two frontends
  - Limited, but functional support for DebugInfo and LLVM DWARF dumping
  - Binary compatible with AVR-GCC and avr-{libc,libgcc} for the most part
  - Cannot lower 32-bit shifts due to a bug, can lower shifts larger or
    smaller
  - Supports assembly/MC for all the entire AVR ISA, generally generates poorly
    optimized machine instructions, with most focus thus far on correctness

I've added reviewers and subscribers from previous patches where backends were made official,
and those who participated in the recent thread on llvm-dev, please add anybody I've missed.

The most recent discussion on this topic can be found in the llvm-dev thread [Moving the AVR backend out of experimental](https://lists.llvm.org/pipermail/llvm-dev/2020-February/139158.html)

Reviewers: chandlerc, lattner, rengolin, tstellar, arsenm, thakis, simoll, asb

Reviewed By: rengolin, thakis

Subscribers: CryZe, wdng, mgorny, aprantl, Jim, hans, aykevl, llvm-commits

Tags: #llvm

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

4 years ago[gn build] Port 518292dbdfc
LLVM GN Syncbot [Thu, 12 Mar 2020 05:17:52 +0000 (05:17 +0000)]
[gn build] Port 518292dbdfc

4 years ago[PowerPC] Add the MacroFusion support for Power8
QingShan Zhang [Thu, 12 Mar 2020 05:15:41 +0000 (05:15 +0000)]
[PowerPC] Add the MacroFusion support for Power8

This patch is intend to implement the missing P8 MacroFusion for LLVM
according to Power8 User's Manual Section 10.1.12 Instruction Fusion

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

4 years ago[builtins] Build for arm64e for Darwin
Shoaib Meenai [Thu, 12 Mar 2020 02:58:15 +0000 (19:58 -0700)]
[builtins] Build for arm64e for Darwin

https://github.com/apple/swift/pull/30112/ makes the Swift standard
library for iOS build for arm64e. If you're building Swift against your
own LLVM, this in turn requires having the builtins built for arm64e,
otherwise you won't be able to use the builtins (which will in turn lead
to an undefined symbol for `__isOSVersionAtLeast`). Make the builtins
build for arm64e to fix this.

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

4 years agoRevert "Update debugserver test for new ostype names"
Adrian Prantl [Thu, 12 Mar 2020 04:32:12 +0000 (21:32 -0700)]
Revert "Update debugserver test for new ostype names"

I accidentally commited this while cherry-picking commits out of my
reflog.

This reverts commit ae73ab64b66d1889b447303d432f4d217d222def.

4 years ago[GC] Remove redundant entiries in stackmap section (and test it this time)
Philip Reames [Thu, 12 Mar 2020 04:23:56 +0000 (21:23 -0700)]
[GC] Remove redundant entiries in stackmap section (and test it this time)

This is a reimplementation of the optimization removed in D75964. The actual spill/fill optimization is handled by D76013, this one just worries about reducing the stackmap section size itself by eliminating redundant entries. As noted in the comments, we could go a lot further here, but avoiding the degenerate invoke case as we did before is probably "enough" in practice.

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

4 years agoAdd a missing include to clang unit tests
Reid Kleckner [Thu, 12 Mar 2020 04:05:13 +0000 (21:05 -0700)]
Add a missing include to clang unit tests

4 years ago[libc] [UnitTest] Add timeout to death tests
Alex Brachet [Thu, 12 Mar 2020 03:57:20 +0000 (23:57 -0400)]
[libc] [UnitTest] Add timeout to death tests

Summary:
This patch adds a timeout of 500ms to death tests. As we add multithreaded code and locks, deadlocks become more likely so timeout will be useful.

Additionally:
 - Better error handling in `invokeSubprocess`
 - Makes `ProcessStatus`'s methods const

Reviewers: sivachandra, MaskRay, gchatelet, PaulkaToast

Reviewed By: sivachandra, PaulkaToast

Subscribers: tschuett, libc-commits

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

4 years agoPrune TargetInfo.h include from ParsedAttr.h, NFC
Reid Kleckner [Thu, 12 Mar 2020 03:43:59 +0000 (20:43 -0700)]
Prune TargetInfo.h include from ParsedAttr.h, NFC

Saves ~400 includes of related headers:

$ diff -u <(sort thedeps-before.txt) <(sort thedeps-after.txt) \
    | grep '^[-+] ' | sort | uniq -c | sort -nr
    468 -    llvm-project/clang/include/clang/Basic/TargetInfo.h
    468 -    llvm-project/clang/include/clang/Basic/TargetCXXABI.h
    368 -    llvm-project/llvm/include/llvm/Support/CodeGen.h
    368 -    llvm-project/clang/include/clang/Basic/XRayInstr.h
    368 -    llvm-project/clang/include/clang/Basic/CodeGenOptions.h
    368 -    llvm-project/clang/include/clang/Basic/CodeGenOptions.def
    367 -    llvm-project/llvm/include/llvm/ADT/FloatingPointMode.h
    367 -    llvm-project/clang/include/clang/Basic/DebugInfoOptions.h

4 years ago[libc] Add initial assert definition
Alex Brachet [Thu, 12 Mar 2020 03:45:58 +0000 (23:45 -0400)]
[libc] Add initial assert definition

Summary: This patch adds a temporary `__assert_fail` and `assert` definition to make it available to internal llvm libc code. `__assert_fail` writes to fd 2 directly instead of `stderr`, using SYS_write. I have not put it in its own linux directory because this is temporary and it should be using stdio's api in the future. It does not currently print out the line number (although we could do that by stringifying `__LINE__` if reviewers wish).

Reviewers: sivachandra, gchatelet, PaulkaToast

Reviewed By: sivachandra

Subscribers: mgorny, MaskRay, tschuett, libc-commits

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

4 years agoSpecify branch probabilities for callbr dests
Bill Wendling [Thu, 12 Mar 2020 00:07:02 +0000 (17:07 -0700)]
Specify branch probabilities for callbr dests

Summary:
callbr's indirect branches aren't expected to be taken, so reduce their
probabilities to 0 while increasing the default destination to 1. This
allows some code improvements through block placement.

Reviewers: nickdesaulniers

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NFC][PowerPC] Add a new MIR file te test ppc-early-ret pass
Kang Zhang [Thu, 12 Mar 2020 03:18:56 +0000 (03:18 +0000)]
[NFC][PowerPC] Add a new MIR file te test ppc-early-ret pass

4 years ago[JITLink] Read symbol linkage from the correct field.
Lang Hames [Thu, 12 Mar 2020 01:44:58 +0000 (18:44 -0700)]
[JITLink] Read symbol linkage from the correct field.

MachO symbol linkage is described by the desc field of the nlist entry, not the
type field.

4 years ago[ORC] Fix an overly aggressive assert.
Lang Hames [Thu, 12 Mar 2020 02:49:12 +0000 (19:49 -0700)]
[ORC] Fix an overly aggressive assert.

It is ok to add dependencies on symbols that are ready, they should just be
skipped.

4 years ago[llvm-jitlink] Fix DEBUG_TYPE string.
Lang Hames [Thu, 12 Mar 2020 01:03:41 +0000 (18:03 -0700)]
[llvm-jitlink] Fix DEBUG_TYPE string.

This updates the DEBUG_TYPE string in llvm-jitlink-macho.cpp to reflect the
change made to llvm-jitlink.cpp in 66128c48400f03f2b423561a63b3e78a355fd349.

4 years ago[ORC] Add some extra debugging output.
Lang Hames [Wed, 11 Mar 2020 23:15:27 +0000 (16:15 -0700)]
[ORC] Add some extra debugging output.

4 years ago[X86] Support intrinsic _mm_broadcastsi128_si256
Shengchen Kan [Thu, 12 Mar 2020 02:50:23 +0000 (10:50 +0800)]
[X86] Support intrinsic _mm_broadcastsi128_si256

Reviewers: LuoYuanke, craig.topper, RKSimon, pengfei

Reviewed By: craig.topper

Subscribers: cfe-commits, llvm-commits

Tags: #clang

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

4 years agoAdd newly-missing include
Adrian Prantl [Thu, 12 Mar 2020 02:30:11 +0000 (19:30 -0700)]
Add newly-missing include

4 years ago[X86] Support intrinsic _mm_cldemote
Shengchen Kan [Tue, 10 Mar 2020 07:57:45 +0000 (15:57 +0800)]
[X86] Support intrinsic _mm_cldemote

Reviewers: LuoYuanke, craig.topper, RKSimon, pengfei

Reviewed By: craig.topper

Subscribers: cfe-commits, llvm-commits

Tags: #clang

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

4 years agoAdd debug info support for Swift/Clang APINotes.
Adrian Prantl [Wed, 4 Mar 2020 00:05:23 +0000 (16:05 -0800)]
Add debug info support for Swift/Clang APINotes.

In order for dsymutil to collect .apinotes files (which capture
attributes such as nullability, Swift import names, and availability),
I want to propose adding an apinotes: field to DIModule that gets
translated into a DW_AT_LLVM_apinotes (path) nested inside
DW_TAG_module. This will be primarily used by LLDB to indirectly
extract the Swift names of Clang declarations that were deserialized
from DWARF.

<rdar://problem/59514626>

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

4 years agoRemove CMake configuration for Sphinx targets in MLIR
Mehdi Amini [Thu, 12 Mar 2020 01:26:54 +0000 (01:26 +0000)]
Remove CMake configuration for Sphinx targets in MLIR

MLIR does not have a Sphinx configuration, this is just leading to build
failures at the moment.
The website https://mlir.llvm.org/ is using the Hugo generator to
process the markdown files.

4 years ago[X86] Support intrinsics _bextr2*
Shengchen Kan [Fri, 6 Mar 2020 07:53:47 +0000 (15:53 +0800)]
[X86] Support intrinsics _bextr2*

Reviewers: LuoYuanke, craig.topper, RKSimon, pengfei

Reviewed By: craig.topper

Subscribers: cfe-commits, llvm-commits

Tags: #clang

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

4 years ago[libc] Add docker container for llvm-libc buildbot worker.
Paula Toth [Thu, 12 Mar 2020 00:34:32 +0000 (17:34 -0700)]
[libc] Add docker container for llvm-libc buildbot worker.

Summary: Created a docker container to provide transparency and easy changes to the llvm-libc buildbot intfra.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: MaskRay, tschuett, libc-commits

Tags: #libc-project

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

4 years agoAdd missing "llvm/Support/Host.h" header to LLVM example after recent header trimming...
Mehdi Amini [Thu, 12 Mar 2020 00:12:03 +0000 (00:12 +0000)]
Add missing "llvm/Support/Host.h" header to LLVM example after recent header trimming (NFC)

4 years ago[mlir][NFC] Use fold expressions instead of variadic class templates for adding opera...
River Riddle [Wed, 11 Mar 2020 23:56:13 +0000 (16:56 -0700)]
[mlir][NFC] Use fold expressions instead of variadic class templates for adding operations/etc. to dialects.

Summary: This is much simpler, and also greatly reduces the generated template recursion stack.

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

4 years agoAdd missing StringMap.h inclusion, apparently clangd is not covered by check-clang...
Reid Kleckner [Wed, 11 Mar 2020 23:47:42 +0000 (16:47 -0700)]
Add missing StringMap.h inclusion, apparently clangd is not covered by check-clang-tools zzz

4 years agoFix MLIR build after header change in LLVM (NFC)
Mehdi Amini [Wed, 11 Mar 2020 23:37:46 +0000 (23:37 +0000)]
Fix MLIR build after header change in LLVM (NFC)

4 years ago[mlir] Add a simplifying wrapper for generateCopy and expose it.
Tim Shen [Tue, 10 Mar 2020 22:32:53 +0000 (15:32 -0700)]
[mlir] Add a simplifying wrapper for generateCopy and expose it.

Summary:
affineDataCopyGenerate is a monolithinc function that
combines several steps for good reasons, but it makes customizing
the behaivor even harder. The major two steps by affineDataCopyGenerate are:
a) Identify interesting memrefs and collect their uses.
b) Create new buffers to forward these uses.

Step (a) actually has requires tremendous customization options. One could see
that from the recently added filterMemRef parameter.

This patch adds a function that only does (b), in the hope that (a)
can be directly implemented by the callers. In fact, (a) is quite
simple if the caller has only one buffer to consider, or even one use.

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

4 years ago[AMDGPU] pre-commit collapse-endcf.mir. NFC.
Stanislav Mekhanoshin [Wed, 11 Mar 2020 23:12:42 +0000 (16:12 -0700)]
[AMDGPU] pre-commit collapse-endcf.mir. NFC.

Pre commit test before D76033.

4 years ago[PowerPC] Fix compile time issue in recursive CTR analysis code
Teresa Johnson [Sat, 7 Mar 2020 01:48:22 +0000 (17:48 -0800)]
[PowerPC] Fix compile time issue in recursive CTR analysis code

Summary:
Avoid re-examining operands on recursive walk looking for CTR.
This was causing huge compile time after some earlier optimization
created a large expression.

The start of the expression (created by IndVarSimplify) looked like:

%469 = lshr i64 trunc (i128 xor (i128 udiv (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011), i128 64), i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011)) to i64), i64 45) to i128), i128 8192506886679785011), i128 64), i128 mul (i128 zext (i64 add (i64 trunc (i128 xor (i128 lshr (i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011), i128 64), i128 mul (i128 zext (i64 add (i64 ptrtoint (i8 @_ZN4absl13hash_internal13CityHashState5kSeedE to i64), i64 120) to i128), i128 8192506886679785011)) to i64), i64 45) to i128), ...

with the _ZN4absl13hash_internal13CityHashState5kSeedE referenced many times.

Reviewers: hfinkel

Subscribers: nemanjai, hiraditya, kbarton, jsji, shchenz, llvm-commits

Tags: #llvm

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

4 years agoAdded constraints on cl-options.cu test
Artem Belevich [Wed, 11 Mar 2020 23:02:29 +0000 (16:02 -0700)]
Added constraints on cl-options.cu test

4 years ago[mlir] [VectorOps] Correctly account for rank-0 affine-map result in vector.contract
aartbik [Wed, 11 Mar 2020 21:26:00 +0000 (14:26 -0700)]
[mlir] [VectorOps] Correctly account for rank-0 affine-map result in vector.contract

Summary:
Now that, thanks to ntv, we have the ability to parse and represent an affine
map with rank-0 results, viz. (i,j) -> (), we can pay off some engineering debt
in special casing the verification of such affine maps in dot-product flavored
vector.contract operations.

Reviewers: nicolasvasilache, andydavis1, rriddle

Reviewed By: nicolasvasilache

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[AssumeBundles] Enforce constraints on the operand bundle of llvm.assume
Tyker [Wed, 11 Mar 2020 22:21:44 +0000 (23:21 +0100)]
[AssumeBundles] Enforce constraints on the operand bundle of llvm.assume

Summary: Add verification that operand bundles on an llvm.assume are well formed to the verify pass.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoMake Decl::setOwningModuleID() public. (NFC)
Adrian Prantl [Tue, 3 Mar 2020 20:54:04 +0000 (12:54 -0800)]
Make Decl::setOwningModuleID() public. (NFC)

This API is going to be used by LLDB to recreate owning module
information for Decls deserialized from DWARF.

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

4 years agoUpdate debugserver test for new ostype names
Adrian Prantl [Fri, 6 Mar 2020 19:13:04 +0000 (11:13 -0800)]
Update debugserver test for new ostype names

4 years agoRemove unused Endian.h includes, NFC
Reid Kleckner [Wed, 11 Mar 2020 22:39:28 +0000 (15:39 -0700)]
Remove unused Endian.h includes, NFC

Mainly avoids including Host.h everywhere:

$ diff -u <(sort thedeps-before.txt) <(sort thedeps-after.txt) \
    | grep '^[-+] ' | sort | uniq -c | sort -nr
   3141 - /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Host.h

4 years agoDrop a StringMap.h include, NFC
Reid Kleckner [Wed, 11 Mar 2020 22:30:04 +0000 (15:30 -0700)]
Drop a StringMap.h include, NFC

$ diff -u <(sort thedeps-before.txt) <(sort thedeps-after.txt) \
    | grep '^[-+] ' | sort | uniq -c | sort -nr
    231 -    llvm/include/llvm/ADT/StringMap.h
    171 -    llvm/include/llvm/Support/AllocatorBase.h
    142 -    llvm/include/llvm/Support/PointerLikeTypeTraits.h

4 years ago[libc+++] Mark two future tests as being FLAKY
Louis Dionne [Wed, 11 Mar 2020 22:12:34 +0000 (18:12 -0400)]
[libc+++] Mark two future tests as being FLAKY

They are timing sensitive.

4 years ago[InstSimplify][SVE] Fix SimplifyInsert/ExtractElementInst for scalable vector.
Huihui Zhang [Wed, 11 Mar 2020 22:09:01 +0000 (15:09 -0700)]
[InstSimplify][SVE] Fix SimplifyInsert/ExtractElementInst for scalable vector.

Summary:
For scalable vector, index out-of-bound can not be determined at compile-time.
The same apply for VectorUtil findScalarElement().

Add test cases to check the functionality of SimplifyInsert/ExtractElementInst for scalable vector.

Reviewers: sdesmalen, efriedma, spatel, apazos

Reviewed By: efriedma

Subscribers: cameron.mcinally, tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years agoRevert "Temporarily re-apply https://reviews.llvm.org/D74347"
Vladimir Vereschaka [Wed, 11 Mar 2020 22:00:56 +0000 (15:00 -0700)]
Revert "Temporarily re-apply https://reviews.llvm.org/D74347"

This reverts commit 0197eac3330c04a49519f3e4dac38c4de605c654.

The changes break Armv7/Aarch64 toolchain builders:
* http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/5570
* http://lab.llvm.org:8011/builders/llvm-clang-win-x-aarch64/builds/5600

4 years ago[libc++abi] NFC: Simplify extern C declaration
Louis Dionne [Wed, 11 Mar 2020 21:21:40 +0000 (17:21 -0400)]
[libc++abi] NFC: Simplify extern C declaration

It seems to me that abort_message.h is always included in a C++ file, so
it's fine to assume that it's C++ code.

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

4 years ago[runtimes] When COMPILER_RT is enabled, consider SANITIZER prefixes
Petr Hosek [Fri, 6 Mar 2020 22:38:07 +0000 (14:38 -0800)]
[runtimes] When COMPILER_RT is enabled, consider SANITIZER prefixes

Currently we passthrough CMake variables based on project prefix,
i.e. LIBCXX_, LIBCXXABI_, LIBUNWIND_ and COMPILER_RT_. However, many
compiler-rt flags start with SANITIZER_ rather than COMPILER_RT, so
passthrough those as well.

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

4 years agoAdd an SDK attribute to DICompileUnit
Adrian Prantl [Wed, 4 Mar 2020 22:12:54 +0000 (14:12 -0800)]
Add an SDK attribute to DICompileUnit

This is part of PR44213 https://bugs.llvm.org/show_bug.cgi?id=44213

When importing (system) Clang modules, LLDB needs to know which SDK
(e.g., MacOSX, iPhoneSimulator, ...) they came from. While the sysroot
attribute contains the absolute path to the SDK, this doesn't work
well when the debugger is run on a different machine than the
compiler, and the SDKs are installed in different directories. It thus
makes sense to just store the name of the SDK instead of the absolute
path, so it can be found relative to LLDB.

rdar://problem/51645582

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

4 years agoAvoid including FileManager.h from SourceManager.h
Reid Kleckner [Sat, 29 Feb 2020 17:10:42 +0000 (09:10 -0800)]
Avoid including FileManager.h from SourceManager.h

Most clients of SourceManager.h need to do things like turning source
locations into file & line number pairs, but this doesn't require
bringing in FileManager.h and LLVM's FS headers.

The main code change here is to sink SM::createFileID into the cpp file.
I reason that this is not performance critical because it doesn't happen
on the diagnostic path, it happens along the paths of macro expansion
(could be hot) and new includes (less hot).

Saves some includes:
    309 -    /usr/local/google/home/rnk/llvm-project/clang/include/clang/Basic/FileManager.h
    272 -    /usr/local/google/home/rnk/llvm-project/clang/include/clang/Basic/FileSystemOptions.h
    271 -    /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/VirtualFileSystem.h
    267 -    /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/FileSystem.h
    266 -    /usr/local/google/home/rnk/llvm-project/llvm/include/llvm/Support/Chrono.h

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

4 years agoFix formatting after Module.h include adjustment, NFC
Reid Kleckner [Wed, 11 Mar 2020 20:52:28 +0000 (13:52 -0700)]
Fix formatting after Module.h include adjustment, NFC

Forgot to implement code review comments.

4 years ago[PatternMatch] add matcher for FP infinity; NFC
Sanjay Patel [Wed, 11 Mar 2020 20:51:30 +0000 (16:51 -0400)]
[PatternMatch] add matcher for FP infinity; NFC

4 years ago[CUDA,clang-cl] Filter out unsupported arguments for device-side compilation.
Artem Belevich [Thu, 27 Feb 2020 23:35:19 +0000 (15:35 -0800)]
[CUDA,clang-cl] Filter out unsupported arguments for device-side compilation.

Device-side compilation does not support some features and we need to
filter them out when command line options enable them for the host.

We're already doing this in various places in the regular clang driver,
but clang-cl mode constructs cc1 options independently and needs to
implement the filtering, too.

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

4 years agoAvoid including Module.h from ExternalASTSource.h
Reid Kleckner [Fri, 28 Feb 2020 02:13:54 +0000 (18:13 -0800)]
Avoid including Module.h from ExternalASTSource.h

Module.h takes 86ms to parse, mostly parsing the class itself. Avoid it
if possible. ASTContext.h depends on ExternalASTSource.h.

A few NFC changes were needed to make this possible:

- Move ASTSourceDescriptor to Module.h. This needs Module to be
  complete, and seems more related to modules and AST files than
  external AST sources.
- Move "import complete" bit from Module* pointer int pair to
  NextLocalImport pointer. Required because PointerIntPair<Module*,...>
  requires Module to be complete, and now it may not be.

Reviewed By: aaron.ballman, hans

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

4 years agoFix conflict value for metadata "Objective-C Garbage Collection" in the mix of swift...
Jin Lin [Tue, 10 Mar 2020 19:46:40 +0000 (12:46 -0700)]
Fix conflict value for metadata "Objective-C Garbage Collection" in the mix of swift and Objective-C bitcode

Summary:
The change is to fix conflict value for metadata "Objective-C Garbage Collection" in the mix of swift and Objective-C bitcode.
The purpose is to provide the support of LTO for swift and Objective-C mixed project.

Reviewers: rjmccall, ahatanak, steven_wu

Reviewed By: rjmccall, steven_wu

Subscribers: manmanren, mehdi_amini, hiraditya, dexonsmith, llvm-commits, jinlin

Tags: #llvm

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

4 years ago[mlir] Add support for non-identifier attribute names.
River Riddle [Wed, 11 Mar 2020 20:22:19 +0000 (13:22 -0700)]
[mlir] Add support for non-identifier attribute names.

Summary: In some situations the name of the attribute is not representable as a bare-identifier, this revision adds support for those cases by formatting the name as a string instead. This has the added benefit of removing the identifier regex from the verifier.

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

4 years agoRevert "[clang-format] Add option to specify explicit config file"
Mitchell Balan [Wed, 11 Mar 2020 20:12:24 +0000 (16:12 -0400)]
Revert "[clang-format] Add option to specify explicit config file"
There were a number of unexpected test failures.

This reverts commit 10b1a87ba35d386b718f0e83c1d750631705b220.

4 years ago[libc++] Add SHA for C++20 Synchronization Library in ABI changelog
Louis Dionne [Wed, 11 Mar 2020 20:00:50 +0000 (16:00 -0400)]
[libc++] Add SHA for C++20 Synchronization Library in ABI changelog

This is mostly a means to test a new Herald rule for libc++ reviews.

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

4 years ago[clang-format] Add option to specify explicit config file
Mitchell Balan [Wed, 11 Mar 2020 19:53:12 +0000 (15:53 -0400)]
[clang-format] Add option to specify explicit config file
Summary:
This diff extends the -style=file option to allow a config file to be specified explicitly. This is useful (for instance) when adding IDE commands to reformat code to a personal style.

Reviewers: djasper, ioeric, krasimir, MyDeveloperDay

Reviewed by: MyDeveloperDay

Contributed by: tnorth

Subscribers: cfe-commits, lebedev.ri, MyDeveloperDay, klimek, sammccall, mitchell-stellar

Tags: #clang, #clang-format

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

4 years ago[InstCombine] reduce demand-limited bool math to logic
Sanjay Patel [Wed, 11 Mar 2020 18:35:31 +0000 (14:35 -0400)]
[InstCombine] reduce demand-limited bool math to logic

The cmp math test is inspired by memcmp() patterns seen in D75840.
I know there's at least 1 related fold we can do here if both
values are sext'd, but I'm not seeing a way to generalize further.

We have some other bool math patterns that we want to reduce, but
that might require fixing the bogus transforms noted in D72396.

Alive proof translations of the regression tests:
https://rise4fun.com/Alive/zGWi

  Name: demand add 1
  %xz = zext i1 %x to i32
  %ys = sext i1 %y to i32
  %sub = add i32 %xz, %ys
  %r = lshr i32 %sub, 31
  =>
  %notx = xor i1 %x, 1
  %and = and i1 %y, %notx
  %r = zext i1 %and to i32

  Name: demand add 2
  %xz = zext i1 %x to i5
  %ys = sext i1 %y to i5
  %sub = add i5 %xz, %ys
  %r = and i5 %sub, 16
  =>
  %notx = xor i1 %x, 1
  %and = and i1 %y, %notx
  %r = select i1 %and, i5 -16, i5 0

  Name: demand add 3
  %xz = zext i1 %x to i8
  %ys = sext i1 %y to i8
  %a = add i8 %ys, %xz
  %r = ashr i8 %a, 7
  =>
  %notx = xor i1 %x, 1
  %and = and i1 %y, %notx
  %r = sext i1 %and to i8

  Name: cmp math
  %gt = icmp ugt i32 %x, %y
  %lt = icmp ult i32 %x, %y
  %xz = zext i1 %gt to i32
  %yz = zext i1 %lt to i32
  %s = sub i32 %xz, %yz
  %r = lshr i32 %s, 31
  =>
  %r = zext i1 %lt to i32

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

4 years ago[InstCombine] add tests for bool math; NFC
Sanjay Patel [Tue, 10 Mar 2020 21:14:41 +0000 (17:14 -0400)]
[InstCombine] add tests for bool math; NFC

4 years agoAdd a verification mechanism to CompilerType.
Adrian Prantl [Wed, 11 Mar 2020 17:44:15 +0000 (10:44 -0700)]
Add a verification mechanism to CompilerType.

Badly-written code can combine an unrelated TypeSystem and opaque type
pointer into a CompilerType. This is particularly an issue in
swift-lldb. This patch adds an assertion mechanism that catches these
kinds of mistakes early. Because this is an assertion-only code path
there is not cost for release builds.

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

4 years agoAMDGPU: Don't hard error on LDS globals in functions
Matt Arsenault [Wed, 11 Mar 2020 15:49:03 +0000 (11:49 -0400)]
AMDGPU: Don't hard error on LDS globals in functions

Instead, emit a trap and a warning. We force inlining of this
situation, so any function where this happens should be dead as
indirect or external calls are not yet supported. This should avoid
erroring on dead code.

4 years ago[GC] Loosen ordering on statepoint reloads to allow CSE
Philip Reames [Wed, 11 Mar 2020 18:12:28 +0000 (11:12 -0700)]
[GC] Loosen ordering on statepoint reloads to allow CSE

We just removed a broken duplicate elimination algorithm in D75964, and after landed that it occurred to me that duplicate elimination is simply CSE. SelectionDAG has a build in CSE, so why wasn't that triggering? Well, it turns out we were overly conservative in the memory states for our reloads and CSE (rightly) considers the incoming memory state for a load part of the identity of the load.

By loosening the chain and allowing reordering, we also allow CSE. As shown in the test case, doing iterative CSE as we go is enough to eliminate duplicate stores in later statepoints as well. We key our (block local) slot map by SDValue, so commoning a previous pair of loads at construction time means we also common following stores.

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

4 years ago[clang-tidy] Mock system headers for portability-restrict-system-includes tests.
Paula Toth [Wed, 11 Mar 2020 19:12:35 +0000 (12:12 -0700)]
[clang-tidy] Mock system headers for portability-restrict-system-includes tests.

Summary: Didn't realize that headers such as stddef.h may not exist on all systems. This patch mocks the headers so that the check's tests work on all systems.  (:

Reviewers: RKSimon, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang-tools-extra, #clang

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

4 years ago[MLIR] Link MLIRMlirOptMain with the same libraries as mlir-opt
Stephen Neuendorffer [Fri, 6 Mar 2020 23:46:51 +0000 (15:46 -0800)]
[MLIR] Link MLIRMlirOptMain with the same libraries as mlir-opt

MLIRMlirOptMain seems to need the same libraries as mlir-opt.

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

4 years ago[DAG] MatchRotate - Add funnel shift by immediate support
Simon Pilgrim [Wed, 11 Mar 2020 18:55:18 +0000 (18:55 +0000)]
[DAG] MatchRotate - Add funnel shift by immediate support

This patch reuses the existing MatchRotate ROTL/ROTR rotation pattern code to also recognize the more general FSHL/FSHR funnel shift patterns when we have constant shift amounts.

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

4 years ago[MLIR] Do not link mlir-cpu-runner with X86 libs
Stephen Neuendorffer [Wed, 11 Mar 2020 16:50:19 +0000 (09:50 -0700)]
[MLIR] Do not link mlir-cpu-runner with X86 libs

The three libs where recently added to the `mlir-cpu-runner`'s
`CMakeLists.txt` file. This prevent the runner to compile on other
platform (e.g. Power in my case).  Native codegen is pulled in
by the ExecutionEngine library, so this is redundant in any case.

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

4 years agoTemporarily re-apply https://reviews.llvm.org/D74347
Sergej Jaskiewicz [Mon, 17 Feb 2020 12:22:18 +0000 (15:22 +0300)]
Temporarily re-apply https://reviews.llvm.org/D74347

It was reverted in 35367e06b84618e21945674aa22e7cfda1957ea4
because it broke the buildbot due to missing libc++abi headers.

https://reviews.llvm.org/D75991 improves the diagnostics, so I hope
the build log will be more informative.

4 years ago[llvm][CodeGen] IR intrinsics for SVE2 contiguous conflict detection instructions.
Francesco Petrogalli [Wed, 11 Mar 2020 18:25:29 +0000 (18:25 +0000)]
[llvm][CodeGen] IR intrinsics for SVE2 contiguous conflict detection instructions.

Summary:
The IR intrinsics are mapped to the following SVE2 instructions:

* WHILERW <Pd>.<T>, <Xn>, <Xm>
* WHILEWR <Pd>.<T>, <Xn>, <Xm>

The intrinsics introduced in this patch are the IR counterpart of the
SVE ACLE functions `svwhilerw` and `svwhilewr` (all data type
variants).

Patch by Maciej Gąbka <maciej.gabka@arm.com>.

Reviewers: kmclaughlin, rengolin

Reviewed By: kmclaughlin

Subscribers: tschuett, kristof.beyls, hiraditya, danielkiss, llvm-commits

Tags: #llvm

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

4 years ago[AMDGPU] Disable nested endcf collapse
Stanislav Mekhanoshin [Tue, 10 Mar 2020 20:29:11 +0000 (13:29 -0700)]
[AMDGPU] Disable nested endcf collapse

The assumption is that conditional regions are perfectly nested
and a mask restored at the exit from the inner block will be
completely covered by a mask restored in the outer.

It turns out with our current structurizer this is not always
the case.

Disable the optimization for now, but I want to keep it around
for a while to either try after further structurizer changes or
to move it into control flow lowering where we have more info
and reuse the test.

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

4 years ago[MLIR] Guard DMA-specific logic with DMA option
Tim Shen [Wed, 26 Feb 2020 04:16:08 +0000 (20:16 -0800)]
[MLIR] Guard DMA-specific logic with DMA option

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

4 years ago[CodeGenPrepare] Fold br(freeze(icmp x, const)) to br(icmp(freeze x, const))
Juneyoung Lee [Mon, 9 Mar 2020 16:37:36 +0000 (01:37 +0900)]
[CodeGenPrepare] Fold br(freeze(icmp x, const)) to br(icmp(freeze x, const))

Summary:
This patch helps CodeGenPrepare move freeze into the icmp when it is used by branch.
It reenables generation of efficient conditional jumps.

This is only done when at least one of icmp's operands is constant to prevent the transformation from increasing # of freeze instructions.

Performance degradation of MultiSource/Benchmarks/Ptrdist/yacr2/yacr2.test is resolved with this patch.

Checked with Alive2

Reviewers: reames, fhahn, nlopes

Reviewed By: reames

Subscribers: jdoerfert, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[libc++] [cmake] Better diagnostics for missing abi library headers
Sergej Jaskiewicz [Wed, 11 Mar 2020 18:00:46 +0000 (21:00 +0300)]
[libc++] [cmake] Better diagnostics for missing abi library headers

Summary:
This is NFC. We only add additional information to the log.

Reviewers: EricWF, ldionne, mclow.lists

Reviewed By: ldionne

Subscribers: kristof.beyls, dexonsmith, danielkiss, mgorny, ldionne, libcxx-commits

Tags: #libc

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

4 years ago[AMDGPU] Extend macro fusion for ADDC and SUBB to SUBBREV
Jay Foad [Wed, 11 Mar 2020 17:01:24 +0000 (17:01 +0000)]
[AMDGPU] Extend macro fusion for ADDC and SUBB to SUBBREV

Summary:
There's a lot of test case churn but the overall effect is to increase
the number of back-to-back v_sub,v_subbrev pairs, which can execute with
no delay even on gfx10.

Reviewers: arsenm, rampitec, nhaehnle

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[Matrix] Add remark propagation along the inlined-at chain.
Florian Hahn [Wed, 11 Mar 2020 17:01:47 +0000 (17:01 +0000)]
[Matrix] Add remark propagation along  the inlined-at chain.

This patch adds support for propagating matrix expressions along the
inlined-at chain and emitting remarks at the traversed function scopes.

To motivate this new behavior, consider the example below. Without the
remark 'up-leveling', we would only get remarks in load.h and store.h,
but we cannot generate a remark describing the full expression in
toplevel.cpp, which is the place where the user has the best chance of
spotting/fixing potential problems.

With this patch, we generate a remark for the load in load.h, one for
the store in store.h and one for the complete expression in
toplevel.cpp. For a bigger example, please see remarks-inlining.ll.

    load.h:
    template <typename Ty, unsigned R, unsigned C> Matrix<Ty, R, C> load(Ty *Ptr) {
      Matrix<Ty, R, C> Result;
      Result.value = *reinterpret_cast <typename Matrix<Ty, R, C>::matrix_t *>(Ptr);
      return Result;
    }

    store.h:
    template <typename Ty, unsigned R, unsigned C> void store(Matrix<Ty, R, C> M1, Ty *Ptr) {
       *reinterpret_cast<typename decltype(M1)::matrix_t *>(Ptr) = M1.value;
    }

    toplevel.cpp
    void test(double *A, double *B, double *C) {
      store(add(load<double, 3, 5>(A), load<double, 3, 5>(B)), C);
    }

For a given function, we traverse the inlined-at chain for each
matrix instruction (= instructions with shape information). We collect
the matrix instructions in each DISubprogram we visit. This produces a
mapping of DISubprogram -> (List of matrix instructions visible in the
subpogram). We then generate remarks using the list of instructions for
each subprogram in the inlined-at chain. Note that the list of instructions
for a subprogram includes the instructions from its own subprograms
recursively. For example using the example above, for the subprogram
'test' this includes inline functions 'load' and 'store'. This allows
surfacing the remarks at a level useful to users.

Please note that the current approach may create a lot of extra remarks.
Additional heuristics to cut-off the traversal can be implemented in the
future. For example, it might make sense to stop 'up-leveling' once all
matrix instructions are at the same debug location.

Reviewers: anemet, Gerolf, thegameg, hfinkel, andrew.w.kaylor, LuoYuanke

Reviewed By: anemet

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

4 years ago[OPENMP][DOCS]Mark depobj as implemented, NFC.
Alexey Bataev [Wed, 11 Mar 2020 17:26:01 +0000 (13:26 -0400)]
[OPENMP][DOCS]Mark depobj as implemented, NFC.

4 years agoLazily save initialState of registers during unwind.
Sterling Augustine [Thu, 5 Mar 2020 00:29:58 +0000 (16:29 -0800)]
Lazily save initialState of registers during unwind.

Summary:
Copying all of the saved register state on every entry to
parseInstruction is a severe performance contraint, especially
because most of this saved state is never used. On x86 linux
this is about 560 bytes, and will be more on other platforms.

When performance testing libunwind, this memcpy appears at the
top of nearly all our tests.

By only saving this state as needed, we see increasing in performance
of around 2.5% for the ctak test here.

https://github.com/clasp-developers/ctak

Certain internal extremely exception-heavy tasks run in about 2/3
the time.

Note that by stashing the new boolean inside what had been padding in
the original structure, this uses no additional memory.

Subscribers: fedor.sergeev, libcxx-commits

Tags: #libc

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

4 years ago[AArch64][SVE] Add the @llvm.aarch64.sve.sel intrinsic
Andrzej Warzynski [Tue, 10 Mar 2020 15:40:40 +0000 (15:40 +0000)]
[AArch64][SVE] Add the @llvm.aarch64.sve.sel intrinsic

Reviewers: sdesmalen, efriedma

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[GC] Remove buggy untested optimization from statepoint lowering
Philip Reames [Wed, 11 Mar 2020 17:01:11 +0000 (10:01 -0700)]
[GC] Remove buggy untested optimization from statepoint lowering

A downstream test case (see included reduced test) revealed that we have a bug in how we handle duplicate relocations. If we have the same SDValue relocated twice, and that value happens to be a constant (such as null), we only export one of the two llvm::Values. Exporting on a per llvm::Value basis is required to allow lowering of gc.relocates in following basic blocks (e.g. invokes). Without it, we end up with a use of an undefined vreg and bad things happen.

Rather than fixing the optimization - which appears to be hard - I propose we simply remove it. There are no tests in tree that change with this code removed. If we find out later that this did matter for something, we can reimplement a variation of this in CodeGenPrepare to catch the easy cases without complicating the lowering code.

Thanks to Denis and Serguei who did all the hard work of figuring out what went wrong here. The patch is by far the easy part. :)

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

4 years agoAdd a decorator option to skip tests based on a default setting.
Adrian Prantl [Mon, 9 Mar 2020 17:40:33 +0000 (10:40 -0700)]
Add a decorator option to skip tests based on a default setting.

This patch allows skipping a test based on a default setting, which is
useful when running the testsuite in different "modes" based on a
default setting. This is a feature I need for the Swift testsuite, but
I think it's generally useful.

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

4 years ago[ELF] Simplify sh_addr computation and warn if sh_addr is not a multiple of sh_addralign
Fangrui Song [Tue, 3 Mar 2020 23:37:12 +0000 (15:37 -0800)]
[ELF] Simplify sh_addr computation and warn if sh_addr is not a multiple of sh_addralign

See `docs/ELF/linker_script.rst` for the new computation for sh_addr and sh_addralign.
`ALIGN(section_align)` now means: "increase alignment to section_align"
(like yet another input section requirement).

The "start of section .foo changes from 0x11 to 0x20" warning no longer
makes sense. Change it to warn if sh_addr%sh_addralign!=0.

To decrease the alignment from the default max_input_align,
use `.output ALIGN(8) : {}` instead of `.output : ALIGN(8) {}`
See linkerscript/section-address-align.test as an example.

When both an output section address and ALIGN are set (can be seen as an
"undefined behavior" https://sourceware.org/ml/binutils/2020-03/msg00115.html),
lld may align more than GNU ld, but it makes a linker script working
with GNU ld hard to break with lld.

This patch can be considered as restoring part of the behavior before D74736.

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

4 years ago[Object][unittest] Skip tests on machines with non-64 bit size_t
James Henderson [Wed, 11 Mar 2020 15:30:04 +0000 (15:30 +0000)]
[Object][unittest] Skip tests on machines with non-64 bit size_t

Speculative fix for build bot failures such as
http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/14317/

4 years ago[ARM] Extra VFMA tests. NFC
David Green [Wed, 11 Mar 2020 14:24:48 +0000 (14:24 +0000)]
[ARM] Extra VFMA tests. NFC

4 years ago[clangd] Improve the "max limit" error message in rename, NFC.
Haojian Wu [Wed, 11 Mar 2020 15:07:44 +0000 (16:07 +0100)]
[clangd] Improve the "max limit" error message in rename, NFC.

previously, we emited "exceeds the max limit 49" which was weird, now we
emit "exceeds the max limit 50".

4 years agoAMDGPU/GlobalISel: Manually RegBankSelect copies
Matt Arsenault [Thu, 20 Feb 2020 19:00:56 +0000 (14:00 -0500)]
AMDGPU/GlobalISel: Manually RegBankSelect copies

This was failng on any pre-assigned copy to the VCC bank.

This is something of a workaround for the default implementation in
getInstrMappingImpl, and how it treats copy-like operations in
general.

Copy-like operations are considered to only have one result register
bank, rather than separate banks for each source like a normal
instruction. To avoid potentially mishandling reg_sequence with
impossible operand combinations, the generic implementation errors on
impossible costs. If the bank was already assigned, is treated it
as-if it were an unsatisfiable REG_SEQUENCE mapping. We really don't
get any value from any of what getInstrMappingImpl tries to do for
copies, so just directly emit the simple mapping we really want.

4 years ago[MLIR] Remove all-reduce lowering from GPU to NVVM. Use in-dialect lowering instead.
Christian Sigg [Mon, 9 Mar 2020 13:42:04 +0000 (14:42 +0100)]
[MLIR] Remove all-reduce lowering from GPU to NVVM. Use in-dialect lowering instead.

Reviewers: herhut, mravishankar

Reviewed By: herhut

Subscribers: merge_guards_bot, jholewinski, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years agoChange to individual pretty printer classes, remove generic `make_printer`.
Christian Sigg [Wed, 29 Jan 2020 08:57:54 +0000 (09:57 +0100)]
Change to individual pretty printer classes, remove generic `make_printer`.

Summary: Follow-up from D72589.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: merge_guards_bot, llvm-commits

Tags: #llvm

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

4 years ago[unittests][Object] Use matching signedness for expected value
Hubert Tong [Wed, 11 Mar 2020 13:58:10 +0000 (09:58 -0400)]
[unittests][Object] Use matching signedness for expected value

Speculative fix for buildbot breakage:
http://lab.llvm.org:8011/builders/clang-ppc64le-rhel/builds/1899/steps/ninja%20check%201/logs/stdio

D75742 introduces checks that cause bots to complain about comparing
values where the integer types mismatch on signedness.

This patch makes the expected value unsigned in various cases (since the
value being tested is unsigned).

4 years ago[analyzer] Fix a strange compile error on a certain Clang-7.0.0
Artem Dergachev [Wed, 11 Mar 2020 12:53:10 +0000 (15:53 +0300)]
[analyzer] Fix a strange compile error on a certain Clang-7.0.0

error: default initialization of an object of const type
       'const clang::QualType' without a user-provided
       default constructor

  Irrelevant; // A placeholder, whenever we do not care about the type.
  ^
            {}

4 years ago[compiler-rt][tsan] Make fiber support in thread sanitizer dynamic linkable
Joachim Protze [Wed, 11 Mar 2020 13:12:51 +0000 (14:12 +0100)]
[compiler-rt][tsan] Make fiber support in thread sanitizer dynamic linkable

This patch will allow dynamic libraries to call into the fiber support functions
introduced in https://reviews.llvm.org/D54889

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

4 years ago[LIBOMPTARGET]Fix PR45139: Bug in mixing Python and OpenMP target offload.
Alexey Bataev [Tue, 10 Mar 2020 17:07:39 +0000 (13:07 -0400)]
[LIBOMPTARGET]Fix PR45139: Bug in mixing Python and OpenMP target offload.

Summary: Explicitly initialize data members of RTLsTy class upon construction.

Reviewers: grokos

Subscribers: guansong, openmp-commits, caomhin, kkwli0

Tags: #openmp

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

4 years ago[MLIR] Add `and`, `or`, `xor`, `min`, `max` too gpu.all_reduce and the nvvm lowering
Valentin Clement [Wed, 11 Mar 2020 12:56:31 +0000 (13:56 +0100)]
[MLIR] Add `and`, `or`, `xor`, `min`, `max` too gpu.all_reduce and the nvvm lowering

Summary:
This patch add some builtin operation for the gpu.all_reduce ops.
- for Integer only: `and`, `or`, `xor`
- for Float and Integer: `min`, `max`

This is useful for higher level dialect like OpenACC or OpenMP that can lower to the GPU dialect.

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

4 years agoRevert "[MLIR] Add `and`, `or`, `xor`, `min`, `max` too gpu.all_reduce and the nvvm...
Stephan Herhut [Wed, 11 Mar 2020 13:03:03 +0000 (14:03 +0100)]
Revert "[MLIR] Add `and`, `or`, `xor`, `min`, `max` too gpu.all_reduce and the nvvm lowering"

Attribution to original author got lost.

4 years ago[clang-format] Improved identification of C# nullables
Jonathan Coe [Wed, 11 Mar 2020 12:57:29 +0000 (12:57 +0000)]
[clang-format] Improved identification of C# nullables

Summary:
Allow `?` inside C# generics.

Do not mistake casts like `(Type?)` as conditional operators.

Reviewers: krasimir

Subscribers: cfe-commits, MyDeveloperDay

Tags: #clang-format, #clang

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

4 years ago[clang-format] No space in `new()` and `this[Type x]` in C#
Jonathan Coe [Wed, 11 Mar 2020 12:53:53 +0000 (12:53 +0000)]
[clang-format] No space in `new()` and `this[Type x]` in C#

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits, MyDeveloperDay

Tags: #clang-format, #clang

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

4 years ago[NFC][ARM] Add test
Sam Parker [Wed, 11 Mar 2020 11:51:52 +0000 (11:51 +0000)]
[NFC][ARM] Add test

Precommit test for LowOverheadLoops.

4 years ago[NFC][ARM] Reorder some logic
Sam Parker [Wed, 11 Mar 2020 11:39:14 +0000 (11:39 +0000)]
[NFC][ARM] Reorder some logic

Move some logic around in LowOverheadLoop::ValidateLiveOut

4 years ago[X86] Replace (most) X86ISD::SHLD/SHRD usage with ISD::FSHL/FSHR generic opcodes...
Simon Pilgrim [Wed, 11 Mar 2020 11:17:34 +0000 (11:17 +0000)]
[X86] Replace (most) X86ISD::SHLD/SHRD usage with ISD::FSHL/FSHR generic opcodes (PR39467)

For i32 and i64 cases, X86ISD::SHLD/SHRD are close enough to ISD::FSHL/FSHR that we can use them directly, we just need to account for the operand commutation for SHRD.

The i16 SHLD/SHRD case is annoying as the shift amount is modulo-32 (vs funnel shift modulo-16), so I've added X86ISD::FSHL/FSHR equivalents, which matches the generic implementation in all other terms.

Something I'm slightly concerned with is that ISD::FSHL/FSHR legality is controlled by the Subtarget.isSHLDSlow() feature flag - we don't normally use non-ISA features for this but it allows the DAG combines to continue to operate after legalization in a lot more cases.

The X86 *bits.ll changes are all affected by the same issue - we now have a "FSHR(-1,-1,amt) -> ROTR(-1,amt) -> (-1)" simplification that reduces the dependencies enough for the branch fall through code to mess up.

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

4 years ago[LLD][ELF] Add initial LLD LinkerScript docs page
Peter Smith [Tue, 10 Mar 2020 13:26:50 +0000 (13:26 +0000)]
[LLD][ELF] Add initial LLD LinkerScript docs page

LLD implements Linker Scripts as they are described in the GNU ld manual.
This description is far from a specification, with the only true reference
the GNU ld implementation, which has undocumented behaviour that can vary
from release to release.

To make it easy for people to switch between linkers we try to follow GNU
ld implementation details wherever possible. We reserve the right to make
our own decisions where the undocumented GNU ld behaviour is not
appropriate for LLD. We don't have a place to document these decisions and
it can be difficult for users to find out this information.

This file is a statement of the LLD implementation policy and will contain
intentional deviations from GNU ld.

The first patch that will add concrete details to this file is D75724

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

4 years ago[gn build] Port 326bc1da45b
LLVM GN Syncbot [Wed, 11 Mar 2020 10:47:56 +0000 (10:47 +0000)]
[gn build] Port 326bc1da45b

4 years ago[Object] Fix handling of large archive members
James Henderson [Fri, 6 Mar 2020 14:25:32 +0000 (14:25 +0000)]
[Object] Fix handling of large archive members

The archive library truncated the size of archive members whose size was
greater than max uint32_t. This patch fixes the issue and adds some unit
tests to verify.

Reviewed by: ruiu, MaskRay, grimar, rupprecht

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

4 years ago[TTI][ARM][MVE] Refine gather/scatter cost model
Anna Welker [Wed, 11 Mar 2020 10:13:11 +0000 (10:13 +0000)]
[TTI][ARM][MVE] Refine gather/scatter cost model

Refines the gather/scatter cost model, but also changes the TTI
function getIntrinsicInstrCost to accept an additional parameter
which is needed for the gather/scatter cost evaluation.
This did require trivial changes in some non-ARM backends to
adopt the new parameter.
Extending gathers and truncating scatters are now priced cheaper.

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

4 years ago[ARM] Improve codegen of volatile load/store of i64
Victor Campos [Mon, 9 Mar 2020 13:29:37 +0000 (13:29 +0000)]
[ARM] Improve codegen of volatile load/store of i64

Summary:
Instead of generating two i32 instructions for each load or store of a volatile
i64 value (two LDRs or STRs), now emit LDRD/STRD.

These improvements cover architectures implementing ARMv5TE or Thumb-2.

The code generation explicitly deviates from using the register-offset
variant of LDRD/STRD. In this variant, the register allocated to the
register-offset cannot be reused in any of the remaining operands. Such
restriction seems to be non-trivial to implement in LLVM, thus it is
left as a to-do.

Reviewers: dmgreen, efriedma, john.brawn, nickdesaulniers

Reviewed By: efriedma, nickdesaulniers

Subscribers: danielkiss, alanphipps, hans, nathanchance, nickdesaulniers, vvereschaka, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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