platform/upstream/llvm.git
7 years agoclang-cl: expose the -fuse-ld option
Hans Wennborg [Tue, 4 Oct 2016 21:01:00 +0000 (21:01 +0000)]
clang-cl: expose the -fuse-ld option

llvm-svn: 283256

7 years agoclang-cl: Expose the -flto option
Hans Wennborg [Tue, 4 Oct 2016 21:00:57 +0000 (21:00 +0000)]
clang-cl: Expose the -flto option

We could hook up /GL as an alias for -flto, but that might be
confusing, as clang-cl in that mode would not be drop-in compatible
with cl.exe /GL, as it requires the linker to be lld.

Exposing -flto seems like a less confusing way to expose this
functionality.

llvm-svn: 283255

7 years agoRevert r283248. It caused failures in the hexagon buildbots.
David L Kreitzer [Tue, 4 Oct 2016 20:57:19 +0000 (20:57 +0000)]
Revert r283248. It caused failures in the hexagon buildbots.

llvm-svn: 283254

7 years ago[analyzer] Add PostStmt callback for ArraySubscriptExpr
Anna Zaks [Tue, 4 Oct 2016 20:49:31 +0000 (20:49 +0000)]
[analyzer] Add PostStmt callback for ArraySubscriptExpr

A patch by Jan Smets!

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

llvm-svn: 283253

7 years ago[Target] move reciprocal estimate settings from TargetOptions to TargetLowering
Sanjay Patel [Tue, 4 Oct 2016 20:46:43 +0000 (20:46 +0000)]
[Target] move reciprocal estimate settings from TargetOptions to TargetLowering

The motivation for the change is that we can't have pseudo-global settings for
codegen living in TargetOptions because that doesn't work with LTO.

Ideally, these reciprocal attributes will be moved to the instruction-level via
FMF, metadata, or something else. But making them function attributes is at least
an improvement over the current state.

The ingredients of this patch are:

    Remove the reciprocal estimate command-line debug option.
    Add TargetRecip to TargetLowering.
    Remove TargetRecip from TargetOptions.
    Clean up the TargetRecip implementation to work with this new scheme.
    Set the default reciprocal settings in TargetLoweringBase (everything is off).
    Update the PowerPC defaults, users, and tests.
    Update the x86 defaults, users, and tests.

Note that if this patch needs to be reverted, the related clang patch checked in
at r283251 should be reverted too.

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

llvm-svn: 283252

7 years ago[clang] make reciprocal estimate codegen a function attribute
Sanjay Patel [Tue, 4 Oct 2016 20:44:05 +0000 (20:44 +0000)]
[clang] make reciprocal estimate codegen a function attribute

The motivation for the change is that we can't have pseudo-global settings
for codegen living in TargetOptions because that doesn't work with LTO.

Ideally, these reciprocal attributes will be moved to the instruction-level
via FMF, metadata, or something else. But making them function attributes is
at least an improvement over the current state.

I'm committing this patch ahead of the related LLVM patch to avoid bot failures,
but if that patch needs to be reverted, then this should be reverted too.

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

llvm-svn: 283251

7 years agoNext set of additional error checks for invalid Mach-O files for the
Kevin Enderby [Tue, 4 Oct 2016 20:37:43 +0000 (20:37 +0000)]
Next set of additional error checks for invalid Mach-O files for the
load commands that uses the MachO::encryption_info_command and
MachO::encryption_info_command types but not used in llvm libObject
code but used in llvm tool code.

This includes just LC_ENCRYPTION_INFO and
LC_ENCRYPTION_INFO_64 load commands.

llvm-svn: 283250

7 years ago[ubsan] Disable bounds-check for flexible array ivars
Vedant Kumar [Tue, 4 Oct 2016 20:36:04 +0000 (20:36 +0000)]
[ubsan] Disable bounds-check for flexible array ivars

This eliminates a class of false positives for -fsanitize=array-bounds
on instrumented ObjC projects.

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

llvm-svn: 283249

7 years ago[safestack] Requires a valid TargetMachine to be passed to the SafeStack pass.
David L Kreitzer [Tue, 4 Oct 2016 20:31:32 +0000 (20:31 +0000)]
[safestack] Requires a valid TargetMachine to be passed to the SafeStack pass.

Patch by Michael LeMay

Differential revision: http://reviews.llvm.org/D24896

llvm-svn: 283248

7 years ago[cmake] Make LIT_COMMAND configurable and improve fallback support
Michal Gorny [Tue, 4 Oct 2016 20:25:37 +0000 (20:25 +0000)]
[cmake] Make LIT_COMMAND configurable and improve fallback support

Make LIT_COMMAND configurable, use source tree only when actually
available and extend the default search to other common executable names
'lit.py' and 'lit', in order to increase uniformity between all LLVM
projects and support using installed lit.

Changing the conditional used to determine whether in-tree or external
lit is being used covers the case when LLVM_MAIN_SRC_DIR is defined but
does not exist (anymore). In this case, the functions falls back to
looking for installed lit rather than attempting to use a non-existing
path. The same conditional is used in clang already.

Making LIT_COMMAND a cache variable in case the source tree variant is
used serves two purposes. Firstly, it increases uniformity between
the two branches since find_program() implicitly makes LIT_COMMAND
a cache variable. Secondly, it allows overriding the lit executable used
to run the tests when the LLVM source tree is provided. Gentoo is
planning to use this to use installed (and byte-compiled) lit instead of
re-compiling it in every LLVM project.

Extending default search is meant to increase uniformity between
different LLVM projects. The 'lit.py' name is already used by a few of
them, and 'lit' is the name used by utils/lit/setup.py when installing.

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

llvm-svn: 283247

7 years agoclang-format: Fix bad multi-variable for-loop formatting.
Daniel Jasper [Tue, 4 Oct 2016 20:18:25 +0000 (20:18 +0000)]
clang-format: Fix bad multi-variable for-loop formatting.

Before:
  for (int*p, *q; p != q; p = p->next) {

After:
  for (int *p, *q; p != q; p = p->next) {

llvm-svn: 283246

7 years agoBuild and run isl_test as part of check-polly
Tobias Grosser [Tue, 4 Oct 2016 19:48:40 +0000 (19:48 +0000)]
Build and run isl_test as part of check-polly

Running isl tests is important to gain confidence that the isl build we created
works as expected. Besides the actual isl tests, there are also isl AST
generation tests shipped with isl. This change only adds support for the isl
unit tests. AST generation test support is left for a later commit.

There is a choice to run tests directly through the build system or in the
context of lit. We choose to run tests as part of lit to as this allows us to
easily set environment variables, print output only on error and generally run
the tests directly from the lit command.

Reviewers: brad.king, Meinersbur

Subscribers: modocache, brad.king, pollydev, beanz, llvm-commits, mgorny

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

llvm-svn: 283245

7 years ago[Support] Add case-insensitive versions of StringSwitch members.
Zachary Turner [Tue, 4 Oct 2016 19:33:13 +0000 (19:33 +0000)]
[Support] Add case-insensitive versions of StringSwitch members.

This adds support for CaseLower, CasesLower, StartsWithLower, and
EndsWithLower.

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

llvm-svn: 283244

7 years agoAArch64: Macrofusion: Split features, add missing combinations.
Matthias Braun [Tue, 4 Oct 2016 19:28:21 +0000 (19:28 +0000)]
AArch64: Macrofusion: Split features, add missing combinations.

AArch64InstrInfo::shouldScheduleAdjacent() determines whether two
instruction can benefit from macroop fusion on apple CPUs. The list
turned out to be incomplete:
- the "rr" variants of the instructions were missing
- even the "rs" variants can have shift value == 0 and behave like the
  "rr" variants

This also splits the MacropFusion target feature into
ArithmeticBccFusion and ArithmeticCbzFusion.

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

llvm-svn: 283243

7 years ago[sancov] documentation update after r283241
Mike Aizatsky [Tue, 4 Oct 2016 19:19:16 +0000 (19:19 +0000)]
[sancov] documentation update after r283241

llvm-svn: 283242

7 years ago[sancov] renamed symcov-report-server to coverage-report-server
Mike Aizatsky [Tue, 4 Oct 2016 19:18:23 +0000 (19:18 +0000)]
[sancov] renamed symcov-report-server to coverage-report-server

llvm-svn: 283241

7 years ago[asan] Switch to using dynamic shadow offset on iOS
Anna Zaks [Tue, 4 Oct 2016 19:02:53 +0000 (19:02 +0000)]
[asan] Switch to using dynamic shadow offset on iOS

The VM layout is not stable between iOS version releases, so switch to dynamic shadow offset.

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

llvm-svn: 283240

7 years ago[asan] LLVM: Switch to using dynamic shadow offset on iOS
Anna Zaks [Tue, 4 Oct 2016 19:02:29 +0000 (19:02 +0000)]
[asan] LLVM: Switch to using dynamic shadow offset on iOS

The VM layout is not stable between iOS version releases, so switch to dynamic shadow offset.

This is the LLVM counterpart of https://reviews.llvm.org/D25218

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

llvm-svn: 283239

7 years agoImprovements to testing blacklist
Francis Ricci [Tue, 4 Oct 2016 18:48:00 +0000 (18:48 +0000)]
Improvements to testing blacklist

Summary:
This patch is necessary because individual test cases are not required
to have unique names. Therefore, test cases must now
be specified explicitly in the form <TestCase>.<TestMethod>.
Because it works by regex matching, passing just <TestCase> will
still disable an entire file.

This also allows for multiple exclusion files to be specified.

Reviewers: zturner, labath, jingham, tfiala

Subscribers: lldb-commits, sas

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

llvm-svn: 283238

7 years agoFix FixupEnvironment on Android after the Args refactor
Tamas Berghammer [Tue, 4 Oct 2016 18:35:39 +0000 (18:35 +0000)]
Fix FixupEnvironment on Android after the Args refactor

llvm-svn: 283237

7 years agoDon't filter diagnostics written as YAML to the output file
Hal Finkel [Tue, 4 Oct 2016 18:13:45 +0000 (18:13 +0000)]
Don't filter diagnostics written as YAML to the output file

The purpose of the YAML diagnostic output file is to collect information on
optimizations performed, or not performed, for later processing by tools that
help users (and compiler developers) understand how code was optimized. As
such, the diagnostics that appear in the file should not be coupled to what a
user might want to see summarized for them as the compiler runs, and in fact,
because the user likely does not know what optimization diagnostics their tools
might want to use, the user cannot provide a useful filter regardless. As such,
we shouldn't filter the diagnostics going to the output file.

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

llvm-svn: 283236

7 years agoTest what happens when tag lookup and redeclaration lookup disagree
Reid Kleckner [Tue, 4 Oct 2016 18:10:23 +0000 (18:10 +0000)]
Test what happens when tag lookup and redeclaration lookup disagree

Clang has a diagnostic for the what happens when an elaborated type
implicitly creates a tag declaration and the initial tag lookup fails,
but the redeclaration lookup succeeds and finds a non-tag type. However,
it wasn't tested, and looked like dead code. After much staring, we
discovered how to exercise it, and are now committing the test for
posterity.

In this example, the tag lookup will not find A, but then when we go to
insert a declaration of A at global scope, we discover the template
friend, which is not a tag type.

  struct C {
    template <typename> friend struct A;
  };
  struct B {
    struct A *p;
  };

llvm-svn: 283235

7 years ago[CMake] Exclude intrinsics_gen from LLVM_COMMON_DEPENDS in LLVMConfig.cmake
Chris Bieneman [Tue, 4 Oct 2016 17:44:28 +0000 (17:44 +0000)]
[CMake] Exclude intrinsics_gen from LLVM_COMMON_DEPENDS in LLVMConfig.cmake

CMake requires that all targets expressed as dependencies exist, so we can't have intrinsics_gen in LLVM_COMMON_DEPENDS when it is written out, otherwise projects building out of tree will have CMake errors.

llvm-svn: 283234

7 years ago[ScopInfo] Add -polly-unprofitable-scalar-accs option.
Michael Kruse [Tue, 4 Oct 2016 17:33:39 +0000 (17:33 +0000)]
[ScopInfo] Add -polly-unprofitable-scalar-accs option.

With this option one can disable the heuristic that assumes that statements with
a scalar write access cannot be profitably optimized. Such a statement instances
necessarily have WAW-dependences to itself. With DeLICM scalar accesses can be
changed to array accesses, which can avoid these WAW-dependence.

llvm-svn: 283233

7 years ago[ScopInfo] Scalar access do not have indirect base pointers.
Michael Kruse [Tue, 4 Oct 2016 17:33:34 +0000 (17:33 +0000)]
[ScopInfo] Scalar access do not have indirect base pointers.

ScopArrayInfo used to determine base pointer origins by looking up whether the
base pointer is a load. The "base pointer" for scalar accesses is the
llvm::Value being accessed. This is only a symbolic base pointer, it
represents the alloca variable (.s2a or .phiops) generated for it at code
generation.

This patch disables determining base pointer origin for scalars.
A test case where this caused a crash will be added in the next commit. In that
test SAI tried to get the origin base pointer that was only declared later,
therefore not existing. This is probably only possible for scalars used in
PHINode incoming blocks.

llvm-svn: 283232

7 years agoSerialize remark argument as a mapping to get proper quotation for the value.
Adam Nemet [Tue, 4 Oct 2016 17:05:04 +0000 (17:05 +0000)]
Serialize remark argument as a mapping to get proper quotation for the value.

llvm-svn: 283231

7 years agoAllow derived classes of OptimizationRemarkAnalysis in YAML
Adam Nemet [Tue, 4 Oct 2016 17:05:01 +0000 (17:05 +0000)]
Allow derived classes of OptimizationRemarkAnalysis in YAML

llvm-svn: 283230

7 years agoAdd a comment.
Rui Ueyama [Tue, 4 Oct 2016 16:47:49 +0000 (16:47 +0000)]
Add a comment.

llvm-svn: 283229

7 years ago[Sema] Format a comment line so that it fits 80 columns. NFC
Alex Lorenz [Tue, 4 Oct 2016 16:06:37 +0000 (16:06 +0000)]
[Sema] Format a comment line so that it fits 80 columns. NFC

llvm-svn: 283228

7 years ago[MS] Move hex long long sign compat hack to -fms-compatibility
Reid Kleckner [Tue, 4 Oct 2016 15:57:49 +0000 (15:57 +0000)]
[MS] Move hex long long sign compat hack to -fms-compatibility

Treating large 0x*LL literals as signed instead of unsigned is not a
conforming language extension, so move it out of -fms-extensions.

Came up in PR30605

llvm-svn: 283227

7 years ago[ELF] - Do not crash on MIPS if there is no object files in input.
George Rimar [Tue, 4 Oct 2016 15:19:20 +0000 (15:19 +0000)]
[ELF] - Do not crash on MIPS if there is no object files in input.

If we have input without object files, for example if we have only .so
code crashes in checkFlags(), getPicFlags(), getArchFlags() functions.

Patch fixes the issue.

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

llvm-svn: 283226

7 years ago[SLPVectorizer] Add a test with non-vectorizable IR.
Alexey Bataev [Tue, 4 Oct 2016 15:07:23 +0000 (15:07 +0000)]
[SLPVectorizer] Add a test with non-vectorizable IR.

llvm-svn: 283225

7 years agoFix some false-positives with cppcoreguidelines-pro-type-member-init. Handle classes...
Aaron Ballman [Tue, 4 Oct 2016 14:48:05 +0000 (14:48 +0000)]
Fix some false-positives with cppcoreguidelines-pro-type-member-init. Handle classes with default constructors that are defaulted or are not present in the AST.
Classes with virtual methods or virtual bases are not trivially default constructible, so their members and bases need to be initialized.

Patch by Malcolm Parsons.

llvm-svn: 283224

7 years ago[OpenMP] fix segfault when a variable referenced in reduction clause is a reference...
David Sheinkman [Tue, 4 Oct 2016 14:41:36 +0000 (14:41 +0000)]
[OpenMP] fix segfault when a variable referenced in reduction clause is a reference parameter\nDifferential Revision: reviews.llvm.org/D24524

llvm-svn: 283223

7 years agoMark #2759 as ready and #2755 as complete
Marshall Clow [Tue, 4 Oct 2016 14:39:58 +0000 (14:39 +0000)]
Mark #2759 as ready and #2755 as complete

llvm-svn: 283222

7 years ago[ScopInfo] Make simplifySCoP() public. NFC.
Michael Kruse [Tue, 4 Oct 2016 14:14:33 +0000 (14:14 +0000)]
[ScopInfo] Make simplifySCoP() public. NFC.

This function may need to be called after the scop construction. The upcoming
DeLICM will use this to cleanup statement that all write accesses have been
removed from.

llvm-svn: 283221

7 years agoMark #2598 as ready
Marshall Clow [Tue, 4 Oct 2016 14:08:50 +0000 (14:08 +0000)]
Mark #2598 as ready

llvm-svn: 283220

7 years ago[RS4GC] Handle ShuffleVector instruction in findBasePointer
Anna Thomas [Tue, 4 Oct 2016 13:48:37 +0000 (13:48 +0000)]
[RS4GC] Handle ShuffleVector instruction in findBasePointer

Summary:
This patch modifies the findBasePointer to handle the shufflevector instruction.

Tests run: RS4GC tests, local downstream tests.

Reviewers: reames, sanjoy

Subscribers: llvm-commits

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

llvm-svn: 283219

7 years agoMark #2739 as ready
Marshall Clow [Tue, 4 Oct 2016 13:41:56 +0000 (13:41 +0000)]
Mark #2739 as ready

llvm-svn: 283218

7 years ago[ThinLTO] Spell `llvm-ar` correctly.
Davide Italiano [Tue, 4 Oct 2016 13:16:00 +0000 (13:16 +0000)]
[ThinLTO] Spell `llvm-ar` correctly.

llvm-svn: 283217

7 years agoRemove duplicated typedef. NFC.
Rafael Espindola [Tue, 4 Oct 2016 13:09:59 +0000 (13:09 +0000)]
Remove duplicated typedef. NFC.

llvm-svn: 283216

7 years agoFix IntegerType::MAX_INT_BITS value
Andrey Bokhanko [Tue, 4 Oct 2016 12:43:46 +0000 (12:43 +0000)]
Fix IntegerType::MAX_INT_BITS value

IntegerType::MAX_INT_BITS is apparently not in sync with Type::SubclassData
size. This patch fixes this.

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

llvm-svn: 283215

7 years ago[ELF] Don't discard excluded section if -r is used
Eugene Leviant [Tue, 4 Oct 2016 12:05:42 +0000 (12:05 +0000)]
[ELF] Don't discard excluded section if -r is used

This conforms to GNU ld/gold behavior and fixes crash in case
excluded section also has associated relocation section

llvm-svn: 283214

7 years ago[ELF] - Removed "invalid-" prefix from testcase. NFC.
George Rimar [Tue, 4 Oct 2016 11:51:38 +0000 (11:51 +0000)]
[ELF] - Removed "invalid-" prefix from testcase. NFC.

llvm-svn: 283213

7 years ago[Power9] Exploit D-Form VSX Scalar memory ops that target full VSX register set
Nemanja Ivanovic [Tue, 4 Oct 2016 11:25:52 +0000 (11:25 +0000)]
[Power9] Exploit D-Form VSX Scalar memory ops that target full VSX register set

This patch corresponds to review:

The newly added VSX D-Form (register + offset) memory ops target the upper half
of the VSX register set. The existing ones target the lower half. In order to
unify these and have the ability to target all the VSX registers using D-Form
operations, this patch defines Pseudo-ops for the loads/stores which are
expanded post-RA. The expansion then choses the correct opcode based on the
register that was allocated for the operation.

llvm-svn: 283212

7 years agoFix a documentation warning.
Haojian Wu [Tue, 4 Oct 2016 10:40:52 +0000 (10:40 +0000)]
Fix a documentation warning.

llvm-svn: 283211

7 years ago[change-namespace] Fix a misplaced case when there is no trailing newline character...
Haojian Wu [Tue, 4 Oct 2016 10:35:53 +0000 (10:35 +0000)]
[change-namespace] Fix a misplaced case when there is no trailing newline character at the end of the file.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 283210

7 years ago[mips][fastisel] Consider soft-float an unsupported floating point mode
Simon Dardis [Tue, 4 Oct 2016 10:35:07 +0000 (10:35 +0000)]
[mips][fastisel] Consider soft-float an unsupported floating point mode

Treat soft-float as unsupported for fast-isel. Additionally, ensure we check
that lowering f32 arguments also considers the case of soft-float mode.

Reviewers: ehostunreach, vkalintiris, zoran.jovanovic

Differential Review: https://reviews.llvm.org/D24505

llvm-svn: 283209

7 years ago[ELF] - Do not hang if broken object has option descriptor in .MIPS.options with...
George Rimar [Tue, 4 Oct 2016 10:23:07 +0000 (10:23 +0000)]
[ELF] - Do not hang if broken object has option descriptor in .MIPS.options with size of zero.

Previously lld would hang in infinite loop in this case,
patch fixes the issue. Object was found during AFL run.

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

llvm-svn: 283208

7 years agoDo not find friend function definitions inside non-instantiated class.
Serge Pavlov [Tue, 4 Oct 2016 10:11:43 +0000 (10:11 +0000)]
Do not find friend function definitions inside non-instantiated class.

Previously if a file-level function was defined inside befriending
template class, it always was treated as defined. For instance, the code like:
```
  int func(int x);
  template<typename T> class C1 {
    friend int func(int x) { return x; }
  };
  template<typename T> class C2 {
    friend int func(int x) { return x; }
  };
```
could not be compiled due to function redefinition, although not of the templates
is instantiated. Moreover, the body of friend function can contain use of template
parameters, attempt to get definition of such function outside any instantiation
causes compiler abnormal termination.

Other compilers (gcc, icc) follow viewpoint that the body of the function defined
in friend declaration becomes available when corresponding class is instantiated.
This patch implements this viewpoint in clang.

Definitions introduced by friend declarations in template classes are not added
to the redeclaration chain of corresponding function. Only when the template is
instantiated, instantiation of the function definition is placed to the chain.

The fix was made in collaboration with Richard Smith.

This change fixes PR8035, PR17923, PR22307 and PR25848.

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

llvm-svn: 283207

7 years agoMinor cleanups in clang-format.el.
Manuel Klimek [Tue, 4 Oct 2016 09:53:04 +0000 (09:53 +0000)]
Minor cleanups in clang-format.el.

- Enable lexical binding
- Formatting
- Enable file name completion for the clang-format-executable variable
- Add a missing docstring
- When available, use bufferpos-to-filepos and filepos-to-bufferpos. These functions given more precise mapping than byte-to-position and position-bytes.
- Rename arguments of clang-format-region to match the docstring
- Instead of binding local variables to nil and then assigning them, bind them directly to their values
- Make use of the fact that insert-file-contents returns the number of characters it inserted
- Use cl-destructuring-bind to make the code a bit shorter
- Use standard iteration (dolist) instead of mapc with a lambda, which is more common and shorter
- Remove a message that was most likely only present for debugging purposes

Patch by Philipp Stephani.

llvm-svn: 283206

7 years agoFix windows builtbot error.
Haojian Wu [Tue, 4 Oct 2016 09:49:20 +0000 (09:49 +0000)]
Fix windows builtbot error.

llvm-svn: 283205

7 years ago[Object/ELF] - Do not crash on invalid sh_offset value of REL[A] section.
George Rimar [Tue, 4 Oct 2016 09:25:39 +0000 (09:25 +0000)]
[Object/ELF] - Do not crash on invalid sh_offset value of REL[A] section.

Previously code would access invalid memory and may crash,
patch fixes the issue.

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

llvm-svn: 283204

7 years ago[SelectionDAG] Fix calling convention in expansion of ?MULO.
whitequark [Tue, 4 Oct 2016 09:07:49 +0000 (09:07 +0000)]
[SelectionDAG] Fix calling convention in expansion of ?MULO.

The SMULO/UMULO DAG nodes, when not directly supported by the target,
expand to a multiplication twice as wide. In case that the resulting
type is not legal, an __mul?i3 intrinsic is used. Since the type is
not legal, the legalizer cannot directly call the intrinsic with
the wide arguments; instead, it "pre-lowers" them by splitting them
in halves.

The "pre-lowering" code in essence made assumptions about
the calling convention, specifically that i(N*2) values will be
split into two iN values and passed in consecutive registers in
little-endian order. This, naturally, breaks on a big-endian system,
such as our OR1K out-of-tree backend.

Thanks to James Miller <james@aatch.net> for help in debugging.

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

llvm-svn: 283203

7 years ago[clang-move] Make it support both relative and absolute file path arguments.
Haojian Wu [Tue, 4 Oct 2016 09:05:31 +0000 (09:05 +0000)]
[clang-move] Make it support both relative and absolute file path arguments.

Reviewers: ioeric

Subscribers: beanz, mgorny, cfe-commits

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

llvm-svn: 283202

7 years ago[ELF] - Do not crash on invalid symbol index.
George Rimar [Tue, 4 Oct 2016 09:02:42 +0000 (09:02 +0000)]
[ELF] - Do not crash on invalid symbol index.

Relative to PR30540.

If .symtab has invalid type in elf, no bodies are created and any relocation
that tries to access them will fail.
The same can happen if symbol index is just incorrect.

This was revealed by "id_000005,sig_11,src_000000,op_flip2,pos_420"

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

llvm-svn: 283201

7 years ago[ELF] Set max page size to 64K for AArch64
Eugene Leviant [Tue, 4 Oct 2016 08:58:55 +0000 (08:58 +0000)]
[ELF] Set max page size to 64K for AArch64

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

llvm-svn: 283200

7 years agoRevert "[XRay] Check in Clang whether XRay supports the target when -fxray-instrument...
Dean Michael Berris [Tue, 4 Oct 2016 08:54:51 +0000 (08:54 +0000)]
Revert "[XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed"

This reverts 283193 -- broke the build.

llvm-svn: 283199

7 years ago[ELF] - Do not crash if symbol type set to TLS when there is no tls sections.
George Rimar [Tue, 4 Oct 2016 08:52:51 +0000 (08:52 +0000)]
[ELF] - Do not crash if symbol type set to TLS when there is no tls sections.

id_000021,sig_11,src_000002,op_flip1,pos_92 from PR30540

does not have TLS sections, but type
of one of the symbol is broken and set to STT_TLS,
what resulted in a crash. Patch fixes crash.

DIfferential revision: https://reviews.llvm.org/D25083

llvm-svn: 283198

7 years ago[ELF] - Do not crash if common symbol has alignment 0.
George Rimar [Tue, 4 Oct 2016 08:49:52 +0000 (08:49 +0000)]
[ELF] - Do not crash if common symbol has alignment 0.

Testcase contains a common symbol with zero alignment,
previously lld would crash, patch fixes that.

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

llvm-svn: 283197

7 years ago[Object/ELF] - Avoid possible crash in getExtendedSymbolTableIndex().
George Rimar [Tue, 4 Oct 2016 08:44:03 +0000 (08:44 +0000)]
[Object/ELF] - Avoid possible crash in getExtendedSymbolTableIndex().

When using broken input object found using AFL,
getExtendedSymbolTableIndex() crashed because ShndxTable
was empty as object does not contain SHT_SYMTAB_SHNDX section.

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

llvm-svn: 283196

7 years agoRevert r283106, "Wdocumentation fix"
NAKAMURA Takumi [Tue, 4 Oct 2016 08:32:33 +0000 (08:32 +0000)]
Revert r283106, "Wdocumentation fix"

It should depend on r283094 and r283182.

llvm-svn: 283195

7 years ago[ELF][MIPS] Do not accept non-zero GP0 value for relocatable object only
Simon Atanasyan [Tue, 4 Oct 2016 08:24:25 +0000 (08:24 +0000)]
[ELF][MIPS] Do not accept non-zero GP0 value for relocatable object only

Follow-up to r282716. Reject input files with non-zero GP0 value only in
case of relocatable object generation. In other case we can handle
arbitrary GP0 value so it does not have a sense to make the restriction
so wide.

llvm-svn: 283194

7 years ago[XRay] Check in Clang whether XRay supports the target when -fxray-instrument is...
Dean Michael Berris [Tue, 4 Oct 2016 08:22:47 +0000 (08:22 +0000)]
[XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed

Added the code which explicitly emits an error in Clang in case
`-fxray-instrument` is passed, but XRay is not supported for the
selected target.

Author: rSerge

Reviewers: dberris, rsmith, aaron.ballman, rnk

Subscribers: cfe-commits, iid_iunknown

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

llvm-svn: 283193

7 years agoConsistent fp denormal mode names. NFC.
Sjoerd Meijer [Tue, 4 Oct 2016 08:03:36 +0000 (08:03 +0000)]
Consistent fp denormal mode names. NFC.

This fixes the inconsistency of the fp denormal option names: in LLVM this was
DenormalType, but in Clang this is DenormalMode which seems better.

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

llvm-svn: 283192

7 years agoFix a test case failure on Apple PPC.
Nemanja Ivanovic [Tue, 4 Oct 2016 07:37:38 +0000 (07:37 +0000)]
Fix a test case failure on Apple PPC.

llvm-svn: 283191

7 years ago[Power9] Part-word VSX integer scalar loads/stores and sign extend instructions
Nemanja Ivanovic [Tue, 4 Oct 2016 06:59:23 +0000 (06:59 +0000)]
[Power9] Part-word VSX integer scalar loads/stores and sign extend instructions

This patch corresponds to review:
https://reviews.llvm.org/D23155

This patch removes the VSHRC register class (based on D20310) and adds
exploitation of the Power9 sub-word integer loads into VSX registers as well
as vector sign extensions.
The new instructions are useful for a few purposes:

    Int to Fp conversions of 1 or 2-byte values loaded from memory
    Building vectors of 1 or 2-byte integers with values loaded from memory
    Storing individual 1 or 2-byte elements from integer vectors

This patch implements all of those uses.

llvm-svn: 283190

7 years ago[cmake] Reintroduce (ldconfig-compatible) SOVERSIONs on shared libraries
Michal Gorny [Tue, 4 Oct 2016 06:09:18 +0000 (06:09 +0000)]
[cmake] Reintroduce (ldconfig-compatible) SOVERSIONs on shared libraries

Reintroduce versioning of shared libraries via SOVERSION, addressing
the issues with the previous design, since Gentoo is relying
on shared-split install of LLVM. The SOVERSIONs were originally
introduced in r229720 for all libraries, and removed in r252093 in favor
of custom SONAME. As far as I understand, the major concern with the old
versioning was that the used versions were incompatible with ldconfig.

Having considered that, this commit introduce SOVERSIONS with the
following considerations:

1. SOVERSIONs are formed of major & minor version concatenated -- i.e.
for 4.0 its .so.40. This matches the common practice where the first
version number indicates ABI breakage, and therefore fixes the issues
with ldconfig. Additionally, VERSION with the remaining verion
components appended is used, however this is not strictly necessary.

2. The versioning is only applied to libraries with no explicit SONAME
specified -- i.e. it won't apply to libLLVM but only to the split
libraries. It will also apply to libraries installed by the subprojects.

3. The versioning is only done on *nix systems, Darwin excluded. This
matches the current use of SONAME.

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

llvm-svn: 283189

7 years ago[cmake] Use separate doctrees to prevent races between Sphinx instances
Michal Gorny [Tue, 4 Oct 2016 06:09:14 +0000 (06:09 +0000)]
[cmake] Use separate doctrees to prevent races between Sphinx instances

Use separate doctrees between different Sphinx builders in order to
prevent race condition issues due to multiple Sphinx instances accessing
the same doctree cache in parallel.

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

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

llvm-svn: 283188

7 years ago[libFuzzer] remove dfsan support and some related stale code. This is not being used...
Kostya Serebryany [Tue, 4 Oct 2016 06:08:46 +0000 (06:08 +0000)]
[libFuzzer] remove dfsan support and some related stale code. This is not being used and as is is pretty weak anyway

llvm-svn: 283187

7 years agoFinish adding the individual instruction tests to the x86 unwinder
Jason Molenda [Tue, 4 Oct 2016 05:10:06 +0000 (05:10 +0000)]
Finish adding the individual instruction tests to the x86 unwinder
unittests.  If I have time, I'd like to see if I can write some
tests of the eh_frame augmentation which is a wholly separate code
path (it seems like maybe it should be rolled into the main instruction
scanning codepath, to be honest, and operate on the generated
UnwindPlan instead of bothering with raw instructions at all).

Outside the eh_frame augmentation, I'm comfortable that this unwind
generator is being tested well now.

llvm-svn: 283186

7 years ago[sanitizer-coverage] remove stale code, second attempt after failed r282994
Kostya Serebryany [Tue, 4 Oct 2016 04:18:30 +0000 (04:18 +0000)]
[sanitizer-coverage] remove stale code, second attempt after failed r282994

llvm-svn: 283185

7 years ago[X86] Add MOV8rm_NOREX to switch in isReallyTriviallyReMaterializable to match MOV8rm.
Craig Topper [Tue, 4 Oct 2016 03:11:44 +0000 (03:11 +0000)]
[X86] Add MOV8rm_NOREX to switch in isReallyTriviallyReMaterializable to match MOV8rm.

llvm-svn: 283184

7 years agoRevert "[sanitizer-coverage] remove stale code" at it breaks Windows bot.
Vitaly Buka [Tue, 4 Oct 2016 02:59:03 +0000 (02:59 +0000)]
Revert "[sanitizer-coverage] remove stale code" at it breaks Windows bot.

This reverts commit r282994.

llvm-svn: 283183

7 years agoRevert "[analyzer] Improve CloneChecker diagnostics" as its depends on reverted r283092
Vitaly Buka [Tue, 4 Oct 2016 02:40:35 +0000 (02:40 +0000)]
Revert "[analyzer] Improve CloneChecker diagnostics" as its depends on reverted r283092

This reverts commit r283094.

llvm-svn: 283182

7 years agoRevert "[analyzer] Add extra notes to ObjCDeallocChecker" as its depends on reverted...
Vitaly Buka [Tue, 4 Oct 2016 02:36:58 +0000 (02:36 +0000)]
Revert "[analyzer] Add extra notes to ObjCDeallocChecker" as its depends on reverted r283092

This reverts commit r283093.

llvm-svn: 283181

7 years agoRevert "[analyzer] Extend bug reports with extra notes" to fix Windows bot.
Vitaly Buka [Tue, 4 Oct 2016 02:19:17 +0000 (02:19 +0000)]
Revert "[analyzer] Extend bug reports with extra notes" to fix Windows bot.

This reverts commit r283092.

llvm-svn: 283180

7 years agoRevert "[analyzer] A blind attempt to fix a buildbot" as it does not help.
Vitaly Buka [Tue, 4 Oct 2016 02:19:12 +0000 (02:19 +0000)]
Revert "[analyzer] A blind attempt to fix a buildbot" as it does not help.

This reverts commit r283141.

llvm-svn: 283179

7 years ago[libFuzzer] change the probabilities so that we choose only the inputs that are known...
Kostya Serebryany [Tue, 4 Oct 2016 01:51:44 +0000 (01:51 +0000)]
[libFuzzer] change the probabilities so that we choose only the inputs that are known to be minimal inputs for at least one coverage feature (works only with -shrink=1 for now)

llvm-svn: 283178

7 years agoAMDGPU: Refactor indirect vector lowering
Matt Arsenault [Tue, 4 Oct 2016 01:41:05 +0000 (01:41 +0000)]
AMDGPU: Refactor indirect vector lowering

Allow inserting multiple instructions in the
expanded loop.

llvm-svn: 283177

7 years agoFix TestNestedAliases.py
Zachary Turner [Tue, 4 Oct 2016 01:34:39 +0000 (01:34 +0000)]
Fix TestNestedAliases.py

I missed an if/else branch when doing the conversion.

llvm-svn: 283176

7 years agoAMDGPU: Factor SGPR spilling into separate functions
Matt Arsenault [Tue, 4 Oct 2016 01:14:56 +0000 (01:14 +0000)]
AMDGPU: Factor SGPR spilling into separate functions

llvm-svn: 283175

7 years agoRemove unused parameter.
Rui Ueyama [Tue, 4 Oct 2016 01:03:03 +0000 (01:03 +0000)]
Remove unused parameter.

I do not fully understand how to use these classes yet, but
seems like these arguments are not used, since without them
all tests still pass. In order to simplify the situation,
I'll remove them now.

llvm-svn: 283174

7 years agoEarly return. NFC.
Rui Ueyama [Tue, 4 Oct 2016 00:46:36 +0000 (00:46 +0000)]
Early return. NFC.

llvm-svn: 283173

7 years agoRevert "Codegen: Tail-duplicate during placement."
Kyle Butt [Tue, 4 Oct 2016 00:38:23 +0000 (00:38 +0000)]
Revert "Codegen: Tail-duplicate during placement."

This reverts commit ff234efbe23528e4f4c80c78057b920a51f434b2.

Causing crashes on aarch64 build.

llvm-svn: 283172

7 years agoFix test when using remote debugging.
Pavel Labath [Tue, 4 Oct 2016 00:32:20 +0000 (00:32 +0000)]
Fix test when using remote debugging.

Summary:
Use os.getcwd() instead of get_process_working_directory() as prefix for
souce file.

Reviewers: labath

Subscribers: lldb-commits

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

llvm-svn: 283171

7 years ago[coroutines] Switch to using std::experimental namespace per P0057R5
Gor Nishanov [Tue, 4 Oct 2016 00:31:16 +0000 (00:31 +0000)]
[coroutines] Switch to using std::experimental namespace per P0057R5

Summary:
Look for coroutine_traits and friends in std::experimental namespace.
Patch (mostly) by EricWF.

Reviewers: cfe-commits, EricWF, rsmith

Subscribers: majnemer, mehdi_amini

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

llvm-svn: 283170

7 years ago[lit] Remove workaround for Python 2.5
Brian Gesiak [Tue, 4 Oct 2016 00:15:37 +0000 (00:15 +0000)]
[lit] Remove workaround for Python 2.5

Summary:
The minimum version of Python necessary to run the LLVM test suite is
2.7. Code to work around Python 2.5 and lower isn't necessary.

Reviewers: ddunbar, echristo, delcypher, beanz

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 283169

7 years agoTry to fix failing tests when running remote test suite.
Zachary Turner [Tue, 4 Oct 2016 00:09:44 +0000 (00:09 +0000)]
Try to fix failing tests when running remote test suite.

llvm-svn: 283168

7 years agoFix the data formatter for std::multiset in libc++ - this is a trivial amount of...
Enrico Granata [Tue, 4 Oct 2016 00:07:42 +0000 (00:07 +0000)]
Fix the data formatter for std::multiset in libc++ - this is a trivial amount of extra change on top of multimap

Also, proper formatting..

llvm-svn: 283167

7 years agoSupport configurable path to LLVM src
Vitaly Buka [Tue, 4 Oct 2016 00:06:23 +0000 (00:06 +0000)]
Support configurable path to LLVM src

llvm-svn: 283166

7 years agoMake GlobalsAA ignore dead constant expressions.
Eli Friedman [Tue, 4 Oct 2016 00:03:55 +0000 (00:03 +0000)]
Make GlobalsAA ignore dead constant expressions.

Slightly improves the precision of GlobalsAA in certain situations, and
makes the behavior of optimization passes more predictable.

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

llvm-svn: 283165

7 years agoCodegen: Tail-duplicate during placement.
Kyle Butt [Tue, 4 Oct 2016 00:00:09 +0000 (00:00 +0000)]
Codegen: Tail-duplicate during placement.

The tail duplication pass uses an assumed layout when making duplication
decisions. This is fine, but passes up duplication opportunities that
may arise when blocks are outlined. Because we want the updated CFG to
affect subsequent placement decisions, this change must occur during
placement.

In order to achieve this goal, TailDuplicationPass is split into a
utility class, TailDuplicator, and the pass itself. The pass delegates
nearly everything to the TailDuplicator object, except for looping over
the blocks in a function. This allows the same code to be used for tail
duplication in both places.

This change, in concert with outlining optional branches, allows
triangle shaped code to perform much better, esepecially when the
taken/untaken branches are correlated, as it creates a second spine when
the tests are small enough.

llvm-svn: 283164

7 years agoMark a couple more Issaquah issues as done: 2578 and 2738
Marshall Clow [Mon, 3 Oct 2016 23:42:31 +0000 (23:42 +0000)]
Mark a couple more Issaquah issues as done: 2578 and 2738

llvm-svn: 283163

7 years agoChange a couple of 'template <typename's to 'template <class' which is what we use...
Marshall Clow [Mon, 3 Oct 2016 23:40:48 +0000 (23:40 +0000)]
Change a couple of 'template <typename's to 'template <class' which is what we use in the rest of the library.

llvm-svn: 283162

7 years agoAdd tests to make sure that is_constructible<cv-void> is false. We already checked...
Marshall Clow [Mon, 3 Oct 2016 23:39:52 +0000 (23:39 +0000)]
Add tests to make sure that is_constructible<cv-void> is false. We already checked 'unqualified void'. This was brought up by LWG#2738

llvm-svn: 283161

7 years agoChanges to the std::multimap formatter to make it work against trunk libc++
Enrico Granata [Mon, 3 Oct 2016 23:33:00 +0000 (23:33 +0000)]
Changes to the std::multimap formatter to make it work against trunk libc++

Fixes rdar://28237486

llvm-svn: 283160

7 years agoModernize some code related to Args usage / implementation.
Zachary Turner [Mon, 3 Oct 2016 23:20:36 +0000 (23:20 +0000)]
Modernize some code related to Args usage / implementation.

Mostly this involves simplifying some logical constructs and using
some ranges instead of index-based iteration.  NFC

llvm-svn: 283159

7 years ago[MSSA] Allow unittests to use BasicAA when building.
George Burgess IV [Mon, 3 Oct 2016 23:12:35 +0000 (23:12 +0000)]
[MSSA] Allow unittests to use BasicAA when building.

We now build MemorySSA in its ctor, instead of waiting until the user
calls MemorySSA::getWalker. This silently changed our unittests, since
we add BasicAA to AAResults *after* constructing MemorySSA (...but
before calling MemorySSA::getWalker).

None of them broke because we do most of our "did this get optimized
correctly?" tests in .ll files.

llvm-svn: 283158

7 years agoRefactor the Args class.
Zachary Turner [Mon, 3 Oct 2016 22:51:09 +0000 (22:51 +0000)]
Refactor the Args class.

There were a number of issues with the Args class preventing
efficient use of strings and incoporating LLVM's StringRef class.
The two biggest were:

1. Backing memory stored in a std::string, so we would frequently
   have to use const_cast to get a mutable buffer for passing to
   various low level APIs.
2. backing std::strings stored in a std::list, which doesn't
   provide random access.

I wanted to solve these two issues so that we could provide
StringRef access to the underlying arguments, and also a way
to provide range-based access to the underlying argument array
while still providing convenient c-style access via an argv style
const char**.

The solution here is to store arguments in a single "entry" class
which contains the backing memory, a StringRef with precomputed
length, and the quote char.  The backing memory is a manually
allocated const char* so that it is not invalidated when the
container is resized, and there is a separate argv array provided
for c-style access.

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

llvm-svn: 283157