platform/upstream/llvm.git
9 years agoDisable warnings in this test.
Rafael Espindola [Mon, 5 Jan 2015 18:19:35 +0000 (18:19 +0000)]
Disable warnings in this test.

This makes it a lot easier to read the output from FileCheck when it fails.

llvm-svn: 225190

9 years ago[PowerPC] Remove zexts after byte-swapping loads
Hal Finkel [Mon, 5 Jan 2015 18:09:06 +0000 (18:09 +0000)]
[PowerPC] Remove zexts after byte-swapping loads

lhbrx and lwbrx not only load their data with byte swapping, but also clear the
upper 32 bits (at least). As a result, they can be added to the PPCISelDAGToDAG
peephole optimization as frontier instructions for the removal of unnecessary
zero extensions.

llvm-svn: 225189

9 years ago[Hexagon] Adding round reg/imm and bitsplit instructions.
Colin LeMahieu [Mon, 5 Jan 2015 18:08:21 +0000 (18:08 +0000)]
[Hexagon] Adding round reg/imm and bitsplit instructions.

llvm-svn: 225188

9 years agoMake the Unwinder -Werror clean.
Dan Albert [Mon, 5 Jan 2015 18:07:36 +0000 (18:07 +0000)]
Make the Unwinder -Werror clean.

Mostly just format string fixes.
Tested clean on arm, x86, and x86_64 Linux.

llvm-svn: 225187

9 years agoSymbolRewriter: use iplist::splice
Saleem Abdulrasool [Mon, 5 Jan 2015 17:56:32 +0000 (17:56 +0000)]
SymbolRewriter: use iplist::splice

The swap implementation for iplist is currently unsupported.  Simply splice the
old list into place, which achieves the same purpose.  This is needed in order
to thread the -frewrite-map-file frontend option correctly.  NFC.

llvm-svn: 225186

9 years agoSymbolRewriter: 80-column
Saleem Abdulrasool [Mon, 5 Jan 2015 17:56:29 +0000 (17:56 +0000)]
SymbolRewriter: 80-column

Wrap a couple of lines.  NFC.

llvm-svn: 225185

9 years agofix cross compilation to 32 bit arm targets
Vince Harron [Mon, 5 Jan 2015 17:49:23 +0000 (17:49 +0000)]
fix cross compilation to 32 bit arm targets

llvm-svn: 225184

9 years ago[AArch64] Improve codegen of store lane instructions by avoiding GPR usage.
Ahmed Bougacha [Mon, 5 Jan 2015 17:10:26 +0000 (17:10 +0000)]
[AArch64] Improve codegen of store lane instructions by avoiding GPR usage.

We used to generate code similar to:

  umov.b        w8, v0[2]
  strb  w8, [x0, x1]

because the STR*ro* patterns were preferred to ST1*.
Instead, we can avoid going through GPRs, and generate:

  add   x8, x0, x1
  st1.b { v0 }[2], [x8]

This patch increases the ST1* AddedComplexity to achieve that.

rdar://16372710
Differential Revision: http://reviews.llvm.org/D6202

llvm-svn: 225183

9 years agoFix clash of gcc toolchains in driver regression tests.
Samuel Antao [Mon, 5 Jan 2015 17:07:42 +0000 (17:07 +0000)]
Fix clash of gcc toolchains in driver regression tests.

For some regression tests the path to the right toolchain is specified using the -sysroot switch. However, if clang was configured with a custom gcc toolchain (either by using GCC_INSTALL_PREFIX in cmake or the equivalent configure command), the path to the custom gcc toolchain path takes precedence to the one specified by sysroot. This causes several regression tests to fail as they will be using an unexpected path. This patch fixes this issue by adding --gcc-toolchain='' to all tests that rely on that. The empty string causes the driver to pick the path from sysroot instead.

llvm-svn: 225182

9 years ago[AArch64] Improve codegen of store lane 0 instructions by directly storing the subreg...
Ahmed Bougacha [Mon, 5 Jan 2015 17:02:28 +0000 (17:02 +0000)]
[AArch64] Improve codegen of store lane 0 instructions by directly storing the subregister.

For 0-lane stores, we used to generate code similar to:

  fmov w8, s0
  str w8, [x0, x1, lsl #2]

instead of:

  str s0, [x0, x1, lsl #2]

To correct that: for store lane 0 patterns, directly match to STR <subreg>0.

Byte-sized instructions don't have the special case for a 0 index,
because FPR8s are defined to have untyped content.

rdar://16372710
Differential Revision: http://reviews.llvm.org/D6772

llvm-svn: 225181

9 years agoFix dangling pointer in isDerivedFrom.
Samuel Benzaquen [Mon, 5 Jan 2015 15:26:42 +0000 (15:26 +0000)]
Fix dangling pointer in isDerivedFrom.

Summary:
Replace usage of StringRef with std::string in AST_MATCHER* generated
matchers to make sure they keep their own copy of the string.
The value could be a temporary and it causes the pointer to be dangling
by the time the matcher is executed.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 225180

9 years agollvm/test/lit.cfg: have_ld_plugin_support(): Use decode() for stdout.
NAKAMURA Takumi [Mon, 5 Jan 2015 14:18:04 +0000 (14:18 +0000)]
llvm/test/lit.cfg: have_ld_plugin_support(): Use decode() for stdout.

llvm-svn: 225171

9 years agoclang/CMakeLists.txt: Introduce LLVM_SHLIB_OUTPUT_INTDIR also here, or plugins tests...
NAKAMURA Takumi [Mon, 5 Jan 2015 14:06:14 +0000 (14:06 +0000)]
clang/CMakeLists.txt: Introduce LLVM_SHLIB_OUTPUT_INTDIR also here, or plugins tests might fail.

llvm-svn: 225170

9 years agoSelect lower fsub,fabs pattern to fabd on AArch64
Karthik Bhat [Mon, 5 Jan 2015 13:57:59 +0000 (13:57 +0000)]
Select lower fsub,fabs pattern to fabd on AArch64
This patch lowers patterns such as-
  fsub   v0.4s, v0.4s, v1.4s
  fabs   v0.4s, v0.4s
to
  fabd  v0.4s, v0.4s, v1.4s
on AArch64.

Review: http://reviews.llvm.org/D6791
llvm-svn: 225169

9 years agoFix formatting. NFC.
Rafael Espindola [Mon, 5 Jan 2015 13:44:59 +0000 (13:44 +0000)]
Fix formatting. NFC.

llvm-svn: 225168

9 years agoParse Tag_compatibility correctly.
Charlie Turner [Mon, 5 Jan 2015 13:26:37 +0000 (13:26 +0000)]
Parse Tag_compatibility correctly.

Tag_compatibility takes two arguments, but before this patch it would
erroneously accept just one, it now produces an error in that case.

Change-Id: I530f918587620d0d5dfebf639944d6083871ef7d
llvm-svn: 225167

9 years agoEmit the build attribute Tag_conformance.
Charlie Turner [Mon, 5 Jan 2015 13:12:17 +0000 (13:12 +0000)]
Emit the build attribute Tag_conformance.

Claim conformance to version 2.09 of the ARM ABI.

This build attribute must be emitted first amongst the build attributes when
written to an object file. This is to simplify conformance detection by
consumers.

Change-Id: If9eddcfc416bc9ad6e5cc8cdcb05d0031af7657e
llvm-svn: 225166

9 years agoSelect lower sub,abs pattern to sabd on AArch64
Karthik Bhat [Mon, 5 Jan 2015 13:11:07 +0000 (13:11 +0000)]
Select lower sub,abs pattern to sabd on AArch64

This patch lowers patterns such as-
  sub v0.4s, v0.4s, v1.4s
  abs v0.4s, v0.4s
to
  sabd v0.4s, v0.4s, v1.4s
on AArch64.

Review: http://reviews.llvm.org/D6781
llvm-svn: 225165

9 years agoFix broken test from r225159.
Michael Kuperstein [Mon, 5 Jan 2015 12:34:01 +0000 (12:34 +0000)]
Fix broken test from r225159.

llvm-svn: 225164

9 years ago[PM] Don't run the machinery of invalidating all the analysis passes
Chandler Carruth [Mon, 5 Jan 2015 12:32:11 +0000 (12:32 +0000)]
[PM] Don't run the machinery of invalidating all the analysis passes
when all are being preserved.

We want to short-circuit this for a couple of reasons. One, I don't
really want passes to grow a dependency on actually receiving their
invalidate call when they've been preserved. I'm thinking about removing
this entirely. But more importantly, preserving everything is likely to
be the common case in a lot of scenarios, and it would be really good to
bypass all of the invalidation and preservation machinery there.
Avoiding calling N opaque functions to try to invalidate things that are
by definition still valid seems important. =]

This wasn't really inpsired by much other than seeing the spam in the
logging for analyses, but it seems better ot get it checked in rather
than forgetting about it.

llvm-svn: 225163

9 years ago[PM] Add names and debug logging for analysis passes to the new pass
Chandler Carruth [Mon, 5 Jan 2015 12:21:44 +0000 (12:21 +0000)]
[PM] Add names and debug logging for analysis passes to the new pass
manager.

This starts to allow us to test analyses more easily, but it's really
only the beginning. Some of the code here is still untestable without
manual changes to create analysis passes, but I wanted to factor it into
a small of chunks as possible.

Next up in order to be able to test things are, in no particular order:
- No-op analyses passes so we don't have to use real ones to exercise
  the pass maneger itself.
- Automatic way of generating dummy passes that require an analysis be
  run, including a variant that calls a 'print' method on a pass to make
  it even easier to print out the results of an analysis.
- Dummy passes that invalidate all analyses for their IR unit so we can
  test invalidation and re-runs.
- Automatic way to print each analysis pass as it is re-run.
- Automatic but optional verification of analysis passes everywhere
  possible.

I'm not claiming I'll get to all of these immediately, but that's what
is in the pipeline at some stage. I'm fleshing out exactly what I need
and what to prioritize by working on converting analyses and then trying
to test the conversion. =]

llvm-svn: 225162

9 years agoclang-format: [Java] Fix incorrect detection of cast.
Daniel Jasper [Mon, 5 Jan 2015 10:33:39 +0000 (10:33 +0000)]
clang-format: [Java] Fix incorrect detection of cast.

After:
  return (a instanceof List<?>) ? aaaaaaaaaaaaaaaaaaaaaaa(
                                      aaaaaaaaaaaaaaaaaaaaa)
                                : aaaaaaaaaaaaaaaaaaaaaaa;

After:
  return (a instanceof List<?>)
      ? aaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaaa)
      : aaaaaaaaaaaaaaaaaaaaaaa;

llvm-svn: 225161

9 years agoReplace several 'assert(false' with 'llvm_unreachable' or fold a condition into the...
Craig Topper [Mon, 5 Jan 2015 10:15:49 +0000 (10:15 +0000)]
Replace several 'assert(false' with 'llvm_unreachable' or fold a condition into the assert.

llvm-svn: 225160

9 years agoFixed a bug in memory dependence checking module of loop vectorization. The following...
Jiangning Liu [Mon, 5 Jan 2015 10:08:58 +0000 (10:08 +0000)]
Fixed a bug in memory dependence checking module of loop vectorization. The following loop should not be vectorized with current algorithm.

{code}
// loop body
   ... = a[i]          (1)
    ... = a[i+1]       (2)
 .......
a[i+1] = ....          (3)
   a[i] = ...          (4)
{code}

The algorithm tries to collect memory access candidates from AliasSetTracker, and then check memory dependences one another. The memory accesses are unique in AliasSetTracker, and a single memory access in AliasSetTracker may map to multiple entries in AccessAnalysis, which could cover both 'read' and 'write'. Originally the algorithm only checked 'write' entry in Accesses if only 'write' exists. This is incorrect and the consequence is it ignored all read access, and finally some RAW and WAR dependence are missed.

For the case given above, if we ignore two reads, the dependence between (1) and (3) would not be able to be captured, and finally this loop will be incorrectly vectorized.

The fix simply inserts a new loop to find all entries in Accesses. Since it will skip most of all other memory accesses by checking the Value pointer at the very beginning of the loop, it should not increase compile-time visibly.

llvm-svn: 225159

9 years agoConvert SmallMapVector from a class to a struct.
Michael Gottesman [Mon, 5 Jan 2015 08:55:19 +0000 (08:55 +0000)]
Convert SmallMapVector from a class to a struct.

llvm-svn: 225158

9 years ago[X86] Remove the predicates from the register forms of the 2-byte inc and dec instruc...
Craig Topper [Mon, 5 Jan 2015 08:19:12 +0000 (08:19 +0000)]
[X86] Remove the predicates from the register forms of the 2-byte inc and dec instructions. Remove the 32-bit mode only versions that existed for the disassembler. Move the patterns out of the instructions so they can still be qualified with predicates.

llvm-svn: 225157

9 years ago[X86] Simplify code a little by just summing flags instead of conditionally increment...
Craig Topper [Mon, 5 Jan 2015 08:19:10 +0000 (08:19 +0000)]
[X86] Simplify code a little by just summing flags instead of conditionally incrementing. NFC

llvm-svn: 225156

9 years ago[X86] Remove unnecessary redeclaration of a variable with the same assignment as...
Craig Topper [Mon, 5 Jan 2015 08:19:07 +0000 (08:19 +0000)]
[X86] Remove unnecessary redeclaration of a variable with the same assignment as the beginning of the function. NFC.

llvm-svn: 225155

9 years ago[X86] Remove a strange fixme referring to a hack that doesn't seem to exist since...
Craig Topper [Mon, 5 Jan 2015 08:19:05 +0000 (08:19 +0000)]
[X86] Remove a strange fixme referring to a hack that doesn't seem to exist since the code is in a comment. Can't figure out what the body of the 'if' was supposed to be anyway.

llvm-svn: 225154

9 years ago[x86] Reduce text duplication for similar operand class declarations in tablegen...
Craig Topper [Mon, 5 Jan 2015 08:19:03 +0000 (08:19 +0000)]
[x86] Reduce text duplication for similar operand class declarations in tablegen instruction info. No functional change intended.

llvm-svn: 225153

9 years ago[X86] Fix the immediate size to match the address size in the operand types for the...
Craig Topper [Mon, 5 Jan 2015 08:18:59 +0000 (08:18 +0000)]
[X86] Fix the immediate size to match the address size in the operand types for the move to/from absolute memory instructions.

llvm-svn: 225152

9 years ago[X86] Remove unused operand type from disassembler handling. NFC
Craig Topper [Mon, 5 Jan 2015 08:18:52 +0000 (08:18 +0000)]
[X86] Remove unused operand type from disassembler handling. NFC

llvm-svn: 225151

9 years ago[PowerPC] Enable speculation of cttz/ctlz
Hal Finkel [Mon, 5 Jan 2015 05:24:42 +0000 (05:24 +0000)]
[PowerPC] Enable speculation of cttz/ctlz

PPC has an instruction for ctlz with defined zero behavior, and our lowering of
cttz (provided by DAGCombine) is also efficient and branchless, so speculating
these makes sense.

llvm-svn: 225150

9 years ago[SROA] Apply a somewhat heavy and unpleasant hammer to fix PR22093, an
Chandler Carruth [Mon, 5 Jan 2015 04:17:53 +0000 (04:17 +0000)]
[SROA] Apply a somewhat heavy and unpleasant hammer to fix PR22093, an
assert out of the new pre-splitting in SROA.

This fix makes the code do what was originally intended -- when we have
a store of a load both dealing in the same alloca, we force them to both
be pre-split with identical offsets. This is really quite hard to do
because we can keep discovering problems as we go along. We have to
track every load over the current alloca which for any resaon becomes
invalid for pre-splitting, and go back to remove all stores of those
loads. I've included a couple of test cases derived from PR22093 that
cover the different ways this can happen. While that PR only really
triggered the first of these two, its the same fundamental issue.

The other challenge here is documented in a FIXME now. We end up being
quite a bit more aggressive for pre-splitting when loads and stores
don't refer to the same alloca. This aggressiveness comes at the cost of
introducing potentially redundant loads. It isn't clear that this is the
right balance. It might be considerably better to require that we only
do pre-splitting when we can presplit every load and store involved in
the entire operation. That would give more consistent if conservative
results. Unfortunately, it requires a non-trivial change to the actual
pre-splitting operation in order to correctly handle cases where we end
up pre-splitting stores out-of-order. And it isn't 100% clear that this
is the right direction, although I'm starting to suspect that it is.

llvm-svn: 225149

9 years ago[LangRef] Correct a typo
Hal Finkel [Mon, 5 Jan 2015 04:05:21 +0000 (04:05 +0000)]
[LangRef] Correct a typo

llvm-svn: 225148

9 years ago[PowerPC] Materialize i64 constants using rotation with masking
Hal Finkel [Mon, 5 Jan 2015 03:41:38 +0000 (03:41 +0000)]
[PowerPC] Materialize i64 constants using rotation with masking

r225135 added the ability to materialize i64 constants using rotations in order
to reduce the instruction count. Sometimes we can use a rotation only with some
extra masking, so that we take advantage of the fact that generating a bunch of
extra higher-order 1 bits is easy using li/lis.

llvm-svn: 225147

9 years ago[PM] Cleanup a place where I forgot to update the header guards when
Chandler Carruth [Mon, 5 Jan 2015 03:03:31 +0000 (03:03 +0000)]
[PM] Cleanup a place where I forgot to update the header guards when
renaming a file from AssumptionTracker.h to AssumptionCache.h.

Thanks to Philip Reames for noticing and pointing it out in code review!

llvm-svn: 225146

9 years ago[PM] Switch the new pass manager to use a reference-based API for IR
Chandler Carruth [Mon, 5 Jan 2015 02:47:05 +0000 (02:47 +0000)]
[PM] Switch the new pass manager to use a reference-based API for IR
units.

This was debated back and forth a bunch, but using references is now
clearly cleaner. Of all the code written using pointers thus far, in
only one place did it really make more sense to have a pointer. In most
cases, this just removes immediate dereferencing from the code. I think
it is much better to get errors on null IR units earlier, potentially
at compile time, than to delay it.

Most notably, the legacy pass manager uses references for its routines
and so as more and more code works with both, the use of pointers was
likely to become really annoying. I noticed this when I ported the
domtree analysis over and wrote the entire thing with references only to
have it fail to compile. =/ It seemed better to switch now than to
delay. We can, of course, revisit this is we learn that references are
really problematic in the API.

llvm-svn: 225145

9 years ago[PM] Wire up support for explicitly running the verifier pass.
Chandler Carruth [Mon, 5 Jan 2015 00:08:53 +0000 (00:08 +0000)]
[PM] Wire up support for explicitly running the verifier pass.

The required functionality has been there for some time, but I never
managed to actually wire it into the command line registry of passes.
Let's do that.

llvm-svn: 225144

9 years ago[PM] Cleanup a const_cast and other machinery left over in this code
Chandler Carruth [Sun, 4 Jan 2015 23:13:57 +0000 (23:13 +0000)]
[PM] Cleanup a const_cast and other machinery left over in this code
from before I removed thet non-const use of the function.

The unused variable that held the const_cast was already kindly removed
by Michael.

llvm-svn: 225143

9 years agoclang-format: [Java] Fix incorrect recognition of annonymous classes.
Daniel Jasper [Sun, 4 Jan 2015 20:40:51 +0000 (20:40 +0000)]
clang-format: [Java] Fix incorrect recognition of annonymous classes.

Before:
  someFunction(new Runnable() { public void run() { System.out.println(42);
  }
  });

After:
  someFunction(new Runnable() {
    public void run() {
      System.out.println(42);
    }
  });

llvm-svn: 225142

9 years agoclang-format: [Java] Change a few flags for Google's Java style.
Daniel Jasper [Sun, 4 Jan 2015 20:40:45 +0000 (20:40 +0000)]
clang-format: [Java] Change a few flags for Google's Java style.

No tests added as all of these are already tested separately.

llvm-svn: 225141

9 years agoRemove an assert that's not true on invalid code.
Nico Weber [Sun, 4 Jan 2015 20:32:12 +0000 (20:32 +0000)]
Remove an assert that's not true on invalid code.

r185773 added an assert that checked that a CXXUnresolvedConstructExpr either
has a valid rparen, or exactly one argument.  This doesn't have to be true for
invalid inputs.  Convert the assert to an if, and add a test for this case.

Found by SLi's afl bot.

llvm-svn: 225140

9 years agoPECOFF: adjust the entry point on ARM NT
Saleem Abdulrasool [Sun, 4 Jan 2015 20:26:45 +0000 (20:26 +0000)]
PECOFF: adjust the entry point on ARM NT

ARM NT assumes a purely THUMB execution, and as such requires that the address
of entry point is adjusted to indicate a thumb entry point.  Unconditionally
adjust the AddressOfEntryPoint in the PE header for PE/COFF ARM as we only
support ARM NT at the moment.

llvm-svn: 225139

9 years ago[X86][SSE] Added vector packing test for pr12412
Simon Pilgrim [Sun, 4 Jan 2015 19:08:03 +0000 (19:08 +0000)]
[X86][SSE] Added vector packing test for pr12412

llvm-svn: 225138

9 years ago[X86][SSE] Added vector integer truncation tests - based off pr15524
Simon Pilgrim [Sun, 4 Jan 2015 17:52:00 +0000 (17:52 +0000)]
[X86][SSE] Added vector integer truncation tests - based off pr15524

llvm-svn: 225137

9 years agoTypo.
Joerg Sonnenberger [Sun, 4 Jan 2015 16:38:20 +0000 (16:38 +0000)]
Typo.

llvm-svn: 225136

9 years ago[PowerPC] Materialize i64 constants using rotation
Hal Finkel [Sun, 4 Jan 2015 15:43:55 +0000 (15:43 +0000)]
[PowerPC] Materialize i64 constants using rotation

Materializing full 64-bit constants on PPC64 can be expensive, requiring up to
5 instructions depending on the locations of the non-zero bits. Sometimes
materializing a rotated constant, and then applying the inverse rotation, requires
fewer instructions than the direct method. If so, do that instead.

In r225132, I added support for forming constants using bit inversion. In
effect, this reverts that commit and replaces it with rotation support. The bit
inversion is useful for turning constants that are mostly ones into ones that
are mostly zeros (thus enabling a more-efficient shift-based materialization),
but the same effect can be obtained by using negative constants and a rotate,
and that is at least as efficient, if not more.

llvm-svn: 225135

9 years agoFix default image name to 'a.exe' on Windows, instead 'a.out'.
Yaron Keren [Sun, 4 Jan 2015 13:48:30 +0000 (13:48 +0000)]
Fix default image name to 'a.exe' on Windows, instead 'a.out'.
This applies to mingw as clang-cl already has its own logic for the filename.

llvm-svn: 225134

9 years agoFix unused variable warning for non-asserts builds. NFC.
Michael Kuperstein [Sun, 4 Jan 2015 13:35:44 +0000 (13:35 +0000)]
Fix unused variable warning for non-asserts builds. NFC.

llvm-svn: 225133

9 years ago[PowerPC] Materialize i64 constants using bit inversion
Hal Finkel [Sun, 4 Jan 2015 12:35:03 +0000 (12:35 +0000)]
[PowerPC] Materialize i64 constants using bit inversion

Materializing full 64-bit constants on PPC64 can be expensive, requiring up to
5 instructions depending on the locations of the non-zero bits. Sometimes
materializing the bit-reversed constant, and then flipping the bits, requires
fewer instructions than the direct method. If so, do that instead.

llvm-svn: 225132

9 years ago[PM] Split the AssumptionTracker immutable pass into two separate APIs:
Chandler Carruth [Sun, 4 Jan 2015 12:03:27 +0000 (12:03 +0000)]
[PM] Split the AssumptionTracker immutable pass into two separate APIs:
a cache of assumptions for a single function, and an immutable pass that
manages those caches.

The motivation for this change is two fold. Immutable analyses are
really hacks around the current pass manager design and don't exist in
the new design. This is usually OK, but it requires that the core logic
of an immutable pass be reasonably partitioned off from the pass logic.
This change does precisely that. As a consequence it also paves the way
for the *many* utility functions that deal in the assumptions to live in
both pass manager worlds by creating an separate non-pass object with
its own independent API that they all rely on. Now, the only bits of the
system that deal with the actual pass mechanics are those that actually
need to deal with the pass mechanics.

Once this separation is made, several simplifications become pretty
obvious in the assumption cache itself. Rather than using a set and
callback value handles, it can just be a vector of weak value handles.
The callers can easily skip the handles that are null, and eventually we
can wrap all of this up behind a filter iterator.

For now, this adds boiler plate to the various passes, but this kind of
boiler plate will end up making it possible to port these passes to the
new pass manager, and so it will end up factored away pretty reasonably.

llvm-svn: 225131

9 years agoclang-format: Re-enable comment re-indentation for Java/JS.
Daniel Jasper [Sun, 4 Jan 2015 09:11:17 +0000 (09:11 +0000)]
clang-format: Re-enable comment re-indentation for Java/JS.

This was broken by r224120.

llvm-svn: 225130

9 years agoFix indentation. No behavior change.
Nico Weber [Sun, 4 Jan 2015 08:07:54 +0000 (08:07 +0000)]
Fix indentation. No behavior change.

llvm-svn: 225129

9 years agoWrap to 80 columns, no behavior change.
Nico Weber [Sun, 4 Jan 2015 07:59:35 +0000 (07:59 +0000)]
Wrap to 80 columns, no behavior change.

llvm-svn: 225128

9 years agoInstCombine: match can find ConstantExprs, don't assume we have a Value
David Majnemer [Sun, 4 Jan 2015 07:36:02 +0000 (07:36 +0000)]
InstCombine: match can find ConstantExprs, don't assume we have a Value

We assumed the output of a match was a Value, this would cause us to
assert because we would fail a cast<>.  Instead, use a helper in the
Operator family to hide the distinction between Value and Constant.

This fixes PR22087.

llvm-svn: 225127

9 years agoValueTracking: ComputeNumSignBits should tolerate misshapen phi nodes
David Majnemer [Sun, 4 Jan 2015 07:06:53 +0000 (07:06 +0000)]
ValueTracking: ComputeNumSignBits should tolerate misshapen phi nodes

PHI nodes can have zero operands in the middle of a transform.  It is
expected that utilities in Analysis don't freak out when this happens.

Note that it is considered invalid to allow these misshapen phi nodes to
make it to another pass.

This fixes PR22086.

llvm-svn: 225126

9 years agoDocument that GetTypeForDeclarator() cannot return a null type.
Nico Weber [Sun, 4 Jan 2015 05:29:21 +0000 (05:29 +0000)]
Document that GetTypeForDeclarator() cannot return a null type.

Also add a few asserts for this.  The existing code assumes this in a bunch
of places already (see e.g. the assert at the top of ParseTypedefDecl(), and
there are many unchecked calls on the result of GetTypeForDeclarator()), and
from looking through the code this should always be true from what I can tell.
This allows removing ASTContext::getNullTypeSourceInfo() too as that's now
unused.

No behavior change intended.

llvm-svn: 225125

9 years agoCrash less enthusiasticially on _Atomic or __restrict__ on invalid types.
Nico Weber [Sun, 4 Jan 2015 04:53:10 +0000 (04:53 +0000)]
Crash less enthusiasticially on _Atomic or __restrict__ on invalid types.

Many places in Sema cannot handle isNull() types.  This is fine, because in
most places the type building code recovers by falling back to IntTy.  In
GetFullTypeForDeclarator(), this is done at the end of the getNumTypeObjects()
loop body.  This function calls BuildQualifiedType() before this fallback is
done though, so it explicitly needs to check for isNull() types.

llvm-svn: 225124

9 years ago[APFloat][ADT] Fix sign handling logic for FMA results that truncate to zero.
Lang Hames [Sun, 4 Jan 2015 01:20:55 +0000 (01:20 +0000)]
[APFloat][ADT] Fix sign handling logic for FMA results that truncate to zero.

This patch adds a check for underflow when truncating results back to lower
precision at the end of an FMA. The additional sign handling logic in
APFloat::fusedMultiplyAdd should only be performed when the result of the
addition step of the FMA (in full precision) is exactly zero, not when the
result underflows to zero.

Unit tests for this case and related signed zero FMA results are included.

Fixes <rdar://problem/18925551>.

llvm-svn: 225123

9 years agoWrap to 80 columns, no behavior change.
Nico Weber [Sun, 4 Jan 2015 00:47:22 +0000 (00:47 +0000)]
Wrap to 80 columns, no behavior change.

llvm-svn: 225122

9 years agoAST: Remove overzealous assertion from IsModifiable
David Majnemer [Sun, 4 Jan 2015 00:44:32 +0000 (00:44 +0000)]
AST: Remove overzealous assertion from IsModifiable

It's reasonable to ask if an l-value with class type is modifiable.

llvm-svn: 225121

9 years agollvm-readobj: add support to dump COFF export tables
Saleem Abdulrasool [Sat, 3 Jan 2015 21:35:09 +0000 (21:35 +0000)]
llvm-readobj: add support to dump COFF export tables

This enhances llvm-readobj to print out the COFF export table, similar to the
-coff-import option.  This is useful for testing in lld.

llvm-svn: 225120

9 years agoARM: permit tail calls to weak externals on COFF
Saleem Abdulrasool [Sat, 3 Jan 2015 21:35:00 +0000 (21:35 +0000)]
ARM: permit tail calls to weak externals on COFF

Weak externals are resolved statically, so we can actually generate the tail
call on PE/COFF targets without breaking the requirements.  It is questionable
whether we want to propagate the current behaviour for MachO as the requirements
are part of the ARM ELF specifications, and it seems that prior to the SVN
r215890, we would have tail'ed the call.  For now, be conservative and only
permit it on PE/COFF where the call will always be fully resolved.

llvm-svn: 225119

9 years agoParse: __attribute__((keyword)) shouldn't error
David Majnemer [Sat, 3 Jan 2015 19:41:00 +0000 (19:41 +0000)]
Parse: __attribute__((keyword)) shouldn't error

Weird constructs like __attribute__((inline)) or
__attibute__((typename)) should result in warnings, not errors.

llvm-svn: 225118

9 years ago[PowerPC/BlockPlacement] Allow target to provide a per-loop alignment preference
Hal Finkel [Sat, 3 Jan 2015 17:58:24 +0000 (17:58 +0000)]
[PowerPC/BlockPlacement] Allow target to provide a per-loop alignment preference

The existing code provided for specifying a global loop alignment preference.
However, the preferred loop alignment might depend on the loop itself. For
recent POWER cores, loops between 5 and 8 instructions should have 32-byte
alignment (while the others are better with 16-byte alignment) so that the
entire loop will fit in one i-cache line.

To support this, getPrefLoopAlignment has been made virtual, and can be
provided with an optional MachineLoop* so the target can inspect the loop
before answering the query. The default behavior, as before, is to return the
value set with setPrefLoopAlignment. MachineBlockPlacement now queries the
target for each loop instead of only once per function. There should be no
functional change for other targets.

llvm-svn: 225117

9 years agoVolatile reads are side-effecting operations, but in the general case of access throu...
Aaron Ballman [Sat, 3 Jan 2015 17:00:12 +0000 (17:00 +0000)]
Volatile reads are side-effecting operations, but in the general case of access through a volatile-qualified type, we're not certain of the underlying object's side-effects on access.

Treat volatile accesses as "maybe" instead of "definite" side effects for the purposes of warning on evaluations in an unevaluated context. No longer diagnose on idiomatic code like:

int * volatile v;
(void)sizeof(*v);

llvm-svn: 225116

9 years ago[PowerPC] Use 16-byte alignment for modern cores for functions/loops
Hal Finkel [Sat, 3 Jan 2015 14:58:25 +0000 (14:58 +0000)]
[PowerPC] Use 16-byte alignment for modern cores for functions/loops

Most modern PowerPC cores prefer that functions and loops start on
16-byte-aligned boundaries (*), so instruct block placement, etc. to make this
happen. The branch selector has also been adjusted so account for the extra
nops that might now be inserted before loop headers.

(*) Some cores actually prefer other alignments for small loops, but that will
    be addressed in a follow-up commit.

llvm-svn: 225115

9 years agoMinor cleanup to all the switches after MatchInstructionImpl in all the AsmParsers.
Craig Topper [Sat, 3 Jan 2015 08:16:34 +0000 (08:16 +0000)]
Minor cleanup to all the switches after MatchInstructionImpl in all the AsmParsers.

Make sure they all have llvm_unreachable on the default path out of the switch. Remove unnecessary "default: break". Remove a 'return' after unreachable. Fix some indentation.

llvm-svn: 225114

9 years agoFix some formatting in tablegen output.
Craig Topper [Sat, 3 Jan 2015 08:16:29 +0000 (08:16 +0000)]
Fix some formatting in tablegen output.

llvm-svn: 225113

9 years agoReplace some 'unreachable' comments with llvm_unreachable.
Craig Topper [Sat, 3 Jan 2015 08:16:14 +0000 (08:16 +0000)]
Replace some 'unreachable' comments with llvm_unreachable.

llvm-svn: 225112

9 years agoRemove TSAN_DEBUG in favor of SANITIZER_DEBUG.
Alexey Samsonov [Sat, 3 Jan 2015 04:29:12 +0000 (04:29 +0000)]
Remove TSAN_DEBUG in favor of SANITIZER_DEBUG.

llvm-svn: 225111

9 years agoReplace DCHECK with DCHECK_LE where appropriate.
Alexey Samsonov [Sat, 3 Jan 2015 04:29:05 +0000 (04:29 +0000)]
Replace DCHECK with DCHECK_LE where appropriate.

llvm-svn: 225110

9 years agoValueTracking: Make computeKnownBits for Arguments a little more clear
David Majnemer [Sat, 3 Jan 2015 02:33:25 +0000 (02:33 +0000)]
ValueTracking: Make computeKnownBits for Arguments a little more clear

We would sometimes leave the out-param APInts untouched while going
through computeKnownBits.  While I don't know of a way to trigger a bug
involving this in practice, it goes against the overall design of
computeKnownBits.

Found via code inspection.

llvm-svn: 225109

9 years ago[asan/tracing] extend the test a bit more, simplify the tracing code, add a guard...
Kostya Serebryany [Sat, 3 Jan 2015 02:07:58 +0000 (02:07 +0000)]
[asan/tracing] extend the test a bit more, simplify the tracing code, add a guard page to trace array, fix the trace IDs before dumping

llvm-svn: 225108

9 years ago[asan] extend coverage-tracing.cc test
Kostya Serebryany [Sat, 3 Jan 2015 01:41:11 +0000 (01:41 +0000)]
[asan] extend coverage-tracing.cc test

llvm-svn: 225107

9 years ago[PowerPC] Add support for the CMPB instruction
Hal Finkel [Sat, 3 Jan 2015 01:16:37 +0000 (01:16 +0000)]
[PowerPC] Add support for the CMPB instruction

Newer POWER cores, and the A2, support the cmpb instruction. This instruction
compares its operands, treating each of the 8 bytes in the GPRs separately,
returning a 'mask' result of 0 (for false) or -1 (for true) in each byte.

Code generation support is added, in the form of a PPCISelDAGToDAG
DAG-preprocessing routine, that recognizes patterns close to what the
instruction computes (either exactly, or related by a constant masking
operation), and generates the cmpb instruction (along with any necessary
constant masking operation). This can be expanded if use cases arise.

llvm-svn: 225106

9 years agotest: correct PE/COFF tests to build under MSVC mode
Saleem Abdulrasool [Sat, 3 Jan 2015 00:57:14 +0000 (00:57 +0000)]
test: correct PE/COFF tests to build under MSVC mode

This adjusts the inputs to be compatible with armv7-windows-msvc as well as
armv7-windows-itanium.  NFC.

llvm-svn: 225105

9 years agoReaderWriter: adjust ARM target addresses for exec
Saleem Abdulrasool [Sat, 3 Jan 2015 00:57:10 +0000 (00:57 +0000)]
ReaderWriter: adjust ARM target addresses for exec

ARM NT assumes a THUMB only environment.  As such, any address that is detected
as residing in an executable section is adjusted to have its bottom bit set to
indicate THUMB in case of a mode exchange.

Although the testing here seems insufficient (missing the negative cases) the
existing test cases for the IMAGE_REL_ARM_{ADDR32,MOV32T} are relevant as they
ensure that we do not incorrectly set the bit.

llvm-svn: 225104

9 years ago[asan] simplify the tracing code, make it use the same guard variables as coverage
Kostya Serebryany [Sat, 3 Jan 2015 00:54:43 +0000 (00:54 +0000)]
[asan] simplify the tracing code, make it use the same guard variables as coverage

llvm-svn: 225103

9 years agoRemove -Werror from test.
Rafael Espindola [Sat, 3 Jan 2015 00:28:47 +0000 (00:28 +0000)]
Remove -Werror from test.

It is not needed since we FileCheck for the warning and -Werror itself can end up
unused.

llvm-svn: 225102

9 years agoReally don't warn about -flto/fno-lto :-(
Rafael Espindola [Sat, 3 Jan 2015 00:06:04 +0000 (00:06 +0000)]
Really don't warn about -flto/fno-lto :-(

This should fix the last bots.

llvm-svn: 225100

9 years ago[X86] Disassembler support for move to/from %rax with a 32-bit memory offset is REX...
Craig Topper [Sat, 3 Jan 2015 00:00:20 +0000 (00:00 +0000)]
[X86] Disassembler support for move to/from %rax with a 32-bit memory offset is REX.W and AdSize prefix are both present.

llvm-svn: 225099

9 years ago[X86] Use 32-bit sign extended immediate for 64-bit LOCK_ArithBinOp with sign extende...
Craig Topper [Sat, 3 Jan 2015 00:00:14 +0000 (00:00 +0000)]
[X86] Use 32-bit sign extended immediate for 64-bit LOCK_ArithBinOp with sign extended immediate.

llvm-svn: 225098

9 years ago[PM] Add proper documentation for the ModulePassManager and
Chandler Carruth [Fri, 2 Jan 2015 23:34:39 +0000 (23:34 +0000)]
[PM] Add proper documentation for the ModulePassManager and
FunctionPassManager. These never got documented, likely due to the
clutter of this header file. This fixes another problem people noticed
when they started trying to use the new pass manager.

I've also used this to document the aspirational constraints I would
like to hold passes to. I don't really have a better place to document
such things at this point, but eventually will probably create a proper
.rst file and page for the LLVM pass infrastructure that carries such
high-level concerns.

llvm-svn: 225097

9 years ago[PM] Actually include the correct file name. Sorry for the breakage.
Chandler Carruth [Fri, 2 Jan 2015 23:25:16 +0000 (23:25 +0000)]
[PM] Actually include the correct file name. Sorry for the breakage.

llvm-svn: 225096

9 years agoAlso avoid warning on -flto/-fno-lto on linux.
Rafael Espindola [Fri, 2 Jan 2015 23:23:52 +0000 (23:23 +0000)]
Also avoid warning on -flto/-fno-lto on linux.

On OS X a .s file is preprocessed, it is not on linux, which is why the warning was still
showing up on linux but not OS X.

llvm-svn: 225095

9 years ago[PM] Lift the majority of the template boilerplate used to implement the
Chandler Carruth [Fri, 2 Jan 2015 23:16:59 +0000 (23:16 +0000)]
[PM] Lift the majority of the template boilerplate used to implement the
concept-based polymorphism in the pass manager to a separate header.

I got feedback from someone reading the code and trying to use it that
this was really making it hard to dive in and start using these APIs and
that makes a lot of sense.

This only requires a moderate amount of gymnastics to separate in this
way, namely rinsing the PreservedAnalysis object through a template
argument in a few places so that it is dependent and we only examine it
on instantiation.

llvm-svn: 225094

9 years agoDon't warn on unused -fno-lto.
Rafael Espindola [Fri, 2 Jan 2015 22:56:15 +0000 (22:56 +0000)]
Don't warn on unused -fno-lto.

It is somewhat common for CFLAGS to be used with .s files. We were
already ignoring -flto. This patch just does the same for -fno-lto.

llvm-svn: 225093

9 years ago[PM] Fix some formatting where clang-format has improved recently.
Chandler Carruth [Fri, 2 Jan 2015 22:51:44 +0000 (22:51 +0000)]
[PM] Fix some formatting where clang-format has improved recently.

llvm-svn: 225092

9 years agoDebugInfo: Provide a less subtle way to set the debug location of simple ret instructions
David Blaikie [Fri, 2 Jan 2015 22:07:26 +0000 (22:07 +0000)]
DebugInfo: Provide a less subtle way to set the debug location of simple ret instructions

un-XFAILing the test XFAIL'd in r225086 after it regressed in r225083.

llvm-svn: 225090

9 years agoDriver: honour the clang-cl behaviour on ARM as well
Saleem Abdulrasool [Fri, 2 Jan 2015 21:47:33 +0000 (21:47 +0000)]
Driver: honour the clang-cl behaviour on ARM as well

Unfortunately, MSVC does not indicate to the driver what target is being used.
This means that we cannot correctly select the target architecture for the
clang_rt component.  This breaks down when targeting windows with the clang
driver as opposed to the clang-cl driver.  This should fix the native ARM
buildbot tests.

llvm-svn: 225089

9 years agoRevert "Revert r224736: "[Sanitizer] Make CommonFlags immutable after initialization.""
Alexey Samsonov [Fri, 2 Jan 2015 21:28:37 +0000 (21:28 +0000)]
Revert "Revert r224736: "[Sanitizer] Make CommonFlags immutable after initialization.""

Fix test failures by introducing CommonFlags::CopyFrom() to make sure
compiler doesn't insert memcpy() calls into runtime code.

Original commit message:
Protect CommonFlags singleton by adding const qualifier to
common_flags() accessor. The only ways to modify the flags are
SetCommonFlagsDefaults(), ParseCommonFlagsFromString() and
OverrideCommonFlags() functions, which are only supposed to be
called during initialization.

llvm-svn: 225088

9 years agoDriver: reuse getCompilerRT in place of addSanitizerRTWindows
Saleem Abdulrasool [Fri, 2 Jan 2015 20:00:55 +0000 (20:00 +0000)]
Driver: reuse getCompilerRT in place of addSanitizerRTWindows

The logic for addSanitizerRTWindows was performing the same logical operation as
getCompilerRT, which was previously fully generalised for Linux and Windows.
This avoids having a duplication of the logic for building up the name of a
clang_rt component.  This change does move the current limitation for Windows
into getArchNameForCompilerRTLib, where it is assumed that the architecture for
Windows is always i386.

llvm-svn: 225087

9 years agoTemporarily XFAIL fallout from r225083 while investigating.
David Blaikie [Fri, 2 Jan 2015 19:49:28 +0000 (19:49 +0000)]
Temporarily XFAIL fallout from r225083 while investigating.

Between this behavior and that fixed by r225083/r225000, I'll take the
latter over the former for now, but I'm immediately working on
understanding/addressing this behavior too.

(the fact that the code change in r225083 caused this change in behavior
is a bit troubling anyway - given that it looks & claims to be just a
preformance thing)

llvm-svn: 225086

9 years agoDebugInfo: Remove some now-unnecessary location handling around function arguments.
David Blaikie [Fri, 2 Jan 2015 19:49:10 +0000 (19:49 +0000)]
DebugInfo: Remove some now-unnecessary location handling around function arguments.

r225000 generalized debug info line info handling for expressions such
that this code is no longer necessary.

This removes the last use of CGDebugInfo::getLocation, but not all the
uses of CGDebugInfo::CurLoc, which is still used internally in
CGDebugInfo. I'd like to do away with all of that & might succeed after
a few more patches.

llvm-svn: 225085

9 years agoReformat statepoint documentation and fix a couple of typos
Philip Reames [Fri, 2 Jan 2015 19:46:49 +0000 (19:46 +0000)]
Reformat statepoint documentation and fix a couple of typos

Patch by Ramkumar Ramachandra <artagnon@gmail.com>.

llvm-svn: 225084

9 years agoDebugInfo: Fix cases where location failed to be updated after r225000
David Blaikie [Fri, 2 Jan 2015 19:06:25 +0000 (19:06 +0000)]
DebugInfo: Fix cases where location failed to be updated after r225000

The optimization (that appears to have been here since the earliest
implementation (r50848) & has become more complicated over the years) to
avoid recreating the debugloc if it would be the same was out of date
because ApplyDebugLocation was not re-updating the CurLoc/PrevLoc. This
optimization doesn't look terribly beneficial/necessary, so I'm removing
it - if it turns up in benchmarks, I'm happy to reconsider/reimplement
this with justification, but for now it just seems to add
complexity/problems.

llvm-svn: 225083

9 years agoReaderWriter: teach the writer about IMAGE_REL_ARM_BRANCH24T
Saleem Abdulrasool [Fri, 2 Jan 2015 18:51:59 +0000 (18:51 +0000)]
ReaderWriter: teach the writer about IMAGE_REL_ARM_BRANCH24T

This adds support for IMAGE_REL_ARM_BRANCH24T relocations.  Similar to the
IMAGE_REL_ARM_BLX32T relocation, this relocation requires munging an
instruction.  The instruction encoding is quite similar, allowing us to reuse
the same munging implementation.  This is needed by the entry point stubs for
modules provided by MSVCRT.

llvm-svn: 225082

9 years agoReaderWriter: teach the writer about IMAGE_REL_ARM_BLX23T
Saleem Abdulrasool [Fri, 2 Jan 2015 18:51:36 +0000 (18:51 +0000)]
ReaderWriter: teach the writer about IMAGE_REL_ARM_BLX23T

This adds support for IMAGE_REL_ARM_BLX23T relocations.  Similar to the
IMAGE_REL_ARM_MOV32T relocation, this relocation requires munging an
instruction.  This inches us closer to supporting a basic hello world
application.

llvm-svn: 225081