platform/upstream/llvm.git
7 years agoConstantFold: Handle gep nonnull, undef as well
Daniel Berlin [Mon, 8 May 2017 17:37:33 +0000 (17:37 +0000)]
ConstantFold: Handle gep nonnull, undef as well

llvm-svn: 302447

7 years agoConstantFold: Fold getelementptr (i32, i32* null, i64 undef) to null.
Daniel Berlin [Mon, 8 May 2017 17:37:29 +0000 (17:37 +0000)]
ConstantFold: Fold  getelementptr (i32, i32* null, i64 undef) to null.
Transforms/IndVarSimplify/2011-10-27-lftrnull will fail if this regresses.
Transforms/GVN/PRE/2011-06-01-NonLocalMemdepMiscompile.ll has been changed to still test what it was
trying to test.

llvm-svn: 302446

7 years ago[X86][LWP] Add __LWP__ macro tests
Simon Pilgrim [Mon, 8 May 2017 17:25:48 +0000 (17:25 +0000)]
[X86][LWP] Add __LWP__ macro tests

Missed in rL302418

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

llvm-svn: 302445

7 years ago[ValueTracking] Use KnownOnes to provide a better bound on known zeros for ctlz/cttz...
Craig Topper [Mon, 8 May 2017 17:22:34 +0000 (17:22 +0000)]
[ValueTracking] Use KnownOnes to provide a better bound on known zeros for ctlz/cttz intrinics

This patch uses KnownOnes of the input of ctlz/cttz to bound the value that can be returned from these intrinsics. This makes these intrinsics more similar to the handling for ctpop which already uses known bits to produce a similar bound.

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

llvm-svn: 302444

7 years agoFix grammar in comment. NFC
Jonathan Roelofs [Mon, 8 May 2017 17:06:17 +0000 (17:06 +0000)]
Fix grammar in comment. NFC

llvm-svn: 302443

7 years ago[X86] Split test configurations. NFC.
Zvi Rackover [Mon, 8 May 2017 16:54:25 +0000 (16:54 +0000)]
[X86] Split test configurations. NFC.

Split test that includes reproducer for pr32967 to KNL and SKX.

llvm-svn: 302442

7 years agoSimplify orphan section positioning.
Rafael Espindola [Mon, 8 May 2017 16:49:20 +0000 (16:49 +0000)]
Simplify orphan section positioning.

The code following this one already considers every possible insertion
point for orphan sections, there is no point in sorting them before.

llvm-svn: 302441

7 years ago[AST] Fix copy&paste error in comment. NFC.
Malcolm Parsons [Mon, 8 May 2017 16:43:29 +0000 (16:43 +0000)]
[AST] Fix copy&paste error in comment. NFC.

llvm-svn: 302440

7 years ago[InstSimplify] fix typo; NFC
Sanjay Patel [Mon, 8 May 2017 16:35:02 +0000 (16:35 +0000)]
[InstSimplify] fix typo; NFC

llvm-svn: 302439

7 years ago[InstCombine] use local variable to reduce code duplication; NFCI
Sanjay Patel [Mon, 8 May 2017 16:33:42 +0000 (16:33 +0000)]
[InstCombine] use local variable to reduce code duplication; NFCI

llvm-svn: 302438

7 years ago[ValueTracking] Introduce a version of computeKnownBits that returns a KnownBits...
Craig Topper [Mon, 8 May 2017 16:22:48 +0000 (16:22 +0000)]
[ValueTracking] Introduce a version of computeKnownBits that returns a KnownBits struct. Begin using it to replace internal usages of ComputeSignBit

This introduces a new interface for computeKnownBits that returns the KnownBits object instead of requiring it to be pre-constructed and passed in by reference.

This is a much more convenient interface as it doesn't require the caller to figure out the BitWidth to pre-construct the object. It's so convenient that I believe we can use this interface to remove the special ComputeSignBit flavor of computeKnownBits.

As a step towards that idea, this patch replaces all of the internal usages of ComputeSignBit with this new interface. As you can see from the patch there were a couple places where we called ComputeSignBit which really called computeKnownBits, and then called computeKnownBits again directly. I've reduced those places to only making one call to computeKnownBits. I bet there are probably external users that do it too.

A future patch will update the external users and remove the ComputeSignBit interface. I'll also working on moving more locations to the KnownBits returning interface for computeKnownBits.

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

llvm-svn: 302437

7 years ago[InstCombine/InstSimplify] add comments about code duplication; NFC
Sanjay Patel [Mon, 8 May 2017 16:21:55 +0000 (16:21 +0000)]
[InstCombine/InstSimplify] add comments about code duplication; NFC

llvm-svn: 302436

7 years ago[Sema] Fix typos handling in an overloadable call.
Anastasia Stulova [Mon, 8 May 2017 16:05:54 +0000 (16:05 +0000)]
[Sema] Fix typos handling in an overloadable call.

In C typos in arguments in a call of an overloadable function lead
to a failure of construction of CallExpr and following recovery does
not handle created delayed typos. This causes an assertion fail in
Sema::~Sema since Sema::DelayedTypos remains not empty.

The patch fixes that behavior by handling a call with arguments
having dependant types in the way that C++ does.

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

Patch by Dmitry Borisenkov!

llvm-svn: 302435

7 years ago[InstCombine] add another test for PR32949; NFC
Sanjay Patel [Mon, 8 May 2017 15:58:57 +0000 (15:58 +0000)]
[InstCombine] add another test for PR32949; NFC

A patch for the InstSimplify variant of this bug is up for review here:
https://reviews.llvm.org/D32954

llvm-svn: 302434

7 years agoInstructionSimplify: Refactor foldIdentityShuffles. NFC.
Zvi Rackover [Mon, 8 May 2017 15:46:58 +0000 (15:46 +0000)]
InstructionSimplify: Refactor foldIdentityShuffles. NFC.

Summary:
Minor refactoring of foldIdentityShuffles() which allows the removal of a
ConstantDataVector::get() in SimplifyShuffleVectorInstruction.

Reviewers: spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

Conflicts:
lib/Analysis/InstructionSimplify.cpp

llvm-svn: 302433

7 years agoFix comment typos.
Geoff Berry [Mon, 8 May 2017 15:33:08 +0000 (15:33 +0000)]
Fix comment typos.

llvm-svn: 302432

7 years ago[clang-tidy] Fix readability-implicit-bool-cast false positives
Alexander Kornienko [Mon, 8 May 2017 15:22:09 +0000 (15:22 +0000)]
[clang-tidy] Fix readability-implicit-bool-cast false positives

The patch makes the check treat binary conditional operator (`x ?: y`), `while`
and regular `for` loops as conditional statements for the purpose of
AllowConditional*Cast options.

llvm-svn: 302431

7 years ago[powerpc] Remove XFAIL for sanitizer_coverage_no_prune.cc on powerpc64
Bill Seurer [Mon, 8 May 2017 15:17:43 +0000 (15:17 +0000)]
[powerpc] Remove XFAIL for sanitizer_coverage_no_prune.cc on powerpc64

This test case works fine on powerpc64 (both BE and LE).

llvm-svn: 302430

7 years agoclang-tidy: add IgnoreMacros option to modernize-use-default-member-init
Miklos Vajna [Mon, 8 May 2017 15:13:31 +0000 (15:13 +0000)]
clang-tidy: add IgnoreMacros option to modernize-use-default-member-init

Summary:
And also enable it by default to be consistent with e.g.
modernize-use-using.

This helps e.g. when running this check on cppunit client code where the
macro is provided by the system, so there is no easy way to modify it.

Reviewers: alexfh, malcolm.parsons

Reviewed By: malcolm.parsons

Subscribers: cfe-commits

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

llvm-svn: 302429

7 years ago[clang-format] Convert AlignEscapedNewlinesLeft to an enum, adding
Daniel Jasper [Mon, 8 May 2017 15:08:00 +0000 (15:08 +0000)]
[clang-format] Convert AlignEscapedNewlinesLeft to an enum, adding
DontAlign

This converts the clang-format option AlignEscapedNewlinesLeft from a
boolean to an enum, named AlignEscapedNewlines, with options Left (prev.
true), Right (prev. false), and a new option DontAlign.

When set to DontAlign, the backslashes are placed just after the last token in each line:
  #define EXAMPLE \
    do { \
        int x = aaaaa; \
        int b; \
        int dddddddddd; \
    } while (0)

Patch by jtbandes. Thank you!

llvm-svn: 302428

7 years ago[clang-format] Don’t propagate AvoidBinPacking into argument
Daniel Jasper [Mon, 8 May 2017 15:07:52 +0000 (15:07 +0000)]
[clang-format] Don’t propagate AvoidBinPacking into argument
subexpressions

This is an attempt to fix the issue described in a recent email:
http://lists.llvm.org/pipermail/cfe-dev/2017-April/053632.html

Patch by jtbandes. Thank you!
Review: https://reviews.llvm.org/D32475

llvm-svn: 302427

7 years agoAdding reproducer for pr32967. NFC.
Zvi Rackover [Mon, 8 May 2017 14:47:32 +0000 (14:47 +0000)]
Adding reproducer for pr32967. NFC.

llvm-svn: 302426

7 years ago[clang-tidy] Ignore private =deleted methods in macros.
Alexander Kornienko [Mon, 8 May 2017 14:17:27 +0000 (14:17 +0000)]
[clang-tidy] Ignore private =deleted methods in macros.

modernize-use-equals-delete is extremely noisy in code using
DISALLOW_COPY_AND_ASSIGN-style macros and there's no easy way to automatically
fix the warning when macros are in play.

llvm-svn: 302425

7 years ago[X86][SSE] Improve combineLogicBlendIntoPBLENDV to use general masks.
Simon Pilgrim [Mon, 8 May 2017 14:16:39 +0000 (14:16 +0000)]
[X86][SSE] Improve combineLogicBlendIntoPBLENDV to use general masks.

Currently combineLogicBlendIntoPBLENDV can only match ASHR to detect sign splatting of a bit mask, this patch generalises this to use computeNumSignBits instead.

This is a first step in several things we can do to improve PBLENDV support:

 * Better matching of X86ISD::ANDNP patterns.
 * Handle floating point cases.
 * Better vector and bitcast support in computeNumSignBits.
 * Recognise that PBLENDV only uses the sign bit of the mask, we should be able strip away sign splats (ASHR, PCMPGT isNeg tests etc.).

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

llvm-svn: 302424

7 years ago[Polly][GPUJIT] Fixed OpenCL 2.0 min requirement for Error codes
Siddharth Bhat [Mon, 8 May 2017 14:10:37 +0000 (14:10 +0000)]
[Polly][GPUJIT] Fixed OpenCL 2.0 min requirement for Error codes

Summary: Removed OpenCL error code identifiers introduced in version 2.0.

Reviewers: grosser, bollu

Reviewed By: bollu

Subscribers: yaxunl, Anastasia, pollydev, llvm-commits

Tags: #polly

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

llvm-svn: 302423

7 years agoNormalize line endings. NFCI,
Simon Pilgrim [Mon, 8 May 2017 13:32:34 +0000 (13:32 +0000)]
Normalize line endings. NFCI,

llvm-svn: 302422

7 years agoFix Windows tests when __config_site is present.
Ben Craig [Mon, 8 May 2017 13:15:22 +0000 (13:15 +0000)]
Fix Windows tests when __config_site is present.
Previously, the force includes would complain about a missing _DEBUG symbol.
Now we dump macros before adding the force includes to the command line.

llvm-svn: 302421

7 years agoIR: Add a shufflevector mask commutation helper function. NFC.
Zvi Rackover [Mon, 8 May 2017 12:40:18 +0000 (12:40 +0000)]
IR: Add a shufflevector mask commutation helper function. NFC.

Summary:
Following up on Sanjay's suggetion in D32955, move this functionality
into ShuffleVectornstruction.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 302420

7 years agoCorrect the attribute spelling for guarded_var and pt_guarded_var.
Aaron Ballman [Mon, 8 May 2017 12:39:17 +0000 (12:39 +0000)]
Correct the attribute spelling for guarded_var and pt_guarded_var.

Patch by Roman Lebedev.

llvm-svn: 302419

7 years ago[X86][LWP] Add clang support for LWP instructions.
Simon Pilgrim [Mon, 8 May 2017 12:09:45 +0000 (12:09 +0000)]
[X86][LWP] Add clang support for LWP instructions.

This patch adds support for the the LightWeight Profiling (LWP) instructions which are available on all AMD Bulldozer class CPUs (bdver1 to bdver4).

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

llvm-svn: 302418

7 years ago[ARM][NEON] Add support for ISD::ABS lowering
Simon Pilgrim [Mon, 8 May 2017 10:37:34 +0000 (10:37 +0000)]
[ARM][NEON] Add support for ISD::ABS lowering

Update NEON int_arm_neon_vabs intrinsic to use the ISD::ABS opcode directly

Added constant folding tests.

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

llvm-svn: 302417

7 years ago[ARM] Clear the constant pool cache on explicit .ltorg directives
Martin Storsjo [Mon, 8 May 2017 10:26:24 +0000 (10:26 +0000)]
[ARM] Clear the constant pool cache on explicit .ltorg directives

Multiple ldr pseudoinstructions with the same constant value will
reuse the same constant pool entry. However, if the constant pool
is explicitly flushed with a .ltorg directive, we should not try
to reference constants in the previous pool any longer, since they
may be out of range.

This fixes assembling hand-written assembler source which repeatedly
loads the same constant value, across a binary size larger than the
pc-relative fixup range for ldr instructions (4096 bytes). Such
assembler source already uses explicit .ltorg instructions to emit
constant pools with regular intervals. However if we try to reuse
constants emitted in earlier pools, they end up out of range.

This makes the output of the testcase match what binutils gas does
(prior to this patch, it would fail to assemble).

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

llvm-svn: 302416

7 years ago[AARCH64][NEON] Add support for ISD::ABS lowering
Simon Pilgrim [Mon, 8 May 2017 10:25:18 +0000 (10:25 +0000)]
[AARCH64][NEON] Add support for ISD::ABS lowering

Update int_aarch64_neon_abs intrinsic to use the ISD::ABS opcode directly

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

llvm-svn: 302415

7 years ago[ELF] - Set DF_STATIC_TLS flag for i386 target.
George Rimar [Mon, 8 May 2017 10:24:38 +0000 (10:24 +0000)]
[ELF] - Set DF_STATIC_TLS flag for i386 target.

This is PR32437.

DF_STATIC_TLS
If set in a shared object or executable, this flag instructs the
dynamic linker to reject attempts to load this file dynamically.
It indicates that the shared object or executable contains code
using a static thread-local storage scheme. Implementations need
not support any form of thread-local storage.

Patch checks if IE/LE relocations were used to check if code uses
static model. If so it sets the DF_STATIC_TLS flag.

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

llvm-svn: 302414

7 years ago[ELF] - Linkerscript: support combination of linkerscript and --compress-debug-sections.
George Rimar [Mon, 8 May 2017 10:18:12 +0000 (10:18 +0000)]
[ELF] - Linkerscript: support combination of linkerscript and --compress-debug-sections.

Previously it was impossible to use linkerscript with --compress-debug-sections
because of assert failture:
Assertion failed: isFinalized(), file C:\llvm\lib\MC\StringTableBuilder.cpp, line 64

Patch fixes the issue

llvm-svn: 302413

7 years ago[GlobalISel][X86] G_GEP selection support.
Igor Breger [Mon, 8 May 2017 09:40:43 +0000 (09:40 +0000)]
[GlobalISel][X86] G_GEP selection support.

Summary: [GlobalISel][X86] G_GEP selection support.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: dberris, rovka, llvm-commits, kristof.beyls

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

llvm-svn: 302412

7 years ago[OpenCL] Check that global samplers are const
Sven van Haastregt [Mon, 8 May 2017 09:29:06 +0000 (09:29 +0000)]
[OpenCL] Check that global samplers are const

Patch by Simon Perretta.

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

llvm-svn: 302411

7 years ago[GlobalISel][X86] G_MUL legalizer/selector support.
Igor Breger [Mon, 8 May 2017 09:03:37 +0000 (09:03 +0000)]
[GlobalISel][X86] G_MUL legalizer/selector support.

Summary:
G_MUL legalizer/selector/regbank support.
Use only Tablegen-erated instruction selection.
This patch dealing with legal operations only.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: krytarowski, rovka, kristof.beyls, llvm-commits

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

llvm-svn: 302410

7 years ago[Lit] Fix to prevent creation of "%SystemDrive%" directory on Windows.
Andrew Ng [Mon, 8 May 2017 08:55:38 +0000 (08:55 +0000)]
[Lit] Fix to prevent creation of "%SystemDrive%" directory on Windows.

This patch propogates the environment variable SYSTEMDRIVE on Windows when
running the unit tests. This prevents the creation of a directory named
"%SystemDrive%" when running the unit tests from FileSystemTest that use the
function llvm::sys::fs::remove_directories which in turn uses SHFileOperationW.
It is within SHFileOperationW that this environment variable may be used and if
undefined causes the creation of a "%SystemDrive%" directory in the current
directory.

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

llvm-svn: 302409

7 years ago[APInt] Modify tcMultiplyPart's overflow detection to not depend on 'i' from the...
Craig Topper [Mon, 8 May 2017 06:34:41 +0000 (06:34 +0000)]
[APInt] Modify tcMultiplyPart's overflow detection to not depend on 'i' from the earlier loop. NFC

The value of 'i' is always the smaller of DstParts and SrcParts so we can just use that fact to write all the code in terms of SrcParts and DstParts.

llvm-svn: 302408

7 years ago[APInt] Use std::min instead of writing the same thing with the ternary operator...
Craig Topper [Mon, 8 May 2017 06:34:39 +0000 (06:34 +0000)]
[APInt] Use std::min instead of writing the same thing with the ternary operator. NFC

llvm-svn: 302407

7 years ago[APInt] Remove 'else' after 'return' in tcMultiply methods. NFC
Craig Topper [Mon, 8 May 2017 06:34:36 +0000 (06:34 +0000)]
[APInt] Remove 'else' after 'return' in tcMultiply methods. NFC

llvm-svn: 302406

7 years ago[XRay] Custom event logging intrinsic
Dean Michael Berris [Mon, 8 May 2017 05:45:21 +0000 (05:45 +0000)]
[XRay] Custom event logging intrinsic

This patch introduces an LLVM intrinsic and a target opcode for custom event
logging in XRay. Initially, its use case will be to allow users of XRay to log
some type of string ("poor man's printf"). The target opcode compiles to a noop
sled large enough to enable calling through to a runtime-determined relative
function call. At runtime, when X-Ray is enabled, the sled is replaced by
compiler-rt with a trampoline to the logic for creating the custom log entries.

Future patches will implement the compiler-rt parts and clang-side support for
emitting the IR corresponding to this intrinsic.

Reviewers: timshen, dberris

Subscribers: igorb, pelikan, rSerge, timshen, echristo, dberris, llvm-commits

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

llvm-svn: 302405

7 years ago[SCEV] Use APInt::operator*=(uint64_t) to avoid a temporary APInt for a constant.
Craig Topper [Mon, 8 May 2017 04:55:13 +0000 (04:55 +0000)]
[SCEV] Use APInt::operator*=(uint64_t) to avoid a temporary APInt for a constant.

llvm-svn: 302404

7 years ago[APInt] Take advantage of new operator*=(uint64_t) to remove a temporary APInt.
Craig Topper [Mon, 8 May 2017 04:55:12 +0000 (04:55 +0000)]
[APInt] Take advantage of new operator*=(uint64_t) to remove a temporary APInt.

llvm-svn: 302403

7 years ago[APInt] Add support for multiplying by a uint64_t.
Craig Topper [Mon, 8 May 2017 04:55:09 +0000 (04:55 +0000)]
[APInt] Add support for multiplying by a uint64_t.

This makes multiply similar to add, sub, xor, and, and or.

llvm-svn: 302402

7 years agoHopefully one last commit to fix this patch, addresses string reference
Eric Beckmann [Mon, 8 May 2017 02:47:42 +0000 (02:47 +0000)]
Hopefully one last commit to fix this patch, addresses string reference
issues.

llvm-svn: 302401

7 years agoQuick fix to D32609, it seems .o files are not transferred in all cases.
Eric Beckmann [Mon, 8 May 2017 02:47:25 +0000 (02:47 +0000)]
Quick fix to D32609, it seems .o files are not transferred in all cases.

Therefore the .o file in question is renamed to .obj.coff.

llvm-svn: 302400

7 years agoUpdate llvm-readobj -coff-resources to display tree structure.
Eric Beckmann [Mon, 8 May 2017 02:47:07 +0000 (02:47 +0000)]
Update llvm-readobj -coff-resources to display tree structure.

Summary: Continue making updates to llvm-readobj to display resource sections.  This is necessary for testing the up and coming cvtres tool.

Reviewers: zturner

Subscribers: llvm-commits

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

llvm-svn: 302399

7 years ago[SCEV] Have getRangeForAffineARHelper take StartRange by const reference to avoid...
Craig Topper [Mon, 8 May 2017 02:29:15 +0000 (02:29 +0000)]
[SCEV] Have getRangeForAffineARHelper take StartRange by const reference to avoid a copy in many of the cases.

llvm-svn: 302398

7 years agoRevert "Hopefully one last commit to fix this patch, addresses string reference"
Eric Beckmann [Mon, 8 May 2017 02:25:03 +0000 (02:25 +0000)]
Revert "Hopefully one last commit to fix this patch, addresses string reference"

Summary:
This reverts commit 56beec1b1cfc6d263e5eddb7efff06117c0724d2.

Revert "Quick fix to D32609, it seems .o files are not transferred in all cases."

This reverts commit 7652eecd29cfdeeab7f76f687586607a99ff4e36.

Revert "Update llvm-readobj -coff-resources to display tree structure."

This reverts commit 422b62c4d302cfc92401418c2acd165056081ed7.

Reviewers: zturner

Subscribers: llvm-commits

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

llvm-svn: 302397

7 years agoFix Windows locale detection
Eric Fiselier [Mon, 8 May 2017 02:09:48 +0000 (02:09 +0000)]
Fix Windows locale detection

llvm-svn: 302396

7 years agoHopefully one last commit to fix this patch, addresses string reference
Eric Beckmann [Mon, 8 May 2017 01:48:55 +0000 (01:48 +0000)]
Hopefully one last commit to fix this patch, addresses string reference
issues.

llvm-svn: 302395

7 years agoFix shared_mutex dll import errors on Windows
Eric Fiselier [Mon, 8 May 2017 01:31:50 +0000 (01:31 +0000)]
Fix shared_mutex dll import errors on Windows

llvm-svn: 302394

7 years ago[libc++] Implement exception_ptr on Windows
Eric Fiselier [Mon, 8 May 2017 01:17:50 +0000 (01:17 +0000)]
[libc++] Implement exception_ptr on Windows

Summary:
This patch implements exception_ptr on Windows using the `__ExceptionPtrFoo` functions provided by MSVC.

The `__ExceptionPtrFoo` functions are defined inside the C++ standard library, `msvcprt`, which is unfortunate because it requires libc++ to link to the MSVC STL. However this doesn't seem to cause any immediate problems. However to be safe I kept all usages within the libc++ dylib so that user programs wouldn't have to link to MSVCPRT as well.

Note there are still 2 outstanding exception_ptr/nested_exception test failures.

* `current_exception.pass.cpp` needs to be rewritten for the Windows exception_ptr semantics which copy the exception every time.
* `rethrow_if_nested.pass.cpp` need investigation. It hits a stack overflow, likely from recursion.

This patch also gets most of the `<future>` tests passing as well.

Reviewers: mclow.lists, compnerd, bcraig, rmaprath, majnemer, BillyONeal, STL_MSFT

Subscribers: mgorny, cfe-commits

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

llvm-svn: 302393

7 years ago[XRay][compiler-rt] XFAIL on ppc
Dean Michael Berris [Mon, 8 May 2017 00:38:13 +0000 (00:38 +0000)]
[XRay][compiler-rt] XFAIL on ppc

Follow-up on D32846.

llvm-svn: 302392

7 years agoFix DLL import/export on Win32 locale helpers
Eric Fiselier [Mon, 8 May 2017 00:37:31 +0000 (00:37 +0000)]
Fix DLL import/export on Win32 locale helpers

llvm-svn: 302391

7 years agoFix DLL import for __time_get_c_storage member functions.
Eric Fiselier [Mon, 8 May 2017 00:29:32 +0000 (00:29 +0000)]
Fix DLL import for __time_get_c_storage member functions.

llvm-svn: 302390

7 years agoRevert "Actually remove the MSVC STL when linking and testing libc++ on Windows"
Eric Fiselier [Sun, 7 May 2017 23:37:38 +0000 (23:37 +0000)]
Revert "Actually remove the MSVC STL when linking and testing libc++ on Windows"

This reverts commit r302387.

llvm-svn: 302389

7 years agoQuick fix to D32609, it seems .o files are not transferred in all cases.
Eric Beckmann [Sun, 7 May 2017 23:31:14 +0000 (23:31 +0000)]
Quick fix to D32609, it seems .o files are not transferred in all cases.

Therefore the .o file in question is renamed to .obj.coff.

llvm-svn: 302388

7 years agoActually remove the MSVC STL when linking and testing libc++ on Windows
Eric Fiselier [Sun, 7 May 2017 23:19:14 +0000 (23:19 +0000)]
Actually remove the MSVC STL when linking and testing libc++ on Windows

llvm-svn: 302387

7 years agoUpdate llvm-readobj -coff-resources to display tree structure.
Eric Beckmann [Sun, 7 May 2017 22:47:22 +0000 (22:47 +0000)]
Update llvm-readobj -coff-resources to display tree structure.

Summary: Continue making updates to llvm-readobj to display resource sections.  This is necessary for testing the up and coming cvtres tool.

Reviewers: zturner

Subscribers: llvm-commits

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

llvm-svn: 302386

7 years ago[ConstantRange][SimplifyCFG] Add a helper method to allow SimplifyCFG to determine...
Craig Topper [Sun, 7 May 2017 22:22:11 +0000 (22:22 +0000)]
[ConstantRange][SimplifyCFG] Add a helper method to allow SimplifyCFG to determine if a ConstantRange has more than 8 elements without requiring an allocation if the ConstantRange is 64-bits wide.

Previously SimplifyCFG used getSetSize which returns an APInt that is 1 bit wider than the ConstantRange's bit width. In the reasonably common case that the ConstantRange is 64-bits wide, this requires returning a 65-bit APInt. APInt's can only store 64-bits without a memory allocation so this is inefficient.

The new method takes the 8 as an input and tells if the range contains more than that many elements without requiring any wider math.

llvm-svn: 302385

7 years agoTemporarly XFAIL aligned new/delete tests on Windows.
Eric Fiselier [Sun, 7 May 2017 22:10:56 +0000 (22:10 +0000)]
Temporarly XFAIL aligned new/delete tests on Windows.

Libc++ doesn't provide its own definitions of new/delete on Windows,
instead using the versions provided by VCRuntime. However VCRuntime
does not yet implement aligned new/delete so these tests fail.

It might be possible for libc++ to provide its own definitions only
for aligned new/delete as long as MSVC doesn't provide it. However
before this can be done libc++ needs to figure out how to implement
std::get_new_handler.

llvm-svn: 302384

7 years ago[ConstantRange] Remove 'Of' from name of ConstantRange::isSizeStrictlySmallerThanOf...
Craig Topper [Sun, 7 May 2017 21:48:08 +0000 (21:48 +0000)]
[ConstantRange] Remove 'Of' from name of ConstantRange::isSizeStrictlySmallerThanOf so that it reads better. NFC

llvm-svn: 302383

7 years agoFix Windows test failures caused by identical temp file names.
Eric Fiselier [Sun, 7 May 2017 21:41:58 +0000 (21:41 +0000)]
Fix Windows test failures caused by identical temp file names.

This patch fixes test failures that occur on Windows because
the tests attempt to generate two distinct temp file names but
get the same name both time.

The fix for this is to create the first temp file before requesting
a second temporary file name. This ensures that the second name
will be unique.

llvm-svn: 302382

7 years agoAccept Windows specific output in system error tests
Eric Fiselier [Sun, 7 May 2017 21:21:07 +0000 (21:21 +0000)]
Accept Windows specific output in system error tests

llvm-svn: 302381

7 years agoFix two test failures caused by Windows mangling of function types.
Eric Fiselier [Sun, 7 May 2017 21:15:28 +0000 (21:15 +0000)]
Fix two test failures caused by Windows mangling of function types.

On Windows the function template `template <class T> void test()` has
the same mangled name when instantiated with the distinct types `void()`
and `void() noexcept`. When this occurs Clang emits an error. This error
was causing two type-traits tests to fail.

However this can be worked around by using class templates instead of
function templates, which is what this patch does to fix the errors.

llvm-svn: 302380

7 years ago[Polly] Added OpenCL Runtime to GPURuntime Library for GPGPU CodeGen
Siddharth Bhat [Sun, 7 May 2017 21:03:46 +0000 (21:03 +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: 302379

7 years ago[X86][AVX1] Improve 256-bit vector costs for integer unary intrinsics.
Simon Pilgrim [Sun, 7 May 2017 20:58:55 +0000 (20:58 +0000)]
[X86][AVX1] Improve 256-bit vector costs for integer unary intrinsics.

Account for subvector extraction/insertion, helps prevent the vectorizers from selecting 256-bit vectors that will have to be split anyhow on AVX1 targets.

llvm-svn: 302378

7 years ago[Orc] Remove trailing whitespace.
Lang Hames [Sun, 7 May 2017 20:39:46 +0000 (20:39 +0000)]
[Orc] Remove trailing whitespace.

llvm-svn: 302377

7 years ago[Polly] [GPUJIT] Adapted argument capitalization to fit standard
Siddharth Bhat [Sun, 7 May 2017 19:53:35 +0000 (19:53 +0000)]
[Polly] [GPUJIT] Adapted argument capitalization to fit standard

Summary: Function argument naming changed to reflect capitalization standards.

Reviewers: grosser, Meinersbur

Reviewed By: grosser

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

llvm-svn: 302376

7 years ago[Polly] [GPUJIT] Moved error prints to stderr
Siddharth Bhat [Sun, 7 May 2017 18:31:25 +0000 (18:31 +0000)]
[Polly] [GPUJIT] Moved error prints to stderr

Summary: Errors previously printed to stdout now get printed to stderr.

Reviewers: grosser, Meinersbur

Reviewed By: grosser

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

llvm-svn: 302375

7 years ago[InstSimplify] add tests for PR32949 miscompile; NFC
Sanjay Patel [Sun, 7 May 2017 18:19:13 +0000 (18:19 +0000)]
[InstSimplify] add tests for PR32949 miscompile; NFC

llvm-svn: 302374

7 years agoInstructionSimplify: Relanding r301766
Zvi Rackover [Sun, 7 May 2017 18:16:37 +0000 (18:16 +0000)]
InstructionSimplify: Relanding r301766

Summary:
Re-applying r301766 with a fix to a typo and a regression test.

The log message for r301766 was:
==================================================================================
    InstructionSimplify: Canonicalize shuffle operands. NFC-ish.

    Summary:
     Apply canonicalization rules:
        1. Input vectors with no elements selected from can be replaced with undef.
        2. If only one input vector is constant it shall be the second one.

    This allows constant-folding to cover more ad-hoc simplifications that
    were in place and avoid duplication for RHS and LHS checks.

    There are more rules we may want to add in the future when we see a
    justification. e.g. mask elements that select undef elements can be
    replaced with undef.
==================================================================================

Reviewers: spatel, RKSimon

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 302373

7 years agoMake llvm-rtdlyd -check preserve automatic address mappings made by RuntimeDyld.
Lang Hames [Sun, 7 May 2017 17:19:53 +0000 (17:19 +0000)]
Make llvm-rtdlyd -check preserve automatic address mappings made by RuntimeDyld.

Currently llvm-rtdyld in -check mode will map sections to back-to-back 4k
aligned slabs starting at 0x1000. Automatically remapping sections by default is
helpful because it quickly exposes relocation bugs due to use of local addresses
rather than load addresses (these would silently pass if the load address was
not remapped). These mappings can be explicitly overridden on a per-section
basis using llvm-rtdlyd's -map-section option. This patch extends this scheme to
also preserve any mappings made by RuntimeDyld itself. Preserving RuntimeDyld's
automatic mappings allows us to write test cases to verify that these automatic
mappings have been applied.

This will allow the fix in https://reviews.llvm.org/D32899 to be tested with
llvm-rtdyld -check.

llvm-svn: 302372

7 years ago[SCEV] Use move semantics in ScalarEvolution::setRange
Craig Topper [Sun, 7 May 2017 16:28:17 +0000 (16:28 +0000)]
[SCEV] Use move semantics in ScalarEvolution::setRange

Summary: This makes setRange take ConstantRange by rvalue reference since most callers were passing an unnamed temporary ConstantRange. We can then move that ConstantRange into the DenseMap caches. For the callers that weren't passing a temporary, I've added std::move to to the local variable being passed.

Reviewers: sanjoy, mzolotukhin, efriedma

Reviewed By: sanjoy

Subscribers: takuto.ikuta, llvm-commits

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

llvm-svn: 302371

7 years ago[InstSimplify] use ConstantRange to simplify or-of-icmps
Sanjay Patel [Sun, 7 May 2017 15:11:40 +0000 (15:11 +0000)]
[InstSimplify] use ConstantRange to simplify or-of-icmps

We can simplify (or (icmp X, C1), (icmp X, C2)) to 'true' or one of the icmps in many cases.
I had to check some of these with Alive to prove to myself it's right, but everything seems
to check out. Eg, the deleted code in instcombine was completely ignoring predicates with
mismatched signedness.

This is a follow-up to:
https://reviews.llvm.org/rL301260
https://reviews.llvm.org/D32143

llvm-svn: 302370

7 years ago[Kaleidoscope] toy.cpp use after move fix
Peter Szecsi [Sun, 7 May 2017 11:00:01 +0000 (11:00 +0000)]
[Kaleidoscope] toy.cpp use after move fix

The variable Proto is moved at the beginning of the codegen() function.
According to the comment above, the pointed object should be used due the
reference P.

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

llvm-svn: 302369

7 years agoRemove unnecessary const_cast
Sanjoy Das [Sun, 7 May 2017 05:29:36 +0000 (05:29 +0000)]
Remove unnecessary const_cast

llvm-svn: 302368

7 years agoUse array_pod_sort instead of std::sort
Sanjoy Das [Sun, 7 May 2017 05:29:34 +0000 (05:29 +0000)]
Use array_pod_sort instead of std::sort

llvm-svn: 302367

7 years agoFix comment.
Lang Hames [Sun, 7 May 2017 03:54:53 +0000 (03:54 +0000)]
Fix comment.

llvm-svn: 302366

7 years agoCOFF: add ARM64 relocation types
Saleem Abdulrasool [Sat, 6 May 2017 23:48:02 +0000 (23:48 +0000)]
COFF: add ARM64 relocation types

Add the ARM64 COFF relocation types.  This will be needed to add support
for the AArch64 Windows object file emission support.

llvm-svn: 302365

7 years agoUpdate LanguageExtensions doc to refer to C++14 instead of C++1y
Eric Fiselier [Sat, 6 May 2017 23:26:04 +0000 (23:26 +0000)]
Update LanguageExtensions doc to refer to C++14 instead of C++1y

llvm-svn: 302364

7 years agoFix undefined pthread references when building against libc++
Eric Fiselier [Sat, 6 May 2017 22:10:14 +0000 (22:10 +0000)]
Fix undefined pthread references when building against libc++

llvm-svn: 302363

7 years agoEnsure showbase does not overflow do_put buffers
Dimitry Andric [Sat, 6 May 2017 20:58:50 +0000 (20:58 +0000)]
Ensure showbase does not overflow do_put buffers

Summary:
In https://bugs.freebsd.org/207918, Daniel McRobb describes how using
std::showbase with ostreams can cause truncation of unsigned long long
when output format is octal.  In fact, this can even happen with
unsigned int and unsigned long.

To ensure this does not happen, add one additional character to the
do_put buffers if std::showbase is on.  Also add a test case.

Reviewers: EricWF, mclow.lists

Reviewed By: EricWF

Subscribers: cfe-commits, emaste

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

llvm-svn: 302362

7 years ago[X86][AVX512] Relax assertion and just exit combine for unsupported types (PR32907)
Simon Pilgrim [Sat, 6 May 2017 20:53:52 +0000 (20:53 +0000)]
[X86][AVX512] Relax assertion and just exit combine for unsupported types (PR32907)

llvm-svn: 302361

7 years agoReally disable test as intended in the previous commit
Tobias Grosser [Sat, 6 May 2017 19:18:19 +0000 (19:18 +0000)]
Really disable test as intended in the previous commit

llvm-svn: 302360

7 years ago[X86][AVX512] Move v2i64/v4i64 VPABS lowering to tablegen
Simon Pilgrim [Sat, 6 May 2017 19:11:59 +0000 (19:11 +0000)]
[X86][AVX512] Move v2i64/v4i64 VPABS lowering to tablegen

Extend NoVLX targets to use the 512-bit versions

llvm-svn: 302359

7 years agoDisable test to avoid buildbot noise
Tobias Grosser [Sat, 6 May 2017 18:50:28 +0000 (18:50 +0000)]
Disable test to avoid buildbot noise

This test was introduced in r302339. It works on my system, but breaks on the
buildbots.

llvm-svn: 302358

7 years ago[X86] Reduce code for setting operations actions by merging into loops across multipl...
Simon Pilgrim [Sat, 6 May 2017 18:17:56 +0000 (18:17 +0000)]
[X86] Reduce code for setting operations actions by merging into loops across multiple types/ops. NFCI.

llvm-svn: 302357

7 years ago[NVPTX] Add support for ISD::ABS lowering
Simon Pilgrim [Sat, 6 May 2017 17:42:09 +0000 (17:42 +0000)]
[NVPTX] Add support for ISD::ABS lowering

Use the ISD::ABS opcode directly

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

llvm-svn: 302356

7 years ago[X86][SSE] Break register dependencies on v16i8/v8i16 BUILD_VECTOR on SSE41
Simon Pilgrim [Sat, 6 May 2017 17:30:39 +0000 (17:30 +0000)]
[X86][SSE] Break register dependencies on v16i8/v8i16 BUILD_VECTOR on SSE41

rL294581 broke unnecessary register dependencies on partial v16i8/v8i16 BUILD_VECTORs, but on SSE41 we (currently) use insertion for full BUILD_VECTORs as well. By allowing full insertion to occur on SSE41 targets we can break register dependencies here as well.

llvm-svn: 302355

7 years ago[Analysis] Print out unreachable loops
Brian Gesiak [Sat, 6 May 2017 16:22:53 +0000 (16:22 +0000)]
[Analysis] Print out unreachable loops

Summary:
When writing a loop pass I made a mistake and hit the assertion
"Unreachable block in loop". Later, I hit an assertion when I called
`BasicBlock::eraseFromParent()` incorrectly: "Use still stuck around
after Def is destroyed". This latter assertion, however, printed out
exactly which value is being deleted and what uses remain, which helped
me debug the issue.

To help people debugging their loop passes in the future, print out
exactly which basic block is unreachable in a loop.

Reviewers: sanjoy, hfinkel, mehdi_amini

Reviewed By: mehdi_amini

Subscribers: mzolotukhin

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

llvm-svn: 302354

7 years ago[builtins] Fixup emulated TLS for mingw.
Martell Malone [Sat, 6 May 2017 15:13:17 +0000 (15:13 +0000)]
[builtins] Fixup emulated TLS for mingw.

Enabled emulated TLS on WOA for mingw
Fix <windows.h> include for mingw

Reviewed By: chapuni, mstorsjo

Subscribers: compnerd, llvm-commits

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

llvm-svn: 302340

7 years ago[DeLICM] Known knowledge.
Michael Kruse [Sat, 6 May 2017 14:03:58 +0000 (14:03 +0000)]
[DeLICM] Known knowledge.

Extend the Knowledge class to store information about the contents
of array elements and which values are written. Two knowledges do
not conflict the known content is the same. The content information
if computed from writes to and loads from the array elements, and
represented by "ValInst": isl spaces that compare equal if the value
represented is the same.

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

llvm-svn: 302339

7 years ago[X86][AVX2] Add scheduling latency/throughput tests for some AVX2 instructions
Simon Pilgrim [Sat, 6 May 2017 13:46:09 +0000 (13:46 +0000)]
[X86][AVX2] Add scheduling latency/throughput tests for some AVX2 instructions

Many more to come...

llvm-svn: 302338

7 years ago[DAGCombiner] If ISD::ABS is legal/custom, use it directly instead of canonicalizing...
Simon Pilgrim [Sat, 6 May 2017 13:44:42 +0000 (13:44 +0000)]
[DAGCombiner] If ISD::ABS is legal/custom, use it directly instead of canonicalizing first.

Remove an extra canonicalization step if ISD::ABS is going to be used anyway.

Updated x86 abs combine to check that we are lowering from both canonicalizations.

llvm-svn: 302337

7 years ago[CMake] Introduce POLLY_BUNDLED_JSONCPP.
Michael Kruse [Sat, 6 May 2017 13:42:15 +0000 (13:42 +0000)]
[CMake] Introduce POLLY_BUNDLED_JSONCPP.

Allow using a system's install jsoncpp library instead of the bundled
one with the setting POLLY_BUNDLED_JSONCPP=OFF.

This fixes llvm.org/PR32929

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

llvm-svn: 302336

7 years ago[SCEV] Remove extra APInt copies from getRangeForAffineARHelper.
Craig Topper [Sat, 6 May 2017 06:03:07 +0000 (06:03 +0000)]
[SCEV] Remove extra APInt copies from getRangeForAffineARHelper.

This changes one parameter to be a const APInt& since we only read from it. Use std::move on local APInts once they are no longer needed so we can reuse their allocations. Lastly, use operator+=(uint64_t) instead of adding 1 to an APInt twice creating a new APInt each time.

llvm-svn: 302335