platform/upstream/llvm.git
4 years ago[libomptarget] Always call malloc, free via SafeMalloc, SafeFree wrapper
Jon Chesterfield [Wed, 30 Oct 2019 13:31:56 +0000 (13:31 +0000)]
[libomptarget] Always call malloc, free via SafeMalloc, SafeFree wrapper

Summary:
[libomptarget] Always call malloc, free via SafeMalloc, SafeFree wrapper

NFC for release, adds some verbosity to debug printing. Motivation is to provide
one place where local modifications can be made to the behaviour of all heap
allocation or deallocation while debugging.

Reviewers: jdoerfert, ABataev, grokos

Reviewed By: ABataev

Subscribers: openmp-commits

Tags: #openmp

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

4 years agoRename a flang test case
Jeremy Morse [Wed, 30 Oct 2019 13:24:55 +0000 (13:24 +0000)]
Rename a flang test case

On Windows and macOS, the filesystem is case insensitive, and these files
interfere with each other. Reading through, the case of the file extension
is part of the test. I've altered the rest of the name instead.

4 years agolldb-vscode: Add a forgotten cast to void
Pavel Labath [Wed, 30 Oct 2019 13:27:26 +0000 (14:27 +0100)]
lldb-vscode: Add a forgotten cast to void

"git push" works even with a dirty working tree. :/

4 years ago[lldb-vscod] fix build with NDEBUG on windows
SquallATF [Wed, 30 Oct 2019 13:20:21 +0000 (14:20 +0100)]
[lldb-vscod] fix build with NDEBUG on windows

Summary: _setmode in assert will not run when build with NDEBUG

Reviewers: mstorsjo, labath, amccarth

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

4 years agoCOFF: Set section permissions
Pavel Labath [Wed, 16 Oct 2019 15:16:41 +0000 (17:16 +0200)]
COFF: Set section permissions

Summary:
This enables us to reason about whether a given address can be
executable, for instance during unwinding.

Reviewers: amccarth, mstorsjo

Subscribers: lldb-commits

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

4 years ago[ARM][AArch64][DebugInfo] Improve call site instruction interpretation
Djordje Todorovic [Wed, 30 Oct 2019 10:04:53 +0000 (11:04 +0100)]
[ARM][AArch64][DebugInfo] Improve call site instruction interpretation

Extend the describeLoadedValue() with support for target specific ARM and
AArch64 instructions interpretation. The patch provides specialization for
ADD and SUB operations that include a register and an immediate/offset
operand. Some of the instructions can operate with global string addresses
or constant pool indexes but such cases are omitted since we currently lack
flexible support for processing such operands at DWARF production stage.

Patch by Nikola Prica

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

4 years ago[lldb] [test] Mark TestCustomShell XFAIL on *bsd as well
Michał Górny [Wed, 30 Oct 2019 12:26:13 +0000 (13:26 +0100)]
[lldb] [test] Mark TestCustomShell XFAIL on *bsd as well

All *BSD targets do not implement ShellExpandArguments, so mark
the test appropriately.

4 years ago[AArch64][SVE] Implement masked store intrinsics
Kerry McLaughlin [Wed, 30 Oct 2019 11:44:29 +0000 (11:44 +0000)]
[AArch64][SVE] Implement masked store intrinsics

Summary:
Adds support for codegen of masked stores, with non-truncating
and truncating variants.

Reviewers: huntergr, greened, dmgreen, rovka, sdesmalen

Reviewed By: dmgreen, sdesmalen

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

Tags: #llvm

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

4 years ago[X86] combineOrShiftToFunnelShift - use isOperationLegalOrCustom to check FSHL/FSHR...
Simon Pilgrim [Wed, 30 Oct 2019 11:39:18 +0000 (11:39 +0000)]
[X86] combineOrShiftToFunnelShift - use isOperationLegalOrCustom to check FSHL/FSHR support

Remove hard wired legality check.

4 years ago[X86] combineOrShiftToFunnelShift - use getShiftAmountTy instead of hardwiring to...
Simon Pilgrim [Wed, 30 Oct 2019 11:27:25 +0000 (11:27 +0000)]
[X86] combineOrShiftToFunnelShift - use getShiftAmountTy instead of hardwiring to MVT::i8

4 years ago[AArch64][SVE] Implement additional integer arithmetic intrinsics
Kerry McLaughlin [Wed, 30 Oct 2019 11:13:49 +0000 (11:13 +0000)]
[AArch64][SVE] Implement additional integer arithmetic intrinsics

Summary:
Add intrinsics for the following:
  - sxt[b|h|w] & uxt[b|h|w]
  - cls & clz
  - not & cnot

Reviewers: huntergr, sdesmalen, dancgr

Reviewed By: sdesmalen

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

Tags: #llvm

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

4 years ago[AMDGPU] Consolidate one more getGeneration check
Jay Foad [Tue, 29 Oct 2019 17:11:21 +0000 (17:11 +0000)]
[AMDGPU] Consolidate one more getGeneration check

This one should have been done in r363902 when hasReadVCCZBug was
introduced.

4 years agogn build: Merge 6bf55804924
LLVM GN Syncbot [Wed, 30 Oct 2019 10:43:37 +0000 (10:43 +0000)]
gn build: Merge 6bf55804924

4 years ago[clang][driver] Add basic --driver-mode=flang support for fortran
Peter Waller [Mon, 10 Jun 2019 13:12:43 +0000 (14:12 +0100)]
[clang][driver] Add basic --driver-mode=flang support for fortran

This patch adds a new Flang mode. When in Flang mode, the driver will
invoke flang for fortran inputs instead of falling back to the GCC
toolchain as it would otherwise do.

The behaviour of other driver modes are left unmodified to preserve
backwards compatibility.

It is intended that a soon to be implemented binary in the flang project
will import libclangDriver and run the clang driver in the new flang
mode.

Please note that since the binary invoked by the driver is under
development, there will no doubt be further tweaks necessary in future
commits.

* Initial support is added for basic driver phases
  * -E, -fsyntax-only, -emit-llvm -S, -emit-llvm, -S, (none specified)
  * -### tests are added for all of the above
  * This is more than is supported by f18 so far, which will emit errors
    for those options which are unimplemented.

* A test is added that ensures that clang gives a reasonable error
  message if flang is not available in the path (without -###).

* Test that the driver accepts multiple inputs in --driver-mode=flang.

* Test that a combination of C and Fortran inputs run both clang and
  flang in --driver-mode=flang.

* clang/test/Driver/fortran.f95 is fixed to use the correct fortran
  comment character.

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

4 years ago[llvm-objcopy] - Do not crash on object that has relocations but no symbol table.
Georgii Rymar [Mon, 28 Oct 2019 09:52:28 +0000 (12:52 +0300)]
[llvm-objcopy] - Do not crash on object that has relocations but no symbol table.

It was revealed by D69260.

Tool crashed when scanned relocations in a object without a symbol table.
This patch teaches it either to handle such objects (when relocations
does not use symbols we do not need a symbol table to proceed)
or to show an appropriate error otherwise.

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

4 years agoEnable OpenBSD support.
AndreyChurbanov [Wed, 30 Oct 2019 09:35:53 +0000 (12:35 +0300)]
Enable OpenBSD support.

Patch by devnexen (David CARLIER)

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

4 years ago[UpdateTestChecks] Fix invalid python string escapes
Alex Richardson [Wed, 30 Oct 2019 09:35:10 +0000 (09:35 +0000)]
[UpdateTestChecks] Fix invalid python string escapes

4 years ago[Alignment] Use Align for TFI.getStackAlignment() in X86ISelLowering
Guillaume Chatelet [Wed, 30 Oct 2019 09:13:15 +0000 (10:13 +0100)]
[Alignment] Use Align for TFI.getStackAlignment() in X86ISelLowering

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet, craig.topper, rnk

Reviewed By: rnk

Subscribers: rnk, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[update_cc_test_checks.py] Fix invalid python string escape sequence
Alex Richardson [Wed, 30 Oct 2019 09:17:29 +0000 (09:17 +0000)]
[update_cc_test_checks.py] Fix invalid python string escape sequence

This works with current python version but will be an error with 3.9

4 years ago[AddressSanitizer] Only instrument globals of default address space
Karl-Johan Karlsson [Wed, 30 Oct 2019 06:45:39 +0000 (07:45 +0100)]
[AddressSanitizer] Only instrument globals of default address space

The address sanitizer ignore memory accesses from different address
spaces, however when instrumenting globals the check for different
address spaces is missing. This result in assertion failure. The fault
was found in an out of tree target.

The patch skip all globals of non default address space.

Reviewed By: leonardchan, vitalybuka

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

4 years ago[PowerPC] Clear the sideeffect bit for those instructions that didn't have the match...
QingShan Zhang [Wed, 30 Oct 2019 07:56:35 +0000 (07:56 +0000)]
[PowerPC] Clear the sideeffect bit for those instructions that didn't have the match pattern

If the instruction have match pattern, llvm-tblgen will infer the sideeffect bit from the match pattern and it works well.
If not, the tblgen will set it as true that hurt the scheduling.

PowerPC has some instructions that didn't specify the match pattern(i.e. LXSD etc), which is manually selected post-ra according
to the register pressure. We need to clear the sideeffect flag for these instructions.

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

4 years ago[Target] Change PATCHABLE_EVENT_CALL/PATCHABLE_TYPED_EVENT_CALL to use unknown instea...
Craig Topper [Wed, 30 Oct 2019 07:35:20 +0000 (00:35 -0700)]
[Target] Change PATCHABLE_EVENT_CALL/PATCHABLE_TYPED_EVENT_CALL to use unknown instead of i8imm/i16imm/i32imm in its definition.

These instructions don't use immediates, they use registers. But
the register class needed is target specific. So just use unknown.

4 years ago[X86] Add test case for PR43758. NFC
Craig Topper [Wed, 30 Oct 2019 05:59:37 +0000 (22:59 -0700)]
[X86] Add test case for PR43758. NFC

4 years ago[llvm-objcopy] Add REQUIRES directive to fix a test
Seiya Nuta [Wed, 30 Oct 2019 07:08:24 +0000 (16:08 +0900)]
[llvm-objcopy] Add REQUIRES directive to fix a test

Buildbot failure log: http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/11164

4 years ago[X86] Make memcmp vector lowering handle arbitrary expansions
David Zarzycki [Mon, 28 Oct 2019 12:39:40 +0000 (14:39 +0200)]
[X86] Make memcmp vector lowering handle arbitrary expansions

Teach combineVectorSizedSetCCEquality() to handle arbitrary memcmp
expansions but do not change any default policy for now.

This also fixes a bug in the memcmp expansion itself when large
displacements are needed.

https://reviews.llvm.org/D69507

4 years ago[llvm-objcopy][MachO] Support indirect symbol table
Seiya Nuta [Wed, 30 Oct 2019 06:12:17 +0000 (15:12 +0900)]
[llvm-objcopy][MachO] Support indirect symbol table

Summary:
Parse the indirect symbol table and update the indexes of
symbol entries in the table in the writer in case they have
been changed.

Reviewers: alexshap, rupprecht, jhenderson

Reviewed By: alexshap, rupprecht

Subscribers: jakehehrlich, abrachet, llvm-commits

Tags: #llvm

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

4 years ago[Orc][test] Fix -DBUILD_SHARED_LIBS=on build
Fangrui Song [Wed, 30 Oct 2019 05:55:17 +0000 (22:55 -0700)]
[Orc][test] Fix -DBUILD_SHARED_LIBS=on build

4 years ago[lli-child-target] Fix -DBUILD_SHARED_LIBS=on build
Fangrui Song [Wed, 30 Oct 2019 05:46:13 +0000 (22:46 -0700)]
[lli-child-target] Fix -DBUILD_SHARED_LIBS=on build

4 years ago[lli] Fix -DBUILD_SHARED_LIBS=on build
Fangrui Song [Wed, 30 Oct 2019 05:37:28 +0000 (22:37 -0700)]
[lli] Fix -DBUILD_SHARED_LIBS=on build

This fixes:

  ld.lld: error: undefined symbol: vtable for llvm::orc::rpc::ResponseAbandoned
  >>> referenced by lli.cpp

In -DBUILD_SHARED_LIBS=on builds, all directly referenced references must
be linked to appease -Wl,-z,defs.

4 years agoRevert "[llvm-cov] Add option to whitelist filenames"
Vlad Tsyrklevich [Wed, 30 Oct 2019 05:38:38 +0000 (22:38 -0700)]
Revert "[llvm-cov] Add option to whitelist filenames"

This reverts commit bfed824b57d14e2ba98ddbaf1a1410cf04a3e279, the
included test fails on many bots including the sanitier bots, e.g. in
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/36140

4 years ago[WebAssembly][lld] Fix for static linking of PIC code
Sam Clegg [Mon, 28 Oct 2019 22:24:52 +0000 (15:24 -0700)]
[WebAssembly][lld] Fix for static linking of PIC code

When statically linking PIC code we create an internalized __memory_base
so that memory-base-relative relocation work correctly.  The value of
this global should be zero, and not the globalBase since the globalBase
offset is already taken into account by getVirtualAddress.

Fixes: https://github.com/emscripten-core/emscripten/issues/9013

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

4 years agogn build: (manually) merge a34680a3
Nico Weber [Wed, 30 Oct 2019 01:50:16 +0000 (21:50 -0400)]
gn build: (manually) merge a34680a3

4 years ago[llvm-cov] Add option to whitelist filenames
Vedant Kumar [Tue, 29 Oct 2019 22:47:23 +0000 (15:47 -0700)]
[llvm-cov] Add option to whitelist filenames

Add the `-whitelist-filename-regex` option to restrict coverage
reporting to file paths that match a whitelist regex.

Patch by Michael Daniels!

rdar://56720320

4 years ago[lit] Refactor ordering of tests
Julian Lettner [Mon, 25 Feb 2019 05:49:42 +0000 (21:49 -0800)]
[lit] Refactor ordering of tests

4 years ago[ADT] add equality operator for SmallSet
Fedor Sergeev [Thu, 24 Oct 2019 19:24:44 +0000 (12:24 -0700)]
[ADT] add equality operator for SmallSet

Makes it easier to migrate existing code that uses std::set.

Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D69417

4 years agoBreak out OrcError and RPC
Chris Bieneman [Wed, 9 Oct 2019 21:27:52 +0000 (14:27 -0700)]
Break out OrcError and RPC

Summary:
When createing an ORC remote JIT target the current library split forces the target process to link large portions of LLVM (Core, Execution Engine, JITLink, Object, MC, Passes, RuntimeDyld, Support, Target, and TransformUtils). This occurs because the ORC RPC interfaces rely on the static globals the ORC Error types require, which starts a cycle of pulling in more and more.

This patch breaks the ORC RPC Error implementations out into an "OrcError" library which only depends on LLVM Support. It also pulls the ORC RPC headers into their own subdirectory.

With this patch code can include the Orc/RPC/*.h headers and will only incur link dependencies on LLVMOrcError and LLVMSupport.

Reviewers: lhames

Reviewed By: lhames

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoSuppress useless GCC "bitfield is too small to hold all values of enum class" warning.
Richard Smith [Wed, 30 Oct 2019 00:05:40 +0000 (17:05 -0700)]
Suppress useless GCC "bitfield is too small to hold all values of enum class" warning.

4 years agoAMDGPU/GlobalISel: Legalize FDIV32
Austin Kerbow [Tue, 29 Oct 2019 16:55:49 +0000 (09:55 -0700)]
AMDGPU/GlobalISel: Legalize FDIV32

Reviewers: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, dstuttard, tpr, t-tye, hiraditya, Petar.Avramovic, llvm-commits

Tags: #llvm

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

4 years ago[MS] Fix constexpr data member pointer conversions
Reid Kleckner [Tue, 29 Oct 2019 00:05:34 +0000 (17:05 -0700)]
[MS] Fix constexpr data member pointer conversions

Constexpr data member conversions work by starting with the class that
originally introduced the field, and converting from there to the type
that the user desires. Before this change, Clang was using the
inheritance model from the final destination class type instead of the
model from the class that originally introduced the field. To fix this,
find the relevant FieldDecl and take its parent class instead of using
the member pointer type the user provided.

Indirect field decls require some special handling to find the parent
class.

Fixes PR43803

4 years ago[lldbsuite] Remove unused test_event files
Jonas Devlieghere [Tue, 29 Oct 2019 23:35:28 +0000 (16:35 -0700)]
[lldbsuite] Remove unused test_event files

These files don't appear to be used anywhere and the corresponding tests
are not run.

4 years ago[lldbsuite] Remove the DumpFormatter
Jonas Devlieghere [Tue, 29 Oct 2019 23:30:37 +0000 (16:30 -0700)]
[lldbsuite] Remove the DumpFormatter

This formatter is never used or referenced.

4 years ago[lldbsuite] Remove pre_kill_hook package
Jonas Devlieghere [Tue, 29 Oct 2019 23:29:12 +0000 (16:29 -0700)]
[lldbsuite] Remove pre_kill_hook package

This package was only used by dosep.py which has since been removed.

4 years ago[lldbsuite] Remove unused support files
Jonas Devlieghere [Tue, 29 Oct 2019 23:26:49 +0000 (16:26 -0700)]
[lldbsuite] Remove unused support files

To the best of my understanding these files or their content is nowhere
referenced.

4 years ago[lit] Small improvements in cl_arguments.py
Julian Lettner [Thu, 21 Feb 2019 07:33:15 +0000 (23:33 -0800)]
[lit] Small improvements in cl_arguments.py

*) `--max-tests` should be positive integer
*) `--max-time` should be positive integer
*) Remove unnecessary defaults for command line option parsing

4 years agoThread safety analysis: Peel away NoOp implicit casts in initializers
Aaron Puchert [Tue, 29 Oct 2019 23:37:06 +0000 (00:37 +0100)]
Thread safety analysis: Peel away NoOp implicit casts in initializers

Summary:
This happens when someone initializes a variable with guaranteed copy
elision and an added const qualifier. Fixes PR43826.

Reviewers: aaron.ballman, rsmith

Reviewed By: aaron.ballman

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

4 years ago[LLD][ELF] Support --[no-]mmap-output-file with F_no_mmap
Nick Terrell [Tue, 29 Oct 2019 22:46:22 +0000 (15:46 -0700)]
[LLD][ELF] Support --[no-]mmap-output-file with F_no_mmap

Summary:
Add a flag `F_no_mmap` to `FileOutputBuffer` to support
`--[no-]mmap-output-file` in ELF LLD. LLD currently explicitly ignores
this flag for compatibility with GNU ld and gold.

We need this flag to speed up link time for large binaries in certain
scenarios. When we link some of our larger binaries we find that LLD
takes 50+ GB of memory, which causes memory pressure. The memory
pressure causes the VM to flush dirty pages of the output file to disk.
This is normally okay, since we should be flushing cold pages. However,
when using BtrFS with compression we need to write 128KB at a time when
we flush a page. If any page in that 128KB block is written again, then
it must be flushed a second time, and so on. Since LLD doesn't write
sequentially this causes write amplification. The same 128KB block will
end up being flushed multiple times, causing the linker to many times
more IO than necessary. We've observed 3-5x faster builds with
-no-mmap-output-file when we hit this scenario.

The bad scenario only applies to compressed filesystems, which group
together multiple pages into a single compressed block. I've tested
BtrFS, but the problem will be present for any compressed filesystem
on Linux, since it is caused by the VM.

Silently ignoring --no-mmap-output-file caused a silent regression when
we switched from gold to lld. We pass --no-mmap-output-file to fix this
edge case, but since lld silently ignored the flag we didn't realize it
wasn't being respected.

Benchmark building a 9 GB binary that exposes this edge case. I linked 3
times with --mmap-output-file and 3 times with --no-mmap-output-file and
took the average. The machine has 24 cores @ 2.4 GHz, 112 GB of RAM,
BtrFS mounted with -compress-force=zstd, and an 80% full disk.

| Mode    | Time  |
|---------|-------|
| mmap    | 894 s |
| no mmap | 126 s |

When compression is disabled, BtrFS performs just as well with and
without mmap on this benchmark.

I was unable to reproduce the regression with any binaries in
lld-speed-test.

Reviewed By: ruiu, MaskRay

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

4 years agoReplace std::function in PrintingPolicy with a callbacks object.
Richard Smith [Wed, 16 Oct 2019 00:51:08 +0000 (17:51 -0700)]
Replace std::function in PrintingPolicy with a callbacks object.

This makes PrintingPolicy significantly more lightweight and provides
groundwork for more printing customization hooks.

4 years ago[LLDB][breakpoints] ArgInfo::count -> ArgInfo::max_positional_args
Lawrence D'Anna [Tue, 29 Oct 2019 20:42:38 +0000 (13:42 -0700)]
[LLDB][breakpoints] ArgInfo::count -> ArgInfo::max_positional_args

Summary:
Move breakpoints from the old, bad ArgInfo::count to the new, better
ArgInfo::max_positional_args.   Soon ArgInfo::count will be no more.

It looks like this functionality is already well tested by
`TestBreakpointCommandsFromPython.py`, so there's no need to write
additional tests for it.

Reviewers: labath, jingham, JDevlieghere

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[Headers] Fix compatibility between arm_acle.h and intrin.h
Eli Friedman [Tue, 29 Oct 2019 21:52:56 +0000 (14:52 -0700)]
[Headers] Fix compatibility between arm_acle.h and intrin.h

Make sure they don't both define __nop.

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

4 years agoAccept __is_same_as as a GCC-compatibility synonym for the proper trait name __is_same.
Richard Smith [Tue, 29 Oct 2019 21:44:38 +0000 (14:44 -0700)]
Accept __is_same_as as a GCC-compatibility synonym for the proper trait name __is_same.

4 years ago[DWARF5] Added support for deleted C++ special member functions.
Adrian Prantl [Tue, 29 Oct 2019 16:20:14 +0000 (09:20 -0700)]
[DWARF5] Added support for deleted C++ special member functions.

This patch adds support for deleted C++ special member functions in
clang and llvm. Also added Defaulted member encodings for future
support for defaulted member functions.

Patch by Sourabh Singh Tomar!

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

4 years ago[globalisel][docs] Fix warning treated as error
Daniel Sanders [Tue, 29 Oct 2019 20:27:48 +0000 (13:27 -0700)]
[globalisel][docs] Fix warning treated as error

I had hoped that I could have some
```
.. code-block:: MIR
```
sections for MIR examples which causes a warning about pygments not
supporting it but we have warnings treated as errors

4 years ago[globalisel][docs] Rewrite the IRTranslator documentation
Daniel Sanders [Sat, 26 Oct 2019 02:54:01 +0000 (19:54 -0700)]
[globalisel][docs] Rewrite the IRTranslator documentation

Summary:
I haven't refreshed the Function Calls section as I don't feel I have
sufficient knowledge of that area. It would be appreciated if someone could
review that section.

Note: I'm aware that pygments doesn't support 'mir' as used in one of the
code-block directives. This currently emits a warning and I decided to
keep it to enable finding them later. Maybe we can teach pygments to
support it.

Depends on D69456

Reviewers: volkan, aditya_nandakumar

Subscribers: rovka, Petar.Avramovic, llvm-commits

Tags: #llvm

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

4 years agoFix argument numbering confusion when diagnosing a non-viable operator().
Richard Smith [Tue, 29 Oct 2019 20:06:34 +0000 (13:06 -0700)]
Fix argument numbering confusion when diagnosing a non-viable operator().

This could lead to crashes if operator() is a variadic template, as we
could end up asking for an out-of-bounds argument.

4 years ago[ValueObjectDisplay] Generalize the description of an option.
Davide Italiano [Tue, 29 Oct 2019 20:05:56 +0000 (13:05 -0700)]
[ValueObjectDisplay] Generalize the description of an option.

4 years ago[SelectionDAG] Enable lowering unordered atomics loads w/LoadSDNode (and stores w...
Philip Reames [Tue, 29 Oct 2019 18:07:36 +0000 (11:07 -0700)]
[SelectionDAG] Enable lowering unordered atomics loads w/LoadSDNode (and stores w/StoreSDNode) by default

Enable the new SelectionDAG representation for unordered loads and stores introduced in r371441 by default.  As a reminder, the new lowering changes the representation of an unordered atomic load from an AtomicSDNode - which is essentially a black box which gets passed through without combines messing with it - to a LoadSDNode w/a atomic marker on the MMO. The later parallels the way we handle volatiles, and I've audited the code to ensure that every location which checks one checks the other.

This has been fairly heavily fuzzed, and I examined diffs in a reasonable large corpus of assembly by hand, so I'm reasonable sure this is correct for the common case.  Late in the review for this, it was discovered that I hadn't correctly handled cases which could be legalized into CAS operations.  This points out that there's a strong bias in the IR of the frontend I'm working with towards only legal atomics.  If there are problems with this patch, the most likely area will be legalization.

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

4 years ago[Docs] Reflect the slow migration from guard to widenable condition which is currentl...
Philip Reames [Fri, 25 Oct 2019 21:50:39 +0000 (14:50 -0700)]
[Docs] Reflect the slow migration from guard to widenable condition which is currently in progress.

4 years ago[lit] Extend internal diff to support `-` argument
Joel E. Denny [Thu, 17 Oct 2019 14:03:06 +0000 (14:03 +0000)]
[lit] Extend internal diff to support `-` argument

When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff file -
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` doesn't
recognize `-` as a command-line option.  This patch adds support for
`-` to mean stdin.

Reviewed By: probinson, rnk

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

4 years ago[lit] Make internal diff work in pipelines
Joel E. Denny [Thu, 17 Oct 2019 14:02:42 +0000 (14:02 +0000)]
[lit] Make internal diff work in pipelines

When using lit's internal shell, RUN lines like the following
accidentally execute an external `diff` instead of lit's internal
`diff`:

```
 # RUN: program | diff file -
 # RUN: not diff file1 file2 | FileCheck %s
```

Such cases exist now, in `clang/test/Analysis` for example.  We are
preparing patches to ensure lit's internal `diff` is called in such
cases, which will then fail because lit's internal `diff` cannot
currently be used in pipelines and doesn't recognize `-` as a
command-line option.

To enable pipelines, this patch moves lit's `diff` implementation into
an out-of-process script, similar to lit's `cat` implementation.  A
follow-up patch will implement `-` to mean stdin.

Also, when lit's `diff` prints differences to stdout in Windows, this
patch ensures it always terminate lines with `\n` not `\r\n`.  That
way, strict FileCheck directives checking the `diff` output succeed in
both Linux and Windows.  This wasn't an issue when `diff` was internal
to lit because `diff` didn't then write to the true stdout, which is
where the `\n` -> `\r\n` conversion happened in Python.

Reviewed By: probinson, stella.stamenova

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

4 years ago[X86] Narrow i64 compares with constant to i32 when the upper 32-bits are known zero.
Craig Topper [Tue, 29 Oct 2019 17:47:02 +0000 (10:47 -0700)]
[X86] Narrow i64 compares with constant to i32 when the upper 32-bits are known zero.

This catches some cases. There are probably ways to improve this.
I tried doing it as a combine on the setcc, but that broke
some cases involving flag reuse in place of test.

I renamed the isX86CCUnsigned to isX86CCSigned and flipped its
polarity to make it consistent with the similar functions for
ISD::SETCC. This avoids calling EQ/NE as being signed or unsigned.

Fixes PR43823.

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

4 years ago[LLDB] Fix for windows bots broken by unsupported tests
shafik [Tue, 29 Oct 2019 18:33:11 +0000 (11:33 -0700)]
[LLDB] Fix for windows bots broken by unsupported tests

4 years ago[globalisel][docs] Rewrite the pipeline overview
Daniel Sanders [Sat, 26 Oct 2019 01:16:40 +0000 (18:16 -0700)]
[globalisel][docs] Rewrite the pipeline overview

Summary:
Rewrite the pipeline overview to be more focused on the structure and
flexibility as well as highlight the increased usefulness of
MachineVerifier and increased testability resulting from the smaller
incremental passes approach.

The diagrams are lifted from the slides for the LLVMDev 2019 talk
'Generating Optimized Code with GlobalISel' and adapted to be readable on
the white background used in the docs.

Reviewers: volkan

Subscribers: rovka, Petar.Avramovic, llvm-commits

Tags: #llvm

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

4 years ago[X86][VBMI2] Add vector funnel shift tests
Simon Pilgrim [Tue, 29 Oct 2019 17:53:03 +0000 (17:53 +0000)]
[X86][VBMI2] Add vector funnel shift tests

Demonstrates missed opportunity to combine to the VBMI2 SHLDV/SHRDV ops - combineOrShiftToFunnelShift should handle vector ops (and we should eventually move this to DAGCombine).

4 years ago[libc++] Force the ABI namespace to be a reserved identifier
Louis Dionne [Thu, 24 Oct 2019 21:16:37 +0000 (14:16 -0700)]
[libc++] Force the ABI namespace to be a reserved identifier

Summary:
When the ABI namespace isn't a reserved identifier, we were issuing a
warning, but this should have been an error since the beginning. This
commit enforces that the ABI namespace is a reserved identifier, and
changes the ABI namespace used by LibFuzzer.

Reviewers: phosek, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, #sanitizers, libcxx-commits, llvm-commits

Tags: #sanitizers, #libc, #llvm

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

4 years agoRevert "[clang-format] Remove the dependency on frontend"
Vlad Tsyrklevich [Tue, 29 Oct 2019 17:20:38 +0000 (10:20 -0700)]
Revert "[clang-format] Remove the dependency on frontend"

This reverts commit ec66603ac7ea655be5c2c5f508c5bf0d5eaeb65b. It was
causing ubsan failures like the following on the ubsan bot:
llvm/lib/Support/SourceMgr.cpp:440:48: runtime error: pointer index expression with base 0x000000000000 overflowed to 0xfffffffffffffffa

4 years ago[SVE][AArch64] Adding pattern matching for some SVE instructions.
Ehsan Amiri [Tue, 29 Oct 2019 16:08:00 +0000 (12:08 -0400)]
[SVE][AArch64] Adding pattern matching for some SVE instructions.

Adding patten matching for two SVE intrinsics: frecps and frsqrts.
Also added patterns for fsub and fmul - these SDNodes directly correspond
to machine instructions.

Review: https://reviews.llvm.org/D68476
Patch authored by mgudim (Mikhail Gudim).

4 years ago[ELF] Delete redundant comment after D56554. NFC
Fangrui Song [Tue, 29 Oct 2019 17:00:46 +0000 (10:00 -0700)]
[ELF] Delete redundant comment after D56554. NFC

4 years ago[lld] [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STACK
Michał Górny [Mon, 21 Oct 2019 17:27:51 +0000 (19:27 +0200)]
[lld] [ELF] Add '-z nognustack' opt to suppress emitting PT_GNU_STACK

Add a new '-z nognustack' option that suppresses emitting PT_GNU_STACK
segment.  This segment is not supported at all on NetBSD (stack is
always non-executable), and the option is meant to be used to disable
emitting it.

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

4 years ago[LLDB][Python] fix another fflush issue on NetBSD
Lawrence D'Anna [Tue, 29 Oct 2019 04:59:04 +0000 (21:59 -0700)]
[LLDB][Python] fix another fflush issue on NetBSD

Summary:
Here's another instance where we were calling fflush on an input
stream, which is illegal on NetBSD.

Reviewers: labath, mgorny

Reviewed By: mgorny

Subscribers: krytarowski, lldb-commits

Tags: #lldb

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

4 years ago[SLP] Fix -Wunused-variable. NFC
Fangrui Song [Tue, 29 Oct 2019 16:38:33 +0000 (09:38 -0700)]
[SLP] Fix -Wunused-variable. NFC

4 years agoisBuiltinFunc() uses StringRef instead of const char*
Guillaume Chatelet [Tue, 29 Oct 2019 16:28:34 +0000 (17:28 +0100)]
isBuiltinFunc() uses StringRef instead of const char*

Summary: This prevents a bug when passing nullptr, StringRef ctor would call strlen(nullptr).

Reviewers: vlad.tsyrklevich

Subscribers: cfe-commits

Tags: #clang

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

4 years agoReland [AArch64][DebugInfo] Do not recompute CalleeSavedStackSize (Take 2)
Sander de Smalen [Tue, 29 Oct 2019 12:49:34 +0000 (12:49 +0000)]
Reland [AArch64][DebugInfo] Do not recompute CalleeSavedStackSize (Take 2)

llvm/test/DebugInfo/MIR/X86/live-debug-values-reg-copy.mir failed with
EXPENSIVE_CHECKS enabled, causing the patch to be reverted in
rG2c496bb5309c972d59b11f05aee4782ddc087e71.

This patch relands the patch with a proper fix to the
live-debug-values-reg-copy.mir tests, by ensuring the MIR encodes the
callee-saves correctly so that the CalleeSaved info is taken from MIR
directly, rather than letting it be recalculated by the PEI pass. I've
done this by running `llc -stop-before=prologepilog` on the LLVM
IR as captured in the test files, adding the extra MOV instructions
that were manually added in the original test file, then running `llc
-run-pass=prologepilog` and finally re-added the comments for the MOV
instructions.

4 years ago[SLP] Generalization of stores vectorization.
Alexey Bataev [Mon, 28 Oct 2019 17:46:10 +0000 (13:46 -0400)]
[SLP] Generalization of stores vectorization.

Stores are vectorized with maximum vectorization factor of 16. Patch
tries to improve the situation and use maximal vectorization factor.

Reviewers: spatel, RKSimon, mkuper, hfinkel

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

4 years agoFix missing memcpy builtin on ppc64be
Guillaume Chatelet [Tue, 29 Oct 2019 15:35:11 +0000 (16:35 +0100)]
Fix missing memcpy builtin on ppc64be
See D68028

4 years ago[X86] Pull out combineOrShiftToFunnelShift helper. NFCI.
Simon Pilgrim [Tue, 29 Oct 2019 15:29:32 +0000 (15:29 +0000)]
[X86] Pull out combineOrShiftToFunnelShift helper. NFCI.

4 years agobuild: make standalone builds work again
Saleem Abdulrasool [Tue, 29 Oct 2019 15:24:10 +0000 (08:24 -0700)]
build: make standalone builds work again

Apple's greendragon bot uses a standalone build of lldb which would
fail to build after a recent change to LLVM as it relied on LLVM setting
global flags for its build.  Attempt to repair the standalone build for
greendragon bot.

4 years agobuild: workaround stale caches (NFC)
Saleem Abdulrasool [Tue, 29 Oct 2019 15:20:58 +0000 (08:20 -0700)]
build: workaround stale caches (NFC)

`LLVM_DEFAULT_TARGET_TRIPLE` is a cached variable, which means that it
may actually be unset.  Furthermore, in standalone builds, the variable
may be fully undefined.  Apply the regular expression over the empty
string in such a case.  This should improve the state of the green
dragon bot.

4 years ago[InstCombine] make icmp vector canonicalization safe for constant with undef elements
Sanjay Patel [Tue, 29 Oct 2019 14:39:59 +0000 (10:39 -0400)]
[InstCombine] make icmp vector canonicalization safe for constant with undef elements

This is a fix for:
https://bugs.llvm.org/show_bug.cgi?id=43730
...and as shown there, we have existing test cases that show potential miscompiles.

We could just bail out for vector constants that contain any undef elements, or we can do as shown here:
allow the transform, but replace the undefs with a safe value.

For most of the tests shown, this results in a full splat constant (no undefs) which is probably a win
for further IR analysis because we conservatively don't match undefs in most cases. Codegen can probably
recover these kinds of undef lanes via demanded elements analysis if that's profitable.

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

4 years ago[clang] Add no_builtin attribute
Guillaume Chatelet [Wed, 25 Sep 2019 09:31:28 +0000 (11:31 +0200)]
[clang] Add no_builtin attribute

Summary:
This is a follow up on https://reviews.llvm.org/D61634
This patch is simpler and only adds the no_builtin attribute.

Reviewers: tejohnson, courbet, theraven, t.p.northover, jdoerfert

Subscribers: mgrang, cfe-commits

Tags: #clang

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

This is a re-submit after it got reverted in https://reviews.llvm.org/rGbd8791610948 since the breakage doesn't seem to come from this patch.

4 years ago[lldb][NFC] Make LLVMUserExpression::DoExecute return early
Raphael Isemann [Tue, 29 Oct 2019 14:13:02 +0000 (15:13 +0100)]
[lldb][NFC] Make LLVMUserExpression::DoExecute return early

The giant if-else isn't conforming to LLVM code style.

4 years ago[OPENMP]Fix PR43772: No warning in non-combined target regions.
Alexey Bataev [Tue, 29 Oct 2019 14:06:11 +0000 (10:06 -0400)]
[OPENMP]Fix PR43772: No warning in non-combined target regions.

Need to analyze inner target regions in case of implicit mapping of the
data members when target region is created in one of the class member
functions.

4 years ago[bugpoint] Try to reduce passes after reducing everything.
Florian Hahn [Tue, 29 Oct 2019 13:41:19 +0000 (13:41 +0000)]
[bugpoint] Try to reduce passes after reducing everything.

In some cases, we fail to reduce the pass list earlier because of
complex pass dependencies, but we can reduce it after we simplified the
reproducer.

An example of that is PR43474, which can limit the crash to
-loop-interchange. Adding a test case would require at least 2
interacting Loop passes I think.

Reviewers: davide, reames, modocache

Reviewed By: reames

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

4 years ago[InstCombine] add tests for icmp predicate canonicalization with vector types; NFC
Sanjay Patel [Tue, 29 Oct 2019 13:39:46 +0000 (09:39 -0400)]
[InstCombine] add tests for icmp predicate canonicalization with vector types; NFC

Increase coverage for D69519.

4 years ago[Hexagon] Handle remaining registers in getRegisterByName()
Krzysztof Parzyszek [Mon, 28 Oct 2019 20:12:43 +0000 (15:12 -0500)]
[Hexagon] Handle remaining registers in getRegisterByName()

This fixes https://llvm.org/PR43829.

4 years ago[BitVector] Define BitWord as uintptr_t
Simon Pilgrim [Tue, 29 Oct 2019 13:52:32 +0000 (13:52 +0000)]
[BitVector] Define BitWord as uintptr_t

Define BitVector::BitWord as uintptr_t instead of unsigned long, as long does not necessarily translates to a pointer size (especially on 64-bit Visual Studio).

Committed on behalf of @ekatz (Ehud Katz)

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

4 years ago[IR] move/change null-check to assert
Sanjay Patel [Tue, 29 Oct 2019 13:25:36 +0000 (09:25 -0400)]
[IR] move/change null-check to assert

This should trigger a dereference before null-check warning,
but I don't see it when building with clang. In any case, the
current and known future users of this helper require non-null
args, so I'm converting the 'if' to an assert.

4 years ago[BitVector] Cast integer literals to BitWord [NFC]
Simon Pilgrim [Tue, 29 Oct 2019 12:56:13 +0000 (12:56 +0000)]
[BitVector] Cast integer literals to BitWord [NFC]

Associate the integer literals with BitWord, instead of the embedded UL suffix.

Required for https://reviews.llvm.org/D69336.

Committed on behalf of @ekatz (Ehud Katz)

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

4 years ago[IR] move helper function to replace undef constant (elements) with fixed constants
Sanjay Patel [Tue, 29 Oct 2019 11:41:41 +0000 (07:41 -0400)]
[IR] move helper function to replace undef constant (elements) with fixed constants

This is the NFC part of D69519.
We had this functionality locally in instcombine, but it can be used
elsewhere, so hoisting it to Constant class.

4 years ago[LLDB] [PECOFF] Use FindSectionByID to associate symbols to sections
Martin Storsjö [Mon, 21 Oct 2019 06:26:55 +0000 (09:26 +0300)]
[LLDB] [PECOFF] Use FindSectionByID to associate symbols to sections

The virtual container/header section caused the section list to be
offset by one, but by using FindSectionByID, the layout of the
section list shouldn't matter.

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

4 years agoFix some spelling mistakes in comments. NFC
Greg Bedwell [Tue, 29 Oct 2019 12:40:57 +0000 (12:40 +0000)]
Fix some spelling mistakes in comments. NFC

4 years agoFix a spelling mistake in a comment. NFC
Greg Bedwell [Tue, 29 Oct 2019 12:32:01 +0000 (12:32 +0000)]
Fix a spelling mistake in a comment. NFC

(I'm currently trying to debug a strange error message I get when
pushing to github, despite the pushes being successful).

4 years agoFix a spelling mistake in a comment. NFC
Greg Bedwell [Mon, 28 Oct 2019 14:28:00 +0000 (14:28 +0000)]
Fix a spelling mistake in a comment. NFC

4 years agoRevert "[NFC] Replace a linked list in LiveDebugVariables pass with a DenseMap"
Andrea Di Biagio [Tue, 29 Oct 2019 12:04:32 +0000 (12:04 +0000)]
Revert "[NFC] Replace a linked list in LiveDebugVariables pass with a DenseMap"

This reverts commit 8af5ada09319e5a021d57a1a03715b2fd022e415.

As Bjorn pointed out in D68816, the iteration over `UserVals` may not be safe.

Reverting on behalf of Orlando.

4 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Tue, 29 Oct 2019 12:12:16 +0000 (12:12 +0000)]
Fix unused variable warning. NFCI.

4 years ago[clangd] Add a hidden tweak to dump symbol under the cursor.
Haojian Wu [Mon, 28 Oct 2019 15:27:42 +0000 (16:27 +0100)]
[clangd] Add a hidden tweak to dump symbol under the cursor.

Summary:
This provides a convenient way to see the SymbolID/USR of the symbol, mainly
for debugging purpose.

Reviewers: ilya-biryukov

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

Tags: #clang

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

4 years ago[LCSSA] Forget values we create LCSSA phis for
Florian Hahn [Tue, 29 Oct 2019 11:54:18 +0000 (11:54 +0000)]
[LCSSA] Forget values we create LCSSA phis for

Summary:
Currently we only forget the loop we added LCSSA phis for. But SCEV
expressions in other loops could also depend on the instruction we added
a PHI for and currently we do not invalidate those expressions. This can
happen when we use ScalarEvolution before converting a function to LCSSA
form. The SCEV expressions will refer to the non-LCSSA value. If this
SCEV expression is then used with the expander, we do not preserve LCSSA
form.

This patch properly forgets the values we created PHIs for. Those need
to be recomputed again. This patch fixes PR43458.

Currently SCEV::verify does not catch this mismatch and any test would
need to run multiple passes to trigger the error (e.g. -loop-reduce
-loop-unroll). I will also look into catching this kind of mismatch in
the verifier. Also, we currently forget the whole loop in LCSSA and I'll
check if we can be more surgical.

Reviewers: efriedma, sanjoy.google, reames

Reviewed By: efriedma

Subscribers: zzheng, hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

4 years agoRevert rG70f5aecedef9a6e347e425eb5b843bf797b95319 - "Reland [AArch64][DebugInfo]...
Simon Pilgrim [Tue, 29 Oct 2019 11:54:38 +0000 (11:54 +0000)]
Revert rG70f5aecedef9a6e347e425eb5b843bf797b95319 - "Reland [AArch64][DebugInfo] Do not recompute CalleeSavedStackSize (Take 2)"

This fails on EXPENSIVE_CHECKS builds

4 years ago[BranchFolding] skip debug instr to avoid code change
Jeremy Morse [Tue, 29 Oct 2019 11:38:20 +0000 (11:38 +0000)]
[BranchFolding] skip debug instr to avoid code change

Use the existing helper function in BranchFolding, "countsAsInstruction",
to skip over non-instructions. Otherwise debug instructions can be
identified as the last real instruction in a block, leading to different
codegen decisions when debug is enabled as demonstrated by the test case.

Patch by: yechunliang (Chris Ye)!

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

4 years ago[ConstantFold] Push extractelement into getelementptr's operands
Jay Foad [Tue, 29 Oct 2019 10:31:52 +0000 (10:31 +0000)]
[ConstantFold] Push extractelement into getelementptr's operands

This fixes a minor oversight mentioned in the review of D69379:
we should push extractelement into the operands of getelementptr
regardless of whether that enables further folding.

4 years ago[clangd] NFC, use URI::resolve to simplify the code.
Haojian Wu [Tue, 29 Oct 2019 09:49:27 +0000 (10:49 +0100)]
[clangd] NFC, use URI::resolve to simplify the code.