lldb.git
11 months agoProvide a hook to customize missing library error handling
serge-sans-paille [Mon, 19 Oct 2020 11:19:52 +0000 (13:19 +0200)]
Provide a hook to customize missing library error handling

Make it possible for lld users to provide a custom script that would help to
find missing libraries. A possible scenario could be:

    % clang /tmp/a.c -fuse-ld=lld -loauth -Wl,--error-handling-script=/tmp/addLibrary.py
    unable to find library -loauth
    looking for relevant packages to provides that library

        liboauth-0.9.7-4.el7.i686
        liboauth-devel-0.9.7-4.el7.i686
        liboauth-0.9.7-4.el7.x86_64
        liboauth-devel-0.9.7-4.el7.x86_64
        pix-1.6.1-3.el7.x86_64

Where addLibrary would be called with the missing library name as first argument
(in that case addLibrary.py oauth)

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

11 months ago[CostModel] Make target intrinsics cheap by default
David Green [Tue, 3 Nov 2020 09:58:28 +0000 (09:58 +0000)]
[CostModel] Make target intrinsics cheap by default

This patch changes the intrinsics cost model to assume that by default
target intrinsics are cheap. This didn't seem to be the case for all
intrinsics, and is potentially an MVE problem due to our scalarization
overheads. Cheap seems to be a good default in general though.

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

11 months ago[NFCI] Add StackOffset class and base classes for ElementCount, TypeSize.
Sander de Smalen [Mon, 2 Nov 2020 21:32:57 +0000 (21:32 +0000)]
[NFCI] Add StackOffset class and base classes for ElementCount, TypeSize.

This patch adds a linear polynomial base class, called LinearPolyBase, which
serves as a base class for StackOffset. It tries to represent a linear
polynomial like:

  c0 * scale0 + c1 * scale1 + ... + cK * scaleK

where the scale is implicit, meaning that only the coefficients are
encoded.

This patch also adds a univariate linear polynomial, which serves as
a base class for ElementCount and TypeSize. This tries to represent a
linear polynomial where only one dimension can be set at any one time,
i.e. a TypeSize is either fixed-sized, or scalable-sized, but cannot be
a combination of the two.

  class LinearPolyBase
     ^
     |
     +---- class StackOffset  (dimensions = 2 (fixed/scalable), type = int64_t)

  class UnivariateLinearPolyBase
     |
     |
     +---- class LinearPolySize (dimensions = 2 (fixed/scalable))
                  ^
                  |
                  +-------- class ElementCount  (type = unsigned)
                  |
                  |
                  +-------- class TypeSize      (type = uint64_t)

Reviewed By: ctetreau, david-arm

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

11 months ago[LLDB][NFC] treat Lua error codes in a more explicit manner
Pedro Tammela [Sun, 1 Nov 2020 16:23:36 +0000 (16:23 +0000)]
[LLDB][NFC] treat Lua error codes in a more explicit manner

This patch is a minor suggestion to not rely on the fact
that the `LUA_OK` macro is 0.

This assumption could change in future versions of the C API.

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

11 months ago[mlir] Add to shape.is_broadcastable description
Tres Popp [Tue, 3 Nov 2020 09:23:54 +0000 (10:23 +0100)]
[mlir] Add to shape.is_broadcastable description

11 months ago[mlir] Add partial lowering of shape.cstr_broadcastable.
Tres Popp [Tue, 13 Oct 2020 15:56:45 +0000 (17:56 +0200)]
[mlir] Add partial lowering of shape.cstr_broadcastable.

Because cstr operations allow more instruction reordering than asserts, we only
lower cstr_broadcastable to std ops with cstr_require. This ensures that the
more drastic lowering to asserts can happen specifically with the user's desire.

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

11 months ago[lldb] [Plugins/FreeBSDRemote] Disable GetMemoryRegionInfo()
Michał Górny [Mon, 2 Nov 2020 22:48:55 +0000 (23:48 +0100)]
[lldb] [Plugins/FreeBSDRemote] Disable GetMemoryRegionInfo()

Disable GetMemoryRegionInfo() in order to unbreak expression parsing.
For some reason, the presence of non-stub function causes LLDB to fail
to detect system libraries correctly.  Through being unable to find
mmap() and allocate memory, this leads to expression parser being
broken.

The issue is non-trivial and it is going to require more time debugging.
On the other hand, the downsides of missing the function are minimal
(2 failing tests), and the benefit of working expression parser
justifies disabling it temporarily.  Furthermore, the old FreeBSD plugin
did not implement it anyway, so it allows us to switch to the new plugin
without major regressions.

The really curious part is that the respective code in the NetBSD plugin
yields very similar results, yet does not seem to break the expression
parser.

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

11 months ago[lldb] [Process/FreeBSDRemote] Remove GetSharedLibraryInfoAddress override
Michał Górny [Mon, 2 Nov 2020 16:01:40 +0000 (17:01 +0100)]
[lldb] [Process/FreeBSDRemote] Remove GetSharedLibraryInfoAddress override

Remove the NetBSD-specific override of GetSharedLibraryInfoAddress(),
restoring the generic implementation from NativeProcessELF.

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

11 months ago[lldb] [Process/FreeBSDRemote] Fix attaching via lldb-server
Michał Górny [Sat, 31 Oct 2020 09:30:13 +0000 (10:30 +0100)]
[lldb] [Process/FreeBSDRemote] Fix attaching via lldb-server

Fix two bugs that caused attaching to a process in a pre-connected
lldb-server to fail.  These are:

1. Prematurely reporting status in NativeProcessFreeBSD::Attach().
   The SetState() call defaulted to notify the process, and LLGS tried
   to send the stopped packet before the process instance was assigned
   to it.  While at it, add an assert for that in LLGS.

2. Duplicate call to ReinitializeThreads() (via SetupTrace()) that
   overwrote the stopped status in threads.  Now SetupTrace() is called
   directly by NativeProcessFreeBSD::Attach() (not the Factory) in place
   of ReinitializeThreads().

This fixes at least commands/process/attach/TestProcessAttach.py
and python_api/hello_world/TestHelloWorld.py.

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

11 months ago[lldb] [Host/{free,net}bsd] Fix process matching by name
Michał Górny [Fri, 30 Oct 2020 11:00:45 +0000 (12:00 +0100)]
[lldb] [Host/{free,net}bsd] Fix process matching by name

Fix process matching by name to make 'process attach -n ...' work.

The process finding code has an optimization that defers getting
the process name and executable format after the numeric (PID, UID...)
parameters are tested.  However, the ProcessInstanceInfoMatch.Matches()
method has been matching process name against the incomplete process
information as well, and effectively no process ever matched.

In order to fix this, create a copy of ProcessInstanceInfoMatch, set
it to ignore process name and se this copy for the initial match.
The same fix applies to FreeBSD and NetBSD host code.

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

11 months ago[lldb] [Process/FreeBSDRemote] Implement thread GetName()
Michał Górny [Wed, 28 Oct 2020 11:40:45 +0000 (12:40 +0100)]
[lldb] [Process/FreeBSDRemote] Implement thread GetName()

Implement NativeThreadFreeBSD::GetName().  This is based
on the equivalent code in the legacy FreeBSD plugin, except it is
modernized a bit to use llvm::Optional and std::vector for data storage.

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

11 months ago[llvm-readobj/libObject] - Allow dumping objects that has a broken SHT_SYMTAB_SHNDX...
Georgii Rymar [Tue, 13 Oct 2020 13:17:04 +0000 (16:17 +0300)]
[llvm-readobj/libObject] - Allow dumping objects that has a broken SHT_SYMTAB_SHNDX section.

Currently it is impossible to create an instance of ELFObjectFile when the
SHT_SYMTAB_SHNDX can't be read. We error out when fail to parse the
SHT_SYMTAB_SHNDX section in the factory method.

This change delays reading of the SHT_SYMTAB_SHNDX section entries,
with it llvm-readobj is now able to work with such inputs.

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

11 months agoAMDGPU/GlobalISel: Use same builder/observer in post-legalizer-combiner
Petar Avramovic [Tue, 3 Nov 2020 08:23:56 +0000 (09:23 +0100)]
AMDGPU/GlobalISel: Use same builder/observer in post-legalizer-combiner

Change match/apply functions into methods of new target specific combiner
helper class. Use reference to MachineIRBuilder from helper instead of
constructing new MachineIRBuilder each time new instruction needs to made.
Allows correct tracking of newly created instructions.

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

11 months ago[clang] Fix the fsanitize.c testcase after eaae6fdf67e1f. NFC.
Martin Storsjö [Tue, 3 Nov 2020 08:20:36 +0000 (10:20 +0200)]
[clang] Fix the fsanitize.c testcase after eaae6fdf67e1f. NFC.

After that commit, the vptr sanitizer is enabled for mingw targets.

11 months ago[NFC] Refactor code in IndVars, preparing for further improvement
Max Kazantsev [Tue, 3 Nov 2020 07:59:04 +0000 (14:59 +0700)]
[NFC] Refactor code in IndVars, preparing for further improvement

11 months ago[clang] [MinGW] Allow using the vptr sanitizer
Martin Storsjö [Sun, 1 Nov 2020 20:49:49 +0000 (22:49 +0200)]
[clang] [MinGW] Allow using the vptr sanitizer

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

11 months ago[compiler-rt] [ubsan] Use the itanium type info lookup for mingw targets
Martin Storsjö [Sun, 1 Nov 2020 20:52:08 +0000 (22:52 +0200)]
[compiler-rt] [ubsan] Use the itanium type info lookup for mingw targets

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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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.

11 months 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

11 months 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

11 months 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

11 months 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.

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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.

11 months 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

11 months 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.

11 months 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

11 months 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

11 months 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

11 months 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.

11 months 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

11 months 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

11 months 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.

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

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

11 months 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

11 months 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

11 months 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.

11 months 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

11 months 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

11 months 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.

11 months 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

11 months 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).

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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.

11 months 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.

11 months 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

11 months 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

11 months 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

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

11 months 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

11 months 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()}})
           ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

11 months 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

11 months 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

11 months 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

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

11 months 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

11 months 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

11 months 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.

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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.

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

11 months 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

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

11 months 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

11 months 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

11 months 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

11 months 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.

11 months 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

11 months 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!