platform/upstream/llvm.git
10 years ago[C++11] Use 'nullptr'.
Craig Topper [Sun, 8 Jun 2014 22:29:17 +0000 (22:29 +0000)]
[C++11] Use 'nullptr'.

llvm-svn: 210442

10 years agoConvert tests I recently add to use -verify instead of FileCheck.
Joey Gouly [Sun, 8 Jun 2014 21:28:54 +0000 (21:28 +0000)]
Convert tests I recently add to use -verify instead of FileCheck.

This uncovered something strange. Diagnostics for InlineAsm have source locations
that don't really map to where they are within the .c source file.

llvm-svn: 210440

10 years ago[SeparateConstOffsetFromGEP] Fix an illegitimate optimization on zext
Jingyue Wu [Sun, 8 Jun 2014 20:19:38 +0000 (20:19 +0000)]
[SeparateConstOffsetFromGEP] Fix an illegitimate optimization on zext

zext(a + b) != zext(a) + zext(b) even if a + b >= 0 && b >= 0.

e.g., a = i4 0b1111, b = i4 0b0001
zext a + b to i8 = zext 0b0000 to i8 = 0b00000000
(zext a to i8) + (zext b to i8) = 0b00001111 + 0b00000001 = 0b00010000

llvm-svn: 210439

10 years agoRefactor canonicalizing array indices to a helper function
Jingyue Wu [Sun, 8 Jun 2014 20:15:45 +0000 (20:15 +0000)]
Refactor canonicalizing array indices to a helper function

No functionality changes.

llvm-svn: 210438

10 years ago[SeparateConstOffsetFromGEP] make two tests more strict
Jingyue Wu [Sun, 8 Jun 2014 20:01:42 +0000 (20:01 +0000)]
[SeparateConstOffsetFromGEP] make two tests more strict

inbounds are not necessary in these two tests. zext(a +nuw b) = zext(a) +
zext(b) should hold with or without inbounds.

llvm-svn: 210437

10 years agoSmallVector: Improve test coverage for insert with repetition
David Blaikie [Sun, 8 Jun 2014 19:33:40 +0000 (19:33 +0000)]
SmallVector: Improve test coverage for insert with repetition

To test cases that involve actual repetition (> 1 elements), at least
one element before the insertion point, and some elements of the
original range that still fit in that range space after insertion.

Actually we need coverage for the inverse case too (where no elements
after the insertion point fit into the previously allocated space), but
this'll do for now, and I might end up rewriting bits of SmallVector to
avoid that special case anyway.

llvm-svn: 210436

10 years agoScalarEvolution: Derive element size from the type of the loaded element
Tobias Grosser [Sun, 8 Jun 2014 19:21:20 +0000 (19:21 +0000)]
ScalarEvolution: Derive element size from the type of the loaded element

Before, we where looking at the size of the pointer type that specifies the
location from which to load the element. This did not make any sense at all.

This change fixes a bug in the delinearization where we failed to delinerize
certain load instructions.

llvm-svn: 210435

10 years agoSmallVector: More movable improvements - don't copy elements to make space when inser...
David Blaikie [Sun, 8 Jun 2014 19:12:31 +0000 (19:12 +0000)]
SmallVector: More movable improvements - don't copy elements to make space when inserting repeated elements.

Also split and improve tests a bit.

llvm-svn: 210433

10 years agoSmallVector: Move, don't copy, elements to make space for an insertion.
David Blaikie [Sun, 8 Jun 2014 19:12:28 +0000 (19:12 +0000)]
SmallVector: Move, don't copy, elements to make space for an insertion.

llvm-svn: 210432

10 years agoX86: simplify data layout calculation
Saleem Abdulrasool [Sun, 8 Jun 2014 19:08:36 +0000 (19:08 +0000)]
X86: simplify data layout calculation

X86Subtarget::isTargetCygMing || X86Subtarget::isTargetKnownWindowsMSVC is
equivalent to all Windows environments.  Simplify the check to isOSWindows.
NFC.

llvm-svn: 210431

10 years agoSmallVectorTest: Remove some more robust checks added in r210429 since they caught...
David Blaikie [Sun, 8 Jun 2014 17:33:47 +0000 (17:33 +0000)]
SmallVectorTest: Remove some more robust checks added in r210429 since they caught some bugs I haven't fixed yet.

Specifically this caused inserting an element from a SmallVector into
itself when such an insertion would cause a reallocation. We have code
to handle this for non-reallocating cases, but it's not robust against
reallocation.

llvm-svn: 210430

10 years agoFix some more moving-from-moved-from objects issues in SmallVector
David Blaikie [Sun, 8 Jun 2014 16:55:13 +0000 (16:55 +0000)]
Fix some more moving-from-moved-from objects issues in SmallVector

(& because it makes it easier to test, this also improves
correctness/performance slightly by moving the last element in an insert
operation, rather than copying it)

llvm-svn: 210429

10 years agoAPFloat: x - NaN needs to flip the signbit of NaN when x is a number.
Stephen Canon [Sun, 8 Jun 2014 16:53:31 +0000 (16:53 +0000)]
APFloat: x - NaN needs to flip the signbit of NaN when x is a number.

Because we don't have a separate negate( ) function, 0 - NaN does double-duty as the IEEE-754 negate( ) operation, which (unlike most FP ops) *does* attach semantic meaning to the signbit of NaN.

llvm-svn: 210428

10 years agoAsmMatchers: Use unique_ptr to manage ownership of MCParsedAsmOperand
David Blaikie [Sun, 8 Jun 2014 16:18:35 +0000 (16:18 +0000)]
AsmMatchers: Use unique_ptr to manage ownership of MCParsedAsmOperand

I saw at least a memory leak or two from inspection (on probably
untested error paths) and r206991, which was the original inspiration
for this change.

I ran this idea by Jim Grosbach a few weeks ago & he was OK with it.
Since it's a basically mechanical patch that seemed sufficient - usual
post-commit review, revert, etc, as needed.

llvm-svn: 210427

10 years agoEnsure SmallVector::insert doesn't overwrite the last element in the range with the...
David Blaikie [Sun, 8 Jun 2014 16:00:02 +0000 (16:00 +0000)]
Ensure SmallVector::insert doesn't overwrite the last element in the range with the already-moved-from value

This would cause the last element in a range to be in a moved-from state
after an insert at a non-end position, losing that value entirely in the
process.

Side note: move_backward is subtle. It copies [A, B) to C-1 and down.
(the fact that it decrements both the second and third iterators before
the first movement is the subtle part... kind of surprising, anyway)

llvm-svn: 210426

10 years ago[Mips] Make got16.test test case independent from external input files.
Simon Atanasyan [Sun, 8 Jun 2014 11:33:05 +0000 (11:33 +0000)]
[Mips] Make got16.test test case independent from external input files.

llvm-svn: 210425

10 years agoRevert "Do materialize for floating point"
Alp Toker [Sun, 8 Jun 2014 09:13:42 +0000 (09:13 +0000)]
Revert "Do materialize for floating point"

1) The commit was made despite profound lack of understanding:

   "I did not understand the comment about using dyn_cast instead of isa. I will
   commit as is and make the update after. You can explain what you meant to me."

   Commit first, understand later isn't OK.

2) Review comments were simply ignored:

   "Can you edit the summary to describe what the patch is for? It appears to be
   a list of commits at the moment."

3) The patch got LGTM'd off-list without any indication of readiness.

4) The public mailing list was excluded from patch review so all of this was
   hidden from the community.

This reverts commit r210414.

llvm-svn: 210424

10 years ago[C++11] Use 'nullptr'. Unittests edition.
Craig Topper [Sun, 8 Jun 2014 08:38:12 +0000 (08:38 +0000)]
[C++11] Use 'nullptr'. Unittests edition.

llvm-svn: 210423

10 years ago[C++11] Use 'nullptr'. Tools edition.
Craig Topper [Sun, 8 Jun 2014 08:38:04 +0000 (08:38 +0000)]
[C++11] Use 'nullptr'. Tools edition.

llvm-svn: 210422

10 years agoRemove outdated CMake MSVC workaround
Alp Toker [Sun, 8 Jun 2014 07:37:17 +0000 (07:37 +0000)]
Remove outdated CMake MSVC workaround

llvm-svn: 210421

10 years agoSplit out inline asm parsing into ParseStmtAsm.cpp
Alp Toker [Sun, 8 Jun 2014 05:40:04 +0000 (05:40 +0000)]
Split out inline asm parsing into ParseStmtAsm.cpp

This change isolates various llvm/MC headers from the rest of the parser and
better aligns with the existing SemaStmtAsm.cpp.

No change in functionality, code move only.

llvm-svn: 210420

10 years agoRemove redundant typedef from MCAsmParserSemaCallback
Alp Toker [Sun, 8 Jun 2014 05:14:54 +0000 (05:14 +0000)]
Remove redundant typedef from MCAsmParserSemaCallback

The last use has been removed in clang r210418.

llvm-svn: 210419

10 years agoDon't include llvm/MC/MCParser throughout all of Sema
Alp Toker [Sun, 8 Jun 2014 05:11:37 +0000 (05:11 +0000)]
Don't include llvm/MC/MCParser throughout all of Sema

Requires LLVM r210417.

llvm-svn: 210418

10 years agoMake InlineAsmIdentifierInfo forward-declarable
Alp Toker [Sun, 8 Jun 2014 05:07:38 +0000 (05:07 +0000)]
Make InlineAsmIdentifierInfo forward-declarable

This helps localize header inclusion in the frontend.

llvm-svn: 210417

10 years agoMS ABI: Simplify microsoft mangling of template instantiations
David Majnemer [Sun, 8 Jun 2014 04:51:13 +0000 (04:51 +0000)]
MS ABI: Simplify microsoft mangling of template instantiations

Use mangled template instantiation name as key for back references.
Templates have their own context for back references, so their mangling
is always the same regardless of context. This avoids mangling template
instantiations twice.

Patch by Agustín Bergé!

llvm-svn: 210416

10 years agoMC: fix text section characteristics for WoA
Saleem Abdulrasool [Sun, 8 Jun 2014 03:57:49 +0000 (03:57 +0000)]
MC: fix text section characteristics for WoA

link.exe requires that the text section has the IMAGE_SCN_MEM_16BIT flag set.
Otherwise, it will treat the function as ARM.  If this occurs, then jumps to the
function will fail, switching from thumb to ARM mode execution.

With this change, it is possible to link using the MSVC linker as well.

llvm-svn: 210415

10 years agoDo materialize for floating point
Reed Kotler [Sun, 8 Jun 2014 03:30:32 +0000 (03:30 +0000)]
Do materialize for floating point

Summary:
start to do simple constants

finish simplestore

add test case

format

Merge branch 'master' into 1756_8

Add basic functionality for assignment of ints. This creates a lot of core infrastructure in which to add, with little effort, quite a bit more to mips fast-isel

Merge branch 'master' into 1756_8

Add basic functionality for assignment of ints. This creates a lot of core infrastructure in which to add, with little effort, quite a bit more to mips fast-isel

in progress

finish integer materialize

test cases

test cases

in progress

Finish up fast-isel materialize for ints.

Finish materialize for ints

test cases

simplestorei.ll

Merge branch 'master' into 1756_8

fix fp constants for fast-isel

Merge branch '1758_1' of dmz-portal.mips.com:llvm into 1758_1

in progress

lastest for fp materialization

clean up

Merge branch 'master' into 1758_1

formatting

add test case

finish test case

Merge branch 'master' into 1758_2

Test Plan:
simplestore.ll

simplestore.ll

Reviewers: dsanders

Reviewed By: dsanders

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

llvm-svn: 210414

10 years agostart to clean up buildMI calls in mips fast-isel
Reed Kotler [Sun, 8 Jun 2014 03:04:42 +0000 (03:04 +0000)]
start to clean up buildMI calls in mips fast-isel

Summary: Merge branch 'master' into 1758_6

Test Plan:
No functionality change. Run "make check" and run test-suite.
Because our servers are not yet running again I have not yet run test-suite.
I will further review myself before submission.

Reviewers: dsanders

Reviewed By: dsanders

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

llvm-svn: 210413

10 years agoRe-enable ARM ELF tests
Alp Toker [Sun, 8 Jun 2014 02:46:02 +0000 (02:46 +0000)]
Re-enable ARM ELF tests

r210408 inadvertently disabled them when X86 is not selected.

llvm-svn: 210412

10 years agoFix build when no native target is enabled
Alp Toker [Sun, 8 Jun 2014 02:45:56 +0000 (02:45 +0000)]
Fix build when no native target is enabled

The JITTests and MCJITTests unit test targets require a native arch with JIT
support, otherwise fail to link.

llvm-svn: 210411

10 years agoinclude MipsGenFastISel.inc
Reed Kotler [Sun, 8 Jun 2014 02:08:43 +0000 (02:08 +0000)]
include MipsGenFastISel.inc

Summary:
Included this file which is needed to enable tablegen generated functionality
for fast mips-isel

Test Plan:
This has no visible functionality by itself but just adding the include
file creates some issues so I have it as a separate patch.

Reviewers: dsanders

Reviewed By: dsanders

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

llvm-svn: 210410

10 years agotest: add test case for SVN r210406
Saleem Abdulrasool [Sun, 8 Jun 2014 01:27:32 +0000 (01:27 +0000)]
test: add test case for SVN r210406

Add missing test case for constructor section selection.  Thanks David Blaikie!

llvm-svn: 210409

10 years agotest: move some tests into ARM directory
Saleem Abdulrasool [Sun, 8 Jun 2014 01:04:05 +0000 (01:04 +0000)]
test: move some tests into ARM directory

Rather than requiring ARM support for the ELF tests (which is odd), move the
tests that require ARM into a subdirectory to use lit to disable them if the
support is not present.  Play this game to prevent disabling the ELF tests on
the Windows build bots as they have caught issues in the past with interactions
between various platforms.

llvm-svn: 210408

10 years agoMC: make ELF .type handling more GNU AS compatible
Saleem Abdulrasool [Sun, 8 Jun 2014 00:34:34 +0000 (00:34 +0000)]
MC: make ELF .type handling more GNU AS compatible

GAS documents the .type directive as having an optional comma following the key
symbol name when using the STT_<TYPE_IN_UPPER_CASE> form.  However, it treats
the comma as optional in all cases.  This makes the IAS support both forms of
inputs.  Furthermore, the prefixed forms take either the upper case name or the
lower case alias.

The tests are split into two separate sets as the hash character serves as a
comment character on x86, which is tested in the second set by using arm-elf
which uses the at symbol as a comment character.

llvm-svn: 210407

10 years agoMC: fix ctor/dtor section for windows-itanium
Saleem Abdulrasool [Sun, 8 Jun 2014 00:34:27 +0000 (00:34 +0000)]
MC: fix ctor/dtor section for windows-itanium

This adjusts the section setup for the windows-itanium environment.  This
environment does not report to be a known windows msvc environment, even though
it is (nearly) identical to the MSVC environment for C code.

llvm-svn: 210406

10 years agoMC: whitespace, grouping for COFF section setup
Saleem Abdulrasool [Sun, 8 Jun 2014 00:34:23 +0000 (00:34 +0000)]
MC: whitespace, grouping for COFF section setup

Add some whitespace, combine two sequential conditionals into a single one.
Reformat some section definitions to maintain uniformity in the function.
NFC.

llvm-svn: 210405

10 years agoDeclObjC: Fix comments about bad API
Alp Toker [Sat, 7 Jun 2014 23:31:01 +0000 (23:31 +0000)]
DeclObjC: Fix comments about bad API

What's going on here isn't overriding but rather the sketchy practice of member
hiding (shadowing of base members).

llvm-svn: 210404

10 years agoAvoid dubious IdentifierInfo::getNameStart() uses
Alp Toker [Sat, 7 Jun 2014 23:30:53 +0000 (23:30 +0000)]
Avoid dubious IdentifierInfo::getNameStart() uses

These cases in particular were incurring an extra strlen() when we already knew
the length. They appear to be leftovers from when the interfaces worked with C
strings that have continued to compile due to the implicit StringRef ctor.

llvm-svn: 210403

10 years agoStringRefize TargetInfo::getABI()
Alp Toker [Sat, 7 Jun 2014 23:30:42 +0000 (23:30 +0000)]
StringRefize TargetInfo::getABI()

llvm-svn: 210402

10 years agoFix typos
Alp Toker [Sat, 7 Jun 2014 21:23:09 +0000 (21:23 +0000)]
Fix typos

llvm-svn: 210401

10 years agoBuild fix: remove initializeJumpInstrTablesPass() call from LTO
Alp Toker [Sat, 7 Jun 2014 20:39:53 +0000 (20:39 +0000)]
Build fix: remove initializeJumpInstrTablesPass() call from LTO

This was incurring an unsatisfied dependency on CodeGen from LTO breaking
shared builds:

Undefined symbols for architecture x86_64:
  "llvm::initializeJumpInstrTablesPass(llvm::PassRegistry&)", referenced from:
      llvm::LTOCodeGenerator::initializeLTOPasses() in LTOCodeGenerator.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Removed as a temporary measure pending feedback from the author.

llvm-svn: 210400

10 years agoARM: correct assertion for long-calls on WoA
Saleem Abdulrasool [Sat, 7 Jun 2014 20:29:27 +0000 (20:29 +0000)]
ARM: correct assertion for long-calls on WoA

COFF/PE, so the relocation model is never static.  Loosen the assertion
accordingly.  The relocation can still be emitted properly, as it will be
converted to an IMAGE_REL_ARM_ADDR32 which will be resolved by the loader
taking the base relocation into account.  This is necessary to permit the
emission of long calls which can be controlled via the -mlong-calls option in
the driver.

llvm-svn: 210399

10 years agoDriver: add -m{,no-}long-calls support
Saleem Abdulrasool [Sat, 7 Jun 2014 19:32:38 +0000 (19:32 +0000)]
Driver: add -m{,no-}long-calls support

This mirrors the GCC option for the ARM backend.  This option enables the
backend option "-enable-arm-long-calls".  The default behaviour is that this is
disabled due to the slight overhead of the generated calls.

If the target of jumps are greater than 64M range of offset-based jumps, then
the target address must be loaded into a register to make an indirect jump.  The
backend support for this has been present, but was not previously controllable
by the proper flag.

llvm-svn: 210398

10 years agotools: add a high level explanation for WoA EH data
Saleem Abdulrasool [Sat, 7 Jun 2014 19:23:07 +0000 (19:23 +0000)]
tools: add a high level explanation for WoA EH data

Add a brief explanation of the data section layout for the unwind data that the
Windows on ARM EH models.  This is simply to provide a rough idea of the layout
of the code involved in the decoding of the unwinding.  Details on the involved
data structures are available in the associated support header.  The bulk of it
is related to printing out the byte-code to help validate generation of WoA EH.

No functional change.

llvm-svn: 210397

10 years ago[OCaml] Commit missing parts of r210395
Peter Zotov [Sat, 7 Jun 2014 15:53:28 +0000 (15:53 +0000)]
[OCaml] Commit missing parts of r210395

llvm-svn: 210396

10 years ago[OCaml] Introduce an llmdkind abstract type.
Peter Zotov [Sat, 7 Jun 2014 15:15:10 +0000 (15:15 +0000)]
[OCaml] Introduce an llmdkind abstract type.

Patch by Gabriel Radanne.

While this commit technically breaks API, no code should have supplied
the integer IDs directly, and thus no code should break.

llvm-svn: 210395

10 years ago[Mips] Handle Mips TLS relocations R_MIPS_TLS_GOTTPREL / R_MIPS_TLS_GD / R_MIPS_TLS_L...
Simon Atanasyan [Sat, 7 Jun 2014 13:20:53 +0000 (13:20 +0000)]
[Mips] Handle Mips TLS relocations R_MIPS_TLS_GOTTPREL / R_MIPS_TLS_GD / R_MIPS_TLS_LDM etc.

llvm-svn: 210394

10 years agoRevert 209903 and 210040.
Rafael Espindola [Sat, 7 Jun 2014 04:12:35 +0000 (04:12 +0000)]
Revert 209903 and 210040.

The messages were

 "PR19753: Optimize comparisons with "ashr exact" of a constanst."
 "Added support to optimize comparisons with "lshr exact" of a constant."

They were not correctly handling signed/unsigned operation differences,
causing pr19958.

llvm-svn: 210393

10 years agoUnbreak release builds.
Arnold Schwaighofer [Sat, 7 Jun 2014 02:30:08 +0000 (02:30 +0000)]
Unbreak release builds.

This test case relies on basic block labels.

llvm-svn: 210392

10 years ago[PPC64LE] Implement little-endian semantics for vec_unpack[hl]
Bill Schmidt [Sat, 7 Jun 2014 02:20:52 +0000 (02:20 +0000)]
[PPC64LE] Implement little-endian semantics for vec_unpack[hl]

The PowerPC vector-unpack-high and vector-unpack-low instructions
are defined architecturally with a big-endian bias, in that the vector
element numbering is assumed to be "left to right" regardless of
whether the processor is in big-endian or little-endian mode.  This
effectively reverses the meaning of "high" and "low."  Such a
definition is unnatural for little-endian code generation.

To facilitate ease of porting, the vec_unpackh and vec_unpackl
interfaces are designed to use natural element ordering, so that
elements are numbered according to little-endian design principles
when code is generated for a little-endian target.  The desired
semantics can be achieved by using the opposite instruction for
little-endian mode.  That is, when a call to vec_unpackh appears in
the code, a vector-unpack-low is generated, and when a call to
vec_unpackl appears in the code, a vector-unpack-high is generated.

The correctness of this code is tested by the new unpack.c test
added in a previous patch, as well as the modifications to
builtins-ppc-altivec.c in the present patch.

Note that these interfaces were originally incorrectly implemented
when they take a vector pixel argument.  This patch corrects this
implementation for both big- and little-endian code generation.

llvm-svn: 210391

10 years agoFix the MachineScheduler's logic for updating ready times for in-order.
Andrew Trick [Sat, 7 Jun 2014 01:48:43 +0000 (01:48 +0000)]
Fix the MachineScheduler's logic for updating ready times for in-order.

Now the scheduler updates a node's ready time as soon as it is
scheduled, before releasing dependent nodes. There was a reason I
didn't do this initially but it no longer applies.

A53 is in-order and was running into an issue where nodes where added
to the readyQ too early. That's now fixed.

This also makes it easier for custom scheduling strategies to build
heuristics based on the actual cycles that the node was scheduled at.

The only impact on OOO (sandybridge/cyclone) is that ready times will
be slightly more accurate. I didn't measure any significant regressions.

llvm-svn: 210390

10 years ago[PPC64LE] Update test for vec_sum2s interface
Bill Schmidt [Sat, 7 Jun 2014 01:47:42 +0000 (01:47 +0000)]
[PPC64LE] Update test for vec_sum2s interface

Commit r210384 prematurely included changes to the little-endian
implementation of the vec_sum2s interface.  This patch modifies
test/CodeGen/builtins-ppc-altivec.c to test those changes.

llvm-svn: 210389

10 years agoFix crash declaring global allocation function with zero parameters. Fixes PR19968!
Nick Lewycky [Sat, 7 Jun 2014 00:43:57 +0000 (00:43 +0000)]
Fix crash declaring global allocation function with zero parameters. Fixes PR19968!

llvm-svn: 210388

10 years agoFix my poor grammar from r210372
Richard Trieu [Fri, 6 Jun 2014 23:56:22 +0000 (23:56 +0000)]
Fix my poor grammar from r210372

llvm-svn: 210387

10 years agoReplace the use of TargetMachine with a tiny bool variable.
Eric Christopher [Fri, 6 Jun 2014 23:26:48 +0000 (23:26 +0000)]
Replace the use of TargetMachine with a tiny bool variable.

llvm-svn: 210386

10 years agoRemove all local variables from X86SelectionDAGInfo, the DAG has
Eric Christopher [Fri, 6 Jun 2014 23:26:43 +0000 (23:26 +0000)]
Remove all local variables from X86SelectionDAGInfo, the DAG has
all of the ones we were stashing away on startup.

llvm-svn: 210385

10 years ago[PPC64LE] Update builtins-ppc-altivec.c for PPC64 and PPC64LE
Bill Schmidt [Fri, 6 Jun 2014 23:12:00 +0000 (23:12 +0000)]
[PPC64LE] Update builtins-ppc-altivec.c for PPC64 and PPC64LE

The Altivec builtin test case test/CodeGen/builtins-ppc-altivec.c has
always been executed only for 32-bit PowerPC.  These tests are equally
valid for 64-bit PowerPC.  This patch updates the test to be run for
three targets:  powerpc-unknown-unknown, powerpc64-unknown-unknown,
and powerpc64le-unknown-unknown.  The expected code generation changes
for some of the Altivec builtins for little endian, so this patch adds
new CHECK-LE variants to the test for the powerpc64le target.

These tests satisfy the testing requirements for some previous patches
committed over the last couple of days for lib/Headers/altivec.h:
r210279 for vec_perm, r210337 for vec_mul[eo], and r210340 for
vec_pack.

llvm-svn: 210384

10 years agoADT: introduce isWindowsItaniumEnvironment
Saleem Abdulrasool [Fri, 6 Jun 2014 22:46:18 +0000 (22:46 +0000)]
ADT: introduce isWindowsItaniumEnvironment

Add an isWindowsItaniumEnvironment function to Triple to mirror the other
Windows environments.  This is simply a utility function to check if we are
targeting windows-itanium rather than windows-msvc.

llvm-svn: 210383

10 years agoDelay lookup of simple default template arguments under -fms-compatibility
Reid Kleckner [Fri, 6 Jun 2014 22:36:36 +0000 (22:36 +0000)]
Delay lookup of simple default template arguments under -fms-compatibility

MSVC delays parsing of default arguments until instantiation.  If the
default argument is never used, it is never parsed.  We don't model
this.

Instead, if lookup of a type name fails in a template argument context,
we form a DependentNameType, which will be looked up at instantiation
time.

This fixes errors about 'CControlWinTraits' in atlwin.h.

Reviewers: rsmith

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

llvm-svn: 210382

10 years agoTesting infastructure: A template for char_traits where all the functions are constex...
Marshall Clow [Fri, 6 Jun 2014 22:33:40 +0000 (22:33 +0000)]
Testing infastructure: A template for char_traits where all the functions are constexpr, and a comparison predicate which counts how many times it's been called.

llvm-svn: 210381

10 years agoSince we now have a value for __cplusplus for c++14, teach libc++ about it
Marshall Clow [Fri, 6 Jun 2014 22:31:09 +0000 (22:31 +0000)]
Since we now have a value for __cplusplus for c++14, teach libc++ about it

llvm-svn: 210380

10 years agoDebugInfo: Use the scope of the function declaration, if any, to name a function...
David Blaikie [Fri, 6 Jun 2014 22:29:05 +0000 (22:29 +0000)]
DebugInfo: Use the scope of the function declaration, if any, to name a function in DWARF pubnames

This ensures that member functions, for example, are entered into
pubnames with their fully qualified name, rather than inside the global
namespace.

llvm-svn: 210379

10 years agoDebugInfo: pubnames: include file-local (static or anonymous namespace) variables...
David Blaikie [Fri, 6 Jun 2014 22:16:56 +0000 (22:16 +0000)]
DebugInfo: pubnames: include file-local (static or anonymous namespace) variables and anonymous namespaces themselves.

Still some issues with name qualification, FIXMEs added to test cases
and fixes will come next.

llvm-svn: 210378

10 years ago[MS-ABI] Implement dynamic_cast
Warren Hunt [Fri, 6 Jun 2014 22:12:37 +0000 (22:12 +0000)]
[MS-ABI] Implement dynamic_cast
This patch implements call lower from dynamic_cast to __RTDynamicCast
and __RTCastToVoid.  Test cases are included.  A feature of note is that
helper function getPolymorphicOffset is placed in such a way that it can
be used by EmitTypeid (to be implemented in a later patch) without being
moved.  Details are included as comments directly in the code.

llvm-svn: 210377

10 years agoRemove invalid comment from last commit.
Todd Fiala [Fri, 6 Jun 2014 21:59:19 +0000 (21:59 +0000)]
Remove invalid comment from last commit.

llvm-svn: 210376

10 years agoInstCombine: Canonicalize addrspacecast between different element types
Jingyue Wu [Fri, 6 Jun 2014 21:52:55 +0000 (21:52 +0000)]
InstCombine: Canonicalize addrspacecast between different element types

addrspacecast X addrspace(M)* to Y addrspace(N)*

-->

bitcast X addrspace(M)* to Y addrspace(M)*
addrspacecast Y addrspace(M)* to Y addrspace(N)*

Updat all affected tests and add several new tests in addrspacecast.ll.

This patch is based on http://reviews.llvm.org/D2186 (authored by Matt
Arsenault) with fixes and more tests.

llvm-svn: 210375

10 years agoAdded gdb-remote program counter check at breakpoint.
Todd Fiala [Fri, 6 Jun 2014 21:50:04 +0000 (21:50 +0000)]
Added gdb-remote program counter check at breakpoint.

Modified the breakpoint stop and start check to verify the program
counter printed immediately after stopping does match the breakpoint
address. This is based on a conversation with Greg Clayton clarifying
that the breakpoint stop handling code on a remote should do any and
all adjusting of the program counter at stop time, not at resume time.

Added a qProcessInfo parser and helper methods to add the collection
send/response elements to the packet flow. Removed the older pid-only
query mechanism. The parser verifies all the keys provided are within
the documented known set of key-value pairs.

Added helper routine to unpack the hex value of a $p-style register
read response according to the endian-ness of the inferior as reported
by qProcessInfo.

Added a test to verify qProcessInfo includes an endian key/value pair.

Refactored several older tests to move to the less verbose test
startup code. Most of these were the tests using the older
qProcessInfo pid-only retrieval code.

llvm-svn: 210374

10 years agoMC: prevent early DCE of empty sections
Saleem Abdulrasool [Fri, 6 Jun 2014 21:40:16 +0000 (21:40 +0000)]
MC: prevent early DCE of empty sections

Prevent the early elimination of sections in the object writer.  There may be
references to the section itself by other symbols, which may potentially not be
possible to resolve.  ML (Visual Studio's Macro Assembler) also seems to retain
empty sections.

The elimination of symbols and sections which are unused should really occur at
the link phase.  This will not cause any change in the resulting binary, simply
in the generated object files.

The adjustments to the other unit tests account for the fluctuating section
index caused by the appearance of sections which were previously discarded.

llvm-svn: 210373

10 years agoAdd -Wtautological-undefined-compare and -Wundefined-bool-conversion warnings
Richard Trieu [Fri, 6 Jun 2014 21:39:26 +0000 (21:39 +0000)]
Add -Wtautological-undefined-compare and -Wundefined-bool-conversion warnings
to detect underfined behavior involving pointers.

llvm-svn: 210372

10 years agoX86: Don't turn shifts into ands if there's another use that may not check for equality.
Benjamin Kramer [Fri, 6 Jun 2014 21:08:55 +0000 (21:08 +0000)]
X86: Don't turn shifts into ands if there's another use that may not check for equality.

Fixes PR19964.

llvm-svn: 210371

10 years ago[TSan] Make lit-tests more self-contained
Alexey Samsonov [Fri, 6 Jun 2014 21:04:55 +0000 (21:04 +0000)]
[TSan] Make lit-tests more self-contained

llvm-svn: 210370

10 years agoFix DOS-style newlines.
Eli Bendersky [Fri, 6 Jun 2014 20:31:48 +0000 (20:31 +0000)]
Fix DOS-style newlines.

A previous patch r210330 (and possibly another) introduced DOS-style newlines
into a UNIX newline formatted file.

Patch by Mark Heffernan (http://reviews.llvm.org/D4046)

llvm-svn: 210369

10 years agoMS ABI: Update the thunk linkage computation
Hans Wennborg [Fri, 6 Jun 2014 20:04:01 +0000 (20:04 +0000)]
MS ABI: Update the thunk linkage computation

As suggested by Reid:

 - class has GVA_Internal linkage -> internal
 - thunk has return adjustment -> weak_odr, to handle evil corner case [1]
 - all other normal methods -> linkonce_odr

 1. Evil corner case:

  struct Incomplete;
  struct A { int a; virtual A *bar(); };
  struct B { int b; virtual B *foo(Incomplete); };
  struct C : A, B { int c; virtual C *foo(Incomplete); };
  C c;

Here, the thunk for C::foo() will be emitted when C::foo() is defined, which
might be in a different translation unit, so it needs to be weak_odr.

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

llvm-svn: 210368

10 years agoFix a few issues with comdat handling on COFF.
Rafael Espindola [Fri, 6 Jun 2014 19:26:12 +0000 (19:26 +0000)]
Fix a few issues with comdat handling on COFF.

* Section association cannot use just the section name as many
sections can have the same name. With this patch, the comdat symbol in
an assoc section is interpreted to mean a symbol in the associated
section and the mapping is discovered from it.

* Comdat symbols were not being set correctly. Instead we were getting
whatever was output first for that section.

A consequence is that associative sections now must use .section to
set the association. Using .linkonce would not work since it is not
possible to change a sections comdat symbol (it is used to decide if
we should create a new section or reuse an existing one).

This includes r210298, which was reverted because it was asserting
on an associated section having the same comdat as the associated
section.

llvm-svn: 210367

10 years agoHave TargetSelectionDAGInfo take a DataLayout initializer rather than
Eric Christopher [Fri, 6 Jun 2014 19:04:48 +0000 (19:04 +0000)]
Have TargetSelectionDAGInfo take a DataLayout initializer rather than
a TargetMachine since the only thing it wants is DataLayout.

llvm-svn: 210366

10 years agotsan: fix argument passing in Go interface
Dmitry Vyukov [Fri, 6 Jun 2014 18:53:52 +0000 (18:53 +0000)]
tsan: fix argument passing in Go interface
Go calling convention does not support bools (it probably works, but uptrs are safer)

llvm-svn: 210365

10 years agoMatch the full hex offsets in test/DebugInfo/X86/gnu-public-names.ll
David Blaikie [Fri, 6 Jun 2014 18:45:14 +0000 (18:45 +0000)]
Match the full hex offsets in test/DebugInfo/X86/gnu-public-names.ll

These checks were accidentally skipping the 0x prefix in the hex
offsets, then cunningly ignoring the prefix in the use of those captured
values.

Except in the case of the unit length, where the match was only matching
the leading '0' before the x in the 0x prefix, then matching that
against the length. We can't actually express the length association
here, as the length field in the Compile Unit header does not include
the length field itself, but the length field in the pubnames section
/does/ include the size of the length field in the Compile Unit header -
so the two numbers are actually 4 bytes different. Just skip matching
that.

llvm-svn: 210364

10 years agoFix a typo made in Programmer's Manual made in r210354. Spotted
Dan Liew [Fri, 6 Jun 2014 18:44:21 +0000 (18:44 +0000)]
Fix a typo made in Programmer's Manual made in r210354. Spotted
by Paul Robinson.

llvm-svn: 210363

10 years agoRemove DWARF3 testing of test/DebugInfo/X86/gnu-public-names.ll
David Blaikie [Fri, 6 Jun 2014 18:22:04 +0000 (18:22 +0000)]
Remove DWARF3 testing of test/DebugInfo/X86/gnu-public-names.ll

This was added to test that DW_AT_GNU_pubnames used sec_offset in DWARF4
and data4 in DWARF3 and below. Since then we've updated
DW_AT_GNU_pubnames to be a flag, rather than a section offset anyway.

Granted this still differs between DWARF 3 and DWARF 4
(FORM_flag_present versun FORM_flag) but it doesn't seem worthwhile
testing that codepath again here. It's covered adequately in many other
test cases.

And while I'm here, don't hardcode the byte size of the compile unit -
it's not relevant to this test and just makes it brittle if/when
anything changes in the way this CU is emitted.

llvm-svn: 210362

10 years agoFixed a bug in lowering shuffle_vectors to insertps
Filipe Cabecinhas [Fri, 6 Jun 2014 18:07:06 +0000 (18:07 +0000)]
Fixed a bug in lowering shuffle_vectors to insertps

Summary:
We were being too strict and not accounting for undefs.
Added a test case and fixed another one where we improved codegen.

Reviewers: grosbach, nadav, delena

Subscribers: llvm-commits

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

llvm-svn: 210361

10 years agoUn-xfail passing ARM Android tests
Greg Fitzgerald [Fri, 6 Jun 2014 18:06:58 +0000 (18:06 +0000)]
Un-xfail passing ARM Android tests

llvm-svn: 210360

10 years agotsan: fix CurrentStackId
Dmitry Vyukov [Fri, 6 Jun 2014 18:05:12 +0000 (18:05 +0000)]
tsan: fix CurrentStackId
FuncEnter adds FuncEnter entry to trace that nobody removes later

llvm-svn: 210359

10 years agotsan: fix mutex in Go mode
Dmitry Vyukov [Fri, 6 Jun 2014 18:04:05 +0000 (18:04 +0000)]
tsan: fix mutex in Go mode
In Go it's legal to unlock from a different goroutine.

llvm-svn: 210358

10 years agotest/SemaCXX/undefined-internal.cpp: Remove target triple.
Hans Wennborg [Fri, 6 Jun 2014 17:51:25 +0000 (17:51 +0000)]
test/SemaCXX/undefined-internal.cpp: Remove target triple.

This test seems to run fine in both MS and Itanium C++ ABI mode these days.

llvm-svn: 210357

10 years agoDefer codegen of inline method definitions to the end of current top level declaration
Hans Wennborg [Fri, 6 Jun 2014 17:36:17 +0000 (17:36 +0000)]
Defer codegen of inline method definitions to the end of current top level declaration

We would previously fail to emit a definition of bar() for the following code:

  struct __declspec(dllexport) S {
    void foo() {
      t->bar();
    }
    struct T {
      void bar() {}
    };
    T *t;
  };

Note that foo() is an exported method, but bar() is not. However, foo() refers
to bar() so we need to emit its definition. We would previously fail to
realise that bar() is used.

By deferring the method definitions until the end of the top level declaration,
we can simply call EmitTopLevelDecl on them and rely on the usual mechanisms
to decide whether the method should be emitted or not.

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

llvm-svn: 210356

10 years agoRetain an expression pack expansion when the parameter pack expansion code asks
Richard Smith [Fri, 6 Jun 2014 17:33:35 +0000 (17:33 +0000)]
Retain an expression pack expansion when the parameter pack expansion code asks
us to.

llvm-svn: 210355

10 years agoMention the IRBuilder in Programmer's Manual with a few small examples.
Dan Liew [Fri, 6 Jun 2014 17:25:47 +0000 (17:25 +0000)]
Mention the IRBuilder in Programmer's Manual with a few small examples.

llvm-svn: 210354

10 years agotsan: disable reporting of mutex misuses in Go
Dmitry Vyukov [Fri, 6 Jun 2014 17:23:27 +0000 (17:23 +0000)]
tsan: disable reporting of mutex misuses in Go

llvm-svn: 210353

10 years agotsan: minor optimizations for Go runtime
Dmitry Vyukov [Fri, 6 Jun 2014 16:06:19 +0000 (16:06 +0000)]
tsan: minor optimizations for Go runtime

llvm-svn: 210351

10 years agoPR14841: If partial substitution of explicitly-specified template arguments
Richard Smith [Fri, 6 Jun 2014 16:00:50 +0000 (16:00 +0000)]
PR14841: If partial substitution of explicitly-specified template arguments
results in a template having too many arguments, but all the trailing arguments
are packs, that's OK if we have a partial pack substitution: the trailing pack
expansions may end up empty.

llvm-svn: 210350

10 years agotsan: fix out-of-bounds access in Go runtime
Dmitry Vyukov [Fri, 6 Jun 2014 15:56:08 +0000 (15:56 +0000)]
tsan: fix out-of-bounds access in Go runtime
FuncEntry can resize the shadow stack, while "thr->shadow_stack_pos[0] = pc" writes out-of-bounds.

llvm-svn: 210349

10 years agotsan: fix mapping of meta shadow for Go
Dmitry Vyukov [Fri, 6 Jun 2014 15:54:49 +0000 (15:54 +0000)]
tsan: fix mapping of meta shadow for Go
Go maps heap and data+bss, these regions are not adjacent.
data+bss is mapped first.

llvm-svn: 210348

10 years agotsan: flush metamap per-thread cache when thread finishes
Dmitry Vyukov [Fri, 6 Jun 2014 15:52:10 +0000 (15:52 +0000)]
tsan: flush metamap per-thread cache when thread finishes

llvm-svn: 210347

10 years agotsan: fix clang warning:
Dmitry Vyukov [Fri, 6 Jun 2014 15:51:20 +0000 (15:51 +0000)]
tsan: fix clang warning:
comparison of unsigned expression >= 0 is always true

llvm-svn: 210346

10 years agotsan: fix Go build with TSAN_COLLECT_STATS
Dmitry Vyukov [Fri, 6 Jun 2014 15:50:29 +0000 (15:50 +0000)]
tsan: fix Go build with TSAN_COLLECT_STATS
Go does not have cur_thread function.

llvm-svn: 210345

10 years agotsan: allow to build Go runtime with clang + enable SSE3
Dmitry Vyukov [Fri, 6 Jun 2014 15:49:49 +0000 (15:49 +0000)]
tsan: allow to build Go runtime with clang + enable SSE3

llvm-svn: 210344

10 years agoFix typo in a test from r210342.
Michael Zolotukhin [Fri, 6 Jun 2014 15:49:47 +0000 (15:49 +0000)]
Fix typo in a test from r210342.

llvm-svn: 210343

10 years ago[SLP] Enable vectorization of GEP expressions.
Michael Zolotukhin [Fri, 6 Jun 2014 15:34:24 +0000 (15:34 +0000)]
[SLP] Enable vectorization of GEP expressions.

The use cases look like the following:
    x->a = y->a + 10
    x->b = y->b + 12

llvm-svn: 210342

10 years ago[PPC64LE] Implement little-endian semantics for vec_pack family
Bill Schmidt [Fri, 6 Jun 2014 15:10:47 +0000 (15:10 +0000)]
[PPC64LE] Implement little-endian semantics for vec_pack family

The PowerPC vector-pack instructions are defined architecturally with
a big-endian bias, in that the vector element numbering is assumed to
be "left to right" regardless of whether the processor is in
big-endian or little-endian mode.  This definition is unnatural for
little-endian code generation.

To facilitate ease of porting, the vec_pack and related interfaces are
designed to use natural element ordering, so that elements are
numbered according to little-endian design principles when code is
generated for a little-endian target.  The vec_pack calls are
implemented as calls to vec_perm, specifying selection of the
odd-numbered vector elements.  For little endian, this means the
odd-numbered elements counting from the right end of the register.
Since the underlying instructions count from the left end, we must
instead select the even-numbered vector elements for little endian to
achieve the desired semantics.

The correctness of this code is tested by the new pack.c test added in
a previous patch.  I plan to later make the existing ppc32 Altivec
compile-time tests work for ppc64 and ppc64le as well.

llvm-svn: 210340

10 years agoFix RecursiveASTVisitor to visit types in ObjCPropertyDecl
Alp Toker [Fri, 6 Jun 2014 15:05:09 +0000 (15:05 +0000)]
Fix RecursiveASTVisitor to visit types in ObjCPropertyDecl

Patch by Mathieu Baudet!

llvm-svn: 210339