platform/upstream/llvm.git
10 years agoReapply "DebugInfo: Ensure that all debug location scope chains from instructions...
David Blaikie [Fri, 18 Jul 2014 17:49:10 +0000 (17:49 +0000)]
Reapply "DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself."""

Recommits 212776 which was reverted in r212793. This has been committed
and recommitted a few times as I try to test it harder and find/fix more
issues. The most recent revert was due to an asan bot failure which I
can't seem to reproduce locally, though I believe I'm following all the
steps the buildbot does.

So I'm going to recommit this in the hopes of investigating the failure
on the buildbot itself... apologies in advance for the bot noise. If
anyone sees failures with this /please/ provide me with any
reproductions, etc.

llvm-svn: 213391

10 years ago[Mips] Replace assembler code by YAML to make the test 'base-address.test'
Simon Atanasyan [Fri, 18 Jul 2014 17:23:21 +0000 (17:23 +0000)]
[Mips] Replace assembler code by YAML to make the test 'base-address.test'
target independent.

llvm-svn: 213390

10 years agoFix build failure on windows
David Peixotto [Fri, 18 Jul 2014 16:41:58 +0000 (16:41 +0000)]
Fix build failure on windows

Add explicit constructor to struct instead of using brace initialization.

llvm-svn: 213389

10 years agoFor i386, gcc 4.9 under Debian (at least) updated its paths to i586-linux-gnu
Sylvestre Ledru [Fri, 18 Jul 2014 16:24:57 +0000 (16:24 +0000)]
For i386, gcc 4.9 under Debian (at least) updated its paths to i586-linux-gnu
(i486-linux-gnu previously). Adding this triple to the list of search.
Also impacts clang 3.4.2

Reported on the Debian bug tracking system here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=754963
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=755183

llvm-svn: 213388

10 years agoMC: support different sized constants in constant pools
David Peixotto [Fri, 18 Jul 2014 16:05:14 +0000 (16:05 +0000)]
MC: support different sized constants in constant pools

On AArch64 the pseudo instruction ldr <reg>, =... supports both
32-bit and 64-bit constants. Add support for 64 bit constants for
the pools to support the pseudo instruction fully.

Changes the AArch64 ldr-pseudo tests to use 32-bit registers and
adds tests with 64-bit registers.

Patch by Janne Grunau!

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

llvm-svn: 213387

10 years agoMark C++ reference parameters as dereferenceable
Hal Finkel [Fri, 18 Jul 2014 15:52:10 +0000 (15:52 +0000)]
Mark C++ reference parameters as dereferenceable

Because references must be initialized using some evaluated expression, they
must point to something, and a callee can assume the reference parameter is
dereferenceable. Taking advantage of a new attribute just added to LLVM, mark
them as such.

Because dereferenceability in addrspace(0) implies nonnull in the backend, we
don't need both attributes. However, we need to know the size of the object to
use the dereferenceable attribute, so for incomplete types we still emit only
nonnull.

llvm-svn: 213386

10 years agoAdd a dereferenceable attribute
Hal Finkel [Fri, 18 Jul 2014 15:51:28 +0000 (15:51 +0000)]
Add a dereferenceable attribute

This attribute indicates that the parameter or return pointer is
dereferenceable. Practically speaking, loads from such a pointer within the
associated byte range are safe to speculatively execute. Such pointer
parameters are common in source languages (C++ references, for example).

llvm-svn: 213385

10 years agotsan: fix Go runtime build with clang
Dmitry Vyukov [Fri, 18 Jul 2014 15:32:22 +0000 (15:32 +0000)]
tsan: fix Go runtime build with clang

llvm-svn: 213384

10 years ago[mips] Use Triple::getVendor() instead of Triple::getVendorName() to identify 'mti...
Daniel Sanders [Fri, 18 Jul 2014 15:05:38 +0000 (15:05 +0000)]
[mips] Use Triple::getVendor() instead of Triple::getVendorName() to identify 'mti' vendor triples.

llvm-svn: 213383

10 years agotsan: expose atomic operations in Go runtime
Dmitry Vyukov [Fri, 18 Jul 2014 14:54:02 +0000 (14:54 +0000)]
tsan: expose atomic operations in Go runtime

llvm-svn: 213382

10 years agoAdd MIPS Technologies to the vendors in llvm::Triple.
Daniel Sanders [Fri, 18 Jul 2014 14:28:19 +0000 (14:28 +0000)]
Add MIPS Technologies to the vendors in llvm::Triple.

This is a prerequisite for checking for 'mti' and 'img' in a consistent way in
clang. Previously 'img' could use Triple::getVendor() but 'mti' could only use
Triple::getVendorName().

llvm-svn: 213381

10 years agoRevert "Emit lifetime.start / lifetime.end markers for unnamed temporary objects."
Arnaud A. de Grandmaison [Fri, 18 Jul 2014 14:23:58 +0000 (14:23 +0000)]
Revert "Emit lifetime.start / lifetime.end markers for unnamed temporary objects."

This reverts commit dbf785a6432f78a8ec229665876647c4cc610d3d, while I qm
investigating a buildbot failure.

llvm-svn: 213380

10 years agoEmit lifetime.start / lifetime.end markers for unnamed temporary objects.
Arnaud A. de Grandmaison [Fri, 18 Jul 2014 13:36:33 +0000 (13:36 +0000)]
Emit lifetime.start / lifetime.end markers for unnamed temporary objects.

This will give more information to the optimizers so that they can reuse stack slots.

llvm-svn: 213379

10 years agoAArch64: implement efficient f16 bitcasts
Tim Northover [Fri, 18 Jul 2014 13:07:05 +0000 (13:07 +0000)]
AArch64: implement efficient f16 bitcasts

Because i16 is illegal, there's no native DAG method to
represent a bitcast to or from an f16 type. This meant LLVM was
inserting a stack store/load pair which is really not ideal.

llvm-svn: 213378

10 years agoNVPTX: support fpext/fptrunc to and from f16.
Tim Northover [Fri, 18 Jul 2014 13:01:43 +0000 (13:01 +0000)]
NVPTX: support fpext/fptrunc to and from f16.

llvm-svn: 213377

10 years agoR600: support fpext/fptrunc operations to and from f16.
Tim Northover [Fri, 18 Jul 2014 13:01:37 +0000 (13:01 +0000)]
R600: support fpext/fptrunc operations to and from f16.

llvm-svn: 213376

10 years agoAArch64: support f16 extend/trunc operations.
Tim Northover [Fri, 18 Jul 2014 13:01:31 +0000 (13:01 +0000)]
AArch64: support f16 extend/trunc operations.

llvm-svn: 213375

10 years agoX86: support fpext/fptrunc operations to and from 16-bit floats.
Tim Northover [Fri, 18 Jul 2014 13:01:25 +0000 (13:01 +0000)]
X86: support fpext/fptrunc operations to and from 16-bit floats.

llvm-svn: 213374

10 years agoARM: support legalisation of "fptrunc ... to half" operations.
Tim Northover [Fri, 18 Jul 2014 13:01:19 +0000 (13:01 +0000)]
ARM: support legalisation of "fptrunc ... to half" operations.

llvm-svn: 213373

10 years agoCodeGen: soften f16 type by default instead of marking legal.
Tim Northover [Fri, 18 Jul 2014 12:41:46 +0000 (12:41 +0000)]
CodeGen: soften f16 type by default instead of marking legal.

Actual support for softening f16 operations is still limited, and can be added
when it's needed.  But Soften is much closer to being a useful thing to try
than keeping it Legal when no registers can actually hold such values.

Longer term, we probably want something between Soften and Promote semantics
for most targets, it'll be more efficient to promote the 4 basic operations to
f32 than libcall them.

llvm-svn: 213372

10 years agoSuppress 'not handled in switch' warning
Renato Golin [Fri, 18 Jul 2014 12:13:04 +0000 (12:13 +0000)]
Suppress 'not handled in switch' warning

llvm-svn: 213371

10 years agoAdd FreeBSD support to the Asan symbolization script
Viktor Kutuzov [Fri, 18 Jul 2014 12:07:00 +0000 (12:07 +0000)]
Add FreeBSD support to the Asan symbolization script
Differential Revision: http://reviews.llvm.org/D4560

llvm-svn: 213370

10 years ago[ARM] Add earlyclobber constraint to pre/post-indexed ARM STR instructions.
Tilmann Scheller [Fri, 18 Jul 2014 12:05:49 +0000 (12:05 +0000)]
[ARM] Add earlyclobber constraint to pre/post-indexed ARM STR instructions.

The post-indexed instructions were missing the constraint, causing unpredictable STR instructions to be emitted.

The earlyclobber constraint on the pre-indexed STR instructions is not strictly necessary, as the instruction selection for pre-indexed STR instructions goes through an additional layer of pseudo instructions which have the constraint defined, however it doesn't hurt to specify the constraint directly on the pre-indexed instructions as well, since at some point someone might create instances of them programmatically and then the constraint is definitely needed.

This fixes PR20323.

llvm-svn: 213369

10 years agoAdd FreeBSD support to the address sanitizer's waitid.cc test case
Viktor Kutuzov [Fri, 18 Jul 2014 12:02:42 +0000 (12:02 +0000)]
Add FreeBSD support to the address sanitizer's waitid.cc test case
Differential Revision: http://reviews.llvm.org/D4422

llvm-svn: 213368

10 years agoRefactor ARM subarchitecture parsing
Renato Golin [Fri, 18 Jul 2014 12:00:48 +0000 (12:00 +0000)]
Refactor ARM subarchitecture parsing

Re-commit of a patch to rework the triple parsing on ARM to a more sane
model.

Patch by Gabor Ballabas.

llvm-svn: 213367

10 years agoUse PRIx64.
Joerg Sonnenberger [Fri, 18 Jul 2014 11:58:19 +0000 (11:58 +0000)]
Use PRIx64.

llvm-svn: 213366

10 years agoMoved 25 flags to clang_ignored_gcc_optimization_f_Group. Will display a warning
Arthur Marble [Fri, 18 Jul 2014 11:38:58 +0000 (11:38 +0000)]
Moved 25 flags to clang_ignored_gcc_optimization_f_Group. Will display a warning
to the user if they try to pass those optimizations. The revision for this patch
is here: http://reviews.llvm.org/D4474. This patch will fix many errors in the
rebuild of Debian with clang. Here is a link to the page for unknown arguments:
http://clang.debian.net/status.php?version=3.4.2&key=UNKNOWN_ARG

llvm-svn: 213365

10 years agoARM: Add test for ACLE memory barrier intrinsics
Yi Kong [Fri, 18 Jul 2014 10:36:37 +0000 (10:36 +0000)]
ARM: Add test for ACLE memory barrier intrinsics

Add an additional test to ensure that someone doesn't accidentally
change the definitions such that they can take a non-constant value.

llvm-svn: 213364

10 years ago[OPENMP] Initial parsing and sema analysis for 'taskwait' directive.
Alexey Bataev [Fri, 18 Jul 2014 10:17:07 +0000 (10:17 +0000)]
[OPENMP] Initial parsing and sema analysis for 'taskwait' directive.

llvm-svn: 213363

10 years agoswapStruct extracted into include/llvm/Support/MachO.h (no functional change)
Artyom Skrobov [Fri, 18 Jul 2014 09:28:10 +0000 (09:28 +0000)]
swapStruct extracted into include/llvm/Support/MachO.h (no functional change)

llvm-svn: 213362

10 years agoextracting swapStruct into include/llvm/Support/MachO.h (no functional change)
Artyom Skrobov [Fri, 18 Jul 2014 09:26:16 +0000 (09:26 +0000)]
extracting swapStruct into include/llvm/Support/MachO.h (no functional change)

llvm-svn: 213361

10 years ago[OPENMP] Initial parsing and sema analysis for 'barrier' directive.
Alexey Bataev [Fri, 18 Jul 2014 09:11:51 +0000 (09:11 +0000)]
[OPENMP] Initial parsing and sema analysis for 'barrier' directive.

llvm-svn: 213360

10 years ago[ARM] Fix AAPCS regression caused by r211898
Oliver Stannard [Fri, 18 Jul 2014 09:09:31 +0000 (09:09 +0000)]
[ARM] Fix AAPCS regression caused by r211898

r211898 introduced a regression where a large struct, which would
normally be passed ByVal, was causing padding to be inserted to
prevent the backend from using some GPRs, in order to follow the
AAPCS. However, the type of the argument was not being set correctly,
so the backend cannot align 8-byte aligned struct types on the stack.

The fix is to not insert the padding arguments when the argument is
being passed ByVal.

llvm-svn: 213359

10 years agoR600: rename misleading fp16 test.
Tim Northover [Fri, 18 Jul 2014 08:43:30 +0000 (08:43 +0000)]
R600: rename misleading fp16 test.

This test is actually going in the opposite direction to what the
filename and function name suggested.

llvm-svn: 213358

10 years agoR600: support f16 -> f64 conversion intrinsic.
Tim Northover [Fri, 18 Jul 2014 08:43:24 +0000 (08:43 +0000)]
R600: support f16 -> f64 conversion intrinsic.

Unfortunately, we don't seem to have a direct truncation, but the
extension can be legally split into two operations so we should
support that.

llvm-svn: 213357

10 years agoNVPTX: support direct f16 <-> f64 conversions via intrinsics.
Tim Northover [Fri, 18 Jul 2014 08:30:10 +0000 (08:30 +0000)]
NVPTX: support direct f16 <-> f64 conversions via intrinsics.

Clang may well start emitting these soon, and while it may not be
directly relevant for OpenCL or GLSL, the instructions were just
sitting there waiting to be used.

llvm-svn: 213356

10 years ago[OPENMP] Initial parsing and sema analysis of 'taskyield' directive.
Alexey Bataev [Fri, 18 Jul 2014 07:47:19 +0000 (07:47 +0000)]
[OPENMP] Initial parsing and sema analysis of 'taskyield' directive.

llvm-svn: 213355

10 years agoUse the designated PYTHON_EXECUTABLE during build.
Zachary Turner [Fri, 18 Jul 2014 07:06:13 +0000 (07:06 +0000)]
Use the designated PYTHON_EXECUTABLE during build.

We were hardcoding "python" as the command to run the swig wrapper
scripts.  We should be using PYTHON_EXECUTABLE instead.

llvm-svn: 213354

10 years ago[AArch64] Implement Clang CLI interface proposal about "-march".
Kevin Qin [Fri, 18 Jul 2014 07:03:22 +0000 (07:03 +0000)]
[AArch64] Implement Clang CLI interface proposal about "-march".

1. Revert "Add default feature for CPUs on AArch64 target in Clang"
at r210625. Then, all enabled feature will by passed explicitly by
-target-feature in -cc1 option.

2. Get "-mfpu" deprecated.

3. Implement support of "-march". Usage is:
    -march=armv8-a+[no]feature
  For instance, "-march=armv8-a+neon+crc+nocrypto". Here "armv8-a" is
  necessary, and CPU names are not acceptable. Candidate features are
  fp, neon, crc and crypto. Where conflicting feature modifiers are
  specified, the right-most feature is used.

4. Implement support of "-mtune". Usage is:
    -march=CPU_NAME
  For instance, "-march=cortex-a57". This option will ONLY get
  micro-architectural feature enabled specifying to target CPU,
  like "+zcm" and "+zcz" for cyclone. Any architectural features
  WON'T be modified.

5. Change usage of "-mcpu" to "-mcpu=CPU_NAME+[no]feature", which is
  an alias to "-march={feature of CPU_NAME}+[no]feature" and
  "-mtune=CPU_NAME" together. Where this option is used in conjunction
  with -march or -mtune, those options take precedence over the
  appropriate part of this option.

llvm-svn: 213353

10 years agoRename AlignAttribute to IntAttribute
Hal Finkel [Fri, 18 Jul 2014 06:51:55 +0000 (06:51 +0000)]
Rename AlignAttribute to IntAttribute

Currently the only kind of integer IR attributes that we have are alignment
attributes, and so the attribute kind that takes an integer parameter is called
AlignAttr, but that will change (we'll soon be adding a dereferenceable
attribute that also takes an integer value). Accordingly, rename AlignAttribute
to IntAttribute (class names, enums, etc.).

No functionality change intended.

llvm-svn: 213352

10 years agoR600: Implement TTI:getPopcntSupport
Matt Arsenault [Fri, 18 Jul 2014 06:07:13 +0000 (06:07 +0000)]
R600: Implement TTI:getPopcntSupport

The test is just copied from X86, and I don't know of a better
way to test it.

llvm-svn: 213351

10 years agoParse: Diagnose malformed 'message' arguments for 'availability' attr
David Majnemer [Fri, 18 Jul 2014 05:43:12 +0000 (05:43 +0000)]
Parse: Diagnose malformed 'message' arguments for 'availability' attr

The parsing code for 'availability' wasn't prepared for string literals
like "a" L"b" showing up.  Error if this occurs.

llvm-svn: 213350

10 years agoAdd dump() for MacroDirective and MacroInfo.
Richard Smith [Fri, 18 Jul 2014 04:54:02 +0000 (04:54 +0000)]
Add dump() for MacroDirective and MacroInfo.

llvm-svn: 213349

10 years ago[modules] Fix macro hiding bug exposed if:
Richard Smith [Fri, 18 Jul 2014 04:53:37 +0000 (04:53 +0000)]
[modules] Fix macro hiding bug exposed if:

 * A submodule of module A is imported into module B
 * Another submodule of module A that is not imported into B exports a macro
 * Some submodule of module B also exports a definition of the macro, and
   happens to be the first submodule of B that imports module A.

In this case, we would incorrectly determine that A's macro redefines B's
macro, and so we don't need to re-export B's macro at all.

This happens with the 'assert' macro in an LLVM self-host. =(

llvm-svn: 213348

10 years agoCleanup: remove essentially unused variable.
Richard Smith [Fri, 18 Jul 2014 04:47:25 +0000 (04:47 +0000)]
Cleanup: remove essentially unused variable.

llvm-svn: 213347

10 years agoMark the vtable used when defining implicit copy and move ctors
Reid Kleckner [Fri, 18 Jul 2014 01:48:10 +0000 (01:48 +0000)]
Mark the vtable used when defining implicit copy and move ctors

I don't think other implicit members like copy assignment and move
assignment require this treatment, because they should already be
operating on a constructed object.

Fixes PR20351.

llvm-svn: 213346

10 years agoSemaInit.cpp: Fix a warning with -Asserts. [-Wunused-variable]
NAKAMURA Takumi [Fri, 18 Jul 2014 01:26:35 +0000 (01:26 +0000)]
SemaInit.cpp: Fix a warning with -Asserts. [-Wunused-variable]

llvm-svn: 213345

10 years ago[mach-o] Add support for x86 pointers which use scattered relocations
Nick Kledzik [Fri, 18 Jul 2014 01:05:35 +0000 (01:05 +0000)]
[mach-o] Add support for x86 pointers which use scattered relocations

llvm-svn: 213344

10 years agoFixes a number of issue related to test portability on Windows.
Zachary Turner [Fri, 18 Jul 2014 01:02:02 +0000 (01:02 +0000)]
Fixes a number of issue related to test portability on Windows.

99% of this CL is simply moving calls to "import pexpect" to a more
narrow scope - i.e. the function that actually runs a particular
test.  This way the test suite can run on Windows, which doesn't have
pexpect, and the individual tests that use pexpect can be disabled on
a platform-specific basis.

Additionally, this CL fixes a few other cases of non-portability.
Notably, using "ps" to get the command line, and os.uname() to
determine the architecture don't work on Windows.  Finally, this
also adds a stubbed out builder_win32 module.

The full test suite runs correctly on Windows after this CL, although
there is still some work remaining on the C++ side to fix one-shot
script commands from LLDB (e.g. script print "foo"), which currently
deadlock.

Reviewed by: Todd Fiala

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

llvm-svn: 213343

10 years agoX86: Constant fold converting vector setcc results to float.
Jim Grosbach [Fri, 18 Jul 2014 00:40:56 +0000 (00:40 +0000)]
X86: Constant fold converting vector setcc results to float.

Since the result of a SETCC for X86 is 0 or -1 in each lane, we can
move unary operations, in this case [su]int_to_fp through the mask
operation and constant fold the operation away. Generally speaking:
  UNARYOP(AND(VECTOR_CMP(x,y), constant))
      --> AND(VECTOR_CMP(x,y), constant2)
where constant2 is UNARYOP(constant).

This implements the transform where UNARYOP is [su]int_to_fp.

For example, consider the simple function:
define <4 x float> @foo(<4 x float> %val, <4 x float> %test) nounwind {
  %cmp = fcmp oeq <4 x float> %val, %test
  %ext = zext <4 x i1> %cmp to <4 x i32>
  %result = sitofp <4 x i32> %ext to <4 x float>
  ret <4 x float> %result
}

Before this change, the SSE code is generated as:
LCPI0_0:
  .long 1                       ## 0x1
  .long 1                       ## 0x1
  .long 1                       ## 0x1
  .long 1                       ## 0x1
  .section  __TEXT,__text,regular,pure_instructions
  .globl  _foo
  .align  4, 0x90
_foo:                                   ## @foo
  cmpeqps %xmm1, %xmm0
  andps LCPI0_0(%rip), %xmm0
  cvtdq2ps  %xmm0, %xmm0
  retq

After, the code is improved to:
LCPI0_0:
  .long 1065353216              ## float 1.000000e+00
  .long 1065353216              ## float 1.000000e+00
  .long 1065353216              ## float 1.000000e+00
  .long 1065353216              ## float 1.000000e+00
  .section  __TEXT,__text,regular,pure_instructions
  .globl  _foo
  .align  4, 0x90
_foo:                                   ## @foo
  cmpeqps %xmm1, %xmm0
  andps LCPI0_0(%rip), %xmm0
  retq

The cvtdq2ps has been constant folded away and the floating point 1.0f
vector lanes are materialized directly via the ModRM operand of andps.

llvm-svn: 213342

10 years agoAArch64: Constant fold converting vector setcc results to float.
Jim Grosbach [Fri, 18 Jul 2014 00:40:52 +0000 (00:40 +0000)]
AArch64: Constant fold converting vector setcc results to float.

Since the result of a SETCC for AArch64 is 0 or -1 in each lane, we can
move unary operations, in this case [su]int_to_fp through the mask
operation and constant fold the operation away. Generally speaking:
  UNARYOP(AND(VECTOR_CMP(x,y), constant))
      --> AND(VECTOR_CMP(x,y), constant2)
where constant2 is UNARYOP(constant).

This implements the transform where UNARYOP is [su]int_to_fp.

For example, consider the simple function:
define <4 x float> @foo(<4 x float> %val, <4 x float> %test) nounwind {
  %cmp = fcmp oeq <4 x float> %val, %test
  %ext = zext <4 x i1> %cmp to <4 x i32>
  %result = sitofp <4 x i32> %ext to <4 x float>
  ret <4 x float> %result
}

Before this change, the code is generated as:
  fcmeq.4s  v0, v0, v1
  movi.4s v1, #0x1        // Integer splat value.
  and.16b v0, v0, v1      // Mask lanes based on the comparison.
  scvtf.4s  v0, v0        // Convert each lane to f32.
  ret

After, the code is improved to:
  fcmeq.4s  v0, v0, v1
  fmov.4s v1, #1.00000000 // f32 splat value.
  and.16b v0, v0, v1      // Mask lanes based on the comparison.
  ret

The svvtf.4s has been constant folded away and the floating point 1.0f
vector lanes are materialized directly via fmov.4s.

Rather than do the folding manually in the target code, teach getNode()
in the generic SelectionDAG to handle folding constant operands of
vector [su]int_to_fp nodes. It is reasonable (as noted in a FIXME) to do
additional constant folding there as well, but I don't have test cases
for those operations, so leaving them for another time when it becomes
appropriate.

rdar://17693791

llvm-svn: 213341

10 years ago[mach-o] Add support for x86 CALL instruction that uses a scattered relocation
Nick Kledzik [Fri, 18 Jul 2014 00:37:52 +0000 (00:37 +0000)]
[mach-o] Add support for x86 CALL instruction that uses a scattered relocation

llvm-svn: 213340

10 years agoRevert "[x86] Fold extract_vector_elt of a load into the Load's address computation."
Michael J. Spencer [Fri, 18 Jul 2014 00:15:50 +0000 (00:15 +0000)]
Revert "[x86] Fold extract_vector_elt of a load into the Load's address computation."

There's a bug where this can create cycles in the DAG. It will take a bit
to fix, so I'm backing it out for now.

llvm-svn: 213339

10 years agoFix parsing certain kinds of strings in the MS section pragmas
Reid Kleckner [Fri, 18 Jul 2014 00:13:16 +0000 (00:13 +0000)]
Fix parsing certain kinds of strings in the MS section pragmas

We were crashing on the relevant test case inputs.  Also, refactor this
code a bit so we can report failure and slurp the pragma tokens without
returning a diagnostic id.  This is more consistent with the rest of the
parser and sema code.

llvm-svn: 213337

10 years agoReset the Subtarget in the AsmPrinter for each machine function
Eric Christopher [Fri, 18 Jul 2014 00:08:53 +0000 (00:08 +0000)]
Reset the Subtarget in the AsmPrinter for each machine function
and add explanatory comment about dual initialization. Fix
use of the Subtarget to grab the information off of the target machine.

llvm-svn: 213336

10 years agoAvoid resetting the UseSoftFloat and FloatABIType on the TargetMachine
Eric Christopher [Fri, 18 Jul 2014 00:08:50 +0000 (00:08 +0000)]
Avoid resetting the UseSoftFloat and FloatABIType on the TargetMachine
Options struct and move the comment to inMips16HardFloat. Use the
fact that we now know whether or not we cared about soft float to
set the libcalls.
Accordingly rename mipsSEUsesSoftFloat to abiUsesSoftFloat and
propagate since it's no longer CPU specific.

llvm-svn: 213335

10 years agoCheck-labelize ubsan tests
Alexey Samsonov [Thu, 17 Jul 2014 23:53:44 +0000 (23:53 +0000)]
Check-labelize ubsan tests

llvm-svn: 213334

10 years ago[mach-o] implement more x86 and x86_64 relocation support
Nick Kledzik [Thu, 17 Jul 2014 23:16:21 +0000 (23:16 +0000)]
[mach-o] implement more x86 and x86_64 relocation support

Add support for adding section relocations in -r mode.  Enhance the test
cases which validate the parsing of .o files to also round trip.  They now
write out the .o file and then parse that, verifying all relocations survived
the round trip.

llvm-svn: 213333

10 years agoPR20346: fix aggregate initialization / template instantiation bug:
Richard Smith [Thu, 17 Jul 2014 23:12:06 +0000 (23:12 +0000)]
PR20346: fix aggregate initialization / template instantiation bug:

If, during the initial parse of a template, we perform aggregate initialization
and form an implicit value initialization for an array type, then when we come
to instantiate the template and redo the initialization step, we would try to
match the implicit value initialization up against an array *element*, not to
the complete array.

Remarkably, we've had this bug since ~the dawn of time, but only noticed it
recently.

llvm-svn: 213332

10 years ago[MCJIT] Fix the alignment requirements for ARM and AArch64 which were mistakenly
Lang Hames [Thu, 17 Jul 2014 23:11:30 +0000 (23:11 +0000)]
[MCJIT] Fix the alignment requirements for ARM and AArch64 which were mistakenly
relaxed in the big RuntimeDyldMachO cleanup of r213293.

No test case yet - this was found via inspection and there's no easy way to test
GOT alignment in RuntimeDyldChecker at the moment. I'm working on adding support
for this now, and hope to have a test case for this soon.

llvm-svn: 213331

10 years agoTweak formating to match what clang-format would be for llvm-nm.cpp .
Kevin Enderby [Thu, 17 Jul 2014 22:56:27 +0000 (22:56 +0000)]
Tweak formating to match what clang-format would be for llvm-nm.cpp .
No functional change.

llvm-svn: 213330

10 years agoclang/test/CodeGen/ms-inline-asm.c: Fix for -Asserts.
NAKAMURA Takumi [Thu, 17 Jul 2014 22:51:49 +0000 (22:51 +0000)]
clang/test/CodeGen/ms-inline-asm.c: Fix for -Asserts.

llvm-svn: 213329

10 years agoFixed the objective C symbol parsing in ObjectFileMachO.
Greg Clayton [Thu, 17 Jul 2014 22:51:31 +0000 (22:51 +0000)]
Fixed the objective C symbol parsing in ObjectFileMachO.

This fixes all of the hidden ivar test cases and any case where we try to find the full definition of an objective C class.

This also means hidden ivars show up again.

<rdar://problem/15458957>
llvm.org/pr20270
llvm.org/pr20269
llvm.org/pr20272

llvm-svn: 213328

10 years agoAdd printing of Mach-O stabs in llvm-nm.
Kevin Enderby [Thu, 17 Jul 2014 22:47:16 +0000 (22:47 +0000)]
Add printing of Mach-O stabs in llvm-nm.

llvm-svn: 213327

10 years agoRemove rules against std::function from the programmer's manual
Reid Kleckner [Thu, 17 Jul 2014 22:43:00 +0000 (22:43 +0000)]
Remove rules against std::function from the programmer's manual

Clarify that llvm::function_ref is like StringRef for callables.

llvm-svn: 213326

10 years agoRevert "unique_ptr-ify ownership of ASTConsumers"
David Blaikie [Thu, 17 Jul 2014 22:34:12 +0000 (22:34 +0000)]
Revert "unique_ptr-ify ownership of ASTConsumers"

This reverts commit r213307.

Reverting to have some on-list discussion/confirmation about the ongoing
direction of smart pointer usage in the LLVM project.

llvm-svn: 213325

10 years agoRevert "unique_ptr-ify ownership of ASTConsumers"
David Blaikie [Thu, 17 Jul 2014 22:33:56 +0000 (22:33 +0000)]
Revert "unique_ptr-ify ownership of ASTConsumers"

This reverts commit r213308.

Reverting to have some on-list discussion/confirmation about the ongoing
direction of smart pointer usage in the LLVM project.

llvm-svn: 213324

10 years agoReferences cannot be bound to null.
Joerg Sonnenberger [Thu, 17 Jul 2014 22:30:09 +0000 (22:30 +0000)]
References cannot be bound to null.

llvm-svn: 213323

10 years ago[PECOFF] Split ExportedSymbolRenameFile.
Rui Ueyama [Thu, 17 Jul 2014 22:17:10 +0000 (22:17 +0000)]
[PECOFF] Split ExportedSymbolRenameFile.

The code to manage resolvable symbols is now separated from
ExportedSymbolRenameFile so that other class can reuse it.
I'm planning to use it to find the entry function symbol
based on resolvable symbols.

llvm-svn: 213322

10 years agoAdd several missing double constant definitions
Aaron Watry [Thu, 17 Jul 2014 22:07:35 +0000 (22:07 +0000)]
Add several missing double constant definitions

These were present in CL 1.0, just not implemented yet.

v2: Use hex values and fix commit message

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Jeroen Ketema <j.ketema@imperial.ac.uk>
CC: Matt Arsenault <Matthew.Arsenault@amd.com>
llvm-svn: 213321

10 years agorelational: Implement isnotequal
Aaron Watry [Thu, 17 Jul 2014 22:07:32 +0000 (22:07 +0000)]
relational: Implement isnotequal

v2: Use relational macros instead of hand-rolled ones

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 213320

10 years agorelational: Implement isgreaterequal
Aaron Watry [Thu, 17 Jul 2014 22:07:27 +0000 (22:07 +0000)]
relational: Implement isgreaterequal

v2: Use relational macros instead of hand-rolled macros

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 213319

10 years agorelational: Implement isgreater
Aaron Watry [Thu, 17 Jul 2014 22:07:19 +0000 (22:07 +0000)]
relational: Implement isgreater

v2: Use relational macros instead of hand-rolled macros

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 213318

10 years agorelational/signbit: Refactor to use relational macros
Aaron Watry [Thu, 17 Jul 2014 22:05:25 +0000 (22:05 +0000)]
relational/signbit: Refactor to use relational macros

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 213317

10 years agoFix isnan definition for vector results
Aaron Watry [Thu, 17 Jul 2014 22:05:22 +0000 (22:05 +0000)]
Fix isnan definition for vector results

Vector true is -1, not 1, which means we need to use the relational unary
macro instead of the normal unary builtin one.

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 213316

10 years agorelational: create re-usable macros for relational declarations
Aaron Watry [Thu, 17 Jul 2014 22:05:16 +0000 (22:05 +0000)]
relational: create re-usable macros for relational declarations

relational.h includes relational macros for defining functions which need to
return 1 for scalar true and -1 for vector true.

I believe that this is the only place that this behavior is required, so the
macro is placed at its lowest useful level (same directory as it is used in).

This also creates re-usable unary/binary declaration and floatn includes which
should simplify relational builtin declarations.

Mostly patterned off of include/math/[binary_decl|unary_decl|floatn].inc
but with required changes for relational functions.

Signed-off-by: Aaron Watry <awatry@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
llvm-svn: 213315

10 years agoReadPointedString takes a Stream not a DataBuffer.
Jim Ingham [Thu, 17 Jul 2014 21:53:48 +0000 (21:53 +0000)]
ReadPointedString takes a Stream not a DataBuffer.

llvm-svn: 213314

10 years agoRemove all uses of llvm::function_ref from LLD.
Rui Ueyama [Thu, 17 Jul 2014 21:33:21 +0000 (21:33 +0000)]
Remove all uses of llvm::function_ref from LLD.

llvm-svn: 213313

10 years agoUse std::function instead of llvm::function_ref.
Rui Ueyama [Thu, 17 Jul 2014 21:23:52 +0000 (21:23 +0000)]
Use std::function instead of llvm::function_ref.

llvm-svn: 213312

10 years agoPrune empty directories.
Joerg Sonnenberger [Thu, 17 Jul 2014 21:00:39 +0000 (21:00 +0000)]
Prune empty directories.

llvm-svn: 213311

10 years ago[Mips] s/context/ctx/ for consistency and reduce lines lengths.
Simon Atanasyan [Thu, 17 Jul 2014 20:57:54 +0000 (20:57 +0000)]
[Mips] s/context/ctx/ for consistency and reduce lines lengths.

No functional changes.

llvm-svn: 213310

10 years agoRevert Thumb-2 conversion of some ARM builtins.
Stephen Hines [Thu, 17 Jul 2014 20:41:01 +0000 (20:41 +0000)]
Revert Thumb-2 conversion of some ARM builtins.

The udivmodsi4/modsi3/umodsi3 code computes jump targets based on ARM encodings
(if CLZ is present and IDIV is not present).

Reverts parts of r211032 and r211035.

llvm-svn: 213309

10 years agounique_ptr-ify ownership of ASTConsumers
David Blaikie [Thu, 17 Jul 2014 20:40:47 +0000 (20:40 +0000)]
unique_ptr-ify ownership of ASTConsumers

llvm-svn: 213308

10 years agounique_ptr-ify ownership of ASTConsumers
David Blaikie [Thu, 17 Jul 2014 20:40:36 +0000 (20:40 +0000)]
unique_ptr-ify ownership of ASTConsumers

(after fixing a bug in MultiplexConsumer I noticed the ownership of the
nested consumers was implemented with raw pointers - so this fixes
that... and follows the source back to its origin pushing unique_ptr
ownership up through there too)

llvm-svn: 213307

10 years agoCreate an _d suffixed symlink when doing a debug Windows build.
Zachary Turner [Thu, 17 Jul 2014 20:36:14 +0000 (20:36 +0000)]
Create an _d suffixed symlink when doing a debug Windows build.

_lldb is built as an extension module on Windows.  Normally to load
an extension module named 'foo', Python would look for the file
'foo.pyd'.  However, when a debug interpreter is used, Python will
look for the file 'foo_d.pyd'.  This change checks the build
configuration and creates the correct symlink name based on the
build configuration.

llvm-svn: 213306

10 years agoAdd a test for PR20343 after llvm r213303.
Nico Weber [Thu, 17 Jul 2014 20:25:36 +0000 (20:25 +0000)]
Add a test for PR20343 after llvm r213303.

llvm-svn: 213305

10 years agoMS compatibility: always emit dllexported in-class initialized static data members...
Hans Wennborg [Thu, 17 Jul 2014 20:25:23 +0000 (20:25 +0000)]
MS compatibility: always emit dllexported in-class initialized static data members (PR20140)

This makes us emit dllexported in-class initialized static data members (which
are treated as definitions in MSVC), even when they're not referenced.

It also makes their special linkage reflected in the GVA linkage instead of
getting massaged in CodeGen.

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

llvm-svn: 213304

10 years agoms inline asm: Don't add x86 segment registers to the clobber list.
Nico Weber [Thu, 17 Jul 2014 20:24:55 +0000 (20:24 +0000)]
ms inline asm: Don't add x86 segment registers to the clobber list.

Clang tries to check the clobber list but doesn't list segment registers in its
x86 register list. This fixes PR20343.

llvm-svn: 213303

10 years agoMake myself code owner of MCJIT.
Lang Hames [Thu, 17 Jul 2014 20:23:31 +0000 (20:23 +0000)]
Make myself code owner of MCJIT.

llvm-svn: 213302

10 years agoIf char/short are shorter than int, do not use U as suffix for
Joerg Sonnenberger [Thu, 17 Jul 2014 20:12:32 +0000 (20:12 +0000)]
If char/short are shorter than int, do not use U as suffix for
constants. Comparing int against a constant of the given type like
UINT8_MAX will otherwise force a promotion to unsigned int, which is
typically not expected.

llvm-svn: 213301

10 years agoDrop the udis86 wrapper from llvm::sys
Alp Toker [Thu, 17 Jul 2014 20:05:29 +0000 (20:05 +0000)]
Drop the udis86 wrapper from llvm::sys

This optional dependency on the udis86 library was added some time back to aid
JIT development, but doesn't make much sense to link into LLVM binaries these
days.

llvm-svn: 213300

10 years agoAlways set the C suffix macro, even if it is empty.
Joerg Sonnenberger [Thu, 17 Jul 2014 19:47:34 +0000 (19:47 +0000)]
Always set the C suffix macro, even if it is empty.

llvm-svn: 213299

10 years agoTableGen: Add 'static' to a large array to avoid a huge stack allocation
Reid Kleckner [Thu, 17 Jul 2014 19:43:40 +0000 (19:43 +0000)]
TableGen: Add 'static' to a large array to avoid a huge stack allocation

Speculative fix for a -Wframe-larger-than warning from gcc.  Clang will
implicitly promote such constant arrays to globals, so in theory it
won't hit this.

llvm-svn: 213298

10 years agoclang-cl: Flush stdout after writing the /showIncludes output
Ehsan Akhgari [Thu, 17 Jul 2014 19:08:19 +0000 (19:08 +0000)]
clang-cl: Flush stdout after writing the /showIncludes output

Summary:
Before this patch, you could get lines in the output such as:
Note: including file:   ../../dist/include/js/Tc:/path/to/foo.cpp(1,1) :  error(clang): static_assert failed...

This patch ensures that the stdout output from showIncludes won't be garbled
in the terminal like this, and it also helps applications that use the output
to generate dependency information if they happen to capture both stdout and
stderr.

Test Plan:
Tested locally, it's hard to write an automated test for this as
the behavior depends on the buffering of the ostreams.

Reviewers: nico

Subscribers: cfe-commits

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

llvm-svn: 213297

10 years ago[AArch64] Cleanup AsmParser: no need to use dyn_cast + assert. cast does it for us.
Arnaud A. de Grandmaison [Thu, 17 Jul 2014 19:08:14 +0000 (19:08 +0000)]
[AArch64] Cleanup AsmParser: no need to use dyn_cast + assert. cast does it for us.

llvm-svn: 213296

10 years agoRectify r213231. Use proper version of 'ComputeNumSignBits'.
Suyog Sarda [Thu, 17 Jul 2014 19:07:00 +0000 (19:07 +0000)]
Rectify r213231. Use proper version of 'ComputeNumSignBits'.

Earlier when the code was in InstCombine, we were calling the version of ComputeNumSignBits in InstCombine.h
that automatically added the DataLayout* before calling into ValueTracking.
When the code moved to InstSimplify, we are calling into ValueTracking directly without passing in the DataLayout*.
This patch rectifies the same by passing DataLayout in ComputeNumSignBits.

llvm-svn: 213295

10 years agoIn Process::LoadImage, if dlopen returns 0x0 fetch the error with dlerror and report
Jim Ingham [Thu, 17 Jul 2014 18:55:25 +0000 (18:55 +0000)]
In Process::LoadImage, if dlopen returns 0x0 fetch the error with dlerror and report
that in the returned Error.

llvm-svn: 213294

10 years ago[MCJIT] Significantly refactor the RuntimeDyldMachO class.
Lang Hames [Thu, 17 Jul 2014 18:54:50 +0000 (18:54 +0000)]
[MCJIT] Significantly refactor the RuntimeDyldMachO class.

The previous implementation of RuntimeDyldMachO mixed logic for all targets
within a single class, creating problems for readability, maintainability, and
performance. To address these issues, this patch strips the RuntimeDyldMachO
class down to just target-independent functionality, and moves all
target-specific functionality into target-specific subclasses RuntimeDyldMachO.

The new class hierarchy is as follows:

class RuntimeDyldMachO
Implemented in RuntimeDyldMachO.{h,cpp}
Contains logic that is completely independent of the target. This consists
mostly of MachO helper utilities which the derived classes use to get their
work done.

template <typename Impl>
class RuntimeDyldMachOCRTPBase<Impl> : public RuntimeDyldMachO
Implemented in RuntimeDyldMachO.h
Contains generic MachO algorithms/data structures that defer to the Impl class
for target-specific behaviors.

RuntimeDyldMachOARM : public RuntimeDyldMachOCRTPBase<RuntimeDyldMachOARM>
RuntimeDyldMachOARM64 : public RuntimeDyldMachOCRTPBase<RuntimeDyldMachOARM64>
RuntimeDyldMachOI386 : public RuntimeDyldMachOCRTPBase<RuntimeDyldMachOI386>
RuntimeDyldMachOX86_64 : public RuntimeDyldMachOCRTPBase<RuntimeDyldMachOX86_64>
Implemented in their respective *.h files in lib/ExecutionEngine/RuntimeDyld/MachOTargets
Each of these contains the relocation logic specific to their target architecture.

llvm-svn: 213293

10 years ago[ASan] Don't instrument load/stores with !nosanitize metadata.
Alexey Samsonov [Thu, 17 Jul 2014 18:48:12 +0000 (18:48 +0000)]
[ASan] Don't instrument load/stores with !nosanitize metadata.

This is used to avoid instrumentation of instructions added by UBSan
in Clang frontend (see r213291). This fixes PR20085.

Reviewed in http://reviews.llvm.org/D4544.

llvm-svn: 213292

10 years ago[UBSan] Add !nosanitize metadata to the code generated by UBSan.
Alexey Samsonov [Thu, 17 Jul 2014 18:46:27 +0000 (18:46 +0000)]
[UBSan] Add !nosanitize metadata to the code generated by UBSan.

This is used to mark the instructions emitted by Clang to implement
variety of UBSan checks. Generally, we don't want to instrument these
instructions with another sanitizers (like ASan).

Reviewed in http://reviews.llvm.org/D4544

llvm-svn: 213291