platform/upstream/llvm.git
7 years agoregenerate checks
Sanjay Patel [Tue, 9 Aug 2016 16:17:46 +0000 (16:17 +0000)]
regenerate checks

llvm-svn: 278130

7 years agoadd tests for missing vector icmp folds
Sanjay Patel [Tue, 9 Aug 2016 16:05:57 +0000 (16:05 +0000)]
add tests for missing vector icmp folds

llvm-svn: 278129

7 years ago[Profile] turn off verbose warnings by default
Xinliang David Li [Tue, 9 Aug 2016 15:35:28 +0000 (15:35 +0000)]
[Profile] turn off verbose warnings by default

no prof data for func warning is turned off by default
due to its high verbosity and minimal usefulness.

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

llvm-svn: 278127

7 years ago[GPGPU] Support PHI nodes used in GPU kernel
Tobias Grosser [Tue, 9 Aug 2016 15:35:06 +0000 (15:35 +0000)]
[GPGPU] Support PHI nodes used in GPU kernel

Ensure the right scalar allocations are used as the host location of data
transfers. For the device code, we clear the allocation cache before device
code generation to be able to generate new device-specific allocation and
we need to make sure to add back the old host allocations as soon as the
device code generation is finished.

llvm-svn: 278126

7 years ago[GPGPU] Use separate basic block for GPU initialization code
Tobias Grosser [Tue, 9 Aug 2016 15:35:03 +0000 (15:35 +0000)]
[GPGPU] Use separate basic block for GPU initialization code

This increases the readability of the IR and also clarifies that the GPU
inititialization is executed _after_ the scalar initialization which needs
to before the code of the transformed scop is executed.

Besides increased readability, the IR should not change. Specifically, I
do not expect any changes in program semantics due to this patch.

llvm-svn: 278125

7 years ago[BlockGenerator] Insert initializations at beginning of start block
Tobias Grosser [Tue, 9 Aug 2016 15:34:59 +0000 (15:34 +0000)]
[BlockGenerator] Insert initializations at beginning of start block

In case some code -- not guarded by control flow -- would be emitted directly in
the start block, it may happen that this code would use uninitalized scalar
values if the scalar initialization is only emitted at the end of the start
block. This is not a problem today in normal Polly, as all statements are
emitted in their own basic blocks, but Polly-ACC emits host-to-device copy
statements into the start block.

Additional Polly-ACC test coverage will be added in subsequent changes that
improve the handling of PHI nodes in Polly-ACC.

llvm-svn: 278124

7 years ago[ASTMatchers] Add matchers canReferToDecl() and hasUnderlyingDecl()
Martin Bohme [Tue, 9 Aug 2016 15:07:52 +0000 (15:07 +0000)]
[ASTMatchers] Add matchers canReferToDecl() and hasUnderlyingDecl()

Summary: Required for D22220

Reviewers: sbenza, klimek, aaron.ballman, alexfh

Subscribers: alexfh, klimek, cfe-commits

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

llvm-svn: 278123

7 years ago[LVI] Make LVI smarter about comparisons with non-constants
Artur Pilipenko [Tue, 9 Aug 2016 14:50:08 +0000 (14:50 +0000)]
[LVI] Make LVI smarter about comparisons with non-constants

Make LVI smarter about comparisons with a non-constant. For example, a s< b constraints a to be in [INT_MIN, INT_MAX) range. This is a part of https://llvm.org/bugs/show_bug.cgi?id=28620 fix.

Reviewed By: sanjoy

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

llvm-svn: 278122

7 years agoclang-format: Add SpaceAfterTemplate
Sylvestre Ledru [Tue, 9 Aug 2016 14:24:40 +0000 (14:24 +0000)]
clang-format: Add SpaceAfterTemplate

Summary:
This is required for compliance with the Mozilla style guide.

This is a rebase+minor change of Birunthan Mohanathas's patch

Reviewers: djasper

Subscribers: klimek, cfe-commits, opilarium

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

llvm-svn: 278121

7 years ago[X86][XOP] Add support for combining target shuffles to VPERMIL2PD/VPERMIL2PS
Simon Pilgrim [Tue, 9 Aug 2016 12:56:15 +0000 (12:56 +0000)]
[X86][XOP] Add support for combining target shuffles to VPERMIL2PD/VPERMIL2PS

llvm-svn: 278120

7 years agoAdd `#ifdef __cplusplus` around `extern "C"` in Compiler.h. NFC.
Kuba Brecka [Tue, 9 Aug 2016 12:12:15 +0000 (12:12 +0000)]
Add `#ifdef __cplusplus` around `extern "C"` in Compiler.h.  NFC.

llvm-svn: 278119

7 years agoReapply "Rewrite gdb-remote's SendContinuePacketAndWaitForResponse"
Pavel Labath [Tue, 9 Aug 2016 12:04:46 +0000 (12:04 +0000)]
Reapply "Rewrite gdb-remote's SendContinuePacketAndWaitForResponse"

Resumbitting the commit after fixing the following problems:
- broken unit tests on windows: incorrect gtest usage on my part (TEST vs. TEST_F)
- the new code did not correctly handle the case where we went to interrupt the process, but it
  stopped due to a different reason - the interrupt request would remain queued and would
  interfere with the following "continue". I also added a unit test for this case.

This reapplies r277156 and r277139.

llvm-svn: 278118

7 years agoAVX-512: A new test for FMA intrinsic
Elena Demikhovsky [Tue, 9 Aug 2016 11:54:14 +0000 (11:54 +0000)]
AVX-512: A new test for FMA intrinsic

A new test that explores sub-optimal sequence of FMA intrinsic and FNEG operation.
An upcoming patch will fix it.

llvm-svn: 278117

7 years ago[sanitizers] Make it possible to XFAIL on the effective target, not just the default.
Daniel Sanders [Tue, 9 Aug 2016 11:50:53 +0000 (11:50 +0000)]
[sanitizers] Make it possible to XFAIL on the effective target, not just the default.

Summary:
The triple is not the right thing to XFAIL on since LIT only sees the default
triple and not the effective triple chosen by any -target option in the RUN
directives. This discrepancy is shown in the table below:

  Default Triple   | Options                           | XFAIL  | LIT's expected result | Desired expectation
  =================+===================================+========+=======================+====================
  mips-linux-gnu   | -target mips-linux-gnu            |        | Pass                  | Pass
  mips-linux-gnu   | -target mips64-linux-gnu -mabi=64 |        | Pass                  | Pass
  mips-linux-gnu   | -target mips-linux-gnu            | mips   | Fail                  | Fail
  mips-linux-gnu   | -target mips64-linux-gnu -mabi=64 | mips   | Fail                  | Fail/Pass* (debatable**)
  mips-linux-gnu   | -target mips-linux-gnu            | mips-  | Fail                  | Fail
  mips-linux-gnu   | -target mips64-linux-gnu -mabi=64 | mips-  | Fail                  | Pass*
  mips-linux-gnu   | -target mips-linux-gnu            | mips64 | Pass                  | Pass
  mips-linux-gnu   | -target mips64-linux-gnu -mabi=64 | mips64 | Pass                  | Fail*
  mips64-linux-gnu | -target mips-linux-gnu            |        | Pass                  | Pass
  mips64-linux-gnu | -target mips64-linux-gnu -mabi=64 |        | Pass                  | Pass
  mips64-linux-gnu | -target mips-linux-gnu            | mips   | Fail                  | Fail*
  mips64-linux-gnu | -target mips64-linux-gnu -mabi=64 | mips   | Fail                  | Fail/Pass (debatable**)
  mips64-linux-gnu | -target mips-linux-gnu            | mips-  | Pass                  | Fail*
  mips64-linux-gnu | -target mips64-linux-gnu -mabi=64 | mips-  | Pass                  | Pass
  mips64-linux-gnu | -target mips-linux-gnu            | mips64 | Fail                  | Pass*
  mips64-linux-gnu | -target mips64-linux-gnu -mabi=64 | mips64 | Fail                  | Fail
  x64_64-linux-gnu | -target i386-linux-gnu            |        | Pass                  | Pass
  x64_64-linux-gnu | -target x86_64-linux-gnu          |        | Pass                  | Pass
  x64_64-linux-gnu | -target i386-linux-gnu            | i386   | Pass                  | Fail*
  x64_64-linux-gnu | -target x86_64-linux-gnu          | i386   | Pass                  | Pass
  x64_64-linux-gnu | -target i386-linux-gnu            | x86_64 | Fail                  | Pass
  x64_64-linux-gnu | -target x86_64-linux-gnu          | x86_64 | Fail                  | Fail*
  * These all differ from LIT's current behaviour.
  ** People's expectations vary depending on whether they know that LIT does a
   substring match on the default triple or think it's an exact match on an
   architecture.

This patch adds "target-is-${target_arch}" to the available features list and
updates the mips XFAIL's to use them. XFAIL'ing on these features will
correctly account for the target being tested. Making the table:

  Options                           | XFAIL            | LIT's expected result
  ==================================+==================+======================
  -target mips-linux-gnu            |                  | Pass
  -target mips64-linux-gnu -mabi=64 |                  | Pass
  -target mips-linux-gnu            | target-is-mips   | Fail
  -target mips64-linux-gnu -mabi=64 | target-is-mips   | Pass
  -target mips-linux-gnu            | target-is-mips64 | Pass
  -target mips64-linux-gnu -mabi=64 | target-is-mips64 | Fail
  -target i386-linux-gnu            |                  | Pass
  -target x86_64-linux-gnu          |                  | Pass
  -target i386-linux-gnu            | target-is-i386   | Fail
  -target x86_64-linux-gnu          | target-is-i386   | Pass
  -target i386-linux-gnu            | target-is-x86_64 | Pass
  -target x86_64-linux-gnu          | target-is-x86_64 | Fail

Reviewers: probinson

Subscribers: probinson, kubabrecka, llvm-commits, samsonov

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

llvm-svn: 278116

7 years ago[ELF] - Removed dead code. NFC.
George Rimar [Tue, 9 Aug 2016 10:57:42 +0000 (10:57 +0000)]
[ELF] - Removed dead code. NFC.

llvm-svn: 278115

7 years ago[X86][XOP] Add support for combining target shuffles to VPPERM
Simon Pilgrim [Tue, 9 Aug 2016 10:56:29 +0000 (10:56 +0000)]
[X86][XOP] Add support for combining target shuffles to VPPERM

llvm-svn: 278114

7 years ago[XRay] Test for xray_instr_map in object file. (NFC)
Dean Michael Berris [Tue, 9 Aug 2016 10:42:11 +0000 (10:42 +0000)]
[XRay] Test for xray_instr_map in object file. (NFC)

This makes a trivial change in the emission of the per-function XRay
tables, and makes sure that the xray_instr_map section does show up in
the object file.

llvm-svn: 278113

7 years ago[clang-rename] cleanup: use isWritten
Kirill Bobyrev [Tue, 9 Aug 2016 10:03:33 +0000 (10:03 +0000)]
[clang-rename] cleanup: use isWritten

nit: use isWritten and const auto *Initializer in
NamedDeclFindingASTVisitor::VisitCXXConstructorDecl method.
Test plan: make -j8 check-clang-tools (passed)

Patch by Alexander Shaposhnikov!

Reviewers: omtcyfz

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

llvm-svn: 278112

7 years agoFix Wdocumentation unknown parameter warning
Simon Pilgrim [Tue, 9 Aug 2016 10:02:11 +0000 (10:02 +0000)]
Fix Wdocumentation unknown parameter warning

llvm-svn: 278111

7 years ago[analyzer] Try to fix coverity CID 1360469.
Vassil Vassilev [Tue, 9 Aug 2016 10:00:23 +0000 (10:00 +0000)]
[analyzer] Try to fix coverity CID 1360469.

Patch by Raphael Isemann!

llvm-svn: 278110

7 years agoRevert 278107 which causes buildbot failures and in addition has wrong commit message
Artur Pilipenko [Tue, 9 Aug 2016 10:00:22 +0000 (10:00 +0000)]
Revert 278107 which causes buildbot failures and in addition has wrong commit message

llvm-svn: 278109

7 years ago[modules]Add missing include.
Vassil Vassilev [Tue, 9 Aug 2016 09:46:11 +0000 (09:46 +0000)]
[modules]Add missing include.

llvm-svn: 278108

7 years agoTeach CorrelatedValuePropagation to mark adds as no wrap
Artur Pilipenko [Tue, 9 Aug 2016 09:41:34 +0000 (09:41 +0000)]
Teach CorrelatedValuePropagation to mark adds as no wrap

Use LVI to prove that adds do not wrap. The change is motivated by https://llvm.org/bugs/show_bug.cgi?id=28620 bug and it's the first step to fix that problem.

Reviewed By: sanjoy

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

llvm-svn: 278107

7 years ago[X86][SSE] Fix memory folding of (v)roundsd / (v)roundss
Simon Pilgrim [Tue, 9 Aug 2016 09:32:34 +0000 (09:32 +0000)]
[X86][SSE] Fix memory folding of (v)roundsd / (v)roundss

We only had partial memory folding support for the intrinsic definitions, and (as noted on PR27481) was causing FR32/FR64/VR128 mismatch errors with the machine verifier.

This patch adds missing memory folding support for both intrinsics and the ffloor/fnearbyint/fceil/frint/ftrunc patterns and in doing so fixes the failing machine verifier stack folding tests from PR27481.

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

llvm-svn: 278106

7 years ago[LVI] NFC. Fix a typo Bofore -> Before
Artur Pilipenko [Tue, 9 Aug 2016 09:14:29 +0000 (09:14 +0000)]
[LVI] NFC. Fix a typo Bofore -> Before

llvm-svn: 278105

7 years ago[tests] Add two missing 'REQUIRES' lines
Tobias Grosser [Tue, 9 Aug 2016 09:11:39 +0000 (09:11 +0000)]
[tests] Add two missing 'REQUIRES' lines

llvm-svn: 278104

7 years ago[BlockGenerator] Also eliminate dead code not originating from BB
Tobias Grosser [Tue, 9 Aug 2016 08:59:05 +0000 (08:59 +0000)]
[BlockGenerator] Also eliminate dead code not originating from BB

After having generated the code for a ScopStmt, we run a simple dead-code
elimination that drops all instructions that are known to be and remain unused.
Until this change, we only considered instructions for dead-code elimination, if
they have a corresponding instruction in the original BB that belongs to
ScopStmt. However, when generating code we do not only copy code from the BB
belonging to a ScopStmt, but also generate code for operands referenced from BB.
After this change, we now also considers code for dead code elimination, which
does not have a corresponding instruction in BB.

This fixes a bug in Polly-ACC where such dead-code referenced CPU code from
within a GPU kernel, which is possible as we do not guarantee that all variables
that are used in known-dead-code are moved to the GPU.

llvm-svn: 278103

7 years ago[include-fixer] Support processing multiple files in one run.
Haojian Wu [Tue, 9 Aug 2016 08:26:19 +0000 (08:26 +0000)]
[include-fixer] Support processing multiple files in one run.

Summary:
Previously, if we pass multiple files or a file pattern (e.g. /path/to/*.cc) to
include-fixer, include-fixer will apply all replacements to the first argument,
which probably causes crashes.

With this patch, include-fixer can process multiple files now.

Vim and Emacs integration are tested manually.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 278102

7 years agoFix clang-tidy crash when a single fix is applied on multiple files.
Eric Liu [Tue, 9 Aug 2016 07:54:49 +0000 (07:54 +0000)]
Fix clang-tidy crash when a single fix is applied on multiple files.

Summary:
tooling::Replacements only holds replacements for a single file, so
this patch makes Fix a map from file paths to tooling::Replacements so that it
can be applied on multiple files.

Reviewers: hokein, alexfh

Subscribers: Prazek, cfe-commits

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

llvm-svn: 278101

7 years ago[GPGPU] Pass parameters always by using their own type
Tobias Grosser [Tue, 9 Aug 2016 07:22:08 +0000 (07:22 +0000)]
[GPGPU] Pass parameters always by using their own type

llvm-svn: 278100

7 years ago[clang-rename] fix bug with initializer lists
Kirill Bobyrev [Tue, 9 Aug 2016 07:14:48 +0000 (07:14 +0000)]
[clang-rename] fix bug with initializer lists

Clang-rename is currently not able to find a symbol in initializer list. This
patch fixes described issue.

Reviewers: alexfh

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

llvm-svn: 278099

7 years ago[X86] Reduce duplicated code in the execution domain lookup functions by passing...
Craig Topper [Tue, 9 Aug 2016 05:26:09 +0000 (05:26 +0000)]
[X86] Reduce duplicated code in the execution domain lookup functions by passing tables as an argument.

llvm-svn: 278098

7 years ago[AVX-512] Add support for execution domain switching masked logical ops between float...
Craig Topper [Tue, 9 Aug 2016 05:26:07 +0000 (05:26 +0000)]
[AVX-512] Add support for execution domain switching masked logical ops between floating point and integer domain.

This switches PS<->D and PD<->Q.

llvm-svn: 278097

7 years agoRemove unreachable `return`. NFC.
Rui Ueyama [Tue, 9 Aug 2016 04:50:26 +0000 (04:50 +0000)]
Remove unreachable `return`. NFC.

llvm-svn: 278096

7 years agoRemove isOutputDynamic and use Out<ELFT>::DynSymTab instead.
Rui Ueyama [Tue, 9 Aug 2016 04:42:01 +0000 (04:42 +0000)]
Remove isOutputDynamic and use Out<ELFT>::DynSymTab instead.

This patch is to not instantiate DynSymTab and DynStrTab if the
output is not a dynamic output.

llvm-svn: 278095

7 years agoRemove redundant variable.
Rui Ueyama [Tue, 9 Aug 2016 04:31:21 +0000 (04:31 +0000)]
Remove redundant variable.

llvm-svn: 278094

7 years agoSeparate {Preinit,Init,Fini}Arrays from Out<ELFT>::Dynamic.
Rui Ueyama [Tue, 9 Aug 2016 04:25:20 +0000 (04:25 +0000)]
Separate {Preinit,Init,Fini}Arrays from Out<ELFT>::Dynamic.

Even if an output is not a dynamic object, the output may have
.{preinit,init,fini} sections. Therefore, managing these sections
as Out<ELFT>::Dynamic's members is not correct.

llvm-svn: 278093

7 years ago[Profile] Implement new API __llvm_profile_dump
Xinliang David Li [Tue, 9 Aug 2016 04:21:14 +0000 (04:21 +0000)]
[Profile] Implement new API __llvm_profile_dump

The API is intended to be used by user to do fine
grained (per-region) control of profile dumping.

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

llvm-svn: 278092

7 years agoDo not pass the SymbolTable to writeResult.
Rui Ueyama [Tue, 9 Aug 2016 03:38:23 +0000 (03:38 +0000)]
Do not pass the SymbolTable to writeResult.

The SymbolTable is always accessible as Symtab<ELFT>::X,
so no need to pass it as an argument.

llvm-svn: 278091

7 years ago[X86] Remove the Fv packed logical operation alias instructions. Replace them with...
Craig Topper [Tue, 9 Aug 2016 03:06:33 +0000 (03:06 +0000)]
[X86] Remove the Fv packed logical operation alias instructions. Replace them with patterns to the regular instructions.

This enables execution domain fixing which is why the tests changed.

llvm-svn: 278090

7 years ago[X86] Cleanup patterns for AVX/SSE for PS operations. Always try to look for bitcasts...
Craig Topper [Tue, 9 Aug 2016 03:06:28 +0000 (03:06 +0000)]
[X86] Cleanup patterns for AVX/SSE for PS operations. Always try to look for bitcasts from floating point types. If only AVX1 is supported we also need to handle integer types with floating point ops without looking for bitcasts.

Previously SSE1 had a pattern that looked for integer types without bitcasts, but the type wasn't legal with only SSE1 and SSE2 add an identical pattern for the integer instructions.

llvm-svn: 278089

7 years ago[X86] Remove unnecessary bitcast from the front of AVX1Only 256-bit logical operation...
Craig Topper [Tue, 9 Aug 2016 03:06:26 +0000 (03:06 +0000)]
[X86] Remove unnecessary bitcast from the front of AVX1Only 256-bit logical operation patterns.

llvm-svn: 278088

7 years agoRemove *super* old test suite results doc for Linux and Windows.
Eric Fiselier [Tue, 9 Aug 2016 03:05:43 +0000 (03:05 +0000)]
Remove *super* old test suite results doc for Linux and Windows.

Neither of these results files has been update in years. Linux now has a dozen
or so buildbots tracking it and the Windows results are no longer relevant.
I plan on looking into getting a Windows buildbot going using Appveyor in the
coming days.

llvm-svn: 278087

7 years agoX86InstrInfo: Update liveness in classifyLea()
Matthias Braun [Tue, 9 Aug 2016 01:47:26 +0000 (01:47 +0000)]
X86InstrInfo: Update liveness in classifyLea()

We need to update liveness information when we create COPYs in
classifyLea().

This fixes http://llvm.org/28301

llvm-svn: 278086

7 years agoRemove redundant local variable.
Rui Ueyama [Tue, 9 Aug 2016 01:35:39 +0000 (01:35 +0000)]
Remove redundant local variable.

llvm-svn: 278085

7 years agoReduce dependency to OutputSectionFactory.
Rui Ueyama [Tue, 9 Aug 2016 01:35:38 +0000 (01:35 +0000)]
Reduce dependency to OutputSectionFactory.

The Factory class is too object-oriented-ish and easy to be abused.
This patch reduces dependency to that class. Eventually we want to
remove the dependency to that class from LinkerScript.

llvm-svn: 278084

7 years agoDo not initialize Out<ELFT>::Opd until needed.
Rui Ueyama [Tue, 9 Aug 2016 01:35:37 +0000 (01:35 +0000)]
Do not initialize Out<ELFT>::Opd until needed.

This change makes it clear that we need the variable only within
writeSections.

llvm-svn: 278083

7 years ago[WebAssembly] Fix bugs in WebAssemblyLowerEmscriptenExceptions pass
Derek Schuff [Tue, 9 Aug 2016 00:29:55 +0000 (00:29 +0000)]
[WebAssembly] Fix bugs in WebAssemblyLowerEmscriptenExceptions pass

* Delete extra '_' prefixes from JS library function names. fixImports()
  function in JS glue code deals with this for wasm.
* Change command-line option names in order to be consistent with
  asm.js.
* Add missing lowering code for llvm.eh.typeid.for intrinsics
* Delete commas in mangled function names
* Fix a function argument attributes bug. Because we add the pointer to
  the original callee as the first argument of invoke wrapper, all
  argument attribute indices have to be incremented by one.

Patch by Heejin Ahn

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

llvm-svn: 278081

7 years agoConsistently use CGSCCAnalysisManager
Sean Silva [Tue, 9 Aug 2016 00:28:56 +0000 (00:28 +0000)]
Consistently use CGSCCAnalysisManager

Besides a general consistently benefit, the extra layer of indirection
allows the mechanical part of https://reviews.llvm.org/D23256 that
requires touching every transformation and analysis to be factored out
cleanly.

Thanks to David for the suggestion.

llvm-svn: 278080

7 years agoConsistently use LoopAnalysisManager
Sean Silva [Tue, 9 Aug 2016 00:28:52 +0000 (00:28 +0000)]
Consistently use LoopAnalysisManager

One exception here is LoopInfo which must forward-declare it (because
the typedef is in LoopPassManager.h which depends on LoopInfo).

Also, some includes for LoopPassManager.h were needed since that file
provides the typedef.

Besides a general consistently benefit, the extra layer of indirection
allows the mechanical part of https://reviews.llvm.org/D23256 that
requires touching every transformation and analysis to be factored out
cleanly.

Thanks to David for the suggestion.

llvm-svn: 278079

7 years agoConsistently use ModuleAnalysisManager
Sean Silva [Tue, 9 Aug 2016 00:28:38 +0000 (00:28 +0000)]
Consistently use ModuleAnalysisManager

Besides a general consistently benefit, the extra layer of indirection
allows the mechanical part of https://reviews.llvm.org/D23256 that
requires touching every transformation and analysis to be factored out
cleanly.

Thanks to David for the suggestion.

llvm-svn: 278078

7 years agoConsistently use FunctionAnalysisManager
Sean Silva [Tue, 9 Aug 2016 00:28:15 +0000 (00:28 +0000)]
Consistently use FunctionAnalysisManager

Besides a general consistently benefit, the extra layer of indirection
allows the mechanical part of https://reviews.llvm.org/D23256 that
requires touching every transformation and analysis to be factored out
cleanly.

Thanks to David for the suggestion.

llvm-svn: 278077

7 years agoAdd lib directory to linker paths when using libunwind
Petr Hosek [Tue, 9 Aug 2016 00:27:19 +0000 (00:27 +0000)]
Add lib directory to linker paths when using libunwind

When using libunwind and not building as standalone project, we
need to add LLVM library directory to the list of linker directories
to ensure it can find libunwind dependency.

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

llvm-svn: 278076

7 years agoCodeView: extract the OMF Directory Header
Saleem Abdulrasool [Tue, 9 Aug 2016 00:25:12 +0000 (00:25 +0000)]
CodeView: extract the OMF Directory Header

The DebugDirectory contains a pointer to the CodeView info structure which is a
derivative of the OMF debug directory.  The structure has evolved a bit over
time, and PDB 2.0 used a slightly different definition from PDB 7.0.  Both of
these are specific to CodeView and not COFF.  Reflect this by moving the
structure definitions into the DebugInfo/CodeView headers.  Define a generic
DebugInfo union type that can be used to pass around a reference to the
DebugInfo irrespective of the versioning.  NFC.

llvm-svn: 278075

7 years ago[x86] split combineVSelectWithAllOnesOrZeros into a helper function; NFCI
Sanjay Patel [Tue, 9 Aug 2016 00:01:11 +0000 (00:01 +0000)]
[x86] split combineVSelectWithAllOnesOrZeros into a helper function; NFCI

llvm-svn: 278074

7 years ago[WebAssembly] Fix CFI index to account for padding nullptr function
Derek Schuff [Mon, 8 Aug 2016 23:56:01 +0000 (23:56 +0000)]
[WebAssembly] Fix CFI index to account for padding nullptr function

The WebAssembly linker now creates a dummy function at index 0 to
prevent miscomparisons with the NULL pointer, see
https://github.com/WebAssembly/binaryen/pull/658. Thanks to pcc for
pointing out this problem!

Patch by Dominic Chen

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

llvm-svn: 278073

7 years agoThe first string table entry should be a null terminated space, not just null.
Pete Cooper [Mon, 8 Aug 2016 23:20:04 +0000 (23:20 +0000)]
The first string table entry should be a null terminated space, not just null.

This matches the behaviour of ld64 which initializes the string table with
' ' then '\0'.  lld only had the '\0' and needed the ' '.

llvm-svn: 278071

7 years agoRevert "Do not ignore SizeOfOptionalHeader in COFF header even if PE header is not...
Rui Ueyama [Mon, 8 Aug 2016 23:07:03 +0000 (23:07 +0000)]
Revert "Do not ignore SizeOfOptionalHeader in COFF header even if PE header is not present."

This reverts commit r278066 to unbreak buildbots.

llvm-svn: 278070

7 years agoRevert r278065 while I investigate some build-bot breakage.
Lang Hames [Mon, 8 Aug 2016 22:57:30 +0000 (22:57 +0000)]
Revert r278065 while I investigate some build-bot breakage.

llvm-svn: 278069

7 years agoAllow building both shared and static library
Petr Hosek [Mon, 8 Aug 2016 22:57:25 +0000 (22:57 +0000)]
Allow building both shared and static library

This change allows building both shared and static version of libc++
in a single build, sharing object files between both versions.

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

llvm-svn: 278068

7 years agoAllow building both shared and static library
Petr Hosek [Mon, 8 Aug 2016 22:55:48 +0000 (22:55 +0000)]
Allow building both shared and static library

This change allows building both shared and static version of libunwind
in a single build, sharing object files between both versions.

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

llvm-svn: 278067

7 years agoDo not ignore SizeOfOptionalHeader in COFF header even if PE header is not present.
Rui Ueyama [Mon, 8 Aug 2016 22:54:22 +0000 (22:54 +0000)]
Do not ignore SizeOfOptionalHeader in COFF header even if PE header is not present.

Attribute SizeOfOptionalHeader is ignored if no PE header is present
in the file. This attribute should be ignored according to standard,
however there are uses of this field even though it should not be used.

This change does not conform to PE/COFF standard, but there are several
COFF files without PE header, where you had to add up SizeOfOptionalHeader
in order to get proper section headers. Other tools and their own parsers
do take this into account.

Patch by Marek Milkovič!

https://reviews.llvm.org/D22750

llvm-svn: 278066

7 years ago[RuntimeDyld][Orc][MCJIT] Add partial weak-symbol support to RuntimeDyld.
Lang Hames [Mon, 8 Aug 2016 22:53:37 +0000 (22:53 +0000)]
[RuntimeDyld][Orc][MCJIT] Add partial weak-symbol support to RuntimeDyld.

This patch causes RuntimeDyld to check for existing definitions when it
encounters weak symbols. If a definition already exists then the new weak
definition is discarded. All symbol lookups within a "logical dylib" should now
agree on the address of any given weak symbol. This allows the JIT to better
match the behavior of the static linker for C++ code.

This support is only partial, as it does not allow strong definitions that
occur after the first weak definition (in JIT symbol lookup order) to override
the previous weak definitions. Support for this will be added in a future
patch.

llvm-svn: 278065

7 years agoGarbage collection is not around anymore, we can remove our support for it.
Greg Clayton [Mon, 8 Aug 2016 22:48:57 +0000 (22:48 +0000)]
Garbage collection is not around anymore, we can remove our support for it.

llvm-svn: 278064

7 years agoFix more RegisterInfo initialization issues and quiet hundreds of warnings.
Greg Clayton [Mon, 8 Aug 2016 22:48:07 +0000 (22:48 +0000)]
Fix more RegisterInfo initialization issues and quiet hundreds of warnings.

llvm-svn: 278063

7 years ago[ScopDetection] Remove unused DetectionContexts during expansion.
Michael Kruse [Mon, 8 Aug 2016 22:39:32 +0000 (22:39 +0000)]
[ScopDetection] Remove unused DetectionContexts during expansion.

The function expandRegion() frees Region* objects again when it determines that
these are not valid SCoPs. However, the DetectionContext added to the
DetectionContextMap still holds a reference. The validity is checked using the
ValidRegions lookup table. When a new Region is added to that list, it might
share the same address, such that the DetectionContext contains two
Region* associations that are in ValidRegions, but that are unrelated and of
which one has already been free.

Also remove the DetectionContext when not a valid expansion.

llvm-svn: 278062

7 years agoFix printf warnings.
Greg Clayton [Mon, 8 Aug 2016 22:16:03 +0000 (22:16 +0000)]
Fix printf warnings.

llvm-svn: 278061

7 years agoFix RegisterInfo initializers to have all the required initializers after recent...
Greg Clayton [Mon, 8 Aug 2016 22:15:35 +0000 (22:15 +0000)]
Fix RegisterInfo initializers to have all the required initializers after recent changes. This quiets a few hundred warnings on MacOSX.

llvm-svn: 278060

7 years agoDo not depend on unwind when building standalone
Petr Hosek [Mon, 8 Aug 2016 22:09:54 +0000 (22:09 +0000)]
Do not depend on unwind when building standalone

When libcxxabi is being built standalone, unwind dependency is not
available, so do not use it even when LLVM unwinder is being
requested.

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

llvm-svn: 278058

7 years agoCOFF: handle /debugtype option
Saleem Abdulrasool [Mon, 8 Aug 2016 22:02:44 +0000 (22:02 +0000)]
COFF: handle /debugtype option

Add the support infrastructure for the /debugtype option which takes a comma
delimited list of debug info to generate. The defaults are based on other
options potentially (/driver or /profile). This sets up the infrastructure to
allow us to emit RSDS records to get "build id" equivalents on COFF (similar to
binutils).

llvm-svn: 278056

7 years agoRevert "[X86] Support the "ms-hotpatch" attribute."
Charles Davis [Mon, 8 Aug 2016 21:20:15 +0000 (21:20 +0000)]
Revert "[X86] Support the "ms-hotpatch" attribute."

This reverts commit r278048. Something changed between the last time I
built this--it takes awhile on my ridiculously slow and ancient
computer--and now that broke this.

llvm-svn: 278053

7 years agoRevert "[Attr] Add support for the `ms_hook_prologue` attribute."
Charles Davis [Mon, 8 Aug 2016 21:19:08 +0000 (21:19 +0000)]
Revert "[Attr] Add support for the `ms_hook_prologue` attribute."

This reverts commit r278050. It depends on r278048, which will be
reverted.

llvm-svn: 278052

7 years ago[Driver] Enable CFI for WebAssembly
Derek Schuff [Mon, 8 Aug 2016 21:14:15 +0000 (21:14 +0000)]
[Driver] Enable CFI for WebAssembly

Since CFI support has landed in the WebAssembly backend, enable it in
the frontend driver.

Patch by Dominic Chen

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

llvm-svn: 278051

7 years ago[Attr] Add support for the `ms_hook_prologue` attribute.
Charles Davis [Mon, 8 Aug 2016 21:03:39 +0000 (21:03 +0000)]
[Attr] Add support for the `ms_hook_prologue` attribute.

Summary:
Based on a patch by Michael Mueller.

This attribute specifies that a function can be hooked or patched. This
mechanism was originally devised by Microsoft for hotpatching their
binaries (which they're constantly updating to stay ahead of crackers,
script kiddies, and other ne'er-do-wells on the Internet), but it's now
commonly abused by Windows programs that want to hook API functions. It
is for this reason that this attribute was added to GCC--hence the name,
`ms_hook_prologue`.

Depends on D19908.

Reviewers: rnk, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 278050

7 years agoInstCombine: Remove a redundant #ifdef NDEBUG. NFC
Justin Bogner [Mon, 8 Aug 2016 21:02:11 +0000 (21:02 +0000)]
InstCombine: Remove a redundant #ifdef NDEBUG. NFC

The DEBUG() macro already does this.

llvm-svn: 278049

7 years ago[X86] Support the "ms-hotpatch" attribute.
Charles Davis [Mon, 8 Aug 2016 21:01:39 +0000 (21:01 +0000)]
[X86] Support the "ms-hotpatch" attribute.

Summary:
Based on two patches by Michael Mueller.

This is a target attribute that causes a function marked with it to be
emitted as "hotpatchable". This particular mechanism was originally
devised by Microsoft for patching their binaries (which they are
constantly updating to stay ahead of crackers, script kiddies, and other
ne'er-do-wells on the Internet), but is now commonly abused by Windows
programs to hook API functions.

This mechanism is target-specific. For x86, a two-byte no-op instruction
is emitted at the function's entry point; the entry point must be
immediately preceded by 64 (32-bit) or 128 (64-bit) bytes of padding.
This padding is where the patch code is written. The two byte no-op is
then overwritten with a short jump into this code. The no-op is usually
a `movl %edi, %edi` instruction; this is used as a magic value
indicating that this is a hotpatchable function.

Reviewers: majnemer, sanjoy, rnk

Subscribers: dberris, llvm-commits

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

llvm-svn: 278048

7 years agoRefactor getMipsEFlags.
Rui Ueyama [Mon, 8 Aug 2016 19:39:45 +0000 (19:39 +0000)]
Refactor getMipsEFlags.

Previously, we incrementally updated the reuslting flag as we check
file flags, so it was not very clear who is updating what flags.
This patch makes them pure functions -- that has no side effect and
don't update arguments to improve readability.

Now each function construct a patial result, and all resutls are then
bitwise-OR'ed to construct the final result.

This patch also creates a new file, Mips.cpp, to move all these
MIPS functions to a separate file.

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

llvm-svn: 278042

7 years ago[MemorySSA] Fix windows build breakage caused by r278028 (take 2)
Geoff Berry [Mon, 8 Aug 2016 19:33:27 +0000 (19:33 +0000)]
[MemorySSA] Fix windows build breakage caused by r278028 (take 2)

r278028: [MemorySSA] Ensure address stability of MemorySSA object.
llvm-svn: 278041

7 years ago[Hexagon] Add pattern for 64-bit mulhs
Krzysztof Parzyszek [Mon, 8 Aug 2016 19:24:25 +0000 (19:24 +0000)]
[Hexagon] Add pattern for 64-bit mulhs

llvm-svn: 278040

7 years ago[GPGPU] Support Values referenced from both isl expr and llvm instructions
Tobias Grosser [Mon, 8 Aug 2016 19:22:19 +0000 (19:22 +0000)]
[GPGPU] Support Values referenced from both isl expr and llvm instructions

When adding code that avoids to pass values used in isl expressions and
LLVM instructions twice, we forgot to make single variable passed to the
kernel available in the ValueMap that makes it usable for instructions that
are not replaced with isl ast expressions. This change adds the variable
that is passed to the kernel to the ValueMap to ensure it is available
for such use cases as well.

llvm-svn: 278039

7 years ago[LoopUnroll] Simplify loops created by unrolling.
Michael Zolotukhin [Mon, 8 Aug 2016 19:02:15 +0000 (19:02 +0000)]
[LoopUnroll] Simplify loops created by unrolling.

Summary:
Currently loop-unrolling doesn't preserve loop-simplified form. This patch
fixes it by resimplifying affected loops.

Reviewers: chandlerc, sanjoy, hfinkel

Subscribers: llvm-commits

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

llvm-svn: 278038

7 years agoRefreshCallGraph does not modify the SCC, adding "const" to make it clear (NFC)
Mehdi Amini [Mon, 8 Aug 2016 18:51:05 +0000 (18:51 +0000)]
RefreshCallGraph does not modify the SCC, adding "const" to make it clear (NFC)

llvm-svn: 278037

7 years agoFix linking of omp_foreign_thread_team_reuse test on FreeBSD
Dimitry Andric [Mon, 8 Aug 2016 18:34:05 +0000 (18:34 +0000)]
Fix linking of omp_foreign_thread_team_reuse test on FreeBSD

Summary:
On FreeBSD, linking the misc_bugs/omp_foreign_thread_team_reuse.c test
case fails with:

   /usr/local/bin/ld: /tmp/omp_foreign_thread_team_reuse-c5e71b.o: undefined reference to symbol 'pthread_create@@FBSD_1.0'

This is because the program is linked without `-lpthread`.  Since the
%libomp-compile-and-run macro does not allow that option to be added to
the compile command line, split it up and add the required `-lpthread`
between %libomp-compile and %libomp-run.

Reviewers: jlpeyton, hfinkel, Hahnfeld

Subscribers: Hahnfeld, emaste, openmp-commits

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

llvm-svn: 278036

7 years ago[MemorySSA] Fix windows build breakage caused by r278028
Geoff Berry [Mon, 8 Aug 2016 18:27:22 +0000 (18:27 +0000)]
[MemorySSA] Fix windows build breakage caused by r278028

r278028: [MemorySSA] Ensure address stability of MemorySSA object.
llvm-svn: 278035

7 years agoRe-add SystemZ SNaN test
Elliot Colp [Mon, 8 Aug 2016 18:11:13 +0000 (18:11 +0000)]
Re-add SystemZ SNaN test

The floating-point bug affecting ninja-x64-msvc-RA-centos6 is fixed (r277813) so this test should
now pass

llvm-svn: 278034

7 years ago[BuildingAJIT] Fix a couple of typos in the Chapter 3 draft.
Lang Hames [Mon, 8 Aug 2016 18:09:56 +0000 (18:09 +0000)]
[BuildingAJIT] Fix a couple of typos in the Chapter 3 draft.

llvm-svn: 278033

7 years agoCMakeLists.txt cleanups: synchronize version with rest of LLVM, consistent spacing.
Eugene Zelenko [Mon, 8 Aug 2016 18:01:50 +0000 (18:01 +0000)]
CMakeLists.txt cleanups: synchronize version with rest of LLVM, consistent spacing.

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

llvm-svn: 278032

7 years ago[X86] Improve code size on X86 segment moves
Nirav Dave [Mon, 8 Aug 2016 18:01:04 +0000 (18:01 +0000)]
[X86] Improve code size on X86 segment moves

Moves of a value to a segment register from a 16-bit register is
equivalent to one from it's corresponding 32-bit register. Match gas's
behavior and rewrite instructions to the shorter of equivalent forms.

Reviewers: rnk, ab

Subscribers: llvm-commits

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

llvm-svn: 278031

7 years agoCMakeLists.txt cleanups: synchronize version with rest of LLVM, consistent spacing.
Eugene Zelenko [Mon, 8 Aug 2016 17:59:02 +0000 (17:59 +0000)]
CMakeLists.txt cleanups: synchronize version with rest of LLVM, consistent spacing.

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

llvm-svn: 278030

7 years agoCMakeLists.txt cleanups: synchronize version and CMake minimum required version with...
Eugene Zelenko [Mon, 8 Aug 2016 17:56:28 +0000 (17:56 +0000)]
CMakeLists.txt cleanups: synchronize version and CMake minimum required version with rest of LLVM, consistent spacing.

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

llvm-svn: 278029

7 years ago[MemorySSA] Ensure address stability of MemorySSA object.
Geoff Berry [Mon, 8 Aug 2016 17:52:01 +0000 (17:52 +0000)]
[MemorySSA] Ensure address stability of MemorySSA object.

Summary:
Ensure that the MemorySSA object never changes address when using the
new pass manager since the walkers contained by MemorySSA cache pointers
to it at construction time.  This is achieved by wrapping the
MemorySSAAnalysis result in a unique_ptr.  Also add some asserts that
check for this bug.

Reviewers: george.burgess.iv, dberlin

Subscribers: mcrosier, hfinkel, chandlerc, silvas, llvm-commits

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

llvm-svn: 278028

7 years ago[esan] Add iterator to esan's generic hashtable
Derek Bruening [Mon, 8 Aug 2016 17:37:19 +0000 (17:37 +0000)]
[esan] Add iterator to esan's generic hashtable

Summary: Adds simple iterator support to the esan hashtable.

Reviewers: aizatsky

Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka

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

llvm-svn: 278027

7 years ago[GPGPU] Create code to verify run-time conditions
Tobias Grosser [Mon, 8 Aug 2016 17:35:55 +0000 (17:35 +0000)]
[GPGPU] Create code to verify run-time conditions

llvm-svn: 278026

7 years agoFix compilation in 'asserts' mode
Tobias Grosser [Mon, 8 Aug 2016 17:35:52 +0000 (17:35 +0000)]
Fix compilation in 'asserts' mode

llvm-svn: 278025

7 years ago[esan] Add generic resizing hashtable
Derek Bruening [Mon, 8 Aug 2016 17:25:40 +0000 (17:25 +0000)]
[esan] Add generic resizing hashtable

Summary:
Adds a new, generic, resizing hashtable data structure for use by esan
tools.  No existing sanitizer hashtable is suitable for the use case for
most esan tools: we need non-fixed-size tables, parameterized keys and
payloads, and write access to payloads.  The new hashtable uses either
simple internal or external mutex locking and supports custom hash and
comparision operators.  The focus is on functionality, not performance, to
catalyze creation of a variety of tools.  We can optimize the more
successful tools later.

Adds tests of the data structure.

Reviewers: aizatsky

Subscribers: vitalybuka, zhaoqin, kcc, eugenis, llvm-commits, kubabrecka

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

llvm-svn: 278024

7 years ago[clang-tidy] enhance modernize-use-bool-literals to check ternary operator
Kirill Bobyrev [Mon, 8 Aug 2016 17:11:56 +0000 (17:11 +0000)]
[clang-tidy] enhance modernize-use-bool-literals to check ternary operator

modernize-use-bool-literals doesn't checks operands in ternary operator.

For example:

``` c++
static int Value = 1;

bool foo() {
  bool Result = Value == 1 ? 1 : 0;
  return Result;
}

bool boo() {
  return Value == 1 ? 1 : 0;
}
```

This issue was reported in bug 28854. The patch fixes it.

Reviewers: alexfh, aaron.ballman, Prazek

Subscribers: Prazek, Eugene.Zelenko

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

llvm-svn: 278022

7 years ago[StreamExecutor] Add DeviceMemory and kernel arg packing
Jason Henline [Mon, 8 Aug 2016 16:45:19 +0000 (16:45 +0000)]
[StreamExecutor] Add DeviceMemory and kernel arg packing

Summary:
Add types for device memory and add the code that knows how to pack these
device memory types if they are passed as arguments to kernel launches.

Reviewers: jlebar, tra

Subscribers: parallel_libs-commits

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

llvm-svn: 278021

7 years ago[analyzer] Change -analyze-function to accept qualified names.
Artem Dergachev [Mon, 8 Aug 2016 16:01:02 +0000 (16:01 +0000)]
[analyzer] Change -analyze-function to accept qualified names.

Both -analyze-function and -analyzer-display-progress now share the same
convention for naming functions, which allows discriminating between
methods with the same name in different classes, C++ overloads, and also
presents Objective-C instance and class methods in the convenient notation.

This also allows looking up the name for the particular function you're trying
to restrict analysis to in the -analyzer-display-progress output,
in case it was not instantly obvious.

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

llvm-svn: 278018

7 years ago[IslNodeBuilder] Move run-time check generation to NodeBuilder [NFC]
Tobias Grosser [Mon, 8 Aug 2016 15:41:52 +0000 (15:41 +0000)]
[IslNodeBuilder] Move run-time check generation to NodeBuilder [NFC]

This improves the structure of the code and allows us to reuse the runtime
code generation in the PPCGCodeGeneration.

llvm-svn: 278017

7 years ago[ARM] Command-line options for embedded position-independent code
Oliver Stannard [Mon, 8 Aug 2016 15:28:40 +0000 (15:28 +0000)]
[ARM] Command-line options for embedded position-independent code

This patch (with the corresponding ARM backend patch) adds support for
some new relocation models:

* Read-only position independence (ROPI): Code and read-only data is accessed
  PC-relative. The offsets between all code and RO data sections are known at
  static link time.
* Read-write position independence (RWPI): Read-write data is accessed relative
  to a static base register. The offsets between all writeable data sections
  are known at static link time.

These two modes are independent (they specify how different objects
should be addressed), so they can be used individually or together.

These modes are intended for bare-metal systems or systems with small
real-time operating systems. They are designed to avoid the need for a
dynamic linker, the only initialisation required is setting the static
base register to an appropriate value for RWPI code.

There is one C construct not currently supported by these modes: global
variables initialised to the address of another global variable or
function, where that address is not known at static-link time. There are
a few possible ways to solve this:

* Disallow this, and require the user to write their own initialisation
  function if they need variables like this.
* Emit dynamic initialisers for these variables in the compiler, called from
  the .init_array section (as is currently done for C++ dynamic initialisers).
  We have a patch to do this, described in my original RFC email
  (http://lists.llvm.org/pipermail/llvm-dev/2015-December/093022.html), but the
  feedback from that RFC thread was that this is not something that belongs in
  clang.
* Use a small dynamic loader to fix up these variables, by adding the
  difference between the load and execution address of the relevant section.
  This would require linker co-operation to generate a table of addresses that
  need fixing up.

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

llvm-svn: 278016