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
Simon Atanasyan [Wed, 18 Jun 2014 09:24:01 +0000 (09:24 +0000)]
[llvm-readobj] Fix member functions name style.
llvm-svn: 211152
Simon Atanasyan [Wed, 18 Jun 2014 09:23:55 +0000 (09:23 +0000)]
[llvm-readobj] Fix compile error.
llvm-svn: 211151
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
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
Alexey Bataev [Wed, 18 Jun 2014 07:08:49 +0000 (07:08 +0000)]
[OPENMP] Reformatting and code improvement.
llvm-svn: 211147
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
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
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
Craig Topper [Wed, 18 Jun 2014 05:13:13 +0000 (05:13 +0000)]
Replace some assert(0)'s with llvm_unreachable.
llvm-svn: 211143
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
Craig Topper [Wed, 18 Jun 2014 05:05:13 +0000 (05:05 +0000)]
Replace some assert(0)'s with llvm_unreachable.
llvm-svn: 211141
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
Craig Topper [Wed, 18 Jun 2014 03:57:25 +0000 (03:57 +0000)]
Replace some assert(0)'s with llvm_unreachable.
llvm-svn: 211139
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
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
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
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
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
Kaelyn Takata [Tue, 17 Jun 2014 23:41:33 +0000 (23:41 +0000)]
Remove an unused argument from checkCorrectionVisibility.
llvm-svn: 211133
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Matt Arsenault [Tue, 17 Jun 2014 17:36:27 +0000 (17:36 +0000)]
R600/SI: Match cttz_zero_undef
llvm-svn: 211116
Matt Arsenault [Tue, 17 Jun 2014 17:36:24 +0000 (17:36 +0000)]
R600/SI: Match ctlz_zero_undef
llvm-svn: 211115
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
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
Yaron Keren [Tue, 17 Jun 2014 17:09:24 +0000 (17:09 +0000)]
Fix the comment which was backwards.
llvm-svn: 211112
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
Tom Stellard [Tue, 17 Jun 2014 16:53:14 +0000 (16:53 +0000)]
R600: Use LDS and vectors for private memory
llvm-svn: 211110
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
Tom Stellard [Tue, 17 Jun 2014 16:53:07 +0000 (16:53 +0000)]
SelectionDAG: Expand i64 = FP_TO_SINT i32
llvm-svn: 211108
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
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
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
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
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
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
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
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
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
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
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
Alexey Bataev [Tue, 17 Jun 2014 11:49:22 +0000 (11:49 +0000)]
[OPENMP] Initial support for '#pragma omp for'.
llvm-svn: 211096
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
Evgeniy Stepanov [Tue, 17 Jun 2014 11:26:00 +0000 (11:26 +0000)]
[msan] Fix a comment.
llvm-svn: 211094
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
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
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
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
Rafael Espindola [Tue, 17 Jun 2014 03:00:40 +0000 (03:00 +0000)]
Convert a few loops to use ranges.
llvm-svn: 211089
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
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
Jordan Rose [Tue, 17 Jun 2014 02:15:36 +0000 (02:15 +0000)]
Modernize doc comments for SourceMgr.
No functionality change.
llvm-svn: 211086
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
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
Zachary Turner [Tue, 17 Jun 2014 00:38:40 +0000 (00:38 +0000)]
Fix build breakage caused by change to ValueMapTest.
llvm-svn: 211083
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
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
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
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
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
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
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
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
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
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
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
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
Zachary Turner [Mon, 16 Jun 2014 22:40:48 +0000 (22:40 +0000)]
Programmer's Manual changes.
llvm-svn: 211070
Zachary Turner [Mon, 16 Jun 2014 22:40:42 +0000 (22:40 +0000)]
Kill the LLVM global lock.
llvm-svn: 211069
Zachary Turner [Mon, 16 Jun 2014 22:40:29 +0000 (22:40 +0000)]
Remove some code churn.
llvm-svn: 211068
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
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
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
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
Jeroen Ketema [Mon, 16 Jun 2014 22:15:50 +0000 (22:15 +0000)]
Add remaining float constants
Reviewed-by: Aaron Watry <awatry@gmail.com>
llvm-svn: 211062
Reed Kotler [Mon, 16 Jun 2014 22:05:47 +0000 (22:05 +0000)]
Add load/store functionality
Summary:
This patches allows non conversions like i1=i2; where both are global ints.
In addition, arithmetic and other things start to work since fast-isel will use
existing patterns for non fast-isel from tablegen files where applicable.
In addition i8, i16 will work in this limited context for assignment without the need
for sign extension (zero or signed). It does not matter how i8 or i16 are loaded (zero or sign extended)
since only the 8 or 16 relevant bits are used and clang will ask for sign extension before using them in
arithmetic. This is all made more complete in forthcoming patches.
for example:
int i, j=1, k=3;
void foo() {
i = j + k;
}
Keep in mind that this pass is not enabled right now and is an experimental pass
It can only be enabled with a hidden option to llvm of -mips-fast-isel.
Test Plan: Run test-suite, loadstore2.ll and I will run some executable tests.
Reviewers: dsanders
Subscribers: mcrosier
Differential Revision: http://reviews.llvm.org/D3856
llvm-svn: 211061
Jim Grosbach [Mon, 16 Jun 2014 21:56:02 +0000 (21:56 +0000)]
AArch64: Support for __builtin_arm_rbit() and __builtin_arm_rbit64().
__builtin_arm_rbit() and __builtin_arm_rbit64().
rdar://9283021
llvm-svn: 211060
Jim Grosbach [Mon, 16 Jun 2014 21:55:58 +0000 (21:55 +0000)]
ARM: Support for __builtin_arm_rbit() intrinsic.
Reverse the bits in a word. Maps to the RBIT instruction.
rdar://9283021
llvm-svn: 211059
Jim Grosbach [Mon, 16 Jun 2014 21:55:35 +0000 (21:55 +0000)]
AArch64: Add backend intrinsic for rbit.
Define an intrinsic for the frontend to use and pattern match it to
the RBIT instruction.
rdar://9283021
llvm-svn: 211058
Jim Grosbach [Mon, 16 Jun 2014 21:55:30 +0000 (21:55 +0000)]
ARM: intrinsic support for rbit.
We already have an ARMISD node. Create an intrinsic to map to it so we can
add support for the frontend __rbit() intrinsic.
rdar://9283021
llvm-svn: 211057
Bill Schmidt [Mon, 16 Jun 2014 21:36:02 +0000 (21:36 +0000)]
[PPC64] Fix PR19893 - improve code generation for local function addresses
Rafael opened http://llvm.org/bugs/show_bug.cgi?id=19893 to track non-optimal
code generation for forming a function address that is local to the compile
unit. The existing code was treating both local and non-local functions
identically.
This patch fixes the problem by properly identifying local functions and
generating the proper addis/addi code. I also noticed that Rafael's earlier
changes to correct the surrounding code in PPCISelLowering.cpp were also
needed for fast instruction selection in PPCFastISel.cpp, so this patch
fixes that code as well.
The existing test/CodeGen/PowerPC/func-addr.ll is modified to test the new
code generation. I've added a -O0 run line to test the fast-isel code as
well.
Tested on powerpc64[le]-unknown-linux-gnu with no regressions.
llvm-svn: 211056
Eric Christopher [Mon, 16 Jun 2014 21:18:27 +0000 (21:18 +0000)]
Since the DataLayout is always found off of the subtarget go ahead
and query the base target machine implementation for it.
llvm-svn: 211055
Zachary Turner [Mon, 16 Jun 2014 20:54:28 +0000 (20:54 +0000)]
Clean up some unnecessary mutex guards.
These were being used as unreferenced parameters to enforce that
the methods must not be called without holding a mutex, but all
of the methods in question were internal, and the methods were
only exposed through an interface whose entire purpose was to
serialize access to these structures, so expecting the methods
to be accessed under a mutex is reasonable enough.
Reviewed by: blaikie
Differential Revision: http://reviews.llvm.org/D4162
llvm-svn: 211054
Sylvestre Ledru [Mon, 16 Jun 2014 20:51:40 +0000 (20:51 +0000)]
actually, just check if it is a file (including directory or symlink)
llvm-svn: 211053
Louis Gerbarg [Mon, 16 Jun 2014 20:31:50 +0000 (20:31 +0000)]
Improve comments for r211040
Added comment to clarify why we r211040 choose to bail out of fast isel instead
of generating a more complicated relocation, and fix mislabelled register in the
comments of the asan test case.
llvm-svn: 211052
Sylvestre Ledru [Mon, 16 Jun 2014 20:31:15 +0000 (20:31 +0000)]
Check that the directory does not exist.
Otherwise, it could allows local users to obtain sensitive information or
overwrite arbitrary files via a symlink attack on temporary directories with
predictable names.
Reported as CVE-2014-2893 ( https://security-tracker.debian.org/tracker/CVE-2014-2893 )
Found by Jakub Wilk
llvm-svn: 211051