platform/upstream/llvm.git
7 years ago[libFuzzer] do not initialize parts of TracePC -- let them be initialized by the...
Kostya Serebryany [Fri, 11 Nov 2016 23:06:53 +0000 (23:06 +0000)]
[libFuzzer] do not initialize parts of TracePC -- let them be initialized by the linker. Add no-msan attribute to the memcmp hook.

llvm-svn: 286665

7 years ago[InstCombine] clean up foldSelectOpOp(); NFC
Sanjay Patel [Fri, 11 Nov 2016 23:01:20 +0000 (23:01 +0000)]
[InstCombine] clean up foldSelectOpOp(); NFC

llvm-svn: 286664

7 years ago[tsan][llvm] Implement the function attribute to disable TSan checking at run time
Anna Zaks [Fri, 11 Nov 2016 23:01:02 +0000 (23:01 +0000)]
[tsan][llvm] Implement the function attribute to disable TSan checking at run time

This implements a function annotation that disables TSan checking for the
function at run time. The benefit over attribute((no_sanitize("thread")))
is that the accesses within the callees will also be suppressed.

The motivation for this attribute is a guarantee given by the objective C
language that the calls to the reference count decrement and object
deallocation will be synchronized. To model this properly, we would need
to intercept all ref count decrement calls (which are very common in ObjC
due to use of ARC) and also every single message send. Instead, we propose
to just ignore all accesses made from within dealloc at run time. The main
downside is that this still does not introduce any synchronization, which
means we might still report false positives if the code that relies on this
synchronization is not executed from within dealloc. However, we have not seen
this in practice so far and think these cases will be very rare.

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

llvm-svn: 286663

7 years ago[LV] Stop saying "use -Rpass-analysis=loop-vectorize"
Adam Nemet [Fri, 11 Nov 2016 22:51:46 +0000 (22:51 +0000)]
[LV] Stop saying "use -Rpass-analysis=loop-vectorize"

This is PR28376.

Unfortunately given the current structure of optimization diagnostics we
lack the capability to tell whether the user has
passed -Rpass-analysis=loop-vectorize since this is local to the
front-end (BackendConsumer::OptimizationRemarkHandler).

So rather than printing this even if the user has already
passed -Rpass-analysis, this patch just punts and stops recommending
this option.  I don't think that getting this right is worth the
complexity.

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

llvm-svn: 286662

7 years ago[RPC] Add const qualifier to MemberFnWrapper to make buildbots happy.
Lang Hames [Fri, 11 Nov 2016 22:50:16 +0000 (22:50 +0000)]
[RPC] Add const qualifier to MemberFnWrapper to make buildbots happy.

This is a temporary fix: The right solution is to make sure addHandler can
support mutable lambdas. I'll add that in a follow-up patch.

llvm-svn: 286661

7 years ago[cxx_status] Prepare features list for WG21 motions.
Richard Smith [Fri, 11 Nov 2016 22:48:43 +0000 (22:48 +0000)]
[cxx_status] Prepare features list for WG21 motions.

llvm-svn: 286660

7 years agoDon't sort sections in -r links.
Rafael Espindola [Fri, 11 Nov 2016 22:43:27 +0000 (22:43 +0000)]
Don't sort sections in -r links.

Unlike gold, bfd, gas or MC we were putting exidx sections first since
they are ro.

The spec doesn't explicitly say that they must come after, but it is
definitely more convenient for the consumer, matches other producers
and matches other areas in ELF (like SHT_GROUP) where sections are
ordered in a natural way.

llvm-svn: 286659

7 years ago[tsan] Expose __tsan_ignore_thread_begin and __tsan_ignore_thread_end in TSan interface
Anna Zaks [Fri, 11 Nov 2016 22:43:12 +0000 (22:43 +0000)]
[tsan] Expose __tsan_ignore_thread_begin and __tsan_ignore_thread_end in TSan interface

This patch is needed to implement the function attribute that disable TSan checking at run time.

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

llvm-svn: 286658

7 years agoFix typo in comment.
Rui Ueyama [Fri, 11 Nov 2016 22:41:47 +0000 (22:41 +0000)]
Fix typo in comment.

llvm-svn: 286657

7 years agoRevert "(origin/master, origin/HEAD) MachineScheduler/ScheduleDAG: Add support to...
Matthias Braun [Fri, 11 Nov 2016 22:39:50 +0000 (22:39 +0000)]
Revert "(origin/master, origin/HEAD) MachineScheduler/ScheduleDAG: Add support to skipping a node."

Revert accidentally committed change.

This reverts commit r286655.

llvm-svn: 286656

7 years agoMachineScheduler/ScheduleDAG: Add support to skipping a node.
Matthias Braun [Fri, 11 Nov 2016 22:37:34 +0000 (22:37 +0000)]
MachineScheduler/ScheduleDAG: Add support to skipping a node.

The DAG mutators in the scheduler cannot really remove DAG nodes as
additional anlysis information such as ScheduleDAGToplogicalSort are
already computed at this point and rely on a fixed number of DAG nodes.

Alleviate the missing removal with a new flag: Setting the new skip
flag on a node ignores it during scheduling.

llvm-svn: 286655

7 years agoScheduleDAGInstrs: Move VRegUses to ScheduleDAGMILive; NFCI
Matthias Braun [Fri, 11 Nov 2016 22:37:31 +0000 (22:37 +0000)]
ScheduleDAGInstrs: Move VRegUses to ScheduleDAGMILive; NFCI

Push VRegUses/collectVRegUses() down the class hierarchy towards its
only user ScheduleDAGMILive.

NFCI: The initialization of the map happens at a later point but that
should not matter.

This is in preparation to allow DAG mutators to merge nodes, which
relies on this map getting computed later.

llvm-svn: 286654

7 years agoMachineScheduler: Dump EntrySU/ExitSU if possible
Matthias Braun [Fri, 11 Nov 2016 22:37:28 +0000 (22:37 +0000)]
MachineScheduler: Dump EntrySU/ExitSU if possible

llvm-svn: 286653

7 years agoScheduleDAG: Identify EntrySU/ExitSU when dumping node ids
Matthias Braun [Fri, 11 Nov 2016 22:37:26 +0000 (22:37 +0000)]
ScheduleDAG: Identify EntrySU/ExitSU when dumping node ids

llvm-svn: 286652

7 years ago[ASTMatchers] Fix a typo in cStyleCastExpr() HTML docs as well. NFC.
Artem Dergachev [Fri, 11 Nov 2016 22:34:53 +0000 (22:34 +0000)]
[ASTMatchers] Fix a typo in cStyleCastExpr() HTML docs as well. NFC.

llvm-svn: 286651

7 years ago[PowerPC] Implement remaining permute builtins in altivec.h - Clang portion
Nemanja Ivanovic [Fri, 11 Nov 2016 22:34:44 +0000 (22:34 +0000)]
[PowerPC] Implement remaining permute builtins in altivec.h - Clang portion

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

It adds the remaining vector permute/rotate builtins to altivec.h.

llvm-svn: 286650

7 years agoFix wrong formatting in lld introduced in r286561 (NFC)
Mehdi Amini [Fri, 11 Nov 2016 22:28:19 +0000 (22:28 +0000)]
Fix wrong formatting in lld introduced in r286561 (NFC)

Pointed out by Davide.

llvm-svn: 286649

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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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

8 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