platform/upstream/llvm.git
8 years agoFix spacing around variable initializations and for-loops. NFC.
Mandeep Singh Grang [Tue, 9 Aug 2016 17:49:24 +0000 (17:49 +0000)]
Fix spacing around variable initializations and for-loops. NFC.

Reviewers: grosser, _jdoerfert, zinob

Projects: #polly

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

llvm-svn: 278143

8 years ago[debugserver] Delete CFData.{h,cpp}, since they appear to be dead (NFCI)
Vedant Kumar [Tue, 9 Aug 2016 17:42:11 +0000 (17:42 +0000)]
[debugserver] Delete CFData.{h,cpp}, since they appear to be dead (NFCI)

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

llvm-svn: 278142

8 years ago[DAGCombiner] Better support for shifting large value type by constants
Simon Pilgrim [Tue, 9 Aug 2016 17:39:11 +0000 (17:39 +0000)]
[DAGCombiner] Better support for shifting large value type by constants

As detailed on D22726, much of the shift combining code assume constant values will fit into a uint64_t value and calls ConstantSDNode::getZExtValue where it probably shouldn't (leading to asserts). Using APInt directly avoids this problem but we encounter other assertions if we attempt to compare/operate on 2 APInt of different bitwidths.

This patch adds a helper function to ensure that 2 APInt values are zero extended as required so that they can be safely used together. I've only added an initial example use for this to the '(SHIFT (SHIFT x, c1), c2) --> (SHIFT x, (ADD c1, c2))' combines. Further cases can easily be added as required.

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

llvm-svn: 278141

8 years ago[CUDA] Regression test to make sure C++ include path are forwarded to host and device...
Samuel Antao [Tue, 9 Aug 2016 17:27:24 +0000 (17:27 +0000)]
[CUDA] Regression test to make sure C++ include path are forwarded to host and device frontends.

Summary: Add test to detect the C++ include paths are passed to both CUDA host and device frontends.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 278140

8 years ago[clang-cl] Make -gline-tables-only imply -gcodeview
Reid Kleckner [Tue, 9 Aug 2016 17:23:56 +0000 (17:23 +0000)]
[clang-cl] Make -gline-tables-only imply -gcodeview

It's surprising that you have to pass /Z7 in addition to -gcodeview to
get debug info. The sanitizer runtime, for example, expects that if the
compiler supports the -gline-tables-only flag, then it will emit debug
info.

llvm-svn: 278139

8 years ago[AliasAnalysis] Treat invariant.start as read-memory
Anna Thomas [Tue, 9 Aug 2016 17:18:05 +0000 (17:18 +0000)]
[AliasAnalysis] Treat invariant.start as read-memory

Summary:
We teach alias analysis that invariant.start is readonly.
This helps with GVN and memcopy optimizations that currently treat.
invariant.start as a clobber.
We need to treat this as readonly, so that DSE does not incorrectly
remove stores prior to the invariant.start

Reviewers: sanjoy, reames, majnemer, dberlin

Subscribers: llvm-commits

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

llvm-svn: 278138

8 years agoauto-generate checks
Sanjay Patel [Tue, 9 Aug 2016 17:03:51 +0000 (17:03 +0000)]
auto-generate checks

llvm-svn: 278137

8 years agoauto-generate checks
Sanjay Patel [Tue, 9 Aug 2016 17:02:17 +0000 (17:02 +0000)]
auto-generate checks

llvm-svn: 278136

8 years agoauto-generate checks
Sanjay Patel [Tue, 9 Aug 2016 16:59:54 +0000 (16:59 +0000)]
auto-generate checks

llvm-svn: 278135

8 years agotest-release.sh: Drop autoconf support
Hans Wennborg [Tue, 9 Aug 2016 16:46:02 +0000 (16:46 +0000)]
test-release.sh: Drop autoconf support

The autoconf build was deleted some time ago.

llvm-svn: 278133

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

llvm-svn: 278132

8 years agoupdate to use FileCheck and auto-generate checks
Sanjay Patel [Tue, 9 Aug 2016 16:19:57 +0000 (16:19 +0000)]
update to use FileCheck and auto-generate checks

llvm-svn: 278131

8 years agoregenerate checks
Sanjay Patel [Tue, 9 Aug 2016 16:17:46 +0000 (16:17 +0000)]
regenerate checks

llvm-svn: 278130

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

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

llvm-svn: 278094

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

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

llvm-svn: 278061

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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