platform/upstream/llvm.git
10 years ago[mips] Access $at only if necessary.
Matheus Almeida [Wed, 18 Jun 2014 14:15:42 +0000 (14:15 +0000)]
[mips] Access $at only if necessary.

Summary:
This patch doesn't really change the logic behind expandMemInst but it allows
us to assemble .S files that use .set noat with some macros. For example:

.set noat
lw $k0, offset($k1)

Can expand to:
lui $k0, %hi(offset)
addu $k0, $k0, $k1
lw $k0, %lo(offset)($k0)

with no need to access $at.

Reviewers: dsanders, vmedic

Reviewed By: dsanders, vmedic

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

llvm-svn: 211165

10 years agoAdd pattern for unsigned v4i32->v4f64 convert on AVX512.
Cameron McInally [Wed, 18 Jun 2014 14:04:37 +0000 (14:04 +0000)]
Add pattern for unsigned v4i32->v4f64 convert on AVX512.

llvm-svn: 211164

10 years ago[mips] Update MipsAsmParser so that it's possible to handle immediates that start...
Matheus Almeida [Wed, 18 Jun 2014 13:55:18 +0000 (13:55 +0000)]
[mips] Update MipsAsmParser so that it's possible to handle immediates that start with the binary operator NOT (~).

Reviewers: dsanders

Reviewed By: dsanders

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

llvm-svn: 211163

10 years ago[msan] Intercept __getdelim.
Evgeniy Stepanov [Wed, 18 Jun 2014 13:35:13 +0000 (13:35 +0000)]
[msan] Intercept __getdelim.

llvm-svn: 211162

10 years ago[mips] Implement alias for 'and' and 'or' instructions for all ISAs.
Matheus Almeida [Wed, 18 Jun 2014 13:30:57 +0000 (13:30 +0000)]
[mips] Implement alias for 'and' and 'or' instructions for all ISAs.

Summary:
Examples:
and $2, 4 <=> andi $2, $2, 4
or $2, 4 <=> ori $2, $2, 4

Reviewers: dsanders

Reviewed By: dsanders

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

llvm-svn: 211161

10 years ago[mips] Remove the last usage of parseRegister from MipsAsmParser.
Matheus Almeida [Wed, 18 Jun 2014 13:08:59 +0000 (13:08 +0000)]
[mips] Remove the last usage of parseRegister from MipsAsmParser.

Summary:
Added negative test case so that we can be sure we handle erroneous situations
while parsing the .cpsetup directive.

Reviewers: dsanders

Reviewed By: dsanders

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

llvm-svn: 211160

10 years agoR600: Implement 64bit SRA
Jan Vesely [Wed, 18 Jun 2014 12:27:17 +0000 (12:27 +0000)]
R600: Implement 64bit SRA

v2: Use capitalized variable name

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 211159

10 years agoR600: Implement 64bit SRL
Jan Vesely [Wed, 18 Jun 2014 12:27:15 +0000 (12:27 +0000)]
R600: Implement 64bit SRL

v2: use C++ style comment

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 211158

10 years agoR600: Implement 64bit SHL
Jan Vesely [Wed, 18 Jun 2014 12:27:13 +0000 (12:27 +0000)]
R600: Implement 64bit SHL

v2: Use c++ style comment

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 211157

10 years ago[msan] Handle X86 *.psad.* and *.pmadd.* intrinsics.
Evgeniy Stepanov [Wed, 18 Jun 2014 12:02:29 +0000 (12:02 +0000)]
[msan] Handle X86 *.psad.* and *.pmadd.* intrinsics.

llvm-svn: 211156

10 years agoDAG: move sret demotion into most basic LowerCallTo implementation.
Tim Northover [Wed, 18 Jun 2014 11:52:44 +0000 (11:52 +0000)]
DAG: move sret demotion into most basic LowerCallTo implementation.

It looks like there are two versions of LowerCallTo here: the
SelectionDAGBuilder one is designed to operate on LLVM IR, and the
TargetLowering one in the case where everything is at DAG level.

Previously, only the SelectionDAGBuilder variant could handle demoting
an impossible return to sret semantics (before delegating to the
TargetLowering version), but this functionality is also useful for
certain libcalls (e.g. 128-bit operations on 32-bit x86).  So this
commit moves the sret handling down a level.

rdar://problem/17242889

llvm-svn: 211155

10 years agoMove google-explicit-constructor check to a separate source file.
Alexander Kornienko [Wed, 18 Jun 2014 09:33:46 +0000 (09:33 +0000)]
Move google-explicit-constructor check to a separate source file.

Summary: No functional changes.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

llvm-svn: 211154

10 years ago[ASan] Fix https://code.google.com/p/address-sanitizer/issues/detail?id=321 for time...
Alexander Potapenko [Wed, 18 Jun 2014 09:27:40 +0000 (09:27 +0000)]
[ASan] Fix https://code.google.com/p/address-sanitizer/issues/detail?id=321 for time() and frexp()
Add a test for the frexp() interceptor.
Annotate the interceptors that may potentially corrupt stack IDs of freed buffers with FIXME comments.

llvm-svn: 211153

10 years ago[llvm-readobj] Fix member functions name style.
Simon Atanasyan [Wed, 18 Jun 2014 09:24:01 +0000 (09:24 +0000)]
[llvm-readobj] Fix member functions name style.

llvm-svn: 211152

10 years ago[llvm-readobj] Fix compile error.
Simon Atanasyan [Wed, 18 Jun 2014 09:23:55 +0000 (09:23 +0000)]
[llvm-readobj] Fix compile error.

llvm-svn: 211151

10 years ago[llvm-readobj][ELF] New `-mips-plt-got` command line option to output
Simon Atanasyan [Wed, 18 Jun 2014 08:47:09 +0000 (08:47 +0000)]
[llvm-readobj][ELF] New `-mips-plt-got` command line option to output
MIPS GOT section.

Patch reviewed by Rafael Espindola.

llvm-svn: 211150

10 years agoAArch64: re-enable tests that were looking for a non-existent backend.
Tim Northover [Wed, 18 Jun 2014 08:37:28 +0000 (08:37 +0000)]
AArch64: re-enable tests that were looking for a non-existent backend.

In the final phase of the merge, I managed to disable a bunch of Clang
tests accidentally. Fortunately none of them seem to have broken in
the interim.

llvm-svn: 211149

10 years ago[OPENMP] Reformatting and code improvement.
Alexey Bataev [Wed, 18 Jun 2014 07:08:49 +0000 (07:08 +0000)]
[OPENMP] Reformatting and code improvement.

llvm-svn: 211147

10 years agoRevert "Random Number Generator (llvm)"
JF Bastien [Wed, 18 Jun 2014 06:33:23 +0000 (06:33 +0000)]
Revert "Random Number Generator (llvm)"

This reverts commit cccba093090d127e0b6d17473b14c264c14c5259.

It causes build breakage.

llvm-svn: 211146

10 years agoRandom Number Generator (llvm)
JF Bastien [Wed, 18 Jun 2014 06:23:25 +0000 (06:23 +0000)]
Random Number Generator (llvm)

Summary:
Provides an abstraction for a random number generator (RNG) that produces a stream of pseudo-random numbers.
The current implementation uses C++11 facilities and is therefore not cryptographically secure.

The RNG is salted with the text of the current command line invocation.
In addition, a user may specify a seed (reproducible builds).

In clang, the seed can be set via
  -frandom-seed=X
In the back end, the seed can be set via
  -rng-seed=X

This is the llvm part of the patch.
clang part: D3391

Reviewers: ahomescu, rinon, nicholas, jfb

Reviewed By: jfb

Subscribers: jfb, perl

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

llvm-svn: 211145

10 years ago[AArch64] Fix a pattern match failure caused by creating improper CONCAT_VECTOR.
Kevin Qin [Wed, 18 Jun 2014 05:54:42 +0000 (05:54 +0000)]
[AArch64] Fix a pattern match failure caused by creating improper CONCAT_VECTOR.

ReconstructShuffle() may wrongly creat a CONCAT_VECTOR trying to
concat 2 of v2i32 into v4i16. This commit is to fix this issue and
try to generate UZP1 instead of lots of MOV and INS.
Patch is initalized by Kevin Qin, and refactored by Tim Northover.

llvm-svn: 211144

10 years agoReplace some assert(0)'s with llvm_unreachable.
Craig Topper [Wed, 18 Jun 2014 05:13:13 +0000 (05:13 +0000)]
Replace some assert(0)'s with llvm_unreachable.

llvm-svn: 211143

10 years agoConvert an llvm_unreachable in an 'else' block to a removal of the 'if' and an assert...
Craig Topper [Wed, 18 Jun 2014 05:13:11 +0000 (05:13 +0000)]
Convert an llvm_unreachable in an 'else' block to a removal of the 'if' and an assertion of its condition. Suggestion from David Blaikie.

llvm-svn: 211142

10 years agoReplace some assert(0)'s with llvm_unreachable.
Craig Topper [Wed, 18 Jun 2014 05:05:13 +0000 (05:05 +0000)]
Replace some assert(0)'s with llvm_unreachable.

llvm-svn: 211141

10 years ago[OPENMP] Initial support for '#pragma omp for' (fixed incompatibility with MSVC).
Alexey Bataev [Wed, 18 Jun 2014 04:14:57 +0000 (04:14 +0000)]
[OPENMP] Initial support for '#pragma omp for' (fixed incompatibility with MSVC).

llvm-svn: 211140

10 years agoReplace some assert(0)'s with llvm_unreachable.
Craig Topper [Wed, 18 Jun 2014 03:57:25 +0000 (03:57 +0000)]
Replace some assert(0)'s with llvm_unreachable.

llvm-svn: 211139

10 years agoConvert assert(0) to llvm_unreachable to silence a warning about Addend being uniniti...
Craig Topper [Wed, 18 Jun 2014 03:13:41 +0000 (03:13 +0000)]
Convert assert(0) to llvm_unreachable to silence a warning about Addend being uninitialized in default case.

llvm-svn: 211138

10 years agoFix bug in code for avoiding dynamic initialization of dllimport globals
Hans Wennborg [Wed, 18 Jun 2014 01:21:33 +0000 (01:21 +0000)]
Fix bug in code for avoiding dynamic initialization of dllimport globals

When instantiating dllimport variables with dynamic initializers, don't
bail out of Sema::InstantiateVariableInitializer without calling
PopExpressionEvaluationContext().

This was causing a stale object to stay on the ExprEvalContexts stack,
causing subsequent calls to getCurrentMangleNumberContext() to fail,
resulting in incorrect numbering of static locals (and probably other
broken things).

llvm-svn: 211137

10 years agoAdd locking around the m_owners collection in the breakpoint site. If we are in...
Jim Ingham [Wed, 18 Jun 2014 01:04:40 +0000 (01:04 +0000)]
Add locking around the m_owners collection in the breakpoint site.  If we are in the middle of "BreakpointLocation::ShouldStop" we don't
want other commands (like "break disable") to mutate the owners of this breakpoint out from under us.

<rdar://problem/17255589>

llvm-svn: 211136

10 years agoDocumentation for #pragma clang loop directive and options vectorize and interleave.
Tyler Nowicki [Wed, 18 Jun 2014 00:51:32 +0000 (00:51 +0000)]
Documentation for #pragma clang loop directive and options vectorize and interleave.

Reviewed by: Aaron Ballman and Dmitri Gribenko

llvm-svn: 211135

10 years agoFix the caller of checkCorrectionVisibility too.
Kaelyn Takata [Tue, 17 Jun 2014 23:47:29 +0000 (23:47 +0000)]
Fix the caller of checkCorrectionVisibility too.

That's what I get for hurredly splitting the small change out of a much
bigger change that had moved where checkCorrectionVisibility was being
called.

llvm-svn: 211134

10 years agoRemove an unused argument from checkCorrectionVisibility.
Kaelyn Takata [Tue, 17 Jun 2014 23:41:33 +0000 (23:41 +0000)]
Remove an unused argument from checkCorrectionVisibility.

llvm-svn: 211133

10 years agoObjective-C ARC. Do not warn about properties with both
Fariborz Jahanian [Tue, 17 Jun 2014 23:35:13 +0000 (23:35 +0000)]
Objective-C ARC. Do not warn about properties with both
IBOutlet and weak attributes when accessed being
unpredictably set to nil because usage of such properties
are always single threaded and its ivar cannot be set
to nil asynchronously. // rdar://15885642

llvm-svn: 211132

10 years agoAdd the coverage cflags to the link step as well to make sure
Eric Christopher [Tue, 17 Jun 2014 23:27:32 +0000 (23:27 +0000)]
Add the coverage cflags to the link step as well to make sure
that we link in the support libraries.

llvm-svn: 211131

10 years agoAllow X86FastIsel to cope with 64 bit absolute relocations
Louis Gerbarg [Tue, 17 Jun 2014 23:22:41 +0000 (23:22 +0000)]
Allow X86FastIsel to cope with 64 bit absolute relocations

This patch is a follow up to r211040 & r211052. Rather than bailing out of fast
isel this patch will generate an alternate instruction (movabsq) instead of the
leaq. While this will always have enough room to handle the 64 bit displacment
it is generally over kill for internal symbols (most displacements will be
within 32 bits) but since we have no way of communicating the code model to the
the assmebler in order to avoid flagging an absolute leal/leaq as illegal when
using a symbolic displacement.

llvm-svn: 211130

10 years agoRetry building modules that were compiled by other instances and are out-of-date
Ben Langmuir [Tue, 17 Jun 2014 22:35:27 +0000 (22:35 +0000)]
Retry building modules that were compiled by other instances and are out-of-date

When another clang instance builds a module, it may still be considered
"out of date" for the current instance in a couple of cases*.  This
patch prevents us from giving spurious errors when compilers race to
build a module by allowing the module load to fail when the pcm was
built by a different compiler instance.

* Cases where a module can be out of date despite just having been
built:

1) There are different -I paths between invocations that result in
finding a different module map file for some dependent module. This is
not an error, and should never be diagnosed.

<rdar://problem/16843887>

2) There are file system races where the headers making up a module are
touched or moved. Although this can sometimes mean trouble, diagnosing
it only during a build-race is worse than useless and we cannot detect
this in general.  It is more robust to just rebuild.  This was causing
spurious issues in some setups where only the modtime of headers was
bumped during a build.

<rdar://problem/16157638>

llvm-svn: 211129

10 years agoAdded gdb-remote auxv test for chunked reads.
Todd Fiala [Tue, 17 Jun 2014 22:01:27 +0000 (22:01 +0000)]
Added gdb-remote auxv test for chunked reads.

Verifies that a sum of offset,length auxv reads
matches a single large read, and that the auxv data
extracted from them match.

llvm-svn: 211127

10 years ago[FastISel][X86] Optimize predicates and fold CMP instructions.
Juergen Ributzka [Tue, 17 Jun 2014 21:55:43 +0000 (21:55 +0000)]
[FastISel][X86] Optimize predicates and fold CMP instructions.

This optimizes predicates for certain compares, such as fcmp oeq %x, %x to
fcmp ord %x, %x. The latter one is more efficient to generate.

The same optimization is applied to conditional branches.

llvm-svn: 211126

10 years agoRemove more occurrences of the unused-mutex-parameter pattern.
Zachary Turner [Tue, 17 Jun 2014 21:54:18 +0000 (21:54 +0000)]
Remove more occurrences of the unused-mutex-parameter pattern.

This pattern loses some of its usefulness when the mutex type is
statically polymorphic as opposed to runtime polymorphic, as
swapping out the mutex type requires changing a significant number
of function parameters, and templatizing the function parameter
requires the methods to be defined in the headers.

Furthermore, if LLVM is compiled with threads disabled then there
may even be no mutex to acquire anyway, so it should not be up to
individual APIs to know whether or not acquiring a mutex is required
to use those APIs to begin with.  It should be up to the user of the
API.

llvm-svn: 211125

10 years agoThose were not the right defines for memory errors, and the right defines aren't
Jim Ingham [Tue, 17 Jun 2014 21:02:44 +0000 (21:02 +0000)]
Those were not the right defines for memory errors, and the right defines aren't
available.  So going back to a generic error instead.

<rdar://problem/17058708>

llvm-svn: 211124

10 years agoFix up lldb cmake linker flags for MacOSX.
Todd Fiala [Tue, 17 Jun 2014 20:54:56 +0000 (20:54 +0000)]
Fix up lldb cmake linker flags for MacOSX.

Change r210035 broke the Darwin cmake build.  The
initial change was intended to stop the --start-group/--end-group
linker flags from being passed to non-gcc/clang-looking compilers,
stopping MSVC from warning on linking.  That change, however,
caused MacOSX cmake-based builds to start using the --start-group/
--end-group flags, even though the MacOSX linker doesn't support
them.  That broke the MacOSX clang build.

The fix keeps the newer check for a gcc-compatible compiler, but
specifically excludes MacOSX.

llvm-svn: 211123

10 years agoRemove dead code.
Diego Novillo [Tue, 17 Jun 2014 20:01:51 +0000 (20:01 +0000)]
Remove dead code.

The parsing for -Rpass= had been factored into the function
GenerateOptimizationRemarkRegex, but at the time I forgot to remove
the original code that just handled OPT_Rpass_EQ.

llvm-svn: 211122

10 years agoChange libclang initialization to use std::call_once instead of
Zachary Turner [Tue, 17 Jun 2014 19:57:15 +0000 (19:57 +0000)]
Change libclang initialization to use std::call_once instead of
hand rolled once-initialization, and rename the mutex to be more
descriptive of its actual purpose.

llvm-svn: 211121

10 years agoR600/SI: Make sure target flags are set on pseudo VOP3 instructions
Tom Stellard [Tue, 17 Jun 2014 19:34:46 +0000 (19:34 +0000)]
R600/SI: Make sure target flags are set on pseudo VOP3 instructions

llvm-svn: 211120

10 years agolit: simplify population of the actual_inputs array
Hans Wennborg [Tue, 17 Jun 2014 18:17:46 +0000 (18:17 +0000)]
lit: simplify population of the actual_inputs array

Add all inputs to the array, except those starting with @, which
are treated as response files and expanded.

llvm-svn: 211119

10 years agoMerge lib/Support/WindowsError.cpp into ib/Support/ErrorHandling.cpp.
Rafael Espindola [Tue, 17 Jun 2014 18:06:45 +0000 (18:06 +0000)]
Merge lib/Support/WindowsError.cpp into ib/Support/ErrorHandling.cpp.

The OSX ranlib warns on files with no symbols, and lib/Support/WindowsError.cpp
was empty when building on non-windows.

llvm-svn: 211118

10 years agoAdd "-format darwin" to llvm-size to be like darwin's size(1) -m output, and
Kevin Enderby [Tue, 17 Jun 2014 17:54:13 +0000 (17:54 +0000)]
Add "-format darwin" to llvm-size to be like darwin's size(1) -m output, and
and the -l option for the long format.  Also when the object is a Mach-O
file and the format is berkeley produce output like darwin’s default size(1)
summary berkeley derived output.

Like System V format, there are also some small changes in how and where
the file names and archive member names are printed for darwin and
Mach-O.

Like the changes to llvm-nm these are the first steps in seeing if it is
possible to make llvm-size produce the same output as darwin's size(1).

llvm-svn: 211117

10 years agoR600/SI: Match cttz_zero_undef
Matt Arsenault [Tue, 17 Jun 2014 17:36:27 +0000 (17:36 +0000)]
R600/SI: Match cttz_zero_undef

llvm-svn: 211116

10 years agoR600/SI: Match ctlz_zero_undef
Matt Arsenault [Tue, 17 Jun 2014 17:36:24 +0000 (17:36 +0000)]
R600/SI: Match ctlz_zero_undef

llvm-svn: 211115

10 years agoSubject: [PATCH-v5] Detect and mark reduction like statements
Johannes Doerfert [Tue, 17 Jun 2014 17:31:36 +0000 (17:31 +0000)]
Subject: [PATCH-v5] Detect and mark reduction like statements

+ Flag to indicate reduction like statements
+ Command line option to (dis)allow multiplicative reduction opcodes
+ Two simple positive test cases, one fp test case w and w/o fast math
+ One "negative" test case (only reduction like but no reduction)

llvm-svn: 211114

10 years agoRevert "[OPENMP] Initial support for '#pragma omp for'."
Rafael Espindola [Tue, 17 Jun 2014 17:20:53 +0000 (17:20 +0000)]
Revert "[OPENMP] Initial support for '#pragma omp for'."

This reverts commit r211096. Looks like it broke the msvc build:

SemaOpenMP.cpp(140) : error C4519: default template arguments are only allowed on a class template

llvm-svn: 211113

10 years agoFix the comment which was backwards.
Yaron Keren [Tue, 17 Jun 2014 17:09:24 +0000 (17:09 +0000)]
Fix the comment which was backwards.

llvm-svn: 211112

10 years agomark the old jit tests as unsupported for powerpc64 (for cmake)
Will Schmidt [Tue, 17 Jun 2014 17:04:42 +0000 (17:04 +0000)]
mark the old jit tests as unsupported for powerpc64 (for cmake)

mark the old JIT tests as unsupported for powerpc64 - CMake style.
This follows the style used for hexagon/arm64/aarch64.
The equivalent tests still run under the supported MCJIT/*

llvm-svn: 211111

10 years agoR600: Use LDS and vectors for private memory
Tom Stellard [Tue, 17 Jun 2014 16:53:14 +0000 (16:53 +0000)]
R600: Use LDS and vectors for private memory

llvm-svn: 211110

10 years agoR600/SI: Add a pattern for llvm.AMDGPU.barrier.global
Tom Stellard [Tue, 17 Jun 2014 16:53:09 +0000 (16:53 +0000)]
R600/SI: Add a pattern for llvm.AMDGPU.barrier.global

llvm-svn: 211109

10 years agoSelectionDAG: Expand i64 = FP_TO_SINT i32
Tom Stellard [Tue, 17 Jun 2014 16:53:07 +0000 (16:53 +0000)]
SelectionDAG: Expand i64 = FP_TO_SINT i32

llvm-svn: 211108

10 years agoR600/SI: Re-initialize the m0 register after using it for indirect addressing
Tom Stellard [Tue, 17 Jun 2014 16:53:04 +0000 (16:53 +0000)]
R600/SI: Re-initialize the m0 register after using it for indirect addressing

We need to store a value greater than or equal to the number of LDS
bytes allocated by the shader in the m0 register in order for LDS
instructions to work correctly.

We always initialize m0 at the beginning of a shader, but this register
is also used for indirect addressing offsets, so we need to
re-initialize it any time we use indirect addressing.

llvm-svn: 211107

10 years ago[PECOFF] Support COMDAT associative sections.
Rui Ueyama [Tue, 17 Jun 2014 16:19:33 +0000 (16:19 +0000)]
[PECOFF] Support COMDAT associative sections.

COFF supports a feature similar to ELF's section groups. This
patch implements it.

In ELF, section groups are identified by their names, and they are
treated somewhat differently from regular symbols. In COFF, the
feature is realized in a more straightforward way. A section can
have an annotation saying "if Nth section is linked, link this
section too."

I added a new reference type, kindAssociate. If a target atom is
coalesced away, the referring atom is removed by Resolver, so that
they are treated as a group.

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

llvm-svn: 211106

10 years agoAdded gdb-remote auxv tests.
Todd Fiala [Tue, 17 Jun 2014 16:04:45 +0000 (16:04 +0000)]
Added gdb-remote auxv tests.

First batch of auxv-related tests from llgs branch.

Includes helpers for unescaping gdb-remote binary-escaped
data, converting binary data from inferior endian-ness to
integral values, etc.

Tests on debugserver are expected to be skipped since it
doesn't support auxv and the tests are geared to be skipped
on platforms that don't broadcast support for the feature
in qSupported.  (llgs is listed as XFAIL since qSupported
support in llgs upstream is not there, so the support check
cannot work in upstream llgs.)

llvm-svn: 211105

10 years ago[FastISel][X86] Fix previous refactoring commit (r211077)
Juergen Ributzka [Tue, 17 Jun 2014 14:47:45 +0000 (14:47 +0000)]
[FastISel][X86] Fix previous refactoring commit (r211077)

Overlooked that fcmp_une uses an "or" instead of an "and" for combining the
flags.

llvm-svn: 211104

10 years agoFixed jump threading going to infinite loop.
Dinesh Dwivedi [Tue, 17 Jun 2014 14:34:19 +0000 (14:34 +0000)]
Fixed jump threading going to infinite loop.

This patch add code to remove unreachable blocks from function
as they may cause jump threading to stuck in infinite loop.

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

llvm-svn: 211103

10 years agoAvoid crashing on invalid or unreadable ELF core
Ed Maste [Tue, 17 Jun 2014 14:14:33 +0000 (14:14 +0000)]
Avoid crashing on invalid or unreadable ELF core

Issue discovered during the GSoC 2014 project implementing FreeBSD
kernel support.  The existing elf-core Process plugin crashed trying
to read from /dev/mem (the kernel memory device).

Patch by Mike Ma.

llvm-svn: 211102

10 years agoRewrite ARM NEON intrinsic emission completely.
James Molloy [Tue, 17 Jun 2014 13:11:27 +0000 (13:11 +0000)]
Rewrite ARM NEON intrinsic emission completely.

There comes a time in the life of any amateur code generator when dumb string
concatenation just won't cut it any more. For NeonEmitter.cpp, that time has
come.

There were a bunch of magic type codes which meant different things depending on
the context. There were a bunch of special cases that really had no reason to be
there but the whole thing was so creaky that removing them would cause something
weird to fall over. There was a 1000 line switch statement for code generation
involving string concatenation, which actually did lexical scoping to an extent
(!!) with a bunch of semi-repeated cases.

I tried to refactor this three times in three different ways without
success. The only way forward was to rewrite the entire thing. Luckily the
testing coverage on this stuff is absolutely massive, both with regression tests
and the "emperor" random test case generator.

The main change is that previously, in arm_neon.td a bunch of "Operation"s were
defined with special names. NeonEmitter.cpp knew about these Operations and
would emit code based on a huge switch. Actually this doesn't make much sense -
the type information was held as strings, so type checking was impossible. Also
TableGen's DAG type actually suits this sort of code generation very well
(surprising that...)

So now every operation is defined in terms of TableGen DAGs. There are a bunch
of operators to use, including "op" (a generic unary or binary operator), "call"
(to call other intrinsics) and "shuffle" (take a guess...). One of the main
advantages of this apart from making it more obvious what is going on, is that
we have proper type inference. This has two obvious advantages:

  1) TableGen can error on bad intrinsic definitions easier, instead of just
     generating wrong code.
  2) Calls to other intrinsics are typechecked too. So
     we no longer need to work out whether the thing we call needs to be the Q-lane
     version or the D-lane version - TableGen knows that itself!

Here's an example: before:

  case OpAbdl: {
    std::string abd = MangleName("vabd", typestr, ClassS) + "(__a, __b)";
    if (typestr[0] != 'U') {
      // vabd results are always unsigned and must be zero-extended.
      std::string utype = "U" + typestr.str();
      s += "(" + TypeString(proto[0], typestr) + ")";
      abd = "(" + TypeString('d', utype) + ")" + abd;
      s += Extend(utype, abd) + ";";
    } else {
      s += Extend(typestr, abd) + ";";
    }
    break;
  }

after:

  def OP_ABDL     : Op<(cast "R", (call "vmovl", (cast $p0, "U",
                                                       (call "vabd", $p0, $p1))))>;

As an example of what happens if you do something wrong now, here's what happens
if you make $p0 unsigned before the call to "vabd" - that is, $p0 -> (cast "U",
$p0):

arm_neon.td:574:1: error: No compatible intrinsic found - looking up intrinsic 'vabd(uint8x8_t, int8x8_t)'
Available overloads:
  - float64x2_t vabdq_v(float64x2_t, float64x2_t)
  - float64x1_t vabd_v(float64x1_t, float64x1_t)
  - float64_t vabdd_f64(float64_t, float64_t)
  - float32_t vabds_f32(float32_t, float32_t)
... snip ...

This makes it seriously easy to work out what you've done wrong in fairly nasty
intrinsics.

As part of this I've massively beefed up the documentation in arm_neon.td too.

Things still to do / on the radar:
  - Testcase generation. This was implemented in the previous version and not in
    the new one, because
    - Autogenerated tests are not being run. The testcase in test/ differs from
      the autogenerated version.
    - There were a whole slew of special cases in the testcase generation that just
      felt (and looked) like hacks.
    If someone really feels strongly about this, I can try and reimplement it too.
  - Big endian. That's coming soon and should be a very small diff on top of this one.

llvm-svn: 211101

10 years agoMove SetTheory from utils/TableGen into lib/TableGen so Clang can use it.
James Molloy [Tue, 17 Jun 2014 13:10:38 +0000 (13:10 +0000)]
Move SetTheory from utils/TableGen into lib/TableGen so Clang can use it.

llvm-svn: 211100

10 years ago[Mips] Make plt-header.test test case independent from external input files.
Simon Atanasyan [Tue, 17 Jun 2014 13:08:11 +0000 (13:08 +0000)]
[Mips] Make plt-header.test test case independent from external input files.

llvm-svn: 211099

10 years agoclang-format: Introduce style with spaces on both sides of */&.
Daniel Jasper [Tue, 17 Jun 2014 12:40:34 +0000 (12:40 +0000)]
clang-format: Introduce style with spaces on both sides of */&.

Patch by Janusz Sobczak (slightly extended).
This fixes llvm.org/19929.

llvm-svn: 211098

10 years agoFix memory leak of RegScavenger accidentally added in r211037.
James Molloy [Tue, 17 Jun 2014 12:31:41 +0000 (12:31 +0000)]
Fix memory leak of RegScavenger accidentally added in r211037.

llvm-svn: 211097

10 years ago[OPENMP] Initial support for '#pragma omp for'.
Alexey Bataev [Tue, 17 Jun 2014 11:49:22 +0000 (11:49 +0000)]
[OPENMP] Initial support for '#pragma omp for'.

llvm-svn: 211096

10 years agoAArch64: estimate inline asm length during branch relaxation
Tim Northover [Tue, 17 Jun 2014 11:31:42 +0000 (11:31 +0000)]
AArch64: estimate inline asm length during branch relaxation

To make sure branches are in range, we need to do a better job of estimating
the length of an inline assembly block than "it's probably 1 instruction, who'd
write asm with more than that?".

Fortunately there's already a (highly suspect, see how many ways you can think
of to break it!) callback for this purpose, which is used by the other targets.

rdar://problem/17277590

llvm-svn: 211095

10 years ago[msan] Fix a comment.
Evgeniy Stepanov [Tue, 17 Jun 2014 11:26:00 +0000 (11:26 +0000)]
[msan] Fix a comment.

llvm-svn: 211094

10 years agoConvertUTF tests: remove uses of initializer lists to restore compatibility
Dmitri Gribenko [Tue, 17 Jun 2014 09:33:24 +0000 (09:33 +0000)]
ConvertUTF tests: remove uses of initializer lists to restore compatibility
with MSVC

llvm-svn: 211093

10 years ago[msan] Fix handling of multiplication by a constant with a number of trailing zeroes.
Evgeniy Stepanov [Tue, 17 Jun 2014 09:23:12 +0000 (09:23 +0000)]
[msan] Fix handling of multiplication by a constant with a number of trailing zeroes.

Multiplication by an integer with a number of trailing zero bits leaves
the same number of lower bits of the result initialized to zero.
This change makes MSan take this into account in the case of multiplication by
a compile-time constant.

We don't handle the general, non-constant, case because
(a) it's not going to be cheap (computation-wise);
(b) multiplication by a partially uninitialized value in user code is
    a bad idea anyway.

Constant case must be handled because it appears from LLVM optimization of a
completely valid user code, as the test case in compiler-rt demonstrates.

llvm-svn: 211092

10 years agoSupport: Inject LLVM_VERSION_INFO into the Support library
Justin Bogner [Tue, 17 Jun 2014 06:52:47 +0000 (06:52 +0000)]
Support: Inject LLVM_VERSION_INFO into the Support library

Mimic r116632 in passing LLVM_VERSION_INFO from the Makefile build
system to the build. This improves the -version output of tools that
use llvm::cl under the configure+make system.

llvm-svn: 211091

10 years agotools: Add a space between package version and LLVM_VERSION_INFO
Justin Bogner [Tue, 17 Jun 2014 06:52:41 +0000 (06:52 +0000)]
tools: Add a space between package version and LLVM_VERSION_INFO

This reads a little strangely. Add a space to clean it up.

llvm-svn: 211090

10 years agoConvert a few loops to use ranges.
Rafael Espindola [Tue, 17 Jun 2014 03:00:40 +0000 (03:00 +0000)]
Convert a few loops to use ranges.

llvm-svn: 211089

10 years ago[OPENMP] Renamed 'DataRecursiveASTVisitor' to just 'RecursiveASTVisitor' for 'reducti...
Alexey Bataev [Tue, 17 Jun 2014 02:32:07 +0000 (02:32 +0000)]
[OPENMP] Renamed 'DataRecursiveASTVisitor' to just 'RecursiveASTVisitor' for 'reduction' clause and small reformatting after Alp Toker's review.

llvm-svn: 211088

10 years agoAdd an overload for SourceMgr::PrintMessage that takes an existing diagnostic.
Jordan Rose [Tue, 17 Jun 2014 02:15:40 +0000 (02:15 +0000)]
Add an overload for SourceMgr::PrintMessage that takes an existing diagnostic.

llvm-svn: 211087

10 years agoModernize doc comments for SourceMgr.
Jordan Rose [Tue, 17 Jun 2014 02:15:36 +0000 (02:15 +0000)]
Modernize doc comments for SourceMgr.

No functionality change.

llvm-svn: 211086

10 years agoAdd documentation for PGO with instrumentation to clang's User's Manual.
Bob Wilson [Tue, 17 Jun 2014 00:45:30 +0000 (00:45 +0000)]
Add documentation for PGO with instrumentation to clang's User's Manual.

<rdar://problem/16771671>

llvm-svn: 211085

10 years ago[InstCombine] mark ADD with nuw if no unsigned overflow
Jingyue Wu [Tue, 17 Jun 2014 00:42:07 +0000 (00:42 +0000)]
[InstCombine] mark ADD with nuw if no unsigned overflow

Summary:
As a starting step, we only use one simple heuristic: if the sign bits
of both a and b are zero, we can prove "add a, b" do not unsigned
overflow, and thus convert it to "add nuw a, b".

Updated all affected tests and added two new tests (@zero_sign_bit and
@zero_sign_bit2) in AddOverflow.ll

Test Plan: make check-all

Reviewers: eliben, rafael, meheff, chandlerc

Reviewed By: chandlerc

Subscribers: chandlerc, llvm-commits

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

llvm-svn: 211084

10 years agoFix build breakage caused by change to ValueMapTest.
Zachary Turner [Tue, 17 Jun 2014 00:38:40 +0000 (00:38 +0000)]
Fix build breakage caused by change to ValueMapTest.

llvm-svn: 211083

10 years agoSROA: Only split loads on byte boundaries
Duncan P. N. Exon Smith [Tue, 17 Jun 2014 00:19:35 +0000 (00:19 +0000)]
SROA: Only split loads on byte boundaries

r199771 accidently broke the logic that makes sure that SROA only splits
load on byte boundaries.  If such a split happens, some bits get lost
when reassembling loads of wider types, causing data corruption.

Move the width check up to reject such splits early, avoiding the
corruption.  Fixes PR19250.

Patch by: Björn Steinbrink <bsteinbr@gmail.com>

llvm-svn: 211082

10 years agoAdd support for the /Fi argument to clang-cl (PR20036)
Hans Wennborg [Tue, 17 Jun 2014 00:19:12 +0000 (00:19 +0000)]
Add support for the /Fi argument to clang-cl (PR20036)

Patch by Ehsan Akhgari!

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

llvm-svn: 211081

10 years agoExpose ValueMap's mutex type as a typedef instead of a sys::Mutex.
Zachary Turner [Tue, 17 Jun 2014 00:17:38 +0000 (00:17 +0000)]
Expose ValueMap's mutex type as a typedef instead of a sys::Mutex.

This enables static polymorphism of the mutex type, which is
necessary in order to replace the standard mutex implementation
with a different type.

llvm-svn: 211080

10 years agoMS static locals mangling: don't double-increment mangling number for switches
Hans Wennborg [Tue, 17 Jun 2014 00:09:05 +0000 (00:09 +0000)]
MS static locals mangling: don't double-increment mangling number for switches

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

llvm-svn: 211079

10 years agoMS static locals mangling: don't count enum scopes
Hans Wennborg [Tue, 17 Jun 2014 00:00:18 +0000 (00:00 +0000)]
MS static locals mangling: don't count enum scopes

We may not have the mangling for static locals vs. enums completely figured out,
but at least for my simple test cases, enums should not increment the mangling
number.

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

llvm-svn: 211078

10 years ago[FastISel][X86] Refactor the code to get the X86 condition from a helper function...
Juergen Ributzka [Mon, 16 Jun 2014 23:58:24 +0000 (23:58 +0000)]
[FastISel][X86] Refactor the code to get the X86 condition from a helper function. NFC.

Make use of helper functions to simplify the branch and compare instruction
selection in FastISel. Also add test cases for compare and conditonal branch.

llvm-svn: 211077

10 years agoTeach LoopUnrollPass to respect loop unrolling hints in metadata.
Eli Bendersky [Mon, 16 Jun 2014 23:53:02 +0000 (23:53 +0000)]
Teach LoopUnrollPass to respect loop unrolling hints in metadata.

[This is resubmitting r210721, which was reverted due to suspected breakage
which turned out to be unrelated].

Some extra review comments were addressed. See D4090 and D4147 for more details.

The Clang change that produces this metadata was committed in r210667

Patch by Mark Heffernan.

llvm-svn: 211076

10 years agoUse the integrated assembler by default on OpenBSD/powerpc.
Brad Smith [Mon, 16 Jun 2014 23:03:00 +0000 (23:03 +0000)]
Use the integrated assembler by default on OpenBSD/powerpc.

llvm-svn: 211075

10 years agoDon't hardcode path to codesign_allocate.
Kuba Brecka [Mon, 16 Jun 2014 22:55:16 +0000 (22:55 +0000)]
Don't hardcode path to codesign_allocate.

Building OS X debugserver assumes you have an Xcode installation at /Application/Xcode.app. Let's instead detect where Xcode is using xcrun.

See http://reviews.llvm.org/D4152

llvm-svn: 211074

10 years agoCorrectly classify code sections as code sections by using the S_ATTR_PURE_INSTRUCTIO...
Greg Clayton [Mon, 16 Jun 2014 22:53:16 +0000 (22:53 +0000)]
Correctly classify code sections as code sections by using the S_ATTR_PURE_INSTRUCTIONS and S_ATTR_SOME_INSTRUCTIONS section flags.

Also correctly set the symbol type of symbols for S_REGULAR and other section types.

<rdar://problem/16896734>

llvm-svn: 211073

10 years agoRevert r211066, 211067, 211068, 211069, 211070.
Zachary Turner [Mon, 16 Jun 2014 22:49:41 +0000 (22:49 +0000)]
Revert r211066, 211067, 211068, 211069, 211070.

These were committed accidentally from the wrong branch before having
a review sign-off.

llvm-svn: 211072

10 years agoCleanup more unreferenced MutexGuard parameters on functions.
Zachary Turner [Mon, 16 Jun 2014 22:41:08 +0000 (22:41 +0000)]
Cleanup more unreferenced MutexGuard parameters on functions.

These parameters are intended to serve as sort of a contract that
you cannot access the functions outside of a mutex.  However, the
entire JIT class cannot be accessed outside of a mutex anyway, and
all methods acquire a lock as soon as they are entered.  Since the
containing class already is not intended to be thread-safe, it only
serves to add code clutter.

llvm-svn: 211071

10 years agoProgrammer's Manual changes.
Zachary Turner [Mon, 16 Jun 2014 22:40:48 +0000 (22:40 +0000)]
Programmer's Manual changes.

llvm-svn: 211070

10 years agoKill the LLVM global lock.
Zachary Turner [Mon, 16 Jun 2014 22:40:42 +0000 (22:40 +0000)]
Kill the LLVM global lock.

llvm-svn: 211069

10 years agoRemove some code churn.
Zachary Turner [Mon, 16 Jun 2014 22:40:29 +0000 (22:40 +0000)]
Remove some code churn.

llvm-svn: 211068

10 years agoRemove some more code out into a separate CL.
Zachary Turner [Mon, 16 Jun 2014 22:40:17 +0000 (22:40 +0000)]
Remove some more code out into a separate CL.

llvm-svn: 211067

10 years agoUsers of the llvm global mutex must now acquire it manually.
Zachary Turner [Mon, 16 Jun 2014 22:39:38 +0000 (22:39 +0000)]
Users of the llvm global mutex must now acquire it manually.

This allows the mutex to be acquired in a guarded, RAII fashion.

llvm-svn: 211066

10 years agoFix definition of INFINITY and add NAN/HUGE_VAL[F]
Aaron Watry [Mon, 16 Jun 2014 22:32:58 +0000 (22:32 +0000)]
Fix definition of INFINITY and add NAN/HUGE_VAL[F]

v3: change __builtin_nanf() to __builtin_nanf("")
    This doesn't work yet, but it was agreed to commit as-is with the logic
    that "broken" is better than "completely missing" and this should be
    fixed in clang.

v2: use __builtin_inff() and also add nan/huge_val definitions

Signed-off-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 211065

10 years agoAArch64: Fix silly think-o in tests.
Jim Grosbach [Mon, 16 Jun 2014 22:18:26 +0000 (22:18 +0000)]
AArch64: Fix silly think-o in tests.

rdar://9283021

llvm-svn: 211064