platform/upstream/llvm.git
7 years ago[clangd] Replaced WorkerRequest with std::function...
Ilya Biryukov [Tue, 23 May 2017 13:42:59 +0000 (13:42 +0000)]
[clangd] Replaced WorkerRequest with std::function...

Summary:
And implemented a helper function to dump an AST of a file for
testing/debugging purposes.

Reviewers: bkramer, krasimir

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 303634

7 years ago[JumpThreading] Safely replace uses of condition
Anna Thomas [Tue, 23 May 2017 13:36:25 +0000 (13:36 +0000)]
[JumpThreading] Safely replace uses of condition

This patch builds over https://reviews.llvm.org/rL303349 and replaces
the use of the condition only if it is safe to do so.

We should not blindly RAUW the condition if experimental.guard or assume
is a use of that
condition. This is because LVI may have used the guard/assume to
identify the
value of the condition, and RUAWing will fold the guard/assume and uses
before the guards/assumes.

Reviewers: sanjoy, reames, trentxintong, mkazantsev

Reviewed by: sanjoy, reames

Subscribers: llvm-commits

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

llvm-svn: 303633

7 years ago[RuntimeDyld, PowerPC] Fix relocation detection overflow
Ulrich Weigand [Tue, 23 May 2017 12:43:57 +0000 (12:43 +0000)]
[RuntimeDyld, PowerPC] Fix relocation detection overflow

Code in RuntimeDyldELF currently uses 32-bit temporaries to detect
whether a PPC64 relocation target is out of range. This is incorrect,
and can mis-detect overflow where the distance between relocation site
and target is close to a multiple of 4GB. Fixed by using 64-bit
temporaries.

Noticed while debugging PR32650.

Reviewer: hfinkel

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

llvm-svn: 303632

7 years ago[NFC] [PolyhedralInfo] fix typo
Siddharth Bhat [Tue, 23 May 2017 11:41:52 +0000 (11:41 +0000)]
[NFC] [PolyhedralInfo] fix typo

"an" -> "and"

llvm-svn: 303631

7 years agoAllow to use vfs::FileSystem for file accesses inside ASTUnit.
Ilya Biryukov [Tue, 23 May 2017 11:37:52 +0000 (11:37 +0000)]
Allow to use vfs::FileSystem for file accesses inside ASTUnit.

Reviewers: bkramer, krasimir, arphaman, akyrtzi

Reviewed By: bkramer

Subscribers: klimek, cfe-commits

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

llvm-svn: 303630

7 years ago[Polly][NewPM] Reenable ScopPassManager unittest
Philip Pfaffe [Tue, 23 May 2017 11:28:50 +0000 (11:28 +0000)]
[Polly][NewPM] Reenable ScopPassManager unittest

llvm-svn: 303629

7 years agoPost-commit fix of a comment
Philip Pfaffe [Tue, 23 May 2017 11:25:05 +0000 (11:25 +0000)]
Post-commit fix of a comment

llvm-svn: 303628

7 years agoAdd support for new (3.0.11+) swigs
Pavel Labath [Tue, 23 May 2017 10:55:17 +0000 (10:55 +0000)]
Add support for new (3.0.11+) swigs

Summary:
A change in swig 3.0.9 has caused it to generate modules incompatible
with us using them as __init__.py (bug #769). Swig 3.0.11 adds a setting to help
fix this problem, so use that. Support for older versions of swig remains
unaffected.

Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 303627

7 years ago[libclang] [OpenCL] Expose more OpenCL CIndex types
Sven van Haastregt [Tue, 23 May 2017 10:36:43 +0000 (10:36 +0000)]
[libclang] [OpenCL] Expose more OpenCL CIndex types

Expose pipe, sampler_t, clk_event_t, queue_t, reserve_id_t, and all
image types.

Update the opencl-types.cl test RUN line such that we can test the
OpenCL 2.0 types.

Patch by Simon Perretta.

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

llvm-svn: 303626

7 years ago[clangd] Explicitly link against pthread.
Benjamin Kramer [Tue, 23 May 2017 10:29:54 +0000 (10:29 +0000)]
[clangd] Explicitly link against pthread.

llvm-svn: 303625

7 years ago[Polly][NewPM] Port CodeGen to the new PM
Philip Pfaffe [Tue, 23 May 2017 10:18:12 +0000 (10:18 +0000)]
[Polly][NewPM] Port CodeGen to the new PM

Summary: To move CG to the new PM I outlined the various helper that were previously members of the CG class into free static functions. The CG class itself I moved into a header, which is required because we need to include it in `RegisterPasses` eventually.

Reviewers: grosser, Meinersbur

Reviewed By: grosser

Subscribers: pollydev, llvm-commits, sanjoy

Tags: #polly

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

llvm-svn: 303624

7 years ago[clangd] Pick up deps via LLVM components, which will hopefully include pthread.
Benjamin Kramer [Tue, 23 May 2017 10:17:48 +0000 (10:17 +0000)]
[clangd] Pick up deps via LLVM components, which will hopefully include pthread.

llvm-svn: 303623

7 years ago[Polly][NewPM] Port IslAst to the new ScopPassManager
Philip Pfaffe [Tue, 23 May 2017 10:12:56 +0000 (10:12 +0000)]
[Polly][NewPM] Port IslAst to the new ScopPassManager

Summary: This patch ports IslAst to the new PM. The change is mostly straightforward. The only major modification required is making IslAst move-only, to correctly manage the isl resources it owns.

Reviewers: grosser, Meinersbur

Reviewed By: grosser

Subscribers: nemanjai, pollydev, llvm-commits

Tags: #polly

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

llvm-svn: 303622

7 years ago[Polly][NewPM] Port DependenceInfo to the new ScopPassManager.
Philip Pfaffe [Tue, 23 May 2017 10:09:06 +0000 (10:09 +0000)]
[Polly][NewPM] Port DependenceInfo to the new ScopPassManager.

Summary: This patch ports DependenceInfo to the new ScopPassManager. Printing is implemented as a seperate printer pass.

Reviewers: grosser, Meinersbur

Reviewed By: grosser

Subscribers: llvm-commits, pollydev

Tags: #polly

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

llvm-svn: 303621

7 years ago[AMDGPU] SDWA: Add assembler support for GFX9
Sam Kolton [Tue, 23 May 2017 10:08:55 +0000 (10:08 +0000)]
[AMDGPU] SDWA: Add assembler support for GFX9

Summary:
Added separate pseudo and real instruction for GFX9 SDWA instructions.
Currently supports only in assembler.
Depends D32493

Reviewers: vpykhtin, artem.tamazov

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

llvm-svn: 303620

7 years ago[mips] Make checks in CodeGen/mips-varargs.c less fragile
Simon Dardis [Tue, 23 May 2017 09:42:50 +0000 (09:42 +0000)]
[mips] Make checks in CodeGen/mips-varargs.c less fragile

This test was failing on our fork of clang because it was not capturing
[[ARG]] in the N32 case. Therefore it used the value from the last function
which does not always have to be the same. All other cases were already
capturing ARG so this appears to be an oversight.
The test now uses -enable-var-scope to prevent such errors in the future.

Reviewers: sdardis, atanasyan

Patch by: Alexander Richardson

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

llvm-svn: 303619

7 years ago[AArch64] Make instruction fusion more aggressive.
Florian Hahn [Tue, 23 May 2017 09:33:34 +0000 (09:33 +0000)]
[AArch64] Make instruction fusion more aggressive.

Summary:
This patch makes instruction fusion more aggressive by
* adding artificial edges between the successors of FirstSU and
  SecondSU, similar to BaseMemOpClusterMutation::clusterNeighboringMemOps.
* updating PostGenericScheduler::tryCandidate to keep clusters together,
   similar to GenericScheduler::tryCandidate.

This change increases the number of AES instruction pairs generated on
 Cortex-A57 and Cortex-A72. This doesn't change code at all in
 most benchmarks or general code, but we've seen improvement on kernels
 using AESE/AESMC and AESD/AESIMC.

Reviewers: evandro, kristof.beyls, t.p.northover, silviu.baranga, atrick, rengolin, MatzeB

Reviewed By: evandro

Subscribers: aemerson, rengolin, MatzeB, javed.absar, llvm-commits

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

llvm-svn: 303618

7 years ago[GlobalISel][X86] G_LOAD/G_STORE vec256/512 support
Igor Breger [Tue, 23 May 2017 08:23:51 +0000 (08:23 +0000)]
[GlobalISel][X86] G_LOAD/G_STORE vec256/512 support

Summary: mark G_LOAD/G_STORE vec256/512 legal for AVX/AVX512. Implement instruction selection.

Reviewers: zvi, guyblank

Reviewed By: zvi

Subscribers: rovka, llvm-commits, kristof.beyls

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

llvm-svn: 303617

7 years ago[clangd] Split clangd into library+executable (mainly for unit tests).
Ilya Biryukov [Tue, 23 May 2017 08:12:45 +0000 (08:12 +0000)]
[clangd] Split clangd into library+executable (mainly for unit tests).

Summary:
This commit itself doesn't add any unit tests, but one that does will
follow shortly.

Reviewers: krasimir, bkramer

Reviewed By: bkramer

Subscribers: mgorny, klimek, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 303616

7 years ago[ScopInfo] Translate foldAccessRelation to isl C++ [NFC]
Tobias Grosser [Tue, 23 May 2017 07:22:56 +0000 (07:22 +0000)]
[ScopInfo] Translate foldAccessRelation to isl C++ [NFC]

llvm-svn: 303615

7 years ago[KnownBits] Use !hasConflict() in asserts in place of Zero & One == 0 or similar...
Craig Topper [Tue, 23 May 2017 07:18:37 +0000 (07:18 +0000)]
[KnownBits] Use !hasConflict() in asserts in place of Zero & One == 0 or similar. NFC

llvm-svn: 303614

7 years ago[LV] Report multiple reasons for not vectorizing under allowExtraAnalysis
Ayal Zaks [Tue, 23 May 2017 07:08:02 +0000 (07:08 +0000)]
[LV] Report multiple reasons for not vectorizing under allowExtraAnalysis

The default behavior of -Rpass-analysis=loop-vectorizer is to report only the
first reason encountered for not vectorizing, if one is found, at which time the
vectorizer aborts its handling of the loop. This patch allows multiple reasons
for not vectorizing to be identified and reported, at the potential expense of
additional compile-time, under allowExtraAnalysis which can currently be turned
on by Clang's -fsave-optimization-record and opt's -pass-remarks-missed.

Removed from LoopVectorizationLegality::canVectorize() the redundant checking
and reporting if we CantComputeNumberOfIterations, as LAI::canAnalyzeLoop() also
does that. This redundancy is caught by a lit test once multiple reasons are
reported.

Patch initially developed by Dror Barak.

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

llvm-svn: 303613

7 years ago[ScopInfo] Translate buildMemIntrinsicAccessRelation to isl C++ [NFC]
Tobias Grosser [Tue, 23 May 2017 07:07:09 +0000 (07:07 +0000)]
[ScopInfo] Translate buildMemIntrinsicAccessRelation to isl C++ [NFC]

llvm-svn: 303612

7 years ago[ScopInfo] Translate assumeNoOutOfBound to isl C++ [NFC]
Tobias Grosser [Tue, 23 May 2017 07:07:07 +0000 (07:07 +0000)]
[ScopInfo] Translate assumeNoOutOfBound to isl C++ [NFC]

llvm-svn: 303611

7 years ago[ScopInfo] Translate applyAndSetFAD to isl C++
Tobias Grosser [Tue, 23 May 2017 07:07:05 +0000 (07:07 +0000)]
[ScopInfo] Translate applyAndSetFAD to isl C++

llvm-svn: 303610

7 years agolibDebugInfo: Support symbolizing using DWP files
David Blaikie [Tue, 23 May 2017 06:48:53 +0000 (06:48 +0000)]
libDebugInfo: Support symbolizing using DWP files

llvm-svn: 303609

7 years ago[ScopInfo] Translate isReadOnly to isl C++
Tobias Grosser [Tue, 23 May 2017 06:41:04 +0000 (06:41 +0000)]
[ScopInfo] Translate isReadOnly to isl C++

llvm-svn: 303608

7 years ago[AArch64] Fix PRR33100.
Akira Hatanaka [Tue, 23 May 2017 06:08:37 +0000 (06:08 +0000)]
[AArch64] Fix PRR33100.

This commit fixes a bug introduced in r301019 where optimizeLogicalImm
would replace a logical node's immediate operand that was CSE'd and
was also an operand of another node.

This commit fixes the bug by replacing the logical node instead of its
immediate operand.

rdar://problem/32295276

llvm-svn: 303607

7 years agoUpdate expected result for or-branch.ll . NFC
Amaury Sechet [Tue, 23 May 2017 05:42:54 +0000 (05:42 +0000)]
Update expected result for or-branch.ll . NFC

llvm-svn: 303606

7 years ago[coroutines] Skip over passthrough operator co_await
Gor Nishanov [Tue, 23 May 2017 05:25:31 +0000 (05:25 +0000)]
[coroutines] Skip over passthrough operator co_await

https://reviews.llvm.org/D31627

llvm-svn: 303605

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Tue, 23 May 2017 05:17:49 +0000 (05:17 +0000)]
Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.

llvm-svn: 303604

7 years ago[coroutines] Add emission of initial and final suspends
Gor Nishanov [Tue, 23 May 2017 05:04:01 +0000 (05:04 +0000)]
[coroutines] Add emission of initial and final suspends

https://reviews.llvm.org/D31608

llvm-svn: 303603

7 years agoCosmetic. Added braces to address gcc warning: suggest explicit braces to avoid ambig...
Galina Kistanova [Tue, 23 May 2017 05:00:10 +0000 (05:00 +0000)]
Cosmetic. Added braces to address gcc warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else].

llvm-svn: 303602

7 years agoTypeStreamMerger.h: Fix a \param in r303577. [-Wdocumentation]
NAKAMURA Takumi [Tue, 23 May 2017 04:49:24 +0000 (04:49 +0000)]
TypeStreamMerger.h: Fix a \param in r303577. [-Wdocumentation]

llvm-svn: 303601

7 years ago[ScopInfo] Simplify domains early
Tobias Grosser [Tue, 23 May 2017 04:26:28 +0000 (04:26 +0000)]
[ScopInfo] Simplify domains early

This speeds up scop modeling for scops with many redundent existentially
quantified constraints. For the attached test case, this change reduces
scop modeling time from minutes (hours?) to 0.15 seconds.

This change resolves a compilation timeout on the AOSP build.

Thanks Eli for reporting _and_ reducing the test case!

Reported-by: Eli Friedman <efriedma@codeaurora.org>
llvm-svn: 303600

7 years ago[coroutines] Add support for deallocation elision
Gor Nishanov [Tue, 23 May 2017 04:21:27 +0000 (04:21 +0000)]
[coroutines] Add support for deallocation elision

Wrap deallocation code with:

  if (auto *mem = coro.free()) Deallocate

When backend decides to elide allocations it will replace coro.free with nullptr to suppress deallocation code.

llvm-svn: 303599

7 years ago[coroutines] Replace all coro.frame builtins with an SSA value of coro.begin
Gor Nishanov [Tue, 23 May 2017 03:46:59 +0000 (03:46 +0000)]
[coroutines] Replace all coro.frame builtins with an SSA value of coro.begin

SemaCoroutine forms expressions referring to the coroutine frame of the enclosing coroutine using coro.frame builtin.
During codegen, we emit llvm.coro.begin intrinsic that returns the address of the coroutine frame.
When coro.frame is emitted, we replace it with SSA value of coro.begin.

llvm-svn: 303598

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Tue, 23 May 2017 01:20:52 +0000 (01:20 +0000)]
Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.

llvm-svn: 303597

7 years ago[coroutines] Add support for allocation elision
Gor Nishanov [Tue, 23 May 2017 01:13:17 +0000 (01:13 +0000)]
[coroutines] Add support for allocation elision

Summary:
We wrap allocation code so that backend can elide it if necessary.
llvm.coro.alloc intrinsic returns true, when allocation is needed and false otherwise.

```
  %NeedAlloc = call i1 @llvm.coro.alloc(token %2)
  br i1 %NeedAlloc, label %AllocBB, label %InitBB

AllocBB:
  %5 = call i64 @llvm.coro.size.i64()
  %call = call i8* @_Znwm(i64 %5) ; operator new
  br label %InitBB

InitBB:
  %Phi = phi i8* [ null, %0 ], [ %call, %4 ]
  call i8* @llvm.coro.begin(token %2, i8* %Phi)
```

Reviewers: majnemer, EricWF

Subscribers: cfe-commits

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

llvm-svn: 303596

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Tue, 23 May 2017 01:07:19 +0000 (01:07 +0000)]
Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.

llvm-svn: 303595

7 years ago[NFC, Refactor] Modernize TemplateIdAnnotation using TrailingObjects
Faisal Vali [Tue, 23 May 2017 01:07:12 +0000 (01:07 +0000)]
[NFC, Refactor] Modernize TemplateIdAnnotation using TrailingObjects

A refactoring of TemplateIdAnnotation that uses TrailingObjects to create a variably-sized object on the heap.

https://reviews.llvm.org/D31414

Thanks to Aaron B for the review!

llvm-svn: 303594

7 years agoAdjust clang test for r303590
Teresa Johnson [Tue, 23 May 2017 00:35:09 +0000 (00:35 +0000)]
Adjust clang test for r303590

Forgot to commit this separately from the llvm change to use a new
module flag type for pic and pie levels. Should fix the bot errors

llvm-svn: 303593

7 years agoFIX: Remove debugging assert left in previous commit
David Blaikie [Tue, 23 May 2017 00:31:24 +0000 (00:31 +0000)]
FIX: Remove debugging assert left in previous commit

Sorry for the bot noise.

llvm-svn: 303592

7 years agolibDebugInfo: Avoid independently parsing the same .dwo file for two separate CUs...
David Blaikie [Tue, 23 May 2017 00:30:42 +0000 (00:30 +0000)]
libDebugInfo: Avoid independently parsing the same .dwo file for two separate CUs residing there

NFC, just an optimization. Will be building on this for DWP support
shortly.

llvm-svn: 303591

7 years agoSupport for taking the max of module flags when linking, use for PIE/PIC
Teresa Johnson [Tue, 23 May 2017 00:08:00 +0000 (00:08 +0000)]
Support for taking the max of module flags when linking, use for PIE/PIC

Summary:
Add Max ModFlagBehavior, which can be used to take the max of two
module flag values when merging modules. Use it for the PIE and PIC
levels.

This avoids an error when we try to import from a module built -fpic
into a module built -fPIC, for example. For both PIE and PIC levels,
this will be legal, since the code generation gets more conservative
as the level is increased. Therefore we can take the max instead of
somehow trying to block importing between modules compiled with
different levels.

Reviewers: tmsriram, pcc

Subscribers: llvm-commits

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

llvm-svn: 303590

7 years agoAdd option to include multiple lines in snippets.
Richard Smith [Mon, 22 May 2017 23:51:40 +0000 (23:51 +0000)]
Add option to include multiple lines in snippets.

When a diagnostic includes a highlighted range spanning multiple lines, clang
now supports printing out multiple lines of context if necessary to show the
highlighted ranges. This is not yet exposed in the driver, but can be enabled
by "-Xclang -fcaret-diagnostics-max-lines -Xclang N".

This is experimental until we can find out whether it works well in practice,
and if so, what a good default for the maximum number of lines is.

llvm-svn: 303589

7 years ago[InstSimplify] Fix the indentation throughout the interface header file.
Craig Topper [Mon, 22 May 2017 23:50:40 +0000 (23:50 +0000)]
[InstSimplify] Fix the indentation throughout the interface header file.

The forward declarations and the SimplifyQuery class at the beginning of the namespace weren't indented. But the closing brace for SimplifyQuery and everything after it were indented.

This commit makes the whole file consistent to no identation per coding standards. The signature of every function in this file changed a few weeks ago so this isn't a big disturbance to the revision history.

llvm-svn: 303588

7 years ago[NewPM] Fix an innocent but silly typo. Reported by Craig Topper.
Davide Italiano [Mon, 22 May 2017 23:47:11 +0000 (23:47 +0000)]
[NewPM] Fix an innocent but silly typo. Reported by Craig Topper.

llvm-svn: 303587

7 years ago[NewPM] Add a temporary cl::opt() to test NewGVN.
Davide Italiano [Mon, 22 May 2017 23:41:40 +0000 (23:41 +0000)]
[NewPM] Add a temporary cl::opt() to test NewGVN.

llvm-svn: 303586

7 years agoAdded LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.
Galina Kistanova [Mon, 22 May 2017 22:46:31 +0000 (22:46 +0000)]
Added LLVM_FALLTHROUGH to address gcc warning: this statement may fall through.

llvm-svn: 303585

7 years ago[coroutines] Fix coro-eh-cleanup.cpp test
Gor Nishanov [Mon, 22 May 2017 22:41:28 +0000 (22:41 +0000)]
[coroutines] Fix coro-eh-cleanup.cpp test

llvm-svn: 303584

7 years ago[coroutines] Wrap the body of the coroutine in try-catch
Gor Nishanov [Mon, 22 May 2017 22:33:17 +0000 (22:33 +0000)]
[coroutines] Wrap the body of the coroutine in try-catch

Summary:
If unhandled_exception member function is present in the coroutine promise,
wrap the body of the coroutine in:

```
try {
  body
} catch(...) { promise.unhandled_exception(); }
```

Reviewers: EricWF, rnk, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 303583

7 years agoGive files from #line the characteristics of the current file
Reid Kleckner [Mon, 22 May 2017 21:42:58 +0000 (21:42 +0000)]
Give files from #line the characteristics of the current file

This allows #line directives to appear in system headers that have code
that clang would normally warn on. This is compatible with GCC, which is
easy to test by running `gcc -E`.

Fixes PR30752

llvm-svn: 303582

7 years ago[CodeGen] Fix uninitialized variables exposed by r303084
Vitaly Buka [Mon, 22 May 2017 21:33:54 +0000 (21:33 +0000)]
[CodeGen] Fix uninitialized variables exposed by r303084

All other calls of analyzeBranch reset PredTBB and PredFBB, so I assume it's
expected behavior.

llvm-svn: 303581

7 years agoInstructionSimplify: don't speculate about Constants changing.
Tim Northover [Mon, 22 May 2017 21:28:08 +0000 (21:28 +0000)]
InstructionSimplify: don't speculate about Constants changing.

When presented with an icmp/select pair, we can end up asking what would happen
if we replaced one constant with another in an instruction. This is a mistake,
while non-constant Values could become a constant, constants cannot change and
trying to do so can lead to completely invalid IR (a GEP referencing a
non-existant field in the original case).

llvm-svn: 303580

7 years ago[lld] Infer relocation model from module flags in relocatable LTO link.
Evgeniy Stepanov [Mon, 22 May 2017 21:11:44 +0000 (21:11 +0000)]
[lld] Infer relocation model from module flags in relocatable LTO link.

Fix for PR33096.

llvm-svn: 303579

7 years agoInfer relocation model from module flags in relocatable LTO link.
Evgeniy Stepanov [Mon, 22 May 2017 21:11:35 +0000 (21:11 +0000)]
Infer relocation model from module flags in relocatable LTO link.

Fix for PR33096.

llvm-svn: 303578

7 years agoImplement various flavors of type merging.
Zachary Turner [Mon, 22 May 2017 21:07:43 +0000 (21:07 +0000)]
Implement various flavors of type merging.

Previous algotirhm assumed that types and ids are in a single
unified stream.  For inputs that come from object files, this
is the case.  But if the input is already a PDB, or is the result
of a previous merge, then the types and ids will already have
been split up, in which case we need an algorithm that can
accept operate on independent streams of types and ids that
refer across stream boundaries to each other.

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

llvm-svn: 303577

7 years agoMake TypeSerializer's StringMap use the same allocator.
Zachary Turner [Mon, 22 May 2017 21:07:14 +0000 (21:07 +0000)]
Make TypeSerializer's StringMap use the same allocator.

llvm-svn: 303576

7 years agoDon't generate line&scope debug info for meta-instructions.
Adrian Prantl [Mon, 22 May 2017 20:47:09 +0000 (20:47 +0000)]
Don't generate line&scope debug info for meta-instructions.

MachineInstructions that don't generate any code (such as
IMPLICIT_DEFs) should not generate any debug info either.

Fixes PR33107.

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

This reapplies r303566 without any modifications. The stage2 build
failures persisted even after reverting this patch, and looking back
through history, it looks like these tests are flaky.

llvm-svn: 303575

7 years agoFix update VP metadata after inlining for instrumentation PGO
Teresa Johnson [Mon, 22 May 2017 20:28:18 +0000 (20:28 +0000)]
Fix update VP metadata after inlining for instrumentation PGO

Summary:
With instrumentation profiling, when updating the VP metadata after
an inline, VP metadata on the inlined copy was inadvertantly having
all counts zeroed out. This was causing indirect calls from code inlined
during the call step to be marked as cold in the ThinLTO summaries and
not imported.

The CallerBFI needs to be passed down so that the CallSiteCount can be
computed from the profile summary info. With Sample PGO this was working
since the count is extracted from the branch weight metadata on the
call being inlined (even before we stopped looking at metadata for
non-sample PGO in r302844 this largely wasn't working for instrumentation
PGO since only promoted indirect calls would be getting inlined and have
the metadata).

Added an instrumentation PGO test and renamed the sample PGO test.

Reviewers: danielcdh, eraman

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 303574

7 years ago[coroutines] Build GRO declaration and return GRO statement
Gor Nishanov [Mon, 22 May 2017 20:22:23 +0000 (20:22 +0000)]
[coroutines] Build GRO declaration and return GRO statement

Summary:
1. build declaration of the gro local variable that keeps the result of get_return_object.
2. build return statement returning the gro variable
3. emit them during CodeGen
4. sema and CodeGen tests updated

Reviewers: EricWF, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 303573

7 years ago[Hexagon] Fix definitions of vector predicate loads and stores
Krzysztof Parzyszek [Mon, 22 May 2017 20:02:53 +0000 (20:02 +0000)]
[Hexagon] Fix definitions of vector predicate loads and stores

This fixes http://llvm.org/PR33048.

llvm-svn: 303572

7 years ago[DataLayout] Add llvm_unreachable to the default of a nested switch statement that...
Craig Topper [Mon, 22 May 2017 19:28:36 +0000 (19:28 +0000)]
[DataLayout] Add llvm_unreachable to the default of a nested switch statement that covers all values given to it by the outer switch. NFC

llvm-svn: 303571

7 years agoRevert "Don't generate line&scope debug info for meta-instructions."
Adrian Prantl [Mon, 22 May 2017 18:50:12 +0000 (18:50 +0000)]
Revert "Don't generate line&scope debug info for meta-instructions."

This reverts commit r303566 while investigating a stage2 buildbot failure.

llvm-svn: 303570

7 years ago[AMDGPU] Narrow lshl from 64 to 32 bit if possible
Stanislav Mekhanoshin [Mon, 22 May 2017 16:58:10 +0000 (16:58 +0000)]
[AMDGPU] Narrow lshl from 64 to 32 bit if possible

Turn expensive 64 bit shift into 32 bit if shift does not overflow int:
shl (ext x) => zext (shl x)

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

llvm-svn: 303569

7 years ago[index] Index the default template parameter values
Alex Lorenz [Mon, 22 May 2017 16:50:54 +0000 (16:50 +0000)]
[index] Index the default template parameter values

rdar://32323724

llvm-svn: 303568

7 years ago[PartialInlining] Add internal options to enable partial inlining in pass pipeline...
Xinliang David Li [Mon, 22 May 2017 16:41:57 +0000 (16:41 +0000)]
[PartialInlining] Add internal options to enable partial inlining in pass pipeline (off by default)

1. Legacy: -mllvm -enable-partial-inlining
2. New:  -mllvm -enable-npm-partial-inlining -fexperimental-new-pass-manager

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

llvm-svn: 303567

7 years agoDon't generate line&scope debug info for meta-instructions.
Adrian Prantl [Mon, 22 May 2017 16:21:02 +0000 (16:21 +0000)]
Don't generate line&scope debug info for meta-instructions.

MachineInstructions that don't generate any code (such as
IMPLICIT_DEFs) should not generate any debug info either.

Fixes PR33107.

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

llvm-svn: 303566

7 years ago[mips] Add one more check to the micromips attribute test case. NFC
Simon Atanasyan [Mon, 22 May 2017 15:53:34 +0000 (15:53 +0000)]
[mips] Add one more check to the micromips attribute test case. NFC

llvm-svn: 303565

7 years ago[mips] Quote command line options with `` in the micromips attribute description...
Simon Atanasyan [Mon, 22 May 2017 15:53:31 +0000 (15:53 +0000)]
[mips] Quote command line options with `` in the micromips attribute description. NFC

llvm-svn: 303564

7 years ago[index] Index the deleted functions
Alex Lorenz [Mon, 22 May 2017 15:42:45 +0000 (15:42 +0000)]
[index] Index the deleted functions

rdar://32323386

llvm-svn: 303563

7 years ago[Sema][ObjC] Fix a bug where -Wunguarded-availability was emitted at the wrong location
Erik Pilkington [Mon, 22 May 2017 15:41:12 +0000 (15:41 +0000)]
[Sema][ObjC] Fix a bug where -Wunguarded-availability was emitted at the wrong location

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

llvm-svn: 303562

7 years ago[CodeGen] Add invalidation of the loop SCEVs after merge block generation.
Michael Kruse [Mon, 22 May 2017 15:36:53 +0000 (15:36 +0000)]
[CodeGen] Add invalidation of the loop SCEVs after merge block generation.

The SCEVs of loops surrounding the escape users of a merge blocks are
forgotten, so that loop trip counts based on old values can be revoked.

This fixes llvm.org//PR32536

Contributed-by: Baranidharan Mohan <mbdharan@gmail.com>
Differential Revision: https://reviews.llvm.org/D33195

llvm-svn: 303561

7 years ago[DAG] Rework store merge to loop on load candidates. NFCI.
Nirav Dave [Mon, 22 May 2017 15:33:47 +0000 (15:33 +0000)]
[DAG] Rework store merge to loop on load candidates. NFCI.

Continue to consider remaining candidate merges until all possible
merges have been considered.

llvm-svn: 303560

7 years ago[index] Visit the default argument values in function definitions
Alex Lorenz [Mon, 22 May 2017 15:17:44 +0000 (15:17 +0000)]
[index] Visit the default argument values in function definitions

rdar://32323315

llvm-svn: 303559

7 years ago[X86] Remove target feature info from mul-i256.ll test. NFC.
Nirav Dave [Mon, 22 May 2017 15:04:08 +0000 (15:04 +0000)]
[X86] Remove target feature info from mul-i256.ll test. NFC.

llvm-svn: 303558

7 years agoclang-format: [JS] avoid line breaks before unindented r_parens.
Martin Probst [Mon, 22 May 2017 14:58:26 +0000 (14:58 +0000)]
clang-format: [JS] avoid line breaks before unindented r_parens.

The change that enabled wrapping at the previous scope's indentation had
unintended side-effects in that clang-format would prefer to wrap
closing parentheses to the next line if it avoided a wrap on the next
line (assuming very narrow lines):

    fooObject
        .someCall(barbazbam)
        .then(bam);

Would get formatted as:

    fooObject.someCall(barbazbam
    ).then(bam);

Because the ')' is now indented at the parent level (fooObject).

Normally formatting a builder pattern style call sequence like that is
outlawed in clang-format anyway. However for JavaScript this is special
cased to support trailing .bind calls.

This change disallows this special case when following a closing ')' to
avoid the problem.

Included are some random comment fixes.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 303557

7 years agoclang-format: do not reflow bullet lists
Francois Ferrand [Mon, 22 May 2017 14:47:17 +0000 (14:47 +0000)]
clang-format: do not reflow bullet lists

Summary:
This patch prevents reflowing bullet lists in block comments.

It handles all lists supported by doxygen and markdown, e.g. bullet
lists starting with '-', '*', '+', as well as numbered lists starting
with -# or a number followed by a dot.

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: djasper, klimek, cfe-commits

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

llvm-svn: 303556

7 years ago[index] 'using namespace' declarations in functions should record
Alex Lorenz [Mon, 22 May 2017 14:39:39 +0000 (14:39 +0000)]
[index] 'using namespace' declarations in functions should record
the reference to the namespace

rdar://32323190

llvm-svn: 303555

7 years ago[clang-tidy] misc-move-const-arg shouldn't complain on std::move(lambda)
Alexander Kornienko [Mon, 22 May 2017 14:30:14 +0000 (14:30 +0000)]
[clang-tidy] misc-move-const-arg shouldn't complain on std::move(lambda)

llvm-svn: 303554

7 years agoFix incorrect Status -> Error rename in IOHandler
Pavel Labath [Mon, 22 May 2017 14:13:38 +0000 (14:13 +0000)]
Fix incorrect Status -> Error rename in IOHandler

Change 302872 was a massive rename of the Error class to Status.

The change included an incorrect rename of the "Status" window
in the LLDB GUI from "Status to "Error". This patch undoes this incorrect
rename and restores the status window's correct name.

Differential Revision: https://reviews.llvm.org/D33241
Patch by Brian Gianforcaro.

llvm-svn: 303553

7 years ago[clang-tidy] readability-redundant-declaration false positive for defaulted function
Alexander Kornienko [Mon, 22 May 2017 13:58:57 +0000 (13:58 +0000)]
[clang-tidy] readability-redundant-declaration false positive for defaulted function

Summary:
```
template <class T>
struct C {
  C();
};

template <class T>
C<T>::C() = default;
```

Causes a readability-redundant-declaration diagnostic. This is caused by `isDefinition` not matching defaulted functions.

Reviewers: alexfh, danielmarjamaki

Reviewed By: alexfh

Subscribers: xazax.hun, cfe-commits

Patch by Florian Gross!
Differential Revision: https://reviews.llvm.org/D33358

llvm-svn: 303552

7 years ago[clang-tidy] readability-braces-around-statements false positive with char literals
Alexander Kornienko [Mon, 22 May 2017 13:58:16 +0000 (13:58 +0000)]
[clang-tidy] readability-braces-around-statements false positive with char literals

Summary:
Single-line if statements cause a false positive when the last token in the conditional statement is a char constant:

```
if (condition)
  return 'a';
```

For some reason `findEndLocation` seems to skips too many (vertical) whitespaces in this case. The same problem already occured with string literals (https://reviews.llvm.org/D25558), and was fixed by adding a special check for this very case. I just extended the condition to also include char constants. No idea what really causes the issue though.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: xazax.hun, cfe-commits

Patch by Florian Gross!
Differential Revision: https://reviews.llvm.org/D33354

llvm-svn: 303551

7 years ago[Docs] Use ReadTheDocs theme if available.
Siddharth Bhat [Mon, 22 May 2017 13:36:15 +0000 (13:36 +0000)]
[Docs] Use ReadTheDocs theme if available.

Use ReadTheDocs theme for Sphinx if available since it is well
maintained and used by readthedocs.org.

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

llvm-svn: 303550

7 years ago[Docs] Fix Sphinx documentation in CMake check.
Siddharth Bhat [Mon, 22 May 2017 13:16:02 +0000 (13:16 +0000)]
[Docs] Fix Sphinx documentation in CMake check.

Summary:
- `include(AddSphinxTarget)` needs to occur before checking `SPHINX_FOUND`.
- `docs-polly-html` and `docs-polly-man` are now usable again.
- Perhaps we should build docs in the CI as well?

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

llvm-svn: 303549

7 years ago[AMDGPU] Fix incorrect register usage tracking in GCNUpwardTracker
Valery Pykhtin [Mon, 22 May 2017 13:09:40 +0000 (13:09 +0000)]
[AMDGPU] Fix incorrect register usage tracking in GCNUpwardTracker

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

llvm-svn: 303548

7 years ago[clangd] Switch to incomplete translation units
Krasimir Georgiev [Mon, 22 May 2017 12:49:08 +0000 (12:49 +0000)]
[clangd] Switch to incomplete translation units

Summary: This speeds up code completion. All the cool kids (ycmd) are doing it.

Reviewers: bkramer, ilya-biryukov

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 303547

7 years ago[mips] Support `micromips` attribute
Simon Atanasyan [Mon, 22 May 2017 12:47:43 +0000 (12:47 +0000)]
[mips] Support `micromips` attribute

This patch adds support for the `micromips` and `nomicromips` attributes
for MIPS targets.

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

llvm-svn: 303546

7 years ago[mips] Support micromips attribute passed by front-end
Simon Atanasyan [Mon, 22 May 2017 12:47:41 +0000 (12:47 +0000)]
[mips] Support micromips attribute passed by front-end

This patch adds handling of the `micromips` and `nomicromips` attributes
passed by front-end. The patch depends on D33363.

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

llvm-svn: 303545

7 years ago[LoopPredication] NFC. Add extra debug output in case we fail to parse the range...
Artur Pilipenko [Mon, 22 May 2017 12:06:57 +0000 (12:06 +0000)]
[LoopPredication] NFC. Add extra debug output in case we fail to parse the range check

llvm-svn: 303544

7 years ago[LoopPredication] NFC. Move a nested struct declaration before the fields, clang...
Artur Pilipenko [Mon, 22 May 2017 12:01:32 +0000 (12:01 +0000)]
[LoopPredication] NFC. Move a nested struct declaration before the fields, clang-format a bit

This will simplify the diff for an upcoming review.

llvm-svn: 303543

7 years agoRevert r303259 - [globalisel][tablegen] Import rules containing intrinsic_wo_chain.
Daniel Sanders [Mon, 22 May 2017 10:14:33 +0000 (10:14 +0000)]
Revert r303259 - [globalisel][tablegen] Import rules containing intrinsic_wo_chain.

It's causing some buildbots to timeout whenever tablegen needs re-compilation,
particularly those with -fsanitize=memory but not only them. A compile time
regression was expected since it triples the amount of SelectionDAG rules we
are able to import but it's currently too high.

llvm-svn: 303542

7 years ago[clang-format] Keep trailing preprocessor line comments separate from the following...
Krasimir Georgiev [Mon, 22 May 2017 10:07:56 +0000 (10:07 +0000)]
[clang-format] Keep trailing preprocessor line comments separate from the following section comments

Summary:
r303415 changed the way a sequence of line comments following a preprocessor
macro is handled, which has the unfortunate effect of aligning a trailing
preprocessor line comment and following unrelated section comments, so:
```
#ifdef A // comment about A
// section comment
#endif
```
gets turned into:
```
#ifdef A // comment about A
         // section comment
#endif
```
This patch fixes this by additionally checking the original start columns of
the line comments.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 303541

7 years agoRe-apply r302416: [ARM] Clear the constant pool cache on explicit .ltorg directives
James Molloy [Mon, 22 May 2017 09:42:07 +0000 (09:42 +0000)]
Re-apply r302416: [ARM] Clear the constant pool cache on explicit .ltorg directives

Re-applying now that PR32825 which was raised on the commit this fixed up is now known to have also been fixed by this commit.

Original commit message:
    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: 303540

7 years agoRe-apply r286006: Fix 24560: assembler does not share constant pool for same constants
James Molloy [Mon, 22 May 2017 09:42:01 +0000 (09:42 +0000)]
Re-apply r286006: Fix 24560:  assembler does not share constant pool for same constants

Re-applying now that the open bug on this commit, PR32825, is known to be fixed.

Original commit message:
    Summary: This patch returns the same label if the CP entry with the same value has been created.

    Reviewers: eli.friedman, rengolin, jmolloy

    Subscribers: majnemer, jmolloy, llvm-commits

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

llvm-svn: 303539

7 years ago[MIPS] Add support to match more patterns for DINS instruction
Strahinja Petrovic [Mon, 22 May 2017 09:06:44 +0000 (09:06 +0000)]
[MIPS] Add support to match more patterns for DINS instruction

This patch adds support for recognizing patterns to match
DINS instruction.

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

llvm-svn: 303537

7 years agoRevert "[ARM] Clear the constant pool cache on explicit .ltorg directives"
James Molloy [Mon, 22 May 2017 08:49:28 +0000 (08:49 +0000)]
Revert "[ARM] Clear the constant pool cache on explicit .ltorg directives"

This reverts commit r302416. This was a fixup for r286006, which has now been reverted so this doesn't apply (either in concept or in code).

This commit itself has no problems, but the underlying issue it was fixing has now disappeared from the codebase.

llvm-svn: 303536

7 years agoRevert "Fix 24560: assembler does not share constant pool for same constants"
James Molloy [Mon, 22 May 2017 08:42:47 +0000 (08:42 +0000)]
Revert "Fix 24560:  assembler does not share constant pool for same constants"

This reverts commit r286006. It caused PR32825 and wasn't fixed.

llvm-svn: 303535

7 years agoclang-format: Allow customizing the penalty for breaking assignment
Francois Ferrand [Mon, 22 May 2017 08:28:17 +0000 (08:28 +0000)]
clang-format: Allow customizing the penalty for breaking assignment

Summary:
Add option to customize the penalty for breaking assignment

This allows increasing the priority of the assignment, to prefer spliting
an operation instead of splitting the assignment, e.g. :

  int a = bbbbbbbbbbbbbbbb +
          cccccccccccccccc;

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 303534