platform/upstream/llvm.git
7 years agoBasic: fix whitespace in file header (NFC)
Saleem Abdulrasool [Wed, 24 May 2017 20:27:09 +0000 (20:27 +0000)]
Basic: fix whitespace in file header (NFC)

llvm-svn: 303804

7 years ago[coroutines] Add support for coroutines with non-scalar parameters
Gor Nishanov [Wed, 24 May 2017 20:09:14 +0000 (20:09 +0000)]
[coroutines] Add support for coroutines with non-scalar parameters

Summary:
Simple types like int are handled by LLVM Coroutines just fine.
But for non-scalar parameters we need to create copies of those parameters in the coroutine frame and make all uses of those parameters to refer to parameter copies.

Reviewers: rsmith, EricWF, GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 303803

7 years ago[DAG] Prevent crashes when merging constant stores with high-bit set. NFC.
Nirav Dave [Wed, 24 May 2017 19:56:39 +0000 (19:56 +0000)]
[DAG] Prevent crashes when merging constant stores with high-bit set. NFC.

llvm-svn: 303802

7 years agoClose the gap between ELF and COFF ICF implementations. NFC.
Rui Ueyama [Wed, 24 May 2017 19:56:29 +0000 (19:56 +0000)]
Close the gap between ELF and COFF ICF implementations. NFC.

We originally wrote the ICF code for COFF and ported it to ELF.
They started diverging since then. This patch closes the gap.

llvm-svn: 303801

7 years ago[AArch64] Prevent nested ADDs from address calc in splitStoreSplat. NFC
Nirav Dave [Wed, 24 May 2017 19:55:49 +0000 (19:55 +0000)]
[AArch64] Prevent nested ADDs from address calc in splitStoreSplat. NFC

In preparation for late-stage store merging.

llvm-svn: 303800

7 years agoFor Microsoft compatibility, set fno_operator_names
Erich Keane [Wed, 24 May 2017 19:31:19 +0000 (19:31 +0000)]
For Microsoft compatibility, set fno_operator_names

There's a Microsoft header in the Windows SDK which won't
compile with clang because it uses an operator name (and)
as a field name. This patch allows that file to compile by
setting the option which disables operator names.
The header which doesn't compile <Query.h> C:/Program Files (x86)/
Windows Kits/10/include/10.0.14393.0/um\Query.h:259:40:
error: expected member name or ';' after declaration specifiers

  /* [case()] */ NODERESTRICTION or;
                   ~~~~~~~~~~~~~~~ ^

                   1 error generated.

Contributed for Melanie Blower

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

llvm-svn: 303798

7 years agoImprove parallelism of ICF.
Rui Ueyama [Wed, 24 May 2017 19:22:34 +0000 (19:22 +0000)]
Improve parallelism of ICF.

This is the only place we use threads for ICF. The intention of this code
was to split an input vector into 256 shards and process them in parallel.
What the code was actually doing was to split an input into 257 shards,
process the first 256 shards in parallel, and the remaining one in serial.

That means this code takes ceil(256/n)+1 instead of ceil(256/n) where n
is the number of available CPU cores. The former converges to 2 while
the latter converges to 1.

This patches fixes the above issue.

llvm-svn: 303797

7 years agoRevert "Revert "Attempt to pacify ASan and UBSan reports in CrashRecovery tests""
Vitaly Buka [Wed, 24 May 2017 19:11:12 +0000 (19:11 +0000)]
Revert "Revert "Attempt to pacify ASan and UBSan reports in CrashRecovery tests""

This dependents on r303729 which was reverted.

This reverts commit r303783.

llvm-svn: 303796

7 years agoRevert "[compiler-rt] Change default of allow_user_segv_handler to true"
Vitaly Buka [Wed, 24 May 2017 19:09:24 +0000 (19:09 +0000)]
Revert "[compiler-rt] Change default of allow_user_segv_handler to true"

Breaks sanitizer-x86_64-linux-fuzzer bot.

This reverts commit r303729.

llvm-svn: 303795

7 years ago[InstCombine] Merge together the SimplifyDemandedUseBits implementations for ZExt...
Craig Topper [Wed, 24 May 2017 18:40:25 +0000 (18:40 +0000)]
[InstCombine] Merge together the SimplifyDemandedUseBits implementations for ZExt and Trunc. NFC

While there avoid resizing the DemandedMask twice. Make a copy into a separate variable instead. This potentially removes an allocation on large bit widths.

With the use of the zextOrTrunc methods on APInt and KnownBits these can be made almost source identical. The only difference is the zero of the upper bits for ZExt. This is similar to how its done in computeKnownBits in ValueTracking.

llvm-svn: 303791

7 years ago[Polly] Add handling of Top Level Regions
Philip Pfaffe [Wed, 24 May 2017 18:39:39 +0000 (18:39 +0000)]
[Polly] Add handling of Top Level Regions

Summary:
My goal is to make the newly added `AllowWholeFunctions` options more usable/powerful.

The changes to ScopBuilder.cpp are exclusively checks to prevent `Region.getExit()` from being dereferenced, since Top Level Regions (TLRs) don't have an exit block.

In ScopDetection's `isValidCFG`, I removed a check that disallowed ReturnInstructions to have return values. This might of course have been intentional, so I would welcome your feedback on this and maybe a small explanation why return values are forbidden. Maybe it can be done but needs more changes elsewhere?

The remaining changes in ScopDetection are simply to consider the AllowWholeFunctions option in more places, i.e. allow TLRs when it is set and once again avoid derefererncing `getExit()` if it doesn't exist.

Finally, in ScopHelper.cpp I extended `polly::isErrorBlock` to handle regions without exit blocks as well: The original check was if a given BasicBlock dominates all predecessors of the exit block. Therefore I do the same for TLRs by regarding all BasicBlocks terminating with a ReturnInst as predecessors of a "virtual" function exit block.

Patch by: Lukas Boehm

Reviewers: philip.pfaffe, grosser, Meinersbur

Reviewed By: grosser

Subscribers: pollydev, llvm-commits, bollu

Tags: #polly

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

llvm-svn: 303790

7 years agoAddress follow-up feedback for r303712
Argyrios Kyrtzidis [Wed, 24 May 2017 18:35:01 +0000 (18:35 +0000)]
Address follow-up feedback for r303712

llvm-svn: 303789

7 years agoReplace std::call_once with llvm:call_once
Kamil Rytarowski [Wed, 24 May 2017 18:31:48 +0000 (18:31 +0000)]
Replace std::call_once with llvm:call_once

Summary:
This is required on some platforms, as GNU libstdc++ std::call_once is known to be buggy.

This fixes operation of LLD on at least NetBSD and perhaps OpenBSD and Linux PowerPC.

The same change has been introduced to LLVM and LLDB.

Reviewers: ruiu

Reviewed By: ruiu

Subscribers: emaste, #lld

Tags: #lld

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

llvm-svn: 303788

7 years agoSimplify a variable type by using StringRef instead of CachedHashStringRef.
Rui Ueyama [Wed, 24 May 2017 18:22:27 +0000 (18:22 +0000)]
Simplify a variable type by using StringRef instead of CachedHashStringRef.

A variable `ComdatGroup` is not supposed to contain a large number of
items. Even when linking clang, it ends up having only 300K strings.
It doesn't make sense to use CachedHashStringRef for this hash table.
This patch has neutral or slightly positive impact on performance while
reducing code complexity.

llvm-svn: 303787

7 years agoFix one test case faiulre in commit 303766.
Tony Jiang [Wed, 24 May 2017 18:12:11 +0000 (18:12 +0000)]
Fix one test case faiulre in commit 303766.

It is clean when I build boostrap and run make checkall on my machine, I guess
it could be I only build bootstrap with assert, while the buildbots may build
without asserts, which could cause the difference.

llvm-svn: 303786

7 years agoPrevent UBSan report in CrashRecovery tests
Vitaly Buka [Wed, 24 May 2017 18:11:57 +0000 (18:11 +0000)]
Prevent UBSan report in CrashRecovery tests
Reverted by mistake with r303783.

llvm-svn: 303785

7 years agoMove writeTo to OutputSectionCommand.
Rafael Espindola [Wed, 24 May 2017 18:08:04 +0000 (18:08 +0000)]
Move writeTo to OutputSectionCommand.

This reduces how many times we have to map from OutputSection to
OutputSectionCommand. It is a required step to moving
clearOutputSections earlier.

In order to always use writeTo in OutputSectionCommand we have to call
fabricateDefaultCommands for -r links and move section compression
after it.

llvm-svn: 303784

7 years agoRevert "Attempt to pacify ASan and UBSan reports in CrashRecovery tests"
Vitaly Buka [Wed, 24 May 2017 17:58:09 +0000 (17:58 +0000)]
Revert "Attempt to pacify ASan and UBSan reports in CrashRecovery tests"

It's not needed after r303729.

This reverts commit r303311.

llvm-svn: 303783

7 years agoFix a couple of typos in memory intrinsic optimization output (NFC)
Teresa Johnson [Wed, 24 May 2017 17:55:25 +0000 (17:55 +0000)]
Fix a couple of typos in memory intrinsic optimization output (NFC)

s/instrinsic/intrinsic

llvm-svn: 303782

7 years agoMove clearOutputSections earlier. NFC.
Rafael Espindola [Wed, 24 May 2017 17:54:28 +0000 (17:54 +0000)]
Move clearOutputSections earlier. NFC.

llvm-svn: 303781

7 years agoP9: D-form vector load/store. Differential Revision: https://reviews.llvm.org/D33248
Zaara Syeda [Wed, 24 May 2017 17:50:37 +0000 (17:50 +0000)]
P9: D-form vector load/store. Differential Revision: https://reviews.llvm.org/D33248

llvm-svn: 303780

7 years ago[InstCombine] Use less bitwise operations to handle Instruction::SExt in SimplifyDema...
Craig Topper [Wed, 24 May 2017 17:33:30 +0000 (17:33 +0000)]
[InstCombine] Use less bitwise operations to handle Instruction::SExt in SimplifyDemandedUseBits. Other improvements.

The current code created a NewBits mask and used it as a mask several times. One of them just before a call to trunc making it unnecessary. A call to getActiveBits can get us the same information for the case. We also ORed with this mask later when we should have just sign extended the known bits.

We also called trunc on the guaranteed to be zero KnownZeros/Ones masks entering this code. Creating appropriately sized temporary APInts is probably better.

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

llvm-svn: 303779

7 years agoMove machine-cse-physreg.mir to test/CodeGen/Thumb
Krzysztof Parzyszek [Wed, 24 May 2017 17:20:47 +0000 (17:20 +0000)]
Move machine-cse-physreg.mir to test/CodeGen/Thumb

llvm-svn: 303778

7 years agoRewrite badly-formatted switch. NFC.
Rui Ueyama [Wed, 24 May 2017 17:12:53 +0000 (17:12 +0000)]
Rewrite badly-formatted switch. NFC.

llvm-svn: 303777

7 years agoMake key-value types explicit. NFC.
Rui Ueyama [Wed, 24 May 2017 17:12:32 +0000 (17:12 +0000)]
Make key-value types explicit. NFC.

llvm-svn: 303776

7 years agoChange the control flow so that the function is a bit more readable. NFC.
Rui Ueyama [Wed, 24 May 2017 17:12:10 +0000 (17:12 +0000)]
Change the control flow so that the function is a bit more readable. NFC.

llvm-svn: 303775

7 years ago[InstSimplify] Simplify uadd/sadd/umul/smul with overflow intrinsics when the Zero...
Craig Topper [Wed, 24 May 2017 17:05:28 +0000 (17:05 +0000)]
[InstSimplify] Simplify uadd/sadd/umul/smul with overflow intrinsics when the Zero or Undef is on the LHS.

Summary: This code was migrated from InstCombine a few years ago. InstCombine had nearby code that would move Constants to the RHS for these, but InstSimplify doesn't have such code on this path.

Reviewers: spatel, majnemer, davide

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 303774

7 years ago[ValueTracking] Convert most of the calls to computeKnownBits to use the version...
Craig Topper [Wed, 24 May 2017 16:53:07 +0000 (16:53 +0000)]
[ValueTracking] Convert most of the calls to computeKnownBits to use the version that returns the KnownBits object.

This continues the changes started when computeSignBit was replaced with this new version of computeKnowBits.

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

llvm-svn: 303773

7 years ago[ValueTracking] Add OptimizationRemarkEmitter to the other signature for commuteKnown...
Craig Topper [Wed, 24 May 2017 16:53:03 +0000 (16:53 +0000)]
[ValueTracking] Add OptimizationRemarkEmitter to the other signature for commuteKnownBits.

This is needed for an upcoming patch.

llvm-svn: 303772

7 years agoRevert r291254: [AArch64] Reduce vector insert/extract cost for Falkor
Matthew Simpson [Wed, 24 May 2017 16:48:39 +0000 (16:48 +0000)]
Revert r291254: [AArch64] Reduce vector insert/extract cost for Falkor

The default vector insert/extract cost is more profitable on Falkor than the
reduced cost.

llvm-svn: 303771

7 years agoDo not track section types of previous sections, always use PROGBITS for dummy sections.
Dmitry Mikulin [Wed, 24 May 2017 16:48:31 +0000 (16:48 +0000)]
Do not track section types of previous sections, always use PROGBITS for dummy sections.

Fix for PR33029.

llvm-svn: 303770

7 years agoAdd some tips on benchmarking.
Rafael Espindola [Wed, 24 May 2017 16:39:12 +0000 (16:39 +0000)]
Add some tips on benchmarking.

llvm-svn: 303769

7 years ago[OPENMP] Allow value of thread local variables in target regions.
Alexey Bataev [Wed, 24 May 2017 16:00:02 +0000 (16:00 +0000)]
[OPENMP] Allow value of thread local variables in target regions.

If the variable is marked as TLS variable and target device does not
support TLS, the error is emitted for the variable even if it is not
used in target regions. Patch fixes this and allows to use the values of
the TLS variables in target regions.

llvm-svn: 303768

7 years ago[AMDGPU] Prevent too large store merges in AMDGPU Subtargets. NFCI.
Nirav Dave [Wed, 24 May 2017 15:59:09 +0000 (15:59 +0000)]
[AMDGPU] Prevent too large store merges in AMDGPU Subtargets. NFCI.

Various address spaces on the SI and R600 subtargets have stricter
limits on memory access size that other address spaces. Use
canMergeStoresTo predicate to prevent the DAGCombiner from creating
these stores as they will be split up during legalization.

llvm-svn: 303767

7 years ago[PowerPC] Implement vec_xxsldwi builtin.
Tony Jiang [Wed, 24 May 2017 15:54:13 +0000 (15:54 +0000)]
[PowerPC] Implement vec_xxsldwi builtin.

The vec_xxsldwi builtin is missing from altivec.h. This has been requested by
developers working on libvpx for VP9 support for Google.

The patch fixes PR: https://bugs.llvm.org/show_bug.cgi?id=32653
Differential Revision: https://reviews.llvm.org/D33236

llvm-svn: 303766

7 years agoAllow armv{7,7s,7k,7m,7em} builds
Jonathan Roelofs [Wed, 24 May 2017 15:53:24 +0000 (15:53 +0000)]
Allow armv{7,7s,7k,7m,7em} builds

llvm-svn: 303765

7 years ago[coroutines] Make generic lambda coroutines work
Gor Nishanov [Wed, 24 May 2017 15:44:57 +0000 (15:44 +0000)]
[coroutines] Make generic lambda coroutines work

Summary:
1. Coroutine cannot be constexpr (added a check in SemaLambda.cpp not to mark coroutine as constexpr)
2. TransformCoroutineBodyStmt should transform ResultDecl and ReturnStmt

Reviewers: rsmith, GorNishanov

Reviewed By: GorNishanov

Subscribers: EricWF, cfe-commits

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

llvm-svn: 303764

7 years ago[LV] Update type in cost model for scalarization
Matthew Simpson [Wed, 24 May 2017 15:26:15 +0000 (15:26 +0000)]
[LV] Update type in cost model for scalarization

For non-uniform instructions marked for scalarization, we should update
`VectorTy` when computing instruction costs to reflect the scalar type. In
addition to determining instruction costs, this type is also used to signal
that all instructions in the loop will be scalarized. This currently affects
memory instructions and non-pointer induction variables and their updates. (We
also mark GEPs scalar after vectorization, but their cost is computed together
with memory instructions.) For scalarized induction updates, this patch also
scales the scalar cost by the vectorization factor, corresponding to each
induction step.

llvm-svn: 303763

7 years ago[DeLICM] Partial writes for PHIs.
Michael Kruse [Wed, 24 May 2017 15:23:06 +0000 (15:23 +0000)]
[DeLICM] Partial writes for PHIs.

Enable the use for partial writes for PHI write accesses with a switch.
This simply skips the test for whether a PHI write would be partial.

The analog test for partial value writes also protects for partial reads
which we do not support (yet). It is possible to test for partial reads
separately such that we could skip the partial write check as well. In
case this shows up to be useful, I can implement it as well.

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

llvm-svn: 303762

7 years agoWarn about uses of `@available` that can't suppress the
Alex Lorenz [Wed, 24 May 2017 15:15:29 +0000 (15:15 +0000)]
Warn about uses of `@available` that can't suppress the
-Wunguarded-availability warnings

rdar://32306520

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

llvm-svn: 303761

7 years ago[PowerPC] Implement vec_xxpermdi builtin.
Tony Jiang [Wed, 24 May 2017 15:13:32 +0000 (15:13 +0000)]
[PowerPC] Implement vec_xxpermdi builtin.

The vec_xxpermdi builtin is missing from altivec.h. This has been requested by
developers working on libvpx for VP9 support for Google.

The patch fixes PR: https://bugs.llvm.org/show_bug.cgi?id=32653
Differential Revision: https://reviews.llvm.org/D33053

llvm-svn: 303760

7 years ago[JSONImporter] misses checks whether the data it imports makes sense.
Michael Kruse [Wed, 24 May 2017 15:09:35 +0000 (15:09 +0000)]
[JSONImporter] misses checks whether the data it imports makes sense.

Without this patch, the JSONImporter did not verify if the data it loads
were correct or not  (Bug llvm.org/PR32543). I add some checks in the
JSONImporter class and some test cases.

Here are the checks (and test cases) I added :

JSONImporter::importContext
- The "context" key does not exist.
- The context was not parsed successfully by ISL.
- The isl_set has the wrong number of parameters.
- The isl_set is not a parameter set.

JSONImporter::importSchedule
- The "statements" key does not exist.
- There is not the right number of statement in the file.
- The "schedule" key does not exist.
- The schedule was not parsed successfully by ISL.

JSONImporter::importAccesses
- The "statements" key does not exist.
- There is not the right number of statement in the file.
- The "accesses" key does not exist.
- There is not the right number of memory accesses in the file.
- The "relation" key does not exist.
- The memory access was not parsed successfully by ISL.

JSONImporter::areArraysEqual
- The "type" key does not exist.
- The "sizes" key does not exist.
- The "name" key does not exist.

JSONImporter::importArrays
/!\ Do not check if there is an key name "arrays" because it is not
considered as an error.
All checks are already in place or implemented in
JSONImporter::areArraysEqual.

Contributed-by: Nicolas Bonfante <nicolas.bonfante@insa-lyon.fr>
Differential Revision: https://reviews.llvm.org/D32739

llvm-svn: 303759

7 years ago[MSP430] Fix PR33050: Don't use ADD16ri to lower FrameIndex.
Vadzim Dambrouski [Wed, 24 May 2017 15:08:30 +0000 (15:08 +0000)]
[MSP430] Fix PR33050: Don't use ADD16ri to lower FrameIndex.

Use ADDframe pseudo instruction instead.
This will fix machine verifier error, and will help to fix PR32146.

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

llvm-svn: 303758

7 years ago[sanitizer] [SystemZ] Update CVE-2016-2143 check for Ubuntu 16.04
Ulrich Weigand [Wed, 24 May 2017 15:06:33 +0000 (15:06 +0000)]
[sanitizer] [SystemZ] Update CVE-2016-2143 check for Ubuntu 16.04

The Ubuntu 16.04 kernel contains a backport of the CVE check
starting with version 4.4.0-13.  Update FixedCVE_2016_2143.

llvm-svn: 303757

7 years agoDriver must return non-zero code on errors in command line
Serge Pavlov [Wed, 24 May 2017 14:57:17 +0000 (14:57 +0000)]
Driver must return non-zero code on errors in command line

This is recommit of r302775, reverted in r302777 due to a fail in
clang-tidy. Original mesage is below.

Now if clang driver is given wrong arguments, in some cases it
continues execution and returns zero code. This change fixes this
behavior.

The fix revealed some errors in clang test set.

File test/Driver/gfortran.f90 added in r118203 checks forwarding
gfortran flags to GCC. Now driver reports error on this file, because
the option -working-directory implemented in clang differs from the
option with the same name implemented in gfortran, in clang the option
requires argument, in gfortran does not.

In the file test/Driver/arm-darwin-builtin.c clang is called with
options -fbuiltin-strcat and -fbuiltin-strcpy. These option were removed
in r191435 and now clang reports error on this test.

File arm-default-build-attributes.s uses option -verify, which is not
supported by driver, it is cc1 option.

Similarly, the file split-debug.h uses options -fmodules-embed-all-files
and -fmodule-format=obj, which are not supported by driver.

Other revealed errors are mainly mistypes.

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

llvm-svn: 303756

7 years ago[InstCombine] add tests to show potential missing folds; NFC
Sanjay Patel [Wed, 24 May 2017 14:56:51 +0000 (14:56 +0000)]
[InstCombine] add tests to show potential missing folds; NFC

As noted in https://bugs.llvm.org/show_bug.cgi?id=33138 and
the comments, there are multiple ways to view this. If we
choose not to solve this in InstCombine, these tests will
serve as documentation of that choice.

llvm-svn: 303755

7 years agoRevert "AMDGPU: Fold CI-specific complex SMRD patterns into existing complex patterns"
Marek Olsak [Wed, 24 May 2017 14:53:50 +0000 (14:53 +0000)]
Revert "AMDGPU: Fold CI-specific complex SMRD patterns into existing complex patterns"

This reverts commit e065977c4b5f68ab845400b256f6a3822b1325fa.

It doesn't work. S_LOAD_DWORD_IMM_ci and friends aren't selected by any of
the patterns, so it was putting 32-bit literals into the 8-bit field.

llvm-svn: 303754

7 years agoGeneralize two diagnostic messages to take function name as parameter.
Tony Jiang [Wed, 24 May 2017 14:45:57 +0000 (14:45 +0000)]
Generalize two diagnostic messages to take function name as parameter.

llvm-svn: 303753

7 years ago[coroutines] Improved diagnostics when unhandled_exception is missing in the promise_type
Gor Nishanov [Wed, 24 May 2017 14:34:19 +0000 (14:34 +0000)]
[coroutines] Improved diagnostics when unhandled_exception is missing in the promise_type

Summary: Now we helpfully provide a note pointing at the promise_type in question.

Reviewers: EricWF, GorNishanov

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 303752

7 years ago[index] The references to explicit class properties should be recorded
Alex Lorenz [Wed, 24 May 2017 14:23:40 +0000 (14:23 +0000)]
[index] The references to explicit class properties should be recorded

rdar://32376363

llvm-svn: 303751

7 years ago[InstCombine] add tests to document bitcast + bitwise-logic behavior; NFC
Sanjay Patel [Wed, 24 May 2017 14:21:31 +0000 (14:21 +0000)]
[InstCombine] add tests to document bitcast + bitwise-logic behavior; NFC

The solution for PR26702 ( https://bugs.llvm.org/show_bug.cgi?id=26702 )
added a canonicalization rule, but the minimal regression tests don't
demonstrate how that rule interacts with other folds.

llvm-svn: 303750

7 years ago[coroutines] [NFC] Add tests for return_void, unhandled_exception and promise dtor
Gor Nishanov [Wed, 24 May 2017 14:19:48 +0000 (14:19 +0000)]
[coroutines] [NFC] Add tests for return_void, unhandled_exception and promise dtor

Summary:
* Test that coroutine promise destructor is called.
* Test that we call return_void on fallthrough
* Test that we call unhandled exception in a try catch surrounding the body

Reviewers: EricWF, GorNishanov

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 303748

7 years agoRevert "[SCEV] Do not fold dominated SCEVUnknown into AddRecExpr start"
Diana Picus [Wed, 24 May 2017 14:16:04 +0000 (14:16 +0000)]
Revert "[SCEV] Do not fold dominated SCEVUnknown into AddRecExpr start"

This reverts commit r303730 because it broke all the buildbots.

llvm-svn: 303747

7 years ago[Hexagon] Fix comment in HexagonPacketizer::runOnMachineFunction
Krzysztof Parzyszek [Wed, 24 May 2017 13:43:42 +0000 (13:43 +0000)]
[Hexagon] Fix comment in HexagonPacketizer::runOnMachineFunction

Patch by Wei-Ren Chen.

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

llvm-svn: 303745

7 years ago[LoopVectorizer] Let target prefer scalar addressing computations.
Jonas Paulsson [Wed, 24 May 2017 13:42:56 +0000 (13:42 +0000)]
[LoopVectorizer]  Let target prefer scalar addressing computations.

The loop vectorizer usually vectorizes any instruction it can and then
extracts the elements for a scalarized use. On SystemZ, all elements
containing addresses must be extracted into address registers (GRs). Since
this extraction is not free, it is better to have the address in a suitable
register to begin with. By forcing address arithmetic instructions and loads
of addresses to be scalar after vectorization, two benefits result:

* No need to extract the register
* LSR optimizations trigger (LSR isn't handling vector addresses currently)

Benchmarking show improvements on SystemZ with this new behaviour.

Any other target could try this by returning false in the new hook
prefersVectorizedAddressing().

Review: Renato Golin, Elena Demikhovsky, Ulrich Weigand
https://reviews.llvm.org/D32422

llvm-svn: 303744

7 years ago[SystemZ] Fix register modelling in expandLoadStackGuard()
Jonas Paulsson [Wed, 24 May 2017 13:15:48 +0000 (13:15 +0000)]
[SystemZ]  Fix register modelling in expandLoadStackGuard()

EXPENSIVE_CHECKS found this bug (https://bugs.llvm.org/show_bug.cgi?id=33047), which
this patch fixes. The EAR instruction defines a GR32, not a GR64.

Review: Ulrich Weigand
llvm-svn: 303743

7 years ago[clang-format] Remove unused using directive, NFC
Krasimir Georgiev [Wed, 24 May 2017 12:15:42 +0000 (12:15 +0000)]
[clang-format] Remove unused using directive, NFC

llvm-svn: 303742

7 years agoMethod loadFromCommandLine should be able to report errors
Serge Pavlov [Wed, 24 May 2017 11:57:37 +0000 (11:57 +0000)]
Method loadFromCommandLine should be able to report errors

Now FixedCompilationDatabase::loadFromCommandLine has no means to report
which error occurred if it fails to create compilation object. This is
a block for implementing D33013, because after that change driver will
refuse to create compilation if command line contains erroneous options.

This change adds additional argument to loadFromCommandLine, which is
assigned error message text if compilation object was not created. This is
the same way as other methods of CompilationDatabase report failure.

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

llvm-svn: 303741

7 years agoRevert "RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false"
Pavel Labath [Wed, 24 May 2017 11:57:28 +0000 (11:57 +0000)]
Revert "RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false"

This reverts commit r303732, as it introduces a regression in
TestLoadUnload on android.

llvm-svn: 303740

7 years agoclang-format: Introduce BreakConstructorInitializers option
Francois Ferrand [Wed, 24 May 2017 11:36:58 +0000 (11:36 +0000)]
clang-format: Introduce BreakConstructorInitializers option

Summary:
This option replaces the BreakConstructorInitializersBeforeComma option with an enum, thus introducing a mode where the colon stays on the same line as constructor declaration:

  // When it fits on line:
  Constructor() : initializer1(), initializer2() {}

  // When it does not fit:
  Constructor() :
      initializer1(), initializer2()
  {}

  // When ConstructorInitializerAllOnOneLineOrOnePerLine = true:
  Constructor() :
      initializer1(),
      initializer2()
  {}

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 303739

7 years agoDemangler: Fix constructor cv qualifier handling
Tamas Berghammer [Wed, 24 May 2017 11:29:02 +0000 (11:29 +0000)]
Demangler: Fix constructor cv qualifier handling

Previously if we parsed a constructor then we set parsed_ctor_dtor_cv
to true and never reseted it. This causes issue when a template argument
references a constructor (e.g. type of lambda defined inside a
constructor) as we will have the parsed_ctor_dtor_cv flag set what will
cause issues when parsing later arguments.

Differential Revision: https://reviews.llvm.org/D33385
libcxxabi change: https://reviews.llvm.org/rL303737

llvm-svn: 303738

7 years ago__cxa_demangle: Fix constructor cv qualifier handling
Tamas Berghammer [Wed, 24 May 2017 11:21:34 +0000 (11:21 +0000)]
__cxa_demangle: Fix constructor cv qualifier handling

Summary:
Previously if we parsed a constructor then we set parsed_ctor_dtor_cv
to true and never reseted it. This causes issue when a template argument
references a constructor (e.g. type of lambda defined inside a
constructor) as we will have the parsed_ctor_dtor_cv flag set what will
cause issues when parsing later arguments.

Reviewers: EricWF, compnerd

Subscribers: cfe-commits

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

llvm-svn: 303737

7 years agoStrip trailing whitespace. NFCI.
Simon Pilgrim [Wed, 24 May 2017 11:02:27 +0000 (11:02 +0000)]
Strip trailing whitespace. NFCI.

llvm-svn: 303736

7 years agoModify test so that it looks for patterns in stderr as well
Serge Pavlov [Wed, 24 May 2017 10:50:56 +0000 (10:50 +0000)]
Modify test so that it looks for patterns in stderr as well

With the change https://reviews.llvm.org/D33013 driver will not build
compilation object if command line is invalid, in particular, if
unrecognized option is provided. In such cases it will prints diagnostics
on stderr. The test 'clang-tidy/diagnostic.cpp' checks reaction on
unrecognized option and will fail when D33013 is applied because it checks
only stdout for test patterns and expects the name of diagnostic category
prepared by clang-tidy. With this change the test makes more general check
and must work in either case.

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

llvm-svn: 303735

7 years agoFix 'set but not used' [-Wunused-but-set-variable] warning
Simon Pilgrim [Wed, 24 May 2017 10:38:09 +0000 (10:38 +0000)]
Fix 'set but not used' [-Wunused-but-set-variable] warning

llvm-svn: 303734

7 years ago[ARM] Remove ThumbTargetMachines. (NFC)
Florian Hahn [Wed, 24 May 2017 10:18:57 +0000 (10:18 +0000)]
[ARM] Remove ThumbTargetMachines. (NFC)

Summary:
Thumb code generation is controlled by ARMSubtarget and the concrete
ThumbLETargetMachine and ThumbBETargetMachine are not needed.

Eric Christopher suggested removing the unneeded target machines in
https://reviews.llvm.org/D33287.

I think it still makes sense to keep separate TargetMachines for big and
little endian as we probably do not want to have different endianess for
difference functions in a single compilation unit. The MIPS backend has
two separate TargetMachines for big and little endian as well.

Reviewers: echristo, rengolin, kristof.beyls, t.p.northover

Reviewed By: echristo

Subscribers: aemerson, javed.absar, arichardson, llvm-commits

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

llvm-svn: 303733

7 years agoRunThreadPlan: Fix halting logic in IgnoreBreakpoints = false
Pavel Labath [Wed, 24 May 2017 09:46:48 +0000 (09:46 +0000)]
RunThreadPlan: Fix halting logic in IgnoreBreakpoints = false

Summary:
The function had logic to handle the case when the expression terminated
while we were trying to halt the process, but it failed to take into
account the possibility that the expression stopped because it hit a
breakpoint. This was caused by the fact that the handling of the stopped
events was duplicated for the "halting" and regular cases (the regular
case handled this situation correctly). I've tried to merge these two
cases into one to make sure they stay in sync.

I should call out that the two cases were checking whether the thread
plan has completed in slightly different ways. I am not sure what is the
difference between them, but I think the check should be the same in
both cases, whatever it is, so I just took the one from the regular
case, as that is probably more tested.

For the test, I modified TestUnwindExpression to run the expression with
a smaller timeout (this is how I found this bug originally). With a 1ms
one thread timeout, the test failed consistently without this patch.

Reviewers: jingham

Subscribers: lldb-commits

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

llvm-svn: 303732

7 years agoMachineCSE: Respect interblock physreg liveness
Mikael Holmen [Wed, 24 May 2017 09:35:23 +0000 (09:35 +0000)]
MachineCSE: Respect interblock physreg liveness

Summary:
This is a fix for PR32538. MachineCSE first looks at MO.isDead(), but
if it is not marked dead, MachineCSE still wants to do its own check
to see if it is trivially dead. This check for the trivial case
assumed that physical registers cannot be live out of a block.

Patch by Mattias Eriksson.

Reviewers: qcolombet, jbhateja

Reviewed By: qcolombet, jbhateja

Subscribers: jbhateja, llvm-commits

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

llvm-svn: 303731

7 years ago[SCEV] Do not fold dominated SCEVUnknown into AddRecExpr start
Max Kazantsev [Wed, 24 May 2017 08:52:18 +0000 (08:52 +0000)]
[SCEV] Do not fold dominated SCEVUnknown into AddRecExpr start

When folding arguments of AddExpr or MulExpr with recurrences, we rely on the fact that
the loop of our base recurrency is the bottom-lost in terms of domination. This assumption
may be broken by an expression which is treated as invariant, and which depends on a complex
Phi for which SCEVUnknown was created. If such Phi is a loop Phi, and this loop is lower than
the chosen AddRecExpr's loop, it is invalid to fold our expression with the recurrence.

Another reason why it might be invalid to fold SCEVUnknown into Phi start value is that unlike
other SCEVs, SCEVUnknown are sometimes position-bound. For example, here:

for (...) { // loop
  phi = {A,+,B}
}
X = load ...
Folding phi + X into {A+X,+,B}<loop> actually makes no sense, because X does not exist and cannot
exist while we are iterating in loop (this memory can be even not allocated and not filled by this moment).
It is only valid to make such folding if X is defined before the loop. In this case the recurrence {A+X,+,B}<loop>
may be existant.

This patch prohibits folding of SCEVUnknown (and those who use them) into the start value of an AddRecExpr,
if this instruction is dominated by the loop. Merging the dominating unknown values is still valid. Some tests that
relied on the fact that some SCEVUnknown should be folded into AddRec's are changed so that they no longer
expect such behavior.

llvm-svn: 303730

7 years ago[compiler-rt] Change default of allow_user_segv_handler to true
Vitaly Buka [Wed, 24 May 2017 07:21:39 +0000 (07:21 +0000)]
[compiler-rt] Change default of allow_user_segv_handler to true

Reviewers: eugenis

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 303729

7 years ago[asan] Remove allow_user_segv_handler on Windows.
Vitaly Buka [Wed, 24 May 2017 07:17:27 +0000 (07:17 +0000)]
[asan] Remove allow_user_segv_handler on Windows.

Summary:
This flags is not covered by tests on Windows and looks like it's implemented
incorrectly. Switching its default breaks some tests.

Taking into account that related handle_segv flag is not supported on Windows
it's safer to remove it until we commit to support it.

Reviewers: eugenis, zturner, rnk

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 303728

7 years agoExplicitly set CPU and -slow-incdec to try to fix r303678's test on llvm-clang-x86_64...
Daniel Sanders [Wed, 24 May 2017 07:02:37 +0000 (07:02 +0000)]
Explicitly set CPU and -slow-incdec to try to fix r303678's test on llvm-clang-x86_64-expensive-checks-win.

llvm-svn: 303727

7 years ago[APInt] Use std::end to avoid mentioning the size of a local buffer repeatedly.
Craig Topper [Wed, 24 May 2017 07:00:55 +0000 (07:00 +0000)]
[APInt] Use std::end to avoid mentioning the size of a local buffer repeatedly.

llvm-svn: 303726

7 years agoAdd a permanent Polly Hangouts URL
Tobias Grosser [Wed, 24 May 2017 06:46:11 +0000 (06:46 +0000)]
Add a permanent Polly Hangouts URL

llvm-svn: 303725

7 years agoAdd new C++ bindings to release notes
Tobias Grosser [Wed, 24 May 2017 06:46:09 +0000 (06:46 +0000)]
Add new C++ bindings to release notes

llvm-svn: 303724

7 years agoUpdate version number in Polly release notes
Tobias Grosser [Wed, 24 May 2017 06:46:06 +0000 (06:46 +0000)]
Update version number in Polly release notes

llvm-svn: 303723

7 years agoHeader file to help forcibly link GPURuntime
Tobias Grosser [Wed, 24 May 2017 06:46:03 +0000 (06:46 +0000)]
Header file to help forcibly link GPURuntime

Summary: LinkGPURuntime.h defines and creates a structure ForceGPURuntimeLinking which creates an artificial dependency to functions defined in GPUJIT.c. The presence of this structure ensures that these functions are a part of the compiled object/library files including it.

Reviewers: grosser, Meinersbur

Reviewed By: grosser

Subscribers: #polly, pollydev

Tags: #polly

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

llvm-svn: 303722

7 years agoRevert r303720: Tweak r303678's test to try to fix llvm-clang-x86_64-expensive-checks...
Daniel Sanders [Wed, 24 May 2017 06:44:55 +0000 (06:44 +0000)]
Revert r303720: Tweak r303678's test to try to fix llvm-clang-x86_64-expensive-checks-win.

It doesn't fix that builder.

llvm-svn: 303721

7 years agoTweak r303678's test to try to fix llvm-clang-x86_64-expensive-checks-win.
Daniel Sanders [Wed, 24 May 2017 06:05:14 +0000 (06:05 +0000)]
Tweak r303678's test to try to fix llvm-clang-x86_64-expensive-checks-win.

I suspect this buildbot has slow-incdec set by default, most likely due to
the default CPU having this set. This feature bit can prevent optsize from
having an effect on this IR.

llvm-svn: 303720

7 years ago[XRay][clang] Allow imbuing arg1 logging attribute via -fxray-always-instrument=
Dean Michael Berris [Wed, 24 May 2017 05:46:36 +0000 (05:46 +0000)]
[XRay][clang] Allow imbuing arg1 logging attribute via -fxray-always-instrument=

Summary:
This change allows us to add arg1 logging support to functions through
the special case list provided through -fxray-always-instrument=. This
is useful for adding arg1 logging to functions that are either in
headers that users don't have control over (i.e. cannot change the
source) or would rather not do.

It only takes effect when the pattern is matched through the "fun:"
special case, as a category. As in:

  fun:*pattern=arg1

Reviewers: pelikan, rnk

Subscribers: cfe-commits

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

llvm-svn: 303719

7 years ago[demangler] Fix a crash in the demangler during parsing of a lamdba
Erik Pilkington [Wed, 24 May 2017 05:44:19 +0000 (05:44 +0000)]
[demangler] Fix a crash in the demangler during parsing of a lamdba

The problem is that multiple types could have been parsed from parse_type(),
which the lamdba parameter parsing didn't handle.

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

llvm-svn: 303718

7 years ago[ARM] Add VLDx/VSTx sched defs for machine-schedulers. NFCI
Javed Absar [Wed, 24 May 2017 05:32:48 +0000 (05:32 +0000)]
[ARM] Add VLDx/VSTx sched defs for machine-schedulers. NFCI

This patch adds missing scheds for Neon VLDx/VSTx instructions.
This will help one write schedulers easier/faster in the future for ARM sub-targets.
Existing models will not affected by this patch.
Reviewed by: Renato Golin, Diana Picus
Differential Revision: https://reviews.llvm.org/D33120

llvm-svn: 303717

7 years ago[coroutines] Implement correct GRO lifetime
Gor Nishanov [Wed, 24 May 2017 02:38:26 +0000 (02:38 +0000)]
[coroutines] Implement correct GRO lifetime

Summary:
Sema creates a declaration for gro variable as:

auto $gro = $promise.get_return_object();

However, gro variable has to outlive coroutine frame and coroutine promise, but,
it can only be initialized after the coroutine promise was created, thus, we
split its emission in two parts: EmitGroAlloca emits an alloca and sets up
the cleanups. Later when the coroutine promise is available we initialize
the gro and set the flag that the cleanup is now active.

Duplicate of: https://reviews.llvm.org/D31670 (which arc patch refuses to apply for some reason)

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

Subscribers: EricWF, cfe-commits

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

llvm-svn: 303716

7 years ago[NewGVN] Update additionalUsers when we simplify to a value.
Davide Italiano [Wed, 24 May 2017 02:30:24 +0000 (02:30 +0000)]
[NewGVN] Update additionalUsers when we simplify to a value.

Otherwise we don't revisit an instruction that could be simplified,
and when we verify, we discover there's something that changed, i.e.
what we had wasn't a maximal fixpoint.

Fixes PR32836.

llvm-svn: 303715

7 years ago[coroutines] Fix leak in CGCoroutine.cpp
Gor Nishanov [Wed, 24 May 2017 01:54:37 +0000 (01:54 +0000)]
[coroutines] Fix leak in CGCoroutine.cpp

FinalBB need to be emitted even when unused to make sure it is deleted

llvm-svn: 303714

7 years agoChange __has_feature(objc_diagnose_if_attr) to __has_feature(attribute_diagnose_if_ob...
Argyrios Kyrtzidis [Wed, 24 May 2017 01:38:00 +0000 (01:38 +0000)]
Change __has_feature(objc_diagnose_if_attr) to __has_feature(attribute_diagnose_if_objc) for consistency with rest of attribute checks.

llvm-svn: 303713

7 years agoEnhance the 'diagnose_if' attribute so that we can apply it for ObjC methods and...
Argyrios Kyrtzidis [Wed, 24 May 2017 00:46:27 +0000 (00:46 +0000)]
Enhance the 'diagnose_if' attribute so that we can apply it for ObjC methods and properties as well

This is an initial commit to allow using it with constant expressions, a follow-up commit will enable full support for it in ObjC methods.

llvm-svn: 303712

7 years agoFix broken build.
Zachary Turner [Wed, 24 May 2017 00:35:32 +0000 (00:35 +0000)]
Fix broken build.

llvm-svn: 303711

7 years agoRevert "Disable coverage opt-out for strong postdominator blocks."
George Karpenkov [Wed, 24 May 2017 00:29:12 +0000 (00:29 +0000)]
Revert "Disable coverage opt-out for strong postdominator blocks."

This reverts commit 2ed06f05fc10869dd1239cff96fcdea2ee8bf4ef.
Buildbots do not like this on Linux.

llvm-svn: 303710

7 years agoRevert "Fixes for tests for r303698"
George Karpenkov [Wed, 24 May 2017 00:29:08 +0000 (00:29 +0000)]
Revert "Fixes for tests for r303698"

This reverts commit 69bfaf72e7502eb08bbca88a57925fa31c6295c6.

llvm-svn: 303709

7 years agogit-llvm script should add .exe on Windows.
Zachary Turner [Wed, 24 May 2017 00:28:46 +0000 (00:28 +0000)]
git-llvm script should add .exe on Windows.

llvm-svn: 303708

7 years agoDon't do a full scan of the type stream before processing records.
Zachary Turner [Wed, 24 May 2017 00:26:27 +0000 (00:26 +0000)]
Don't do a full scan of the type stream before processing records.

LazyRandomTypeCollection is designed for random access, and in
order to provide this it lazily indexes ranges of types.  In the
case of types from an object file, there is no partial index
to build off of, so it has to index the full stream up front.
However, merging types only requires sequential access, and when
that is needed, this extra work is simply wasted.  Changing the
algorithm to work on sequential arrays of types rather than
random access type collections eliminates this up front scan.

llvm-svn: 303707

7 years ago[SCCP] Use the `hasAddressTaken()` version defined in `Function`.
Davide Italiano [Tue, 23 May 2017 23:59:23 +0000 (23:59 +0000)]
[SCCP] Use the `hasAddressTaken()` version defined in `Function`.

Instead of using the SCCP homegrown one. We should eventually
make the private SCCP version disappear, but that wont' be today.
PR33143 tracks this issue.

Add braces for consistency while here. No functional change intended.

llvm-svn: 303706

7 years ago[Modules] Fix overly conservative assertion for import diagnostic
Bruno Cardoso Lopes [Tue, 23 May 2017 23:53:17 +0000 (23:53 +0000)]
[Modules] Fix overly conservative assertion for import diagnostic

We currenltly assert when want to diagnose a missing import and the decl
in question is already visible. It turns out that the decl in question
might be visible because another decl from the same module actually made
the module visible in a previous error diagnostic.

Remove the assertion and avoid re-exporting the module if it's already
visible.

rdar://problem/27975402

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

llvm-svn: 303705

7 years ago[LIR] Use the newly `getRecurrenceVar()` helper. NFCI.
Davide Italiano [Tue, 23 May 2017 23:51:54 +0000 (23:51 +0000)]
[LIR] Use the newly `getRecurrenceVar()` helper. NFCI.

llvm-svn: 303704

7 years agoClear OutSec->Sections.
Rafael Espindola [Tue, 23 May 2017 22:54:06 +0000 (22:54 +0000)]
Clear OutSec->Sections.

Once the dummy linker script is created, we want it to be used for
everything to avoid having two redundant representations that can get
out of sync.

We were already clearing OutputSections. With this patch we clear the
Sections vector of every OutputSection.

llvm-svn: 303703

7 years agoUse more strict types. NFC.
Rafael Espindola [Tue, 23 May 2017 22:47:31 +0000 (22:47 +0000)]
Use more strict types. NFC.

By the time we get to linker scripts, all special InputSectionBase
should have been combined into synthetic sections, which are a type of
InputSection. The net result is that we can use InputSection in a few
places that were using InputSectionBase.

llvm-svn: 303702

7 years agoFixes for tests for r303698
George Karpenkov [Tue, 23 May 2017 22:42:34 +0000 (22:42 +0000)]
Fixes for tests for r303698

llvm-svn: 303701

7 years ago[LIR] Strengthen the check for recurrence variable in popcnt/CTLZ.
Davide Italiano [Tue, 23 May 2017 22:32:56 +0000 (22:32 +0000)]
[LIR] Strengthen the check for recurrence variable in popcnt/CTLZ.

Fixes PR33114.
Differential Revision:  https://reviews.llvm.org/D33420

llvm-svn: 303700

7 years ago[modules] When reparenting a local declaration, don't mark the declaration as
Richard Smith [Tue, 23 May 2017 22:02:49 +0000 (22:02 +0000)]
[modules] When reparenting a local declaration, don't mark the declaration as
being visible with its owning module if we're not tracking owning modules for
local declarations.

This avoids the possibility of a declaration being (meaninglessly) marked as
hidden with no owning module, which would otherwise lead to violated AST
invariants (checked by the added assertion).

llvm-svn: 303699