platform/upstream/llvm.git
4 years agoFix compatibility with python3 of clang-include-fixer.py
Yannick Brehon [Tue, 3 Dec 2019 11:52:59 +0000 (12:52 +0100)]
Fix compatibility with python3 of clang-include-fixer.py

clang-include-fixer was recently updated to be python3-compatible.
However, an exception handling clause was improperly using the deprecated `message` property of Exception classes, so the code was not yet entirely python3-compatible.

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

4 years ago[AArch64][SVE] Implement shift intrinsics
Kerry McLaughlin [Tue, 3 Dec 2019 11:26:18 +0000 (11:26 +0000)]
[AArch64][SVE] Implement shift intrinsics

Summary:
Adds the following intrinsics:
- asr & asrd
- insr
- lsl & lsr

This patch also adds a new AArch64ISD node (INSR) to represent the int_aarch64_sve_insr intrinsic.

Reviewers: huntergr, sdesmalen, dancgr, mgudim, rengolin, efriedma

Reviewed By: sdesmalen

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

Tags: #llvm

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

4 years agogn build: Merge bc76dadb3cf
LLVM GN Syncbot [Tue, 3 Dec 2019 11:35:13 +0000 (11:35 +0000)]
gn build: Merge bc76dadb3cf

4 years ago[lldb][NFC] Extract searching for function SymbolContexts out of ClangExpressionDeclM...
Raphael Isemann [Fri, 29 Nov 2019 14:05:42 +0000 (15:05 +0100)]
[lldb][NFC] Extract searching for function SymbolContexts out of ClangExpressionDeclMap::LookupFunction

This code was just creating a new SymbolContextList with any found functions
in the front and orders them by how close they are to the current frame.
This refactors this code into its own function to make this more obvious.

Doesn't do any other changes to the code, so this is NFC.

4 years agoFix for buildbots
Sam Parker [Tue, 3 Dec 2019 11:30:38 +0000 (11:30 +0000)]
Fix for buildbots

Change pass name in pipeline test.

4 years ago[lldb] Remove all remaining tabs from TestReturnValue.py
Raphael Isemann [Tue, 3 Dec 2019 11:05:54 +0000 (12:05 +0100)]
[lldb] Remove all remaining tabs from TestReturnValue.py

I assumed this was just a single typo, but it seems we actually have
a whole bunch of tabs in this file which cause Python to complain
about mixing tabs and spaces.

4 years ago[CodeGen] Move ARMCodegenPrepare to TypePromotion
Sam Parker [Tue, 3 Dec 2019 11:00:32 +0000 (11:00 +0000)]
[CodeGen] Move ARMCodegenPrepare to TypePromotion

Convert ARMCodeGenPrepare into a generic type promotion pass by:
- Removing the insertion of arm specific intrinsics to handle narrow
  types as we weren't using this.
- Removing ARMSubtarget references.
- Now query a generic TLI object to know which types should be
  promoted and what they should be promoted to.
- Move all codegen tests into Transforms folder and testing using opt
  and not llc, which is how they should have been written in the
  first place...

The pass searches up from icmp operands in an attempt to safely
promote types so we can avoid generating unnecessary unsigned extends
during DAG ISel.

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

4 years ago[OpenCL] Fix mangling of single-overload builtins
Sven van Haastregt [Tue, 3 Dec 2019 11:07:48 +0000 (11:07 +0000)]
[OpenCL] Fix mangling of single-overload builtins

Commit 9a8d477a0e0 ("[OpenCL] Add builtin function attribute
handling", 2019-11-05) stopped Clang from mangling single-overload
builtins, which is incorrect.

4 years ago[lldb][NFC] Test going up/down one line in the multiline expression editor
Raphael Isemann [Tue, 3 Dec 2019 10:28:56 +0000 (11:28 +0100)]
[lldb][NFC] Test going up/down one line in the multiline expression editor

4 years ago[clang][CodeGen] Make use of cc1 instead of clang in the tests
Kadir Cetinkaya [Tue, 3 Dec 2019 11:02:12 +0000 (12:02 +0100)]
[clang][CodeGen] Make use of cc1 instead of clang in the tests

4 years agoFixup 6d18e53: xfail TestShowLocationDwarf5.py properly
Diana Picus [Tue, 3 Dec 2019 10:52:03 +0000 (11:52 +0100)]
Fixup 6d18e53: xfail TestShowLocationDwarf5.py properly

Forgot to squash this...

4 years ago[DWARF] Add support for parsing/dumping section indices in location lists
Pavel Labath [Thu, 21 Nov 2019 15:16:50 +0000 (16:16 +0100)]
[DWARF] Add support for parsing/dumping section indices in location lists

Summary:
This does exactly what it says on the box. The only small gotcha is the
section index computation for offset_pair entries, which can use either
the base address section, or the section from the offset_pair entry.
This is to support both the cases where the base address is relocated
(points to the base of the CU, typically), and the case where the base
address is a constant (typically zero) and relocations are on the
offsets themselves.

Reviewers: dblaikie, JDevlieghere, aprantl, SouraVX

Subscribers: hiraditya, llvm-commits, probinson

Tags: #llvm

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

4 years ago[lldb] Remove tab from TestReturnValue.py
Raphael Isemann [Tue, 3 Dec 2019 10:44:23 +0000 (11:44 +0100)]
[lldb] Remove tab from TestReturnValue.py

Mixing tabs and spaces makes Python exit with this error:

  File "llvm/lldb/packages/Python/lldbsuite/test/functionalities/return-value/TestReturnValue.py", line 23
    return (self.getArchitecture() == "aarch64" and self.getPlatform() == "linux")
                                                                                 ^
TabError: inconsistent use of tabs and spaces in indentation

4 years ago[lldb] Move register info "augmentation" from gdb-remote into ABI
Pavel Labath [Tue, 3 Dec 2019 10:39:20 +0000 (11:39 +0100)]
[lldb] Move register info "augmentation" from gdb-remote into ABI

Summary:
Previously the ABI plugin exposed some "register infos" and the
gdb-remote code used those to fill in the missing bits. Now, the
"filling in" code is in the ABI plugin itself, and the gdb-remote code
just invokes that.

The motivation for this is two-fold:
a) the "augmentation" logic is useful outside of process gdb-remote. For
  instance, it would allow us to avoid repeating the register number
  definitions in minidump code.
b) It gives more implementation freedom to the ABI classes. Now that
  these "register infos" are essentially implementation details, classes
  can use other methods to obtain dwarf/eh_frame register numbers -- for
  instance they can consult llvm MC layer.

Since the augmentation code was not currently tested anywhere, I took
the opportunity to create a simple test for it.

Reviewers: jasonmolenda, clayborg, tatyana-krasnukha

Subscribers: aprantl, lldb-commits

Tags: #lldb

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

4 years ago[asan] Remove debug locations from alloca prologue instrumentation
Johannes Altmanninger [Mon, 2 Dec 2019 10:39:28 +0000 (11:39 +0100)]
[asan] Remove debug locations from alloca prologue instrumentation

Summary:
This fixes https://llvm.org/PR26673
"Wrong debugging information with -fsanitize=address"
where asan instrumentation causes the prologue end to be computed
incorrectly: findPrologueEndLoc, looks for the first instruction
with a debug location to determine the prologue end.  Since the asan
instrumentation instructions had debug locations, that prologue end was
at some instruction, where the stack frame is still being set up.

There seems to be no good reason for extra debug locations for the
asan instrumentations that set up the frame; they don't have a natural
source location.  In the debugger they are simply located at the start
of the function.

For certain other instrumentations like -fsanitize-coverage=trace-pc-guard
the same problem persists - that might be more work to fix, since it
looks like they rely on locations of the tracee functions.

This partly reverts aaf4bb239487e0a3b20a8eaf94fc641235ba2c29
"[asan] Set debug location in ASan function prologue"
whose motivation was to give debug location info to the coverage callback.
Its test only ensures that the call to @__sanitizer_cov_trace_pc_guard is
given the correct source location; as the debug location is still set in
ModuleSanitizerCoverage::InjectCoverageAtBlock, the test does not break.
So -fsanitize-coverage is hopefully unaffected - I don't think it should
rely on the debug locations of asan-generated allocas.

Related revision: 3c6c14d14b40adfb581940859ede1ac7d8ceae7a
"ASAN: Provide reliable debug info for local variables at -O0."

Below is how the X86 assembly version of the added test case changes.
We get rid of some .loc lines and put prologue_end where the user code starts.

```diff
--- 2.master.s 2019-12-02 12:32:38.982959053 +0100
+++ 2.patch.s 2019-12-02 12:32:41.106246674 +0100
@@ -45,8 +45,6 @@
  .cfi_offset %rbx, -24
  xorl %eax, %eax
  movl %eax, %ecx
- .Ltmp2:
-  .loc 1 3 0 prologue_end      # 2.c:3:0
  cmpl $0, __asan_option_detect_stack_use_after_return
  movl %edi, 92(%rbx)          # 4-byte Spill
  movq %rsi, 80(%rbx)          # 8-byte Spill
@@ -57,9 +55,7 @@
  callq __asan_stack_malloc_0
  movq %rax, 72(%rbx)          # 8-byte Spill
 .LBB1_2:
-  .loc 1 0 0 is_stmt 0         # 2.c:0:0
  movq 72(%rbx), %rax          # 8-byte Reload
-  .loc 1 3 0                   # 2.c:3:0
  cmpq $0, %rax
  movq %rax, %rcx
  movq %rax, 64(%rbx)          # 8-byte Spill
@@ -72,9 +68,7 @@
  movq %rax, %rsp
  movq %rax, 56(%rbx)          # 8-byte Spill
 .LBB1_4:
-  .loc 1 0 0                   # 2.c:0:0
  movq 56(%rbx), %rax          # 8-byte Reload
-  .loc 1 3 0                   # 2.c:3:0
  movq %rax, 120(%rbx)
  movq %rax, %rcx
  addq $32, %rcx
@@ -99,7 +93,6 @@
  movb %r8b, 31(%rbx)          # 1-byte Spill
  je .LBB1_7
 # %bb.5:
-  .loc 1 0 0                   # 2.c:0:0
  movq 40(%rbx), %rax          # 8-byte Reload
  andq $7, %rax
  addq $3, %rax
@@ -118,7 +111,8 @@
  movl %ecx, (%rax)
  movq 80(%rbx), %rdx          # 8-byte Reload
  movq %rdx, 128(%rbx)
- .loc 1 4 3 is_stmt 1         # 2.c:4:3
+.Ltmp2:
+ .loc 1 4 3 prologue_end      # 2.c:4:3
  movq %rax, %rdi
  callq f
  movq 48(%rbx), %rax          # 8-byte Reload
```

Reviewers: eugenis, aprantl

Reviewed By: eugenis

Subscribers: ormris, aprantl, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoTemporarily run machine-verifier once in test/CodeGen/SPARC/fp128.ll, so that
Jonas Paulsson [Tue, 3 Dec 2019 10:19:16 +0000 (11:19 +0100)]
Temporarily run machine-verifier once in test/CodeGen/SPARC/fp128.ll, so that
it XFAIL:s also without expensive checks.

See https://reviews.llvm.org/D63973

4 years agoImplicitNullChecks: Don't add a dead definition of DepMI as live-in
Jonas Paulsson [Tue, 19 Nov 2019 12:15:12 +0000 (13:15 +0100)]
ImplicitNullChecks: Don't add a dead definition of DepMI as live-in

This is one of the fixes needed to reapply D68267 which improves verification
of live-in lists.

Review: craig.topper
https://reviews.llvm.org/D70434

4 years ago[LiveDebugValues] Introduce entry values of unmodified params
Djordje Todorovic [Thu, 21 Nov 2019 10:07:39 +0000 (11:07 +0100)]
[LiveDebugValues] Introduce entry values of unmodified params

The idea is to remove front-end analysis for the parameter's value
modification and leave it to the value tracking system. Front-end in some
cases marks a parameter as modified even the line of code that modifies the
parameter gets optimized, that implies that this will cover more entry
values even. In addition, extending the support for modified parameters
will be easier with this approach.

Since the goal is to recognize if a parameter’s value has changed, the idea
at very high level is: If we encounter a DBG_VALUE other than the entry
value one describing the same variable (parameter), we can assume that the
variable’s value has changed and we should not track its entry value any
more. That would be ideal scenario, but due to various LLVM optimizations,
a variable’s value could be just moved around from one register to another
(and there will be additional DBG_VALUEs describing the same variable), so
we have to recognize such situation (otherwise, we will lose a lot of entry
values) and salvage the debug entry value.

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

4 years agoMark some tests as xfail on AArch64 Linux
Diana Picus [Tue, 19 Nov 2019 09:58:52 +0000 (10:58 +0100)]
Mark some tests as xfail on AArch64 Linux

I have either opened new bug reports for these tests, or added links to
existing bugs.

This should help make the lldb-aarch64-ubuntu buildbot green (there will
still be some unexpected passes that someone should look into, but those
can be handled later).

4 years ago[NFC] Tidy-ups to TimeProfiler.cpp
Russell Gallop [Thu, 28 Nov 2019 16:20:59 +0000 (16:20 +0000)]
[NFC] Tidy-ups to TimeProfiler.cpp

Remove unused include
Make fields const where possible
Move initialisation to initialiser list

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

4 years ago[MachineVerifier] Improve checks of target instructions operands.
Jonas Paulsson [Fri, 1 Nov 2019 09:14:22 +0000 (10:14 +0100)]
[MachineVerifier]  Improve checks of target instructions operands.

While working with a patch for instruction selection, the splitting of a
large immediate ended up begin treated incorrectly by the backend. Where a
register operand should have been created, it instead became an immediate. To
my surprise the machine verifier failed to report this, which at the time
would have been helpful.

This patch improves the verifier so that it will report this type of error.

This patch XFAILs CodeGen/SPARC/fp128.ll, which has been reported at
https://bugs.llvm.org/show_bug.cgi?id=44091

Review: thegameg, arsenm, fhahn
https://reviews.llvm.org/D63973

4 years ago[NFC] Slightly improve wording in the comments
Kirill Bobyrev [Tue, 3 Dec 2019 09:12:17 +0000 (10:12 +0100)]
[NFC] Slightly improve wording in the comments

Reviewed by: hokein

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

4 years ago[llvm][bindings][go] Fix typo
Kadir Cetinkaya [Tue, 3 Dec 2019 08:30:32 +0000 (09:30 +0100)]
[llvm][bindings][go] Fix typo

4 years ago[UpdateTestChecks] Fix parsing of RUN: lines with line continuations
Alex Richardson [Tue, 3 Dec 2019 08:23:25 +0000 (08:23 +0000)]
[UpdateTestChecks] Fix parsing of RUN: lines with line continuations

I accidentally broke this in d9542db49e90457de62af3bfe395aaf4c47b68a5 due
to incorrectly placed parentheses.

4 years ago[lldb][NFC] Remove ThreadSafeSTLVector and ThreadSafeSTLMap and their use in ValueObj...
Raphael Isemann [Tue, 3 Dec 2019 07:53:42 +0000 (08:53 +0100)]
[lldb][NFC] Remove ThreadSafeSTLVector and ThreadSafeSTLMap and their use in ValueObjectSynthetic

Summary:
ThreadSafeSTLVector and ThreadSafeSTLMap are not useful for achieving any degree of thread safety in LLDB
and should be removed before they are used in more places. They are only used (unsurprisingly incorrectly) in
`ValueObjectSynthetic::GetChildAtIndex`, so this patch replaces their use there with a simple mutex with which
we guard the related data structures. This doesn't make ValueObjectSynthetic::GetChildAtIndex
any more thread-safe, but on the other hand it at least allows us to get rid of the ThreadSafeSTL* data structures
without changing the observable behaviour of ValueObjectSynthetic (beside that it is now a few bytes smaller).

Reviewers: labath, JDevlieghere, jingham

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

4 years agoAvoidBindCheck.cpp: Fix unused variables warning
Hans Wennborg [Tue, 3 Dec 2019 07:59:01 +0000 (08:59 +0100)]
AvoidBindCheck.cpp: Fix unused variables warning

4 years agoAvoidBindCheck.cpp: Fix GCC 5.3 build errors
Hans Wennborg [Tue, 3 Dec 2019 07:56:51 +0000 (08:56 +0100)]
AvoidBindCheck.cpp: Fix GCC 5.3 build errors

It was failing with:

clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp:61:29:
error: declaration of ‘clang::tidy::modernize::{anonymous}::CaptureMode clang::tidy::modernize::{anonymous}::BindArgument::CaptureMode’ [-fpermissive]
   CaptureMode CaptureMode = CM_None;
                             ^
clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp:38:6:
error: changes meaning of ‘CaptureMode’ from ‘enum clang::tidy::modernize::{anonymous}::CaptureMode’ [-fpermissive]
 enum CaptureMode { CM_None, CM_ByRef, CM_ByValue, CM_InitExpression };
      ^

4 years ago[LegalizeDAG] Return true from ExpandNode for some nodes that don't have expand support.
Craig Topper [Tue, 3 Dec 2019 07:10:57 +0000 (23:10 -0800)]
[LegalizeDAG] Return true from ExpandNode for some nodes that don't have expand support.

These nodes have a FIXME that they only get here because a Custom
handler returned SDValue() instead of the original Op.

Even though we aren't expanding them, we should return true here to
prevent ConvertNodeToLibcall from also trying to process them until
the FIXME has been addressed.

I'm hoping to add checking to ConvertNodeToLibcall to make sure
we don't give it nodes it doesn't have support for.

4 years ago[LegalizeDAG] When expanding vector SRA/SRL/SHL add the new BUILD_VECTOR to the Resul...
Craig Topper [Tue, 3 Dec 2019 06:50:59 +0000 (22:50 -0800)]
[LegalizeDAG] When expanding vector SRA/SRL/SHL add the new BUILD_VECTOR to the Results vector instead of just calling ReplaceNode

The code that processes the Results vector also calls ReplaceNode
and makes ExpandNode return true.

If we don't add it to the Results node, we end up returning false
from ExpandNode. This causes ConvertNodeToLibcall to be called next.
But ConvertNodeToLibcall doesn't do anything for shifts so they
just pass through unmodified. Except for printing a debug message.

Ultimately, I'd like to add more checks to ExpandNode and
ConvertNodeToLibcall to make sure we don't have nodes marked as
Expand that don't have any Expand or libcall handling.

4 years ago[NFC][PowerPC] Add the inheritable and additional features to make the processor...
QingShan Zhang [Tue, 3 Dec 2019 06:32:46 +0000 (06:32 +0000)]
[NFC][PowerPC] Add the inheritable and additional features to make the processor definition more clear

The old processor design assume that, all the old processor's feature must be
inherited into future processor. That is not true as instruction fusion or some
implementation defined features are not inheritable.

What this patch did:
  * Rename the old "specific features" to "additional features" that keep the new added inheritable features.
  * Use the "specific features" to keep those features only for specific processor.
  * Add the "inheritable features" to keep all the features that inherited from early processor.

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

4 years agoRecommit "[DWARF5]Addition of alignment atrribute in typedef DIE."
Sourabh Singh Tomar [Tue, 3 Dec 2019 03:59:54 +0000 (09:29 +0530)]
Recommit "[DWARF5]Addition of alignment atrribute in typedef DIE."

This revision is revised to update Go-bindings and Release Notes.

The original commit message follows.

This patch, adds support for DW_AT_alignment[DWARF5] attribute, to be emitted with typdef DIE.
When explicit alignment is specified.

Patch by Awanish Pandey <Awanish.Pandey@amd.com>

Reviewers: aprantl, dblaikie, jini.susan.george, SouraVX, alok,
deadalinx

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

4 years ago[DebugInfo] Support for debug_macinfo.dwo section in llvm and llvm-dwarfdump.
Sourabh Singh Tomar [Mon, 11 Nov 2019 07:23:19 +0000 (12:53 +0530)]
[DebugInfo] Support for debug_macinfo.dwo section in llvm and llvm-dwarfdump.

This patch adds support for debug_macinfo.dwo section[pre-standardized]
to llvm and llvm-dwarfdump.

Reviewers: probinson, dblaikie, aprantl, jini.susan.george, alok

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

Tags: #debug-info #llvm

4 years ago[clang-scan-deps] do not skip empty #if/#elif in the minimizer to avoid missing ...
Alex Lorenz [Tue, 3 Dec 2019 01:38:40 +0000 (17:38 -0800)]
[clang-scan-deps] do not skip empty #if/#elif in the minimizer to avoid missing `__has_include` dependencies

This patch makes the minimizer more conservative to avoid missing dependency files that are brought in by __has_include
PP expressions that occur in a condition of an #if/#elif that was previously skipped. The __has_include PP expressions
can be used in an #if/#elif either directly, or through macro expansion, so we can't detect them at the time of minimization.

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

4 years ago[X86] Model MXCSR for AVX instructions other than AVX512
Wang, Pengfei [Wed, 27 Nov 2019 13:09:17 +0000 (21:09 +0800)]
[X86] Model MXCSR for AVX instructions other than AVX512

Summary: Model MXCSR for AVX instructions other than AVX512

Reviewers: craig.topper, RKSimon

Subscribers: hiraditya, llvm-commits, LuoYuanke, LiuChen3

Tags: #llvm

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

4 years agoFix failing testcase to check for the correct output
Bill Wendling [Tue, 3 Dec 2019 00:19:01 +0000 (16:19 -0800)]
Fix failing testcase to check for the correct output

4 years ago[clang-tidy] Rewrite modernize-avoid-bind check.
Zachary Turner [Wed, 20 Nov 2019 19:27:14 +0000 (11:27 -0800)]
[clang-tidy] Rewrite modernize-avoid-bind check.

This represents largely a full re-write of modernize-avoid-bind, adding
significant new functionality in the process. In particular:

* Both boost::bind and std::bind are now supported
* Function objects are supported in addition to functions
* Member functions are supported
* Nested calls are supported using capture-init syntax
* std::ref() and boost::ref() are now recognized, and will capture by reference.
* Rather than capturing with a global =, we now build up an individual
  capture list that is both necessary and sufficient for the call.
* Fixits are supported in a much larger variety of scenarios than before.

All previous tests pass under the re-write, but a large number of new
tests have been added as well.

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

4 years agoPlace the "cold" code piece into the same section as the original function
Bill Wendling [Mon, 2 Dec 2019 07:22:50 +0000 (23:22 -0800)]
Place the "cold" code piece into the same section as the original function

Summary:
This cropped up in the Linux kernel where cold code was placed in an
incompatible section.

Reviewers: compnerd, vsk, tejohnson

Reviewed By: vsk

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoFileCheck IR output for blockaddress in new test
Reid Kleckner [Mon, 2 Dec 2019 23:03:31 +0000 (15:03 -0800)]
FileCheck IR output for blockaddress in new test

Minor improvement to a test added in 1ac700cdef787383ad49a

4 years ago[clang test] Do not assume default target
Thomas Preud'homme [Tue, 26 Nov 2019 22:40:18 +0000 (22:40 +0000)]
[clang test] Do not assume default target

Summary:
clang test Driver/darwin-opt-record.c assumes the default target is
x86_64 by its uses of the -arch x86_64 and -arch x86_64h and thus fail
on systems where it is not the case. Adding a target
x86_64-apple-darwin10 reveals another problem: the driver refuses 2
-arch for an assembly output so this commit also changes the output to
be an object file.

Reviewers: thegameg

Reviewed By: thegameg

Subscribers: cfe-commits

Tags: #clang

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

4 years agoFix comment to more accurately describe C++ language requirements around tail padding.
Richard Smith [Mon, 2 Dec 2019 21:58:37 +0000 (13:58 -0800)]
Fix comment to more accurately describe C++ language requirements around tail padding.

Summary:
As of C++ core issue 43 (http://wg21.link/cwg43), which was voted into
the C++ working draft in 1999, it is not permissible to memcpy a base
class subobject, even if it's of POD type, so there is no problem with
reusing the tail padding of a base class. That issue was voted into the
standard in DR status, so it applies retroactively to C++98 (and is in
any case part of C++03).

So stop suggesting that AlwaysUseTailPadding mode is non-conforming.

Reviewers: rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

Tags: #clang

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

4 years agoTemporarily revert "build: avoid hardcoding the libxml2 library name"
Eric Christopher [Mon, 2 Dec 2019 22:30:16 +0000 (14:30 -0800)]
Temporarily revert "build: avoid hardcoding the libxml2 library name"
as it breaks uses of llvm-config --system-libs and the follow-on commit
"build: avoid cached literals being linked against"

This reverts commits 340e7c0b77a7037afefe7255503afe362967b577 and
340e7c0b77a7037afefe7255503afe362967b577.

4 years agoRemove extraneous semicolon.
Bill Wendling [Mon, 2 Dec 2019 22:05:28 +0000 (14:05 -0800)]
Remove extraneous semicolon.

4 years agoAutomatically generated arm64-abi-varargs.ll . NFC
Amaury Séchet [Mon, 2 Dec 2019 21:28:57 +0000 (22:28 +0100)]
Automatically generated arm64-abi-varargs.ll . NFC

4 years ago[PGO][PGSO] Add an optional query type parameter to shouldOptimizeForSize.
Hiroshi Yamauchi [Wed, 20 Nov 2019 21:08:07 +0000 (13:08 -0800)]
[PGO][PGSO] Add an optional query type parameter to shouldOptimizeForSize.

Summary:
In case of a need to distinguish different query sites for gradual commit or
debugging of PGSO. NFC.

Reviewers: davidxl

Subscribers: hiraditya, zzheng, llvm-commits

Tags: #llvm

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

4 years agoRemove redundant file.
Taewook Oh [Mon, 2 Dec 2019 21:44:42 +0000 (13:44 -0800)]
Remove redundant file.

4 years ago[LLDB] [test] Try to fix the test from 7d019d1a3b when run on Windows.
Martin Storsjö [Mon, 2 Dec 2019 21:35:37 +0000 (23:35 +0200)]
[LLDB] [test] Try to fix the test from 7d019d1a3b when run on Windows.

4 years ago[libcxx{,abi}] Emit deplibs only when detected by CMake
Michał Górny [Mon, 2 Dec 2019 10:49:20 +0000 (11:49 +0100)]
[libcxx{,abi}] Emit deplibs only when detected by CMake

This is a followup to 35bc5276ca3.  It fixes the dependent libs usage
in libcxx and libcxxabi to link pthread and rt libraries only if CMake
detects them, rather than based on explicit platform blacklist.

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

4 years agoRevert "[clangd] repair mac tests for 88bccded8fa1"
Sam McCall [Mon, 2 Dec 2019 21:12:23 +0000 (22:12 +0100)]
Revert "[clangd] repair mac tests for 88bccded8fa1"

Revert "[clangd] Try harder to find a plausible `clang` as argv0, particularly on Mac."

4 years ago[Remarks][ThinLTO] Use the correct file extension based on the format
Francis Visoiu Mistrih [Mon, 2 Dec 2019 21:02:48 +0000 (13:02 -0800)]
[Remarks][ThinLTO] Use the correct file extension based on the format

Since we now have multiple formats, the ThinLTO remark files should also
respect that.

4 years ago[lldb/CMake] Add in_call_stack to the utilities package
Jonas Devlieghere [Mon, 2 Dec 2019 20:27:43 +0000 (12:27 -0800)]
[lldb/CMake] Add in_call_stack to the utilities package

A subset of the examples are shipped as python packages. Include the
in_call_stack utility.

4 years ago[lldb/CMake] Simplify logic for adding example Python packages (NFC)
Jonas Devlieghere [Mon, 2 Dec 2019 20:25:03 +0000 (12:25 -0800)]
[lldb/CMake] Simplify logic for adding example Python packages (NFC)

This simplifies the CMake logic for adding the Python examples to the
Python package. It unifies the use of create_python_package by adding
the NOINIT option and removes the `target` argument, which is always
`finish_swig`.

4 years ago[clangd] repair mac tests for 88bccded8fa1
Sam McCall [Mon, 2 Dec 2019 20:55:30 +0000 (21:55 +0100)]
[clangd] repair mac tests for 88bccded8fa1

4 years ago[MIBundles] Move analyzePhysReg out of MIBundleOperands iterator (NFC).
Florian Hahn [Mon, 2 Dec 2019 20:00:56 +0000 (20:00 +0000)]
[MIBundles] Move analyzePhysReg out of MIBundleOperands iterator (NFC).

analyzePhysReg does not really fit into the iterator and moving it
makes it easier to change the base iterator.

Reviewers: evandro, t.p.northover, paquette, MatzeB, arsenm, qcolombet

Reviewed By: arsenm

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

4 years ago[LLDB] Set the right address size on output DataExtractors from ObjectFile
Martin Storsjö [Fri, 29 Nov 2019 11:28:25 +0000 (13:28 +0200)]
[LLDB] Set the right address size on output DataExtractors from ObjectFile

If filling in a DataExtractor from an ObjectFile, e.g. via the
ReadSectionData method, the output DataExtractor gets the address
size from the m_data member.

ObjectFile's m_data member is initialized without knowledge about
the address size (so the address size is set based on the host's
sizeof(void*), and at that point within ObjectFile's constructor,
virtual methods implemented in subclasses (like GetAddressByteSize())
can't be called, therefore fix it up when filling in external
DataExtractors.

This makes sure that line tables from executables with a different
address size are parsed properly; previously this tripped up
DWARFDebugLine::LineTable::parse for 32 bit executables on a 64 bit
host, as the address size in the line table (4) didn't match the
one set in the DWARFDataExtractor.

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

4 years ago[lldb] Fix TestFormattersSBAPI test
António Afonso [Mon, 2 Dec 2019 20:23:45 +0000 (12:23 -0800)]
[lldb] Fix TestFormattersSBAPI test

Summary:
This test was broken in two ways:
* Using the wrong API (e.g.: format = instead of SetFormat)
* The hex checker was only checking "01" which will pass with 0x0000001

Reviewers: clayborg, lanza, wallace

Reviewed By: clayborg

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[GlobalISel] CombinerHelper: Fix a bug in matchCombineCopy
Volkan Keles [Mon, 2 Dec 2019 20:05:09 +0000 (12:05 -0800)]
[GlobalISel] CombinerHelper: Fix a bug in matchCombineCopy

Summary:
When combining COPY instructions, we were replacing the destination registers
with the source register without checking register constraints. This patch adds
a simple logic to check if the constraints match before replacing registers.

Reviewers: qcolombet, aditya_nandakumar, aemerson, paquette, dsanders, Petar.Avramovic

Reviewed By: aditya_nandakumar

Subscribers: rovka, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ARM] Add ARMVCCThen to tablegen and make use of it. NFC
David Green [Mon, 2 Dec 2019 14:51:49 +0000 (14:51 +0000)]
[ARM] Add ARMVCCThen to tablegen and make use of it. NFC

Similar to the parent, this adds some constants to tablegen to replace
the existing magic values.

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

4 years ago[ARM] Add ARMCC constants to tablegen. NFC
David Green [Mon, 2 Dec 2019 14:49:46 +0000 (14:49 +0000)]
[ARM] Add ARMCC constants to tablegen. NFC

I got tired of looking at magic constants in tablegen files. This adds
condition codes like ARMCCeq and makes use of them.

I also removed the extra patterns for reverse condition codes from
D70296, they should now be covered by the parent commit.

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

4 years ago[ARM] Add some VCMP folding and canonicalisation
David Green [Mon, 2 Dec 2019 14:47:22 +0000 (14:47 +0000)]
[ARM] Add some VCMP folding and canonicalisation

The VCMP instructions in MVE can accept a register or ZR, but only as
the right hand operator. Most of the time this will already be correct
because the icmp will have been canonicalised that way already. There
are some cases in the lowering of float conditions that this will not
apply to though. This code should fix up those cases.

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

4 years ago[ARM] More reversed vcmp tests. NFC
David Green [Mon, 2 Dec 2019 14:46:22 +0000 (14:46 +0000)]
[ARM] More reversed vcmp tests. NFC

4 years ago[MIBundles] Move analyzeVirtReg out of MIBundleOperands iterator (NFC).
Florian Hahn [Mon, 2 Dec 2019 19:41:09 +0000 (19:41 +0000)]
[MIBundles] Move analyzeVirtReg out of MIBundleOperands iterator (NFC).

analyzeVirtReg does not really fit into the iterator and moving it
makes it easier to change the base iterator.

Reviewers: evandro, t.p.northover, paquette, MatzeB, arsenm, qcolombet

Reviewed By: qcolombet

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

4 years ago[WebAssembly] Find wasm-opt with GetProgramPath
Dan Gohman [Mon, 2 Dec 2019 19:47:31 +0000 (11:47 -0800)]
[WebAssembly] Find wasm-opt with GetProgramPath

Instead of just searching for wasm-opt in PATH, use GetProgramPath, which
checks the `COMPILER_PATH` environment variable, -B paths, and `PATH`.

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

4 years ago[AArch64] Attempt to fixup test line. NFC
David Green [Mon, 2 Dec 2019 19:29:50 +0000 (19:29 +0000)]
[AArch64] Attempt to fixup test line. NFC

The test is complaining on some of the builders. This attempts to
adjust the run line to be more line the others in the same folder, using
clang_cc1 as opposed to the driver.

4 years ago[OPENMP]Use cast instead dyn_cast, NFC.
Alexey Bataev [Mon, 2 Dec 2019 19:15:38 +0000 (14:15 -0500)]
[OPENMP]Use cast instead dyn_cast, NFC.

Here the expression is always a DeclRefExpr, no need to use dyn_cast.

4 years ago[OPENMP]Fix PR44133: Emit definitions of used constructors/functions.
Alexey Bataev [Mon, 2 Dec 2019 18:04:30 +0000 (13:04 -0500)]
[OPENMP]Fix PR44133: Emit definitions of used constructors/functions.

Need to fully rebuild the initializer/combiner when instatiating the
declare reduction constrcut to properly emit used functions.

4 years ago[clang][modules] Add support for merging lifetime-extended temporaries
Tyker [Sat, 30 Nov 2019 15:42:33 +0000 (16:42 +0100)]
[clang][modules] Add support for merging lifetime-extended temporaries

Summary: Add support for merging lifetime-extended temporaries

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: xbolva00, cfe-commits

Tags: #clang

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

4 years agoReland "b19ec1eb3d0c [BPI] Improve unreachable/ColdCall heurstics to handle loops."
Taewook Oh [Mon, 2 Dec 2019 18:15:22 +0000 (10:15 -0800)]
Reland "b19ec1eb3d0c [BPI] Improve unreachable/ColdCall heurstics to handle loops."

Summary: b19ec1eb3d0c has been reverted because of the test failures
with PowerPC targets. This patch addresses the issues from the previous
commit.

Test Plan: ninja check-all. Confirmed that CodeGen/PowerPC/pr36292.ll
and CodeGen/PowerPC/sms-cpy-1.ll pass

Subscribers: llvm-commits

4 years ago[VPlan] Move graph traits (NFC).
Florian Hahn [Mon, 2 Dec 2019 18:21:07 +0000 (18:21 +0000)]
[VPlan] Move graph traits (NFC).

By defining the graph traits right after the VPBlockBase definitions, we
can make use of them earlier in the file.

Reviewers: hsaito, Ayal, gilr

Reviewed By: gilr

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

4 years ago[update_cc_test_checks.py] Use CHECK_RE from common
Alex Richardson [Mon, 2 Dec 2019 18:18:47 +0000 (18:18 +0000)]
[update_cc_test_checks.py] Use CHECK_RE from common

Summary:
This change modifies the common.CHECK_RE regex to also handle '//'
comment prefixes which allows us to share it between clang and IR tests.
Using the regex from common means that *-SAME lines are also stripped
now. Before this change using the --function-signature flag would result
in -SAME: lines from previous runs not being removed.

Reviewers: MaskRay, jdoerfert

Reviewed By: jdoerfert

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

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

4 years ago[lit] Be more explicit about the state of tests
Julian Lettner [Tue, 26 Feb 2019 06:39:50 +0000 (22:39 -0800)]
[lit] Be more explicit about the state of tests

Tests go through the following stages:
  *) discovered
  *) filtered
  *) executed

Only executed tests have a result (e.g., PASS, FAIL, XFAIL, etc.).  See
"result codes" in Test.py.

Reviewed By: rnk

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

4 years ago[DAGCombine] Factor oplist operations. NFC
Amaury Séchet [Mon, 2 Dec 2019 17:35:59 +0000 (18:35 +0100)]
[DAGCombine] Factor oplist operations. NFC

4 years ago[ELF][AArch64] Support R_AARCH64_{CALL26,JUMP26} range extension thunks with addends
Fangrui Song [Sat, 23 Nov 2019 08:57:54 +0000 (00:57 -0800)]
[ELF][AArch64] Support R_AARCH64_{CALL26,JUMP26} range extension thunks with addends

Fixes AArch64 part of PR40438

The current range extension thunk framework does not handle a relocation
relative to a STT_SECTION symbol with a non-zero addend, which may be
used by jumps/calls to local functions on some RELA targets (AArch64,
powerpc ELFv1, powerpc64 ELFv2, etc).  See PR40438 and the following
code for examples:

  // clang -target $target a.cc
  // .text.cold may be placed in a separate output section.
  // The distance between bar in .text.cold and foo in .text may be larger than 128MiB.
  static void foo() {}
  __attribute__((section(".text.cold"))) static int bar() { foo(); return
  0; }
  __attribute__((used)) static int dummy = bar();

This patch makes such thunks with addends work for AArch64. The target
independent part can be reused by PPC in the future.

On REL targets (ARM, MIPS), jumps/calls are not represented as
STT_SECTION + non-zero addend (see
MCELFObjectTargetWriter::needsRelocateWithSymbol), so they don't need
this feature, but we need to make sure this patch does not affect them.

Reviewed By: peter.smith

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

4 years ago[InstCombine] fix undef propagation for vector urem transform (PR44186)
Sanjay Patel [Mon, 2 Dec 2019 17:10:05 +0000 (12:10 -0500)]
[InstCombine] fix undef propagation for vector urem transform (PR44186)

As described here:
https://bugs.llvm.org/show_bug.cgi?id=44186

The match() code safely allows undef values, but we can't safely
propagate a vector constant that contains an undef to the new
compare instruction.

4 years ago[SelectionDAG] Reduce assumptions made about levels. NFC
Amaury Séchet [Mon, 2 Dec 2019 15:30:51 +0000 (16:30 +0100)]
[SelectionDAG] Reduce assumptions made about levels. NFC

4 years agoAdd AIX assembler support
stevewan [Mon, 2 Dec 2019 16:28:31 +0000 (11:28 -0500)]
Add AIX assembler support

Summary:
A skeleton of AIX toolchain and system linker support has been introduced in D68340, and this is a follow on patch to it.
This patch adds support to system assembler invocation to the AIX toolchain.

Reviewers: daltenty, hubert.reinterpretcast, jasonliu, Xiangling_L, dlj

Reviewed By: daltenty, hubert.reinterpretcast

Subscribers: wuzish, nemanjai, kbarton, jfb, cfe-commits

Tags: #clang

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

4 years ago[ARM,MVE] Add intrinsics to deal with predicates.
Simon Tatham [Mon, 2 Dec 2019 16:17:59 +0000 (16:17 +0000)]
[ARM,MVE] Add intrinsics to deal with predicates.

Summary:
This commit adds the `vpselq` intrinsics which take an MVE predicate
word and select lanes from two vectors; the `vctp` intrinsics which
create a tail predicate word suitable for processing the first m
elements of a vector (e.g. in the last iteration of a loop); and
`vpnot`, which simply complements a predicate word and is just
syntactic sugar for the `~` operator.

The `vctp` ACLE intrinsics are lowered to the IR intrinsics we've
already added (and which D70592 just reorganized). I've filled in the
missing isel rule for VCTP64, and added another set of rules to
generate the predicated forms.

I needed one small tweak in MveEmitter to allow the `unpromoted` type
modifier to apply to predicates as well as integers, so that `vpnot`
doesn't pointlessly convert its input integer to an `<n x i1>` before
complementing it.

Reviewers: ostannard, MarkMurrayARM, dmgreen

Reviewed By: dmgreen

Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[ARM,MVE] Rename and clean up VCTP IR intrinsics.
Simon Tatham [Mon, 2 Dec 2019 16:18:24 +0000 (16:18 +0000)]
[ARM,MVE] Rename and clean up VCTP IR intrinsics.

Summary:
D65884 added a set of Arm IR intrinsics for the MVE VCTP instruction,
to use in tail predication. But the 64-bit one doesn't work properly:
its predicate type is `<2 x i1>` / `v2i1`, which isn't a legal MVE
type (due to not having a full set of instructions that manipulate it
usefully). The test of `vctp64` in `basic-tail-pred.ll` goes through
`opt` fine, as the test expects, but if you then feed it to `llc` it
causes a type legality failure at isel time.

The usual workaround we've been using in the rest of the MVE
intrinsics family is to bodge `v2i1` into `v4i1`. So I've adjusted the
`vctp64` IR intrinsic to do that, and completely removed the code (and
test) that uses that intrinsic for 64-bit tail predication. That will
allow me to add isel rules (upcoming in D70485) that actually generate
the VCTP64 instruction.

Also renamed all four of these IR intrinsics so that they have `mve`
in the name, since its absence was confusing.

Reviewers: ostannard, MarkMurrayARM, dmgreen

Reviewed By: MarkMurrayARM

Subscribers: samparker, kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ARM,MVE] Add an InstCombine rule permitting VPNOT.
Simon Tatham [Mon, 2 Dec 2019 16:18:34 +0000 (16:18 +0000)]
[ARM,MVE] Add an InstCombine rule permitting VPNOT.

Summary:
If a user writing C code using the ACLE MVE intrinsics generates a
predicate and then complements it, then the resulting IR will use the
`pred_v2i` IR intrinsic to turn some `<n x i1>` vector into a 16-bit
integer; complement that integer; and convert back. This will generate
machine code that moves the predicate out of the `P0` register,
complements it in an integer GPR, and moves it back in again.

This InstCombine rule replaces `i2v(~v2i(x))` with a direct complement
of the original predicate vector, which we can already instruction-
select as the VPNOT instruction which complements P0 in place.

Reviewers: ostannard, MarkMurrayARM, dmgreen

Reviewed By: dmgreen

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoAdd contributing info to CONTRIBUTING.md and README.md
Florian Hahn [Mon, 2 Dec 2019 15:46:47 +0000 (15:46 +0000)]
Add contributing info to CONTRIBUTING.md and README.md

As discussed on llvm-dev [1], this patch adds a brief CONTRIBUTING.md to
the top-level of the repo, with a pointer to Contributing.html. This
should make it easier to discover the contributing information and also
be highlighted in the Github UI.

It also updates README.md to link to Contributing.html.

[1] http://lists.llvm.org/pipermail/llvm-dev/2019-November/137141.html

Reviewers: tonic, rnk, jhenderson, meikeb

Reviewed By: rnk, jhenderson, meikeb

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

4 years ago[PatternMatch] Add support for matching intrinsics with 5 operands.
Florian Hahn [Mon, 2 Dec 2019 15:29:53 +0000 (15:29 +0000)]
[PatternMatch] Add support for matching intrinsics with 5 operands.

Summary: Also adds a test to the pattern matching unit tests.

Reviewers: spatel, craig.topper, RKSimon, majnemer, lebedev.ri

Reviewed By: spatel

Subscribers: merge_guards_bot, llvm-commits

Tags: #llvm

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

4 years ago[Attributor] Copy or port test cases related to Attributor to` Attributor` test folder
Hideto Ueno [Mon, 2 Dec 2019 13:40:09 +0000 (13:40 +0000)]
[Attributor] Copy or port test cases related to Attributor to` Attributor` test folder

Summary:
This patch moves the test cases related to Attributor to `Transforms/Attributor` folder.
We have used `Transforms/FunctionAttrs` as the primary folder for Attributor test but we need to change testing way now.

For the test cases which I think functionattrs doesn't infer anything something like (willreturn, nosync, value-simplify, h2s ..etc), I moved them with the command `git mv`.

For the test cases in which functoinattrs and attributor are tested, I copied the test to the folder and remove the check only used by functoinattrs.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: jfb, llvm-commits

Tags: #llvm

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

4 years agoAutogenerate test/Analysis/ValueTracking/non-negative-phi-bits.ll test
Roman Lebedev [Mon, 2 Dec 2019 15:28:17 +0000 (18:28 +0300)]
Autogenerate test/Analysis/ValueTracking/non-negative-phi-bits.ll test

Forgot to stage this change into 0f22e783a038b6983f0fe161eef6cf2add3a4156 commit.

4 years ago[clangd] Try harder to find a plausible `clang` as argv0, particularly on Mac.
Sam McCall [Fri, 29 Nov 2019 18:37:48 +0000 (19:37 +0100)]
[clangd] Try harder to find a plausible `clang` as argv0, particularly on Mac.

Summary:
Fixes https://github.com/clangd/clangd/issues/211
Fixes https://github.com/clangd/clangd/issues/178

No tests - this is hard to test, and basically impossible to verify what we want
(this produces compile commands that work on a real mac with recent toolchain)

(Need someone on mac to verify it actually fixes these!)

Reviewers: kbobyrev, ilya-biryukov

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

Tags: #clang

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

4 years ago[llvm-exegesis] Fix 44b9942898c7.
Clement Courbet [Mon, 2 Dec 2019 13:58:41 +0000 (14:58 +0100)]
[llvm-exegesis] Fix 44b9942898c7.

Summary:
Add missing stack release instructions in
loadImplicitRegAndFinalize.

Reviewers: pengfei, gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

4 years ago[InstCombine] Revert rL341831: relax one-use check in foldICmpAddConstant() (PR44100)
Roman Lebedev [Mon, 2 Dec 2019 14:34:55 +0000 (17:34 +0300)]
[InstCombine] Revert rL341831: relax one-use check in foldICmpAddConstant() (PR44100)

rL341831 moved one-use check higher up, restricting a few folds
that produced a single instruction from two instructions to the case
where the inner instruction would go away.

Original commit message:
> InstCombine: move hasOneUse check to the top of foldICmpAddConstant
>
> There were two combines not covered by the check before now,
> neither of which actually differed from normal in the benefit analysis.
>
> The most recent seems to be because it was just added at the top of the
> function (naturally). The older is from way back in 2008 (r46687)
> when we just didn't put those checks in so routinely, and has been
> diligently maintained since.

From the commit message alone, there doesn't seem to be a
deeper motivation, deeper problem that was trying to solve,
other than 'fixing the wrong one-use check'.

As i have briefly discusses in IRC with Tim, the original motivation
can no longer be recovered, too much time has passed.

However i believe that the original fold was doing the right thing,
we should be performing such a transformation even if the inner `add`
will not go away - that will still unchain the comparison from `add`,
it will no longer need to wait for `add` to compute.

Doing so doesn't seem to break any particular idioms,
as least as far as i can see.

References https://bugs.llvm.org/show_bug.cgi?id=44100

4 years ago[PowerPC] Fix crash in peephole optimization
Nemanja Ivanovic [Mon, 2 Dec 2019 14:32:59 +0000 (08:32 -0600)]
[PowerPC] Fix crash in peephole optimization

When converting reg+reg shifts to reg+imm rotates, we neglect to consider the
CodeGenOnly versions of the 32-bit shift mnemonics. This means we produce a
rotate with missing operands which causes a crash.

Committing this fix without review since it is non-controversial that the list
of mnemonics to consider should include the 64-bit aliases for the exact
mnemonics.

Fixes PR44183.

4 years ago[ARM][AArch64] Complex addition Neon intrinsics for Armv8.3-A
Victor Campos [Mon, 2 Dec 2019 12:13:04 +0000 (12:13 +0000)]
[ARM][AArch64] Complex addition Neon intrinsics for Armv8.3-A

Summary:
Add support for vcadd_* family of intrinsics. This set of intrinsics is
available in Armv8.3-A.

The fp16 versions require the FP16 extension, which has been available
(opt-in) since Armv8.2-A.

Reviewers: t.p.northover

Reviewed By: t.p.northover

Subscribers: t.p.northover, kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[InstCombine] fold copysign with constant sign argument to (fneg+)fabs
Sanjay Patel [Mon, 2 Dec 2019 14:21:59 +0000 (09:21 -0500)]
[InstCombine] fold copysign with constant sign argument to (fneg+)fabs

If the sign of the sign argument is known (this could be extended to use ValueTracking),
then we can use fneg+fabs to clear/set the sign bit of the magnitude argument.
http://llvm.org/docs/LangRef.html#llvm-copysign-intrinsic

This transform is already done in DAGCombiner, but we can do it sooner in IR as
suggested in PR44153:
https://bugs.llvm.org/show_bug.cgi?id=44153

We have effectively no analysis for copysign in IR, so we are taking the unusual step
of increasing the number of IR instructions for the negative constant case.

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

4 years ago[OpenCL] Fix address space for implicit conversion (PR43145)
Sven van Haastregt [Mon, 2 Dec 2019 14:20:15 +0000 (14:20 +0000)]
[OpenCL] Fix address space for implicit conversion (PR43145)

Clang was creating a DerivedToBase ImplicitCastExpr that was also
casting between address spaces as part of the second step in the
standard conversion sequence.  Defer the address space conversion to
the third step in the sequence instead, such that we get a separate
ImplicitCastExpr for the address space conversion.

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

4 years ago[lldb][NFC] Don't calculate member indices in DWARFASTParserClang::ParseChildMembers
Raphael Isemann [Mon, 2 Dec 2019 13:34:51 +0000 (14:34 +0100)]
[lldb][NFC] Don't calculate member indices in DWARFASTParserClang::ParseChildMembers

We keep counting members and then don't do anything with the computed result.

4 years ago[lldb][NFC] Use raw_ostream instead of Stream in Baton::GetDescription
Raphael Isemann [Sat, 30 Nov 2019 14:30:08 +0000 (15:30 +0100)]
[lldb][NFC] Use raw_ostream instead of Stream in Baton::GetDescription

Removing raw_ostream here is getting us closer to removing LLDB's Stream
class.

4 years ago[X86] Add initialization of FPCW in llvm-exegesis
Wang, Pengfei [Mon, 2 Dec 2019 11:39:16 +0000 (19:39 +0800)]
[X86] Add initialization of FPCW in llvm-exegesis

Summary: This is a following up to D70874. It adds the initialization of FPCW in llvm-exegesis.

Reviewers: craig.topper, RKSimon, courbet, gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

4 years ago[llvm-readobj/llvm-readelf] - Simplify the code that dumps versions.
Georgii Rymar [Thu, 28 Nov 2019 11:12:09 +0000 (14:12 +0300)]
[llvm-readobj/llvm-readelf] - Simplify the code that dumps versions.

After changes introduced in D70495 and D70826 its now possible
to significantly simplify the code we have.

This also fixes an issue: previous code assumed that version strings
should always be read from the dynamic string table. While it is
normally true, the string table should be taken from the corresponding
sh_link field.

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

4 years agoAMDGPU: Fixed indeterminate map iteration in SIPeepholeSDWA
Tim Renouf [Wed, 27 Nov 2019 15:16:59 +0000 (15:16 +0000)]
AMDGPU: Fixed indeterminate map iteration in SIPeepholeSDWA

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

Change-Id: Ic26f915a4acb4c00ecefa9d09d7c24cec370ed06

4 years ago[lldb][NFC] Make Stream's IndentLevel an unsigned integers.
Raphael Isemann [Mon, 2 Dec 2019 11:44:55 +0000 (12:44 +0100)]
[lldb][NFC] Make Stream's IndentLevel an unsigned integers.

We expect it to be always positive values and LLVM/Clang's IndentLevel
values are already unsigned integers, so we should do the same.

4 years ago[ARM][MVE][Intrinsics] Add VMINQ/VMAXQ/VMINNMQ/VMAXNMQ intrinsics.
Mark Murray [Thu, 28 Nov 2019 16:38:01 +0000 (16:38 +0000)]
[ARM][MVE][Intrinsics] Add VMINQ/VMAXQ/VMINNMQ/VMAXNMQ intrinsics.

Summary: Add VMINQ/VMAXQ/VMINNMQ/VMAXNMQ intrinsics and their predicated versions. Add unit tests.

Subscribers: kristof.beyls, hiraditya, dmgreen, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years ago[update_cc_test_checks.py] Handle extern "C" and namespaces
Alex Richardson [Mon, 2 Dec 2019 10:53:57 +0000 (10:53 +0000)]
[update_cc_test_checks.py] Handle extern "C" and namespaces

Summary:
My change to use the clang AST JSON dump did not handle functions declared
inside scopes other than the root TranslationUnitDecl. After this change
update_cc_test_checks.py also works for C++ test cases that use extern "C"
and namespaces.

Reviewers: MaskRay

Reviewed By: MaskRay

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[UpdateTestChecks] Share the code to parse RUN: lines between all scripts
Alex Richardson [Mon, 2 Dec 2019 10:50:23 +0000 (10:50 +0000)]
[UpdateTestChecks] Share the code to parse RUN: lines between all scripts

Summary:
This commit also introduces a common.debug() function to avoid many
`if args.verbose:` statements. Depends on D70428.

Reviewers: xbolva00, MaskRay, jdoerfert

Reviewed By: MaskRay

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[lldb][NFC] Add 'breakpoint command list' test
Raphael Isemann [Mon, 2 Dec 2019 10:08:10 +0000 (11:08 +0100)]
[lldb][NFC] Add 'breakpoint command list' test

The command has zero test coverage and I'll have to touch the
code formatting the output commands, so let's start by adding a
test for it.

4 years ago[ARM] Remove VHADD patterns
David Green [Mon, 2 Dec 2019 10:29:01 +0000 (10:29 +0000)]
[ARM] Remove VHADD patterns

These instructions do not work quite like I expected them to. They
perform the addition and then shift in a higher precision integer, so do
not match up with the patterns that we added.

For example with s8s, adding 100 and 100 should wrap leaving the shift
to work on a negative number. VHADD will instead do the arithmetic in
higher precision, giving 100 overall. The vhadd gives a "better" result,
but not one that matches up with the input.

I am just removing the patterns here. We might be able to re-add them in
the future by checking for wrap flags or changing bitwidths. But for the
moment just remove them to remove the problem cases.