platform/upstream/llvm.git
8 years ago[llvm-nm] Simplify code logic. NFCI.
Davide Italiano [Fri, 5 Feb 2016 21:10:48 +0000 (21:10 +0000)]
[llvm-nm] Simplify code logic. NFCI.

llvm-svn: 259917

8 years agoDo not honor explicit alignment attribute on fields for PS4.
Sunil Srivastava [Fri, 5 Feb 2016 20:50:02 +0000 (20:50 +0000)]
Do not honor explicit alignment attribute on fields for PS4.
This change reverts r257462 for PS4 triple.

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

llvm-svn: 259916

8 years agoCallAnalyzer::analyzeCall: change the condition back to "Cost < Threshold"
Hans Wennborg [Fri, 5 Feb 2016 20:32:42 +0000 (20:32 +0000)]
CallAnalyzer::analyzeCall: change the condition back to "Cost < Threshold"

In r252595, I inadvertently changed the condition to "Cost <= Threshold",
which caused a significant size regression in Chrome. This commit rectifies
that.

llvm-svn: 259915

8 years ago[AArch64] Refactoring aarch64-ldst-opt. NCF.
Jun Bum Lim [Fri, 5 Feb 2016 20:02:03 +0000 (20:02 +0000)]
[AArch64] Refactoring aarch64-ldst-opt. NCF.

Remove narrow load / store instructions from getMatchingPairOpcode(),
and add getMatchingWideOpcode().

llvm-svn: 259914

8 years agoTableGen: Add IsOptional field to AsmOperandClass
Tom Stellard [Fri, 5 Feb 2016 19:59:33 +0000 (19:59 +0000)]
TableGen: Add IsOptional field to AsmOperandClass

Summary:
This makes it possible to specify some operands as optional to the AsmMatcher.
Setting this field to true will prevent the AsmMatcher from emitting
'too few operands' errors when there are missing optional operands.

Reviewers: olista01, ab

Subscribers: nhaustov, arsenm, llvm-commits

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

llvm-svn: 259913

8 years agoAMDGPU: Account for LDS alignment
Matt Arsenault [Fri, 5 Feb 2016 19:47:29 +0000 (19:47 +0000)]
AMDGPU: Account for LDS alignment

The current situation isn't great, because the amount of padding
requires is determined by the inverse order of the first encountered
use. We should eventually somehow sort these to minimize wasted space.

Another problem is the alignment of kernel arguments isn't
respected. The group_segment_alignment is always emitted as
the default 16, and typed arguments with higher alignments
or an explicitly set alignment are also ignored.

llvm-svn: 259912

8 years agoAMDGPU: Preserve alignments on new created globals
Matt Arsenault [Fri, 5 Feb 2016 19:47:23 +0000 (19:47 +0000)]
AMDGPU: Preserve alignments on new created globals

Also switch to internal linkage, and include the name of the function in
the name.

llvm-svn: 259911

8 years ago[Parser] Perform CachedTokens update dependent on token consumption
Bruno Cardoso Lopes [Fri, 5 Feb 2016 19:36:39 +0000 (19:36 +0000)]
[Parser] Perform CachedTokens update dependent on token consumption

In the context where we break one tok::greatergreater into two
tok::greater in order to correctly update the cached tokens; update the
CachedTokens with two tok::greater only if ParseGreaterThanInTemplateList
clients asks to consume the last token. Otherwise we only need to add
one because the second is already added later on, as a not yet cached token.

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

rdar://problem/24488367

llvm-svn: 259910

8 years ago[codeview] Dump a missing field and change its signedness
Reid Kleckner [Fri, 5 Feb 2016 19:15:45 +0000 (19:15 +0000)]
[codeview] Dump a missing field and change its signedness

llvm-svn: 259904

8 years agoSimplify. NFC.
Rui Ueyama [Fri, 5 Feb 2016 19:13:18 +0000 (19:13 +0000)]
Simplify. NFC.

llvm-svn: 259903

8 years agoTake 2: Use an artifical namespace so that member vars do not hide local vars.
Siva Chandra [Fri, 5 Feb 2016 19:10:04 +0000 (19:10 +0000)]
Take 2: Use an artifical namespace so that member vars do not hide local vars.

Summary: This relands r259810 with fix for failures on Mac.

Reviewers: spyffe, tfiala

Subscribers: tfiala, lldb-commits

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

llvm-svn: 259902

8 years ago[modules] Separately track whether an identifier's preprocessor information and
Richard Smith [Fri, 5 Feb 2016 19:03:40 +0000 (19:03 +0000)]
[modules] Separately track whether an identifier's preprocessor information and
name lookup information have changed since deserialization. For a C++ modules
build, we do not need to re-emit the identifier into the serialized identifier
table if only the name lookup information has changed (and in all cases, we
don't need to re-emit the macro information if only the name lookup information
has changed).

llvm-svn: 259901

8 years agoAMDGPU: Remove some purely R600 functions from AMDGPUInstrInfo
Tom Stellard [Fri, 5 Feb 2016 18:44:57 +0000 (18:44 +0000)]
AMDGPU: Remove some purely R600 functions from AMDGPUInstrInfo

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

llvm-svn: 259900

8 years agoELF: Make Out<ELFT> initialization less error-prone.
Rui Ueyama [Fri, 5 Feb 2016 18:41:40 +0000 (18:41 +0000)]
ELF: Make Out<ELFT> initialization less error-prone.

Previously, it was easy to leave some Out<ELFT> fields uninitialized
because assignments to the fields are mixed with output section
instantiations. In this patch, I separate initializations from assignments
to improve readability.

http://reviews.llvm.org/D16864

llvm-svn: 259899

8 years ago[ASTMatchers] Allow hasName() to look through inline namespaces
Samuel Benzaquen [Fri, 5 Feb 2016 18:29:24 +0000 (18:29 +0000)]
[ASTMatchers] Allow hasName() to look through inline namespaces

Summary:
Allow hasName() to look through inline namespaces.
This will fix the interaction between some clang-tidy checks and libc++.

libc++ defines names in an inline namespace named std::<version_#>.
When we try to match a name using hasName("std::xxx") it fails to match and the clang-tidy check does not work.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 259898

8 years agoAMDGPU: Fix ordering of CPU and FS parameters in TargetMachine constructors
Tom Stellard [Fri, 5 Feb 2016 18:29:17 +0000 (18:29 +0000)]
AMDGPU: Fix ordering of CPU and FS parameters in TargetMachine constructors

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

llvm-svn: 259897

8 years agoFix echo.ll test failing due to DOS line endings
Reid Kleckner [Fri, 5 Feb 2016 18:21:28 +0000 (18:21 +0000)]
Fix echo.ll test failing due to DOS line endings

llvm-svn: 259896

8 years agoSome stackslots are allocated to vregs which have no real reference.
Wei Mi [Fri, 5 Feb 2016 18:14:24 +0000 (18:14 +0000)]
Some stackslots are allocated to vregs which have no real reference.

LiveRangeEdit::eliminateDeadDef is used to remove dead define instructions
after rematerialization. To remove a VNI for a vreg from its LiveInterval,
LiveIntervals::removeVRegDefAt is used. However, after non-PHI VNIs are all
removed, PHI VNI are still left in the LiveInterval. Such unused vregs will
be kept in RegsToSpill[] at the end of InlineSpiller::reMaterializeAll and
spiller will allocate stackslot for them.

The fix is to get rid of unused reg by checking whether it has non-dbg
reference instead of whether it has non-empty interval.

llvm-svn: 259895

8 years agoAMDGPU/SI: Correctly initialize SIInsertWaits pass
Tom Stellard [Fri, 5 Feb 2016 17:42:38 +0000 (17:42 +0000)]
AMDGPU/SI: Correctly initialize SIInsertWaits pass

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

llvm-svn: 259894

8 years ago[WebAssembly] Update the select instructions' operand orders to match the spec.
Dan Gohman [Fri, 5 Feb 2016 17:14:59 +0000 (17:14 +0000)]
[WebAssembly] Update the select instructions' operand orders to match the spec.

llvm-svn: 259893

8 years agoRename IsUsedInDynamicReloc to MustBeInDynSym.
Rafael Espindola [Fri, 5 Feb 2016 15:27:15 +0000 (15:27 +0000)]
Rename IsUsedInDynamicReloc to MustBeInDynSym.

The variable was marking various cases where a symbol must be included
in the dynamic symbol table. Being used by a dynamic relocation was only
one of them.

llvm-svn: 259889

8 years agoAdd the missing test case for PR26193
Nemanja Ivanovic [Fri, 5 Feb 2016 15:03:17 +0000 (15:03 +0000)]
Add the missing test case for PR26193

llvm-svn: 259888

8 years agoCentralize most calls to setUsedInDynamicReloc.
Rafael Espindola [Fri, 5 Feb 2016 15:03:10 +0000 (15:03 +0000)]
Centralize most calls to setUsedInDynamicReloc.

llvm-svn: 259887

8 years agoFix for PR 26193
Nemanja Ivanovic [Fri, 5 Feb 2016 14:50:29 +0000 (14:50 +0000)]
Fix for PR 26193

This is a simple fix for a PowerPC intrinsic that was incorrectly defined
(the return type was incorrect).

llvm-svn: 259886

8 years agoAdd support to detect arm hard float ABI based binaries for ABISysV_arm
Omair Javaid [Fri, 5 Feb 2016 14:37:53 +0000 (14:37 +0000)]
Add support to detect arm hard float ABI based binaries for ABISysV_arm

This patch adds logic to detect if underlying binary is using arm hard float abi and use that information while handling return values in ABISysV_arm.

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

llvm-svn: 259885

8 years agoclang-format: Fix corner case in template detection.
Daniel Jasper [Fri, 5 Feb 2016 14:17:16 +0000 (14:17 +0000)]
clang-format: Fix corner case in template detection.

Before:
  f(a.operator() < A > ());

After:
  f(a.operator()<A>());

llvm-svn: 259884

8 years agoMove classes defined in a cpp file into an anonymous namespace.
Benjamin Kramer [Fri, 5 Feb 2016 13:50:53 +0000 (13:50 +0000)]
Move classes defined in a cpp file into an anonymous namespace.

No functionality change intended.

llvm-svn: 259883

8 years agoPrefix external symbols in llvm-c-test.
Benjamin Kramer [Fri, 5 Feb 2016 13:31:14 +0000 (13:31 +0000)]
Prefix external symbols in llvm-c-test.

This makes it less likely to clash with other stuff that might be linked
in by change, e.g. ncurses exposes an external function called simply
"echo", so linking ncurses statically into the binary explodes in funny
ways.

llvm-svn: 259882

8 years agoRevert "[AArch64] Improve load/store optimizer to handle LDUR + LDR (take 3)."
Renato Golin [Fri, 5 Feb 2016 12:14:30 +0000 (12:14 +0000)]
Revert "[AArch64] Improve load/store optimizer to handle LDUR + LDR (take 3)."

This reverts commit r259812 as it broke AArch64 self-hosting.

llvm-svn: 259881

8 years agoUnbreak the cmake shared build.
Benjamin Kramer [Fri, 5 Feb 2016 11:38:50 +0000 (11:38 +0000)]
Unbreak the cmake shared build.

llvm-svn: 259880

8 years ago[clang-tdiy] Add header file extension configuration support.
Haojian Wu [Fri, 5 Feb 2016 11:23:59 +0000 (11:23 +0000)]
[clang-tdiy] Add header file extension configuration support.

Summary: * Add a `HeaderFileExtensions` check option in misc-definitions-in-headers, google-build-namespaces and google-global-names-in-headers.

Reviewers: aaron.ballman, alexfh

Subscribers: cfe-commits

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

llvm-svn: 259879

8 years agoBump up the packet timeout for gdbremote tests
Pavel Labath [Fri, 5 Feb 2016 11:17:22 +0000 (11:17 +0000)]
Bump up the packet timeout for gdbremote tests

Log confirmed that the we are sometimes timing out on the receive, even though the server is
sending the correct packets.

llvm-svn: 259878

8 years ago[DebugInfo] Eliminate compilation warning about used variable LSDA
Dmitry Polukhin [Fri, 5 Feb 2016 09:24:34 +0000 (09:24 +0000)]
[DebugInfo] Eliminate compilation warning about used variable LSDA

The waring was:
lib/DebugInfo/DWARF/DWARFDebugFrame.cpp:643:20: warning: variable ‘LSDA’ set but not used

llvm-svn: 259877

8 years ago[CMake] Introduce OPENMP_LLVM_TOOLS_DIR
Jonas Hahnfeld [Fri, 5 Feb 2016 07:00:13 +0000 (07:00 +0000)]
[CMake] Introduce OPENMP_LLVM_TOOLS_DIR

This will be used in a later patch to find additional LLVM tools for tests and
enables reusability for libomptarget that is currently under review.

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

llvm-svn: 259876

8 years ago[analyzer] Suppress localization diagnostics in debug classes and methods.
Devin Coughlin [Fri, 5 Feb 2016 04:22:15 +0000 (04:22 +0000)]
[analyzer] Suppress localization diagnostics in debug classes and methods.

If the class or method name case-insensitively contains the term "debug",
suppress warnings about string constants flowing to user-facing UI APIs.

llvm-svn: 259875

8 years agoCodeGen: correct Windows ARM C++ assertion
Saleem Abdulrasool [Fri, 5 Feb 2016 04:12:40 +0000 (04:12 +0000)]
CodeGen: correct Windows ARM C++ assertion

Because the Decl is explicitly passed as nullptr further up the call chain, it
is possible to invoke isa on a nullptr, which will assert.  Guard against the
nullptr.

Take the opportunity to reuse the helper method rather than re-implementing this
logic.

llvm-svn: 259874

8 years ago[CMake] One more try to make CMake clean up after itself
Chris Bieneman [Fri, 5 Feb 2016 03:59:08 +0000 (03:59 +0000)]
[CMake] One more try to make CMake clean up after itself

Seriously... CMake... You're on my list...

llvm-svn: 259873

8 years agoRevert "[CMake] Improve the clang order-file generation workflow"
Chris Bieneman [Fri, 5 Feb 2016 03:40:37 +0000 (03:40 +0000)]
Revert "[CMake] Improve the clang order-file generation workflow"

This reverts commit r259862, and attempts to fix builder CMakeCaches.

Will try this again some other time...

Conflicts:

CMakeLists.txt
tools/driver/CMakeLists.txt

llvm-svn: 259872

8 years ago[CMake] One more try to fix this.
Chris Bieneman [Fri, 5 Feb 2016 03:02:40 +0000 (03:02 +0000)]
[CMake] One more try to fix this.

This change will catch any bots that generated the order file that GNU ld doesn't like and delete it before trying to generate one that I think GNU ld will deal with.

llvm-svn: 259871

8 years ago[CMake] Speculative fix for linker error on Linux
Chris Bieneman [Fri, 5 Feb 2016 02:51:33 +0000 (02:51 +0000)]
[CMake] Speculative fix for linker error on Linux

I can't reproduce this locally, but I think this may fix it.

llvm-svn: 259870

8 years ago[LoopUnrolling] Try harder to avoid rebuilding LCSSA when possible.
Michael Zolotukhin [Fri, 5 Feb 2016 02:17:36 +0000 (02:17 +0000)]
[LoopUnrolling] Try harder to avoid rebuilding LCSSA when possible.

In r255133 (reapplied r253126) we started to avoid redundant
recomputation of LCSSA after loop-unrolling. This patch moves one step
further in this direction - now we can avoid it for much wider range of
loops, as we start to look at IR and try to figure out if the
transformation actually breaks LCSSA phis or makes it necessary to
insert new ones.

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

llvm-svn: 259869

8 years ago[MC] Add support for encoding CodeView variable definition ranges
David Majnemer [Fri, 5 Feb 2016 01:55:49 +0000 (01:55 +0000)]
[MC] Add support for encoding CodeView variable definition ranges

CodeView, like most other debug formats, represents the live range of a
variable so that debuggers might print them out.

They use a variety of records to represent how a particular variable
might be available (in a register, in a frame pointer, etc.) along with
a set of ranges where this debug information is relevant.

However, the format only allows us to use ranges which are limited to a
maximum of 0xF000 in size.  This means that we need to split our debug
information into chunks of 0xF000.

Because the layout of code is not known until *very* late, we must use a
new fragment to record the information we need until we can know
*exactly* what the range is.

llvm-svn: 259868

8 years ago[RS4GC] Pass DenseMap by reference, NFC
Joseph Tremoulet [Fri, 5 Feb 2016 01:42:52 +0000 (01:42 +0000)]
[RS4GC] Pass DenseMap by reference, NFC

Summary:
Passing the rematerialized values map to insertRematerializationStores by
value looks to be a simple oversight; update it to pass by reference.

Reviewers: reames, sanjoy

Subscribers: llvm-commits

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

llvm-svn: 259867

8 years ago[modules] Factor out common code to mark identifier being "from AST", and add a
Richard Smith [Fri, 5 Feb 2016 01:40:54 +0000 (01:40 +0000)]
[modules] Factor out common code to mark identifier being "from AST", and add a
call in one more place to reduce the size of identifier tables in non-leaf
modules. No behavior change.

llvm-svn: 259866

8 years agoAdd two more addresses to check for the address of the kernel in debug mode;
Jason Molenda [Fri, 5 Feb 2016 01:38:56 +0000 (01:38 +0000)]
Add two more addresses to check for the address of the kernel in debug mode;
also add some logging about where lldb is lookin for a kernel as it connects.
<rdar://problem/24454582>

llvm-svn: 259865

8 years ago[CMake] Trying to fix a bot failure I introduced in r259862
Chris Bieneman [Fri, 5 Feb 2016 01:27:31 +0000 (01:27 +0000)]
[CMake] Trying to fix a bot failure I introduced in r259862

CMake caching behavior makes me sad.

llvm-svn: 259864

8 years agoAdd various binary operations in the LLVM C API echo test
Amaury Sechet [Fri, 5 Feb 2016 01:27:11 +0000 (01:27 +0000)]
Add various binary operations in the LLVM C API echo test

Summary: This diff increase the tested surface of the C API.

Reviewers: bogner, chandlerc, echristo, dblaikie, joker.eph, Wallbraker

Subscribers: llvm-commits

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

llvm-svn: 259863

8 years ago[CMake] Improve the clang order-file generation workflow
Chris Bieneman [Fri, 5 Feb 2016 01:22:03 +0000 (01:22 +0000)]
[CMake] Improve the clang order-file generation workflow

Summary:
With this change generating clang order files using dtrace uses the following workflow:

cmake <whatever options you want>

ninja generate-order-file

ninja clang

This patch works by setting a default path to the order file (which can be overridden by the user). If the order file doesn't exist during configuration CMake will create an empty one.

CMake then ties up the dependencies between the clang link job and the order file, and generate-order-file overwrites CLANG_ORDER_FILE with the new order file.

Reviewers: bogner

Subscribers: cfe-commits

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

llvm-svn: 259862

8 years ago[LoopLoadElim] Don't allow versioning when optForSize
Adam Nemet [Fri, 5 Feb 2016 01:14:05 +0000 (01:14 +0000)]
[LoopLoadElim] Don't allow versioning when optForSize

This was requested in the review of D16300.

llvm-svn: 259861

8 years agoFix typo in comment
Adam Nemet [Fri, 5 Feb 2016 01:14:00 +0000 (01:14 +0000)]
Fix typo in comment

llvm-svn: 259860

8 years agoDon't synthesize an ImportDecl for a module named in -fmodule-implementation-of
Ben Langmuir [Fri, 5 Feb 2016 01:10:05 +0000 (01:10 +0000)]
Don't synthesize an ImportDecl for a module named in -fmodule-implementation-of

When building a PCH with modules enabled this import would assert in the
ASTWriter and (if assertions were disabled) sometimes crash the compiler
that loaded the resulting PCH when trying to lookup the submodule ID.

rdar://problem/24137448

llvm-svn: 259859

8 years agoFix printing of f16 machine operands
Matt Arsenault [Fri, 5 Feb 2016 00:50:18 +0000 (00:50 +0000)]
Fix printing of f16 machine operands

Only single and double FP immediates are correctly printed by
MachineInstr::print() during debug output. Half float type goes to
APFloat::convertToDouble() and hits assertion it is not a double
semantics. This diff prints half machine operands correctly.

This cannot currently be hit by any in-tree target.

Patch by Stanislav Mekhanoshin

llvm-svn: 259857

8 years agoFix build breakage introduced by r259846.
Easwaran Raman [Fri, 5 Feb 2016 00:45:02 +0000 (00:45 +0000)]
Fix build breakage introduced by r259846.

llvm-svn: 259855

8 years agoAdd a test for MemorySSA. NFC.
George Burgess IV [Fri, 5 Feb 2016 00:42:02 +0000 (00:42 +0000)]
Add a test for MemorySSA. NFC.

We don't currently have many tests that deal with operations on multiple
local MemoryLocations. This new test helps out a bit in that regard.

llvm-svn: 259854

8 years agoAdd Support to llvm-c-test dependancies
Amaury Sechet [Fri, 5 Feb 2016 00:19:50 +0000 (00:19 +0000)]
Add Support to llvm-c-test dependancies

Summary: As per title. It is required and don't get linked in in some builds.

Reviewers: chapuni, joker.eph

Subscribers: llvm-commits

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

llvm-svn: 259853

8 years agoELF: Make names for TLS module indices shorter.
Rui Ueyama [Fri, 5 Feb 2016 00:10:02 +0000 (00:10 +0000)]
ELF: Make names for TLS module indices shorter.

The previous names contained "Local" and "Current", but what we
are handling is always local and current, so they were redundant.

TlsIndex comes from "tls_index" struct that Ulrich Drepper is using
in this document to describe this data structure in GOT.

llvm-svn: 259852

8 years agoFunction name change /NFC
Xinliang David Li [Thu, 4 Feb 2016 23:59:09 +0000 (23:59 +0000)]
Function name change /NFC

llvm-svn: 259851

8 years agoAdd a little logging to ProcessMachCore so it is easier to tell when a user process...
Jason Molenda [Thu, 4 Feb 2016 23:45:17 +0000 (23:45 +0000)]
Add a little logging to ProcessMachCore so it is easier to tell when a user process dyld
or mach kernel binary are found, and if there are multiples of them found within a single
corefile.
<rdar://problem/24446112>

llvm-svn: 259850

8 years agoSimplify. NFC.
Rui Ueyama [Thu, 4 Feb 2016 23:39:35 +0000 (23:39 +0000)]
Simplify. NFC.

llvm-svn: 259848

8 years agoDo not round uintX_t to uint32_t.
Rui Ueyama [Thu, 4 Feb 2016 23:39:33 +0000 (23:39 +0000)]
Do not round uintX_t to uint32_t.

On 64-bit computers, this value can be larger than UINT32_MAX.

llvm-svn: 259847

8 years agoRefactor profile summary support code. NFC.
Easwaran Raman [Thu, 4 Feb 2016 23:34:31 +0000 (23:34 +0000)]
Refactor profile summary support code. NFC.

Summary computation is not just for instrumented profiling and so I have moved
the ProfileSummary class to ProfileCommon.h (named so to allow code unrelated
to summary but common to instrumented and sampled profiling to be placed there)

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

llvm-svn: 259846

8 years agoFix the search path for CMake files
Niels Ole Salscheider [Thu, 4 Feb 2016 23:28:57 +0000 (23:28 +0000)]
Fix the search path for CMake files

This allows to find the LLVM's CMake files after moving them in
r259821.

llvm-svn: 259845

8 years agoImprove testing for the C API
Amaury Sechet [Thu, 4 Feb 2016 23:26:19 +0000 (23:26 +0000)]
Improve testing for the C API

Summary:
This basically add an echo test case in C. The support is limited right now, but full support would just be too much to review at once.

The echo test case simply get a module as input and try to output the same exact module. This allow to check the both reading and writing API are working as expected.

I want to improve this test over time to support more and more of the API, in order to improve coverage (coverage is quite poor right now).

Test Plan: Run the test.

Reviewers: chandlerc, bogner

Subscribers: llvm-commits

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

llvm-svn: 259844

8 years agoMerge conditions of two nested `if`s.
Rui Ueyama [Thu, 4 Feb 2016 23:18:22 +0000 (23:18 +0000)]
Merge conditions of two nested `if`s.

llvm-svn: 259843

8 years agoFix the search path for CMake files
Niels Ole Salscheider [Thu, 4 Feb 2016 23:17:20 +0000 (23:17 +0000)]
Fix the search path for CMake files

This allows to find the LLVM's CMake files after moving them in
r259821.

llvm-svn: 259842

8 years agoFix the libdir suffix for LLVM_CMAKE_PATH
Niels Ole Salscheider [Thu, 4 Feb 2016 23:15:29 +0000 (23:15 +0000)]
Fix the libdir suffix for LLVM_CMAKE_PATH

llvm-svn: 259841

8 years agoFix for PR 26356
Nemanja Ivanovic [Thu, 4 Feb 2016 23:14:42 +0000 (23:14 +0000)]
Fix for PR 26356

Using the load immediate only when the immediate (whether signed or unsigned)
can fit in a 16-bit signed field. Namely, from -32768 to 32767 for signed and
0 to 65535 for unsigned. This patch also ensures that we sign-extend under the
right conditions.

llvm-svn: 259840

8 years agoFix typo and test commit
Evandro Menezes [Thu, 4 Feb 2016 23:07:57 +0000 (23:07 +0000)]
Fix typo and test commit

llvm-svn: 259839

8 years agoMove the rest of the tests over to using the new decorator module.
Zachary Turner [Thu, 4 Feb 2016 23:04:17 +0000 (23:04 +0000)]
Move the rest of the tests over to using the new decorator module.

llvm-svn: 259838

8 years agoPR25271: When attaching default template arguments to redeclarations of a
Richard Smith [Thu, 4 Feb 2016 22:54:41 +0000 (22:54 +0000)]
PR25271: When attaching default template arguments to redeclarations of a
template, keep looking for default arguments if we see a template parameter
pack. There may be default arguments preceding a pack with no default argument.

Patch by Jannis Harder!

llvm-svn: 259836

8 years agoProvide a test case for rl259798
Nemanja Ivanovic [Thu, 4 Feb 2016 22:36:10 +0000 (22:36 +0000)]
Provide a test case for rl259798

llvm-svn: 259835

8 years agoReplace tabs with spaces for consistent indentation. No actual text changes.
Adrian McCarthy [Thu, 4 Feb 2016 22:20:30 +0000 (22:20 +0000)]
Replace tabs with spaces for consistent indentation.  No actual text changes.

llvm-svn: 259834

8 years agoFix the search path for CMake files
Niels Ole Salscheider [Thu, 4 Feb 2016 21:45:02 +0000 (21:45 +0000)]
Fix the search path for CMake files

This fixes the build after moving LLVM's CMake files in r259821.

llvm-svn: 259832

8 years agoDon't push relocation sections onto InputSection<ELFT>::Discarded.RelocSections
Sean Silva [Thu, 4 Feb 2016 21:41:07 +0000 (21:41 +0000)]
Don't push relocation sections onto InputSection<ELFT>::Discarded.RelocSections

Summary:
LLVM3.3 (and earlier) would fail to include a relocation section in
the group that the section it was relocating is in. Object files
affected by this issue have been encountered in the wild when using LLD.

This would result in a siutation like:

  Section {
    Index: 5
    Name: .text._Z3fooIiEvv (6)
    Type: SHT_PROGBITS (0x1)
    Flags [ (0x206)
      SHF_ALLOC (0x2)
      SHF_EXECINSTR (0x4)
      SHF_GROUP (0x200)
    ]
    Address: 0x0
    Offset: 0x48
    Size: 5
    Link: 0
    Info: 0
    AddressAlignment: 1
    EntrySize: 0
  }
  Section {
    Index: 6
    Name: .rela.text._Z3fooIiEvv (1)
    Type: SHT_RELA (0x4)
    Flags [ (0x0)
    ]
    Address: 0x0
    Offset: 0x3F0
    Size: 24
    Link: 8
    Info: 5
    AddressAlignment: 8
    EntrySize: 24
  }

In LLD, during symbol resolution, we discard the section containing the
weak symbol, but this amounts to replacing it with
InputSection<ELFT>::Discarded.
When we later saw the corresponding relocation section, we would then
end up pusing onto InputSection<ELFT>::Discarded.RelocSections, which is
bogus.

Reviewers: ruiu, rafael

Subscribers: llvm-commits, Bigcheese

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

llvm-svn: 259831

8 years agoAvoid code duplication when creating dynamic relocations.
Rafael Espindola [Thu, 4 Feb 2016 21:33:05 +0000 (21:33 +0000)]
Avoid code duplication when creating dynamic relocations.

Another case where we currently have almost duplicated code is the
creation of dynamic relocations. First to decide if we need one, then to
decide what to write.

This patch fixes it by passing more information from the relocation scan
to the section writing code. This is the same idea used for r258723.

I actually think it should be possible to simplify this further by
reordering things a bit in the writer. For example, we should be able to
represent almost every position in the file with an OutputSeciton and
offset. When writing it out we then just need to add the offset to the
OutputSection VA.

llvm-svn: 259829

8 years ago[AArch64] Bound the number of instructions we scan when searching for updates.
Chad Rosier [Thu, 4 Feb 2016 21:26:02 +0000 (21:26 +0000)]
[AArch64] Bound the number of instructions we scan when searching for updates.

This only impacts the creation of pre-/post-index instructions.  The bound was
set high enough such that it did not change code generation for SPEC200X.

llvm-svn: 259828

8 years agoSet CPU_SUBTYPE_LIB64 in mach_header.
Pete Cooper [Thu, 4 Feb 2016 20:43:43 +0000 (20:43 +0000)]
Set CPU_SUBTYPE_LIB64 in mach_header.

On Mac OS 10.5 and later, with X86_64 and outputting a dynamic executable,
ld64 set the CPU_SUBTYPE_LIB64 mask on the cpusubtype in the mach_header.

This adds the same functionality to lld.

rdar://problem/24507177

llvm-svn: 259826

8 years ago[docs] Fix typo in YamlIO.rst
Vedant Kumar [Thu, 4 Feb 2016 20:42:43 +0000 (20:42 +0000)]
[docs] Fix typo in YamlIO.rst

Patch by Mario Lang!

llvm-svn: 259825

8 years agobuiltins: Fix struct __emutls_control to match GCC
Chih-Hung Hsieh [Thu, 4 Feb 2016 20:26:00 +0000 (20:26 +0000)]
builtins: Fix struct __emutls_control to match GCC

The type of size and align in struct __emutls_control must be
  typedef unsigned int gcc_word __attribute__((mode(word)));
to match GCC. When gcc_word is larger than size_t, which is the case
for x32, the upper extra bits are all zeros. We can use variables of
size_t to operate on size and align.

Fix one trivial C99 warning about mixed declaration and code.

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

llvm-svn: 259824

8 years agoRevert "Use an artifical namespace so that member vars do not hide local vars."
Siva Chandra [Thu, 4 Feb 2016 20:08:40 +0000 (20:08 +0000)]
Revert "Use an artifical namespace so that member vars do not hide local vars."

Summary:
This reverts commit 8af14b5f9af68c31ac80945e5b5d56f0a14b38e4.
Reverting as it breaks a few tests on Mac.

Reviewers: spyffe

Subscribers: lldb-commits

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

llvm-svn: 259823

8 years agoInstall cmake files to lib/cmake/clang
Niels Ole Salscheider [Thu, 4 Feb 2016 20:08:27 +0000 (20:08 +0000)]
Install cmake files to lib/cmake/clang

This is the right location for platform-specific files.

Also, search for LLVM's CMake files in this directory.

llvm-svn: 259822

8 years agoInstall cmake files to lib/cmake/llvm
Niels Ole Salscheider [Thu, 4 Feb 2016 20:08:19 +0000 (20:08 +0000)]
Install cmake files to lib/cmake/llvm

This is the right location for platform-specific files.

On some distributions (e. g. Exherbo), a package can be installed for several
architectures in parallel, but the architecture-independent files are shared.
Therefore, we must not install architecture-dependent files (like the CMake
config and export files) to share/.

llvm-svn: 259821

8 years agoFix a crash when there is a typo in the return statement.
Manman Ren [Thu, 4 Feb 2016 20:05:40 +0000 (20:05 +0000)]
Fix a crash when there is a typo in the return statement.

If the typo happens after a successful deduction for an earlier
return statement, we should check if the deduced type is null
before using it.

The typo correction happens after we try to deduce the return
type and we ignore the deduction from the typo and continue
to typo correction.

rdar://24342247

llvm-svn: 259820

8 years ago[PGO] code simplification: use existing VP annotation API /NFC
Xinliang David Li [Thu, 4 Feb 2016 19:54:17 +0000 (19:54 +0000)]
[PGO] code simplification: use existing VP annotation API /NFC

llvm-svn: 259819

8 years agoMake HostThread SetName work on OS X. GetName doesn't currently work, the code that...
Jim Ingham [Thu, 4 Feb 2016 19:42:32 +0000 (19:42 +0000)]
Make HostThread SetName work on OS X.  GetName doesn't currently work, the code that was in
GetName actually got the queue name not the thread name and anyway didn't actually work to do
that.  So I just deleted it with a fixme.

<rdar://problem/24487554>

llvm-svn: 259818

8 years agoAdd LIBOMP_ENABLE_SHARED option for CMake
Jonathan Peyton [Thu, 4 Feb 2016 19:29:35 +0000 (19:29 +0000)]
Add LIBOMP_ENABLE_SHARED option for CMake

When building executables for Cray supercomputers, statically-linked executables
are preferred. This patch makes it possible to build the OpenMP runtime as an
archive for building statically-linked executables.  The patch adds the flag
LIBOMP_ENABLE_SHARED, which defaults to true. When true, a build of the OpenMP
runtime yields dynamic libraries. When false, a build of the OpenMP runtime
yields static libraries. There is no setting that allows both kinds of libraries
to be built.

Patch by John Mellor-Crummey

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

llvm-svn: 259817

8 years ago[X86][SSE] Select domain for 32/64-bit partial loads for EltsFromConsecutiveLoads
Simon Pilgrim [Thu, 4 Feb 2016 19:27:51 +0000 (19:27 +0000)]
[X86][SSE] Select domain for 32/64-bit partial loads for EltsFromConsecutiveLoads

Choose between MOVD/MOVSS and MOVQ/MOVSD depending on the target vector type.

This has a lot fewer test changes than trying to add this to X86InstrInfo::setExecutionDomain.....

llvm-svn: 259816

8 years agoFix a regression for r259736.
Wei Mi [Thu, 4 Feb 2016 19:17:33 +0000 (19:17 +0000)]
Fix a regression for r259736.

When SCEV expansion tries to reuse an existing value, it is needed to ensure
that using the Value at the InsertPt will not break LCSSA. The fix adds a
check that InsertPt is either inside the candidate Value's parent loop, or
the candidate Value's parent loop is nullptr.

llvm-svn: 259815

8 years agoFix format in comment
Xinliang David Li [Thu, 4 Feb 2016 19:14:10 +0000 (19:14 +0000)]
Fix format in comment

llvm-svn: 259814

8 years ago[PGO] Add interfaces to annotate instr with VP data
Xinliang David Li [Thu, 4 Feb 2016 19:11:43 +0000 (19:11 +0000)]
[PGO] Add interfaces to annotate instr with VP data
  Add interfaces to do value profile data IR annnotation
  and read. Needed by both FE and IR based PGO.

llvm-svn: 259813

8 years ago[AArch64] Improve load/store optimizer to handle LDUR + LDR (take 3).
Chad Rosier [Thu, 4 Feb 2016 18:59:49 +0000 (18:59 +0000)]
[AArch64] Improve load/store optimizer to handle LDUR + LDR (take 3).

This patch allows the mixing of scaled and unscaled load/stores to form
load/store pairs.

PR24465
http://reviews.llvm.org/D12116
Many thanks to Ahmed and Michael for fixes and code review.

This is a reapplication of r246769 and r259790.  The tramp3d failure was caused
by an incorrect refactoring in the patch.  Specifically, we weren't always
properly clearing the SExtIdx flag.

llvm-svn: 259812

8 years ago[PGO] cc1 option name change for profile instrumentation
Rong Xu [Thu, 4 Feb 2016 18:39:09 +0000 (18:39 +0000)]
[PGO] cc1 option name change for profile instrumentation

This patch changes cc1 option -fprofile-instr-generate to an enum option
-fprofile-instrument={clang|none}. It also changes cc1 options
-fprofile-instr-generate= to -fprofile-instrument-path=.
The driver level option -fprofile-instr-generate and -fprofile-instr-generate=
remain intact. This change will pave the way to integrate new PGO
instrumentation in IR level.

Review: http://reviews.llvm.org/D16730
llvm-svn: 259811

8 years agoUse an artifical namespace so that member vars do not hide local vars.
Siva Chandra [Thu, 4 Feb 2016 18:38:35 +0000 (18:38 +0000)]
Use an artifical namespace so that member vars do not hide local vars.

Summary:
While evaluating expressions when stopped in a class method, there was a
problem of member variables hiding local variables. This was happening
because, in the context of a method, clang already knew about member
variables with their name and assumed that they were the only variables
with those names in scope. Consequently, clang never checks with LLDB
about the possibility of local variables with the same name and goes
wrong. This change addresses the problem by using an artificial
namespace "$__lldb_local_vars". All local variables in scope are
declared in the "$__lldb_expr" method as follows:

    using $__lldb_local_vars::<local var 1>;
    using $__lldb_local_vars::<local var 2>;
    ...

This hides the member variables with the same name and forces clang to
enquire about the variables which it thinks are declared in
$__lldb_local_vars. When LLDB notices that clang is enquiring about
variables in $__lldb_local_vars, it looks up local vars and conveys
their information if found. This way, member variables do not hide local
variables, leading to correct evaluation of expressions.

A point to keep in mind is that the above solution does not solve the
problem for one specific case:

    namespace N
    {
        int a;
    }

    class A
    {
    public:
        void Method();
        int a;
    };

    void
    A::Method()
    {
        using N::a;
        ...

        // Since the above solution only touches locals, it does not
        // force clang to enquire about "a" coming from namespace N.
    }

Reviewers: clayborg, spyffe

Subscribers: lldb-commits

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

llvm-svn: 259810

8 years ago[SCEV] Add boolean accessors for NSW, NUW and NW; NFC
Sanjoy Das [Thu, 4 Feb 2016 18:21:54 +0000 (18:21 +0000)]
[SCEV] Add boolean accessors for NSW, NUW and NW; NFC

llvm-svn: 259809

8 years agoMove some of the common decorators to decorators.py.
Zachary Turner [Thu, 4 Feb 2016 18:03:01 +0000 (18:03 +0000)]
Move some of the common decorators to decorators.py.

This doesn't attempt to move every decorator.  The reason for
this is that it requires touching every single test file to import
decorators.py.  I would like to do this in a followup patch, but
in the interest of keeping the patches as bite-sized as possible,
I've only attempted to move the underlying common decorators first.
A few tests call these directly, so those tests are updated as part
of this patch.

llvm-svn: 259807

8 years agoCorrectly handle {Always,Never}StepIntoLine
David Majnemer [Thu, 4 Feb 2016 17:57:12 +0000 (17:57 +0000)]
Correctly handle {Always,Never}StepIntoLine

llvm-svn: 259806

8 years agoAdd support for S_DEFRANGE and S_DEFRANGE_SUBFIELD
David Majnemer [Thu, 4 Feb 2016 17:37:30 +0000 (17:37 +0000)]
Add support for S_DEFRANGE and S_DEFRANGE_SUBFIELD

llvm-svn: 259805

8 years agoMake the dumper's output for variable ranges easier to read
David Majnemer [Thu, 4 Feb 2016 17:29:13 +0000 (17:29 +0000)]
Make the dumper's output for variable ranges easier to read

llvm-svn: 259804

8 years agouse 'auto' for iterators; NFCI
Sanjay Patel [Thu, 4 Feb 2016 17:00:35 +0000 (17:00 +0000)]
use 'auto' for iterators; NFCI

llvm-svn: 259802

8 years ago[AArch64] Multiply extended 32-bit ints with `[U|S]MADDL'
Silviu Baranga [Thu, 4 Feb 2016 16:47:09 +0000 (16:47 +0000)]
[AArch64] Multiply extended 32-bit ints with `[U|S]MADDL'

During instruction selection, the AArch64 backend can recognise the
following pattern and generate an [U|S]MADDL instruction, i.e. a
multiply of two 32-bit operands with a 64-bit result:

(mul (sext i32), (sext i32))
However, when one of the operands is constant, the sign extension
gets folded into the constant in SelectionDAG::getNode(). This means
that the instruction selection sees this:

(mul (sext i32), i64)
...which doesn't match the pattern. Sign-extension and 64-bit
multiply instructions are generated, which are slower than one 32-bit
multiply.

Add a pattern to match this and generate the correct instruction, for
both signed and unsigned multiplies.

Patch by Chris Diamand!

llvm-svn: 259800