platform/upstream/llvm.git
7 years ago[docs] Fix a think-o in the Programmer's Manual.
Lang Hames [Tue, 28 Feb 2017 01:35:31 +0000 (01:35 +0000)]
[docs] Fix a think-o in the Programmer's Manual.

llvm-svn: 296421

7 years agoAdd test case for usubo combine. NFC.
Amaury Sechet [Tue, 28 Feb 2017 01:16:39 +0000 (01:16 +0000)]
Add test case for usubo combine. NFC.

llvm-svn: 296420

7 years ago[asan] Print a "PC is at a non-executable memory region" message if that's the case
Filipe Cabecinhas [Tue, 28 Feb 2017 00:56:43 +0000 (00:56 +0000)]
[asan] Print a "PC is at a non-executable memory region" message if that's the case

Summary: Points the user to look at function pointer assignments.

Reviewers: kcc, eugenis, kubamracek

Subscribers: llvm-commits

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

llvm-svn: 296419

7 years agoAdd MIR-level outlining pass
Matthias Braun [Tue, 28 Feb 2017 00:33:32 +0000 (00:33 +0000)]
Add MIR-level outlining pass

This is a patch for the outliner described in the RFC at:
http://lists.llvm.org/pipermail/llvm-dev/2016-August/104170.html

The outliner is a code-size reduction pass which works by finding
repeated sequences of instructions in a program, and replacing them with
calls to functions. This is useful to people working in low-memory
environments, where sacrificing performance for space is acceptable.

This adds an interprocedural outliner directly before printing assembly.
For reference on how this would work, this patch also includes X86
target hooks and an X86 test.

The outliner is run like so:

clang -mno-red-zone -mllvm -enable-machine-outliner file.c

Patch by Jessica Paquette<jpaquette@apple.com>!

rdar://29166825

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

llvm-svn: 296418

7 years agoAdd test case for computing known bits of substraction operations. NFC
Amaury Sechet [Tue, 28 Feb 2017 00:15:13 +0000 (00:15 +0000)]
Add test case for computing known bits of substraction operations. NFC

llvm-svn: 296417

7 years ago[CGP] Split some critical edges coming out of indirect branches
Michael Kuperstein [Tue, 28 Feb 2017 00:11:34 +0000 (00:11 +0000)]
[CGP] Split some critical edges coming out of indirect branches

Splitting critical edges when one of the source edges is an indirectbr
is hard in general (because it requires changing the memory the indirectbr
reads). But if a block only has a single indirectbr predecessor (which is
the common case), we can simulate splitting that edge by splitting
the destination block, and retargeting the *direct* branches.

This is motivated by the use of computed gotos in python 2.7: PyEval_EvalFrame()
ends up using an indirect branch with ~100 successors, and passing a constant to
each of those. Since MachineSink can't break indirect critical edges on demand
(and doing this in MIR doesn't look feasible), this causes us to emit about ~100
defs of registers containing constants, which we in the predecessor block, where
only one of those constants is used in each successor. So, at each computed goto,
we needlessly spill about a 100 constants to stack. The end result is that a
clang-compiled python interpreter can be about ~2.5x slower on a simple python
reduction loop than a gcc-compiled interpreter.

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

llvm-svn: 296416

7 years ago[PDB] Make streams carry their own endianness.
Zachary Turner [Tue, 28 Feb 2017 00:04:07 +0000 (00:04 +0000)]
[PDB] Make streams carry their own endianness.

Before the endianness was specified on each call to read
or write of the StreamReader / StreamWriter, but in practice
it's extremely rare for streams to have data encoded in
multiple different endiannesses, so we should optimize for the
99% use case.

This makes the code cleaner and more general, but otherwise
has NFC.

llvm-svn: 296415

7 years agoReland: [analyzer] NFC: Update test infrastructure to support multiple constraint...
Dominic Chen [Tue, 28 Feb 2017 00:02:36 +0000 (00:02 +0000)]
Reland: [analyzer] NFC: Update test infrastructure to support multiple constraint managers

Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952.

Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin

Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits

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

llvm-svn: 296414

7 years ago[DebugInfo] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Mon, 27 Feb 2017 23:43:14 +0000 (23:43 +0000)]
[DebugInfo] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 296413

7 years agoAh, this was an early exit to leave built products around, it wasn't meant to
Jason Molenda [Mon, 27 Feb 2017 23:31:29 +0000 (23:31 +0000)]
Ah, this was an early exit to leave built products around, it wasn't meant to
be checked in.

llvm-svn: 296412

7 years ago[SLP] Load sorting should not try to sort things that aren't loads.
Michael Kuperstein [Mon, 27 Feb 2017 23:18:11 +0000 (23:18 +0000)]
[SLP] Load sorting should not try to sort things that aren't loads.

We may get a VL where the first element is a load, but the others
aren't. Trying to sort such VLs can only lead to sorrow.

llvm-svn: 296411

7 years ago[MC] Implement the COFF directives in MCNullStreamer.
Dan Gohman [Mon, 27 Feb 2017 23:10:18 +0000 (23:10 +0000)]
[MC] Implement the COFF directives in MCNullStreamer.

This fixes -filetype=null errors introduced in r296403.

llvm-svn: 296410

7 years agoAMDGPU: Basic folds for fmed3 intrinsic
Matt Arsenault [Mon, 27 Feb 2017 23:08:49 +0000 (23:08 +0000)]
AMDGPU: Basic folds for fmed3 intrinsic

Constant fold, canonicalize constants to RHS,
reduce to minnum/maxnum when inputs are nan/undef.

llvm-svn: 296409

7 years agoclang-format: Don't leave behind temp files in -i mode on Windows, PR26125, reloaded
Nico Weber [Mon, 27 Feb 2017 22:59:58 +0000 (22:59 +0000)]
clang-format: Don't leave behind temp files in -i mode on Windows, PR26125, reloaded

Second attempt after http://llvm.org/viewvc/llvm-project?rev=296166&view=rev

In the first attempt, Code (the memory buffer backing the input file) was reset
before overwriteChangedFiles() was called, but overwriteChangedFiles() still
reads from it.  This time, load the whole input file into memory instead of
using mmap when formatting in-place.

(Since the test is identical to what was in the repo before chapuni's revert,
svn diff doesn't show it – see the above link for the test.)

https://reviews.llvm.org/D30385

llvm-svn: 296408

7 years agoRemove some code accidentally left in.
Zachary Turner [Mon, 27 Feb 2017 22:57:32 +0000 (22:57 +0000)]
Remove some code accidentally left in.

llvm-svn: 296407

7 years agoupdate pbxproj to match cmake config, broken in r296335
Tim Hammerquist [Mon, 27 Feb 2017 22:56:27 +0000 (22:56 +0000)]
update pbxproj to match cmake config, broken in r296335

llvm-svn: 296406

7 years ago[AddressSanitizer] Put shadow at 0 for Fuchsia
Petr Hosek [Mon, 27 Feb 2017 22:49:37 +0000 (22:49 +0000)]
[AddressSanitizer] Put shadow at 0 for Fuchsia

The Fuchsia ASan runtime reserves the low part of the address space.

Patch by Roland McGrath

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

llvm-svn: 296405

7 years ago[CodeGen] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Mon, 27 Feb 2017 22:45:06 +0000 (22:45 +0000)]
[CodeGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 296404

7 years ago[MC] Factor out non-COFF handling of COFF-specific directives.
Dan Gohman [Mon, 27 Feb 2017 22:44:37 +0000 (22:44 +0000)]
[MC] Factor out non-COFF handling of COFF-specific directives.

Instead of requiring every non-COFF MCObjectStreamer to implement the
COFF hooks just to do an llvm_unreachable to say that they're not
supported, do the llvm_unreachable in the default implementation, as
suggested by rnk in https://reviews.llvm.org/D26722.

llvm-svn: 296403

7 years ago[WebAssembly] Add some comments and tidy up whitespace.
Dan Gohman [Mon, 27 Feb 2017 22:41:39 +0000 (22:41 +0000)]
[WebAssembly] Add some comments and tidy up whitespace.

llvm-svn: 296402

7 years agoAMDGPU: Use v_med3_{f16|i16|u16}
Matt Arsenault [Mon, 27 Feb 2017 22:40:39 +0000 (22:40 +0000)]
AMDGPU: Use v_med3_{f16|i16|u16}

llvm-svn: 296401

7 years agoRefactor write{Global,Local}Symbols.
Rui Ueyama [Mon, 27 Feb 2017 22:39:50 +0000 (22:39 +0000)]
Refactor write{Global,Local}Symbols.

This part of code is hard to understand because NumLocals does not
actually mean the number of local symbols but something else (!).
We need to rewrite. But before that we need to clean it up.

llvm-svn: 296400

7 years ago[WebAssembly] Split CFG-sorting into its own pass. NFC.
Dan Gohman [Mon, 27 Feb 2017 22:38:58 +0000 (22:38 +0000)]
[WebAssembly] Split CFG-sorting into its own pass. NFC.

CFG sorting was already an independent algorithm from block/loop insertion;
this change makes it more convenient to debug.

llvm-svn: 296399

7 years agoRevert r296366 "[InlineFunction] add nonnull assumptions based on argument attributes"
Hans Wennborg [Mon, 27 Feb 2017 22:33:02 +0000 (22:33 +0000)]
Revert r296366 "[InlineFunction] add nonnull assumptions based on argument attributes"

It causes miscompiles e.g. during self-host of Clang (PR32082).

llvm-svn: 296398

7 years agoAdd missing namespace qualifier.
Zachary Turner [Mon, 27 Feb 2017 22:17:50 +0000 (22:17 +0000)]
Add missing namespace qualifier.

llvm-svn: 296397

7 years agoAMDGPU: Support v2i16/v2f16 packed operations
Matt Arsenault [Mon, 27 Feb 2017 22:15:25 +0000 (22:15 +0000)]
AMDGPU: Support v2i16/v2f16 packed operations

llvm-svn: 296396

7 years agoISel: We need to notify FastIS of the IMPLICIT_DEF we created in createSwiftErrorEntr...
Arnold Schwaighofer [Mon, 27 Feb 2017 22:12:06 +0000 (22:12 +0000)]
ISel: We need to notify FastIS of the IMPLICIT_DEF we created in createSwiftErrorEntriesInEntryBlock

Otherwise, it will insert instructions before it.

rdar://30536186

llvm-svn: 296395

7 years ago[PDB] Partial resubmit of r296215, which improved PDB Stream Library.
Zachary Turner [Mon, 27 Feb 2017 22:11:43 +0000 (22:11 +0000)]
[PDB] Partial resubmit of r296215, which improved PDB Stream Library.

This was reverted because it was breaking some builds, and
because of incorrect error code usage.  Since the CL was
large and contained many different things, I'm resubmitting
it in pieces.

This portion is NFC, and consists of:

1) Renaming classes to follow a consistent naming convention.
2) Fixing the const-ness of the interface methods.
3) Adding detailed doxygen comments.
4) Fixing a few instances of passing `const BinaryStream& X`.  These
   are now passed as `BinaryStreamRef X`.

llvm-svn: 296394

7 years agoRevert "DAG: Check if extract_vector_elt is legal or custom"
Matt Arsenault [Mon, 27 Feb 2017 21:59:07 +0000 (21:59 +0000)]
Revert "DAG: Check if extract_vector_elt is legal or custom"

This reverts r295782. This could potentially result in some
legalization loops and I avoided the need for this.

llvm-svn: 296393

7 years agoEmpty line. NFCI
Xin Tong [Mon, 27 Feb 2017 21:51:48 +0000 (21:51 +0000)]
Empty line. NFCI

llvm-svn: 296392

7 years ago[PGO] Fix a bug in reading text format value profile.
Rong Xu [Mon, 27 Feb 2017 21:42:39 +0000 (21:42 +0000)]
[PGO] Fix a bug in reading text format value profile.

Summary: Should use the Valuekind read from the profile.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits, xur

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

llvm-svn: 296391

7 years ago[clangd] Make clangd install to bin
Benjamin Kramer [Mon, 27 Feb 2017 21:40:35 +0000 (21:40 +0000)]
[clangd] Make clangd install to bin

This allows the install target to also install clangd to bin, so that
it can be deployed and used outside the build tree.

Patch by Marc-Andre Laperle!
Differential Revision: https://reviews.llvm.org/D30425

llvm-svn: 296390

7 years ago[ARM] don't transform an add(ext Cond), C to select unless there's a setcc of the...
Sanjay Patel [Mon, 27 Feb 2017 21:30:54 +0000 (21:30 +0000)]
[ARM] don't transform an add(ext Cond), C to select unless there's a setcc of the condition

The transform in question claims to be doing:

// fold (add (select cc, 0, c), x) -> (select cc, x, (add, x, c))

...starting in PerformADDCombineWithOperands(), but it wasn't actually checking for a setcc node
for the sext/zext patterns.

This is exactly the opposite of a transform I'd like to add to DAGCombiner's foldSelectOfConstants(),
so I was seeing infinite loops with my draft of a patch applied.

The changes in select_const.ll look positive (less instructions). The change in arm-and-tst-peephole.ll
is unrelated. We're changing the input IR in that test to preserve the intent of the test, but that's
not affected by this code change.

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

llvm-svn: 296389

7 years agoPR32042: Create inlined debug info for EmitInlinedInheritingCXXConstructorCall.
Adrian Prantl [Mon, 27 Feb 2017 21:30:05 +0000 (21:30 +0000)]
PR32042: Create inlined debug info for EmitInlinedInheritingCXXConstructorCall.

When clang emits an inheriting C++ constructor it may inline code
during the CodeGen phase. This patch ensures that any debug info in
this inlined code gets a proper inlined location. Otherwise we can end
up with invalid debug info metadata, since all inlined local variables
and function arguments would be reparented into the call site.

Analogous to ApplyInlineLocation this patch introduces a
ApplyInlineDebugLocation scoped helper to facilitate entering an
inlined scope and cleaning up afterwards.

This fixes one of the issues discovered in PR32042.

rdar://problem/30679307

llvm-svn: 296388

7 years agoUBSan docs: Explicitly mention that `-fsanitize=unsigned-integer-overflow` does not...
Nico Weber [Mon, 27 Feb 2017 21:27:07 +0000 (21:27 +0000)]
UBSan docs: Explicitly mention that `-fsanitize=unsigned-integer-overflow` does not catch UB.

https://reviews.llvm.org/D27455

llvm-svn: 296387

7 years agoRemove unused variable
David Blaikie [Mon, 27 Feb 2017 21:14:42 +0000 (21:14 +0000)]
Remove unused variable

llvm-svn: 296386

7 years agoRemove XFAIL in implicit_deduction_guides tests
Steven Wu [Mon, 27 Feb 2017 21:10:41 +0000 (21:10 +0000)]
Remove XFAIL in implicit_deduction_guides tests

The clang assertion causing these tests failing with sanitizer is fixed
in r295794. All the bots running libcxx tests should be upgraded and
running the compiler with the fix.

llvm-svn: 296385

7 years ago[Support][Error] Add a 'cantFail' utility function for known-safe calls to
Lang Hames [Mon, 27 Feb 2017 21:09:47 +0000 (21:09 +0000)]
[Support][Error] Add a 'cantFail' utility function for known-safe calls to
fallible functions.

Some fallible functions (those returning Error or Expected<T>) may only fail
for a subset of their inputs. For example, a "safe" square root function will
succeed for all finite positive inputs:

  Expected<double> safeSqrt(double d) {
    if (d < 0 && !isnan(d) && !isinf(d))
      return make_error<...>("Cannot sqrt -ve values, nans or infs");
    return sqrt(d);
  }

At a safe callsite for such a function, checking the error return value is
redundant:

  if (auto ValOrErr = safeSqrt(42.0)) {
    // use *ValOrErr.
  } else
    llvm_unreachable("safeSqrt should always succeed for +ve values");

The cantFail function wraps this check and extracts the contained value,
simplifying control flow:

  double Result = cantFail(safeSqrt(42.0));

This function should be used with care: it is a programmatic error to wrap a
call with cantFail if it can in fact fail. For debug builds this will
result in llvm_unreachable being called. For release builds the behavior is
undefined.

Use of this function is likely to be rare in library code, but more common
for tool and unit-test code where inputs and mock functions may be known to be
safe.

llvm-svn: 296384

7 years agoClarify benchmark conditions.
Rui Ueyama [Mon, 27 Feb 2017 21:07:50 +0000 (21:07 +0000)]
Clarify benchmark conditions.

llvm-svn: 296383

7 years agoAMDGPU: Add some of the new gfx9 VOP3 instructions
Matt Arsenault [Mon, 27 Feb 2017 21:04:41 +0000 (21:04 +0000)]
AMDGPU: Add some of the new gfx9 VOP3 instructions

llvm-svn: 296382

7 years ago[X86][SSE] Attempt to extract vector elements through target shuffles
Simon Pilgrim [Mon, 27 Feb 2017 21:01:57 +0000 (21:01 +0000)]
[X86][SSE] Attempt to extract vector elements through target shuffles

DAGCombiner already supports peeking thorough shuffles to improve vector element extraction, but legalization often leaves us in situations where we need to extract vector elements after shuffles have already been lowered.

This patch adds support for VECTOR_EXTRACT_ELEMENT/PEXTRW/PEXTRB instructions to attempt to handle target shuffles as well. I've covered some basic scenarios including handling shuffle mask scaling and the implicit zero-extension of PEXTRW/PEXTRB, there is more that could be done here (that I've mentioned in TODOs) but I haven't found many cases where its worth it.

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

llvm-svn: 296381

7 years agoAMDGPU: Support inlineasm for packed instructions
Matt Arsenault [Mon, 27 Feb 2017 20:52:10 +0000 (20:52 +0000)]
AMDGPU: Support inlineasm for packed instructions

Add packed types as legal so they may be used with inlineasm.
Keep all operations expanded for now.

llvm-svn: 296379

7 years agoAdd terminator to .eh_frame sections
Rui Ueyama [Mon, 27 Feb 2017 20:44:59 +0000 (20:44 +0000)]
Add terminator to .eh_frame sections

Patch by Mark Kettenis.

Currenlty ld.lld does not add a terminator (a CIE with its length field
set to zero) to the .eh_frame sections it generates.  While the relevant
standards (the AMD64 SysV ABI and the Linux LSB) are not explicit about
this, such a terminator is expected by some unwinder implementations and
seems to be always emitted by ld.bfd. In addition to that, the Linux LSB

  https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html#EHFRAME

explicitly says that

  The .eh_frame section shall contain 1 or more Call Frame Information
  (CFI) records.

Currently, if the .eh_frame sections of the input files only contain
terminators, ld.lld emits a zero=sized .eh_frame section
which clearly doesn't meet that requirement.

The diff makes sure a terminator gets added to each .eh_frame section
and adjusts all the relevant tests to account for that.  An additional
test isn't needed as these adjustments mean that the existence of the
terminator is tested for by several tests already.

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

llvm-svn: 296378

7 years agoDe-template ResolvedReloc as it doesn't actually depends on ELFT.
Rui Ueyama [Mon, 27 Feb 2017 20:32:34 +0000 (20:32 +0000)]
De-template ResolvedReloc as it doesn't actually depends on ELFT.

Pointed out by Bob Haarman.

llvm-svn: 296377

7 years ago[SLP] Use different flags in tests for reduction ops and extra args.
Alexey Bataev [Mon, 27 Feb 2017 20:22:44 +0000 (20:22 +0000)]
[SLP] Use different flags in tests for reduction ops and extra args.

llvm-svn: 296376

7 years agoAMDGPU: Don't fold immediate if clamp/omod are set
Matt Arsenault [Mon, 27 Feb 2017 20:21:31 +0000 (20:21 +0000)]
AMDGPU: Don't fold immediate if clamp/omod are set

Doesn't fix any practical problems because clamp/omod
are currently folded after peephole optimizer.

llvm-svn: 296375

7 years ago[ubsan] Factor out logic to emit a range check. NFC.
Vedant Kumar [Mon, 27 Feb 2017 19:46:19 +0000 (19:46 +0000)]
[ubsan] Factor out logic to emit a range check. NFC.

This is a readability improvement, but it will also help prep an
upcoming patch to detect UB loads from bitfields.

llvm-svn: 296374

7 years agoenable -flto=thin in clang-cl
Bob Haarman [Mon, 27 Feb 2017 19:40:19 +0000 (19:40 +0000)]
enable -flto=thin in clang-cl

Summary: This enables LTO to be used with the clang-cl frontend.

Reviewers: rnk, hans

Reviewed By: hans

Subscribers: pcc, cfe-commits, mehdi_amini, Prazek

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

llvm-svn: 296373

7 years agoAMDGPU: Fold omod into instructions
Matt Arsenault [Mon, 27 Feb 2017 19:35:42 +0000 (19:35 +0000)]
AMDGPU: Fold omod into instructions

llvm-svn: 296372

7 years ago[TailDuplicator] Maintain DebugLoc for branch instructions
Taewook Oh [Mon, 27 Feb 2017 19:30:01 +0000 (19:30 +0000)]
[TailDuplicator] Maintain DebugLoc for branch instructions

Summary: Existing implementation of duplicateSimpleBB function drops DebugLoc metadata of branch instructions during the transformation. This patch addresses this issue by making newly created branch instructions to keep the metadata of replaced branch instructions.

Reviewers: qcolombet, craig.topper, aprantl, MatzeB, sanjoy, dblaikie

Reviewed By: dblaikie

Subscribers: dblaikie, llvm-commits

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

llvm-svn: 296371

7 years agoAMDGPU: Add f16 to shader calling conventions
Matt Arsenault [Mon, 27 Feb 2017 19:24:47 +0000 (19:24 +0000)]
AMDGPU: Add f16 to shader calling conventions

Mostly useful for writing tests for f16 features.

llvm-svn: 296370

7 years ago[SLP] Modify test to check IR flags propagation for extra args.
Alexey Bataev [Mon, 27 Feb 2017 19:16:09 +0000 (19:16 +0000)]
[SLP] Modify test to check IR flags propagation for extra args.

llvm-svn: 296369

7 years agoAMDGPU: Add VOP3P instruction format
Matt Arsenault [Mon, 27 Feb 2017 18:49:11 +0000 (18:49 +0000)]
AMDGPU: Add VOP3P instruction format

Add a few non-VOP3P but instructions related to packed.

Includes hack with dummy operands for the benefit of the assembler

llvm-svn: 296368

7 years agoRefactor xaluo.ll and xmulo.ll tests. NFC
Amaury Sechet [Mon, 27 Feb 2017 18:32:54 +0000 (18:32 +0000)]
Refactor xaluo.ll and xmulo.ll tests. NFC

llvm-svn: 296367

7 years ago[InlineFunction] add nonnull assumptions based on argument attributes
Sanjay Patel [Mon, 27 Feb 2017 18:13:48 +0000 (18:13 +0000)]
[InlineFunction] add nonnull assumptions based on argument attributes

This was suggested in D27855: have the inliner add assumptions, so we don't
lose nonnull info provided by argument attributes.

This still doesn't solve PR28430 (dyn_cast), but this gets us closer.

https://reviews.llvm.org/D29999

llvm-svn: 296366

7 years ago[Hexagon] Defs and clobbers can overlap
Krzysztof Parzyszek [Mon, 27 Feb 2017 18:03:35 +0000 (18:03 +0000)]
[Hexagon] Defs and clobbers can overlap

llvm-svn: 296365

7 years agoFix a bug when unswitching on partial LIV for SwitchInst
Xin Tong [Mon, 27 Feb 2017 18:00:13 +0000 (18:00 +0000)]
Fix a bug when unswitching on partial LIV for SwitchInst

Summary: Fix a bug when unswitching on partial LIV for SwitchInst.

Reviewers: hfinkel, efriedma, sanjoy

Reviewed By: sanjoy

Subscribers: david2050, mzolotukhin, llvm-commits

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

llvm-svn: 296363

7 years agoFix comments. NFC.
Rong Xu [Mon, 27 Feb 2017 17:59:01 +0000 (17:59 +0000)]
Fix comments. NFC.

Change "Thin-LTO" to "ThinLTO" in the comments for consistency.

llvm-svn: 296362

7 years ago[Cmake] Optionally use a system isl version.
Michael Kruse [Mon, 27 Feb 2017 17:54:25 +0000 (17:54 +0000)]
[Cmake] Optionally use a system isl version.

This patch adds an option to build against a version of libisl already
installed on the system. The installation is autodetected using the
pkg-config file shipped with isl.

The detection of the library is in the FindISL.cmake module that creates
an imported target.

Contributed-by: Philip Pfaffe <philip.pfaffe@gmail.com>
Differential Revision: https://reviews.llvm.org/D30043

llvm-svn: 296361

7 years agoSupport NetBSD Thread ID in lldb-server tests
Kamil Rytarowski [Mon, 27 Feb 2017 17:52:48 +0000 (17:52 +0000)]
Support NetBSD Thread ID in lldb-server tests

Summary:
Native Thread ID is retrieved with _lwp_self() on NetBSD.

The returned value is of type int32_t, but for consistency with other Operating Systems cast it to uint64_t.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, labath, clayborg, emaste

Reviewed By: labath, clayborg

Subscribers: #lldb

Tags: #lldb

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

llvm-svn: 296360

7 years agoFix the project name in the license file.
Arnaud A. de Grandmaison [Mon, 27 Feb 2017 17:47:58 +0000 (17:47 +0000)]
Fix the project name in the license file.

llvm-svn: 296359

7 years agoAdd libcxxabi's LICENSE.TXT to libunwind.
Arnaud A. de Grandmaison [Mon, 27 Feb 2017 17:33:20 +0000 (17:33 +0000)]
Add libcxxabi's LICENSE.TXT to libunwind.

When libunwind was spinned off libcxxabi, most file were copied from
libcxxabi to libunwind.  However, libc++abi's toplevel LICENSE.TXT was
forgotten in the copying. It's considered a good practice to have the
license file at the root of the project, and making linunwind a separate
project was not supposed to change its licensing. Besides, several
header files refer to the LICENSE.TXT, so copy the one from libc++abi.

llvm-svn: 296358

7 years agoFix LLVM module build
Steven Wu [Mon, 27 Feb 2017 16:56:37 +0000 (16:56 +0000)]
Fix LLVM module build

Add WasmRelocs/WebAssembly.def to textual include header.

llvm-svn: 296356

7 years ago[X86] Use APInt instead of SmallBitVector tracking undef elements from getTargetConst...
Craig Topper [Mon, 27 Feb 2017 16:15:32 +0000 (16:15 +0000)]
[X86] Use APInt instead of SmallBitVector tracking undef elements from getTargetConstantBitsFromNode and getConstVector.

Summary:
SmallBitVector uses a malloc for more than 58 bits on a 64-bit target and more than 27 bits on a 32-bit target. Some of the vector types we deal with here use more than those number of elements and therefore cause a malloc.

APInt on the other hand supports up to 64 bits without a malloc. That's the maximum number of bits we need here so we can avoid a malloc for all cases by using APInt.

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 296355

7 years ago[X86] Use APInt instead of SmallBitVector for tracking Zeroable elements in shuffle...
Craig Topper [Mon, 27 Feb 2017 16:15:30 +0000 (16:15 +0000)]
[X86] Use APInt instead of SmallBitVector for tracking Zeroable elements in shuffle lowering

Summary:
SmallBitVector uses a malloc for more than 58 bits on a 64-bit target and more than 27 bits on a 32-bit target. Some of the vector types we deal with here use more than those number of elements and therefore cause a malloc.

APInt on the other hand supports up to 64 bits without a malloc. That's the maximum number of bits we need here so we can avoid a malloc for all cases by using APInt.

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 296354

7 years ago[X86] Fix SmallVector sizes in constant pool shuffle decoding to avoid heap allocation
Craig Topper [Mon, 27 Feb 2017 16:15:27 +0000 (16:15 +0000)]
[X86] Fix SmallVector sizes in constant pool shuffle decoding to avoid heap allocation

Some of the vectors are under sized to avoid heap allocation. In one case the vector was oversized.

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

llvm-svn: 296353

7 years ago[X86] Use APInt instead of SmallBitVector for tracking undef elements in constant...
Craig Topper [Mon, 27 Feb 2017 16:15:25 +0000 (16:15 +0000)]
[X86] Use APInt instead of SmallBitVector for tracking undef elements in constant pool shuffle decoding

Summary:
SmallBitVector uses a malloc for more than 58 bits on a 64-bit target and more than 27 bits on a 32-bit target. Some of the vector types we deal with here use more than those number of elements and therefore cause a malloc.

APInt on the other hand supports up to 64 bits without a malloc. That's the maximum number of bits we need here so we can avoid a malloc for all cases by using APInt. This will incur a minor increase in stack usage due to APInt storing the bit count separately from the data bits unlike SmallBitVector, but that should be ok.

Reviewers: RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 296352

7 years agoFix LIBCXX_HAS_EXTERNAL_THREAD_API builds. NFC.
Asiri Rathnayake [Mon, 27 Feb 2017 16:10:57 +0000 (16:10 +0000)]
Fix LIBCXX_HAS_EXTERNAL_THREAD_API builds. NFC.

Add the missing check in the __config header.

llvm-svn: 296351

7 years agoRemove an empty line in icmp-illegal.ll . NFC
Amaury Sechet [Mon, 27 Feb 2017 16:09:44 +0000 (16:09 +0000)]
Remove an empty line in icmp-illegal.ll . NFC

llvm-svn: 296350

7 years ago[SLP] A test for a fix of PR32038.
Alexey Bataev [Mon, 27 Feb 2017 16:07:10 +0000 (16:07 +0000)]
[SLP] A test for a fix of PR32038.

llvm-svn: 296349

7 years ago[DeLICM] Add nomap regressions tests. NFC.
Michael Kruse [Mon, 27 Feb 2017 15:53:18 +0000 (15:53 +0000)]
[DeLICM] Add nomap regressions tests. NFC.

These verify that some scalars are not mapped because it would be
incorrect to do so.

For these check we verify that no transformation has been executed from
output of the pass's '-analyze'. Adding optimization remarks is not useful
as it would result in too many messages, even repeated ones. I avoided
checking the '-debug-only=polly-delicm' output which is an antipattern.

llvm-svn: 296348

7 years ago[DeLICM] Statistics for use in regression tests.
Michael Kruse [Mon, 27 Feb 2017 15:53:13 +0000 (15:53 +0000)]
[DeLICM] Statistics for use in regression tests.

Print some measurements of the DeLICM transformation at -analyze to be
used in regression tests.

llvm-svn: 296347

7 years agoFix typo in error message. NFC.
Asiri Rathnayake [Mon, 27 Feb 2017 15:49:51 +0000 (15:49 +0000)]
Fix typo in error message. NFC.

llvm-svn: 296346

7 years agoLoop predication expand both sides of the widened condition
Artur Pilipenko [Mon, 27 Feb 2017 15:44:49 +0000 (15:44 +0000)]
Loop predication expand both sides of the widened condition

This is a fix for a loop predication bug which resulted in malformed IR generation.

Loop invariant side of the widened condition is not guaranteed to be available in the preheader as is, so we need to expand it as well. See added unsigned_loop_0_to_n_hoist_length test for example.

Reviewed By: sanjoy, mkazantsev

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

llvm-svn: 296345

7 years agoAttempt to fix arm-native libcxxabi tests for the no-exceptions variant
Asiri Rathnayake [Mon, 27 Feb 2017 15:31:34 +0000 (15:31 +0000)]
Attempt to fix arm-native libcxxabi tests for the no-exceptions variant

These tests embed calls to exceptions-related symbols from the abi library,
which are absent in the no-exceptions variant. The tests need to be marked
as unsupported for the no-exceptions configuration.

llvm-svn: 296344

7 years agoAArch64InstPrinter: rewrite of printSysAlias
Sjoerd Meijer [Mon, 27 Feb 2017 14:45:34 +0000 (14:45 +0000)]
AArch64InstPrinter: rewrite of printSysAlias

This is a cleanup/rewrite of the printSysAlias function. This was not using the
tablegen instruction descriptions, but was "manually" decoding the
instructions. This has been replaced with calls to lookup_XYZ_ByEncoding
tablegen calls.

This revealed several problems. First, instruction IVAU had the wrong encoding.
This was cancelled out by the parser that incorrectly matched the wrong
encoding. Second, instruction CVAP was missing from the SystemOperands tablegen
descriptions, so this has been added. And third, the required target features
were not captured in the tablegen descriptions, so support for this has also
been added.

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

llvm-svn: 296343

7 years ago[ARM] LSL #0 is an alias of MOV
John Brawn [Mon, 27 Feb 2017 14:40:51 +0000 (14:40 +0000)]
[ARM] LSL #0 is an alias of MOV

Currently we handle this correctly in arm, but in thumb we don't which leads to
an unpredictable instruction being emitted for LSL #0 in an IT block and SP not
being permitted in some cases when it should be.

For the thumb2 LSL we can handle this by making LSL #0 an alias of MOV in the
.td file, but for thumb1 we need to handle it in checkTargetMatchPredicate to
get the IT handling right. We also need to adjust the handling of
MOV rd, rn, LSL #0 to avoid generating the 16-bit encoding in an IT block. We
should also adjust it to allow SP in the same way that it is allowed in
MOV rd, rn, but I haven't done that here because it looks like it would take
quite a lot of work to get right.

Additionally correct the selection of the 16-bit shift instructions in
processInstruction, where it was checking if the two registers were equal when
it should have been checking if they were low. It appears that previously this
code was never executed and the 16-bit encoding was selected by default, but
the other changes I've done here have somehow made it start being used.

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

llvm-svn: 296342

7 years ago[clang-format] Add a NamespaceEndCommentsFixer
Krasimir Georgiev [Mon, 27 Feb 2017 13:28:36 +0000 (13:28 +0000)]
[clang-format] Add a NamespaceEndCommentsFixer

Summary:
This patch adds a NamespaceEndCommentsFixer TokenAnalyzer for clang-format,
which fixes end namespace comments.
It currently supports inserting and updating existing wrong comments.

Example source:
```
namespace A {
int i;
}

namespace B {
int j;
} // namespace A
```

after formatting:
```
namespace A {
int i;
} // namespace A

namespace B {
int j;
} // namespace B
```

Reviewers: klimek, djasper

Reviewed By: djasper

Subscribers: klimek, mgorny

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

llvm-svn: 296341

7 years agoAdd a test we already get right.
Rafael Espindola [Mon, 27 Feb 2017 13:21:18 +0000 (13:21 +0000)]
Add a test we already get right.

It would have found a problem in a patch I am writing.

llvm-svn: 296339

7 years agoFix cmake dependency for the external-thread-library variant. NFC.
Asiri Rathnayake [Mon, 27 Feb 2017 13:19:25 +0000 (13:19 +0000)]
Fix cmake dependency for the external-thread-library variant. NFC.

llvm-svn: 296338

7 years ago[clang-move] Extend clang-move to support moving global variable.
Haojian Wu [Mon, 27 Feb 2017 13:19:13 +0000 (13:19 +0000)]
[clang-move] Extend clang-move to support moving global variable.

Summary: Also support dumping global variables.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: cfe-commits

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

llvm-svn: 296337

7 years ago[DAGCombine] Fix for a load combine bug with non-zero offset patterns on BE targets
Artur Pilipenko [Mon, 27 Feb 2017 13:04:23 +0000 (13:04 +0000)]
[DAGCombine] Fix for a load combine bug with non-zero offset patterns on BE targets

This pattern is essentially a i16 load from p+1 address:

  %p1.i16 = bitcast i8* %p to i16*
  %p2.i8 = getelementptr i8, i8* %p, i64 2
  %v1 = load i16, i16* %p1.i16
  %v2.i8 = load i8, i8* %p2.i8
  %v2 = zext i8 %v2.i8 to i16
  %v1.shl = shl i16 %v1, 8
  %res = or i16 %v1.shl, %v2

Current implementation would identify %v1 load as the first byte load and would mistakenly emit a i16 load from %p1.i16 address. This patch adds a check that the first byte is loaded from a non-zero offset of the first load address. This way this address can be used as the base address for the combined value. Otherwise just give up combining.

llvm-svn: 296336

7 years agoMerge Linux and FreeBSD arm register contexts
Pavel Labath [Mon, 27 Feb 2017 13:00:50 +0000 (13:00 +0000)]
Merge Linux and FreeBSD arm register contexts

Summary:
These two register contexts were identical, so this shouldn't cause any
regressions, but I'd appreciate it if you can check that this at least compiles.

Reviewers: emaste, sas

Subscribers: aemerson, rengolin, lldb-commits, mgorny

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

llvm-svn: 296335

7 years agoFix MinidumpParserTest on 32-bit arches
Pavel Labath [Mon, 27 Feb 2017 12:21:20 +0000 (12:21 +0000)]
Fix MinidumpParserTest on 32-bit arches

load_size should be 64-bit unconditionally to match the underlying API.
This makes sure the MAX value correctly signals to auto-detect the file
size when mmap()ing.

llvm-svn: 296334

7 years agoRemove the callback-based log channel registration mechanism
Pavel Labath [Mon, 27 Feb 2017 12:21:16 +0000 (12:21 +0000)]
Remove the callback-based log channel registration mechanism

All the existing channels have beens switched to the new mechanism and
this code is now unused.

llvm-svn: 296333

7 years ago[DAGCombine] NFC. MatchLoadCombine extract MemoryByteOffset lambda helper
Artur Pilipenko [Mon, 27 Feb 2017 11:42:54 +0000 (11:42 +0000)]
[DAGCombine] NFC. MatchLoadCombine extract MemoryByteOffset lambda helper

This refactoring will simplify the upcoming change to fix the bug in folding patterns with non-zero offsets on BE targets.

llvm-svn: 296332

7 years ago[DAGCombine] NFC. MatchLoadCombine remember the first byte provider, not the load...
Artur Pilipenko [Mon, 27 Feb 2017 11:40:14 +0000 (11:40 +0000)]
[DAGCombine] NFC. MatchLoadCombine remember the first byte provider, not the load node

This refactoring will simplify the upcoming change to fix a bug in folding patterns with non-zero offsets on BE targets.

llvm-svn: 296331

7 years agoclang-format: [JS] whitespace after async in arrow functions.
Martin Probst [Mon, 27 Feb 2017 11:15:53 +0000 (11:15 +0000)]
clang-format: [JS] whitespace after async in arrow functions.

Summary:
Async arrow functions should be marked with a whitespace after the async keyword, before the parameter list:
    x = async () => foo();

Before:
    x = async() => foo();

This makes it easier to tell apart an async arrow function from a call to a function called async.

Reviewers: bkramer

Subscribers: cfe-commits, klimek

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

llvm-svn: 296330

7 years agoLog: Fix a regression in handling log options
Pavel Labath [Mon, 27 Feb 2017 11:05:39 +0000 (11:05 +0000)]
Log: Fix a regression in handling log options

The channel refactor introduced a regression where we were not honoring
the log options passed when enabling the channel. Fix that and add a
test.

llvm-svn: 296329

7 years agoSwitch SBBreakpoint to storing a weak_ptr of the internal breakpoint object
Pavel Labath [Mon, 27 Feb 2017 11:05:34 +0000 (11:05 +0000)]
Switch SBBreakpoint to storing a weak_ptr of the internal breakpoint object

Summary:
There is nothing we can do with the breakpoint once the associated
target becomes deleted. This will make sure we don't hold on to more
resources than we need in this case. In particular, this fixes the case
TestStepOverBreakpoint on windows, where a lingering SBBreakpoint object
causes us to nor unmap the executable file from memory.

Reviewers: clayborg, jingham

Subscribers: lldb-commits

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

llvm-svn: 296328

7 years agoAArch64AsmParser: don't try to parse “[1]” for non-vector register operands
Sjoerd Meijer [Mon, 27 Feb 2017 10:51:11 +0000 (10:51 +0000)]
AArch64AsmParser: don't try to parse “[1]” for non-vector register operands

There are no instructions that have "[1]" as part of the assembly string;
FMOVXDhighr is out of date. This removes dead code.

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

llvm-svn: 296327

7 years ago[analyzer] clarify 'result is garbage value' when it is out of bounds
Daniel Marjamaki [Mon, 27 Feb 2017 10:44:24 +0000 (10:44 +0000)]
[analyzer] clarify 'result is garbage value' when it is out of bounds

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

llvm-svn: 296326

7 years agoDisable the parallel code generation in case of extension nodes
Roman Gareev [Mon, 27 Feb 2017 08:03:11 +0000 (08:03 +0000)]
Disable the parallel code generation in case of extension nodes

We can not perform the dependence analysis and, consequently, the parallel
code generation in case the schedule tree contains extension nodes.

Reviewed-by: Tobias Grosser <tobias@grosser.es>
Differential Revision: https://reviews.llvm.org/D30394

llvm-svn: 296325

7 years ago[AMDGPU] Runtime metadata fixes:
Konstantin Zhuravlyov [Mon, 27 Feb 2017 07:55:17 +0000 (07:55 +0000)]
[AMDGPU] Runtime metadata fixes:
  - Verify that runtime metadata is actually valid runtime metadata when assembling, otherwise we could accept the following when assembling, but ocl runtime will reject it:
    .amdgpu_runtime_metadata
    { amd.MDVersion: [ 2, 1 ], amd.RandomUnknownKey, amd.IsaInfo: ...
  - Make IsaInfo optional, and always emit it.

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

llvm-svn: 296324

7 years agollvm-mc-fuzzer: add support for assembly
Brian Cain [Mon, 27 Feb 2017 06:22:17 +0000 (06:22 +0000)]
llvm-mc-fuzzer: add support for assembly

This creates an llvm-mc-disassemble-fuzzer from the existing llvm-mc-fuzzer
and finishing the assemble support in llvm-mc-assemble-fuzzer.

llvm-svn: 296323

7 years ago[APInt] Use UINT64_MAX instead of ~integerPart(0). NFC
Craig Topper [Mon, 27 Feb 2017 06:05:33 +0000 (06:05 +0000)]
[APInt] Use UINT64_MAX instead of ~integerPart(0). NFC

llvm-svn: 296322

7 years ago[X86] Check for less than 0 rather than explicit compare with -1. NFC
Craig Topper [Mon, 27 Feb 2017 06:05:30 +0000 (06:05 +0000)]
[X86] Check for less than 0 rather than explicit compare with -1. NFC

llvm-svn: 296321

7 years ago[GeneratePCHAction] If preprocessor option 'AllowPCHWithCompilerErrors' is enabled...
Argyrios Kyrtzidis [Mon, 27 Feb 2017 03:52:36 +0000 (03:52 +0000)]
[GeneratePCHAction] If preprocessor option 'AllowPCHWithCompilerErrors' is enabled, don't delete the produced PCH file if error diagnostics occurred.

llvm-svn: 296320

7 years agoSimplify sortMipsSymbols function a bit.
Rui Ueyama [Mon, 27 Feb 2017 03:31:38 +0000 (03:31 +0000)]
Simplify sortMipsSymbols function a bit.

llvm-svn: 296319

7 years agoAdd comments to SymbolTableSection.
Rui Ueyama [Mon, 27 Feb 2017 03:31:19 +0000 (03:31 +0000)]
Add comments to SymbolTableSection.

llvm-svn: 296318