platform/upstream/llvm.git
7 years ago[ELF] - Accept --defsym foo=value form.
George Rimar [Fri, 5 May 2017 11:59:15 +0000 (11:59 +0000)]
[ELF] - Accept --defsym foo=value form.

Previously we accepted --defsym=foo=value only.

Reported by Sean Silva.

llvm-svn: 302227

7 years agoRemove unused variable
Simon Pilgrim [Fri, 5 May 2017 11:55:38 +0000 (11:55 +0000)]
Remove unused variable

llvm-svn: 302226

7 years agoFix segfault resulting from empty print prompt
Pavel Labath [Fri, 5 May 2017 11:51:21 +0000 (11:51 +0000)]
Fix segfault resulting from empty print prompt

Summary:
I have found a way to segfault lldb in 7 keystrokes! Steps to reproduce:
1) Launch lldb
2) Type `print` and hit enter. lldb will now prompt you to type a list of
    expressions, followed by an empty line.
3) Hit enter, indicating the end of your input.
4) Segfault!

After some investigation, I've found the issue in Host/common/Editline.cpp.
Editline::MoveCursor() relies on m_input_lines not being empty when the `to`
argument is CursorPosition::BlockEnd. This scenario, as far as I can tell,
occurs in one specific instance: In Editline::EndOrAddLineCommand() when the
list of lines being processed contains exactly one string (""). Meeting this
condition is fairly simple, I have posted steps to reproduce above.

Reviewers: krytarowski, zturner, labath

Reviewed By: labath

Subscribers: scott.smith, lldb-commits

Differential Revision: https://reviews.llvm.org/D32421
Patch by Alex Langford.

llvm-svn: 302225

7 years ago[ARM] Add support for ORR and ORN instruction substitutions
John Brawn [Fri, 5 May 2017 11:31:25 +0000 (11:31 +0000)]
[ARM] Add support for ORR and ORN instruction substitutions

Recently support was added for substituting one intruction for another by
negating or inverting the immediate, but ORR and ORN were missed so this patch
adds them.

This one is slightly different to the others in that ORN only exists in thumb,
so we only do the substitution in thumb.

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

llvm-svn: 302224

7 years agoAdd TaskMap for iterating a function over a set of integers
Pavel Labath [Fri, 5 May 2017 11:16:59 +0000 (11:16 +0000)]
Add TaskMap for iterating a function over a set of integers

Summary:
Many parallel tasks just want to iterate over all the possible numbers from 0 to N-1.  Rather than enqueue N work items, instead just "map" the function across the requested integer space.

Reviewers: clayborg, labath, tberghammer, zturner

Reviewed By: clayborg, zturner

Subscribers: zturner, lldb-commits

Differential Revision: https://reviews.llvm.org/D32757
Patch by Scott Smith <scott.smith@purestorage.com>.

llvm-svn: 302223

7 years ago[X86][AVX] Add LowerIntUnary helpers to split unary vector ops in half. NFCI.
Simon Pilgrim [Fri, 5 May 2017 10:59:24 +0000 (10:59 +0000)]
[X86][AVX] Add LowerIntUnary helpers to split unary vector ops in half. NFCI.

Same as LowerIntArith helpers but for unary ops instead of binary.

llvm-svn: 302222

7 years ago[llvm-dwarfdump] - Print an error message if section decompression failed.
George Rimar [Fri, 5 May 2017 10:52:39 +0000 (10:52 +0000)]
[llvm-dwarfdump] - Print an error message if section decompression failed.

llvm-dwarfdump currently prints no message if decompression fails
for some reason. I noticed that during work on one of LLD patches
where LLD produced an broken output. It was a bit confusing to see
no output for section dumped and no any error message at all.

Patch adds error message for such cases.

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

llvm-svn: 302221

7 years agoABISysV_arm64: compute return value for large vectors correctly
Pavel Labath [Fri, 5 May 2017 10:50:02 +0000 (10:50 +0000)]
ABISysV_arm64: compute return value for large vectors correctly

Summary:
Arm64 Procedure Call Standard specifies than only vectors up to 16 bytes
are stored in v0 (which makes sense, as that's the size of the
register). 32-byte vector types are passed as regular structs via x8
pointer. Treat them as such.

This fixes TestReturnValue for arm64-clang. I also split the test case
into two so I can avoid the if(gcc) line, and annotate each test
instead. (It seems the vector type tests fail with gcc only when
targetting x86 arches).

Reviewers: tberghammer, eugene

Subscribers: aemerson, omjavaid, rengolin, srhines, lldb-commits

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

llvm-svn: 302220

7 years ago[X86] Remove unused code from X86 optimize LEAs. NFC.
Andrew Ng [Fri, 5 May 2017 09:21:35 +0000 (09:21 +0000)]
[X86] Remove unused code from X86 optimize LEAs. NFC.

This patch removes unused code which is no longer required because of changes
to the DIExpression::prepend function.

llvm-svn: 302219

7 years ago[ubsan] Implement __sanitizer_print_stack_trace for standalone UBSan runtime.
Alexander Potapenko [Fri, 5 May 2017 09:02:28 +0000 (09:02 +0000)]
[ubsan] Implement __sanitizer_print_stack_trace for standalone UBSan runtime.

Patch by Max Moroz, reviewed at https://reviews.llvm.org/D32542

llvm-svn: 302218

7 years agoRevert "[Polly] Added OpenCL Runtime to GPURuntime Library for GPGPU CodeGen"
Siddharth Bhat [Fri, 5 May 2017 09:02:08 +0000 (09:02 +0000)]
Revert "[Polly] Added OpenCL Runtime to GPURuntime Library for GPGPU CodeGen"

This reverts commit 17a84e414adb51ee375d14836d4c2a817b191933.

Patches should have been submitted in the order of:

1. D32852
2. D32854
3. D32431

I mistakenly pushed D32431(3) first. Reverting to push in the correct
order.

llvm-svn: 302217

7 years ago[ArgPromotion] Add a testcase for PR32917
Martin Storsjo [Fri, 5 May 2017 08:40:24 +0000 (08:40 +0000)]
[ArgPromotion] Add a testcase for PR32917

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

llvm-svn: 302216

7 years ago[Polly] Added OpenCL Runtime to GPURuntime Library for GPGPU CodeGen
Siddharth Bhat [Fri, 5 May 2017 07:54:49 +0000 (07:54 +0000)]
[Polly] Added OpenCL Runtime to GPURuntime Library for GPGPU CodeGen

Summary:
When compiling for GPU, one can now choose to compile for OpenCL or CUDA,
with the corresponding polly-gpu-runtime flag (libopencl / libcudart). The
GPURuntime library (GPUJIT) has been extended with the OpenCL Runtime library
for that purpose, correctly choosing the corresponding library calls to the
option chosen when compiling (via different initialization calls).

Additionally, a specific GPU Target architecture can now be chosen with -polly-gpu-arch (only nvptx64 implemented thus far).

Reviewers: grosser, bollu, Meinersbur, etherzhhb, singam-sanjay

Reviewed By: grosser, Meinersbur

Subscribers: singam-sanjay, llvm-commits, pollydev, nemanjai, mgorny, yaxunl, Anastasia

Tags: #polly

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

llvm-svn: 302215

7 years agoInitialize new member X86Operand::FrontendSize in all codepaths.
Daniel Jasper [Fri, 5 May 2017 07:31:40 +0000 (07:31 +0000)]
Initialize new member X86Operand::FrontendSize in all codepaths.

This fixes MSAN-builds after r302179.

llvm-svn: 302214

7 years agoDocument XFAIL's with the relevent bug number
Eric Fiselier [Fri, 5 May 2017 05:19:21 +0000 (05:19 +0000)]
Document XFAIL's with the relevent bug number

llvm-svn: 302213

7 years ago[XRay][compiler-rt] Remove dependency on FileCheck from function id utilities tests
Dean Michael Berris [Fri, 5 May 2017 01:55:13 +0000 (01:55 +0000)]
[XRay][compiler-rt] Remove dependency on FileCheck from function id utilities tests

Follow-up on D32846 to simplify testing and not rely on FileCheck to
test boundary conditions, and instead do all the testing in code
instead.

llvm-svn: 302212

7 years ago[ubsan] Fix error summary message for ObjC BOOL invalid loads
Vedant Kumar [Fri, 5 May 2017 01:35:42 +0000 (01:35 +0000)]
[ubsan] Fix error summary message for ObjC BOOL invalid loads

llvm-svn: 302211

7 years ago[XRay][compiler-rt] Add function id utilities for XRay
Dean Michael Berris [Fri, 5 May 2017 01:27:11 +0000 (01:27 +0000)]
[XRay][compiler-rt] Add function id utilities for XRay

Summary:
This change allows us to provide users and implementers of XRay handlers
a means of converting XRay function id's to addresses. This, in
combination with the facilities provided in D32695, allows users to find
out:

  - How many function id's there are defined in the current binary.
  - Get the address of the function associated with this function id.
  - Patch only specific functions according to their requirements.

While we don't directly provide symbolization support in XRay, having
the function's address lets users determine this information easily
either during runtime, or offline with tools like 'addr2line'.

Reviewers: dblaikie, echristo, pelikan

Subscribers: kpw, llvm-commits

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

llvm-svn: 302210

7 years agoUpdate VP prof metadata during inlining.
Dehao Chen [Fri, 5 May 2017 00:47:34 +0000 (00:47 +0000)]
Update VP prof metadata during inlining.

Summary: r298270 added profile update logic for branch_weights. This patch implements profile update logic for VP prof metadata too.

Reviewers: eraman, tejohnson, davidxl

Reviewed By: eraman

Subscribers: llvm-commits

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

llvm-svn: 302209

7 years ago[ADT] A few minor improvements to BitVector
Zachary Turner [Fri, 5 May 2017 00:19:57 +0000 (00:19 +0000)]
[ADT] A few minor improvements to BitVector

Fixes some spelling mistakes, uses a helper function, and
adds an additional test case.

llvm-svn: 302208

7 years agoDocument that Multilib flags must be actual flags
Jonathan Roelofs [Fri, 5 May 2017 00:18:27 +0000 (00:18 +0000)]
Document that Multilib flags must be actual flags

This is because -print-multi-lib depends on them being flags for correctness.

Fixes a case of this in the arm-android multilib selection logic.

llvm-svn: 302207

7 years ago[pdb] Don't verify TPI hash values up front.
Zachary Turner [Thu, 4 May 2017 23:53:54 +0000 (23:53 +0000)]
[pdb] Don't verify TPI hash values up front.

Verifying the hash values as we are currently doing
results in iterating every type record before the user
even tries to access the first one, and the API user
has no control over, or ability to hook into this
process.

As a result, when the user wants to iterate over types
to print them or index them, this results in a second
iteration over the same list of types.  When there's
upwards of 1,000,000 type records, this is obviously
quite undesirable.

This patch raises the verification outside of TpiStream
, and llvm-pdbdump hooks a hash verification visitor
into the normal dumping process.  So we still verify
the hash records, but we can do it while not requiring
a second iteration over the type stream.

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

llvm-svn: 302206

7 years ago[PDB] Don't build the entire source file list up front.
Zachary Turner [Thu, 4 May 2017 23:53:29 +0000 (23:53 +0000)]
[PDB] Don't build the entire source file list up front.

I tried to run llvm-pdbdump on a very large (~1.5GB) PDB to
try and identify show-stopping performance problems.  This
patch addresses the first such problem.

When loading the DBI stream, before anyone has even tried to
access a single record, we build an in memory map of every
source file for every module.  In the particular PDB I was
using, this was over 85 million files.  Specifically, the
complexity is O(m*n) where m is the number of modules and
n is the average number of source files (including headers)
per module.

The whole reason for doing this was so that we could have
constant time access to any module and any of its source
file lists.  However, we can still get O(1) access to the
source file list for a given module with a simple O(m)
precomputation, and access to the list of modules is
already O(1) anyway.

So this patches reduces the O(m*n) up-front precomputation
to an O(m) one, where n is ~6,500 and n*m is about 85 million
in my pathological test case.

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

llvm-svn: 302205

7 years ago[llvm-pdbdump] Only build the TypeDatabase if necessary.
Zachary Turner [Thu, 4 May 2017 23:53:01 +0000 (23:53 +0000)]
[llvm-pdbdump] Only build the TypeDatabase if necessary.

Building the type database is expensive, and can take multiple
minutes for large PDBs.  But we only need it in certain cases
depending on what command line options are specified.  So only
build it when we know we're about to need it.

llvm-svn: 302204

7 years agoRemap metadata attached to global variables.
Evgeniy Stepanov [Thu, 4 May 2017 23:29:39 +0000 (23:29 +0000)]
Remap metadata attached to global variables.

Fix for PR32577.
Global variables may have !associated metadata, which includes a reference to another global. It needs remapping.

llvm-svn: 302203

7 years ago[RegisterBankInfo] Fix 80-col introduced in r293506.
Quentin Colombet [Thu, 4 May 2017 22:43:08 +0000 (22:43 +0000)]
[RegisterBankInfo] Fix 80-col introduced in r293506.

NFC.

llvm-svn: 302202

7 years ago[GlobalISel] Add missing doxygen keyword for doxygen groups.
Quentin Colombet [Thu, 4 May 2017 22:43:04 +0000 (22:43 +0000)]
[GlobalISel] Add missing doxygen keyword for doxygen groups.

NFC

llvm-svn: 302201

7 years agoAMDGPU: GFX9 GS and HS shaders always have the scratch wave offset in SGPR5
Marek Olsak [Thu, 4 May 2017 22:25:20 +0000 (22:25 +0000)]
AMDGPU: GFX9 GS and HS shaders always have the scratch wave offset in SGPR5

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 302200

7 years ago[GISel]:Skip legalizing Intermediate inst(with generic types)
Aditya Nandakumar [Thu, 4 May 2017 22:00:42 +0000 (22:00 +0000)]
[GISel]:Skip legalizing Intermediate inst(with generic types)

During legalization, targets can create Pseudo Instructions with
generic types. We shouldn't try to legalize them.

Reviewed by Quentin, dsanders
https://reviews.llvm.org/D32575

llvm-svn: 302199

7 years ago[JumpThreading] When processing compares, explicitly check that the result type is...
Craig Topper [Thu, 4 May 2017 21:45:49 +0000 (21:45 +0000)]
[JumpThreading] When processing compares, explicitly check that the result type is not a vector rather than check for it being an integer.

Compares always return a scalar integer or vector of integers. isIntegerTy returns false for vectors, but that's not completely obvious. So using isVectorTy is less confusing.

llvm-svn: 302198

7 years ago[JumpThreading] Change a dyn_cast that is already protected by an isa check to a...
Craig Topper [Thu, 4 May 2017 21:45:45 +0000 (21:45 +0000)]
[JumpThreading] Change a dyn_cast that is already protected by an isa check to a static cast. Combine the with another static cast. NFC

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

llvm-svn: 302197

7 years ago[GISel]: Add support to translate ConstantVectors
Aditya Nandakumar [Thu, 4 May 2017 21:43:12 +0000 (21:43 +0000)]
[GISel]: Add support to translate ConstantVectors

Reviewed by Quentin
https://reviews.llvm.org/D32814

llvm-svn: 302196

7 years agoFix whitespace before token-paste of an argument.
James Y Knight [Thu, 4 May 2017 21:31:17 +0000 (21:31 +0000)]
Fix whitespace before token-paste of an argument.

The whitespace should come from the argument name in the macro
expansion, rather than from the token passed to the macro (same as it
does when not pasting).

Added a new test case for the change in behavior to stringize_space.c.

FileCheck'ized macro_paste_commaext.c, tweaked the test case, and
added a comment; no behavioral change to this test.

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

llvm-svn: 302195

7 years ago[ConstantRange] Add LLVM_NODISCARD to ConstantRange since a large number of its metho...
Craig Topper [Thu, 4 May 2017 21:29:50 +0000 (21:29 +0000)]
[ConstantRange] Add LLVM_NODISCARD to ConstantRange since a large number of its methods construct new ConstantRange objects.

llvm-svn: 302194

7 years ago[Float2Int] Remove return of ConstantRange from seen method. Nothing uses it so it...
Craig Topper [Thu, 4 May 2017 21:29:45 +0000 (21:29 +0000)]
[Float2Int] Remove return of ConstantRange from seen method. Nothing uses it so it just creates and discards a ConstantRange object for no reason.

llvm-svn: 302193

7 years agoStrip trailing whitespace. NFCI.
Simon Pilgrim [Thu, 4 May 2017 20:55:16 +0000 (20:55 +0000)]
Strip trailing whitespace. NFCI.

llvm-svn: 302192

7 years ago[clangd] Add documentation page
Marc-Andre Laperle [Thu, 4 May 2017 19:57:53 +0000 (19:57 +0000)]
[clangd] Add documentation page

Summary:
Add a simple documentation page for Clangd.
This will be useful for interested users and contributors to get basic information about how
to get started and the progress of Clangd.

Reviewers: krasimir, bkramer

Reviewed By: krasimir

Subscribers: Prazek, jbcoe, JDevlieghere, mgehre, JonasToth, kromanenkov, xazax.hun, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 302191

7 years agoTurn on -Wmicrosoft-enum-forward-reference by default.
Nico Weber [Thu, 4 May 2017 19:54:50 +0000 (19:54 +0000)]
Turn on -Wmicrosoft-enum-forward-reference by default.

clang-cl already errs or warns on everything that cl
warns on in /permissive- mode, except for enum foward
declarations (and ATL attributes).
So warn on enum forward declarations by default.

llvm-svn: 302190

7 years ago[InstSimplify] add folds for or-of-casted-icmps
Sanjay Patel [Thu, 4 May 2017 19:51:34 +0000 (19:51 +0000)]
[InstSimplify] add folds for or-of-casted-icmps

The sibling folds for 'and' with casts were added with https://reviews.llvm.org/rL273200.
This is a preliminary step for adding the 'or' variants for the folds added with https://reviews.llvm.org/rL301260.

The reason for the strange form with constant LHS in the 1st test is because there's another missing fold in that
case for the inverted predicate. That should be fixed when we add the ConstantRange functionality for 'or-of-icmps'
that already exists for 'and-of-icmps'.

I'm hoping to share more code for the and/or cases, so we won't have these differences. This will allow us to remove
code from InstCombine. It's also possible that we can remove some code here in InstSimplify. I think we have some
duplicated folds because patterns are not matched in a general way.

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

llvm-svn: 302189

7 years agoFix bugs checking va_start in lambdas and erroneous contexts
Reid Kleckner [Thu, 4 May 2017 19:51:05 +0000 (19:51 +0000)]
Fix bugs checking va_start in lambdas and erroneous contexts

Summary:
First, getCurFunction looks through blocks and lambdas, which is wrong.
Inside a lambda, va_start should refer to the lambda call operator
prototype. This fixes PR32737.

Second, we shouldn't use any of the getCur* methods, because they look
through contexts that we don't want to look through (EnumDecl,
CapturedStmtDecl). We can use CurContext directly as the calling
context.

Finally, this code assumed that CallExprs would never appear outside of
code contexts (block, function, obj-c method), which is wrong. Struct
member initializers are an easy way to create and parse exprs in a
non-code context.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 302188

7 years agoTurn -Wmicrosoft-enum-value off by default.
Nico Weber [Thu, 4 May 2017 19:36:26 +0000 (19:36 +0000)]
Turn -Wmicrosoft-enum-value off by default.

The warning is currently way too noisy to be useful. The plan is
to make it warn when an MS enum that's negative is compared to
something, but until that's done the warning shouldn't default
to on.

llvm-svn: 302187

7 years agoSimplify the header allocation.
Rafael Espindola [Thu, 4 May 2017 19:34:17 +0000 (19:34 +0000)]
Simplify the header allocation.

In the non linker script case we would try very early to find out if
we could allocate the headers. Failing to do that would add extra
alignment to the first ro section, since we would set PageAlign
thinking it was the first section in the PT_LOAD.

In the linker script case the header allocation must be done in the
end, causing some duplication.

We now tentatively add the headers to the first PT_LOAD and if it
turns out they don't fit, remove them. With this we only need to
allocate the headers in one place in the code.

llvm-svn: 302186

7 years ago[WebAssembly] Add wasm symbol table support to llvm-objdump
Sam Clegg [Thu, 4 May 2017 19:32:43 +0000 (19:32 +0000)]
[WebAssembly] Add wasm symbol table support to llvm-objdump

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

llvm-svn: 302185

7 years agoDriver: only inject libstdc++ paths when needed on CrossWindows
Saleem Abdulrasool [Thu, 4 May 2017 19:18:21 +0000 (19:18 +0000)]
Driver: only inject libstdc++ paths when needed on CrossWindows

When building with libc++ don't bother with injecting the libstdc++
search paths into the linker search path.  This will make it easier to
switch between ld and lld.

llvm-svn: 302184

7 years ago[PPC] When restoring R30 (PIC base pointer), mark it as <def>
Krzysztof Parzyszek [Thu, 4 May 2017 19:14:54 +0000 (19:14 +0000)]
[PPC] When restoring R30 (PIC base pointer), mark it as <def>

This happened on the PPC32/SVR4 path and was discovered when building
FreeBSD on PPC32. It was a typo-class error in the frame lowering code.

This fixes PR26519.

llvm-svn: 302183

7 years agoFix test failure with GCC 4.9
Eric Fiselier [Thu, 4 May 2017 19:13:28 +0000 (19:13 +0000)]
Fix test failure with GCC 4.9

llvm-svn: 302182

7 years agoChange Appveyor to download Clang from llvm.org instead of my private server
Eric Fiselier [Thu, 4 May 2017 19:04:50 +0000 (19:04 +0000)]
Change Appveyor to download Clang from llvm.org instead of my private server

llvm-svn: 302181

7 years agoDon't return an invalid line table if the DW_AT_stmt_list value is not in the .debug_...
Greg Clayton [Thu, 4 May 2017 18:29:44 +0000 (18:29 +0000)]
Don't return an invalid line table if the DW_AT_stmt_list value is not in the .debug_line section.

llvm-svn: 302180

7 years ago[ms-inline-asm] Use the frontend size only for ambiguous instructions
Reid Kleckner [Thu, 4 May 2017 18:19:52 +0000 (18:19 +0000)]
[ms-inline-asm] Use the frontend size only for ambiguous instructions

This avoids problems on code like this:
  char buf[16];
  __asm {
    movups xmm0, [buf]
    mov [buf], eax
  }

The frontend size in this case (1) is wrong, and the register makes the
instruction matching unambiguous. There are also enough bytes available
that we shouldn't complain to the user that they are potentially using
an incorrectly sized instruction to access the variable.

Supersedes D32636 and D26586 and fixes PR28266

llvm-svn: 302179

7 years ago[InstSimplify] move logic-of-icmps helper functions; NFC
Sanjay Patel [Thu, 4 May 2017 18:19:17 +0000 (18:19 +0000)]
[InstSimplify] move logic-of-icmps helper functions; NFC

Putting these next to each other should make it easier to see
what's missing from each side. Patch to plug one of those holes
should be posted soon.

llvm-svn: 302178

7 years agoRe-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in the module...
Peter Collingbourne [Thu, 4 May 2017 18:03:25 +0000 (18:03 +0000)]
Re-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI."
with a fix for the clang backend.

llvm-svn: 302176

7 years agoFix a typo.
Michael Zolotukhin [Thu, 4 May 2017 17:42:34 +0000 (17:42 +0000)]
Fix a typo.

llvm-svn: 302175

7 years ago[InstSimplify] add tests for or-of-casted-icmps; NFC
Sanjay Patel [Thu, 4 May 2017 17:36:53 +0000 (17:36 +0000)]
[InstSimplify] add tests for or-of-casted-icmps; NFC

llvm-svn: 302174

7 years ago[NewGVN] Remove unneeded newline and format assertions. NFCI.
Davide Italiano [Thu, 4 May 2017 17:26:15 +0000 (17:26 +0000)]
[NewGVN] Remove unneeded newline and format assertions. NFCI.

llvm-svn: 302173

7 years agoAdd markup for libc++ dylib availability
Mehdi Amini [Thu, 4 May 2017 17:08:54 +0000 (17:08 +0000)]
Add markup for libc++ dylib availability

Libc++ is used as a system library on macOS and iOS (amongst others). In order
for users to be able to compile a binary that is intended to be deployed to an
older version of the platform, clang provides the
availability attribute <https://clang.llvm.org/docs/AttributeReference.html#availability>_
that can be placed on declarations to describe the lifecycle of a symbol in the
library.

See docs/DesignDocs/AvailabilityMarkup.rst for more information.

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

llvm-svn: 302172

7 years ago[APInt] Reduce number of allocations involved in multiplying. Reduce worst case multi...
Craig Topper [Thu, 4 May 2017 17:00:41 +0000 (17:00 +0000)]
[APInt] Reduce number of allocations involved in multiplying. Reduce worst case multiply size

Currently multiply is implemented in operator*=. Operator* makes a copy and uses operator*= to modify the copy.

Operator*= itself allocates a temporary buffer to hold the multiply result as it computes it. Then copies it to the buffer in *this.

Operator*= attempts to bound the size of the result based on the number of active bits in its inputs. It also has a couple special cases to handle 0 inputs without any memory allocations or multiply operations. The best case is that it calculates a single word regardless of input bit width. The worst case is that it calculates the a 2x input width result and drop the upper bits.

Since operator* uses operator*= it incurs two allocations, one for a copy of *this and one for the temporary allocation. Neither of these allocations are kept after the method operation is done.

The main usage in the backend appears to be ConstantRange::multiply which uses operator* rather than operator*=.

This patch moves the multiply operation to operator* and implements operator*= using it. This avoids the copy in operator*. operator* now allocates a result buffer sized the same width as its inputs no matter what. This buffer will be used as the buffer for the returned APInt. Finally, we reuse tcMultiply to implement the multiply operation. This function is capable of not calculating additional upper words that will be discarded.

This change does lose the special optimizations for the inputs using less words than their size implies. But it also removed the getActiveBits calls from all multiplies. If we think those optimizations are important we could look at providing additional bounds to tcMultiply to limit the computations.

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

llvm-svn: 302171

7 years ago[PM] Add ProfileSummaryAnalysis as a required pass in the new pipeline.
Easwaran Raman [Thu, 4 May 2017 16:58:45 +0000 (16:58 +0000)]
[PM] Add ProfileSummaryAnalysis as a required pass in the new pipeline.

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

llvm-svn: 302170

7 years ago[Lexicon] Add BDCE
Brian Gesiak [Thu, 4 May 2017 16:50:37 +0000 (16:50 +0000)]
[Lexicon] Add BDCE

Summary: Add an entry to the Lexicon for "BDCE."

Reviewers: jmolloy, hfinkel

Reviewed By: jmolloy

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

llvm-svn: 302169

7 years agoUse lgamma_r instead of lgamma in binomial_distribution, because freakin' POSIX took...
Marshall Clow [Thu, 4 May 2017 16:36:39 +0000 (16:36 +0000)]
Use lgamma_r instead of lgamma in binomial_distribution, because freakin' POSIX took a perfectly fine call and made it not thread safe.

llvm-svn: 302168

7 years agoAdd accidentally deleted testcase back.
Adrian Prantl [Thu, 4 May 2017 16:26:07 +0000 (16:26 +0000)]
Add accidentally deleted testcase back.

llvm-svn: 302167

7 years agoCleanup tests to not share a DISubprogram between multiple Functions.
Adrian Prantl [Thu, 4 May 2017 16:24:31 +0000 (16:24 +0000)]
Cleanup tests to not share a DISubprogram between multiple Functions.

rdar://problem/31926379

llvm-svn: 302166

7 years ago[test-release] Status update *before* long gzip
Renato Golin [Thu, 4 May 2017 16:21:30 +0000 (16:21 +0000)]
[test-release] Status update *before* long gzip

llvm-svn: 302165

7 years ago[clang-tidy] fix readability-implicit-bool-cast false positive with xor
Alexander Kornienko [Thu, 4 May 2017 16:06:08 +0000 (16:06 +0000)]
[clang-tidy] fix readability-implicit-bool-cast false positive with xor

llvm-svn: 302164

7 years ago[ScopBuilder] Add missing semicolon after LLVM_FALLTHROUGH.
Michael Kruse [Thu, 4 May 2017 15:55:54 +0000 (15:55 +0000)]
[ScopBuilder] Add missing semicolon after LLVM_FALLTHROUGH.

It was forgotten in r302157.

llvm-svn: 302163

7 years ago[test] Name the local variable in the C1XX implementation of DoNotOptmize
Casey Carter [Thu, 4 May 2017 15:54:09 +0000 (15:54 +0000)]
[test] Name the local variable in the C1XX implementation of DoNotOptmize

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

llvm-svn: 302162

7 years ago[clang-tidy] fix readability-implicit-bool-cast false alarm on |=, &=
Alexander Kornienko [Thu, 4 May 2017 15:34:31 +0000 (15:34 +0000)]
[clang-tidy] fix readability-implicit-bool-cast false alarm on |=, &=

llvm-svn: 302161

7 years ago[clang-tidy] Code cleanup, (almost) NFC (*).
Alexander Kornienko [Thu, 4 May 2017 15:34:23 +0000 (15:34 +0000)]
[clang-tidy] Code cleanup, (almost) NFC (*).

(*) Printed types of member pointers don't use elaborated type specifiers
(`int struct S::*` -> `int S::*`).

llvm-svn: 302160

7 years ago[Tooling] add a createReplacement overload for StringRef
Alexander Kornienko [Thu, 4 May 2017 15:34:06 +0000 (15:34 +0000)]
[Tooling] add a createReplacement overload for StringRef

llvm-svn: 302159

7 years ago[test] variant: enable constexpr construction tests on MSVC STL
Casey Carter [Thu, 4 May 2017 15:32:54 +0000 (15:32 +0000)]
[test] variant: enable constexpr construction tests on MSVC STL

* Add a new macro _MSVC_STL_VER to detect when the MSVC STL is being tested
* Workaround C1XX __is_trivially_copyable bug

llvm-svn: 302158

7 years agoIntroduce VirtualUse. NFC.
Michael Kruse [Thu, 4 May 2017 15:22:57 +0000 (15:22 +0000)]
Introduce VirtualUse. NFC.

If a ScopStmt references a (scalar) value, there are multiple
possibilities where this value can come. The decision about what kind of
use it is must be handled consistently at different places, which can be
error-prone. VirtualUse is meant to centralize the handling of the
different types of value uses.

This patch makes ScopBuilder and CodeGeneration use VirtualUse. This
already helps to show inconsistencies with the value handling. In order
to keep this patch NFC, exceptions to the general rules are added.
These might be fixed later if they turn to problems. Overall, this
should result in fewer post-codegen IR-verification errors, but instead
assertion failures in `getNewValue` that are closer to the actual error.

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

llvm-svn: 302157

7 years agoclang-format: [JS] exponentiation operator
Martin Probst [Thu, 4 May 2017 15:04:04 +0000 (15:04 +0000)]
clang-format: [JS] exponentiation operator

Summary: While its precedence should be higher than multiplicative, LLVM does not have a level for that, so for the time being just treat it as multiplicative.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 302156

7 years agoReduce code duplication. NFC.
Rafael Espindola [Thu, 4 May 2017 14:54:48 +0000 (14:54 +0000)]
Reduce code duplication. NFC.

llvm-svn: 302155

7 years ago[globalisel][tablegen] Add several GINodeEquiv's for operators that do not require...
Daniel Sanders [Thu, 4 May 2017 14:24:50 +0000 (14:24 +0000)]
[globalisel][tablegen] Add several GINodeEquiv's for operators that do not require additional support.

Summary:
As of this patch, 350 out of 3938 rules are currently imported.

Depends on D32229

Reviewers: qcolombet, kristof.beyls, rovka, t.p.northover, ab, aditya_nandakumar

Reviewed By: ab

Subscribers: dberris, llvm-commits, igorb

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

llvm-svn: 302154

7 years ago[DAGCombine] Transform (fadd A, (fmul B, -2.0)) -> (fsub A, (fadd B, B)).
Chad Rosier [Thu, 4 May 2017 14:14:44 +0000 (14:14 +0000)]
[DAGCombine] Transform (fadd A, (fmul B, -2.0)) -> (fsub A, (fadd B, B)).

Differential Revision: http://reviews.llvm.org/D32596

llvm-svn: 302153

7 years ago[ASAN] Add interceptor for __longjmp_chk
Peter Wu [Thu, 4 May 2017 14:03:57 +0000 (14:03 +0000)]
[ASAN] Add interceptor for __longjmp_chk

Summary:
glibc on Linux calls __longjmp_chk instead of longjmp (or _longjmp) when
_FORTIFY_SOURCE is defined. Ensure that an ASAN-instrumented program
intercepts this function when a system library calls it, otherwise the
stack might remain poisoned and result in CHECK failures and false
positives.

Fixes https://github.com/google/sanitizers/issues/721

Reviewed By: eugenis

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

llvm-svn: 302152

7 years agoDiagnosticsEngine should clear DelayedDiagID before reporting the
Alex Lorenz [Thu, 4 May 2017 13:56:51 +0000 (13:56 +0000)]
DiagnosticsEngine should clear DelayedDiagID before reporting the
delayed diagnostic

This fix avoids an infinite recursion that was uncovered in one of our internal
tests by r301992. The testcase is the most reduced version of that
auto-generated test.

This is an improved version of the reverted commit r302037. The previous fix
actually managed to expose another subtle bug whereby `fatal_too_many_errors`
error was reported twice, with the second report setting the
`FatalErrorOccurred` flag. That prevented the notes that followed the diagnostic
the caused `fatal_too_many_errors` to be emitted. This commit ensures that notes
that follow `fatal_too_many_errors` but that belong to the diagnostic that
caused `fatal_too_many_errors` won't be emitted by setting the
`FatalErrorOccurred` when emitting `fatal_too_many_errors`.

rdar://31962618

llvm-svn: 302151

7 years ago[X86][AVX512] Fix VPABSD file checks
Simon Pilgrim [Thu, 4 May 2017 13:42:57 +0000 (13:42 +0000)]
[X86][AVX512] Fix VPABSD file checks

Fix capitalization and string matching

llvm-svn: 302150

7 years ago[X86][SSE] Add i686 triple tests for partial vector and re-association
Simon Pilgrim [Thu, 4 May 2017 13:35:40 +0000 (13:35 +0000)]
[X86][SSE] Add i686 triple tests for partial vector and re-association

llvm-svn: 302149

7 years agoRefactoring with range-based for, NFC
Krzysztof Parzyszek [Thu, 4 May 2017 13:35:17 +0000 (13:35 +0000)]
Refactoring with range-based for, NFC

Patch by Wei-Ren Chen.

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

llvm-svn: 302148

7 years ago[compiler-rt][mips] Add support for quad precision builtins for mips64
Simon Dardis [Thu, 4 May 2017 13:34:17 +0000 (13:34 +0000)]
[compiler-rt][mips] Add support for quad precision builtins for mips64

Match the builtins that GCC provides for IEEE754 quad precision
on MIPS64. Also, enable building them with clang as PR20098 is resolved.

Disable tests for xf and xc modes as MIPS doesn't support that mode in
hardware or software.

Reviewers: slthakur

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

llvm-svn: 302147

7 years ago[SystemZ] Make copyPhysReg() add impl-use operands of super reg.
Jonas Paulsson [Thu, 4 May 2017 13:33:30 +0000 (13:33 +0000)]
[SystemZ]  Make copyPhysReg() add impl-use operands of super reg.

When a 128 bit COPY is lowered into two instructions, an impl-use operand of
the super-reg should be added to each new instruction in case one of the
sub-regs is undefined.

Review: Ulrich Weigand
llvm-svn: 302146

7 years ago[X86][SSE] Add i686 triple tests for PBLENDW commutation
Simon Pilgrim [Thu, 4 May 2017 13:08:09 +0000 (13:08 +0000)]
[X86][SSE] Add i686 triple tests for PBLENDW commutation

llvm-svn: 302145

7 years ago[X86][AVX1] Regenerate checks and add i686 triple tests for folded logical ops
Simon Pilgrim [Thu, 4 May 2017 13:00:30 +0000 (13:00 +0000)]
[X86][AVX1] Regenerate checks and add i686 triple tests for folded logical ops

llvm-svn: 302144

7 years agoAdd support of the next Ubuntu (Ubuntu 17.10 - Artful Aardvark)
Sylvestre Ledru [Thu, 4 May 2017 12:46:38 +0000 (12:46 +0000)]
Add support of the next Ubuntu (Ubuntu 17.10 - Artful Aardvark)

llvm-svn: 302143

7 years ago[CMake] Remove POLLY_TEST_DIRECTORIES.
Michael Kruse [Thu, 4 May 2017 12:21:25 +0000 (12:21 +0000)]
[CMake] Remove POLLY_TEST_DIRECTORIES.

The test subdirectory POLLY_TEST_DIRECTORIES was heavily outdated and
only used in out-of-LLVM-tree builds
(to generate polly-test-${subdir} targets).

llvm-svn: 302142

7 years agoRevert "IR: Use pointers instead of GUIDs to represent edges in the module summary...
Eric Liu [Thu, 4 May 2017 12:05:40 +0000 (12:05 +0000)]
Revert "IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI."

This reverts commit r302108.

llvm-svn: 302141

7 years agoRevert "IR: Use pointers instead of GUIDs to represent edges in the module summary...
Eric Liu [Thu, 4 May 2017 11:49:39 +0000 (11:49 +0000)]
Revert "IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI."

This reverts commit r302108. This causes crash in clang bootstrap with LTO.

Contacted the auther in the original commit.

llvm-svn: 302140

7 years ago[LLDB][MIPS] Fix TestStepOverBreakpoint.py failure.
Nitesh Jain [Thu, 4 May 2017 11:34:42 +0000 (11:34 +0000)]
[LLDB][MIPS] Fix TestStepOverBreakpoint.py failure.

Reviewers: jingham, labath

Subscribers: jaydeep, bhushan, lldb-commits, slthakur

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

llvm-svn: 302139

7 years ago[mips][XRay] Use the base version of emitXRayTable
Simon Dardis [Thu, 4 May 2017 11:03:50 +0000 (11:03 +0000)]
[mips][XRay] Use the base version of emitXRayTable

Follow up rL290858 by removing the MIPS specific version of XRayTable
emission in favour of the basic version.

This resolves a buildbot failure where the ELF sections were malformed
causing the linker to reject the object files with xray related sections.

Reviewers: dberris, slthakur

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

llvm-svn: 302138

7 years ago[ArgPromotion] Fix a truncated variable
Martin Storsjo [Thu, 4 May 2017 10:54:35 +0000 (10:54 +0000)]
[ArgPromotion] Fix a truncated variable

This fixes a regression since SVN rev 273808 (which was supposed to
not change functionality).

The regression caused miscompilations (noted in the wild when targeting
AArch64) on platforms with 32 bit long.

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

llvm-svn: 302137

7 years ago[Index] The relation between the declarations in template
Alex Lorenz [Thu, 4 May 2017 10:42:06 +0000 (10:42 +0000)]
[Index] The relation between the declarations in template
specializations that 'override' declarations in the base template should use
the 'specializationOf' relation instead of 'specializationOf | overrideOf'.

The indexer relations are meant to be orthogonal, so 'specializationOf' is
better than the combined relation.

llvm-svn: 302136

7 years ago[LLVM][inline-asm][Altmacor] Altmacro string delimiter '<..>'
Michael Zuckerman [Thu, 4 May 2017 10:37:00 +0000 (10:37 +0000)]
[LLVM][inline-asm][Altmacor] Altmacro string delimiter '<..>'

In this patch, I introduce a new altmacro string delimiter.
This review is the second review in a series of four reviews.
(one for each altmacro feature: LOCAL, string delimiter, string '!' escape sign and absolute expression as a string '%' ).

In the alternate macro mode, you can delimit strings with matching angle brackets <..>
when using it as a part of calling macro arguments.

As described in the https://sourceware.org/binutils/docs-2.27/as/Altmacro.html
"<string>
You can delimit strings with matching angle brackets."

assumptions:

1. If an argument begins with '<' and ends with '>'. The argument is considered as a string.
2. Except adding new string mark '<..>', a regular macro behavior is expected.
3. The altmacro cannot affect the regular less/greater behavior.
4. If a comma is present inside an angle brackets it considered as a character and not as a separator.

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

llvm-svn: 302135

7 years ago[ScopDetection] Check for already known required-invariant loads [NFC]
Tobias Grosser [Thu, 4 May 2017 10:16:20 +0000 (10:16 +0000)]
[ScopDetection] Check for already known required-invariant loads [NFC]

For certain test cases we spent over 50% of the scop detection time in
checking if a load is likely invariant. We can avoid most of these checks by
testing early on if a load is expected to be invariant. Doing this reduces
scop-detection time on a large benchmark from 52 seconds to just 25 seconds.

No functional change is expected.

llvm-svn: 302134

7 years agoMainLoop: Add unit tests
Pavel Labath [Thu, 4 May 2017 10:11:33 +0000 (10:11 +0000)]
MainLoop: Add unit tests

Summary:
This adds a couple of unit tests to the MainLoop class. To get the
kqueue based version of the signal handling passing, I needed to
modify the implementation a bit to make the queue object persistent.
Otherwise, only the signals which are send during the Run call would get
processed, which did not match the ppoll behaviour.

I also took the opportunity to remove the ForEach template functions and
replace them with something more reasonable.

Reviewers: beanz, eugene

Subscribers: lldb-commits, mgorny

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

llvm-svn: 302133

7 years agoAdjust test case to not trigger the SCEV optimization committed in r302096
Tobias Grosser [Thu, 4 May 2017 08:56:54 +0000 (08:56 +0000)]
Adjust test case to not trigger the SCEV optimization committed in r302096

This makes sure we still test the case that a PHI-NODE cannot be analyzed by
scalar evolution and consequently must be code generated explicitly.  As
Michael's optimization triggers only on a very specific "add %iv, %step"
pattern, just changing 'add' to 'mul' adds back test coverage.

llvm-svn: 302132

7 years ago[ARM] ACLE Chapter 9 intrinsics
Sam Parker [Thu, 4 May 2017 08:37:59 +0000 (08:37 +0000)]
[ARM] ACLE Chapter 9 intrinsics

Implemented the remaining integer data processing intrinsics from
the ARM ACLE v2.1 spec, such as parallel arithemtic and DSP style
multiplications.

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

llvm-svn: 302131

7 years agoDummy commit to trigger CMake reconfiguration and unbreak Sphinx build
Eric Fiselier [Thu, 4 May 2017 08:32:33 +0000 (08:32 +0000)]
Dummy commit to trigger CMake reconfiguration and unbreak Sphinx build

llvm-svn: 302130

7 years agoFix incorrect usage of __libcpp_mutex_trylock. Patch from Andrey Khalyavin
Eric Fiselier [Thu, 4 May 2017 07:45:09 +0000 (07:45 +0000)]
Fix incorrect usage of __libcpp_mutex_trylock. Patch from Andrey Khalyavin

llvm-svn: 302129

7 years agoUpdate Appveyor bot link to point to new llvm-mirror Appveyor account
Eric Fiselier [Thu, 4 May 2017 07:40:23 +0000 (07:40 +0000)]
Update Appveyor bot link to point to new llvm-mirror Appveyor account

llvm-svn: 302128

7 years ago[X86][AVX-512] Allow EVEX encoded instruction selection when available for mul v8i32.
Igor Breger [Thu, 4 May 2017 07:34:58 +0000 (07:34 +0000)]
[X86][AVX-512] Allow EVEX encoded instruction selection when available for mul v8i32.

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

llvm-svn: 302127