platform/upstream/llvm.git
8 years agoTry to fix a few bots.
Rafael Espindola [Fri, 16 Sep 2016 22:47:34 +0000 (22:47 +0000)]
Try to fix a few bots.

llvm-svn: 281794

8 years agoconfigure: Add amdgcn-mesa-mesa3d target
Tom Stellard [Fri, 16 Sep 2016 22:43:33 +0000 (22:43 +0000)]
configure: Add amdgcn-mesa-mesa3d target

llvm-svn: 281793

8 years agoamdgcn-amdhsa: Add get_num_groups implementation
Tom Stellard [Fri, 16 Sep 2016 22:43:31 +0000 (22:43 +0000)]
amdgcn-amdhsa: Add get_num_groups implementation

llvm-svn: 281792

8 years agoamdgcn-amdhsa: Add get_global_size() implementation
Tom Stellard [Fri, 16 Sep 2016 22:43:29 +0000 (22:43 +0000)]
amdgcn-amdhsa: Add get_global_size() implementation

llvm-svn: 281791

8 years agoAdd target triples to fix test on non-x86.
Peter Collingbourne [Fri, 16 Sep 2016 22:26:45 +0000 (22:26 +0000)]
Add target triples to fix test on non-x86.

llvm-svn: 281790

8 years agoAMDGPU/SI: Fix kernel argument ABI for HSA
Tom Stellard [Fri, 16 Sep 2016 22:20:24 +0000 (22:20 +0000)]
AMDGPU/SI: Fix kernel argument ABI for HSA

Summary: i8, i16, and f16 values are not extended to 32-bit in the HSA kernel ABI.

Reviewers: arsenm

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, llvm-commits, yaxunl

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

llvm-svn: 281789

8 years ago[CMake] Support symlinks with the same name as the binary
Chris Bieneman [Fri, 16 Sep 2016 22:19:19 +0000 (22:19 +0000)]
[CMake] Support symlinks with the same name as the binary

This supports creating symlinks to tools in different directories than
the tool is built to. This is useful for the LLDB framework build which
I’m sending patches for shortly.

llvm-svn: 281788

8 years ago[InstCombine] canonicalize vector select with constant vector condition to shuffle
Sanjay Patel [Fri, 16 Sep 2016 22:16:18 +0000 (22:16 +0000)]
[InstCombine] canonicalize vector select with constant vector condition to shuffle

As discussed on llvm-dev ( http://lists.llvm.org/pipermail/llvm-dev/2016-August/104210.html ):
turn a vector select with constant condition operand into a shuffle as a canonicalization step.
Shuffles may be easier to reason about in conjunction with other shuffles and insert/extract.

Possible known (minor?) regressions from this change are filed as:
https://llvm.org/bugs/show_bug.cgi?id=28530
https://llvm.org/bugs/show_bug.cgi?id=28531
https://llvm.org/bugs/show_bug.cgi?id=30371

If something terrible happens to perf after this commit, feel free to revert until a backend
fix is in place.

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

llvm-svn: 281787

8 years agoAMDGPU: Allow some control flow intrinsics to be CSEd
Matt Arsenault [Fri, 16 Sep 2016 22:11:18 +0000 (22:11 +0000)]
AMDGPU: Allow some control flow intrinsics to be CSEd

These clean up some unnecessary or instructions in
cases with complex loops.

In the original testcase I noticed this, the same
or with exec was repeated 5 or 6 times in a row. With
this only one is emitted or sometimes a copy.

llvm-svn: 281786

8 years agoCodeGen: Add more checks to nobuiltin.c test, add a negative test.
Peter Collingbourne [Fri, 16 Sep 2016 22:05:53 +0000 (22:05 +0000)]
CodeGen: Add more checks to nobuiltin.c test, add a negative test.

llvm-svn: 281785

8 years ago[safestack] Fix assertion failure in stack coloring.
Evgeniy Stepanov [Fri, 16 Sep 2016 22:04:10 +0000 (22:04 +0000)]
[safestack] Fix assertion failure in stack coloring.

This is a fix for PR30318.

Clang may generate IR where an alloca is already live when entering a
BB with lifetime.start. In this case, conservatively extend the
alloca lifetime all the way back to the block entry.

llvm-svn: 281784

8 years ago[RegAllocGreedy] Fix the list of NewVRegs for last chance recoloring.
Quentin Colombet [Fri, 16 Sep 2016 22:00:50 +0000 (22:00 +0000)]
[RegAllocGreedy] Fix the list of NewVRegs for last chance recoloring.

When trying to recolor a register we may split live-ranges in the
process. When we create new live-ranges we will have to process them,
but when we move a register from Assign to Split, the allocation is not
changed until the whole recoloring session is successful.
Therefore, only push the live-ranges that changed from Assign to
Split when the recoloring is successful.

Same as the previous commit, I was not able to produce a test case that
reproduce the problem with in-tree targets.

Note: The bug has been here since the recoloring scheme has been added
back in r200883 (Feb 2014).

llvm-svn: 281783

8 years ago[RegAllocGreedy] Fix an assertion and condition when last chance recoloring is used.
Quentin Colombet [Fri, 16 Sep 2016 22:00:42 +0000 (22:00 +0000)]
[RegAllocGreedy] Fix an assertion and condition when last chance recoloring is used.

When last chance recoloring is used, the list of NewVRegs may not be
empty when calling selectOrSplitImpl. Indeed, another coloring may have
taken place with splitting/spilling in the same recoloring session.

Relax an assertion to take this into account and adapt a condition to
act as if the NewVRegs were local to this selectOrSplitImpl instance.

Unfortunately I am unable to produce a test case for this, I was only
able to reproduce the conditions on an out-of-tree target.

llvm-svn: 281782

8 years agoAMDGPU: Refactor kernel argument lowering
Tom Stellard [Fri, 16 Sep 2016 21:53:00 +0000 (21:53 +0000)]
AMDGPU: Refactor kernel argument lowering

Summary:
The main challenge in lowering kernel arguments for AMDGPU is determing the
memory type of the argument.  The generic calling convention code assumes
that only legal register types can be stored in memory, but this is not the
case for AMDGPU.

This consolidates all the logic AMDGPU uses for deducing memory types into a single
function.  This will make it much easier to support different ABIs in the future.

Reviewers: arsenm

Subscribers: arsenm, wdng, nhaehnle, llvm-commits, yaxunl

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

llvm-svn: 281781

8 years agoAMDGPU: Use SOPK compare instructions
Matt Arsenault [Fri, 16 Sep 2016 21:41:16 +0000 (21:41 +0000)]
AMDGPU: Use SOPK compare instructions

llvm-svn: 281780

8 years agoAMDGPU/SI: Add support for triples with the mesa3d operating system
Tom Stellard [Fri, 16 Sep 2016 21:34:26 +0000 (21:34 +0000)]
AMDGPU/SI: Add support for triples with the mesa3d operating system

Summary:
mesa3d will use the same kernel calling convention as amdhsa, but it will
handle everything else like the default 'unknown' OS type.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits, kzhuravl

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

llvm-svn: 281779

8 years agoPut SHF_ALLOC sections first, even with linker scripts.
Rafael Espindola [Fri, 16 Sep 2016 21:29:07 +0000 (21:29 +0000)]
Put SHF_ALLOC sections first, even with linker scripts.

This matches gold and bfd, and is pretty much required by some linker
scripts. They end with commands like

foo   0 : { *(bar) }

if we put any SHF_ALLOC sections after they can have an address that
is too low.

llvm-svn: 281778

8 years ago[InstCombine] allow vector types for constant folding / computeKnownBits (PR24942)
Sanjay Patel [Fri, 16 Sep 2016 21:20:36 +0000 (21:20 +0000)]
[InstCombine] allow vector types for constant folding / computeKnownBits (PR24942)

computeKnownBits() already works for integer vectors, so allow vector types when calling that from InstCombine.

I don't think the change to use m_APInt in computeKnownBits is strictly necessary because we do check for
ConstantVector later, but it's more efficient to handle the splat case without needing to loop on vector elements.

This should work with InstSimplify, but doesn't yet, so I made that a FIXME comment on the test for PR24942:
https://llvm.org/bugs/show_bug.cgi?id=24942

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

llvm-svn: 281777

8 years agoRename SortSectionPolicy::IgnoreConfig to None.
Rui Ueyama [Fri, 16 Sep 2016 21:14:55 +0000 (21:14 +0000)]
Rename SortSectionPolicy::IgnoreConfig to None.

Because it corresponds to SORT_NONE. None was renamed Default.

llvm-svn: 281776

8 years agoOnly process commands in a ONLY_IF_RO if it matches.
Rafael Espindola [Fri, 16 Sep 2016 21:05:36 +0000 (21:05 +0000)]
Only process commands in a ONLY_IF_RO if it matches.

This matches bfd behavior. It also makes future changes simpler as we
don't have to worry about ignoring these commands in multiple places

llvm-svn: 281775

8 years ago[LTO] Add ability to parse AA pipelines.
Davide Italiano [Fri, 16 Sep 2016 21:03:21 +0000 (21:03 +0000)]
[LTO] Add ability to parse AA pipelines.

This is supposed to be a drop in replacement for what lld
provides via --lto-newpm-aa-pipeline.

llvm-svn: 281774

8 years ago[WebAssembly] Fix function types of CFGStackify tests
Derek Schuff [Fri, 16 Sep 2016 20:58:31 +0000 (20:58 +0000)]
[WebAssembly] Fix function types of CFGStackify tests

Make the function's declared type match its (lack of) return type

llvm-svn: 281773

8 years agoFix constraint checking in ONLY_IF_RO.
Rafael Espindola [Fri, 16 Sep 2016 20:34:02 +0000 (20:34 +0000)]
Fix constraint checking in ONLY_IF_RO.

We have to look at all the relevant input sections at once.

llvm-svn: 281772

8 years ago[ELF] - Implemented --sort-section cmd line option and SORT_NONE script command.
George Rimar [Fri, 16 Sep 2016 20:21:55 +0000 (20:21 +0000)]
[ELF] - Implemented --sort-section cmd line option and SORT_NONE script command.

This fixes Bug 30385 - SORT_NONE not implemented,

`SORT_NONE' disables section sorting by ignoring the command line
section sorting option.

That is why this patch also implements --sort-section option.

Description of sorting rules
available at https://sourceware.org/binutils/docs/ld/Input-Section-Wildcards.html

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

llvm-svn: 281771

8 years agoFix compiler warnings where two values weren't being initialized.
Greg Clayton [Fri, 16 Sep 2016 20:10:02 +0000 (20:10 +0000)]
Fix compiler warnings where two values weren't being initialized.

llvm-svn: 281770

8 years ago[X86][SSE] Added vector sub combine tests
Simon Pilgrim [Fri, 16 Sep 2016 20:00:51 +0000 (20:00 +0000)]
[X86][SSE] Added vector sub combine tests

llvm-svn: 281769

8 years ago[X86][SSE] Added vector add combine tests
Simon Pilgrim [Fri, 16 Sep 2016 19:20:41 +0000 (19:20 +0000)]
[X86][SSE] Added vector add combine tests

Some work great and others currently demonstrate the anti-vector bias prevalent in DAGCombiner

llvm-svn: 281768

8 years ago[libc++] Fix inline attribute for non-MSVC Windows
Shoaib Meenai [Fri, 16 Sep 2016 19:12:54 +0000 (19:12 +0000)]
[libc++] Fix inline attribute for non-MSVC Windows

gcc and clang in gcc compatibility mode do not accept __forceinline. Use
the gcc attribute for them instead.

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

llvm-svn: 281766

8 years agoSet the correct triple when creating an ArchSpec for Windows.
Zachary Turner [Fri, 16 Sep 2016 19:09:19 +0000 (19:09 +0000)]
Set the correct triple when creating an ArchSpec for Windows.

Patch by Walter Erquinigo
Differential Revision: https://reviews.llvm.org/D24283

llvm-svn: 281765

8 years agoAdd unit tests for a few string conversion functions in Args.
Zachary Turner [Fri, 16 Sep 2016 19:09:12 +0000 (19:09 +0000)]
Add unit tests for a few string conversion functions in Args.

Also provided a StringRef overload for these functions and have
the const char* overloads delegate to the StringRef overload.

llvm-svn: 281764

8 years agoInstall libLLVM if needed with LLVM_INSTALL_TOOLCHAIN_ONLY
Derek Schuff [Fri, 16 Sep 2016 18:50:39 +0000 (18:50 +0000)]
Install libLLVM if needed with LLVM_INSTALL_TOOLCHAIN_ONLY

Summary:
When LLVM_LINK_LLVM_DYLIB is set, the libLLVM shared
library needs to be installed in the toolchain.  Without
this chanage LLVM_INSTALL_TOOLCHAIN_ONLY combined with
LLVM_LINK_LLVM_DYLIB results in a broken install.

Patch by Sam Clegg

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

llvm-svn: 281763

8 years agoDefer asm errors to post-statement failure
Nirav Dave [Fri, 16 Sep 2016 18:30:20 +0000 (18:30 +0000)]
Defer asm errors to post-statement failure

Recommitting after fixing AsmParser initialization and X86 inline asm
error cleanup.

Allow errors to be deferred and emitted as part of clean up to simplify
and shorten Assembly parser code. This will allow error messages to be
emitted in helper functions and be modified by the caller which has
better context.

As part of this many minor cleanups to the Parser:

* Unify parser cleanup on error
* Add Workaround for incorrect return values in ParseDirective instances
* Tighten checks on error-signifying return values for parser functions
  and fix in-tree TargetParsers to be more consistent with the changes.
* Fix AArch64 test cases checking for spurious error messages that are
  now fixed.

These changes should be backwards compatible with current Target Parsers
so long as the error status are correctly returned in appropriate
functions.

Reviewers: rnk, majnemer

Subscribers: aemerson, jyknight, llvm-commits

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

llvm-svn: 281762

8 years agoChange extractProfMetadata and extractProfTotalWeight to const member function.
Dehao Chen [Fri, 16 Sep 2016 18:27:20 +0000 (18:27 +0000)]
Change extractProfMetadata and extractProfTotalWeight to const member function.

llvm-svn: 281760

8 years agoMake test slightly more explicit. NFC.
Michael Kuperstein [Fri, 16 Sep 2016 18:20:43 +0000 (18:20 +0000)]
Make test slightly more explicit. NFC.

llvm-svn: 281759

8 years agoLoopDistribute should preserve GlobalsAA.
Eli Friedman [Fri, 16 Sep 2016 18:01:48 +0000 (18:01 +0000)]
LoopDistribute should preserve GlobalsAA.

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

llvm-svn: 281758

8 years agoLoopLoadElimination should preserve GlobalsAA.
Eli Friedman [Fri, 16 Sep 2016 17:58:07 +0000 (17:58 +0000)]
LoopLoadElimination should preserve GlobalsAA.

Avoids losing GlobalsAA in the standard pass pipeline.

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

llvm-svn: 281757

8 years agoauto-generate checks
Sanjay Patel [Fri, 16 Sep 2016 17:54:52 +0000 (17:54 +0000)]
auto-generate checks

llvm-svn: 281756

8 years agoauto-generate checks
Sanjay Patel [Fri, 16 Sep 2016 17:48:16 +0000 (17:48 +0000)]
auto-generate checks

llvm-svn: 281755

8 years agoRecommit r281721 "[ELF] - Linkerscript: implement EXCLUDE_FILE in the middle of a...
George Rimar [Fri, 16 Sep 2016 17:42:10 +0000 (17:42 +0000)]
Recommit r281721 "[ELF] - Linkerscript: implement EXCLUDE_FILE in the middle of a input section description."

With fix for 2 bots. Details about the fix performed is on a review page.

Initial commit message:
This is PR30387:

From PR description:
We fail to parse

SECTIONS
{
  foo :
  {
    *(sec0 EXCLUDE_FILE (zed1.o) sec1  EXCLUDE_FILE (zed2.o) sec2 )
  }
}
The semantics according to bfd are:

Include sec1 from every file but zed1.o
Include sec2 from every file but zed2.o
Include sec0 from every file

Patch implements the support.

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

llvm-svn: 281754

8 years agoIntroduce inline assembly parsing test is PR30372.
Nirav Dave [Fri, 16 Sep 2016 17:42:02 +0000 (17:42 +0000)]
Introduce inline assembly parsing test is PR30372.

llvm-svn: 281753

8 years agoFix test after renaming -name-anon-functions pass to -name-anon-globals
Mehdi Amini [Fri, 16 Sep 2016 17:18:16 +0000 (17:18 +0000)]
Fix test after renaming -name-anon-functions pass to -name-anon-globals

llvm-svn: 281752

8 years ago[LTO] Use llvm-nm instead of nm in new tests
Teresa Johnson [Fri, 16 Sep 2016 17:12:48 +0000 (17:12 +0000)]
[LTO] Use llvm-nm instead of nm in new tests

The use of nm in the new tests added with r281725 caused a couple
of bot failures:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/15701
http://bb.pgr.jp/builders/ninja-clang-i686-msc19-R/builds/6939

Use llvm-nm instead.

llvm-svn: 281750

8 years agoActually remove the Mangler from the AsmPrinter and clean up the places it was "used...
Eric Christopher [Fri, 16 Sep 2016 17:07:23 +0000 (17:07 +0000)]
Actually remove the Mangler from the AsmPrinter and clean up the places it was "used" but not used.

llvm-svn: 281749

8 years agoFix a hidden use of grabbing the Mangler from the AsmPrinter and update
Eric Christopher [Fri, 16 Sep 2016 17:07:13 +0000 (17:07 +0000)]
Fix a hidden use of grabbing the Mangler from the AsmPrinter and update
accordingly.

llvm-svn: 281748

8 years agoRemove undefined weak hooks from dll thunk export list to really fix windows build
Reid Kleckner [Fri, 16 Sep 2016 17:05:40 +0000 (17:05 +0000)]
Remove undefined weak hooks from dll thunk export list to really fix windows build

llvm-svn: 281747

8 years ago[compiler-rt] Don't force ASAN_HAS_EXCEPTIONS to be true for all builds
Francis Ricci [Fri, 16 Sep 2016 16:59:31 +0000 (16:59 +0000)]
[compiler-rt] Don't force ASAN_HAS_EXCEPTIONS to be true for all builds

Summary:
This value is already defaulted to true in asan_internal.h.
Allow the value to be overriden in cases where exceptions are unavailable.

Reviewers: kcc, samsonov, compnerd

Subscribers: kubabrecka, dberris, beanz, mgorny, llvm-commits

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

llvm-svn: 281746

8 years agoRename NameAnonFunctions to NameAnonGlobals to match what it is doing (NFC)
Mehdi Amini [Fri, 16 Sep 2016 16:56:30 +0000 (16:56 +0000)]
Rename NameAnonFunctions to NameAnonGlobals to match what it is doing (NFC)

llvm-svn: 281745

8 years agoFix NameAnonFunctions pass: for ThinLTO we need to rename global variables as well
Mehdi Amini [Fri, 16 Sep 2016 16:56:25 +0000 (16:56 +0000)]
Fix NameAnonFunctions pass: for ThinLTO we need to rename global variables as well

A follow-up patch will rename this pass and the source file accordingly,
but I figured the non-NFC change will be easier to spot in isolation.

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

llvm-svn: 281744

8 years ago[InstCombine] add helper functions for visitICmpInst(); NFCI
Sanjay Patel [Fri, 16 Sep 2016 16:10:22 +0000 (16:10 +0000)]
[InstCombine] add helper functions for visitICmpInst(); NFCI

llvm-svn: 281743

8 years ago[IRObjectFile] Turn llvm_unreachable("foo") into something more explicative.
Davide Italiano [Fri, 16 Sep 2016 16:07:19 +0000 (16:07 +0000)]
[IRObjectFile] Turn llvm_unreachable("foo") into something more explicative.

llvm-svn: 281742

8 years ago[LTO] Prevent asm references to be dropped from the output.
Davide Italiano [Fri, 16 Sep 2016 16:05:25 +0000 (16:05 +0000)]
[LTO] Prevent asm references to be dropped from the output.

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

llvm-svn: 281741

8 years agoImprove handling ASSERT outside SECTIONS block
Eugene Leviant [Fri, 16 Sep 2016 15:30:47 +0000 (15:30 +0000)]
Improve handling ASSERT outside SECTIONS block

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

llvm-svn: 281740

8 years ago[AArch64][GlobalISel] Add default regbank mapping for int<>FP.
Ahmed Bougacha [Fri, 16 Sep 2016 15:12:46 +0000 (15:12 +0000)]
[AArch64][GlobalISel] Add default regbank mapping for int<>FP.

llvm-svn: 281739

8 years ago[AArch64][GlobalISel] Add default regbank mapping for G_FCMP.
Ahmed Bougacha [Fri, 16 Sep 2016 15:12:43 +0000 (15:12 +0000)]
[AArch64][GlobalISel] Add default regbank mapping for G_FCMP.

llvm-svn: 281738

8 years ago[AArch64][GlobalISel] Add default regbank mapping for FP ops.
Ahmed Bougacha [Fri, 16 Sep 2016 15:12:40 +0000 (15:12 +0000)]
[AArch64][GlobalISel] Add default regbank mapping for FP ops.

These should have all their operands - even scalars - go on FPR.

llvm-svn: 281737

8 years agoChange how we compute offsets with linker scripts.
Rafael Espindola [Fri, 16 Sep 2016 15:10:23 +0000 (15:10 +0000)]
Change how we compute offsets with linker scripts.

This fixes pr30367, but more importantly, it changes how we compute offsets.

Now offset computation in a walk over linker script commands, like the
rest of assignAddresses. IMHO this is simpler to understand and if we
ever have to create multiple outputsections or chunks to change how we
handle test/ELF/linkerscript/alternate-sections.s it should be easier
to do it.

llvm-svn: 281736

8 years ago[AArch64][GlobalISel] Test default regbank mapping for G_ICMP.
Ahmed Bougacha [Fri, 16 Sep 2016 14:44:54 +0000 (14:44 +0000)]
[AArch64][GlobalISel] Test default regbank mapping for G_ICMP.

Also relax a RegisterBankInfo verifier check that's incompatible with
1-bit mappings.

llvm-svn: 281735

8 years ago[AArch64][GlobalISel] Add default regbank mappings for mixed-type ops.
Ahmed Bougacha [Fri, 16 Sep 2016 14:44:51 +0000 (14:44 +0000)]
[AArch64][GlobalISel] Add default regbank mappings for mixed-type ops.

We used to only support instructions with same-type operands.
Instead, use the per-register type information to map each
operand more accurately.

llvm-svn: 281734

8 years ago[AArch64][GlobalISel] Add tests for default RegBank mappings. NFC.
Ahmed Bougacha [Fri, 16 Sep 2016 14:44:48 +0000 (14:44 +0000)]
[AArch64][GlobalISel] Add tests for default RegBank mappings. NFC.

llvm-svn: 281733

8 years agoReapplying r278731 after fixing the problem that caused it to be reverted.
David L Kreitzer [Fri, 16 Sep 2016 14:38:13 +0000 (14:38 +0000)]
Reapplying r278731 after fixing the problem that caused it to be reverted.

Enhance SCEV to compute the trip count for some loops with unknown stride.

Patch by Pankaj Chawla

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

llvm-svn: 281732

8 years ago[libcxx] Add missing c++98 xfail. NFC.
Asiri Rathnayake [Fri, 16 Sep 2016 14:32:19 +0000 (14:32 +0000)]
[libcxx] Add missing c++98 xfail. NFC.

This is the only test failing in c++98 mode at the moment.

llvm-svn: 281731

8 years agoCodeGen: use pointer rather than reference in range loop
Saleem Abdulrasool [Fri, 16 Sep 2016 14:24:26 +0000 (14:24 +0000)]
CodeGen: use pointer rather than reference in range loop

Address post-commit comments from Justin Bogner.  Explicitly indicate
that the dereferenced iterator provides a pointer rather than a
reference.  NFC.

llvm-svn: 281730

8 years ago[mips] Fix previous revert r281726.
Simon Dardis [Fri, 16 Sep 2016 14:16:23 +0000 (14:16 +0000)]
[mips] Fix previous revert r281726.

llvm-svn: 281729

8 years agoFix shared library build
Ismail Donmez [Fri, 16 Sep 2016 14:10:23 +0000 (14:10 +0000)]
Fix shared library build

llvm-svn: 281728

8 years agoPlace the lowered phi instruction(s) before the DEBUG_VALUE entry
Keith Walker [Fri, 16 Sep 2016 14:07:29 +0000 (14:07 +0000)]
Place the lowered phi instruction(s) before the DEBUG_VALUE entry

When a phi node is finally lowered to a machine instruction it is
important that the lowered "load" instruction is placed before the
associated DEBUG_VALUE entry describing the value loaded.

Renamed the existing SkipPHIsAndLabels to SkipPHIsLabelsAndDebug to
more fully describe that it also skips debug entries. Then used the
"new" function SkipPHIsAndLabels when the debug information should not
be skipped when placing the lowered "load" instructions so that it is
placed before the debug entries.

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

llvm-svn: 281727

8 years agoRevert "[mips] Fix aui/daui/dahi/dati for MIPSR6"
Simon Dardis [Fri, 16 Sep 2016 13:56:05 +0000 (13:56 +0000)]
Revert "[mips] Fix aui/daui/dahi/dati for MIPSR6"

This reverts r281724. Still need dsanders to accept this.

llvm-svn: 281726

8 years ago[LTO] Fix handling of mixed (regular and thin) mode LTO
Teresa Johnson [Fri, 16 Sep 2016 13:54:19 +0000 (13:54 +0000)]
[LTO] Fix handling of mixed (regular and thin) mode LTO

Summary:
In runThinLTO we start the task numbering for ThinLTO backend
tasks depending on whether there was also a regular LTO object
(CombinedModule). However, the CombinedModule is moved at
the end of runRegularLTO, so we need to save this information and
pass it into runThinLTO. Otherwise the AddOutput callback to the client
will use the same task number for both the regular LTO object
and the first ThinLTO object, which in gold-plugin caused only
one to be end up in the output filename array and therefore passed
back to gold for the final native link.

Reviewers: pcc, mehdi_amini

Subscribers: mehdi_amini, kromanova

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

llvm-svn: 281725

8 years ago[mips] Fix aui/daui/dahi/dati for MIPSR6
Simon Dardis [Fri, 16 Sep 2016 13:50:43 +0000 (13:50 +0000)]
[mips] Fix aui/daui/dahi/dati for MIPSR6

For compatiblity with binutils, define these instructions to take
two registers with a 16bit unsigned immediate. Both of the registers
have to be same for dahi and dati.

Reviewers: vkalintiris, dsanders, zoran.jovanovic

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

llvm-svn: 281724

8 years agoReverted r281721 ("[ELF] - Linkerscript: implement EXCLUDE_FILE in the middle of...
George Rimar [Fri, 16 Sep 2016 13:30:18 +0000 (13:30 +0000)]
Reverted r281721 ("[ELF] - Linkerscript: implement EXCLUDE_FILE in the middle of a input section description.").

It broke build bot:
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/27508

llvm-svn: 281723

8 years agoReverting r281719, this is causing buildbot failures and timeouts again.
Sjoerd Meijer [Fri, 16 Sep 2016 13:16:52 +0000 (13:16 +0000)]
Reverting r281719, this is causing buildbot failures and timeouts again.

llvm-svn: 281722

8 years ago[ELF] - Linkerscript: implement EXCLUDE_FILE in the middle of a input section descrip...
George Rimar [Fri, 16 Sep 2016 13:07:02 +0000 (13:07 +0000)]
[ELF] - Linkerscript: implement EXCLUDE_FILE in the middle of a input section description.

This is PR30387:

From PR description:
We fail to parse

SECTIONS
{
  foo :
  {
    *(sec0 EXCLUDE_FILE (zed1.o) sec1  EXCLUDE_FILE (zed2.o) sec2 )
  }
}
The semantics according to bfd are:

Include sec1 from every file but zed1.o
Include sec2 from every file but zed2.o
Include sec0 from every file

Patch implements the support.

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

llvm-svn: 281721

8 years ago[AArch64][GlobalISel] Use the generic DefaultMapping as the default.
Ahmed Bougacha [Fri, 16 Sep 2016 12:33:34 +0000 (12:33 +0000)]
[AArch64][GlobalISel] Use the generic DefaultMapping as the default.

This lets generic logic handle the common case, instead of having to
implement applyMappingImpl for each instruction.

llvm-svn: 281720

8 years agoThis is an attempt to reapply r280808: [ARM] Lower UDIV+UREM to UDIV+MLS
Sjoerd Meijer [Fri, 16 Sep 2016 12:10:09 +0000 (12:10 +0000)]
This is an attempt to reapply r280808: [ARM] Lower UDIV+UREM to UDIV+MLS
(and the same for SREM)

This was causing buildbot failures earlier (time outs in the LNT suite).
However, we haven't been able to reproduce this and are suspecting this
was caused by another (reverted) patch.

llvm-svn: 281719

8 years agoTrying to fix Mangler memory leak in TargetLoweringObjectFile.
Eric Liu [Fri, 16 Sep 2016 11:50:57 +0000 (11:50 +0000)]
Trying to fix Mangler memory leak in TargetLoweringObjectFile.

Summary:
`TargetLoweringObjectFile` can be re-used and thus `TargetLoweringObjectFile::Initialize()`
can be called multiple times causing `Mang` pointer memory leak.

Reviewers: echristo

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 281718

8 years ago[RenderScript] Support tracking and dumping reduction kernels
Luke Drummond [Fri, 16 Sep 2016 11:28:12 +0000 (11:28 +0000)]
[RenderScript] Support tracking and dumping reduction kernels

Initial implementation of support for tracking
[RenderScript Reductions](https://developer.android.com/guide/topics/renderscript/compute.html#reduction-in-depth)

With this patch, `language renderscript module dump` properly lists reductions
that are part of loaded RenderScript modules as well the the consituent
functions and their roles, within the reduction.

This support required new tracking mechanisms for the `#pragma(reduce)`
mechanism, and extension of `RSModuleDescriptor::ParseRSInfo` to support
the metadata output by `bcc`. This work was also an opportunity to
refactor/improve parse code:

- `RSModuleDescriptor::ParseExportReduceCount` now has a complete
  implementation and the debugger can correctly track reductions on
  receipt of a module hook.
- `RSModuleDescriptor::Dump` now dumps Reductions as well as `ForEach`
  kernels. Also, fixed indentation of the output, and made indentation
  groupings in the source clearer.
- `RSModuleDescriptor::ParseRSInfo` now returns true if the `".rs.info"`
  packet has nonzero linecount, rather than rejecting RenderScripts that
  don't contain kernels (an unlikely situation, but possibly valid). This
  was changed because scripts that only contained reductions were not
  being tracked in `RenderScriptRuntime::LoadModule`.
- Refactor `RSModuleInfo::ParseRSInfo` and add reduction spec parser stub
 - Prepared ParseRSInfo to more easily be able to add new parser types
 - Use llvm::StringRef and llvm::StringMap helpers to make the parsing code cleaner
 - factor out forEachCount, globalVarCount, and pragmaCount parsing block to their own methods
 - Add ExportReduceCount Parser
 - Use `llvm::StringRef` in `RSKernelDescriptor` constructor
 - removed now superfluous `MAXLINE` macros as we've switched from `const
   char *` to `llvm::StringRef`

llvm-svn: 281717

8 years ago[LCG] Redesign the lazy post-order iteration mechanism for the
Chandler Carruth [Fri, 16 Sep 2016 10:20:17 +0000 (10:20 +0000)]
[LCG] Redesign the lazy post-order iteration mechanism for the
LazyCallGraph to support repeated, stable iterations, even in the face
of graph updates.

This is particularly important to allow the CGSCC pass manager to walk
the RefSCCs (and thus everything else) in a module more than once. Lots
of unittests and other tests were hard or impossible to write because
repeated CGSCC pass managers which didn't invalidate the LazyCallGraph
would conclude the module was empty after the first one. =[ Really,
really bad.

The interesting thing is that in many ways this simplifies the code. We
can now re-use the same code for handling reference edge insertion
updates of the RefSCC graph as we use for handling call edge insertion
updates of the SCC graph. Outside of adapting to the shared logic for
this (which isn't trivial, but is *much* simpler than the DFS it
replaces!), the new code involves putting newly created RefSCCs when
deleting a reference edge into the cached list in the correct way, and
to re-formulate the iterator to be stable and effective even in the face
of these kinds of updates.

I've updated the unittests for the LazyCallGraph to re-iterate the
postorder sequence and verify that this all works. We even check for
using alternating iterators to trigger the lazy formation of RefSCCs
after mutation has occured.

It's worth noting that there are a reasonable number of likely
simplifications we can make past this. It isn't clear that we need to
keep the "LeafRefSCCs" around any more. But I've not removed that mostly
because I want this to be a more isolated change.

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

llvm-svn: 281716

8 years ago[ARM] Promote small global constants to constant pools
James Molloy [Fri, 16 Sep 2016 10:17:04 +0000 (10:17 +0000)]
[ARM] Promote small global constants to constant pools

If a constant is unamed_addr and is only used within one function, we can save
on the code size and runtime cost of an indirection by changing the global's storage
to inside the constant pool. For example, instead of:

      ldr r0, .CPI0
      bl printf
      bx lr
    .CPI0: &format_string
    format_string: .asciz "hello, world!\n"

We can emit:

      adr r0, .CPI0
      bl printf
      bx lr
    .CPI0: .asciz "hello, world!\n"

This can cause significant code size savings when many small strings are used in one
function (4 bytes per string).

This recommit contains fixes for a nasty bug related to fast-isel fallback - because
fast-isel doesn't know about this optimization, if it runs and emits references to
a string that we inline (because fast-isel fell back to SDAG) we will end up
with an inlined string and also an out-of-line string, and we won't emit the
out-of-line string, causing backend failures.

It also contains fixes for emitting .text relocations which made the sanitizer
bots unhappy.

llvm-svn: 281715

8 years agoImprove handling of floating point literals in OpenCL to only use double precision...
Neil Hickey [Fri, 16 Sep 2016 10:15:06 +0000 (10:15 +0000)]
Improve handling of floating point literals in OpenCL to only use double precision if the target supports fp64

https://reviews.llvm.org/D24235

llvm-svn: 281714

8 years ago[clang-tidy] Bugfix for readability-redundant-control-flow check
Kirill Bobyrev [Fri, 16 Sep 2016 10:12:08 +0000 (10:12 +0000)]
[clang-tidy] Bugfix for readability-redundant-control-flow check

This check did not create FixItHints when the statement before the redundant
control flow was not followed by a semicolon.

Patch by Malcolm Parsons!

Reviewers: alexfh

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

llvm-svn: 281713

8 years agoTouch up [[clang::require_constant_initialization]] docs
Eric Fiselier [Fri, 16 Sep 2016 10:04:38 +0000 (10:04 +0000)]
Touch up [[clang::require_constant_initialization]] docs

* Fix an egregious comma usage.
* Remove the `static` keyword in the example since the variables should have
  external linkage.
* Use C++11 attributes in the example.

llvm-svn: 281712

8 years agoTesting commit rights. Removing trailing white space from test file.
Neil Hickey [Fri, 16 Sep 2016 09:38:11 +0000 (09:38 +0000)]
Testing commit rights. Removing trailing white space from test file.

llvm-svn: 281711

8 years ago[clang-rename] Merge rename-{at|all} & optimise.
Kirill Bobyrev [Fri, 16 Sep 2016 08:45:19 +0000 (08:45 +0000)]
[clang-rename] Merge rename-{at|all} & optimise.

Having both rename-at and rename-all both seems confusing and introduces
unneeded difficulties. After merging rename-at and rename-all maintaining main
function wrappers and custom help becomes redundant while CLI becomes less
confusing.

D24224 (which was the original patch causing buildbot failures) wasn't aware of
bugs caused by passing both -offset and -qualified-name. After D24224 was landed
it caused buildbot failures and therefor I just reverted it.

Two things that make this patch different from D24224 are:

* unittests/clang-rename was deleted, because it is unmaintained and doesn't do
much.
* Passing both `-offset` and `-qualified-name` isn't allowed anymore for the
sake of preventing bugs.

This patch is a trivial enhancement of accepted D24224 revision.

Tested with `ninja check-all`.

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

llvm-svn: 281710

8 years agoFix side effect in assertion
Eric Fiselier [Fri, 16 Sep 2016 08:16:07 +0000 (08:16 +0000)]
Fix side effect in assertion

llvm-svn: 281709

8 years agoMove the Mangler from the AsmPrinter down to TLOF and clean up the
Eric Christopher [Fri, 16 Sep 2016 07:33:15 +0000 (07:33 +0000)]
Move the Mangler from the AsmPrinter down to TLOF and clean up the
TLOF API accordingly.

llvm-svn: 281708

8 years agoRemove unused function getMang().
Eric Christopher [Fri, 16 Sep 2016 07:32:58 +0000 (07:32 +0000)]
Remove unused function getMang().

llvm-svn: 281707

8 years agoFix unused result from sign extending an Offset.
Stephen Hines [Fri, 16 Sep 2016 07:21:24 +0000 (07:21 +0000)]
Fix unused result from sign extending an Offset.

Summary:
Offset was doubled in size, but the assignment was missing. We just need
to reassign to the original variable in this case to fix it.

Reviewers: cfe-commits, echristo

Subscribers: meikeb

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

llvm-svn: 281706

8 years agoUpdate CFGPrinter -> CFGPrinterLegacyPass
Tobias Grosser [Fri, 16 Sep 2016 05:48:09 +0000 (05:48 +0000)]
Update CFGPrinter -> CFGPrinterLegacyPass

.. to match recent changes in LLVM that broke the Polly compilation.

llvm-svn: 281705

8 years agoUse functions in DebugInfoPDB to create dummy PDB file.
Rui Ueyama [Fri, 16 Sep 2016 04:32:33 +0000 (04:32 +0000)]
Use functions in DebugInfoPDB to create dummy PDB file.

I don't think we are creating valid PDB file here,
but it is okay because we have never created valid PDBs before.

llvm-svn: 281704

8 years ago[CUDA] [doc] Note that you can use std::min/max from device code with C++14.
Justin Lebar [Fri, 16 Sep 2016 04:14:02 +0000 (04:14 +0000)]
[CUDA] [doc] Note that you can use std::min/max from device code with C++14.

llvm-svn: 281702

8 years agoDemangle symbols in "undefined symbol" error message.
Rui Ueyama [Fri, 16 Sep 2016 03:52:45 +0000 (03:52 +0000)]
Demangle symbols in "undefined symbol" error message.

llvm-svn: 281698

8 years agoAttempt to fix Sphinx build
Eric Fiselier [Fri, 16 Sep 2016 03:47:53 +0000 (03:47 +0000)]
Attempt to fix Sphinx build

llvm-svn: 281697

8 years agoadd availability check to DarwinLog event tests
Todd Fiala [Fri, 16 Sep 2016 03:07:14 +0000 (03:07 +0000)]
add availability check to DarwinLog event tests

The pexpect-based tests properly checked for the stub reporting
DarwinLog support.  The event-based ones did not.  This is fixed
here.  Swift CI bots are not currently building debugserver on
macOS, so they don't have the DarwinLog support even when they
pass the macOS 10.12 check.

llvm-svn: 281696

8 years agoUpdate _LIBCPP_EXCEPTION_ABI doc with @mclow's feedback
Eric Fiselier [Fri, 16 Sep 2016 02:51:26 +0000 (02:51 +0000)]
Update _LIBCPP_EXCEPTION_ABI doc with @mclow's feedback

llvm-svn: 281695

8 years agoAdd a test for r280191
David Majnemer [Fri, 16 Sep 2016 02:43:36 +0000 (02:43 +0000)]
Add a test for r280191

llvm-svn: 281694

8 years agoAlter the iOS/tvOS ARM64 C++ ABI to ignore the upper half of the
John McCall [Fri, 16 Sep 2016 02:40:45 +0000 (02:40 +0000)]
Alter the iOS/tvOS ARM64 C++ ABI to ignore the upper half of the
virtual table offset in a member function pointer.

We are reserving this space for future ABI use relating to alternative
v-table configurations.  In the meantime, continue to zero-initialize
this space when actually emitting a member pointer literal.

This will successfully interoperate with existing compilers.
Future versions of the compiler may place additional data in
this location, and at that point, code emitted by compilers
prior to this patch will fail if exposed to such a member pointer.
This is therefore a somewhat hard ABI break.  However, because
it is limited to an uncommon case of an uncommon language feature,
and especially because interoperation with the standard library
does not depend on member pointers, we believe that with a
sufficiently advance compiler change the impact of this break
will be minimal in practice.

llvm-svn: 281693

8 years agoMove _LIBCPP_INLINE_VISIBILITY to first declaration in <propagate_const>
Eric Fiselier [Fri, 16 Sep 2016 02:16:23 +0000 (02:16 +0000)]
Move _LIBCPP_INLINE_VISIBILITY to first declaration in <propagate_const>

llvm-svn: 281692

8 years agoMove _LIBCPP_INLINE_VISIBILITY to first declaration in sstream.
Eric Fiselier [Fri, 16 Sep 2016 02:09:26 +0000 (02:09 +0000)]
Move _LIBCPP_INLINE_VISIBILITY to first declaration in sstream.

llvm-svn: 281691

8 years agoFirst tests for serializing breakpoints.
Jim Ingham [Fri, 16 Sep 2016 01:41:27 +0000 (01:41 +0000)]
First tests for serializing breakpoints.

Plus a few bug fixes I found along the way.

llvm-svn: 281690

8 years agoRevert "[asan] Avoid lifetime analysis for allocas with can be in ambiguous state"
Vitaly Buka [Fri, 16 Sep 2016 01:38:46 +0000 (01:38 +0000)]
Revert "[asan] Avoid lifetime analysis for allocas with can be in ambiguous state"

This approach is not good enough. Working on the new solution.

This reverts commit r280907.

llvm-svn: 281689

8 years agoRevert "[asan] Add flag to allow lifetime analysis of problematic allocas"
Vitaly Buka [Fri, 16 Sep 2016 01:38:43 +0000 (01:38 +0000)]
Revert "[asan] Add flag to allow lifetime analysis of problematic allocas"

This approach is not good enough. Working on the new solution.

This reverts commit r281126.

llvm-svn: 281688