platform/upstream/llvm.git
9 years agoScalarEvolution: Construct SCEVDivision's Derived type instead of itself
David Majnemer [Mon, 17 Nov 2014 11:27:45 +0000 (11:27 +0000)]
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

9 years ago[Thumb1] Re-write emitThumbRegPlusImmediate
Oliver Stannard [Mon, 17 Nov 2014 11:18:10 +0000 (11:18 +0000)]
[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

9 years agoObject, COFF: Tighten the object file parser
David Majnemer [Mon, 17 Nov 2014 11:17:17 +0000 (11:17 +0000)]
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

9 years agoFix optimisations of SELECT_CC which assumed result is boolean
Oliver Stannard [Mon, 17 Nov 2014 10:49:31 +0000 (10:49 +0000)]
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

9 years agosilence gcc 4.9.1 warning in /llvm/lib/Support/Windows/Path.inc:564:39:
Yaron Keren [Mon, 17 Nov 2014 09:29:33 +0000 (09:29 +0000)]
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

9 years agoOptimize switch lookup tables with linear mapping.
Erik Eckstein [Mon, 17 Nov 2014 09:13:57 +0000 (09:13 +0000)]
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

9 years agoFix CR/LF line endings in test case.
Bob Wilson [Mon, 17 Nov 2014 08:00:45 +0000 (08:00 +0000)]
Fix CR/LF line endings in test case.

llvm-svn: 222120

9 years agoAdd missing semicolon from r222118.
Craig Topper [Mon, 17 Nov 2014 05:58:26 +0000 (05:58 +0000)]
Add missing semicolon from r222118.

llvm-svn: 222119

9 years agoMove register class name strings to a single array in MCRegisterInfo to reduce static...
Craig Topper [Mon, 17 Nov 2014 05:50:14 +0000 (05:50 +0000)]
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

9 years agoAdd back r222061 with a fix.
Rafael Espindola [Mon, 17 Nov 2014 02:28:27 +0000 (02:28 +0000)]
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

9 years ago[PECOFF] Fix 32-bit delay-import table.
Rui Ueyama [Mon, 17 Nov 2014 02:04:54 +0000 (02:04 +0000)]
[PECOFF] Fix 32-bit delay-import table.

llvm-svn: 222116

9 years agoImplement MachODumper::printFileHeaders
Frederic Riss [Mon, 17 Nov 2014 01:34:15 +0000 (01:34 +0000)]
Implement MachODumper::printFileHeaders

Patch by Chilledheart.

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

llvm-svn: 222115

9 years agoReplace a couple asserts with static_asserts.
Craig Topper [Mon, 17 Nov 2014 00:26:50 +0000 (00:26 +0000)]
Replace a couple asserts with static_asserts.

llvm-svn: 222114

9 years agoEnable SCEV based code generation by default
Tobias Grosser [Sun, 16 Nov 2014 22:50:23 +0000 (22:50 +0000)]
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

9 years agoModify test cases to work with SCEV based code generation
Tobias Grosser [Sun, 16 Nov 2014 22:43:21 +0000 (22:43 +0000)]
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

9 years agoMake usage of scev based code generation explicit in tests
Tobias Grosser [Sun, 16 Nov 2014 21:43:28 +0000 (21:43 +0000)]
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

9 years agoFix typo
Tobias Grosser [Sun, 16 Nov 2014 21:19:35 +0000 (21:19 +0000)]
Fix typo

llvm-svn: 222110

9 years agoConvert some EVTs to MVTs where only a SimpleValueType is needed.
Craig Topper [Sun, 16 Nov 2014 21:17:18 +0000 (21:17 +0000)]
Convert some EVTs to MVTs where only a SimpleValueType is needed.

llvm-svn: 222109

9 years agoFix formatting
Tobias Grosser [Sun, 16 Nov 2014 21:03:32 +0000 (21:03 +0000)]
Fix formatting

llvm-svn: 222106

9 years ago[Sanitizer] Parse and produce all sanitizer-relevant arguments in SanitizerArgs.
Alexey Samsonov [Sun, 16 Nov 2014 20:53:53 +0000 (20:53 +0000)]
[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

9 years agoScalarEvolution: Introduce SCEVSDivision and SCEVUDivision
David Majnemer [Sun, 16 Nov 2014 20:35:19 +0000 (20:35 +0000)]
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

9 years agoIndependent blocks: SE->forget() scalars translated to arrays
Tobias Grosser [Sun, 16 Nov 2014 20:33:58 +0000 (20:33 +0000)]
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

9 years agoRemove an unnecessary ifdef
Tobias Grosser [Sun, 16 Nov 2014 17:16:30 +0000 (17:16 +0000)]
Remove an unnecessary ifdef

Reported-by: Johannes Doerfert <doerfert@cs.uni-saarland.de>
llvm-svn: 222102

9 years agoSwitch default code generation backend to isl
Tobias Grosser [Sun, 16 Nov 2014 17:02:11 +0000 (17:02 +0000)]
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

9 years ago[DependenceAnalysis] Allow subscripts of different types
Jingyue Wu [Sun, 16 Nov 2014 16:52:44 +0000 (16:52 +0000)]
[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

9 years agoIntroduce minimalistic cost model for auto parallelization
Tobias Grosser [Sun, 16 Nov 2014 14:24:53 +0000 (14:24 +0000)]
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

9 years agoRevert r222091 because it caused a buildbot failure.
Jay Foad [Sun, 16 Nov 2014 09:44:37 +0000 (09:44 +0000)]
Revert r222091 because it caused a buildbot failure.

llvm-svn: 222095

9 years ago[x86] Remove two redundant isel patterns. They equivalent already exists in the instr...
Craig Topper [Sun, 16 Nov 2014 09:24:16 +0000 (09:24 +0000)]
[x86] Remove two redundant isel patterns. They equivalent already exists in the instruction pattern.

llvm-svn: 222094

9 years agoScalarEvolution: HowFarToZero was wrongly using signed division
David Majnemer [Sun, 16 Nov 2014 07:30:35 +0000 (07:30 +0000)]
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

9 years agoInstSimplify: Optimize ICmpInst xform that uses computeKnownBits
David Majnemer [Sun, 16 Nov 2014 02:20:08 +0000 (02:20 +0000)]
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

9 years ago[ASan] Fix leak tests on 64-bit targets other than x86-64
Jay Foad [Sat, 15 Nov 2014 23:00:14 +0000 (23:00 +0000)]
[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

9 years ago[DAG] Improved target independent vector shuffle folding logic.
Andrea Di Biagio [Sat, 15 Nov 2014 22:56:25 +0000 (22:56 +0000)]
[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

9 years agoRemove one incomplete test case accidentally committed
Tobias Grosser [Sat, 15 Nov 2014 21:34:34 +0000 (21:34 +0000)]
Remove one incomplete test case accidentally committed

llvm-svn: 222089

9 years agoAdd OpenMP code generation to isl backend
Tobias Grosser [Sat, 15 Nov 2014 21:32:53 +0000 (21:32 +0000)]
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

9 years ago[X86][SSE] Improve legal SHUFP and PSHUFD shuffle matching
Simon Pilgrim [Sat, 15 Nov 2014 21:13:05 +0000 (21:13 +0000)]
[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

9 years agoFix build regression caused by not defining ABI library macros
Eric Fiselier [Sat, 15 Nov 2014 17:25:23 +0000 (17:25 +0000)]
Fix build regression caused by not defining ABI library macros

llvm-svn: 222085

9 years agoAs a follow up to r222001, Peter Bergner pointed out that there is
Jay Foad [Sat, 15 Nov 2014 13:52:10 +0000 (13:52 +0000)]
As a follow up to r222001, Peter Bergner pointed out that there is
nothing 64-bit-specific about the PowerPC stack overflow detection.

llvm-svn: 222084

9 years agoDispose disassembler after use in unit test.
Benjamin Kramer [Sat, 15 Nov 2014 10:53:12 +0000 (10:53 +0000)]
Dispose disassembler after use in unit test.

llvm-svn: 222083

9 years agoProvide missing definition of uppercase_CMAKE_BUILD_TYPE in HandleLLVMOptions module
Eric Fiselier [Sat, 15 Nov 2014 07:45:31 +0000 (07:45 +0000)]
Provide missing definition of uppercase_CMAKE_BUILD_TYPE in HandleLLVMOptions module

llvm-svn: 222082

9 years agoFix issues missed during the review of r222099.
Richard Trieu [Sat, 15 Nov 2014 06:37:39 +0000 (06:37 +0000)]
Fix issues missed during the review of r222099.

Shift some functions around, make a method in Sema private,
call the correct overloaded function.  No functional change.

llvm-svn: 222081

9 years ago[libcxx] Refactor CMakeLists.txt handling of compile and link flags to suppress warnings.
Eric Fiselier [Sat, 15 Nov 2014 06:26:30 +0000 (06:26 +0000)]
[libcxx] Refactor CMakeLists.txt handling of compile and link flags to suppress warnings.

Summary:
Currently we have 5 variables that are used to specify options for building libcxx
1. `LIBCXX_CXX_FEATURE_FLAGS`
2. `LIBCXX_CXX_WARNING_FLAGS`
3. `LIBCXX_CXX_REQUIRED_FLAGS`
4. `compile_flags` (in libcxx/lib)
5. `link_flags` (in libcxx/lib)

The first three all get put into `CMAKE_CXX_FLAGS`.
This changes the way flags are handled by only using 3 different options:

1. `LIBCXX_CXX_FLAGS` - general compile and link flags.
2. `LIBCXX_COMPILE_FLAGS` - compile only flags.
3. `LIBCXX_LINK_FLAGS` - link only flags.

This patch also removes the warning about `-nostdinc++` being unused during linking.

Reviewers: mclow.lists, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

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

llvm-svn: 222080

9 years agoR600: Permute operands when selecting legacy min/max
Matt Arsenault [Sat, 15 Nov 2014 05:02:57 +0000 (05:02 +0000)]
R600: Permute operands when selecting legacy min/max

This gets the correct NaN behavior based on the compare type
the hardware uses. This now passes the new piglit test I have
for this on SI.

Add stricter tests for the operand order.

llvm-svn: 222079

9 years agoyaml2obj, COFF: Consider the DOS stub when laying out section headers
David Majnemer [Sat, 15 Nov 2014 02:03:59 +0000 (02:03 +0000)]
yaml2obj, COFF: Consider the DOS stub when laying out section headers

While this program worked correctly with small example programs, larger
ones tickled this bug.  I'm working on a reduction because my program is
quite large.

llvm-svn: 222078

9 years agoRevert "Don't make assumptions about the name of private global variables."
Reid Kleckner [Sat, 15 Nov 2014 02:03:53 +0000 (02:03 +0000)]
Revert "Don't make assumptions about the name of private global variables."

This reverts commit r222061.

It's causing linker errors.

llvm-svn: 222077

9 years agoSplit thread test into two parts. Mark one as XFAIL with ASAN.
Eric Fiselier [Sat, 15 Nov 2014 01:58:45 +0000 (01:58 +0000)]
Split thread test into two parts. Mark one as XFAIL with ASAN.

The second part of the test checks that std::terminate is called when a running
thread is move assigned to. Calling std::terminate prevents some of the destructors
to be called and ASAN fires on this.

llvm-svn: 222076

9 years agoFor some reason, sometimes the directory paths that clang emits have internal
Jim Ingham [Sat, 15 Nov 2014 01:54:26 +0000 (01:54 +0000)]
For some reason, sometimes the directory paths that clang emits have internal
relative paths, like:

/whatever/llvm/lib/Sema/../../include/llvm/Sema/

That causes problems with our type uniquing, since we use the declaration file
and line as one component of the uniquing, and different ways of getting to the
same file will have different directory spellings, though they are functionally
equivalent.  We end up with two copies of the exact same type because of this,
and that makes the expression parser give "duplicate type" errors.

I added a method to resolve paths with ../ in them and used that in the FileSpec::Equals,
for comparing Declarations and for doing Breakpoint compares as well, since they also
suffer from this if you specify breakpoints by full path (since nobody knows what
../'s to insert...)

<rdar://problem/18765814>

llvm-svn: 222075

9 years agoFix IRGen for passing transparent unions
Reid Kleckner [Sat, 15 Nov 2014 01:41:41 +0000 (01:41 +0000)]
Fix IRGen for passing transparent unions

We have had a test for this for a long time with a FIXME saying what we
should be doing. This just does it.

Fixes PR21573.

llvm-svn: 222074

9 years agoR600: Fix 64-bit integer division
Tom Stellard [Sat, 15 Nov 2014 01:07:57 +0000 (01:07 +0000)]
R600: Fix 64-bit integer division

This fixes a failure in one of the oclconform tests.

Patch by: Jan Vesely

llvm-svn: 222073

9 years agoR600: Factor i64 UDIVREM lowering into its own fuction
Tom Stellard [Sat, 15 Nov 2014 01:07:53 +0000 (01:07 +0000)]
R600: Factor i64 UDIVREM lowering into its own fuction

This is so it could potentially be used by SI.  However, the current
implementation does not always produce correct results, so the
IntegerDivisionPass is being used instead.

llvm-svn: 222072

9 years agoCGDebugInfo: Update for DIBuilder API change
Duncan P. N. Exon Smith [Sat, 15 Nov 2014 00:24:50 +0000 (00:24 +0000)]
CGDebugInfo: Update for DIBuilder API change

Tracking LLVM commit r222070.

llvm-svn: 222071

9 years agoDIBuilder: Use Constant instead of Value
Duncan P. N. Exon Smith [Sat, 15 Nov 2014 00:23:49 +0000 (00:23 +0000)]
DIBuilder: Use Constant instead of Value

Make explicit the requirement that most IR values in `DIBuilder` are
`Constant`.  This requires a follow-up change in clang.

Part of PR21532.

llvm-svn: 222070

9 years agoClean empty directories.
Joerg Sonnenberger [Sat, 15 Nov 2014 00:21:06 +0000 (00:21 +0000)]
Clean empty directories.

llvm-svn: 222069

9 years agoDIBuilder: Change private helper function to static, NFC
Duncan P. N. Exon Smith [Sat, 15 Nov 2014 00:05:04 +0000 (00:05 +0000)]
DIBuilder: Change private helper function to static, NFC

llvm-svn: 222068

9 years agoIR: Remove MDString logic for Value::hasName()
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 23:58:20 +0000 (23:58 +0000)]
IR: Remove MDString logic for Value::hasName()

This isn't necessary after r221960.

llvm-svn: 222067

9 years agoDIBuilder: Cleanup access control style, NFC
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 23:55:52 +0000 (23:55 +0000)]
DIBuilder: Cleanup access control style, NFC

llvm-svn: 222066

9 years agoThis patch fixes couple of bugs for predefined expression
Fariborz Jahanian [Fri, 14 Nov 2014 23:55:27 +0000 (23:55 +0000)]
This patch fixes couple of bugs for predefined expression
used inside blocks. It fixes a crash in naming code
for __func__ etc. when used in a block declared globally.
It also brings back old naming convention for
predefined expression which was broken. rdar://18961148

llvm-svn: 222065

9 years agoDI: Use Metadata for DITypeRef and DIScopeRef
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 23:55:03 +0000 (23:55 +0000)]
DI: Use Metadata for DITypeRef and DIScopeRef

Now that `MDString` and `MDNode` have a common base class, use it.  Note
that it's not useful to assume subclasses of `Metadata` must be one or
the other since we'll be adding more subclasses soon enough.

Part of PR21532.

llvm-svn: 222064

9 years agoI don't need this ivar. It was probably there from the olden days where dynamic type...
Enrico Granata [Fri, 14 Nov 2014 23:38:23 +0000 (23:38 +0000)]
I don't need this ivar. It was probably there from the olden days where dynamic type support was flakey. Remove and save space

llvm-svn: 222063

9 years agoRename EH related stuff to be more precise
Reid Kleckner [Fri, 14 Nov 2014 23:31:07 +0000 (23:31 +0000)]
Rename EH related stuff to be more precise

Summary:
The current "WinEH" exception handling type is more about Itanium-style
LSDA tables layered on top of the Windows native unwind info format
instead of .eh_frame tables or EHABI unwind info. Use the name
"ItaniumWinEH" to better reflect the hybrid nature of the design.

Also rename isExceptionHandlingDWARF to usesItaniumLSDAForExceptions,
since the LSDA is part of the Itanium C++ ABI document, and not the
DWARF standard.

Reviewers: echristo

Subscribers: llvm-commits, compnerd

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

llvm-svn: 222062

9 years agoDon't make assumptions about the name of private global variables.
Rafael Espindola [Fri, 14 Nov 2014 23:17:47 +0000 (23:17 +0000)]
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: 222061

9 years ago[asan] add interface function __sanitizer_get_total_unique_coverage; useful for cover...
Kostya Serebryany [Fri, 14 Nov 2014 23:15:55 +0000 (23:15 +0000)]
[asan] add interface function __sanitizer_get_total_unique_coverage; useful for coverage-guided in-process fuzzers

llvm-svn: 222060

9 years agoFix examine-threads to build for arm64.
Jim Ingham [Fri, 14 Nov 2014 22:58:25 +0000 (22:58 +0000)]
Fix examine-threads to build for arm64.

llvm-svn: 222059

9 years agoRemoved a couple of static helpers in the data formatters, replaced with new general...
Enrico Granata [Fri, 14 Nov 2014 22:58:11 +0000 (22:58 +0000)]
Removed a couple of static helpers in the data formatters, replaced with new general logic in StringLexer

llvm-svn: 222058

9 years agoARM: refactor .cfi_def_cfa_offset emission.
Tim Northover [Fri, 14 Nov 2014 22:45:33 +0000 (22:45 +0000)]
ARM: refactor .cfi_def_cfa_offset emission.

We use to track quite a few "adjusted" offsets through the FrameLowering code
to account for changes in the prologue instructions as we went and allow the
emission of correct CFA annotations. However, we were missing a couple of cases
and the code was almost impenetrable.

It's easier to just add any stack-adjusting instruction to a list and emit them
together.

llvm-svn: 222057

9 years agoARM: correctly calculate the offset of FP in its push.
Tim Northover [Fri, 14 Nov 2014 22:45:31 +0000 (22:45 +0000)]
ARM: correctly calculate the offset of FP in its push.

When we folded the DPR alignment gap into a push, we weren't noting the extra
distance from the beginning of the push to the FP, and so FP ended up pointing
at an incorrect offset.

The .cfi_def_cfa_offset directives are still wrong in this case, but I think
that can be improved by refactoring.

llvm-svn: 222056

9 years agoARM: simplify test.
Tim Northover [Fri, 14 Nov 2014 22:45:23 +0000 (22:45 +0000)]
ARM: simplify test.

The test's DWARF stubs were there just to trigger the emission of .cfi
directives. Fortunately, the NetBSD ABI already demands proper DWARF unwind
info, so it's easier to just use that triple.

llvm-svn: 222055

9 years ago[c++1z] Support [[deprecated]] attributes on namespaces. Note that it only applies...
Aaron Ballman [Fri, 14 Nov 2014 22:34:56 +0000 (22:34 +0000)]
[c++1z] Support [[deprecated]] attributes on namespaces. Note that it only applies to situations where the namespace is mentioned. Thus, use on anonymous namespaces is diagnosed.

llvm-svn: 222054

9 years agoAdd -g -fno-omit-frame-pointer when compiling tests with sanitizers
Eric Fiselier [Fri, 14 Nov 2014 22:27:43 +0000 (22:27 +0000)]
Add -g -fno-omit-frame-pointer when compiling tests with sanitizers

llvm-svn: 222053

9 years agoInitialize pointer in string conversion helpers to prevent MSAN diagnostic.
Eric Fiselier [Fri, 14 Nov 2014 22:23:57 +0000 (22:23 +0000)]
Initialize pointer in string conversion helpers to prevent MSAN diagnostic.

Since the initialization of the pointer happens across the libc library boundry
MSAN will not know the pointer was initialized. This fixes MSAN failures in
test/strings/string.conversions.

llvm-svn: 222052

9 years agoadd debug info when compiling sanitizer tests
Eric Fiselier [Fri, 14 Nov 2014 22:18:03 +0000 (22:18 +0000)]
add debug info when compiling sanitizer tests

llvm-svn: 222051

9 years agoRerun AutoRegen.sh.
Eric Christopher [Fri, 14 Nov 2014 22:10:16 +0000 (22:10 +0000)]
Rerun AutoRegen.sh.

llvm-svn: 222050

9 years agoRecommit r222044 with a test fix - it does not make sense to hunt
Anton Korobeynikov [Fri, 14 Nov 2014 22:09:15 +0000 (22:09 +0000)]
Recommit r222044 with a test fix - it does not make sense to hunt
for a typedef before arithmetic conversion in all rare corner cases.

llvm-svn: 222049

9 years agoRemoving an unused variable; NFC.
Aaron Ballman [Fri, 14 Nov 2014 21:57:30 +0000 (21:57 +0000)]
Removing an unused variable; NFC.

llvm-svn: 222048

9 years agoAgain revert r222044 to resolve darwin objc test fails.
Anton Korobeynikov [Fri, 14 Nov 2014 21:54:46 +0000 (21:54 +0000)]
Again revert r222044 to resolve darwin objc test fails.

llvm-svn: 222047

9 years agoTurn a leaked object into a stack variable instead.
David Blaikie [Fri, 14 Nov 2014 21:53:50 +0000 (21:53 +0000)]
Turn a leaked object into a stack variable instead.

llvm-svn: 222046

9 years agoAdd the code and test cases for 64-bit ARM to llvm-objdump’s Mach-O symbolizer.
Kevin Enderby [Fri, 14 Nov 2014 21:52:18 +0000 (21:52 +0000)]
Add the code and test cases for 64-bit ARM to llvm-objdump’s Mach-O symbolizer.

FYI, removed the unused MCInstrAnalysis as it does not exist for 64-bit ARM and
was causing a “couldn't initialize disassembler for target” error.

llvm-svn: 222045

9 years agoFollow-up to D6217
Anton Korobeynikov [Fri, 14 Nov 2014 21:41:07 +0000 (21:41 +0000)]
Follow-up to D6217

Summary:
Ok, here is somewhat addition to D6217 aiming to preserve old darwin behavior wrt the typedefed types. The actual change to SemaChecking turned out to be pretty gross, in particular:
  1. We need to extract the typedef'ed type for proper diagnostics
  2. We need to walk over paren expressions as well

Reviewers: chandlerc, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 222044

9 years ago[PECOFF] Fix section alignment.
Rui Ueyama [Fri, 14 Nov 2014 21:33:07 +0000 (21:33 +0000)]
[PECOFF] Fix section alignment.

If you have something like

  __declspec(align(8192)) int foo = 1;

in your code, the compiler makes the data to be aligned to 8192-byte
boundary, and the linker align the section containing the data to 8192.

LLD always aligned the section to 4192. So, as long as alignment
requirement is smaller than 4192, it was correct, but for larger
requirements, it's wrong.

This patch fixes the issue.

llvm-svn: 222043

9 years agoAdd DiagID and Warning Flag to DiagnosticsLog
Steven Wu [Fri, 14 Nov 2014 21:23:56 +0000 (21:23 +0000)]
Add DiagID and Warning Flag to DiagnosticsLog

llvm-svn: 222042

9 years agoAdd a test for r222029 that doesn't rely on the default target being a COFF platform.
Frederic Riss [Fri, 14 Nov 2014 21:23:26 +0000 (21:23 +0000)]
Add a test for r222029 that doesn't rely on the default target being a COFF platform.

llvm-svn: 222041

9 years agoInstCombine: Fix infinite loop caused by visitFPTrunc
David Majnemer [Fri, 14 Nov 2014 21:21:15 +0000 (21:21 +0000)]
InstCombine: Fix infinite loop caused by visitFPTrunc

We would attempt to replace a fptrunc of an frem with an identical
fptrunc.  This would cause the new fptrunc to be added to the worklist.
Of course, this results in an infinite loop because we will keep
visiting the newly created fptruncs.

This fixes PR21576.

llvm-svn: 222040

9 years agoReapply r221924: "[GVN] Perform Scalar PRE on gep indices that feed loads before
Chad Rosier [Fri, 14 Nov 2014 21:09:13 +0000 (21:09 +0000)]
Reapply r221924: "[GVN] Perform Scalar PRE on gep indices that feed loads before
doing Load PRE"

This commit updates the failing test in
Analysis/TypeBasedAliasAnalysis/gvn-nonlocal-type-mismatch.ll

The failing test is sensitive to the order in which we process loads.  This
version turns on the RPO traversal instead of the while DT traversal in GVN.
The new test code is functionally same just the order of loads that are
eliminated is swapped.

This new version also fixes an issue where GVN splits a critical edge and
potentially invalidate the RPO/DT iterator.

llvm-svn: 222039

9 years agoChange order of tablegen generated fast-isel instruction code to be
Bill Schmidt [Fri, 14 Nov 2014 21:05:45 +0000 (21:05 +0000)]
Change order of tablegen generated fast-isel instruction code to be
based on instruction complexity

The order that tablegen fast-isel instruction code is generated is
currently based on the text of the predicate (using string
less-than). This patch changes this to instead use the instruction
complexity. Because the complexities are not unique a C++ multimap is
used instead of a map.

This fixes the problem where code with no predicate always comes out
first (the empty string always compares as less than all other
strings) thus making the code with predicates dead code. See the FMUL
code in PPCFastISel.cpp for an example. It also more closely matches
the normal codegen ordering. Some error checking in the tablegen
fast-isel code is fixed as well.

Patch by Bill Seurer.

llvm-svn: 222038

9 years agoR600/SI: Mark s_movk_i32 as rematerializable
Tom Stellard [Fri, 14 Nov 2014 20:43:28 +0000 (20:43 +0000)]
R600/SI: Mark s_movk_i32 as rematerializable

llvm-svn: 222037

9 years agoR600/SI: Fix spilling of m0 register
Tom Stellard [Fri, 14 Nov 2014 20:43:26 +0000 (20:43 +0000)]
R600/SI: Fix spilling of m0 register

If we have spilled the value of the m0 register, then we need to restore
it with v_readlane_b32 to a regular sgpr, because v_readlane_b32 can't
write to m0.

v_readlane_b32 can't write to m0, so

llvm-svn: 222036

9 years agoAdd -gline-tables-only when compiling w/ sanitizers in RELEASE
Eric Fiselier [Fri, 14 Nov 2014 20:38:07 +0000 (20:38 +0000)]
Add -gline-tables-only when compiling w/ sanitizers in RELEASE

llvm-svn: 222035

9 years agoCOFF: Add support for Dwarf accelerator tables.
Frederic Riss [Fri, 14 Nov 2014 20:33:40 +0000 (20:33 +0000)]
COFF: Add support for Dwarf accelerator tables.

This allows COFF targets to emit accelerator tables
when requested by -dwarf-accel-tables=Enable instead
of aborting. The test DebugInfo/cross-cu-inlining.ll
covers this on COFF platforms.

llvm-svn: 222034

9 years agoMinGW doesn't implement std::to_string; working around it. NFC.
Aaron Ballman [Fri, 14 Nov 2014 20:31:50 +0000 (20:31 +0000)]
MinGW doesn't implement std::to_string; working around it. NFC.

llvm-svn: 222033

9 years agoR600/SI: Combine min3/max3 instructions
Matt Arsenault [Fri, 14 Nov 2014 20:08:52 +0000 (20:08 +0000)]
R600/SI: Combine min3/max3 instructions

llvm-svn: 222032

9 years agoadd Makefile rule for test program CREATE_STD_THREADS
Shawn Best [Fri, 14 Nov 2014 19:41:33 +0000 (19:41 +0000)]
add Makefile rule for test program CREATE_STD_THREADS

Effectively removes -lpthreads from linux/gcc build of test programs in test/api/multithreaded. This was done due to that combination causing a test program to hang due, likely due to an issue with gcc linker and libstdc++ conflicting pthreads code in test program and pthread used by lldb.  Issue has been documented at:
http://llvm.org/bugs/show_bug.cgi?id=21553

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

llvm-svn: 222031

9 years agoyaml2obj, COFF: Correctly calculate SizeOfImage and SizeOfHeaders
David Majnemer [Fri, 14 Nov 2014 19:35:59 +0000 (19:35 +0000)]
yaml2obj, COFF: Correctly calculate SizeOfImage and SizeOfHeaders

SizeOfHeaders must be aligned to the FileAlignment.
SizeOfImage must be at least the SizeOfHeaders aligned to the
SectionAlignment.

llvm-svn: 222030

9 years ago[dwarfdump] Handle relocations in Dwarf accelerator tables
Frederic Riss [Fri, 14 Nov 2014 19:30:08 +0000 (19:30 +0000)]
[dwarfdump] Handle relocations in Dwarf accelerator tables

ELF targets (and maybe COFF) use relocations when referring
to strings in the .debug_str section. Handle that in the
accelerator table dumper. This commit restores the
test/DebugInfo/cross-cu-inlining.ll test to its expected
platform independant form, validating that the fix works
(this test failed on linux boxes).

llvm-svn: 222029

9 years agoRemove some redundant virtual on overridden functions
David Blaikie [Fri, 14 Nov 2014 19:27:22 +0000 (19:27 +0000)]
Remove some redundant virtual on overridden functions

llvm-svn: 222027

9 years ago[PECOFF] Remove dead code
Rui Ueyama [Fri, 14 Nov 2014 19:21:06 +0000 (19:21 +0000)]
[PECOFF] Remove dead code

AddressOfEntryPoint is overridden after we layout all atoms (until then,
we don't know the entry point address for obvious reason.)
I believe this code is leftover from very early version of the
PE/COFF port that we only had an entry function in a test object file.

llvm-svn: 222026

9 years ago[libcxx] Fix memory leak in strstream tests.
Eric Fiselier [Fri, 14 Nov 2014 19:10:43 +0000 (19:10 +0000)]
[libcxx] Fix memory leak in strstream tests.

Summary: The strstream function `str()` sets `freeze(true)`. When `freeze` is true the destructor is not allowed to free any dynamically allocated memory. The memory leak causes ASAN to fail on these tests. To ensure memory is deallocated `strstream.freeze(false)` is called at the end of the tests.

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 222025

9 years agoRemove some redundant virtual specifiers on overriden functions.
David Blaikie [Fri, 14 Nov 2014 19:09:44 +0000 (19:09 +0000)]
Remove some redundant virtual specifiers on overriden functions.

llvm-svn: 222024

9 years agoRemove redundant virtual on overriden functions.
David Blaikie [Fri, 14 Nov 2014 19:06:36 +0000 (19:06 +0000)]
Remove redundant virtual on overriden functions.

llvm-svn: 222023

9 years agoIR: Make MDString inherit from Metadata
Duncan P. N. Exon Smith [Fri, 14 Nov 2014 18:45:40 +0000 (18:45 +0000)]
IR: Make MDString inherit from Metadata

llvm-svn: 222022

9 years agoSilence inconsistent override warnings.
Eric Christopher [Fri, 14 Nov 2014 18:44:53 +0000 (18:44 +0000)]
Silence inconsistent override warnings.

llvm-svn: 222021

9 years agoR600/SI: Fix verifier error from a branch on IMPLICIT_DEF
Matt Arsenault [Fri, 14 Nov 2014 18:43:41 +0000 (18:43 +0000)]
R600/SI: Fix verifier error from a branch on IMPLICIT_DEF

SIILowerI1Copies wasn't correctly handling this case.

llvm-svn: 222020