Commit Graph

186829 Commits

Author SHA1 Message Date
Timur Iskhodzhanov 7081460287 Minor readability tweaks to VFTableBuilder.cpp
llvm-svn: 222140
2014-11-17 15:53:50 +00:00
Chad Rosier 9a1ac6e494 [Reassociate] Canonicalize constants to RHS operand.
Fix a thinko where the RHS was already a constant.

llvm-svn: 222139
2014-11-17 15:52:51 +00:00
Marshall Clow 3687d3c2e9 Implement void_t from N3911. Add a private version for use in the library before C++1z. Update the 1z status page, marking a bunch of issues that don't require library changes as complete (2129, 2212, 2230, 2233, 2325, 2365, 2376)
llvm-svn: 222138
2014-11-17 15:50:08 +00:00
Rafael Espindola 5bef24d7e3 Use a more canonical way of computing a mask with N trailing 1s. NFC.
llvm-svn: 222137
2014-11-17 15:46:21 +00:00
Ed Maste 9dfcaf4854 Fix Darwin and FreeBSD OS type detection
Obtained in part from http://reviews.llvm.org/D6290

llvm-svn: 222136
2014-11-17 15:40:18 +00:00
Ed Maste 0178e7587e Whitespace cleanup and remove non-canonical headers
llvm-svn: 222135
2014-11-17 15:37:59 +00:00
Ed Maste 9251e2e61c Add decorator for intermittently failing test on FreeBSD
This test has intermittently failed on FreeBSD for quite some time when
run as part of the full test suite.  It generally passes when run by
itself.  Mark as expected failure for now to reduce buildbot noise.

llvm.org/pr15039 test fails intermittently on FreeBSD

llvm-svn: 222134
2014-11-17 15:27:09 +00:00
Timur Iskhodzhanov 7d19fc1c37 Add a couple more examples illustrating why we need vtordisps and how they work
llvm-svn: 222133
2014-11-17 15:11:05 +00:00
Marshall Clow 5a8c46653f Add tests to ensure that reference_wrapper<T> is trivially copyable. This was added to C++1z with the adoption of N4277, but libc++ already implemented it as a conforming extension. No code changes were needed, just more tests.
llvm-svn: 222132
2014-11-17 15:04:46 +00:00
Samuel Benzaquen 9743c9d88c Remove VariadicOperatorMatcherInterface as it is redundant with logic from DynTypedMatcher.
Summary:
The generic variadic matcher is faster (one less virtual function call
per match) and doesn't require template instantiations which reduces
compile time and binary size.
Registry.cpp.o generates ~14% less symbols and compiles ~7.5% faster.
The change also speeds up our clang-tidy benchmark by ~2%.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 222131
2014-11-17 14:55:49 +00:00
Alexander Kornienko 4c0ef3797b A small correction for r221884. No functional changes.
llvm-svn: 222130
2014-11-17 14:46:28 +00:00
Renato Golin 609bf92365 Fix ARM triple parsing
The triple parser should only accept existing architecture names
when the triple starts with armv, armebv, thumbv or thumbebv.

Patch by Gabor Ballabas.

llvm-svn: 222129
2014-11-17 14:08:57 +00:00
Daniel Jasper 6a3fd8361f clang-format: Fix regression introduced in r221609.
Before:
  void f() { f(a, c *d); }

After:
  void f() { f(a, c * d); }

llvm-svn: 222128
2014-11-17 13:55:04 +00:00
Jason Molenda b412e529e2 Add a little sketch of a program that can extract unwind
information from the compact unwind section used on darwin
for exception handling, and dump that information..

The UNWIND_X86_64_MODE_RBP_FRAME and UNWIND_X86_64_MODE_DWARF
entries look to be handled correctly.

UNWIND_X86_64_MODE_STACK_IMMD and UNWIND_X86_64_MODE_STACK_IND 
are still a work in progress.

Only x86_64 is supported right now.  Given that this is an
experiment in parsing the section contents, I don't expect to
add other architectures; they are trivial variations on this
arch.  There exists a real dumper included in the Xcode tools, 
unwinddump.

llvm-svn: 222127
2014-11-17 11:43:37 +00:00
David Majnemer 5d2670c52a ScalarEvolution: Construct SCEVDivision's Derived type instead of itself
SCEVDivision::divide constructed an object of SCEVDivision<Derived>
instead of Derived.  divide would call visit which would cast the
SCEVDivision<Derived> to type Derived.  As it happens,
SCEVDivision<Derived> and Derived currently have the same layout but
this is fragile and grounds for UB.

Instead, just construct Derived.  No functional change intended.

llvm-svn: 222126
2014-11-17 11:27:45 +00:00
Oliver Stannard 970b0d576c [Thumb1] Re-write emitThumbRegPlusImmediate
This was motivated by a bug which caused code like this to be
miscompiled:
  declare void @take_ptr(i8*)
  define void @test() {
    %addr1.32 = alloca i8
    %addr2.32 = alloca i32, i32 1028
    call void @take_ptr(i8* %addr1)
    ret void
  }

This was emitting the following assembly to get the value of %addr1:
  add r0, sp, #1020
  add r0, r0, #8
However, "add r0, r0, #8" is not a valid Thumb1 instruction, and this
could not be assembled. The generated object file contained this,
resulting in r0 holding SP+8 rather tha SP+1028:
  add r0, sp, #1020
  add r0, sp, #8

This function looked like it could have caused miscompilations for
other combinations of registers and offsets (though I don't think it is
currently called with these), and the heuristic it used did not match
the emitted code in all cases.

llvm-svn: 222125
2014-11-17 11:18:10 +00:00
David Majnemer 236b0ca790 Object, COFF: Tighten the object file parser
We were a little lax in a few areas:
- We pretended that import libraries were like any old COFF file, they
  are not.  In fact, they aren't really COFF files at all, we should
  probably grow some specialized functionality to handle them smarter.
- Our symbol iterators were more than happy to attempt to go past the
  end of the symbol table if you had a symbol with a bad list of
  auxiliary symbols.

llvm-svn: 222124
2014-11-17 11:17:17 +00:00
Oliver Stannard d29db9b949 Fix optimisations of SELECT_CC which assumed result is boolean
Some optimisations in DAGCombiner cause miscompilations for targets that use
TargetLowering::UndefinedBooleanContent, because they assume that the results
of a SELECT_CC node are boolean values, and can be safely ANDed, ORed and
XORed. These optimisations are only valid for targets that use
ZeroOrOneBooleanContent or ZeroOrNegativeOneBooleanContent.

This is a follow-up to D6210/r221693.

llvm-svn: 222123
2014-11-17 10:49:31 +00:00
Yaron Keren 428ceaf90a silence gcc 4.9.1 warning in /llvm/lib/Support/Windows/Path.inc:564:39:
warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   if (ec = widenPath(path, path_utf16))

llvm-svn: 222122
2014-11-17 09:29:33 +00:00
Erik Eckstein 105374fe5e Optimize switch lookup tables with linear mapping.
This is a simple optimization for switch table lookup:
It computes the output value directly with an (optional) mul and add if there is a linear mapping between index and output.
Example:

int f1(int x) {
  switch (x) {
    case 0: return 10;
    case 1: return 11;
    case 2: return 12;
    case 3: return 13;
  }
  return 0;
}

generates:

define i32 @f1(i32 %x) #0 {
entry:
  %0 = icmp ult i32 %x, 4
  br i1 %0, label %switch.lookup, label %return

switch.lookup:
  %switch.offset = add i32 %x, 10
  ret i32 %switch.offset

return:
  ret i32 0
}

llvm-svn: 222121
2014-11-17 09:13:57 +00:00
Bob Wilson a61a19037a Fix CR/LF line endings in test case.
llvm-svn: 222120
2014-11-17 08:00:45 +00:00
Craig Topper f98c606479 Add missing semicolon from r222118.
llvm-svn: 222119
2014-11-17 05:58:26 +00:00
Craig Topper cf0444ba2a Move register class name strings to a single array in MCRegisterInfo to reduce static table size and number of relocation entries.
Indices into the table are stored in each MCRegisterClass instead of a pointer. A new method, getRegClassName, is added to MCRegisterInfo and TargetRegisterInfo to lookup the string in the table.

llvm-svn: 222118
2014-11-17 05:50:14 +00:00
Rafael Espindola a3b5b60753 Add back r222061 with a fix.
This adds back r222061, but now calls initializePAEvalPass from the correct
library to avoid link problems.

Original message:

Don't make assumptions about the name of private global variables.

Private variables are can be renamed, so it is not reliable to make
decisions on the name.

The name is also dropped by the assembler before getting to the
linker, so using the name causes a disconnect between how llvm makes a
decision (var name) and how the linker makes a decision (section it is
in).

This patch changes one case where we were looking at the variable name to use
the section instead.

Test tuning by Michael Gottesman.

llvm-svn: 222117
2014-11-17 02:28:27 +00:00
Rui Ueyama 5552de51d5 [PECOFF] Fix 32-bit delay-import table.
llvm-svn: 222116
2014-11-17 02:04:54 +00:00
Frederic Riss d431932d38 Implement MachODumper::printFileHeaders
Patch by Chilledheart.

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

llvm-svn: 222115
2014-11-17 01:34:15 +00:00
Craig Topper 6438fc3d05 Replace a couple asserts with static_asserts.
llvm-svn: 222114
2014-11-17 00:26:50 +00:00
Tobias Grosser 7031141009 Enable SCEV based code generation by default
SCEV based code generation allows Polly to detect and generate code for loops
that do not have an explicit induction variable, but only virtual induction
variables given by SCEV.

Being able to do so has two main benefits:

  - We can detect more scops by default
  - We require less canonicalization before Polly, which means we get closer
    to our goal of not touching the IR before analyzing its properties.
    Specifically, we do not need to run -polly-indvars to introduce explicit
    canonical induction variables.

This switch became possible as both the isl code generation and -polly-parallel
are LNT error free with SCEV based code generation and the isl ast generator.

llvm-svn: 222113
2014-11-16 22:50:23 +00:00
Tobias Grosser bab3568105 Modify test cases to work with SCEV based code generation
This patch includes tests where we actually need to adjust the CHECK lines
for SCEV based code generation. Besides these adjustments we add explicit
calls to -polly-codegen-scev=[true|false] and make sure we test both cases.

llvm-svn: 222112
2014-11-16 22:43:21 +00:00
Tobias Grosser 95cd1c718e Make usage of scev based code generation explicit in tests
This is in preparation of using SCEV based codegen by default in polly

llvm-svn: 222111
2014-11-16 21:43:28 +00:00
Tobias Grosser 849475ae2e Fix typo
llvm-svn: 222110
2014-11-16 21:19:35 +00:00
Craig Topper 7f416c8acb Convert some EVTs to MVTs where only a SimpleValueType is needed.
llvm-svn: 222109
2014-11-16 21:17:18 +00:00
Tobias Grosser a4377d3eb8 Fix formatting
llvm-svn: 222106
2014-11-16 21:03:32 +00:00
Alexey Samsonov 1e715a66d7 [Sanitizer] Parse and produce all sanitizer-relevant arguments in SanitizerArgs.
In particular, make SanitizerArgs responsible for parsing
and passing down to frontend -fsanitize-recover and
-fsanitize-undefined-trap-on-error flags.

Simplify parsing -f(no-)sanitize= flags parsing: get rid of
too complex filterUnsupportedKinds function.

No functionality change.

llvm-svn: 222105
2014-11-16 20:53:53 +00:00
David Majnemer 32b8ccf480 ScalarEvolution: Introduce SCEVSDivision and SCEVUDivision
It turns out that not all users of SCEVDivision want the same
signedness.  Let the users determine which operation they'd like by
explicitly choosing SCEVUDivision or SCEVSDivision.

findArrayDimensions and computeAccessFunctions will use SCEVSDivision
while HowFarToZero will use SCEVUDivision.

llvm-svn: 222104
2014-11-16 20:35:19 +00:00
Tobias Grosser 2f8732e7c6 Independent blocks: SE->forget() scalars translated to arrays
This prevents SCEVs to reference values not valid any more and as a consequence
solves a bug where such values reintroduced during ast generation caused the
independent blocks pass to fail validation.

http://llvm.org/PR21204

llvm-svn: 222103
2014-11-16 20:33:58 +00:00
Tobias Grosser 4f124821e4 Remove an unnecessary ifdef
Reported-by: Johannes Doerfert <doerfert@cs.uni-saarland.de>
llvm-svn: 222102
2014-11-16 17:16:30 +00:00
Tobias Grosser b05b038b81 Switch default code generation backend to isl
The isl based backend has been tested since a long time and with the recently
commited OpenMP support the last missing piece of functionality was ported from
the CLooG backend.

The isl based backend gives us interesting new functionality:

  - Run-time alias checks (enabled by default)

  Optimize scops that contain possibly aliasing pointers. This feature has
  largely increased the number of loop nests we consider for optimization.

  Thanks Johannes!

  - Delinearization (not yet enabled by default)

  Model accesses to multi-dimensional arrays precisely. This will allow us to
  understand kernels with multi-dimensional VLAs written in Julia, boost::ublas,
  coremark or C99.

  Thanks Sebastian!

  - Generation of higher quality code

  Sven and me spent a long time to optimize the quality of the generated code. A
  major focus were expressions as they result from modulos/divisions or
  piecewise affine expressions (a ? b : c).

  - Full/Partial tile separation, polyhedral unrolling

  The isl code generation provides functionality to generate specialized code
  for core and cleanup loops and to specialize code using polyhedral context
  information while unrolling statements.

  (not yet exploited in Polly)

  - Modifieable access functions

  We can now use standard isl functionality to remap memory accesses to new
  data locations. A standard use case is the use of shared memory, where
  accesses to a larger region in global memory need to be mapped to a smaller
  shared memory region using a modulo mapping.

  (not yet exploited in Polly)

The cloog based code generation is still available for comparision, but is
scheduled for removal.

llvm-svn: 222101
2014-11-16 17:02:11 +00:00
Jingyue Wu 0fa125a77d [DependenceAnalysis] Allow subscripts of different types
Summary:
Several places in DependenceAnalysis assumes both SCEVs in a subscript pair
share the same integer type. For instance, isKnownPredicate calls
SE->getMinusSCEV(X, Y) which asserts X and Y share the same type. However,
DependenceAnalysis fails to ensure this assumption when producing a subscript
pair, causing tests such as NonCanonicalizedSubscript to crash. With this
patch, DependenceAnalysis runs unifySubscriptType before producing any
subscript pair, ensuring the assumption.

Test Plan:
Added NonCanonicalizedSubscript.ll on which DependenceAnalysis before the fix
crashed because subscripts have different types.

Reviewers: spop, sebpop, jingyue

Reviewed By: jingyue

Subscribers: eliben, meheff, llvm-commits

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

llvm-svn: 222100
2014-11-16 16:52:44 +00:00
Tobias Grosser bf34f1d2b2 Introduce minimalistic cost model for auto parallelization
Instead of parallelizing every parallel outermost loop, we now use a very
minimalistic cost model. Specifically, we assume innermost loops are not
worth parallelising and all non-innermost loops are.

When parallelizing all loops in LNT we got several slowdowns/timeouts due to
us parallelizing innermost loops that are executed only a couple of times
(number of iterations not known statically). With this basic heuristic enabled
LNT does not show any more timeouts, while several interesting loops are still
parallelized.

There are many ways to obtain an improved heuristic. Constructing such an
improvide heuristic from a position of minimal slow-down and zero code size
increase seems to be the best, as it allows us to track progress on LNT.

llvm-svn: 222096
2014-11-16 14:24:53 +00:00
Jay Foad 670bdb5a64 Revert r222091 because it caused a buildbot failure.
llvm-svn: 222095
2014-11-16 09:44:37 +00:00
Craig Topper 949d50bc71 [x86] Remove two redundant isel patterns. They equivalent already exists in the instruction pattern.
llvm-svn: 222094
2014-11-16 09:24:16 +00:00
David Majnemer 0df1d12476 ScalarEvolution: HowFarToZero was wrongly using signed division
HowFarToZero was supposed to use unsigned division in order to calculate
the backedge taken count.  However, SCEVDivision::divide performs signed
division.  Unless I am mistaken, no users of SCEVDivision actually want
signed arithmetic: switch to udiv and urem.

This fixes PR21578.

llvm-svn: 222093
2014-11-16 07:30:35 +00:00
David Majnemer 5854e9fae8 InstSimplify: Optimize ICmpInst xform that uses computeKnownBits
A few things:
- computeKnownBits is relatively expensive, let's delay its use as long
  as we can.
- Don't create two APInt values just to run computeKnownBits on a
  ConstantInt, we already know the exact value!
- Avoid creating a temporary APInt value in order to calculate unary
  negation.

llvm-svn: 222092
2014-11-16 02:20:08 +00:00
Jay Foad 83c97c6997 [ASan] Fix leak tests on 64-bit targets other than x86-64
Summary:
This test explicitly sets ASAN_OPTIONS=detect_leaks=1 which is only
supported on x86-64. The test is currently restricted to run only on
64-bit targets, but needs to be restricted further so it only runs on
x86-64.

Reviewers: kcc, eugenis, earthdok, samsonov

Reviewed By: samsonov

Subscribers: llvm-commits

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

llvm-svn: 222091
2014-11-15 23:00:14 +00:00
Andrea Di Biagio e13a0b81f4 [DAG] Improved target independent vector shuffle folding logic.
This patch teaches the DAGCombiner how to combine shuffles according to rules:
   shuffle(shuffle(A, Undef, M0), B, M1) -> shuffle(B, A, M2)
   shuffle(shuffle(A, B, M0), B, M1) -> shuffle(B, A, M2)
   shuffle(shuffle(A, B, M0), A, M1) -> shuffle(B, A, M2)

llvm-svn: 222090
2014-11-15 22:56:25 +00:00
Tobias Grosser d1c12e65cd Remove one incomplete test case accidentally committed
llvm-svn: 222089
2014-11-15 21:34:34 +00:00
Tobias Grosser e3c0558e35 Add OpenMP code generation to isl backend
This backend supports besides the classical code generation the upcoming SCEV
based code generation (which the existing CLooG backend does not support
robustly).

OpenMP code generation in the isl backend benefits from our run-time alias
checks such that the set of loops that can possibly be parallelized is a lot
larger.

The code was tested on LNT. We do not regress on builds without -polly-parallel.
When using -polly-parallel most tests work flawlessly, but a few issues still
remain and will be addressed in follow up commits.

SCEV/non-SCEV codegen:
  - Compile time failure in ldecod and TimberWolfMC due a problem in our
    run-time alias check generation triggered by pointers that escape through
    the OpenMP subfunction (OpenMP specific).

  - Several execution time failures. Due to the larger set of loops that we now
    parallelize (compared to the classical code generation),  we currently run
    into some timeouts in tests with a lot loops that have a low trip count and
    are slowed down by parallelizing them.

SCEV only:

  - One existing failure in lencod due to llvm.org/PR21204 (not OpenMP specific)

OpenMP code generation is the last feature that was only available in the CLooG
backend. With the isl backend being the only one supporting features such as
run-time alias checks and delinearization, we will soon switch to use the isl
ast generator by the default and subsequently remove our dependency on CLooG.

http://reviews.llvm.org/D5517

llvm-svn: 222088
2014-11-15 21:32:53 +00:00
Simon Pilgrim 6d675f4e35 [X86][SSE] Improve legal SHUFP and PSHUFD shuffle matching
Updated X86TargetLowering::isShuffleMaskLegal to match SHUFP masks with commuted inputs and PSHUFD masks that reference the second input.

As part of this I've refactored isPSHUFDMask to work in a more general manner and allow it to match against either the first or second input vector.

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

llvm-svn: 222087
2014-11-15 21:13:05 +00:00
Eric Fiselier 382338d988 Fix build regression caused by not defining ABI library macros
llvm-svn: 222085
2014-11-15 17:25:23 +00:00