platform/upstream/llvm.git
6 years ago[GISel]: Add Legalization/lowering code for bit counting operations
Aditya Nandakumar [Sat, 18 Aug 2018 00:01:54 +0000 (00:01 +0000)]
[GISel]: Add Legalization/lowering code for bit counting operations

https://reviews.llvm.org/D48847#inline-448257

Ported legalization expansions for CTLZ/CTTZ from DAG to GISel.

Reviewed by rtereshin.

llvm-svn: 340111

6 years agoQuickfix for failing tests.
George Karpenkov [Fri, 17 Aug 2018 23:54:00 +0000 (23:54 +0000)]
Quickfix for failing tests.

llvm-svn: 340110

6 years ago[index] For an ObjC message call, also record as receivers the protocols if they...
Argyrios Kyrtzidis [Fri, 17 Aug 2018 23:50:59 +0000 (23:50 +0000)]
[index] For an ObjC message call, also record as receivers the protocols if they are present in the ObjC type

llvm-svn: 340109

6 years ago[AST] Clarify printing of unknown size locations [NFC]
Philip Reames [Fri, 17 Aug 2018 23:17:31 +0000 (23:17 +0000)]
[AST] Clarify printing of unknown size locations [NFC]

Printing "unknown" is much more clear than an arbitrary large integer

llvm-svn: 340108

6 years ago[llvm-objcopy] Implement -G/--keep-global-symbol(s).
Jordan Rupprecht [Fri, 17 Aug 2018 22:34:48 +0000 (22:34 +0000)]
[llvm-objcopy] Implement -G/--keep-global-symbol(s).

Summary:
Port GNU Objcopy -G/--keep-global-symbol(s).

This is slightly different than the already-implemented --globalize-symbol, which marks a symbol as global when copying. When --keep-global-symbol (alias -G) is used, *only* those symbols marked will stay global, and all other globals are demoted to local. (Also note that it doesn't *promote* a symbol to global). Additionally, there is a pluralized version of the flag --keep-global-symbols, which effectively applies --keep-global-symbol for every non-comment in a file.

Reviewers: jakehehrlich, jhenderson, alexshap

Reviewed By: jhenderson

Subscribers: llvm-commits

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

llvm-svn: 340105

6 years ago[DebugCounters] don't do redundant map lookups; NFC
George Burgess IV [Fri, 17 Aug 2018 22:34:04 +0000 (22:34 +0000)]
[DebugCounters] don't do redundant map lookups; NFC

llvm-svn: 340104

6 years ago[ObjC] Error out when using forward-declared protocol in a @protocol
Alex Lorenz [Fri, 17 Aug 2018 22:18:08 +0000 (22:18 +0000)]
[ObjC] Error out when using forward-declared protocol in a @protocol
expression

Clang emits invalid protocol metadata when a @protocol expression is used with a
forward-declared protocol. The protocol metadata is missing protocol conformance
list of the protocol since we don't have access to the definition of it in the
compiled translation unit. The linker then might end up picking the invalid
metadata when linking which will lead to incorrect runtime protocol conformance
checks.

This commit makes sure that Clang fails to compile code that uses a @protocol
expression with a forward-declared protocol. This ensures that Clang does not
emit invalid protocol metadata. I added an extra assert in CodeGen to ensure
that this kind of issue won't happen in other places.

rdar://32787811

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

llvm-svn: 340102

6 years agoDon't warn on returning the address of a label from a statement expression
Reid Kleckner [Fri, 17 Aug 2018 22:11:31 +0000 (22:11 +0000)]
Don't warn on returning the address of a label from a statement expression

Summary:
There isn't anything inherently wrong with returning a label from a
statement expression. In practice, the Linux kernel uses this pattern to
materialize PCs.

Fixes PR38569

Reviewers: niravd, rsmith, nickdesaulniers

Subscribers: cfe-commits

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

llvm-svn: 340101

6 years ago[AST][Tests] Clarify what each test is doing
Philip Reames [Fri, 17 Aug 2018 21:58:26 +0000 (21:58 +0000)]
[AST][Tests] Clarify what each test is doing

llvm-svn: 340100

6 years ago[AST[Tests] Shorten tests using noalias params
Philip Reames [Fri, 17 Aug 2018 21:45:57 +0000 (21:45 +0000)]
[AST[Tests] Shorten tests using noalias params

llvm-svn: 340099

6 years ago[analyzer] [NFC] Minor refactoring of ISL-specific code in RetainCountChecker
George Karpenkov [Fri, 17 Aug 2018 21:43:27 +0000 (21:43 +0000)]
[analyzer] [NFC] Minor refactoring of ISL-specific code in RetainCountChecker

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

llvm-svn: 340098

6 years ago[analyzer] Re-instate support for MakeCollectable is RetainCountChecker
George Karpenkov [Fri, 17 Aug 2018 21:42:59 +0000 (21:42 +0000)]
[analyzer] Re-instate support for MakeCollectable is RetainCountChecker

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

llvm-svn: 340097

6 years ago[analyzer] [NFC] Move ObjCRetainCount to include/Analysis
George Karpenkov [Fri, 17 Aug 2018 21:42:32 +0000 (21:42 +0000)]
[analyzer] [NFC] Move ObjCRetainCount to include/Analysis

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

llvm-svn: 340096

6 years ago[AST] Add tests for argmemonly calls [NFC]
Philip Reames [Fri, 17 Aug 2018 21:42:18 +0000 (21:42 +0000)]
[AST] Add tests for argmemonly calls [NFC]

First step towards building a test set to rebase D50730 on top of.  Starting with clone of memtransfer tests, more to come.

llvm-svn: 340095

6 years ago[analyzer] [NFC] Move canEval function from RetainCountChecker to RetainCountSummaries
George Karpenkov [Fri, 17 Aug 2018 21:42:05 +0000 (21:42 +0000)]
[analyzer] [NFC] Move canEval function from RetainCountChecker to RetainCountSummaries

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

llvm-svn: 340094

6 years ago[analyzer] [NFC] Split up summary generation in RetainCountChecker in two methods
George Karpenkov [Fri, 17 Aug 2018 21:41:37 +0000 (21:41 +0000)]
[analyzer] [NFC] Split up summary generation in RetainCountChecker in two methods

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

llvm-svn: 340093

6 years ago[analyzer] [NFC] Split up RetainCountChecker
George Karpenkov [Fri, 17 Aug 2018 21:41:07 +0000 (21:41 +0000)]
[analyzer] [NFC] Split up RetainCountChecker

At some point, staring at 4k+ LOC file becomes a bit hard.

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

llvm-svn: 340092

6 years ago[analyzer] Drop support for GC mode in RetainCountChecker
George Karpenkov [Fri, 17 Aug 2018 21:40:38 +0000 (21:40 +0000)]
[analyzer] Drop support for GC mode in RetainCountChecker

A lot of code in RetainCountChecker deals with GC mode.
Given that GC mode is deprecated, Apple does not ship runtime for it,
and modern compiler toolchain does not support it, it makes sense to
remove the code dealing with it in order to aid understanding of
RetainCountChecker.

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

llvm-svn: 340091

6 years agoValueTracking: Add tests for isKnownNeverNaN
Matt Arsenault [Fri, 17 Aug 2018 21:39:52 +0000 (21:39 +0000)]
ValueTracking: Add tests for isKnownNeverNaN

llvm-svn: 340090

6 years ago[MC] Improve error message when a codeview register is unknown
Reid Kleckner [Fri, 17 Aug 2018 21:35:14 +0000 (21:35 +0000)]
[MC] Improve error message when a codeview register is unknown

This is in MCRegisterInfo, we can print the actual register name easily.

llvm-svn: 340089

6 years ago[MS Demangler] Properly print all thunk types.
Zachary Turner [Fri, 17 Aug 2018 21:32:07 +0000 (21:32 +0000)]
[MS Demangler] Properly print all thunk types.

We were only printing the vtordisp thunk before as the previous
patch was more aimed at getting special operators working, one
of which was a thunk.  This patch gets all thunk types to print
properly, and adds a test for each one.

llvm-svn: 340088

6 years ago[X86] Remove detectAddSubSatPattern.
Craig Topper [Fri, 17 Aug 2018 21:19:28 +0000 (21:19 +0000)]
[X86] Remove detectAddSubSatPattern.

This was added very recently in r339650, but appears to be completely untested and has at least one bug in it.

llvm-svn: 340086

6 years agoDAG: Fix isKnownNeverNaN for basic non-sNaN cases
Matt Arsenault [Fri, 17 Aug 2018 21:19:22 +0000 (21:19 +0000)]
DAG: Fix isKnownNeverNaN for basic non-sNaN cases

fadd/fsub/fmul need to worry about infinities as well
as fdiv.

llvm-svn: 340085

6 years ago[ORC] Rename VSO to JITDylib.
Lang Hames [Fri, 17 Aug 2018 21:18:18 +0000 (21:18 +0000)]
[ORC] Rename VSO to JITDylib.

VSO was a little close to VDSO (an acronym on Linux for Virtual Dynamic Shared
Object) for comfort. It also risks giving the impression that instances of this
class could be shared between ExecutionSessions, which they can not.

JITDylib seems moderately less confusing, while still hinting at how this
class is intended to be used, i.e. as a JIT-compiled stand-in for a dynamic
library (code that would have been a dynamic library if you had wanted to
compile it ahead of time).

llvm-svn: 340084

6 years ago[MS Demangler] Demangle all remaining types of operators.
Zachary Turner [Fri, 17 Aug 2018 21:18:05 +0000 (21:18 +0000)]
[MS Demangler] Demangle all remaining types of operators.

This demangles all remaining special operators including thunks,
RTTI Descriptors, and local static guard variables.

llvm-svn: 340083

6 years agotest commit: add a comment
Mike Rice [Fri, 17 Aug 2018 21:16:21 +0000 (21:16 +0000)]
test commit: add a comment

llvm-svn: 340082

6 years ago[Hexagon] Remove unused functions from HexagonInstPrinter, NFC
Krzysztof Parzyszek [Fri, 17 Aug 2018 21:12:37 +0000 (21:12 +0000)]
[Hexagon] Remove unused functions from HexagonInstPrinter, NFC

llvm-svn: 340081

6 years agoUpdate comments in CGDebugInfo to reflect changes in the MS mangler, NFC
Reid Kleckner [Fri, 17 Aug 2018 20:59:52 +0000 (20:59 +0000)]
Update comments in CGDebugInfo to reflect changes in the MS mangler, NFC

I've tried to elaborate on the purpose of these type identifiers and why
and when clang uses them.

llvm-svn: 340080

6 years ago[MS] Mangle a hash of the main file path into anonymous namespaces
Reid Kleckner [Fri, 17 Aug 2018 20:59:27 +0000 (20:59 +0000)]
[MS] Mangle a hash of the main file path into anonymous namespaces

Summary:
This is needed to avoid conflicts in mangled names for codeview types in
anonymous namespaces. In CodeView, types refer to each other typically
through forward declarations, which contain mangled names. These names
have to be unique, otherwise the debugger will look up the mangled name
and find the wrong definition.

Furthermore, ThinLTO will deduplicate the types, and debug info
verification can fail when the types have the wrong sizes. This is
PR38608.

Fixes PR38609.

Reviewers: majnemer, inglorion, hans

Subscribers: mehdi_amini, aprantl, JDevlieghere, dexonsmith, cfe-commits

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

llvm-svn: 340079

6 years agoSkip the lldb-vscode attach with waitFor test for now, some build bots are having...
Greg Clayton [Fri, 17 Aug 2018 20:42:06 +0000 (20:42 +0000)]
Skip the lldb-vscode attach with waitFor test for now, some build bots are having trouble.

llvm-svn: 340077

6 years ago[clang-tidy] Add missing check documentation.
Haojian Wu [Fri, 17 Aug 2018 19:50:22 +0000 (19:50 +0000)]
[clang-tidy] Add missing check documentation.

llvm-svn: 340075

6 years agoImprove diagnostic for missing comma in template parameter list.
Richard Smith [Fri, 17 Aug 2018 19:43:40 +0000 (19:43 +0000)]
Improve diagnostic for missing comma in template parameter list.

Given 'typename T typename U', we would correctly diagnose the missing
comma, but incorrectly disambiguate the first parameter as being a
non-type parameter and complain that the 'T' is not a qualified-id.

See also gcc.gnu.org/PR86998.

llvm-svn: 340074

6 years ago[WebAssembly] Don't compress LEBs by default
Sam Clegg [Fri, 17 Aug 2018 19:42:46 +0000 (19:42 +0000)]
[WebAssembly] Don't compress LEBs by default

LEB compression breaks debug info so we don't want to enable
it by default, even at high optimization levels.

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

llvm-svn: 340073

6 years ago[AST] Adapt Polly to AnalysisSetTracker changes. NFC.
Michael Kruse [Fri, 17 Aug 2018 19:31:41 +0000 (19:31 +0000)]
[AST] Adapt Polly to AnalysisSetTracker changes. NFC.

The method AliasSetTracker::getAliasSetForPointer was removed and replaced by AliasSetTracker::getAliasSetFor for the restructuring in r339930.

Since Polly uses AliasSetTracker::getAliasSetForPointer, a temporary fix has been committed in r339937 with a comment:

     Can someone from polly please migrate usage and then delete the wrapper?

This commit is doing exactly that.

llvm-svn: 340072

6 years agoFix windows buildbots by removing : from filenames
Jordan Rupprecht [Fri, 17 Aug 2018 19:18:20 +0000 (19:18 +0000)]
Fix windows buildbots by removing : from filenames

llvm-svn: 340071

6 years ago[llvm-objcopy] Add support for -I binary -B <arch>.
Jordan Rupprecht [Fri, 17 Aug 2018 18:51:11 +0000 (18:51 +0000)]
[llvm-objcopy] Add support for -I binary -B <arch>.

Summary:
The -I (--input-target) and -B (--binary-architecture) flags exist but are currently silently ignored. This adds support for -I binary for architectures i386, x86-64 (and alias i386:x86-64), arm, aarch64, sparc, and ppc (powerpc:common64). This is largely based on D41687.

This is done by implementing an additional subclass of Reader, BinaryReader, which works by interpreting the input file as contents for .data field, sets up a synthetic header, and adds additional sections/symbols (e.g. _binary__tmp_data_txt_start).

Reviewers: jakehehrlich, alexshap, jhenderson, javed.absar

Reviewed By: jhenderson

Subscribers: jyknight, nemanjai, kbarton, fedor.sergeev, jrtc27, kristof.beyls, paulsemel, llvm-commits

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

llvm-svn: 340070

6 years agoTest commit
Jun Lim [Fri, 17 Aug 2018 18:40:41 +0000 (18:40 +0000)]
Test commit

I just removed a blank space.

llvm-svn: 340069

6 years agoRemove a hardcoded address in test/DebugInfo/X86/vla-multi.ll
Vedant Kumar [Fri, 17 Aug 2018 18:39:19 +0000 (18:39 +0000)]
Remove a hardcoded address in test/DebugInfo/X86/vla-multi.ll

This relaxes a test to make it less brittle.

llvm-svn: 340068

6 years ago[IDF] Make GD const.
Alina Sbirlea [Fri, 17 Aug 2018 18:37:15 +0000 (18:37 +0000)]
[IDF] Make GD const.

llvm-svn: 340067

6 years ago[llvm-mca] Reformat a few lines (fix spacing). NFC.
Matt Davis [Fri, 17 Aug 2018 18:06:01 +0000 (18:06 +0000)]
[llvm-mca] Reformat a few lines (fix spacing).  NFC.

llvm-svn: 340065

6 years ago[Support] NFC: Fix docstring in FileSystem.h.
Reka Kovacs [Fri, 17 Aug 2018 18:05:38 +0000 (18:05 +0000)]
[Support] NFC: Fix docstring in FileSystem.h.

llvm-svn: 340063

6 years ago[X86][SSE] Lower constant vXi8 ISD::SRL/ISD::SRA using PMULLW
Simon Pilgrim [Fri, 17 Aug 2018 18:03:11 +0000 (18:03 +0000)]
[X86][SSE] Lower constant vXi8 ISD::SRL/ISD::SRA using PMULLW

Extending the concept introduced in D49562, this patch lowers constant vXi8 ISD::SRL/ISD::SRA by zero/sign extending to vXi16 and using PMULLW and then truncating the high 8 bits of the result.

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

llvm-svn: 340062

6 years ago[InstCombine] Refactor the simplification of pow() (NFC)
Evandro Menezes [Fri, 17 Aug 2018 17:59:53 +0000 (17:59 +0000)]
[InstCombine] Refactor the simplification of pow() (NFC)

Refactor all cases dealing with `exp{,2,10}()` into one function in
preparation for D49273.  Otherwise, NFC.

llvm-svn: 340061

6 years ago[NFC] Expand test cases for simplifying pow()
Evandro Menezes [Fri, 17 Aug 2018 17:59:38 +0000 (17:59 +0000)]
[NFC] Expand test cases for simplifying pow()

In prepatration for the improvements that D49273 enables.

llvm-svn: 340060

6 years ago[X86] Use hasOneUse instead of isOnlyUserOf. NFCI
Craig Topper [Fri, 17 Aug 2018 17:57:25 +0000 (17:57 +0000)]
[X86] Use hasOneUse instead of isOnlyUserOf. NFCI

isOnlyUserOf is a little heavier because it allows the node to be used multiple times by the other node. In this case we are looking at a truncate which only has one operand so we know it can only use it once. Thus hasOneUse is better.

llvm-svn: 340059

6 years ago[sanitizer] When setting up shadow memory on iOS, fix handling the return value of...
Kuba Mracek [Fri, 17 Aug 2018 17:53:14 +0000 (17:53 +0000)]
[sanitizer] When setting up shadow memory on iOS, fix handling the return value of task_info on older OS versions

task_vm_info is a "revisioned" structure, new OS versions add fields to the end, and compatibility is based on the reported size. On older OS versions, min_address/max_address is not filled back. Let's handle that case. Unfortunately, we can't really write a test (as the failure only happens when on a specific OS version).

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

llvm-svn: 340058

6 years ago[HIP] Make __hip_gpubin_handle hidden to avoid being merged across different shared...
Yaxun Liu [Fri, 17 Aug 2018 17:47:31 +0000 (17:47 +0000)]
[HIP] Make __hip_gpubin_handle hidden to avoid being merged across different shared libraries

Different shared libraries contain different fat binary, which is stored in a global variable
__hip_gpubin_handle. Since different compilation units share the same fat binary, this
variable has linkonce linkage. However, it should not be merged across different shared
libraries.

This patch set the visibility of the global variable to be hidden, which will make it invisible
in the shared library, therefore preventing it from being merged.

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

llvm-svn: 340056

6 years ago[TableGen] Don't separately search for DefaultMode when we're going to iterate the...
Simon Pilgrim [Fri, 17 Aug 2018 17:45:15 +0000 (17:45 +0000)]
[TableGen] Don't separately search for DefaultMode when we're going to iterate the set anyway. NFCI.

llvm-svn: 340055

6 years agoShow how to use "lldb -P" to find the lldb.py.
Jim Ingham [Fri, 17 Aug 2018 17:39:32 +0000 (17:39 +0000)]
Show how to use "lldb -P" to find the lldb.py.
We had hard-coded the path in the docs but that got
out of date - showing again that -P is the better
way to do this.

<rdar://problem/43394652>

llvm-svn: 340053

6 years ago[IDF] Teach Iterated Dominance Frontier to use a snapshot CFG based on a GraphDiff.
Alina Sbirlea [Fri, 17 Aug 2018 17:39:15 +0000 (17:39 +0000)]
[IDF] Teach Iterated Dominance Frontier to use a snapshot CFG based on a GraphDiff.

Summary:
Create the ability to compute IDF using a CFG View.
For this, we'll need a new DT created using a list of Updates (to be refactored later to a GraphDiff), and the GraphTraits based on the same GraphDiff.

Reviewers: kuhar, george.burgess.iv, mzolotukhin

Subscribers: sanjoy, jlebar, llvm-commits

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

llvm-svn: 340052

6 years agoChange the attach test case to use self.assertEqual so we can get more info on what...
Greg Clayton [Fri, 17 Aug 2018 17:27:53 +0000 (17:27 +0000)]
Change the attach test case to use self.assertEqual so we can get more info on what is going wrong on test bots.

Also add a cleanup function to remove the copied binary.

llvm-svn: 340050

6 years agoRefactor the newly created <bit> header. Still (almost) NFC. Reviewed as https:/...
Marshall Clow [Fri, 17 Aug 2018 17:27:25 +0000 (17:27 +0000)]
Refactor the newly created <bit> header. Still (almost) NFC. Reviewed as https://reviews.llvm.org/D50876

llvm-svn: 340049

6 years agoMake __shiftleft128 / __shiftright128 real compiler built-ins.
Nico Weber [Fri, 17 Aug 2018 17:19:06 +0000 (17:19 +0000)]
Make __shiftleft128 / __shiftright128 real compiler built-ins.

r337619 added __shiftleft128 / __shiftright128 as functions in intrin.h.
Microsoft's STL plans on using these functions, and they're using intrin0.h
which just has declarations of built-ins to not pull in the huge intrin.h
header in the standard library headers. That requires that these functions are
real built-ins.

https://reviews.llvm.org/D50907

llvm-svn: 340048

6 years ago[ThinLTO] Add option for printing import failure reasons
Teresa Johnson [Fri, 17 Aug 2018 16:53:47 +0000 (16:53 +0000)]
[ThinLTO] Add option for printing import failure reasons

Summary:
Adds the option for the printing of summary information about functions
considered but rejected for importing during the thin link.

Reviewers: davidxl

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits

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

llvm-svn: 340047

6 years ago[MS Demangler] Rework the way operators are demangled.
Zachary Turner [Fri, 17 Aug 2018 16:14:05 +0000 (16:14 +0000)]
[MS Demangler] Rework the way operators are demangled.

Previously, some of the code for actually parsing mangled
operator names was more like formatting code in nature,
and was interspersed with the demangling code which builds
the AST.  This means that by the time we got to the printing
code, we had lost all information about what type of operator
we had, and all we were left with was a string that we just
had to print.  However, not all operators are actually even
operators.  it's basically just a catch-all mangling for
"special names", and for some of the other types it helps
to know when we're actually doing the printing what it is.

This patch changes the way things work by introducing an
OperatorInfo structure and corresponding enumeration.  When
we demangle we store the enumeration value and demangled
components separately.  This gives more flexibility during
printing.

In doing so, some demanglings of special names which we didn't
previously support come out of this for free, so we now demangle
those.

A few are more complex and are better left for a followup patch
though.

An exhaustive test of every possible operator code is included,
with the ones that don't yet work commented out.

llvm-svn: 340046

6 years agoRecommit r339943 - Establish the <bit> header. NFC yet. Reviewed as https://reviews...
Marshall Clow [Fri, 17 Aug 2018 16:07:48 +0000 (16:07 +0000)]
Recommit r339943 - Establish the <bit> header. NFC yet. Reviewed as https://reviews.llvm.org/D50815 - with a fix for the sanitizer bots

llvm-svn: 340045

6 years ago[TableGen] TypeInfer - Cache the legal types as TypeSetByHwMode
Simon Pilgrim [Fri, 17 Aug 2018 15:54:07 +0000 (15:54 +0000)]
[TableGen] TypeInfer - Cache the legal types as TypeSetByHwMode

We were just caching the MVT set of legal types, then every call creating a new TypeSetByHwMode with it and passing it back on the stack. There's no need to do this - we can create and cache the whole TypeSetByHwMode once and return a const reference to it each time.

Additionally, TypeInfer::expandOverloads wasn't making use of the fact that the cache just contains a default mode containing all the types.

Saves up to 30secs in debug builds of x86 -gen-dag-isel.

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

llvm-svn: 340042

6 years ago[CodeGen] Merge identical block descriptor global variables.
Akira Hatanaka [Fri, 17 Aug 2018 15:46:07 +0000 (15:46 +0000)]
[CodeGen] Merge identical block descriptor global variables.

Currently, clang generates a new block descriptor global variable for
each new block literal. This commit merges block descriptors that are
identical inside and across translation units using the same approach
taken in r339438.

To enable merging identical block descriptors, the size and signature of
the block and information about the captures are encoded into the name
of the block descriptor variable. Also, the block descriptor variable is
marked as linkonce_odr and unnamed_addr.

rdar://problem/42640703

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

llvm-svn: 340041

6 years ago[clangd] Add parantheses while auto-completing functions.
Kadir Cetinkaya [Fri, 17 Aug 2018 15:42:54 +0000 (15:42 +0000)]
[clangd] Add parantheses while auto-completing functions.

Summary:
Currently we only add parantheses to the functions if snippets are
enabled, which also inserts snippets for parameters into parantheses. Adding a
new option to put only parantheses. Also it moves the cursor within parantheses
or at the end of them by looking at whether completion item has any parameters
or not. Still requires snippets support on the client side.

Reviewers: ioeric, ilya-biryukov, hokein

Reviewed By: ioeric

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 340040

6 years ago[DebugInfo] Generate DWARF debug information for labels. (Fix leak problems)
Hsiangkai Wang [Fri, 17 Aug 2018 15:22:04 +0000 (15:22 +0000)]
[DebugInfo] Generate DWARF debug information for labels. (Fix leak problems)

There are two forms for label debug information in DWARF format.

1. Labels in a non-inlined function:

DW_TAG_label
  DW_AT_name
  DW_AT_decl_file
  DW_AT_decl_line
  DW_AT_low_pc

2. Labels in an inlined function:

DW_TAG_label
  DW_AT_abstract_origin
  DW_AT_low_pc

We will collect label information from DBG_LABEL. Before every DBG_LABEL,
we will generate a temporary symbol to denote the location of the label.
The symbol could be used to get DW_AT_low_pc afterwards. So, we create a
mapping between 'inlined label' and DBG_LABEL MachineInstr in DebugHandlerBase.
The DBG_LABEL in the mapping is used to query the symbol before it.

The AbstractLabels in DwarfCompileUnit is used to process labels in inlined
functions.

We also keep a mapping between scope and labels in DwarfFile to help to
generate correct tree structure of DIEs.

It also generates label debug information under global isel.

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

llvm-svn: 340039

6 years ago[clang-tidy] Abseil: integral division of Duration check
Haojian Wu [Fri, 17 Aug 2018 15:19:19 +0000 (15:19 +0000)]
[clang-tidy] Abseil: integral division of Duration check

This check is an abseil specific test that tests to ensure users utilize abseil specific floating point division when trying to divide with abseil duration types.

Patch by Deanna Garcia!

llvm-svn: 340038

6 years ago[PowerPC] Generate lxsd instead of the ld->mtvsrd sequence for vector loads
Stefan Pintilie [Fri, 17 Aug 2018 15:15:26 +0000 (15:15 +0000)]
[PowerPC] Generate lxsd instead of the ld->mtvsrd sequence for vector loads

This patch addresses:

- Implementation within PPCISelLowering.cpp to check if we should use direct
load into vector instructions (such as lxsd/lfd ) when the scalar_to_vector
function is used; which will allow us to catch as many cases of the
scalar_to_vector uses as possible to translate the ld->mtvsrd sequence into
lxsd.

- Test cases to exhibit the behaviour of emitting lxsd/lfd.

Patch by amyk

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

llvm-svn: 340037

6 years ago[llvm-mca] Removed references to HWStallEvent in Scheduler.h. NFCI
Andrea Di Biagio [Fri, 17 Aug 2018 15:01:37 +0000 (15:01 +0000)]
[llvm-mca] Removed references to HWStallEvent in Scheduler.h. NFCI

class Scheduler should not know anything of hardware event listeners and
hardware stall events (HWStallEvent).  HWStallEvent objects should only be
constructed by pipeline stages to notify listeners of hardware events.

No functional change intended.

llvm-svn: 340036

6 years ago[clangd] Add a testcase for empty preamble.
Haojian Wu [Fri, 17 Aug 2018 14:55:57 +0000 (14:55 +0000)]
[clangd] Add a testcase for empty preamble.

Summary: This is a patch of add a testcase for https://reviews.llvm.org/D50628.

Reviewers: ilya-biryukov

Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 340035

6 years ago[x86] Fix test breaking on Darwin after r339962
Francis Visoiu Mistrih [Fri, 17 Aug 2018 14:47:01 +0000 (14:47 +0000)]
[x86] Fix test breaking on Darwin after r339962

* -march=x86-64 -> -mtriple=x86_64-unknown-linux to avoid _ prefixes to
symbols
* add -start-before to avoid running the whole codegen on the IR. I
assumed it is meant to be running after X86SpeculativeLoadHardening.

llvm-svn: 340034

6 years ago[X86] Fix liveness information when expanding X86::EH_SjLj_LongJmp64
Francis Visoiu Mistrih [Fri, 17 Aug 2018 14:46:56 +0000 (14:46 +0000)]
[X86] Fix liveness information when expanding X86::EH_SjLj_LongJmp64

test/CodeGen/X86/shadow-stack.ll has the following machine verifier
errors:

```
*** Bad machine code: Using a killed virtual register ***
- function:    bar
- basic block: %bb.6 entry (0x7fdc81857818)
- instruction: %3:gr64 = MOV64rm killed %2:gr64, 1, $noreg, 8, $noreg
- operand 1:   killed %2:gr64

*** Bad machine code: Using a killed virtual register ***
- function:    bar
- basic block: %bb.6 entry (0x7fdc81857818)
- instruction: $rsp = MOV64rm killed %2:gr64, 1, $noreg, 16, $noreg
- operand 1:   killed %2:gr64

*** Bad machine code: Virtual register killed in block, but needed live out. ***
- function:    bar
- basic block: %bb.2 entry (0x7fdc818574f8)
Virtual register %2 is used after the block.
```

The fix here is to only copy the machine operand's register without the
kill flags for all the instructions except the very last one of the
sequence.

I had to insert dummy PHIs in the test case to force the NoPHI function
property to be set to false. More on this here: https://llvm.org/PR38439

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

llvm-svn: 340033

6 years ago[NewGVN] Add tests for r340031.
Florian Hahn [Fri, 17 Aug 2018 14:39:53 +0000 (14:39 +0000)]
[NewGVN] Add tests for r340031.

llvm-svn: 340032

6 years ago[InstrSimplify,NewGVN] Add option to ignore additional instr info when simplifying.
Florian Hahn [Fri, 17 Aug 2018 14:39:04 +0000 (14:39 +0000)]
[InstrSimplify,NewGVN] Add option to ignore additional instr info when simplifying.

NewGVN uses InstructionSimplify for simplifications of leaders of
congruence classes. It is not guaranteed that the metadata or other
flags/keywords (like nsw or exact) of the leader is available for all members
in a congruence class, so we cannot use it for simplification.

This patch adds a InstrInfoQuery struct with a boolean field
UseInstrInfo (which defaults to true to keep the current behavior as
default) and a set of helper methods to get metadata/keywords for a
given instruction, if UseInstrInfo is true. The whole thing might need a
better name, to avoid confusion with TargetInstrInfo but I am not sure
what a better name would be.

The current patch threads through InstrInfoQuery to the required
places, which is messier then it would need to be, if
InstructionSimplify and ValueTracking would share the same Query struct.

The reason I added it as a separate struct is that it can be shared
between InstructionSimplify and ValueTracking's query objects. Also,
some places do not need a full query object, just the InstrInfoQuery.

It also updates some interfaces that do not take a Query object, but a
set of optional parameters to take an additional boolean UseInstrInfo.

See https://bugs.llvm.org/show_bug.cgi?id=37540.

Reviewers: dberlin, davide, efriedma, sebpop, hiraditya

Reviewed By: hiraditya

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

llvm-svn: 340031

6 years ago[Preamble] Empty preamble is not an error.
Haojian Wu [Fri, 17 Aug 2018 14:25:10 +0000 (14:25 +0000)]
[Preamble] Empty preamble is not an error.

Summary:
Empty preamble is valid for source file which doesn't have any
preprocessor and #includes.

This patch makes clang treat an empty preamble as a normal preamble.

Check: ninja check-clang

A testcase is added in https://reviews.llvm.org/D50627.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 340029

6 years ago[Hexagon] Expand vgather pseudos during packetization
Krzysztof Parzyszek [Fri, 17 Aug 2018 14:24:24 +0000 (14:24 +0000)]
[Hexagon] Expand vgather pseudos during packetization

This will allow packetizing the vgather expansion with other instructions.

llvm-svn: 340028

6 years ago[AtomicExpandPass] Widen partword atomicrmw or/xor/and before tryExpandAtomicRMW
Alex Bradbury [Fri, 17 Aug 2018 14:03:37 +0000 (14:03 +0000)]
[AtomicExpandPass] Widen partword atomicrmw or/xor/and before tryExpandAtomicRMW

This patch performs a widening transformation of bitwise atomicrmw
{or,xor,and} and applies it prior to tryExpandAtomicRMW. This operates
similarly to convertCmpXchgToIntegerType. For these operations, the i8/i16
atomicrmw can be implemented in terms of the 32-bit atomicrmw by appropriately
manipulating the operands. There is no functional change for the handling of
partword or/xor, but the transformation for partword 'and' is new.

The advantage of performing this transformation early is that the same
code-path can be used regardless of the approach used to expand the atomicrmw
(AtomicExpansionKind). i.e. the same logic is used for
AtomicExpansionKind::CmpXchg and can also be used by the intrinsic-based
expansion in D47882.

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

llvm-svn: 340027

6 years ago[LICM] Add a diagnostic analysis for identifying alias information
Anna Thomas [Fri, 17 Aug 2018 13:44:00 +0000 (13:44 +0000)]
[LICM] Add a diagnostic analysis for identifying alias information

Summary:
Currently, in LICM, we use the alias set tracker to identify if the
instruction (we're interested in hoisting) aliases with instruction that
modifies that memory location.

This patch adds an LICM alias analysis diagnostic tool that checks the
mod ref info of the instruction we are interested in hoisting/sinking,
with every instruction in the loop.  Because of O(N^2) complexity this
is now only a diagnostic tool to show the limitation we have with the
alias set tracker and is OFF by default.

Test cases show the difference with the diagnostic analysis tool, where
we're able to hoist out loads and readonly + argmemonly calls from the
loop, where the alias set tracker analysis is not able to hoist these
instructions out.

Reviewers: reames, mkazantsev, fedor.sergeev, hfinkel

Subscribers: llvm-commits

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

llvm-svn: 340026

6 years agoFix for bug 38508 - Don't do PCH processing when only generating preprocessor output
Erich Keane [Fri, 17 Aug 2018 13:43:39 +0000 (13:43 +0000)]
Fix for bug 38508 - Don't do PCH processing when only generating preprocessor output

This clang-cl driver change removes the PCH options when we are only generating
preprocessed output. This is similar to the behavior of Y-.

Patch by: mikerice
Differential Revision: https://reviews.llvm.org/D50640

llvm-svn: 340025

6 years ago[RISCV] Remove unused function
Roger Ferrer Ibanez [Fri, 17 Aug 2018 13:40:03 +0000 (13:40 +0000)]
[RISCV] Remove unused function

This function is not virtual, it is private and it is not called anywhere. No
regression is introduced by removing it.

I think we can safely remove it.

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

llvm-svn: 340024

6 years agoclang-cl: Expose -fno-crash-diagnostics (PR38574)
Hans Wennborg [Fri, 17 Aug 2018 13:37:57 +0000 (13:37 +0000)]
clang-cl: Expose -fno-crash-diagnostics (PR38574)

llvm-svn: 340023

6 years ago[ConstantFolding] add simplifications for funnel shift intrinsics
Sanjay Patel [Fri, 17 Aug 2018 13:23:44 +0000 (13:23 +0000)]
[ConstantFolding] add simplifications for funnel shift intrinsics

This is another step towards being able to canonicalize to the funnel shift
intrinsics in IR (see D49242 for the initial patch).
We should not have any loss of simplification power in IR between these and
the equivalent IR constructs.

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

llvm-svn: 340022

6 years ago[ThinLTO] Correct documentation on default number of threads
Teresa Johnson [Fri, 17 Aug 2018 13:19:36 +0000 (13:19 +0000)]
[ThinLTO] Correct documentation on default number of threads

Summary:
The number of threads used for ThinLTO backend parallelism was
dropped to the number of cores in r284618 to avoid oversubscribing
physical cores due to hyperthreading. This updates the documentation
to reflect that change.

Fixes PR38610.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, cfe-commits

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

llvm-svn: 340021

6 years ago[TableGen] TypeSetByHwMode::insert - cache the default MVT. NFCI.
Simon Pilgrim [Fri, 17 Aug 2018 13:03:17 +0000 (13:03 +0000)]
[TableGen] TypeSetByHwMode::insert - cache the default MVT. NFCI.

Avoids repeated count()/find() calls that we've already have the default values for.

llvm-svn: 340020

6 years ago[AArch64] - return address signing
Luke Cheeseman [Fri, 17 Aug 2018 12:55:05 +0000 (12:55 +0000)]
[AArch64] - return address signing

- Add a command line options -msign-return-address to enable return address
  signing
- Armv8.3a added instructions to sign the return address to help mitigate
  against ROP attacks
- This patch adds command line options to generate function attributes that
  signal to the back whether return address signing instructions should be
  added

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

llvm-svn: 340019

6 years ago[AArch64] - Generate pointer authentication instructions
Luke Cheeseman [Fri, 17 Aug 2018 12:53:22 +0000 (12:53 +0000)]
[AArch64] - Generate pointer authentication instructions

- Generate pointer authentication instructions
- The functions instrumented depend on function attribtues:
  all (all functions instrumentent)
  non-leaf (only those that spill LR)
  none
- Function epilogues sign the LR before spilling to the stack and authenticate
  the LR once restored
- If the target is v8.3a or greater than can use the combined authenticate and
  return instruction

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

llvm-svn: 340018

6 years agoRevert extraneous directory added by accident in rL340016
Nemanja Ivanovic [Fri, 17 Aug 2018 12:41:49 +0000 (12:41 +0000)]
Revert extraneous directory added by accident in rL340016

It appears that the way this patch was produced ended up creating an
extra 'llvm' directory where the test was placed. When I committed the
patch, that directory ended up being created upstream. This commit should
revert that.
Sorry for the noise.

llvm-svn: 340017

6 years ago[PowerPC] Generate Power9 extswsli extend sign and shift immediate instruction
Nemanja Ivanovic [Fri, 17 Aug 2018 12:35:44 +0000 (12:35 +0000)]
[PowerPC] Generate Power9 extswsli extend sign and shift immediate instruction

Add a DAG combine for the PowerPC code generator to generate the Power9 extswsli
extend sign and shift immediate instruction.

Patch by RolandF.

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

llvm-svn: 340016

6 years ago[DAGCombiner] extractShiftForRotate - fix out of range shift issue
Simon Pilgrim [Fri, 17 Aug 2018 12:25:18 +0000 (12:25 +0000)]
[DAGCombiner] extractShiftForRotate - fix out of range shift issue

Don't just check for negative shift amounts.

Fixes OSS Fuzz #9935
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9935

llvm-svn: 340015

6 years ago[InstCombine] Remove unused method FAddCombine::createFDiv(). NFC
Andrea Di Biagio [Fri, 17 Aug 2018 11:33:48 +0000 (11:33 +0000)]
[InstCombine] Remove unused method FAddCombine::createFDiv(). NFC

This commit fixes a (gcc 7.3.0) [-Wunused-function] warning caused by the
presence of unused method FaddCombine::createFDiv().
The last use of that method was removed at r339519.

llvm-svn: 340014

6 years ago[ARM/AArch64] Support FP16 +fp16fml instructions
Bernard Ogden [Fri, 17 Aug 2018 11:29:49 +0000 (11:29 +0000)]
[ARM/AArch64] Support FP16 +fp16fml instructions

Add +fp16fml feature for new FP16 instructions, which are a
mandatory part of FP16 from v8.4-A and an optional part of FP16
from v8.2-A. It doesn't seem to be possible to model this in
LLVM, but the relationship between the options is handled by
the related clang patch.

In keeping with what I think is the usual practice, the fp16fml
extension is accepted regardless of base architecture version.

Builds on/replaces Sjoerd Meijer's patch to add these instructions at
https://reviews.llvm.org/D49839.

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

llvm-svn: 340013

6 years ago[ARM/AArch64] TargetParserTest fixes
Bernard Ogden [Fri, 17 Aug 2018 11:26:57 +0000 (11:26 +0000)]
[ARM/AArch64] TargetParserTest fixes

Adds some missing tests for the FP16 extension,
fixes an existing test that misnames it.

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

llvm-svn: 340012

6 years ago[LLD][ELF] - Remove dead code. NFC.
George Rimar [Fri, 17 Aug 2018 11:19:55 +0000 (11:19 +0000)]
[LLD][ELF] - Remove dead code. NFC.

These lines were unused.

llvm-svn: 340011

6 years ago[DAGCombine] Improve (sra (sra x, c1), c2) -> (sra x, (add c1, c2)) folding
Simon Pilgrim [Fri, 17 Aug 2018 10:52:49 +0000 (10:52 +0000)]
[DAGCombine] Improve (sra (sra x, c1), c2) -> (sra x, (add c1, c2)) folding

Add support for cases where only some c1+c2 results exceed the max bitshift, clamping accordingly.

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

llvm-svn: 340010

6 years agoFix clangd tests on older compilers
Simon Pilgrim [Fri, 17 Aug 2018 10:40:05 +0000 (10:40 +0000)]
Fix clangd tests on older compilers

Old versions of gcc struggle with raw string literals inside macros.

llvm-svn: 340009

6 years ago[Sparc] Get sret arg size from CallLoweringInfo.getArgs()
Daniel Cederman [Fri, 17 Aug 2018 10:40:00 +0000 (10:40 +0000)]
[Sparc] Get sret arg size from CallLoweringInfo.getArgs()

Summary:
Looking at the callee argument list, as is done now, might not work if
the function has been typecasted into one that is expected to return
a struct. This change also simplifies the code.

The isFP128ABICall() function can be removed as it is no longer needed.
The test in fp128.ll has been updated to verify this.

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: fedor.sergeev, jrtc27, llvm-commits

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

llvm-svn: 340008

6 years ago[clangd] NFC: Mark Workspace Symbol feature complete in the documentation
Kirill Bobyrev [Fri, 17 Aug 2018 10:14:31 +0000 (10:14 +0000)]
[clangd] NFC: Mark Workspace Symbol feature complete in the documentation

Workspace Symbol implementation was introduced in D44882 and should be
complete now.

Reviewed by: ioeric

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

llvm-svn: 340007

6 years agoFix "control reaches end of non-void function" -Wreturn-type warning. NFCI.
Simon Pilgrim [Fri, 17 Aug 2018 09:47:52 +0000 (09:47 +0000)]
Fix "control reaches end of non-void function" -Wreturn-type warning. NFCI.

llvm-svn: 340006

6 years ago[clangd] Fetch documentation from the Index during signature help
Ilya Biryukov [Fri, 17 Aug 2018 09:32:30 +0000 (09:32 +0000)]
[clangd] Fetch documentation from the Index during signature help

Summary:
Sema can only be used for documentation in the current file, other doc
comments should be fetched from the index.

Reviewers: hokein, ioeric, kadircet

Reviewed By: hokein, kadircet

Subscribers: MaskRay, jkorous, mgrang, arphaman, cfe-commits

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

llvm-svn: 340005

6 years ago[clangd] Show function documentation in signature help
Ilya Biryukov [Fri, 17 Aug 2018 09:29:38 +0000 (09:29 +0000)]
[clangd] Show function documentation in signature help

Summary:
Previously, clangd was trying to show documentation for the active
parameter instead, which is wrong per LSP specification.

Moreover, the code path that attempts to get parameter comments never
succeds, because no attempt is made to parse function doc comment and
extract parameter-specific parts out of it. So we also remove the code
that claims to fetch parameter comments: it is not used anymore and is
incorrect.

Reviewers: hokein, ioeric, kadircet

Reviewed By: ioeric

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 340004

6 years ago[Sparc] Flush register windows for @llvm.returnaddress(1)
Daniel Cederman [Fri, 17 Aug 2018 09:18:31 +0000 (09:18 +0000)]
[Sparc] Flush register windows for @llvm.returnaddress(1)

Summary: When @llvm.returnaddress is called with a value higher than 0
it needs to read from the call stack to get the return address. This
means that the register windows needs to be flushed to the stack to
guarantee that the data read is valid. For values higher than 1 this
is done indirectly by the call to getFRAMEADDR(), but not for the value 1.

Reviewers: jyknight, venkatra

Reviewed By: jyknight

Subscribers: fedor.sergeev, jrtc27, llvm-commits

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

llvm-svn: 340003

6 years ago[clangd] Always use the latest preamble
Haojian Wu [Fri, 17 Aug 2018 08:15:22 +0000 (08:15 +0000)]
[clangd] Always use the latest preamble

Summary:
Fix an inconsistent behavior of using `LastBuiltPreamble`/`NewPreamble`
in TUScheduler (see the test for details), AST should always use
NewPreamble. This patch makes LastBuiltPreamble always point to
NewPreamble.

Preamble rarely fails to build, even there are errors in headers, so we
assume it would not cause performace issue for code completion.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 340001

6 years ago[MISC]Fix wrong usage of std::equal()
Chen Zheng [Fri, 17 Aug 2018 07:51:01 +0000 (07:51 +0000)]
[MISC]Fix wrong usage of std::equal()
Differential Revision: https://reviews.llvm.org/D49958

llvm-svn: 340000

6 years ago[ARM][NFC] ARMCodeGenPrepare: some refactoring and algorithm description
Sjoerd Meijer [Fri, 17 Aug 2018 07:34:01 +0000 (07:34 +0000)]
[ARM][NFC] ARMCodeGenPrepare: some refactoring and algorithm description

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

llvm-svn: 339997

6 years ago[NFC] Some small test updates for Implicit Conversion sanitizer.
Roman Lebedev [Fri, 17 Aug 2018 07:33:38 +0000 (07:33 +0000)]
[NFC] Some small test updates for Implicit Conversion sanitizer.

Split off from D50251.

llvm-svn: 339996

6 years ago[NFC] Some small test updates for Implicit Conversion sanitizer.
Roman Lebedev [Fri, 17 Aug 2018 07:33:25 +0000 (07:33 +0000)]
[NFC] Some small test updates for Implicit Conversion sanitizer.

Split off from D50250.

llvm-svn: 339995