platform/upstream/llvm.git
7 years agoFunctionComparator: don't rely on argument evaluation order.
Erik Eckstein [Fri, 11 Nov 2016 22:21:39 +0000 (22:21 +0000)]
FunctionComparator: don't rely on argument evaluation order.

This is a follow-up on the recent refactoring of the FunctionMerge pass.
It should fix a fail of the new FunctionComparator unittest whe compiling with MSVC.

llvm-svn: 286648

7 years agoFix static initialization order fiasco in MCTests
Mehdi Amini [Fri, 11 Nov 2016 22:18:42 +0000 (22:18 +0000)]
Fix static initialization order fiasco in MCTests

Reported by Kostya on llvm-dev, uncovered by an ASAN bot

llvm-svn: 286647

7 years ago[ORC] Temporarily fix the RPCUtils unit test by explicitly specifying a handler
Lang Hames [Fri, 11 Nov 2016 22:16:10 +0000 (22:16 +0000)]
[ORC] Temporarily fix the RPCUtils unit test by explicitly specifying a handler
return type.

This should be fixed permanently by having the RPCUtils header recognize the
ErrorSuccess type. I'll commit that in a follow up patch.

llvm-svn: 286646

7 years agoNFC ProgrammersManual fix
Piotr Padlewski [Fri, 11 Nov 2016 22:12:15 +0000 (22:12 +0000)]
NFC ProgrammersManual fix

llvm-svn: 286645

7 years agoSimplify code and address review comments (NFC)
Adrian Prantl [Fri, 11 Nov 2016 22:09:25 +0000 (22:09 +0000)]
Simplify code and address review comments (NFC)

llvm-svn: 286644

7 years agoMake test more strict. NFC.
Rafael Espindola [Fri, 11 Nov 2016 22:07:15 +0000 (22:07 +0000)]
Make test more strict. NFC.

It was non-obvious that a CHECK was not matching the following section.

llvm-svn: 286643

7 years ago[Orc] Update the BuildingAJIT Chapter 5 server class for the recent RPC changes.
Lang Hames [Fri, 11 Nov 2016 21:55:25 +0000 (21:55 +0000)]
[Orc] Update the BuildingAJIT Chapter 5 server class for the recent RPC changes.

llvm-svn: 286642

7 years agoRemove double setting of invalid flag.
Richard Trieu [Fri, 11 Nov 2016 21:50:39 +0000 (21:50 +0000)]
Remove double setting of invalid flag.

In r286630, Decl::setInvalidDecl will automatically set the invalid flag for
BindingDecl for children in invalid DecompositionDecl.  It no longer is
necessary to do a separate setInvalidDecl when finalizing a BindingDecl.

llvm-svn: 286641

7 years agoFix a reference-to-temporary introduced in r286607.
Adrian Prantl [Fri, 11 Nov 2016 21:48:09 +0000 (21:48 +0000)]
Fix a reference-to-temporary introduced in r286607.

llvm-svn: 286640

7 years ago[ORC] Re-apply 286620 with fixes for the ErrorSuccess class.
Lang Hames [Fri, 11 Nov 2016 21:42:09 +0000 (21:42 +0000)]
[ORC] Re-apply 286620 with fixes for the ErrorSuccess class.

llvm-svn: 286639

7 years ago[PowerPC] Add remaining vector permute builtins in altivec.h - LLVM portion
Nemanja Ivanovic [Fri, 11 Nov 2016 21:42:01 +0000 (21:42 +0000)]
[PowerPC] Add remaining vector permute builtins in altivec.h - LLVM portion

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

Adds all the intrinsics used for various permute builtins that will
be added to altivec.h.

llvm-svn: 286638

7 years ago[cfi] Test case for weak symbol handling.
Evgeniy Stepanov [Fri, 11 Nov 2016 21:39:35 +0000 (21:39 +0000)]
[cfi] Test case for weak symbol handling.

llvm-svn: 286637

7 years ago[cfi] Fix weak functions handling.
Evgeniy Stepanov [Fri, 11 Nov 2016 21:39:26 +0000 (21:39 +0000)]
[cfi] Fix weak functions handling.

When a function pointer is replaced with a jumptable pointer, special
case is needed to preserve the semantics of extern_weak functions.
Since a jumptable entry can not be extern_weak, we emulate that
behaviour by replacing all references to F (the extern_weak function)
with the following expression: F != nullptr ? JumpTablePtr : nullptr.

Extra special care is needed for global initializers, since most (or
probably all) backends can not lower an initializer that includes
this kind of constant expression. Initializers like that are replaced
with a global constructor (i.e. a runtime initializer).

llvm-svn: 286636

7 years agoAvoid a crash with -r and .comment.
Rafael Espindola [Fri, 11 Nov 2016 21:36:25 +0000 (21:36 +0000)]
Avoid a crash with -r and .comment.

We would create a MergeInputSection for the synthetic .comment and
crash trying to add it to a regular output section.

With this we just don't add the synthetic section with -r. That is
consistent with gold that doesn't create .note.gnu.gold-version with
-r.

llvm-svn: 286635

7 years agoFix build since llvm r286566 and require at least llvm 4.0
Tom Stellard [Fri, 11 Nov 2016 21:34:47 +0000 (21:34 +0000)]
Fix build since llvm r286566 and require at least llvm 4.0

llvm-svn: 286634

7 years ago[analyzer] Teach RetainCountChecker about VTCompressionSessionEncodeFrame()
Devin Coughlin [Fri, 11 Nov 2016 21:31:38 +0000 (21:31 +0000)]
[analyzer] Teach RetainCountChecker about VTCompressionSessionEncodeFrame()

The context argument passed to VideoToolbox's
VTCompressionSessionEncodeFrame() function is ultimately passed to a callback
supplied when creating the compression session and so may be freed by that
callback.  To suppress false positives in this case, teach the retain count
checker to stop tracking that argument.

This isn't suppressed by the usual callback context mechanism because the call
to VTCompressionSessionEncodeFrame() doesn't include the callback itself.

rdar://problem/27685213

llvm-svn: 286633

7 years agoMake the FunctionComparator of the MergeFunctions pass a stand-alone utility.
Erik Eckstein [Fri, 11 Nov 2016 21:15:13 +0000 (21:15 +0000)]
Make the FunctionComparator of the MergeFunctions pass a stand-alone utility.

This is pure refactoring. NFC.

This change moves the FunctionComparator (together with the GlobalNumberState
utility) in to a separate file so that it can be used by other passes.
For example, the SwiftMergeFunctions pass in the Swift compiler:
https://github.com/apple/swift/blob/master/lib/LLVMPasses/LLVMMergeFunctions.cpp

Details of the change:

*) The big part is just moving code out of MergeFunctions.cpp into FunctionComparator.h/cpp
*) Make FunctionComparator member functions protected (instead of private)
   so that a derived comparator class can use them.

Following refactoring helps to share code between the base FunctionComparator
class and a derived class:

*) Add a beginCompare() function
*) Move some basic function property comparisons into a separate function compareSignature()
*) Do the GEP comparison inside cmpOperations() which now has a new
   needToCmpOperands reference parameter

https://reviews.llvm.org/D25385

llvm-svn: 286632

7 years agoRemove weak-linked symbols for SBBreakpointListImpl
Todd Fiala [Fri, 11 Nov 2016 21:06:40 +0000 (21:06 +0000)]
Remove weak-linked symbols for SBBreakpointListImpl

Summary:
Similar to SBStructuredData's Impl class, SBBreakpointListImpl was
getting weak-link exported in the lldb namespace. This change list fixes
that by moving out of the lldb public namespace, which removes it from
public export visibility.

Fixes:
rdar://28960344

Reviewers: jingham

Subscribers: lldb-commits

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

llvm-svn: 286631

7 years agoWhen a DecompositionDecl is marked invalid, also set the child BindingDecl's to
Richard Trieu [Fri, 11 Nov 2016 20:51:04 +0000 (20:51 +0000)]
When a DecompositionDecl is marked invalid, also set the child BindingDecl's to
invalid.

llvm-svn: 286630

7 years agoFix -Wpessimizing-move warning.
Rui Ueyama [Fri, 11 Nov 2016 20:39:02 +0000 (20:39 +0000)]
Fix -Wpessimizing-move warning.

llvm-svn: 286629

7 years ago[ASTMatchers] Fix a typo in cStyleCastExpr() docs. NFC.
Artem Dergachev [Fri, 11 Nov 2016 20:29:59 +0000 (20:29 +0000)]
[ASTMatchers] Fix a typo in cStyleCastExpr() docs. NFC.

llvm-svn: 286628

7 years ago[PowerPC] Add vector conversion builtins to altivec.h - clang portion
Nemanja Ivanovic [Fri, 11 Nov 2016 19:56:17 +0000 (19:56 +0000)]
[PowerPC] Add vector conversion builtins to altivec.h - clang portion

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

It adds a number of vector type conversion builtins to altivec.h.

llvm-svn: 286627

7 years agoFixed the lost FastMathFlags for FCmp operations in SLPVectorizer.
Vyacheslav Klochkov [Fri, 11 Nov 2016 19:55:29 +0000 (19:55 +0000)]
Fixed the lost FastMathFlags for FCmp operations in SLPVectorizer.
Reviewer: Michael Zolotukhin.
Differential Revision: https://reviews.llvm.org/D26543

llvm-svn: 286626

7 years ago[AArch64] Update a FIXME comment to reflect current state. NFC.
Chad Rosier [Fri, 11 Nov 2016 19:52:45 +0000 (19:52 +0000)]
[AArch64] Update a FIXME comment to reflect current state. NFC.

llvm-svn: 286625

7 years agoBitcode: Change getModuleSummaryIndex() to return an llvm::Expected.
Peter Collingbourne [Fri, 11 Nov 2016 19:50:39 +0000 (19:50 +0000)]
Bitcode: Change getModuleSummaryIndex() to return an llvm::Expected.

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

llvm-svn: 286624

7 years agoBitcode: Clean up error handling for certain bitcode query functions.
Peter Collingbourne [Fri, 11 Nov 2016 19:50:24 +0000 (19:50 +0000)]
Bitcode: Clean up error handling for certain bitcode query functions.

The functions getBitcodeTargetTriple(), isBitcodeContainingObjCCategory(),
getBitcodeProducerString() and hasGlobalValueSummary() now return errors
via their return value rather than via the diagnostic handler.

To make this work, re-implement these functions using non-member functions
so that they can be used without the LLVMContext required by BitcodeReader.

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

llvm-svn: 286623

7 years agoBitcode: Prepare to move bitcode readers to free functions.
Peter Collingbourne [Fri, 11 Nov 2016 19:50:10 +0000 (19:50 +0000)]
Bitcode: Prepare to move bitcode readers to free functions.

Make initStream() a free function, and change BitcodeReaderBase ctor to take
a BitstreamCursor.

llvm-svn: 286622

7 years ago[ORC] Revert r286620 while I investigate a bot failure.
Lang Hames [Fri, 11 Nov 2016 19:46:46 +0000 (19:46 +0000)]
[ORC] Revert r286620 while I investigate a bot failure.

llvm-svn: 286621

7 years ago[ORC] Refactor the ORC RPC utilities to add some new features.
Lang Hames [Fri, 11 Nov 2016 19:42:44 +0000 (19:42 +0000)]
[ORC] Refactor the ORC RPC utilities to add some new features.

(1) Add support for function key negotiation.

The previous version of the RPC required both sides to maintain the same
enumeration for functions in the API. This means that any version skew between
the client and server would result in communication failure.

With this version of the patch functions (and serializable types) are defined
with string names, and the derived function signature strings are used to
negotiate the actual function keys (which are used for efficient call
serialization). This allows clients to connect to any server that supports a
superset of the API (based on the function signatures it supports).

(2) Add a callAsync primitive.

The callAsync primitive can be used to install a return value handler that will
run as soon as the RPC function's return value is sent back from the remote.

(3) Launch policies for RPC function handlers.

The new addHandler method, which installs handlers for RPC functions, takes two
arguments: (1) the handler itself, and (2) an optional "launch policy". When the
RPC function is called, the launch policy (if present) is invoked to actually
launch the handler. This allows the handler to be spawned on a background
thread, or added to a work list. If no launch policy is used, the handler is run
on the server thread itself. This should only be used for short-running
handlers, or entirely synchronous RPC APIs.

(4) Zero cost cross type serialization.

You can now define serialization from any type to a different "wire" type. For
example, this allows you to call an RPC function that's defined to take a
std::string while passing a StringRef argument. If a serializer from StringRef
to std::string has been defined for the channel type this will be used to
serialize the argument without having to construct a std::string instance.

This allows buffer reference types to be used as arguments to RPC calls without
requiring a copy of the buffer to be made.

llvm-svn: 286620

7 years ago[InstCombine] add tests to show size-increasing select transforms
Sanjay Patel [Fri, 11 Nov 2016 19:37:54 +0000 (19:37 +0000)]
[InstCombine] add tests to show size-increasing select transforms

llvm-svn: 286619

7 years agoAdd a test that uses coverage and printf from a DLL
Reid Kleckner [Fri, 11 Nov 2016 19:27:52 +0000 (19:27 +0000)]
Add a test that uses coverage and printf from a DLL

This test fails without LLVM r286615

llvm-svn: 286618

7 years ago[AArch64] Add test to show narrow zero store merging is disabled with strict align...
Chad Rosier [Fri, 11 Nov 2016 19:25:48 +0000 (19:25 +0000)]
[AArch64] Add test to show narrow zero store merging is disabled with strict align. NFC.

llvm-svn: 286617

7 years ago[AArch64] Fix bugs in isel lowering replaceSplatVectorStore.
Geoff Berry [Fri, 11 Nov 2016 19:25:20 +0000 (19:25 +0000)]
[AArch64] Fix bugs in isel lowering replaceSplatVectorStore.

Summary:
Fix off-by-one indexing error in loop checking that inserted value was a
splat vector.

Add code to check that INSERT_VECTOR_ELT nodes constructing the splat
vector have the expected constant index values.

Reviewers: t.p.northover, jmolloy, mcrosier

Subscribers: aemerson, llvm-commits, rengolin

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

llvm-svn: 286616

7 years ago[sancov] Don't instrument MSVC CRT stdio config helpers
Reid Kleckner [Fri, 11 Nov 2016 19:18:45 +0000 (19:18 +0000)]
[sancov] Don't instrument MSVC CRT stdio config helpers

They get called before initialization, which is a problem for winasan.

Test coming in compiler-rt.

llvm-svn: 286615

7 years ago[CMake] Check runtimes subdir when looking for libcxx and libuwind
Petr Hosek [Fri, 11 Nov 2016 19:12:58 +0000 (19:12 +0000)]
[CMake] Check runtimes subdir when looking for libcxx and libuwind

The runtimes subdir is the new location for runtimes, we should
include it when looking for libcxx and libunwind headers.

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

llvm-svn: 286614

7 years ago[cfi] Enable cfi-icall on ARM and AArch64.
Evgeniy Stepanov [Fri, 11 Nov 2016 18:49:49 +0000 (18:49 +0000)]
[cfi] Enable cfi-icall on ARM and AArch64.

llvm-svn: 286613

7 years ago[cfi] Tweak a test for the cfi-icall change.
Evgeniy Stepanov [Fri, 11 Nov 2016 18:49:15 +0000 (18:49 +0000)]
[cfi] Tweak a test for the cfi-icall change.

llvm-svn: 286612

7 years ago[cfi] Implement cfi-icall using inline assembly.
Evgeniy Stepanov [Fri, 11 Nov 2016 18:49:09 +0000 (18:49 +0000)]
[cfi] Implement cfi-icall using inline assembly.

The current implementation is emitting a global constant that happens
to evaluate to the same bytes + relocation as a jump instruction on
X86. This does not work for PIE executables and shared libraries
though, because we end up with a wrong relocation type. And it has no
chance of working on ARM/AArch64 which use different relocation types
for jump instructions (R_ARM_JUMP24) that is never generated for
data.

This change replaces the constant with module-level inline assembly
followed by a hidden declaration of the jump table. Works fine for
ARM/AArch64, but has some drawbacks.
* Extra symbols are added to the static symbol table, which inflate
the size of the unstripped binary a little. Stripped binaries are not
affected. This happens because jump table declarations must be
external (because their body is in the inline asm).
* Original functions that were anonymous are now named
<original name>.cfi, and it affects symbolization sometimes. This is
necessary because the only user of these functions is the (inline
asm) jump table, so they had to be added to @llvm.used, which does
not allow unnamed functions.

llvm-svn: 286611

7 years agoFix comments according to the LLVM coding guidelines.
Adrian Prantl [Fri, 11 Nov 2016 18:22:51 +0000 (18:22 +0000)]
Fix comments according to the LLVM coding guidelines.

llvm-svn: 286610

7 years agoAdd missing %run to test to fix AArch64 buildbot
Reid Kleckner [Fri, 11 Nov 2016 18:11:33 +0000 (18:11 +0000)]
Add missing %run to test to fix AArch64 buildbot

llvm-svn: 286609

7 years ago[asan/win] Fix wrong TerminateProcess exit code
Reid Kleckner [Fri, 11 Nov 2016 17:51:51 +0000 (17:51 +0000)]
[asan/win] Fix wrong TerminateProcess exit code

Add a test for it.

llvm-svn: 286608

7 years agoRevert "Use private linkage for MergedGlobals variables" on Darwin.
Adrian Prantl [Fri, 11 Nov 2016 17:50:09 +0000 (17:50 +0000)]
Revert "Use private linkage for MergedGlobals variables" on Darwin.

This is a partial revert of r244615 (http://reviews.llvm.org/D11942),
which caused a major regression in debug info quality.

Turning the artificial __MergedGlobal symbols into private symbols
(l__MergedGlobal) means that the linker will not include them in the
symbol table of the final executable. Without a symbol table entry
dsymutil is not be able to process the debug info for any of the
merged globals and thus drops the debug info for all of them.

This patch is enabling the old behavior for all MachO targets while
leaving all other targets unaffected.

rdar://problem/29160481
https://reviews.llvm.org/D26531

llvm-svn: 286607

7 years ago[AArch64] Remove lots of redundant code. NFC.
Chad Rosier [Fri, 11 Nov 2016 17:49:34 +0000 (17:49 +0000)]
[AArch64] Remove lots of redundant code. NFC.

llvm-svn: 286606

7 years agoForce the locale when executing ld gold
Sylvestre Ledru [Fri, 11 Nov 2016 17:46:51 +0000 (17:46 +0000)]
Force the locale when executing ld gold

Summary:
If run with other locales (like French),
the decode operation might fail

This is the same change as in r246421 for llvm.

llvm-svn: 286605

7 years ago[InstCombine] fix formatting of FoldOpIntoSelect(); NFCI
Sanjay Patel [Fri, 11 Nov 2016 17:42:16 +0000 (17:42 +0000)]
[InstCombine] fix formatting of FoldOpIntoSelect(); NFCI

llvm-svn: 286604

7 years agoFixed issues found by Paul Robinson with my patch for:
Greg Clayton [Fri, 11 Nov 2016 17:38:14 +0000 (17:38 +0000)]
Fixed issues found by Paul Robinson with my patch for:

https://reviews.llvm.org/D26526

- Fixed DW_FORM_strp to be correctly sized and extracted for DWARF64
- Added some missing strp variants as well
- Fixed comment typo

llvm-svn: 286603

7 years agoAdd a new optimization option -Og
Sylvestre Ledru [Fri, 11 Nov 2016 17:29:56 +0000 (17:29 +0000)]
Add a new optimization option -Og

Summary:
Just like gcc, we should have the -Og option as more and more software are using it:
https://llvm.org/bugs/show_bug.cgi?id=20765

Reviewers: echristo, dberlin, dblaikie, keith.walker.arm, rengolin

Subscribers: aprantl, friss, mehdi_amini, RKSimon, probinson, majnemer, cfe-commits

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

llvm-svn: 286602

7 years ago[AArch64] Early return and minor renaming/refactoring to ease code review. NFC.
Chad Rosier [Fri, 11 Nov 2016 17:07:37 +0000 (17:07 +0000)]
[AArch64] Early return and minor renaming/refactoring to ease code review. NFC.

llvm-svn: 286601

7 years agoFix windows buildbot where warnings are errors. We had a switch statement where all...
Greg Clayton [Fri, 11 Nov 2016 16:55:31 +0000 (16:55 +0000)]
Fix windows buildbot where warnings are errors. We had a switch statement where all enumerations were handled, but some compilers don't recognize this. Simplify the logic so that all compilers will know a return value is returned in all cases.

llvm-svn: 286600

7 years agoFix mismatched enum value name and diagnostic text.
Douglas Katzman [Fri, 11 Nov 2016 16:51:40 +0000 (16:51 +0000)]
Fix mismatched enum value name and diagnostic text.

ExpectedFunctionGlobalVarMethodOrProperty
would previously say "functions and global variables"
instead of "functions, methods, properties, and global variables"

The newly added ExpectedFunctionOrGlobalVariable
says "functions and global variables"

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

llvm-svn: 286599

7 years agoFix code to deal with recent LLVM changes.
Greg Clayton [Fri, 11 Nov 2016 16:23:47 +0000 (16:23 +0000)]
Fix code to deal with recent LLVM changes.

https://reviews.llvm.org/D26526

llvm-svn: 286598

7 years agoClean up DWARFFormValue by reducing duplicated code and removing DWARFFormValue:...
Greg Clayton [Fri, 11 Nov 2016 16:21:37 +0000 (16:21 +0000)]
Clean up DWARFFormValue by reducing duplicated code and removing DWARFFormValue::getFixedFormSizes()

In preparation for a follow on patch that improves DWARF parsing speed, clean up DWARFFormValue so that we have can get the fixed byte size of a form value given a DWARFUnit or given the version, address byte size and dwarf32/64.

This patch cleans up code so that everyone is using one of the new DWARFFormValue functions:

static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, const DWARFUnit *U = nullptr);
static Optional<uint8_t> DWARFFormValue::getFixedByteSize(dwarf::Form Form, uint16_t Version, uint8_t AddrSize, bool Dwarf32);

This patch changes DWARFFormValue::skipValue() to rely on the output of DWARFFormValue::getFixedByteSize(...) instead of duplicating the code in each function. This will reduce the number of changes we need to make to DWARF to fewer places in DWARFFormValue when we add support for new form.

This patch also starts to support DWARF64 so that we can get correct byte sizes for forms that vary according the DWARF 32/64.

To reduce the code duplication a new FormSizeHelper pure virtual class was created that can be created as a FormSizeHelperDWARFUnit when you have a DWARFUnit, or FormSizeHelperManual where you manually specify the DWARF version, address byte size and DWARF32/DWARF64. There is now a single implementation of a function that gets the fixed byte size (instead of two where one took a DWARFUnit and one took the DWARF version, address byte size and DWARFFormat enum) and one function to skip the form values.

https://reviews.llvm.org/D26526

llvm-svn: 286597

7 years ago[PowerPC] Add vector conversion builtins to altivec.h - LLVM portion
Nemanja Ivanovic [Fri, 11 Nov 2016 14:41:19 +0000 (14:41 +0000)]
[PowerPC] Add vector conversion builtins to altivec.h - LLVM portion

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

Adds all the intrinsics used for various conversion builtins that will
be added to altivec.h. These are type conversions between various types of
vectors.

llvm-svn: 286596

7 years ago[X86] Merge (near) duplicate scalar non-temporal store code. NFCI.
Simon Pilgrim [Fri, 11 Nov 2016 14:38:34 +0000 (14:38 +0000)]
[X86] Merge (near) duplicate scalar non-temporal store code. NFCI.

llvm-svn: 286595

7 years agollvm-strings: Fix r286556 to add required libraries.
NAKAMURA Takumi [Fri, 11 Nov 2016 14:17:37 +0000 (14:17 +0000)]
llvm-strings: Fix r286556 to add required libraries.

llvm-svn: 286594

7 years agoFix test/tools/gold/X86/thinlto_funcimport.ll on non-X86 hosts
John Brawn [Fri, 11 Nov 2016 14:12:15 +0000 (14:12 +0000)]
Fix test/tools/gold/X86/thinlto_funcimport.ll on non-X86 hosts

Pass -m elf_x86_64 to gold, as is done in other tests.

llvm-svn: 286593

7 years ago[AArch64] Enable merging of adjacent zero stores for all subtargets.
Chad Rosier [Fri, 11 Nov 2016 14:10:12 +0000 (14:10 +0000)]
[AArch64] Enable merging of adjacent zero stores for all subtargets.

This optimization merges adjacent zero stores into a wider store.

e.g.,

strh wzr, [x0]
strh wzr, [x0, #2]
; becomes
str wzr, [x0]

e.g.,

str wzr, [x0]
str wzr, [x0, #4]
; becomes
str xzr, [x0]

Previously, this was only enabled for Kryo and Cortex-A57.

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

llvm-svn: 286592

7 years ago[AMDGPU] TargetStreamer: Fix .note section name
Sam Kolton [Fri, 11 Nov 2016 13:41:52 +0000 (13:41 +0000)]
[AMDGPU] TargetStreamer: Fix .note section name

llvm-svn: 286591

7 years ago[ELF] Attempt to fix PPC buildbot
Eugene Leviant [Fri, 11 Nov 2016 13:24:49 +0000 (13:24 +0000)]
[ELF] Attempt to fix PPC buildbot

llvm-svn: 286590

7 years ago[ELF] - Use backward slashes inside response files
George Rimar [Fri, 11 Nov 2016 13:23:13 +0000 (13:23 +0000)]
[ELF] - Use backward slashes inside response files

Patch replaces forward slashes with backward inside response.txt

This is https://llvm.org/bugs/show_bug.cgi?id=30951.

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

llvm-svn: 286589

7 years ago[ELF] Set 'Live = true' in SyntheticSection ctor. NFC.
Eugene Leviant [Fri, 11 Nov 2016 13:03:58 +0000 (13:03 +0000)]
[ELF] Set 'Live = true' in SyntheticSection ctor. NFC.

llvm-svn: 286588

7 years ago[SystemZ] Support CL(G)T instructions
Ulrich Weigand [Fri, 11 Nov 2016 12:48:26 +0000 (12:48 +0000)]
[SystemZ] Support CL(G)T instructions

This adds support for the compare logical and trap (memory)
instructions that were added as part of the miscellaneous
instruction extensions feature with zEC12.

llvm-svn: 286587

7 years ago[SystemZ] Support load-and-zero-rightmost-byte facility
Ulrich Weigand [Fri, 11 Nov 2016 12:46:28 +0000 (12:46 +0000)]
[SystemZ] Support load-and-zero-rightmost-byte facility

This adds support for the LZRF/LZRG/LLZRGF instructions that were
added on z13, and uses them for code generation were appropriate.

SystemZDAGToDAGISel::tryRISBGZero is updated again to prefer LLZRGF
over RISBG where both would be possible.

llvm-svn: 286586

7 years ago[SystemZ] Use LLGT(R) instructions
Ulrich Weigand [Fri, 11 Nov 2016 12:43:51 +0000 (12:43 +0000)]
[SystemZ] Use LLGT(R) instructions

This adds support for the 31-to-64-bit zero extension instructions
LLGT and LLGTR and uses them for code generation where appropriate.

Since this operation can also be performed via RISBG, we have to
update SystemZDAGToDAGISel::tryRISBGZero so that we prefer LLGT
over RISBG in case both are possible.  The patch includes some
simplification to the tryRISBGZero code; this is not intended
to cause any (further) functional change in codegen.

llvm-svn: 286585

7 years agoFix for PR28523: unexpected compilation error.
Alexey Bataev [Fri, 11 Nov 2016 12:36:20 +0000 (12:36 +0000)]
Fix for PR28523: unexpected compilation error.

Clang emits error message for the following code:
```
template <class F> void parallel_loop(F &&f) { f(0); }

int main() {
  int x;
  parallel_loop([&](auto y) {
    {
      x = y;
    };
  });
}
```

$ clang++ --std=gnu++14 clang_test.cc -o clang_test
clang_test.cc:9:7: error: reference to local variable 'x' declared in enclosing function 'main'
      x = y;
            ^
clang_test.cc:2:48: note: in instantiation of function template specialization 'main()::(anonymous class)::operator()<int>' requested here
            template <class F> void parallel_loop(F &&f) { f(0); }
                                                           ^
clang_test.cc:6:3: note: in instantiation of function template specialization 'parallel_loop<(lambda at clang_test.cc:6:17)>' requested here parallel_loop([&](auto y) {
           ^
clang_test.cc:5:7: note: 'x' declared here
      int x;
          ^
1 error generated.

Patch fixes this issue.

llvm-svn: 286584

7 years ago[MSAN][MIPS] Fix test Linux/syscalls_sigaction.cc on mips64
Sagar Thakur [Fri, 11 Nov 2016 12:05:30 +0000 (12:05 +0000)]
[MSAN][MIPS] Fix test Linux/syscalls_sigaction.cc on mips64

Changed the kernel sigaction structure in test syscalls_sigaction.cc for MIPS according to the structure defined in kernel.

Reviewed by eugenis.
Differential: https://reviews.llvm.org/D25814

llvm-svn: 286583

7 years ago[SelectionDAG] Add support for vector demandedelts in BSWAP opcodes
Simon Pilgrim [Fri, 11 Nov 2016 11:51:29 +0000 (11:51 +0000)]
[SelectionDAG] Add support for vector demandedelts in BSWAP opcodes

llvm-svn: 286582

7 years agoFix TestHelp on linux after version number syntax change
Tamas Berghammer [Fri, 11 Nov 2016 11:39:23 +0000 (11:39 +0000)]
Fix TestHelp on linux after version number syntax change

llvm-svn: 286581

7 years ago[ELF] Convert .got section to input section
Eugene Leviant [Fri, 11 Nov 2016 11:33:32 +0000 (11:33 +0000)]
[ELF] Convert .got section to input section

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

llvm-svn: 286580

7 years ago[X86] Add knownbits vector BSWAP test
Simon Pilgrim [Fri, 11 Nov 2016 11:33:21 +0000 (11:33 +0000)]
[X86] Add knownbits vector BSWAP test

In preparation for demandedelts support

llvm-svn: 286579

7 years ago[SelectionDAG] Add support for vector demandedelts in UREM/SREM opcodes
Simon Pilgrim [Fri, 11 Nov 2016 11:23:43 +0000 (11:23 +0000)]
[SelectionDAG] Add support for vector demandedelts in UREM/SREM opcodes

llvm-svn: 286578

7 years ago[X86] Add knownbits vector UREM/SREM tests
Simon Pilgrim [Fri, 11 Nov 2016 11:11:40 +0000 (11:11 +0000)]
[X86] Add knownbits vector UREM/SREM tests

In preparation for demandedelts support

llvm-svn: 286577

7 years ago[SelectionDAG] Add support for vector demandedelts in UDIV opcodes
Simon Pilgrim [Fri, 11 Nov 2016 10:47:24 +0000 (10:47 +0000)]
[SelectionDAG] Add support for vector demandedelts in UDIV opcodes

llvm-svn: 286576

7 years ago[X86] Add knownbits vector UDIV test
Simon Pilgrim [Fri, 11 Nov 2016 10:39:15 +0000 (10:39 +0000)]
[X86] Add knownbits vector UDIV test

In preparation for demandedelts support

llvm-svn: 286575

7 years agoMark xfail TestNamespaceDefinitions for arm/aarch64 targets
Omair Javaid [Fri, 11 Nov 2016 10:00:53 +0000 (10:00 +0000)]
Mark xfail TestNamespaceDefinitions for arm/aarch64 targets

Fails with all versions of arm/aarch64 gcc available on ubuntu 16.04/14.04.

Passes with Linaro GCC version >= 4.8 but fails with >= 5.0. But There are other regressions when we use Linaro GCC.

llvm-svn: 286574

7 years ago[ARM] Add plumbing for GlobalISel
Diana Picus [Fri, 11 Nov 2016 08:27:37 +0000 (08:27 +0000)]
[ARM] Add plumbing for GlobalISel

Add GlobalISel skeleton, up to the point where we can select a ret void.

llvm-svn: 286573

7 years ago[opt-viewer] Make it work in the absence of hotness information
Adam Nemet [Fri, 11 Nov 2016 06:11:56 +0000 (06:11 +0000)]
[opt-viewer] Make it work in the absence of hotness information

In this case the index page is sorted by the source location.

llvm-svn: 286572

7 years agoFix gold plugin after Error API changes
Mehdi Amini [Fri, 11 Nov 2016 06:04:30 +0000 (06:04 +0000)]
Fix gold plugin after Error API changes

llvm-svn: 286571

7 years agoFix examples files to reflect header split in r286566.
Teresa Johnson [Fri, 11 Nov 2016 06:02:04 +0000 (06:02 +0000)]
Fix examples files to reflect header split in r286566.

I missed these files in examples/

llvm-svn: 286570

7 years agoAdd missing file from r286566
Teresa Johnson [Fri, 11 Nov 2016 05:46:30 +0000 (05:46 +0000)]
Add missing file from r286566

Add the new BitcodeWriter.h header, which was missed in my r286566
commit, and should fix all the bot failures.

llvm-svn: 286569

7 years agoMirror the llvm changes that split Bitcode/ReaderWriter.h
Teresa Johnson [Fri, 11 Nov 2016 05:35:22 +0000 (05:35 +0000)]
Mirror the llvm changes that split Bitcode/ReaderWriter.h

The change in D26502 splits ReaderWriter.h, which contains the APIs
into both the BitReader and BitWriter libraries, into BitcodeReader.h
and BitcodeWriter.h.

Change lld uses to the appropriate split header, removing it
completely in one case where it wasn't needed.

llvm-svn: 286568

7 years agoMirror the llvm changes that split Bitcode/ReaderWriter.h
Teresa Johnson [Fri, 11 Nov 2016 05:35:12 +0000 (05:35 +0000)]
Mirror the llvm changes that split Bitcode/ReaderWriter.h

The change in D26502 splits ReaderWriter.h, which contains the APIs
into both the BitReader and BitWriter libraries, into BitcodeReader.h
and BitcodeWriter.h.

Change clang uses to the appropriate split header(s).

llvm-svn: 286567

7 years agoSplit Bitcode/ReaderWriter.h into separate reader and writer headers
Teresa Johnson [Fri, 11 Nov 2016 05:34:58 +0000 (05:34 +0000)]
Split Bitcode/ReaderWriter.h into separate reader and writer headers

Summary:
Split ReaderWriter.h which contains the APIs into both the BitReader and
BitWriter libraries into BitcodeReader.h and BitcodeWriter.h.

This is to address Chandler's concern about sharing the same API header
between multiple libraries (BitReader and BitWriter). That concern is
why we create a single bitcode library in our downstream build of clang,
which led to r286297 being reverted as it added a dependency that
created a cycle only when there is a single bitcode library (not two as
in upstream).

Reviewers: mehdi_amini

Subscribers: dlj, mehdi_amini, llvm-commits

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

llvm-svn: 286566

7 years agoRevert unwanted changes in lldb when updating llvm::Error()
Mehdi Amini [Fri, 11 Nov 2016 05:07:57 +0000 (05:07 +0000)]
Revert unwanted changes in lldb when updating llvm::Error()

My script updated lldb::Errors, and I failed to fix it entirely
before pushing. This restore everything in lldb as it was before
r286561.

llvm-svn: 286565

7 years ago[opt-viewer] PEPify opt-viewer.py
Mandeep Singh Grang [Fri, 11 Nov 2016 04:51:27 +0000 (04:51 +0000)]
[opt-viewer] PEPify opt-viewer.py

Reviewers: anemet

Subscribers: fhahn

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

llvm-svn: 286564

7 years agoFix build failure, update llvm-strings for the new Error API
Mehdi Amini [Fri, 11 Nov 2016 04:50:18 +0000 (04:50 +0000)]
Fix build failure, update llvm-strings for the new Error API

llvm-svn: 286563

7 years agoPrevent at compile time converting from Error::success() to Expected<T>
Mehdi Amini [Fri, 11 Nov 2016 04:29:25 +0000 (04:29 +0000)]
Prevent at compile time converting from Error::success() to Expected<T>

This would trigger an assertion at runtime otherwise.

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

llvm-svn: 286562

7 years agoMake the Error class constructor protected
Mehdi Amini [Fri, 11 Nov 2016 04:28:40 +0000 (04:28 +0000)]
Make the Error class constructor protected

This is forcing to use Error::success(), which is in a wide majority
of cases a lot more readable.

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

llvm-svn: 286561

7 years agoCMake: make LLVM_OPTIMIZED_TABLEGEN friendly with LLVM_EXTERNAL_CLANG_SOURCE_DIR
Mehdi Amini [Fri, 11 Nov 2016 04:27:59 +0000 (04:27 +0000)]
CMake: make LLVM_OPTIMIZED_TABLEGEN friendly with LLVM_EXTERNAL_CLANG_SOURCE_DIR

This is need because of clang-tblgen

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

llvm-svn: 286560

7 years ago[ADT/MathExtras] Make buildbot happy again.
Davide Italiano [Fri, 11 Nov 2016 04:03:29 +0000 (04:03 +0000)]
[ADT/MathExtras] Make buildbot happy again.

llvm-svn: 286559

7 years agollvm-strings: explicitly include cctype
Saleem Abdulrasool [Fri, 11 Nov 2016 04:00:59 +0000 (04:00 +0000)]
llvm-strings: explicitly include cctype

Include the cctype header to try to fix windows bots.

llvm-svn: 286558

7 years agoRemove a member from InputSectionData and use the pool instead.
Rui Ueyama [Fri, 11 Nov 2016 03:54:59 +0000 (03:54 +0000)]
Remove a member from InputSectionData and use the pool instead.

llvm-svn: 286557

7 years agollvm-strings: introduce basic strings tool
Saleem Abdulrasool [Fri, 11 Nov 2016 03:44:12 +0000 (03:44 +0000)]
llvm-strings: introduce basic strings tool

This is a replacement to binutils' string tool.  It prints strings found in a
binary (object file, executable, or archive library).  It is rather bare and
not functionally equivalent, however, it lays the groundwork necessary for the
strings tool, enabling iterative development of features to reach feature
parity.

llvm-svn: 286556

7 years ago[lli] Simplify the code a bit. No functional change intended.
Davide Italiano [Fri, 11 Nov 2016 03:07:45 +0000 (03:07 +0000)]
[lli] Simplify the code a bit. No functional change intended.

llvm-svn: 286555

7 years ago[IR/DataLayout] Simplify the code using PowerOf2Ceil. NFCI.
Davide Italiano [Fri, 11 Nov 2016 03:00:00 +0000 (03:00 +0000)]
[IR/DataLayout] Simplify the code using PowerOf2Ceil. NFCI.

llvm-svn: 286554

7 years ago[lld/COFF] Don't round alignment if it's already a power-of-two.
Davide Italiano [Fri, 11 Nov 2016 02:53:48 +0000 (02:53 +0000)]
[lld/COFF] Don't round alignment if it's already a power-of-two.

This matches link.exe behaviour.

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

llvm-svn: 286553

7 years agoAMDGPU: Attempt to fix build failure on x86-64 selfhost build
Yaxun Liu [Fri, 11 Nov 2016 02:48:50 +0000 (02:48 +0000)]
AMDGPU: Attempt to fix build failure on x86-64 selfhost build

Remove redundant include file.

llvm-svn: 286552

7 years ago[ADT/MathExtras] Add tests for PowerOf2Floor (previously untested).
Davide Italiano [Fri, 11 Nov 2016 02:38:24 +0000 (02:38 +0000)]
[ADT/MathExtras] Add tests for PowerOf2Floor (previously untested).

llvm-svn: 286551

7 years agoAdd a blank line for a test commit.
Sean Fertile [Fri, 11 Nov 2016 02:33:17 +0000 (02:33 +0000)]
Add a blank line for a test commit.

llvm-svn: 286550

7 years ago[ADT/MathExtras] Introduce PowerOf2Ceil.
Davide Italiano [Fri, 11 Nov 2016 02:22:16 +0000 (02:22 +0000)]
[ADT/MathExtras] Introduce PowerOf2Ceil.

To be used in lld (and probably somewhere else in llvm).

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

llvm-svn: 286549