platform/upstream/llvm.git
8 years agoUse DefinedSynthetic for _gp* symbols.
Rafael Espindola [Tue, 12 Apr 2016 13:26:51 +0000 (13:26 +0000)]
Use DefinedSynthetic for _gp* symbols.

The test changes to put _gp* in the .got section matches what both bfd
and gold do.

llvm-svn: 266067

8 years agoIntroduce and use MemoryAccess::getPwAff() [NFC]
Johannes Doerfert [Tue, 12 Apr 2016 13:26:45 +0000 (13:26 +0000)]
Introduce and use MemoryAccess::getPwAff() [NFC]

llvm-svn: 266066

8 years agoDo not assume switch modeling optimizes a SCoP
Johannes Doerfert [Tue, 12 Apr 2016 13:25:43 +0000 (13:25 +0000)]
Do not assume switch modeling optimizes a SCoP

llvm-svn: 266065

8 years agoSimplify now that we always have a .got.
Rafael Espindola [Tue, 12 Apr 2016 13:23:27 +0000 (13:23 +0000)]
Simplify now that we always have a .got.

llvm-svn: 266064

8 years agoAlways create a .got on mips.
Rafael Espindola [Tue, 12 Apr 2016 13:21:13 +0000 (13:21 +0000)]
Always create a .got on mips.

The _gp* family of symbols is defined as an offset in .got, and it is
not at all clear what should happen when .got is not defined.

This will allow some simplifications on how these symbols are handled.

llvm-svn: 266063

8 years agoThis reverts commit r266002, r266011 and r266016.
Rafael Espindola [Tue, 12 Apr 2016 12:30:25 +0000 (12:30 +0000)]
This reverts commit r266002, r266011 and r266016.

They broke the msan bot.

Original message:

Add __atomic_* lowering to AtomicExpandPass.

AtomicExpandPass can now lower atomic load, atomic store, atomicrmw,and
cmpxchg instructions to __atomic_* library calls, when the target
doesn't support atomics of a given size.

This is the first step towards moving all atomic lowering from clang
into llvm. When all is done, the behavior of __sync_* builtins,
__atomic_* builtins, and C11 atomics will be unified.

Previously LLVM would pass everything through to the ISelLowering
code. There, unsupported atomic instructions would turn into __sync_*
library calls. Because of that behavior, Clang currently avoids emitting
llvm IR atomic instructions when this would happen, and emits __atomic_*
library functions itself, in the frontend.

This change makes LLVM able to emit __atomic_* libcalls, and thus will
eventually allow clang to depend on LLVM to do the right thing.

It is advantageous to do the new lowering to atomic libcalls in
AtomicExpandPass, before ISel time, because it's important that all
atomic operations for a given size either lower to __atomic_*
libcalls (which may use locks), or native instructions which won't. No
mixing and matching.

At the moment, this code is enabled only for SPARC, as a
demonstration. The next commit will expand support to all of the other
targets.

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

llvm-svn: 266062

8 years agoRevert "[mips] MIPSR6 Compact branch aliases"
Simon Dardis [Tue, 12 Apr 2016 12:22:45 +0000 (12:22 +0000)]
Revert "[mips] MIPSR6 Compact branch aliases"

This reverts commit r266055.

ps4-buildslave2 is highlighting a failure.

llvm-svn: 266061

8 years ago[SystemZ] Use LDE32 instead of LE, when Offset is small.
Jonas Paulsson [Tue, 12 Apr 2016 12:07:23 +0000 (12:07 +0000)]
[SystemZ] Use LDE32 instead of LE, when Offset is small.

On z13, if eliminateFrameIndex() chooses LE (and not LEY), immediately
transform that LE to LDE32 to avoid partial register dependencies.

LEY should be generally preferred for big offsets over an expansion
into LAY + LDE32.

Reviewed by Ulrich Weigand.

llvm-svn: 266060

8 years ago[ELF] Removed redundant llvm-mc call. NFC.
George Rimar [Tue, 12 Apr 2016 12:01:31 +0000 (12:01 +0000)]
[ELF] Removed redundant llvm-mc call. NFC.

llvm-svn: 266059

8 years agoBump up timeout in TestGdbRemoteProcessInfo
Pavel Labath [Tue, 12 Apr 2016 11:59:41 +0000 (11:59 +0000)]
Bump up timeout in TestGdbRemoteProcessInfo

the process info packet is slow, and sometimes it does not arrive on time when run on the android
emulator.

llvm-svn: 266058

8 years agoRemove unused diagnostics. NFC.
Benjamin Kramer [Tue, 12 Apr 2016 11:49:52 +0000 (11:49 +0000)]
Remove unused diagnostics. NFC.

llvm-svn: 266057

8 years ago[OPENMP 4.0] Support for 'linear' clause in 'declare simd' directive.
Alexey Bataev [Tue, 12 Apr 2016 11:02:11 +0000 (11:02 +0000)]
[OPENMP 4.0] Support for 'linear' clause in 'declare simd' directive.

The linear clause declares one or more list items to be private to a SIMD lane and to have a linear relationship with respect to the iteration space of a loop.
'linear' '(' <linear-list> [ ':' <linear-step> ] ')'
When a linear-step expression is specified in a linear clause it must be
either a constant integer expression or an integer-typed parameter that is specified in a uniform clause on the directive.
The special this pointer can be used as if was one of the arguments to the function in any of the linear, aligned, or uniform clauses.

llvm-svn: 266056

8 years ago[mips] MIPSR6 Compact branch aliases
Simon Dardis [Tue, 12 Apr 2016 10:41:53 +0000 (10:41 +0000)]
[mips] MIPSR6 Compact branch aliases

Summary:
Alias 'jic $reg, 0' to 'jrc $reg' and 'jialc $reg, 0' to 'jalrc $reg' like
binutils.

Reviewers: dsanders

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

llvm-svn: 266055

8 years agoSkip a test in TestNamespaceLookup on linux to avoid a crash
Pavel Labath [Tue, 12 Apr 2016 10:06:37 +0000 (10:06 +0000)]
Skip a test in TestNamespaceLookup on linux to avoid a crash

llvm-svn: 266054

8 years agoIntroduce an invalid context for each statement
Johannes Doerfert [Tue, 12 Apr 2016 09:57:34 +0000 (09:57 +0000)]
Introduce an invalid context for each statement

  Collect the error domain contexts (formerly in the ErrorDomainCtxMap)
  for each statement in the new InvalidContext member variable. While
  this commit is basically a [NFC] it is a first step to make hoisting
  sound by allowing a more fine grained record of invalid contexts,
  e.g., here on statement level.

llvm-svn: 266053

8 years ago[OPENMP 4.0] Support for 'aligned' clause in 'declare simd' directive.
Alexey Bataev [Tue, 12 Apr 2016 09:35:56 +0000 (09:35 +0000)]
[OPENMP 4.0] Support for 'aligned' clause in 'declare simd' directive.

The aligned clause declares that the object to which each list item points is aligned to the number of bytes expressed in the optional parameter of the aligned clause.
'aligned' '(' <argument-list> [ ':' <alignment> ] ')'
The optional parameter of the aligned clause, alignment, must be a constant positive integer expression. If no optional parameter is specified, implementation-defined default alignments for SIMD instructions on the target platforms are assumed.
The special this pointer can be used as if was one of the arguments to the function in any of the linear, aligned, or uniform clauses.

llvm-svn: 266052

8 years agoSimplify SCEVAffinator code [NFC]
Johannes Doerfert [Tue, 12 Apr 2016 09:33:47 +0000 (09:33 +0000)]
Simplify SCEVAffinator code [NFC]

llvm-svn: 266051

8 years agoRevert "Restore the lazy initialization of ScriptInterpreterPython, which was lost...
Pavel Labath [Tue, 12 Apr 2016 09:06:08 +0000 (09:06 +0000)]
Revert "Restore the lazy initialization of ScriptInterpreterPython, which was lost as part of the SystemLifetimeManager work"

This change breaks python unit tests.

This reverts commit 266033.

llvm-svn: 266050

8 years agoAvoid GCC -fpermissive error about llvm::Mangler hidden by member named Mangler
Stephan Bergmann [Tue, 12 Apr 2016 08:23:44 +0000 (08:23 +0000)]
Avoid GCC -fpermissive error about llvm::Mangler hidden by member named Mangler

llvm-svn: 266049

8 years ago[Clang][BuiltIn][avx512] Adding avx512 (shuf,sqrt{ss|sd},rsqrt ) builtin to clang
Michael Zuckerman [Tue, 12 Apr 2016 07:59:39 +0000 (07:59 +0000)]
[Clang][BuiltIn][avx512] Adding avx512 (shuf,sqrt{ss|sd},rsqrt ) builtin to clang

llvm-svn: 266048

8 years agoRefactor the Internalize stage of libLTO in a separate file (NFC)
Mehdi Amini [Tue, 12 Apr 2016 06:34:10 +0000 (06:34 +0000)]
Refactor the Internalize stage of libLTO in a separate file (NFC)

This is intended to be shared by the ThinLTOCodeGenerator.

Note that there is a change in the way the verifier is run, previously
it was ran as a Pass on the merged module during internalization.
While now the verifier is called explicitely on the merged module
outside of the internalize "pass pipeline".

What remains strange in the API is the fact that `DisableVerify` in
the API does not disable this initial verifier.

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266047

8 years agoUse StringSet instead of StringMap where it makes sense to in LTOCodeGenerator (NFC)
Mehdi Amini [Tue, 12 Apr 2016 06:33:44 +0000 (06:33 +0000)]
Use StringSet instead of StringMap where it makes sense to in LTOCodeGenerator (NFC)

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266046

8 years agoMinor code cleanup. NFC.
Junmo Park [Tue, 12 Apr 2016 06:02:11 +0000 (06:02 +0000)]
Minor code cleanup. NFC.

llvm-svn: 266045

8 years ago[clang-tidy] fix readability-avoid-const-params-in-decls creating invalid code in...
Matthias Gehre [Tue, 12 Apr 2016 05:45:13 +0000 (05:45 +0000)]
[clang-tidy] fix readability-avoid-const-params-in-decls creating invalid code in fix-its

Summary:
The Fix-Its for the added test cases were before:
-void F11(const unsigned int /*version*/);
+void F11(unsigned int int /*version*/);

-void F12(const bool b = true);
+void F12(_Bool true);

Reviewers: fowles, hokein, sbenza, alexfh

Subscribers: cfe-commits

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

llvm-svn: 266044

8 years ago[ASTMatchers]: fix crash in hasReturnValue
Matthias Gehre [Tue, 12 Apr 2016 05:43:18 +0000 (05:43 +0000)]
[ASTMatchers]: fix crash in hasReturnValue

Summary:
The crash was reproduced by the included test case. It was initially
found through a crash of clang-tidy's misc-misplaced-widening-cast
check.

Reviewers: klimek, alexfh

Subscribers: cfe-commits, klimek

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

llvm-svn: 266043

8 years agoProcess: fix the build with certain kernel versions
Saleem Abdulrasool [Tue, 12 Apr 2016 05:40:51 +0000 (05:40 +0000)]
Process: fix the build with certain kernel versions

The structure definitions are not provided, but we perform a sizeof operation of
them which causes a build failure.  Include `asm/ptrace.h` to get the structure
definitions.

llvm-svn: 266042

8 years ago[OPENMP 4.0] Support for 'uniform' clause in 'declare simd' directive.
Alexey Bataev [Tue, 12 Apr 2016 05:28:34 +0000 (05:28 +0000)]
[OPENMP 4.0] Support for 'uniform' clause in 'declare simd' directive.

OpenMP 4.0 defines clause 'uniform' in 'declare simd' directive:
'uniform' '(' <argument-list> ')'
The uniform clause declares one or more arguments to have an invariant value for all concurrent invocations of the function in the execution of a single SIMD loop.
The special this pointer can be used as if was one of the arguments to the function in any of the linear, aligned, or uniform clauses.

llvm-svn: 266041

8 years ago[PPC64] Mark CR0 Live if PPCInstrInfo::optimizeCompareInstr Creates a Use of CR0
Chuang-Yu Cheng [Tue, 12 Apr 2016 03:10:52 +0000 (03:10 +0000)]
[PPC64] Mark CR0 Live if PPCInstrInfo::optimizeCompareInstr Creates a Use of CR0

Resolve Bug 27046 (https://llvm.org/bugs/show_bug.cgi?id=27046).
The PPCInstrInfo::optimizeCompareInstr function could create a new use of
CR0, even if CR0 were previously dead. This patch marks CR0 live if a use of
CR0 is created.

Author: Tom Jablin (tjablin)
Reviewers: hfinkel kbarton cycheng

http://reviews.llvm.org/D18884

llvm-svn: 266040

8 years agoBasic: fix profiling with GNU EABI
Saleem Abdulrasool [Tue, 12 Apr 2016 03:05:03 +0000 (03:05 +0000)]
Basic: fix profiling with GNU EABI

The GNU profiling support indicates that the interface is `_mcount` rather than
`mcount`.  Conditionalise the behaviour according to the `-meabi gnu` flag.

Resolves PR27311

llvm-svn: 266039

8 years ago[PPC64] Use mfocrf in prologue when we only need to save 1 nonvolatile CR field
Chuang-Yu Cheng [Tue, 12 Apr 2016 03:04:44 +0000 (03:04 +0000)]
[PPC64] Use mfocrf in prologue when we only need to save 1 nonvolatile CR field

In the ELFv2 ABI, we are not required to save all CR fields. If only one
nonvolatile CR field is clobbered, use mfocrf instead of mfcr to
selectively save the field, because mfocrf has short latency compares to
mfcr.

Thanks Nemanja's invaluable hint!
Reviewers: nemanjai tjablin hfinkel kbarton

http://reviews.llvm.org/D17749

llvm-svn: 266038

8 years agoDevide _gp in the same spot as other mips symbols. NFC.
Rafael Espindola [Tue, 12 Apr 2016 02:24:43 +0000 (02:24 +0000)]
Devide _gp in the same spot as other mips symbols. NFC.

The test changes are just because of the symbol order.

llvm-svn: 266037

8 years agoTargetLowering: Add missing doxygen group end.
Matthias Braun [Tue, 12 Apr 2016 02:16:15 +0000 (02:16 +0000)]
TargetLowering: Add missing doxygen group end.

The missing end was also confusing the '{', '}' matching heuristics in
vim.

llvm-svn: 266036

8 years agoAArch64: Drive-by cleanup
Matthias Braun [Tue, 12 Apr 2016 02:16:13 +0000 (02:16 +0000)]
AArch64: Drive-by cleanup

llvm-svn: 266035

8 years agoAttempt to make buildbot happier with r266032.
George Burgess IV [Tue, 12 Apr 2016 01:44:13 +0000 (01:44 +0000)]
Attempt to make buildbot happier with r266032.

Apparently std::numeric_limits<unsigned>::max() isn't constexpr
everywhere yet.

llvm-svn: 266034

8 years agoRestore the lazy initialization of ScriptInterpreterPython, which was lost as part...
Enrico Granata [Tue, 12 Apr 2016 01:08:35 +0000 (01:08 +0000)]
Restore the lazy initialization of ScriptInterpreterPython, which was lost as part of the SystemLifetimeManager work

llvm-svn: 266033

8 years agoAdd the allocsize attribute to LLVM.
George Burgess IV [Tue, 12 Apr 2016 01:05:35 +0000 (01:05 +0000)]
Add the allocsize attribute to LLVM.

`allocsize` is a function attribute that allows users to request that
LLVM treat arbitrary functions as allocation functions.

This patch makes LLVM accept the `allocsize` attribute, and makes
`@llvm.objectsize` recognize said attribute.

The review for this was split into two patches for ease of reviewing:
D18974 and D14933. As promised on the revisions, I'm landing both
patches as a single commit.

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

llvm-svn: 266032

8 years ago[analyzer] Fix assertion in ReturnVisitor for body-farm synthesized getters
Devin Coughlin [Tue, 12 Apr 2016 00:53:26 +0000 (00:53 +0000)]
[analyzer] Fix assertion in ReturnVisitor for body-farm synthesized getters
Don't emit a path note marking the return site if the return statement does not
have a valid location. This fixes an assertion failure I introduced in r265839.

llvm-svn: 266031

8 years ago[AArch64] Add test cases for the repairing of physical registers.
Quentin Colombet [Tue, 12 Apr 2016 00:43:40 +0000 (00:43 +0000)]
[AArch64] Add test cases for the repairing of physical registers.

llvm-svn: 266030

8 years ago[RegBankSelect] Teach the repairing code how to handle physical
Quentin Colombet [Tue, 12 Apr 2016 00:38:51 +0000 (00:38 +0000)]
[RegBankSelect] Teach the repairing code how to handle physical
registers.

llvm-svn: 266029

8 years ago[AArch64] Add a test case for the propagation of register banks through
Quentin Colombet [Tue, 12 Apr 2016 00:32:55 +0000 (00:32 +0000)]
[AArch64] Add a test case for the propagation of register banks through
phis.

llvm-svn: 266028

8 years ago[RegisterBankInfo] Do not provide a default mapping for non-reg of phi
Quentin Colombet [Tue, 12 Apr 2016 00:30:14 +0000 (00:30 +0000)]
[RegisterBankInfo] Do not provide a default mapping for non-reg of phi
operations.

llvm-svn: 266027

8 years ago[AArch64] Add a test case for the repairing of definitions.
Quentin Colombet [Tue, 12 Apr 2016 00:25:22 +0000 (00:25 +0000)]
[AArch64] Add a test case for the repairing of definitions.

llvm-svn: 266026

8 years ago[RegBankSelect] Teach how to repair definitions.
Quentin Colombet [Tue, 12 Apr 2016 00:12:59 +0000 (00:12 +0000)]
[RegBankSelect] Teach how to repair definitions.

Although repairing definitions is not mandatory for correctness (only
phis would be impacted because of the RPO traversal), not repairing
might go against the cost model. Therefore, just repair when it is
possible.

llvm-svn: 266025

8 years ago[MachineIRBuilder] Expose the insertion point in the public API.
Quentin Colombet [Tue, 12 Apr 2016 00:07:14 +0000 (00:07 +0000)]
[MachineIRBuilder] Expose the insertion point in the public API.

It may be convenient to know where we are about to insert some code, for
instance to save and then restore this insertion.

llvm-svn: 266024

8 years agoFixed Variable::GetDecl() and Variable::GetDeclContext() to check the "Type *" before...
Greg Clayton [Tue, 12 Apr 2016 00:06:27 +0000 (00:06 +0000)]
Fixed Variable::GetDecl() and Variable::GetDeclContext() to check the "Type *" before using it so we don't crash if a variable's type can't be realized which happens more often recently due to -gmodules.

<rdar://problem/25612626>

llvm-svn: 266023

8 years agoMergeFunctions: test alloca better
JF Bastien [Tue, 12 Apr 2016 00:03:26 +0000 (00:03 +0000)]
MergeFunctions: test alloca better

r237193 fix handling of alloca size / align in MergeFunctions, but only tested one and didn't follow FunctionComparator::cmpOperations's usual comparison pattern. It also didn't update Instruction.cpp:haveSameSpecialState which I'll do separately.

llvm-svn: 266022

8 years ago[AArch64] Test that RegBankSelect inserts the proper copies to fix the
Quentin Colombet [Tue, 12 Apr 2016 00:00:42 +0000 (00:00 +0000)]
[AArch64] Test that RegBankSelect inserts the proper copies to fix the
register bank assignments.

llvm-svn: 266021

8 years agoReplace MachineRegisterInfo::TracksLiveness with a MachineFunctionProperty
Derek Schuff [Mon, 11 Apr 2016 23:32:13 +0000 (23:32 +0000)]
Replace MachineRegisterInfo::TracksLiveness with a MachineFunctionProperty

Use the MachineFunctionProperty mechanism to indicate whether the
liveness info is accurate instead of a bool flag on MRI.
Keeps the MRI accessor function for convenience. NFC

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

llvm-svn: 266020

8 years agoAdd a missing DICompileUnit to testcase.
Adrian Prantl [Mon, 11 Apr 2016 23:30:29 +0000 (23:30 +0000)]
Add a missing DICompileUnit to testcase.

llvm-svn: 266019

8 years agoThinLTO renaming: use module hash instead of position in the summary
Mehdi Amini [Mon, 11 Apr 2016 23:26:46 +0000 (23:26 +0000)]
ThinLTO renaming: use module hash instead of position in the summary

This is more robust to changes in the link ordering.

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266018

8 years agoLegalize the debug info in this testcase in anticipation of future Verifier improvements.
Adrian Prantl [Mon, 11 Apr 2016 23:26:31 +0000 (23:26 +0000)]
Legalize the debug info in this testcase in anticipation of future Verifier improvements.

llvm-svn: 266017

8 years agoAtomicExpandPass: mark assert variable as used
JF Bastien [Mon, 11 Apr 2016 23:03:54 +0000 (23:03 +0000)]
AtomicExpandPass: mark assert variable as used

Avoid -Wunused-variable

llvm-svn: 266016

8 years agoFix compile with GCC after r266002 (Add __atomic_* lowering to AtomicExpandPass)
James Y Knight [Mon, 11 Apr 2016 22:52:42 +0000 (22:52 +0000)]
Fix compile with GCC after r266002 (Add __atomic_* lowering to AtomicExpandPass)

It doesn't like implicitly calling the ArrayRef constructor with a
returned array -- it appears to decays the returned value to a pointer,
first, before trying to make an ArrayRef out of it.

llvm-svn: 266011

8 years ago[LTO] Switch Module to std::unique_ptr<>.
Davide Italiano [Mon, 11 Apr 2016 22:39:51 +0000 (22:39 +0000)]
[LTO] Switch Module to std::unique_ptr<>.

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

llvm-svn: 266009

8 years agoCodeGen: Fix a use-after-free in TailDuplication
Justin Bogner [Mon, 11 Apr 2016 22:37:13 +0000 (22:37 +0000)]
CodeGen: Fix a use-after-free in TailDuplication

The call to processPHI already erased MI from its parent, so MI isn't
even valid here, making the getParent() call a use-after-free in
addition to being redundant.

Found by ASan with the ArrayRecycler changes in llvm.org/pr26808.

llvm-svn: 266008

8 years agoNFC: keep comment up to date
JF Bastien [Mon, 11 Apr 2016 22:30:37 +0000 (22:30 +0000)]
NFC: keep comment up to date

MergeFunctions was refactored a while ago, and Instruction.cpp's comments went out of sync. The content did as well, will fix later.

llvm-svn: 266007

8 years ago[safestack] A test for stackprotector canaries.
Evgeniy Stepanov [Mon, 11 Apr 2016 22:28:13 +0000 (22:28 +0000)]
[safestack] A test for stackprotector canaries.

llvm-svn: 266006

8 years agoAllow simultaneous safestack and stackprotector attributes.
Evgeniy Stepanov [Mon, 11 Apr 2016 22:27:55 +0000 (22:27 +0000)]
Allow simultaneous safestack and stackprotector attributes.

This is the clang part of http://reviews.llvm.org/D18846.
SafeStack instrumentation pass adds stack protector canaries if both
attributes are present on a function. StackProtector pass will step
back if the function has a safestack attribute.

llvm-svn: 266005

8 years ago[safestack] Add canary to unsafe stack frames
Evgeniy Stepanov [Mon, 11 Apr 2016 22:27:48 +0000 (22:27 +0000)]
[safestack] Add canary to unsafe stack frames

Add StackProtector to SafeStack. This adds limited protection against
data corruption in the caller frame. Current implementation treats
all stack protector levels as -fstack-protector-all.

llvm-svn: 266004

8 years agoARM: use r7 as the frame-pointer on all MachO targets.
Tim Northover [Mon, 11 Apr 2016 22:27:40 +0000 (22:27 +0000)]
ARM: use r7 as the frame-pointer on all MachO targets.

This is better for a few reasons:
  + It matches the other tooling for iOS.
  + It matches EABI in more cases (i.e. Thumb-mode, and in practice we don't
    use ARM mode).
  + It leads to infinitesimally smaller code (0.2%, yay!).

rdar://25369506

llvm-svn: 266003

8 years agoAdd __atomic_* lowering to AtomicExpandPass.
James Y Knight [Mon, 11 Apr 2016 22:22:33 +0000 (22:22 +0000)]
Add __atomic_* lowering to AtomicExpandPass.

AtomicExpandPass can now lower atomic load, atomic store, atomicrmw, and
cmpxchg instructions to __atomic_* library calls, when the target
doesn't support atomics of a given size.

This is the first step towards moving all atomic lowering from clang
into llvm. When all is done, the behavior of __sync_* builtins,
__atomic_* builtins, and C11 atomics will be unified.

Previously LLVM would pass everything through to the ISelLowering
code. There, unsupported atomic instructions would turn into __sync_*
library calls. Because of that behavior, Clang currently avoids emitting
llvm IR atomic instructions when this would happen, and emits __atomic_*
library functions itself, in the frontend.

This change makes LLVM able to emit __atomic_* libcalls, and thus will
eventually allow clang to depend on LLVM to do the right thing.

It is advantageous to do the new lowering to atomic libcalls in
AtomicExpandPass, before ISel time, because it's important that all
atomic operations for a given size either lower to __atomic_*
libcalls (which may use locks), or native instructions which won't. No
mixing and matching.

At the moment, this code is enabled only for SPARC, as a
demonstration. The next commit will expand support to all of the other
targets.

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

llvm-svn: 266002

8 years agoAdd support for resolving dynamic types of extended ObjC tagged pointers
Enrico Granata [Mon, 11 Apr 2016 21:50:35 +0000 (21:50 +0000)]
Add support for resolving dynamic types of extended ObjC tagged pointers

rdar://problem/24401051

llvm-svn: 266001

8 years agoswifterror: fix up a testing case.
Manman Ren [Mon, 11 Apr 2016 21:45:33 +0000 (21:45 +0000)]
swifterror: fix up a testing case.

llvm-svn: 266000

8 years ago[DebugInfo/Test] Add CU as required.
Davide Italiano [Mon, 11 Apr 2016 21:16:48 +0000 (21:16 +0000)]
[DebugInfo/Test] Add CU as required.

llvm-svn: 265999

8 years ago[DAGCombiner] Fold xor/and/or (bitcast(A), bitcast(B)) -> bitcast(op (A,B)) anytime...
Simon Pilgrim [Mon, 11 Apr 2016 21:10:33 +0000 (21:10 +0000)]
[DAGCombiner] Fold xor/and/or (bitcast(A), bitcast(B)) -> bitcast(op (A,B)) anytime before LegalizeVectorOprs

xor/and/or (bitcast(A), bitcast(B)) -> bitcast(op (A,B)) was only being combined at the AfterLegalizeTypes stage, this patch permits the combine to occur anytime before then as well.

The main aim with this to improve the ability to recognise bitmasks that can be converted to shuffles.

I had to modify a number of AVX512 mask tests as the basic bitcast to/from scalar pattern was being stripped out, preventing testing of the mmask bitops. By replacing the bitcasts with loads we can get almost the same result.

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

llvm-svn: 265998

8 years agoSwift Calling Convention: swifterror target support.
Manman Ren [Mon, 11 Apr 2016 21:08:06 +0000 (21:08 +0000)]
Swift Calling Convention: swifterror target support.

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

llvm-svn: 265997

8 years agoRevert accidentally committed change
Adrian Prantl [Mon, 11 Apr 2016 21:00:26 +0000 (21:00 +0000)]
Revert accidentally committed change

llvm-svn: 265996

8 years agoAdd missing DICompileUnit to this testcase
Adrian Prantl [Mon, 11 Apr 2016 20:58:57 +0000 (20:58 +0000)]
Add missing DICompileUnit to this testcase

llvm-svn: 265995

8 years agolibclang: fix two memory leaks (PR26292)
Hans Wennborg [Mon, 11 Apr 2016 20:53:59 +0000 (20:53 +0000)]
libclang: fix two memory leaks (PR26292)

llvm-svn: 265994

8 years agoFix some display bugs in llvm-pdbdump.
Zachary Turner [Mon, 11 Apr 2016 20:39:17 +0000 (20:39 +0000)]
Fix some display bugs in llvm-pdbdump.

We were incorrectly reporting all non-64 bit integers as int64s.
This is most evident when trying to print the "short" type, but
in theory could happen with chars too (although usually chars use
a different builtin type).

Additionally, we were using the wrong check when deciding whether
to print an enum definition as a global enum.  We were checking
whether or not the enum was "nested", and if so saving it until
we print the class definition that it was nested in.  But this is
not correct in rare situations where the enum is nested, but the
class that it's nested in does not have type information in the PDB.
So instead we check if there is a class definition for the parent
in the PDB.  If so we save it for later, otherwise we print it.

llvm-svn: 265993

8 years agoRevert "AMDGPU/SI: Do not generate s_waitcnt after ds_permute/ds_bpermute"
Tom Stellard [Mon, 11 Apr 2016 20:38:40 +0000 (20:38 +0000)]
Revert "AMDGPU/SI: Do not generate s_waitcnt after ds_permute/ds_bpermute"

This reverts commit r263720.

Just confirmed that s_waitcnt is required after ds_permute/ds_bpermute.

llvm-svn: 265992

8 years agoAdjust tests to have consistent integer sizes.
Richard Trieu [Mon, 11 Apr 2016 20:37:04 +0000 (20:37 +0000)]
Adjust tests to have consistent integer sizes.

Add a triple to the run lines so that integers will the same sizes across runs.
Also add a compile time check to ensure the assumptions about sizes are met.

llvm-svn: 265991

8 years agoFix repeated conditional expression (PR20711)
Hans Wennborg [Mon, 11 Apr 2016 20:36:05 +0000 (20:36 +0000)]
Fix repeated conditional expression (PR20711)

llvm-svn: 265990

8 years agoFix broken assert, PR24624
Hans Wennborg [Mon, 11 Apr 2016 20:35:41 +0000 (20:35 +0000)]
Fix broken assert, PR24624

llvm-svn: 265989

8 years agoRemove redundant .c_str(), as suggested by PR25633
Hans Wennborg [Mon, 11 Apr 2016 20:35:17 +0000 (20:35 +0000)]
Remove redundant .c_str(), as suggested by PR25633

llvm-svn: 265988

8 years agoFix a couple of redundant conditional expressions (PR27283, PR28282)
Hans Wennborg [Mon, 11 Apr 2016 20:35:01 +0000 (20:35 +0000)]
Fix a couple of redundant conditional expressions (PR27283, PR28282)

llvm-svn: 265987

8 years agoSimplify handling of mips gp* symbols.
Rafael Espindola [Mon, 11 Apr 2016 20:34:27 +0000 (20:34 +0000)]
Simplify handling of mips gp* symbols.

Give them values instead of computing it during relocation.

llvm-svn: 265986

8 years agouse range-loops; NFCI
Sanjay Patel [Mon, 11 Apr 2016 20:13:44 +0000 (20:13 +0000)]
use range-loops; NFCI

llvm-svn: 265985

8 years agoMCParser: diagnose missing directional labels more clearly.
Tim Northover [Mon, 11 Apr 2016 19:50:46 +0000 (19:50 +0000)]
MCParser: diagnose missing directional labels more clearly.

Before, ELF at least managed a diagnostic but it was a completely untraceable
"undefined symbol" error. MachO had a variety of even worse behaviours: crash,
emit corrupt file, or an equally bad message.

llvm-svn: 265984

8 years ago[LoopUtils, LV] Fix PR27246 (first-order recurrences)
Matthew Simpson [Mon, 11 Apr 2016 19:48:18 +0000 (19:48 +0000)]
[LoopUtils, LV] Fix PR27246 (first-order recurrences)

This patch ensures that when we detect first-order recurrences, we reject a phi
node if its previous value is also a phi node. During vectorization the initial
and previous values of the recurrence are shuffled together to create the value
for the current iteration. However, phi nodes are not widened like other
instructions. This fixes PR27246.

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

llvm-svn: 265983

8 years agoLit C++11 Compatibility Patch #6
Charles Li [Mon, 11 Apr 2016 19:30:25 +0000 (19:30 +0000)]
Lit C++11 Compatibility Patch #6

Updated the expected diagnostics of 17 OpenMP tests.
The changes to each test are identical.

llvm-svn: 265982

8 years agoSimplify the creation of __rel[a]_iplt_{start,end}.
Rafael Espindola [Mon, 11 Apr 2016 19:14:59 +0000 (19:14 +0000)]
Simplify the creation of __rel[a]_iplt_{start,end}.

They can be regular DefinedSynthetic.

llvm-svn: 265981

8 years ago[DebugInfo] Fix even more tests to include DICompileunit.
Davide Italiano [Mon, 11 Apr 2016 18:53:27 +0000 (18:53 +0000)]
[DebugInfo] Fix even more tests to include DICompileunit.

llvm-svn: 265980

8 years agoAdd support for additional NSArray formatters
Enrico Granata [Mon, 11 Apr 2016 18:46:37 +0000 (18:46 +0000)]
Add support for additional NSArray formatters

llvm-svn: 265979

8 years agoAdd a formatter for zero-sized NSData
Enrico Granata [Mon, 11 Apr 2016 18:46:26 +0000 (18:46 +0000)]
Add a formatter for zero-sized NSData

llvm-svn: 265978

8 years agoEmit the module hash by default with -flto=thin.
Mehdi Amini [Mon, 11 Apr 2016 18:45:20 +0000 (18:45 +0000)]
Emit the module hash by default with -flto=thin.

Reviewers: tejohnson

Subscribers: joker.eph, cfe-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 265977

8 years agoTest commit.
Sriraman Tallam [Mon, 11 Apr 2016 18:40:50 +0000 (18:40 +0000)]
Test commit.

llvm-svn: 265976

8 years ago[Object] Make .alt_entry directive parsing MachO specific.
Lang Hames [Mon, 11 Apr 2016 18:33:45 +0000 (18:33 +0000)]
[Object] Make .alt_entry directive parsing MachO specific.

ELF and COFF will now treat .alt_entry like any other unrecognized directive.

llvm-svn: 265975

8 years agoFix missing DICompileUnits in testcases
Adrian Prantl [Mon, 11 Apr 2016 18:15:44 +0000 (18:15 +0000)]
Fix missing DICompileUnits in testcases

llvm-svn: 265974

8 years ago[InstCombine] consolidate tests for related bugs
Sanjay Patel [Mon, 11 Apr 2016 17:58:37 +0000 (17:58 +0000)]
[InstCombine] consolidate tests for related bugs

llvm-svn: 265973

8 years agoUse member initializers for all scalar fields of MachineFrameInfo to save boilerplate
Reid Kleckner [Mon, 11 Apr 2016 17:54:16 +0000 (17:54 +0000)]
Use member initializers for all scalar fields of MachineFrameInfo to save boilerplate

No functionality change.

llvm-svn: 265972

8 years agoCombine redundant stack realignment booleans in MachineFrameInfo
Reid Kleckner [Mon, 11 Apr 2016 17:54:03 +0000 (17:54 +0000)]
Combine redundant stack realignment booleans in MachineFrameInfo

MachineFrameInfo does not need to be able to distinguish between the
user asking us not to realign the stack and the target telling us it
doesn't support stack realignment. Either way, fixed stack objects have
their alignment clamped.

llvm-svn: 265971

8 years agoadd FIXME comment; NFC
Sanjay Patel [Mon, 11 Apr 2016 17:35:57 +0000 (17:35 +0000)]
add FIXME comment; NFC

llvm-svn: 265970

8 years agoadd an assert for safety; NFC
Sanjay Patel [Mon, 11 Apr 2016 17:27:44 +0000 (17:27 +0000)]
add an assert for safety; NFC

llvm-svn: 265969

8 years agovariable names start with a capital letter; NFC
Sanjay Patel [Mon, 11 Apr 2016 17:25:23 +0000 (17:25 +0000)]
variable names start with a capital letter; NFC

llvm-svn: 265968

8 years ago[llvm-readobj] Add ELF hash histogram printing
Hemant Kulkarni [Mon, 11 Apr 2016 17:15:30 +0000 (17:15 +0000)]
[llvm-readobj] Add ELF hash histogram printing

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

llvm-svn: 265967

8 years agoAdd code comment/NFC
Xinliang David Li [Mon, 11 Apr 2016 17:13:08 +0000 (17:13 +0000)]
Add code comment/NFC

llvm-svn: 265966

8 years ago[InstCombine] use canEvaluateShiftedShift() to handle the lshr case (NFCI)
Sanjay Patel [Mon, 11 Apr 2016 17:11:55 +0000 (17:11 +0000)]
[InstCombine] use canEvaluateShiftedShift() to handle the lshr case (NFCI)

We need just a couple of logic tweaks to consolidate the shl and lshr cases.

This is step 5 of refactoring to solve PR26760:
https://llvm.org/bugs/show_bug.cgi?id=26760

llvm-svn: 265965

8 years ago[Clang][AVX512][BuiltIn] Adding avx512 ( psll{d|q}512,psllv{16si|8di},psra{d|q}512...
Michael Zuckerman [Mon, 11 Apr 2016 17:04:21 +0000 (17:04 +0000)]
[Clang][AVX512][BuiltIn] Adding avx512 ( psll{d|q}512,psllv{16si|8di},psra{d|q}512,psrav{16si|8di},pternlog{d|q}{128|256|512} ) builtin to clang

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

llvm-svn: 265964

8 years agoUpdate getting started docs
Reid Kleckner [Mon, 11 Apr 2016 17:02:34 +0000 (17:02 +0000)]
Update getting started docs

compiler-rt is optional. We often get email from users with compiler-rt
build errors who don't actually need compiler-rt. Marking it optional
should help them avoid those potential problems.

While I'm here, update a reference to the build directory and remove an
obsolete reference to llvm-gcc. Nobody today is under the impression
that Clang depends on GCC.

llvm-svn: 265963