platform/upstream/llvm.git
4 years ago[PowerPC] Extend folding RLWINM + RLWINM to post-RA.
Esme-Yi [Tue, 3 Nov 2020 07:44:11 +0000 (07:44 +0000)]
[PowerPC] Extend folding RLWINM + RLWINM to post-RA.

Summary: This patch depends on D89846. We have the patterns to fold 2 RLWINMs in ppc-mi-peephole, while some RLWINM will be generated after RA, for example rGc4690b007743. If the RLWINM generated after RA followed by another RLWINM, we expect to perform the optimization after RA, too.

Reviewed By: shchenz, steven.zhang

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

4 years ago[libcxx] [test] Use error_code::default_error_condition to check errors against the...
Martin Storsjö [Thu, 29 Oct 2020 10:40:13 +0000 (12:40 +0200)]
[libcxx] [test] Use error_code::default_error_condition to check errors against the expected codes

error_code returned from functions might not be of the generic category,
but of the system category, which can have different error code values.
Use default_error_condition() to remap errors to the generic category
where possible, to allow comparing them to the expected values.

Use the ErrorIs() helper instead of a direct comparison against
an excpected value.

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

4 years ago[libcxx] Avoid double frees of file descriptors in the fallback ifstream/ofstream...
Martin Storsjö [Mon, 2 Nov 2020 08:19:42 +0000 (10:19 +0200)]
[libcxx] Avoid double frees of file descriptors in the fallback ifstream/ofstream codepath

So far, most actual uses of libc++ std::filesystem probably use
the sendfile or fcopyfile implementations.

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

4 years ago[libcxx] [test] Create symlink_to_dir as the right kind, as a directory symlink
Martin Storsjö [Fri, 30 Oct 2020 23:01:28 +0000 (01:01 +0200)]
[libcxx] [test] Create symlink_to_dir as the right kind, as a directory symlink

This was missed in 5c39eebc126d.

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

4 years ago[libcxx] [test] Avoid an unused variable in non-libcpp cases in path.append
Martin Storsjö [Thu, 22 Oct 2020 10:28:35 +0000 (13:28 +0300)]
[libcxx] [test] Avoid an unused variable in non-libcpp cases in path.append

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

4 years ago[libcxx] [test] Fix the fs.op.absolute test to cope with windows paths
Martin Storsjö [Wed, 14 Oct 2020 10:16:03 +0000 (13:16 +0300)]
[libcxx] [test] Fix the fs.op.absolute test to cope with windows paths

Prepend the root path on the already_absolute testcase, and construct
a path ending with the preferred separator for the test reference for
"foo/".

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

4 years ago[libcxxabi] Build all of libcxxabi with _LIBCPP_BUILDING_LIBRARY defined
Martin Storsjö [Fri, 30 Oct 2020 17:11:23 +0000 (19:11 +0200)]
[libcxxabi] Build all of libcxxabi with _LIBCPP_BUILDING_LIBRARY defined

Various definitions from libcxx need to be set in the same way
as if building libcxx itself.

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

4 years ago[scan-build] Fix clang++ pathname again
Stephan Bergmann [Thu, 15 Oct 2020 16:10:22 +0000 (18:10 +0200)]
[scan-build] Fix clang++ pathname again

e00629f777d9d62875730f40d266727df300dbb2 "[scan-build] Fix clang++ pathname" had
removed the -MAJOR.MINOR suffix, but since presumably LLVM 7 the suffix is only
-MAJOR, so ClangCXX (i.e., the CLANG_CXX environment variable passed to
clang/tools/scan-build/libexec/ccc-analyzer) now contained a non-existing
/path/to/clang-12++ (which apparently went largely unnoticed as
clang/tools/scan-build/libexec/ccc-analyzer falls back to just 'clang++' if the
executable denoted by CLANG_CXX does not exist).

For the new clang/test/Analysis/scan-build/cxx-name.test to be effective,
%scan-build must now take care to pass the clang executable's resolved pathname
(i.e., ending in .../clang-MAJOR rather than just .../clang) to --use-analyzer.

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

4 years ago[NFC] Split lambda into 2 parts for further reuse
Max Kazantsev [Tue, 3 Nov 2020 07:13:28 +0000 (14:13 +0700)]
[NFC] Split lambda into 2 parts for further reuse

4 years ago[RISCV] Remove isel patterns for fshl/fshr with same inputs. NFC
Craig Topper [Tue, 3 Nov 2020 06:54:20 +0000 (22:54 -0800)]
[RISCV] Remove isel patterns for fshl/fshr with same inputs. NFC

These were being selected to ROL/ROR, but DAG combine should
canonicalize fshl/fshr with same inputs to rotl/rotr which we
also have patterns for.

4 years ago[IndVars] Use knowledge about execution on last iteration when removing checks
Max Kazantsev [Tue, 3 Nov 2020 06:18:46 +0000 (13:18 +0700)]
[IndVars] Use knowledge about execution on last iteration when removing checks

If we know that some check will not be executed on the last iteration, we can use this
fact to eliminate its check.

Differential Revision: https://reviews.llvm.org/D88210
Reviwed By: ebrevnov

4 years ago[NFC][PowerPC] Move the folding RLWINMs from ppc-mi-peephole to PPCInstrInfo.
Esme-Yi [Tue, 3 Nov 2020 06:28:56 +0000 (06:28 +0000)]
[NFC][PowerPC] Move the folding RLWINMs from ppc-mi-peephole to PPCInstrInfo.

Summary: We have the patterns to fold 2 RLWINMs in ppc-mi-peephole, while some RLWINM will be generated after RA, for example D88274. If the RLWINM generated after RA followed by another RLWINM, we expect to perform the optimization after RA, too.
This is a NFC patch to move the folding patterns to PPCInstrInfo, and the follow-up works will be calling it in pre-emit-peephole and expand the patterns to handle more cases.

Reviewed By: shchenz

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

4 years ago[Flang][OpenMP][NFC][1/2] Reorder OmpStructureChecker and simplify it.
Sameeran joshi [Wed, 28 Oct 2020 18:13:49 +0000 (23:43 +0530)]
[Flang][OpenMP][NFC][1/2] Reorder OmpStructureChecker and simplify it.

`OmpStructureChecker` has too much boilerplate code in source file.
It was not easy to figure out the seperation of clauses inside 'OmpClause' and
the ones which had a seperate node in parse-tree.h.

This patch:
1. Removes the boilerplate by defining a few macros.
2. Makes seperation between constructs, directives and clauses(sub classes are seperated).
3. Macros could have been shared between OMP and OACC, template specilizations might have
   been costly hence used macros.
Follows the same strategy used for `AccStructureChecker`.

Next patch in series to simplify OmpStructureChecker would try to simplify
boilerplates inside the functions and either create abstractions or use if
something is available inside check-directive-structure.h

Reviewed By: kiranchandramohan, clementval

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

4 years agoPut back the test pragma-fp-exc.cpp
Serge Pavlov [Tue, 3 Nov 2020 05:24:22 +0000 (12:24 +0700)]
Put back the test pragma-fp-exc.cpp

This test was removed in 5963e028e714 because it failed on cores where
support of constrained intrinsics was limited. Now this test is enabled
only on x86.

4 years ago[Libomptarget][NFC] Move global Libomptarget state to a struct
Atmn Patel [Fri, 30 Oct 2020 05:04:34 +0000 (01:04 -0400)]
[Libomptarget][NFC] Move global Libomptarget state to a struct

Presently, there a number of global variables in libomptarget (devices,
RTLs, tables, mutexes, etc.) that are not placed within a struct. This
patch places them into a struct ``PluginManager``. All of the functions
that act on this data remain free.

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

4 years ago[docs] Fix clang/docs/UsersManual.rst after D87528 & D88446
Fangrui Song [Tue, 3 Nov 2020 05:07:15 +0000 (21:07 -0800)]
[docs] Fix clang/docs/UsersManual.rst after D87528 & D88446

4 years ago[polly] Fix -Wunused-lambda-capture and -Wunused-variable
Fangrui Song [Tue, 3 Nov 2020 04:35:26 +0000 (20:35 -0800)]
[polly] Fix -Wunused-lambda-capture and -Wunused-variable

4 years ago[sanitizer] Cleanup -Wnon-virtual-dtor warnings
Vitaly Buka [Tue, 3 Nov 2020 01:33:22 +0000 (17:33 -0800)]
[sanitizer] Cleanup -Wnon-virtual-dtor warnings

4 years ago[CodeGen] Fix regression from D83655
Jessica Clarke [Tue, 3 Nov 2020 03:57:46 +0000 (03:57 +0000)]
[CodeGen] Fix regression from D83655

Arm EHABI has a null LSDASection as it does its own thing, so we should
continue to return null in that case rather than try and cast it.

4 years ago[RISCV] Only return DestSourcePair from isCopyInstrImpl for registers
Jessica Clarke [Tue, 3 Nov 2020 03:55:47 +0000 (03:55 +0000)]
[RISCV] Only return DestSourcePair from isCopyInstrImpl for registers

ADDI often has a frameindex in operand 1, but consumers of this
interface, such as MachineSink, tend to call getReg() on the Destination
and Source operands, leading to the following crash when building
FreeBSD after this implementation was added in 8cf6778d30:

```
clang: llvm/include/llvm/CodeGen/MachineOperand.h:359: llvm::Register llvm::MachineOperand::getReg() const: Assertion `isReg() && "This is not a register operand!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
 #0 0x00007f4286f9b4d0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) llvm/lib/Support/Unix/Signals.inc:563:0
 #1 0x00007f4286f9b587 PrintStackTraceSignalHandler(void*) llvm/lib/Support/Unix/Signals.inc:630:0
 #2 0x00007f4286f9926b llvm::sys::RunSignalHandlers() llvm/lib/Support/Signals.cpp:71:0
 #3 0x00007f4286f9ae52 SignalHandler(int) llvm/lib/Support/Unix/Signals.inc:405:0
 #4 0x00007f428646ffd0 (/lib/x86_64-linux-gnu/libc.so.6+0x3efd0)
 #5 0x00007f428646ff47 raise /build/glibc-2ORdQG/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #6 0x00007f42864718b1 abort /build/glibc-2ORdQG/glibc-2.27/stdlib/abort.c:81:0
 #7 0x00007f428646142a __assert_fail_base /build/glibc-2ORdQG/glibc-2.27/assert/assert.c:89:0
 #8 0x00007f42864614a2 (/lib/x86_64-linux-gnu/libc.so.6+0x304a2)
 #9 0x00007f428d4078e2 llvm::MachineOperand::getReg() const llvm/include/llvm/CodeGen/MachineOperand.h:359:0
#10 0x00007f428d8260e7 attemptDebugCopyProp(llvm::MachineInstr&, llvm::MachineInstr&) llvm/lib/CodeGen/MachineSink.cpp:862:0
#11 0x00007f428d826442 performSink(llvm::MachineInstr&, llvm::MachineBasicBlock&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::SmallVectorImpl<llvm::MachineInstr*>&) llvm/lib/CodeGen/MachineSink.cpp:918:0
#12 0x00007f428d826e27 (anonymous namespace)::MachineSinking::SinkInstruction(llvm::MachineInstr&, bool&, std::map<llvm::MachineBasicBlock*, llvm::SmallVector<llvm::MachineBasicBlock*, 4u>, std::less<llvm::MachineBasicBlock*>, std::allocator<std::pair<llvm::MachineBasicBlock* const, llvm::SmallVector<llvm::MachineBasicBlock*, 4u> > > >&) llvm/lib/CodeGen/MachineSink.cpp:1073:0
#13 0x00007f428d824a2c (anonymous namespace)::MachineSinking::ProcessBlock(llvm::MachineBasicBlock&) llvm/lib/CodeGen/MachineSink.cpp:410:0
#14 0x00007f428d824513 (anonymous namespace)::MachineSinking::runOnMachineFunction(llvm::MachineFunction&) llvm/lib/CodeGen/MachineSink.cpp:340:0
```

Thus, check that operand 1 is also a register in the condition.

Reviewed By: arichardson, luismarques

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

4 years ago[crashlog] Remove commented out code (NFC)
Jonas Devlieghere [Tue, 3 Nov 2020 03:46:43 +0000 (19:46 -0800)]
[crashlog] Remove commented out code (NFC)

Remove commented out code and print statements.

4 years ago[crashlog] Turn crash log parsing modes into a Python 'enum' (NFC)
Jonas Devlieghere [Tue, 3 Nov 2020 03:18:51 +0000 (19:18 -0800)]
[crashlog] Turn crash log parsing modes into a Python 'enum' (NFC)

Python doesn't support enums before PEP 435, but using a class with
constants is how it's commonly emulated. It can be converted into a real
Enum (in Python 3.4 and later) by extending the Enum class:

  class CrashLogParseMode(Enum):
      NORMAL = 0
      THREAD = 1
      IMAGES = 2
      THREGS = 3
      SYSTEM = 4
      INSTRS = 5

4 years ago[PowerPC] Skip IEEE 128-bit FP type in FastISel
Qiu Chaofan [Tue, 3 Nov 2020 03:17:11 +0000 (11:17 +0800)]
[PowerPC] Skip IEEE 128-bit FP type in FastISel

Vector types, quadword integers and f128 currently cannot be handled in
FastISel. We did not skip f128 type in lowering arguments, which causes
a crash. This patch will fix it.

Reviewed By: steven.zhang

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

4 years ago[PowerPC] [NFC] Rename VCMPo to VCMP_rec
Qiu Chaofan [Tue, 3 Nov 2020 02:53:35 +0000 (10:53 +0800)]
[PowerPC] [NFC] Rename VCMPo to VCMP_rec

Reviewed By: jsji

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

4 years ago[crashlog] Fix and simplify the way we import lldb
Jonas Devlieghere [Tue, 3 Nov 2020 02:56:24 +0000 (18:56 -0800)]
[crashlog] Fix and simplify the way we import lldb

Don't try to guess the location of LLDB.framework but use xcrun to ask
the command line driver for the location of the lldb module.

4 years ago[Syntax] DeclaratorList is a List
Sam McCall [Sat, 31 Oct 2020 20:20:27 +0000 (21:20 +0100)]
[Syntax] DeclaratorList is a List

I think this was just an oversight.

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

4 years agoAdd textual header PPCTypes.def to module Clang_Basic after D81508
Fangrui Song [Tue, 3 Nov 2020 02:23:26 +0000 (18:23 -0800)]
Add textual header PPCTypes.def to module Clang_Basic after D81508

4 years ago[LICM] Add assert of AST/MSSA exclusiveness.
Alina Sbirlea [Tue, 3 Nov 2020 01:50:53 +0000 (17:50 -0800)]
[LICM] Add assert of AST/MSSA exclusiveness.

The API `canSinkOrHoistInst` may be called by LoopSink. Add assert to
avoid having two analyses passed in.

4 years ago[sanitizer] Make destructors protected
Vitaly Buka [Tue, 3 Nov 2020 00:42:20 +0000 (16:42 -0800)]
[sanitizer] Make destructors protected

4 years agoRemove unused parameter
Akira Hatanaka [Tue, 3 Nov 2020 01:40:06 +0000 (17:40 -0800)]
Remove unused parameter

4 years ago[mlir][Affine] Remove single iteration affine.for ops in AffineLoopNormalize
Diego Caballero [Tue, 27 Oct 2020 20:21:00 +0000 (13:21 -0700)]
[mlir][Affine] Remove single iteration affine.for ops in AffineLoopNormalize

This patch renames AffineParallelNormalize to AffineLoopNormalize to make it
more generic and be able to hold more loop normalization transformations in
the future for affine.for and affine.parallel ops. Eventually, it could also be
extended to support scf.for and scf.parallel. As a starting point for affine.for,
the patch also adds support for removing single iteration affine.for ops to the
the pass.

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

4 years agoAdd parallelTransformReduce and parallelForEachError
Reid Kleckner [Mon, 2 Nov 2020 18:15:34 +0000 (10:15 -0800)]
Add parallelTransformReduce and parallelForEachError

parallelTransformReduce is modelled on the C++17 pstl API of
std::transform_reduce, except our wrappers do not use execution policy
parameters.

parallelForEachError allows loops that contain potentially failing
operations to propagate errors out of the loop. This was one of the
major challenges I encountered while parallelizing PDB type merging in
LLD. Parallelizing a loop with parallelForEachError is not behavior
preserving: the loop will no longer stop on the first error, it will
continue working and report all errors it encounters in a list.

I plan to use this to propagate errors out of LLD's
coff::TpiSource::remapTpiWithGHashes, which currently stores errors an
error in the TpiSource object.

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

4 years ago[PowerPC] Parse and ignore .machine ppc64
Fangrui Song [Tue, 3 Nov 2020 00:49:56 +0000 (16:49 -0800)]
[PowerPC] Parse and ignore .machine ppc64

In the wild, kexec-tools purgatory/arch/ppc64/v2wrap.S and hvcall.S
use this directive.

4 years ago[mlir][Linalg] Add more utility functions to LinalgDependenceGraph.
MaheshRavishankar [Tue, 3 Nov 2020 00:04:14 +0000 (16:04 -0800)]
[mlir][Linalg] Add more utility functions to LinalgDependenceGraph.

Reviewed By: ThomasRaoux

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

4 years ago[darwin] add support for __isPlatformVersionAtLeast check for if (@available)
Alex Lorenz [Thu, 29 Oct 2020 05:48:59 +0000 (22:48 -0700)]
[darwin] add support for __isPlatformVersionAtLeast check for if (@available)

The __isPlatformVersionAtLeast routine is an implementation of `if (@available)` check
that uses the _availability_version_check API on Darwin that's supported on
macOS 10.15, iOS 13, tvOS 13 and watchOS 6.

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

4 years ago[libc++] Fix invalid parsing of ints in a <random> test
Louis Dionne [Tue, 3 Nov 2020 00:18:37 +0000 (19:18 -0500)]
[libc++] Fix invalid parsing of ints in a <random> test

The strings were concatenated together without adding spaces between
numbers, which lead to numbers that wouldn't fit in an unsigned int.

Thanks to Casey Carter for the find.

4 years ago[scudo][standalone] Code tidying (NFC)
Kostya Kortchinsky [Mon, 2 Nov 2020 22:27:11 +0000 (14:27 -0800)]
[scudo][standalone] Code tidying (NFC)

- we have clutter-reducing helpers for relaxed atomics that were barely
  used, use them everywhere we can
- clang-format everything with a recent version

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

4 years ago[cc1as] Close MCAsmParser before MCStreamer
Fangrui Song [Mon, 2 Nov 2020 23:56:56 +0000 (15:56 -0800)]
[cc1as] Close MCAsmParser before MCStreamer

This is a pre-existing problem exposed by D90511 (asan failurs with
clang/test/Driver/relax.s and a few other tests).

4 years ago[NFC] Use [MC]Register in Live-ness tracking
Gaurav Jain [Fri, 23 Oct 2020 05:15:56 +0000 (22:15 -0700)]
[NFC] Use [MC]Register in Live-ness tracking

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

4 years ago[pstl] Replace direct use of assert() with _PSTL_ASSERT
Thomas Rodgers [Mon, 2 Nov 2020 23:11:41 +0000 (18:11 -0500)]
[pstl] Replace direct use of assert() with _PSTL_ASSERT

Standard libraries may (libstdc++ in particular) forbid direct use of
assert()/<cassert> in library code.

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

4 years agoReland - [Clang] Add the ability to map DLL storage class to visibility
Ben Dunbobbin [Mon, 2 Nov 2020 23:24:04 +0000 (23:24 +0000)]
Reland - [Clang] Add the ability to map DLL storage class to visibility

415f7ee883 had LIT test failures on any build where the clang executable
was not called "clang". I have adjusted the LIT CHECKs to remove the
binary name to fix this.

Original commit message:

For PlayStation we offer source code compatibility with
Microsoft's dllimport/export annotations; however, our file
format is based on ELF.

To support this we translate from DLL storage class to ELF
visibility at the end of codegen in Clang.

Other toolchains have used similar strategies (e.g. see the
documentation for this ARM toolchain:

https://developer.arm.com/documentation/dui0530/i/migrating-from-rvct-v3-1-to-rvct-v4-0/changes-to-symbol-visibility-between-rvct-v3-1-and-rvct-v4-0)

This patch adds the ability to perform this translation. Options
are provided to support customizing the mapping behaviour.

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

4 years ago[MLIR] Remove unnecessary CHECK's from tests for which we do not run FileCheck.
Rahul Joshi [Mon, 2 Nov 2020 23:02:38 +0000 (15:02 -0800)]
[MLIR] Remove unnecessary CHECK's from tests for which we do not run FileCheck.

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

4 years agoRevert "[CUDA] Allow local static variables with target attributes."
Artem Belevich [Mon, 2 Nov 2020 23:08:26 +0000 (15:08 -0800)]
Revert "[CUDA] Allow local static variables with target attributes."

This reverts commit f38a9e51178add132d2c8ae160787fb2175a48a4
Which triggered assertions.

4 years ago[MachO] Also recongize __swift_ast as a debug info section
Jonas Devlieghere [Mon, 2 Nov 2020 22:41:18 +0000 (14:41 -0800)]
[MachO] Also recongize __swift_ast as a debug info section

Address post-commit review from Adrian.

4 years ago[mlir] Optimize Op definitions and registration to optimize for code size
River Riddle [Mon, 2 Nov 2020 22:21:02 +0000 (14:21 -0800)]
[mlir] Optimize Op definitions and registration to optimize for code size

This revision refactors the base Op/AbstractOperation classes to reduce the amount of generated code size when defining a new operation. The current scheme involves taking the address of functions defined directly on Op and Trait classes. This is problematic because even when these functions are empty/unused we still result in these functions being defined in the main executable. In this revision, we switch to using SFINAE and template type filtering to remove remove functions that are not needed/used. For example, if an operation does not define a custom `print` method we shouldn't define a templated `printAssembly` method for it. The same applies to parsing/folding/verification/etc. This dropped MLIR code size for a large downstream library by ~10%(~1 mb in an opt build).

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

4 years ago[CUDA] Allow local static variables with target attributes.
Artem Belevich [Fri, 25 Sep 2020 23:25:27 +0000 (16:25 -0700)]
[CUDA] Allow local static variables with target attributes.

While CUDA documentation claims that such variables are not allowed[1], NVCC has
been accepting them since CUDA-10.0[2] and some headers in CUDA-11 rely on this
working.

1. https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#static-variables-function
2. https://godbolt.org/z/zsodzc

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

4 years ago[AsmPrinter] Split up .gcc_except_table
Fangrui Song [Mon, 2 Nov 2020 22:36:25 +0000 (14:36 -0800)]
[AsmPrinter] Split up .gcc_except_table

MC currently produces monolithic .gcc_except_table section. GCC can split up .gcc_except_table:

* if comdat: `.section .gcc_except_table._Z6comdatv,"aG",@progbits,_Z6comdatv,comdat`
* otherwise, if -ffunction-sections: `.section .gcc_except_table._Z3fooi,"a",@progbits`

This ensures that (a) non-prevailing copies are discarded and (b)
.gcc_except_table associated to discarded text sections can be discarded by a
.gcc_except_table-aware linker (GNU ld, but not gold or LLD)

This patches matches the GCC behavior. If -fno-unique-section-names is
specified, we don't append the suffix. If -ffunction-sections is additionally specified,
use `.section ...,unique`.

Note, if clang driver communicates that the linker is LLD and we know it
is new (11.0.0 or later) we can use SHF_LINK_ORDER to avoid string table
costs, at least in the -fno-unique-section-names case. We cannot use it on GNU
ld because as of binutils 2.35 it does not support mixed SHF_LINK_ORDER &
non-SHF_LINK_ORDER components in an output section
https://sourceware.org/bugzilla/show_bug.cgi?id=26256

For RISC-V -mrelax, this patch additionally fixes an assembler-linker
interaction problem: because a section is shrinkable, the length of a call-site
code range is not a constant. Relocations referencing the associated text
section (STT_SECTION) are needed. However, a STB_LOCAL relocation referencing a
discarded section group member from outside the group is disallowed by the ELF
specification (PR46675):

```
// a.cc
inline int comdat() { try { throw 1; } catch (int) { return 1; } return 0; }
int main() { return comdat(); }

// b.cc
inline int comdat() { try { throw 1; } catch (int) { return 1; } return 0; }
int foo() { return comdat(); }

clang++ -target riscv64-linux -c a.cc b.cc -fPIC -mno-relax
ld.lld -shared a.o b.o => ld.lld: error: relocation refers to a symbol in a discarded section:
```

-fbasic-block-sections= is similar to RISC-V -mrelax: there are outstanding relocations.

Reviewed By: jrtc27, rahmanl

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

4 years ago[LoopFusion] Regenerate test checks (NFC)
Nikita Popov [Mon, 2 Nov 2020 21:42:06 +0000 (22:42 +0100)]
[LoopFusion] Regenerate test checks (NFC)

4 years ago[GWP-ASan] Stub out backtrace/signal functions on Fuchsia
Kostya Kortchinsky [Sat, 31 Oct 2020 18:09:29 +0000 (11:09 -0700)]
[GWP-ASan] Stub out backtrace/signal functions on Fuchsia

The initial version of GWP-ASan on Fuchsia doesn't support crash and
signal handlers, so this just adds empty stubs to be able to compile
the project on the platform.

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

4 years ago[MLIR] Work around an ICE in GCC 7.
Benjamin Kramer [Mon, 2 Nov 2020 21:46:19 +0000 (22:46 +0100)]
[MLIR] Work around an ICE in GCC 7.

Looks like we have a blind spot in the testing matrix.

AsyncRegionRewriter.cpp: In member function ‘virtual void {anonymous}::GpuAsyncRegionPass::runOnFunction()’:
AsyncRegionRewriter.cpp:113:16: internal compiler error: in replace_placeholders_r, at cp/tree.c:2804
   if (getFunction()
       ~~~~~~~~~~~~~
           .getRegion()
           ~~~~~~~~~~~~
           .walk(Callback{OpBuilder{&getContext()}})
           ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

4 years ago[MLIR] Introduce std.global_memref and std.get_global_memref operations.
Rahul Joshi [Mon, 2 Nov 2020 19:21:29 +0000 (11:21 -0800)]
[MLIR] Introduce std.global_memref and std.get_global_memref operations.

- Add standard dialect operations to define global variables with memref types and to
  retrieve the memref for to a named global variable
- Extend unit tests to test verification for these operations.

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

4 years ago[flang] Fix actual argument character length and length error reporting
peter klausler [Fri, 30 Oct 2020 20:28:10 +0000 (13:28 -0700)]
[flang] Fix actual argument character length and length error reporting

Ensure that character length is properly calculated for
actual arguments to intrinsics, and that source provenance
information is available when expression analysis calls
folding in cases where the length is invalid.

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

4 years ago[NFC][AMDGPU] Restructure the AMDGPU memory model description
Tony [Sat, 31 Oct 2020 04:43:55 +0000 (04:43 +0000)]
[NFC][AMDGPU] Restructure the AMDGPU memory model description

Separate the AMDGPU memory model description into separate sections
for each architecture.

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

4 years ago[IndVars] Regenerate test checks (NFC)
Nikita Popov [Mon, 2 Nov 2020 21:30:51 +0000 (22:30 +0100)]
[IndVars] Regenerate test checks (NFC)

4 years ago[LazyCallGraph] Build SCCs of the reference graph in order
Fangrui Song [Mon, 2 Nov 2020 21:22:42 +0000 (13:22 -0800)]
[LazyCallGraph] Build SCCs of the reference graph in order

```
// The legacy PM CGPassManager discovers SCCs this way:
for function in the source order
  tarjanSCC(function)

// While the new PM CGSCCPassManager does:
for function in the reversed source order [1]
  discover a reference graph SCC
  build call graph SCCs inside the reference graph SCC
```

In the common cases, reference graph ~= call graph, the new PM order is
undesired because for `a | b | c` (3 independent functions), the new PM will
process them in the reversed order: c, b, a. If `a <-> b <-> c`, we can see
that `-print-after-all` will report the sole SCC as `scc: (c, b, a)`.

This patch corrects the iteration order. The discovered SCC order will match
the legacy PM in the common cases.

For some tests (`Transforms/Inline/cgscc-*.ll` and
`unittests/Analysis/CGSCCPassManagerTest.cpp`), the behaviors are dependent on
the SCC discovery order and there are too many check lines for the particular
order.  This patch simply reverses the function order to avoid changing too many
check lines.

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

4 years ago[Coroutines][Docs] Remove frame packing as a TODO
Atmn Patel [Sun, 1 Nov 2020 11:42:29 +0000 (06:42 -0500)]
[Coroutines][Docs] Remove frame packing as a TODO

This has already been done by @rjmccall in D76526 (49e5a97ec363), and
9514c048d89e. We should remove this from the docs.

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

4 years agoFix build error on bots after 9f151df17800e1668c32e5314a290ae94c8f2dd3
Duncan P. N. Exon Smith [Mon, 2 Nov 2020 20:55:02 +0000 (15:55 -0500)]
Fix build error on bots after 9f151df17800e1668c32e5314a290ae94c8f2dd3

Attempt to fix build error on bots not seen locally.

4 years ago[mlir][Bufferize] Rename TestBufferPlacement to TestFinalizingBufferize
Sean Silva [Thu, 22 Oct 2020 19:47:29 +0000 (12:47 -0700)]
[mlir][Bufferize] Rename TestBufferPlacement to TestFinalizingBufferize

BufferPlacement is no longer part of bufferization. However, this test
is an important test of "finalizing" bufferize passes.
A "finalizing" bufferize conversion is one that performs a "full"
conversion and expects all tensors to be gone from the program. This in
particular involves rewriting funcs (including block arguments of the
contained region), calls, and returns. The unique property of finalizing
bufferization passes is that they cannot be done via a local
transformation with suitable materializations to ensure composability
(as other bufferization passes do). For example, if a call is
rewritten, the callee needs to be rewritten otherwise the IR will end up
invalid. Thus, finalizing bufferization passes require an atomic change
to the entire program (e.g. the whole module).

This new designation makes it clear also that it shouldn't be testing
bufferization of linalg ops, so the tests have been updated to not use
linalg.generic ops. (linalg.copy is still used as the "copy" op for
copying into out-params)

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

4 years ago[mlir] Add func-bufferize pass.
Sean Silva [Mon, 26 Oct 2020 19:52:28 +0000 (12:52 -0700)]
[mlir] Add func-bufferize pass.

This is the most basic possible finalizing bufferization pass, which I
also think is sufficient for most new use cases. The more concentrated
nature of this pass also greatly clarifies the invariants that it
requires on its input to safely transform the program (see the
pass description in Passes.td).

With this pass, I have now upstreamed practically all of the
bufferizations from npcomp (the exception being std.constant, which can
be upstreamed when std.global_memref lands:
https://llvm.discourse.group/t/rfc-global-variables-in-mlir/2076/16 )

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

4 years ago[MC] Make MCStreamer aware of AsmParser's StartTokLoc
Fangrui Song [Mon, 2 Nov 2020 20:32:06 +0000 (12:32 -0800)]
[MC] Make MCStreamer aware of AsmParser's StartTokLoc

A SMLoc allows MCStreamer to report location-aware diagnostics, which
were previously done by adding SMLoc to various methods (e.g. emit*) in an ad-hoc way.

Since the file:line is most important, the column is less important and
the start token location suffices in many cases, this patch reverts
b7e7131af2dd7bdb03fa42a3bc1b4bc72ab95ce1

```
// old
symbol-binding-changed.s:6:8: error: local changed binding to STB_GLOBAL
.globl local
       ^
// new
symbol-binding-changed.s:6:1: error: local changed binding to STB_GLOBAL
.globl local
^
```

Reviewed By: rnk

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

4 years ago[clangd] Add -log=public to redact all request info from index server logs
Sam McCall [Sat, 31 Oct 2020 10:30:26 +0000 (11:30 +0100)]
[clangd] Add -log=public to redact all request info from index server logs

The index server has access to potentially-sensitive information, e.g. a
sequence of fuzzyFind requests reveals details about code completions in the
editor which in turn reveals details about the code being edited.
This information is necessary to provide the service, and our intention[1] is it
should never be retained beyond the scope of the request (e.g. not logged).

At the same time, some log messages should be exposed:
 - server startup/index reloads etc that don't pertain to a user request
 - basic request logs (method, latency, #results, error code) for monitoring
 - errors while handling requests, without request-specific data
The -log=public design accommodates these by allowing three types of logs:
 - those not associated with any user RPC request (via context-propagation)
 - those explicitly tagged as [public] in the log line
 - logging of format strings only, with no interpolated data (error level only)

[1] Specifically: Google is likely to run public instances of this server
for LLVM and potentially other projects, they will run in this configuration.
The details agreed in a Google-internal privacy review.
As clangd developers, we'd encourage others to use this configuration for public
instances too.

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

4 years agoIgnore template instantiations if not in AsIs mode
Stephen Kelly [Mon, 1 Jun 2020 12:40:20 +0000 (13:40 +0100)]
Ignore template instantiations if not in AsIs mode

Summary:
IgnoreUnlessSpelledInSource mode should ignore these because they are
not written in the source.  This matters for example when trying to
replace types or values which are templated.  The new test in
TransformerTest.cpp in this commit demonstrates the problem.

In existing matcher code, users can write
`unless(isInTemplateInstantiation())` or `unless(isInstantiated())` (the
user must know which to use).  The point of the
TK_IgnoreUnlessSpelledInSource mode is to allow the novice to avoid such
details.  This patch changes the IgnoreUnlessSpelledInSource mode to
skip over implicit template instantiations.

This patch does not change the TK_AsIs mode.

Note: An obvious attempt at an alternative implementation would simply
change the shouldVisitTemplateInstantiations() in ASTMatchFinder.cpp to
return something conditional on the operational TraversalKind.  That
does not work because shouldVisitTemplateInstantiations() is called
before a possible top-level traverse() matcher changes the operational
TraversalKind.

Reviewers: sammccall, aaron.ballman, gribozavr2, ymandel, klimek

Subscribers: cfe-commits

Tags: #clang

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

4 years agoRename CXXUnresolvedConstructExpr::arg_size for consistency
Stephen Kelly [Fri, 30 Oct 2020 16:49:24 +0000 (16:49 +0000)]
Rename CXXUnresolvedConstructExpr::arg_size for consistency

Make it possible to use argumentCountIs and hasArgument with
CXXUnresolvedConstructExpr.

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

4 years ago[FileCheck] Added documentation for --allow-unused-prefixes
Mircea Trofin [Mon, 2 Nov 2020 16:46:53 +0000 (08:46 -0800)]
[FileCheck] Added documentation for --allow-unused-prefixes

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

4 years agoChange Module::ASTFile and ModuleFile::File => Optional<FileEntryRef>, NFC
Duncan P. N. Exon Smith [Tue, 20 Oct 2020 22:11:52 +0000 (18:11 -0400)]
Change Module::ASTFile and ModuleFile::File => Optional<FileEntryRef>, NFC

Change `Module::ASTFile` and `ModuleFile::File` to use
`Optional<FileEntryRef>` instead of `const FileEntry *`. One of many
steps toward removing `FileEntry::getName`.

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

4 years ago[clangd] Fix check-clangd with no clang built
Sam McCall [Sat, 31 Oct 2020 11:36:17 +0000 (12:36 +0100)]
[clangd] Fix check-clangd with no clang built

- pass required=False to use_clang(), as we don't need it
- fix required=False (which was unused and rotted):
  - make derived substitutions conditional on it
  - add a feature so we can disable tests that need it
- conditionally disable our one test that depends on %resource_dir.
  This doesn't seem right from first principles, but isn't a big deal.

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

4 years ago[Hexagon] Move isTypeForHVX from Hexagon TTI to HexagonSubtarget, NFC
Krzysztof Parzyszek [Mon, 2 Nov 2020 19:57:42 +0000 (13:57 -0600)]
[Hexagon] Move isTypeForHVX from Hexagon TTI to HexagonSubtarget, NFC

It's useful outside of Hexagon TTI, and with how TTI is implemented,
it is not accessible outside of TTI.

4 years ago[NFC][regalloc] Use MCRegister appropriately
Mircea Trofin [Fri, 30 Oct 2020 22:12:14 +0000 (15:12 -0700)]
[NFC][regalloc] Use MCRegister appropriately

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

4 years ago[AMDGPU] Improve FLAT scratch detection
Stanislav Mekhanoshin [Mon, 2 Nov 2020 18:56:12 +0000 (10:56 -0800)]
[AMDGPU] Improve FLAT scratch detection

We were useing too broad check for isFLATScratch() which also
includes FLAT global.

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

4 years ago[PartialInliner]: Handle code regions in a switch stmt cases
Ettore Tiotto [Mon, 2 Nov 2020 19:10:27 +0000 (14:10 -0500)]
[PartialInliner]: Handle code regions in a switch stmt cases

This patch enhances computeOutliningColdRegionsInfo() to allow it to
consider regions containing a single basic block and a single
predecessor as candidate for partial inlining.

Reviewed By: fhann

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

4 years agoUndef the `DEFINE_C_API_STRUCT` macro after using it in the MLIR C API header (NFC)
Mehdi Amini [Mon, 2 Nov 2020 18:56:25 +0000 (18:56 +0000)]
Undef the `DEFINE_C_API_STRUCT` macro after using it in the MLIR C API header (NFC)

Leaking macros isn't a good practice when defining headers. This
requires to duplicate the macro definition in every header though, but
that seems like a better tradeoff right now.

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

4 years ago[Sema] adds -Wfree-nonheap-object member var checks
Christopher Di Bella [Mon, 2 Nov 2020 18:59:38 +0000 (10:59 -0800)]
[Sema] adds -Wfree-nonheap-object member var checks

Checks to make sure that stdlib's (std::)free is being appropriately
used for member variables.

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

4 years ago[flang] Allow array constructor implied DO loop indices as constant expressions
peter klausler [Fri, 30 Oct 2020 19:57:28 +0000 (12:57 -0700)]
[flang] Allow array constructor implied DO loop indices as constant expressions

When the bounds of an implied DO loop in an array constructor are
constant, the index variable of that loop is considered a constant
expression and can be used as such in the items in the value list
of the implied DO loop.  Since the KIND type parameter values of items
in the value list can depend on the various values taken by such an
index, it is not possible to represent those values with a single
typed expression.  So implement such loops by taking multiple passes
over the parse tree of the implied DO loop instead.

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

4 years ago[mlir][vector] Address post-commit review comments on vector ops folding patterns
Thomas Raoux [Mon, 2 Nov 2020 18:18:38 +0000 (10:18 -0800)]
[mlir][vector] Address post-commit review comments on vector ops folding patterns

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

4 years ago[mlir][CAPI] Add APIs for mlirOperationGetName and Identifier.
Stella Laurenzo [Mon, 2 Nov 2020 18:26:38 +0000 (18:26 +0000)]
[mlir][CAPI] Add APIs for mlirOperationGetName and Identifier.

Reviewed By: ftynse

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

4 years ago[LLD] [COFF] Align all debug directories
Peter Penzin [Thu, 29 Oct 2020 22:50:40 +0000 (15:50 -0700)]
[LLD] [COFF] Align all debug directories

Match MSVC linker output - align all debug directories on four bytes,
while removing debug directory alignment. This would have the same
effect on CETCOMPAT support as D89919.

Chromium bug: https://crbug.com/1136664

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

4 years ago[gn build] Port c17da8676a0
LLVM GN Syncbot [Mon, 2 Nov 2020 18:32:12 +0000 (18:32 +0000)]
[gn build] Port c17da8676a0

4 years agoSupport: Avoid std::tie in Support/FileSystem/UniqueID.h, NFC
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 15:13:37 +0000 (11:13 -0400)]
Support: Avoid std::tie in Support/FileSystem/UniqueID.h, NFC

Running `-fsyntax-only` on UniqueID.h is 2x faster with this patch
(which avoids calling `std::tie` for `operator<`).  Since the transitive
includers of this file will go up as `FileEntryRef` gets used in more
places, avoid that compile-time hit.  This is a follow-up to
23ed570af1cc165afea1b70a533a4a39d6656501 (suggested by Reid Kleckner).

Also drop the `<tuple>` include from FileSystem.h (which was vestigal
from before UniqueID.h was split out).

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

4 years ago[clang-format] Improve BAS_DontAlign+AllowAllArgumentsOnNextLine=false
Alex Richardson [Mon, 2 Nov 2020 17:35:59 +0000 (17:35 +0000)]
[clang-format] Improve BAS_DontAlign+AllowAllArgumentsOnNextLine=false

TokenAnnotator::splitPenalty() was always returning 0 for opening parens if
AlignAfterOpenBracket was set to BAS_DontAlign, so the preferred point for
line breaking was always after the open paren (and was ignoring
PenaltyBreakBeforeFirstCallParameter). This change restricts the zero
penalty to the AllowAllArgumentsOnNextLine case. This results in improved
formatting for FreeBSD where we set AllowAllArgumentsOnNextLine: false
and a high value for PenaltyBreakBeforeFirstCallParameter to avoid breaking
after the open paren.

Before:
```
functionCall(
    paramA, paramB, paramC);
void functionDecl(
    int A, int B, int C)
```
After:
```
functionCall(paramA, paramB,
    paramC);
void functionDecl(int A, int B,
    int C)
```

Reviewed By: MyDeveloperDay

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

4 years ago[AtomicExpand] Avoid creating an unnamed libcall
Alex Richardson [Mon, 2 Nov 2020 17:33:07 +0000 (17:33 +0000)]
[AtomicExpand] Avoid creating an unnamed libcall

I recently modified this pass to better support CHERI-RISC-V and while
doing so I noticed that this pass was calling M->getOrInsertFunction()
with the result of TLI->getLibcallName(RTLibType). However, AMDGPU fills
the libcalls array with nullptr, so this creates an anonymous function
instead. This patch changes expandAtomicOpToLibcall to return false in
case the libcall does not exist and changes the assert() in the callees to
a report_fatal_error() instead.

Reviewed By: arsenm

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

4 years agoCorrect the nomerge attribute documentation
Aaron Ballman [Mon, 2 Nov 2020 17:49:40 +0000 (12:49 -0500)]
Correct the nomerge attribute documentation

The nomerge attribute is a statement attribute not a function attribute.

4 years ago[ARM] Cost model test for target intrinsics. NFC
David Green [Mon, 2 Nov 2020 17:46:48 +0000 (17:46 +0000)]
[ARM] Cost model test for target intrinsics. NFC

4 years agoRevert "[Clang] Add the ability to map DLL storage class to visibility"
Ben Dunbobbin [Mon, 2 Nov 2020 17:32:55 +0000 (17:32 +0000)]
Revert "[Clang] Add the ability to map DLL storage class to visibility"

This reverts commit 415f7ee8836944942d8beb70e982e95a312866a7.

The added tests were failing on the build bots!

4 years ago[RISCV] Make SelectRORIW handle the commutability of OR.
Craig Topper [Mon, 2 Nov 2020 17:31:01 +0000 (09:31 -0800)]
[RISCV] Make SelectRORIW handle the commutability of OR.

The SHL and SRL could be in opposite order so account for that.

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

4 years ago[AggressiveInstCombine] Add funnel shift tests
Simon Pilgrim [Mon, 2 Nov 2020 17:26:22 +0000 (17:26 +0000)]
[AggressiveInstCombine] Add funnel shift tests

Based off existing rotate test coverage

4 years ago[AggressiveInstCombine] Regenerate rotate tests
Simon Pilgrim [Mon, 2 Nov 2020 17:23:33 +0000 (17:23 +0000)]
[AggressiveInstCombine] Regenerate rotate tests

4 years ago[libc++] Migrate warning flags to the DSL
Louis Dionne [Thu, 29 Oct 2020 21:30:28 +0000 (17:30 -0400)]
[libc++] Migrate warning flags to the DSL

This makes us closer to running the test suite on platforms where the
legacy test suite configuration doesn't work.

One notable change after this commit is that the tests will be run with
warnings enabled on GCC too, which wasn't the case before. However,
previous commits should have tweaked the test suite to make sure it
passes with warnings enabled on GCC.

Note that warnings can still be disabled with `--param enable_warnings=False`,
as before.

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

4 years ago[flang] Design document for runtime derived type descriptions (NFC)
peter klausler [Fri, 30 Oct 2020 21:21:45 +0000 (14:21 -0700)]
[flang] Design document for runtime derived type descriptions (NFC)

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

4 years ago[TableGen] Fix a couple of minor issues regarding the paste operator.
Paul C. Anagnostopoulos [Mon, 2 Nov 2020 13:40:49 +0000 (08:40 -0500)]
[TableGen] Fix a couple of minor issues regarding the paste operator.

Update the documentation to fully describe it.

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

4 years ago[x86] add AVX2 cost model entries for maxnum of 256-bit vectors
Sanjay Patel [Mon, 2 Nov 2020 17:01:49 +0000 (12:01 -0500)]
[x86] add AVX2 cost model entries for maxnum of 256-bit vectors

As noticed in D90554 ,
the AVX2 costs for 256-bit vectors did not include FMAXNUM entries,
so we fell back to AVX1 which assumes those ops will be split into
128-bit halves or something close to that.

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

4 years ago[InstCombine] add multi-use tests for negator; NFC
Sanjay Patel [Sun, 1 Nov 2020 16:26:07 +0000 (11:26 -0500)]
[InstCombine] add multi-use tests for negator; NFC

PR47997

4 years ago[RISCV] When matching RORIW, make sure the same input is given to both shifts.
Craig Topper [Mon, 2 Nov 2020 16:45:33 +0000 (08:45 -0800)]
[RISCV] When matching RORIW, make sure the same input is given to both shifts.

The code is looking for (sext_inreg (or (shl X, C2), (shr (and Y, C3), C1))).
We need to ensure X and Y are the same.

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

4 years ago[AggressiveInstCombine] foldGuardedRotateToFunnelShift - generalize rotation to funne...
Simon Pilgrim [Mon, 2 Nov 2020 16:19:32 +0000 (16:19 +0000)]
[AggressiveInstCombine] foldGuardedRotateToFunnelShift - generalize rotation to funnel shift matcher.

Replace matchRotate with a more general matchFunnelShift - at the moment this is still just used for rotation patterns.

4 years ago[Clang] Add the ability to map DLL storage class to visibility
Ben Dunbobbin [Mon, 2 Nov 2020 15:11:56 +0000 (15:11 +0000)]
[Clang] Add the ability to map DLL storage class to visibility

For PlayStation we offer source code compatibility with
Microsoft's dllimport/export annotations; however, our file
format is based on ELF.

To support this we translate from DLL storage class to ELF
visibility at the end of codegen in Clang.

Other toolchains have used similar strategies (e.g. see the
documentation for this ARM toolchain:

https://developer.arm.com/documentation/dui0530/i/migrating-from-rvct-v3-1-to-rvct-v4-0/changes-to-symbol-visibility-between-rvct-v3-1-and-rvct-v4-0)

This patch adds the ability to perform this translation. Options
are provided to support customizing the mapping behaviour.

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

4 years ago[test] Fix unused FileCheck prefix in ThinLTO test
Teresa Johnson [Mon, 2 Nov 2020 17:05:11 +0000 (09:05 -0800)]
[test] Fix unused FileCheck prefix in ThinLTO test

Add intended and missing prefix check.

4 years ago[clangd] Account for vendor in version string
Shoaib Meenai [Sat, 31 Oct 2020 00:43:41 +0000 (17:43 -0700)]
[clangd] Account for vendor in version string

The vendor will be prefixed to the "clangd" and can be an arbitrary
string, so account for it in the test.

Reviewed By: sammccall

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

4 years ago[clang] Limit scope of CLANG_VENDOR definition
Shoaib Meenai [Sat, 31 Oct 2020 00:42:09 +0000 (17:42 -0700)]
[clang] Limit scope of CLANG_VENDOR definition

It's only used by Version.cpp, so limit the definition to just that one
file instead of making all of Clang recompile if you change CLANG_VENDOR.

Reviewed By: phosek

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

4 years ago[MemProf] Reenable test with fix for bot failures
Teresa Johnson [Fri, 30 Oct 2020 15:03:35 +0000 (08:03 -0700)]
[MemProf] Reenable test with fix for bot failures

The issue was unexpected macro expansion when the bot's test output
directory contained a token matching a build system macro (e.g.
"linux"). Switch to using a hardcoded path, which is invalid but is
sufficient for ensuring that the path is passed down to the runtime.

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

4 years ago[libc++][CI] Allow retries in case an agent is lost
Louis Dionne [Mon, 2 Nov 2020 16:58:01 +0000 (11:58 -0500)]
[libc++][CI] Allow retries in case an agent is lost

We see this fairly often on our Linux bots, which appear to be killed
by GCE from time to time.

4 years ago[LLDB/Lua] call lua_close() on Lua dtor
Pedro Tammela [Sun, 1 Nov 2020 18:02:30 +0000 (18:02 +0000)]
[LLDB/Lua] call lua_close() on Lua dtor

This patch calls `lua_close()` on Lua dtor.

This guarantees that the Lua GC finalizers are honored, aside from the
usual internal clean up.

It also guarantees a call to the `__close` metamethod of any active
to-be-closed variable in Lua 5.4.

Since the previous `luaL_openlibs()` was a noop, because the standard
library is cached internally, I've removed it.

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