platform/upstream/llvm.git
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

10 years agoTypo: exists -> exits
Hans Wennborg [Thu, 17 Jul 2014 18:33:44 +0000 (18:33 +0000)]
Typo: exists -> exits

llvm-svn: 213290

10 years agoProvide __SIG_ATOMIC_MAX__ next to __SIG_ATOMIC_WIDTH__.
Joerg Sonnenberger [Thu, 17 Jul 2014 18:31:20 +0000 (18:31 +0000)]
Provide __SIG_ATOMIC_MAX__ next to __SIG_ATOMIC_WIDTH__.

llvm-svn: 213289

10 years agoWrap a comment to 80 columns, no code change.
Nico Weber [Thu, 17 Jul 2014 18:19:30 +0000 (18:19 +0000)]
Wrap a comment to 80 columns, no code change.

llvm-svn: 213288

10 years ago[NVPTX] Improve handling of FP fusion
Justin Holewinski [Thu, 17 Jul 2014 18:10:09 +0000 (18:10 +0000)]
[NVPTX] Improve handling of FP fusion

We now consider the FPOpFusion flag when determining whether
to fuse ops.  We also explicitly emit add.rn when fusion is
disabled to prevent ptxas from fusing the operations on its
own.

llvm-svn: 213287

10 years agoFix typos
Matt Arsenault [Thu, 17 Jul 2014 17:50:22 +0000 (17:50 +0000)]
Fix typos

llvm-svn: 213285

10 years agoFixed our install-headers script to set version
Sean Callanan [Thu, 17 Jul 2014 17:26:38 +0000 (17:26 +0000)]
Fixed our install-headers script to set version
numbers correctly.

<rdar://problem/17708687>

llvm-svn: 213284

10 years ago[BUG] Due to a typo introduced in r199933 and r200027 two tests for FMA were never...
Zinovy Nis [Thu, 17 Jul 2014 17:14:35 +0000 (17:14 +0000)]
[BUG] Due to a typo introduced in r199933  and r200027 two tests for FMA were never even started.

llvm-svn: 213283

10 years agoObjective-C. deprecated attribute is not inherited on methods
Fariborz Jahanian [Thu, 17 Jul 2014 17:05:04 +0000 (17:05 +0000)]
Objective-C. deprecated attribute is not inherited on methods
overriden in interfaces and protocols (this is already the case
for properties). rdar://16068470

llvm-svn: 213282

10 years ago[X86] AVX512: Add disassembler support for compressed displacement
Adam Nemet [Thu, 17 Jul 2014 17:04:56 +0000 (17:04 +0000)]
[X86] AVX512: Add disassembler support for compressed displacement

There are two parts here.  First is to modify tablegen to adjust the encoding
type ENCODING_RM with the scaling factor.

The second is to use the new encoding types to compute the correct
displacement in the decoder.

Fixes <rdar://problem/17608489>

llvm-svn: 213281

10 years ago[X86] AVX512: Rename EVEX_CD8V to CD8_Form
Adam Nemet [Thu, 17 Jul 2014 17:04:52 +0000 (17:04 +0000)]
[X86] AVX512: Rename EVEX_CD8V to CD8_Form

This is to match the naming of CD8_EltSize, CD8_Scale, etc.

No functional change.

llvm-svn: 213280

10 years ago[X86] AVX512: Use the TD version of CD8_Scale in the assembler
Adam Nemet [Thu, 17 Jul 2014 17:04:50 +0000 (17:04 +0000)]
[X86] AVX512: Use the TD version of CD8_Scale in the assembler

Passes the computed scaling factor in TSFlags rather than the old attributes.

Also removes the C++ version of computing the scaling factor (MemObjSize)
along with the asserts added by the previous patch.

No functional change.

llvm-svn: 213279

10 years ago[X86] AVX512: Move compressed displacement logic to TD
Adam Nemet [Thu, 17 Jul 2014 17:04:34 +0000 (17:04 +0000)]
[X86] AVX512: Move compressed displacement logic to TD

This does not actually move the logic yet but reimplements it in the Tablegen
language.  Then asserts that the new implementation results in the same value.

The next patch will remove the assert and the temporary use of the TSFlags and
remove the C++ implementation.

The formula requires a limited form of the logical left and right operators.
I implemented these with the bit-extract/insert operator (i.e. blah{bits}).

No functional change.

llvm-svn: 213278

10 years ago[TableGen] Allow shift operators to take bits<n>
Adam Nemet [Thu, 17 Jul 2014 17:04:27 +0000 (17:04 +0000)]
[TableGen] Allow shift operators to take bits<n>

Convert the operand to int if possible, i.e. if the value is properly
initialized.  (I suppose there is further room for improvement here to also
peform the shift if the uninitialized bits are shifted out.)

With this little change we can now compute the scaling factor for compressed
displacement with pure tablegen code in the X86 backend.  This is useful
because both the X86-disassembler-specific part of tablegen and the assembler
need this and TD is the natural sharing place.

The patch also adds the missing documentation for the shift and add operator.

llvm-svn: 213277

10 years ago[NVPTX] Add missing .v4 qualifier on vector store instruction
Justin Holewinski [Thu, 17 Jul 2014 16:58:56 +0000 (16:58 +0000)]
[NVPTX] Add missing .v4 qualifier on vector store instruction

llvm-svn: 213276

10 years agoMC: correct DWARF header for PE/COFF assembly input
Saleem Abdulrasool [Thu, 17 Jul 2014 16:27:44 +0000 (16:27 +0000)]
MC: correct DWARF header for PE/COFF assembly input

The header contains an offset to the DWARF abbreviations for the CU.  The offset
must be section relative for COFF and absolute for others.  The non-assembly
code path for the DWARF header generation already had the correct emission for
the headers.  This corrects just the assembly path.  Due to the invalid
relocation, processing of the debug information would halt previously on the
first assembly input as the associated abbreviations would be out of range as
they would have the location increased by image base and the section offset.

This address PR20332.

llvm-svn: 213275

10 years agoMC: fix MCAsmInfo usage for windows-itanium
Saleem Abdulrasool [Thu, 17 Jul 2014 16:27:40 +0000 (16:27 +0000)]
MC: fix MCAsmInfo usage for windows-itanium

Windows itanium uses the GNUCOFF assmebly format, not ELF.

llvm-svn: 213274

10 years agoMC: collapse emission of producer
Saleem Abdulrasool [Thu, 17 Jul 2014 16:27:35 +0000 (16:27 +0000)]
MC: collapse emission of producer

Rather than use three EmitBytes, concatenate the string at compile time,
constructing a single StringRef and emitting the data in one shot.  This also
creates nicer assembly output.  NFC.

llvm-svn: 213273

10 years ago[Refactor] Move code out of the IslAst header
Johannes Doerfert [Thu, 17 Jul 2014 16:11:28 +0000 (16:11 +0000)]
[Refactor] Move code out of the IslAst header

  Offer the static functions to extract information out of an IslAst for node
  as members of IslAstInfo not as top level entities.

  + Refactor common code
  + Add isParallel and isReductionParallel
  + Rename IslAstUser to IslAstUserPayload to make it clear this is just a (or
    the) payload struct.

llvm-svn: 213272

10 years agoFix bug #20335 - memory leak when move-constructing a string with unequal allocator...
Marshall Clow [Thu, 17 Jul 2014 15:32:20 +0000 (15:32 +0000)]
Fix bug #20335 - memory leak when move-constructing a string with unequal allocator. Thanks to Thomas Koeppe for the report

llvm-svn: 213269

10 years ago[NVPTX] Flag surface/texture query instructions with IsTexSurfQuery
Justin Holewinski [Thu, 17 Jul 2014 14:51:33 +0000 (14:51 +0000)]
[NVPTX] Flag surface/texture query instructions with IsTexSurfQuery

Also, add some tests to make sure we can handle surface/texture
queries on both Fermi and Kepler+.

llvm-svn: 213268

10 years agoHandle __assume in the VoidExprEvaluator
Hal Finkel [Thu, 17 Jul 2014 14:49:58 +0000 (14:49 +0000)]
Handle __assume in the VoidExprEvaluator

This is a follow-up to an IRC conversation with Richard last night; __assume
does not evaluate its argument, and so the argument should not contribute to
whether (__assume(e), constant) can be used where a constant is required.

llvm-svn: 213267

10 years agoAdd an __assume side-effects warning
Hal Finkel [Thu, 17 Jul 2014 14:25:55 +0000 (14:25 +0000)]
Add an __assume side-effects warning

In MS-compatibility mode, we support the __assume builtin. The __assume builtin
does not evaluate its arguments, and we should issue a warning if __assume is
provided with an argument with side effects (because these effects will be
discarded).

This is similar in spirit to the warnings issued by other compilers (Intel
Diagnostic 2261, MS Compiler Warning C4557).

llvm-svn: 213266

10 years agoUsing a std::string instead of a StringRef because the Default case synthesizes a...
Aaron Ballman [Thu, 17 Jul 2014 13:28:50 +0000 (13:28 +0000)]
Using a std::string instead of a StringRef because the Default case synthesizes a temporary std::string from a Twine. Assigning that into a StringRef causes the StringRef to refer to a temporary, and bad things happen.

This fixes a failing test case on Windows.

llvm-svn: 213265

10 years ago[asan] Remove leftover debug printf.
Evgeniy Stepanov [Thu, 17 Jul 2014 13:05:21 +0000 (13:05 +0000)]
[asan] Remove leftover debug printf.

llvm-svn: 213264

10 years ago[asan] Fix malloc interception on Android L Preview.
Evgeniy Stepanov [Thu, 17 Jul 2014 12:48:45 +0000 (12:48 +0000)]
[asan] Fix malloc interception on Android L Preview.

Format of __libc_malloc_dispatch has changed in Android L.
While we are moving towards a solution that does not depend on bionic
internals, here is something to support both K* and L releases.

llvm-svn: 213263

10 years ago[OPENMP] Initial parsing and sema analysis of 'mergeable' clause.
Alexey Bataev [Thu, 17 Jul 2014 12:47:03 +0000 (12:47 +0000)]
[OPENMP] Initial parsing and sema analysis of 'mergeable' clause.

llvm-svn: 213262

10 years agoARM: Add ACLE memory barrier intrinsic mapping
Yi Kong [Thu, 17 Jul 2014 12:45:17 +0000 (12:45 +0000)]
ARM: Add ACLE memory barrier intrinsic mapping

llvm-svn: 213261

10 years agoRevert "Handle diagnostic warnings in Frontend diagnostic handler."
Alp Toker [Thu, 17 Jul 2014 12:29:08 +0000 (12:29 +0000)]
Revert "Handle diagnostic warnings in Frontend diagnostic handler."

This commit is missing tests and there are a few points that need to be
addressed before a new user-facing option can be added:

  http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20140714/110198.html

This reverts commit r213112.

llvm-svn: 213260

10 years agoFixing the objc_runtine_name documentation so that the code block is properly generated.
Aaron Ballman [Thu, 17 Jul 2014 12:25:32 +0000 (12:25 +0000)]
Fixing the objc_runtine_name documentation so that the code block is properly generated.

llvm-svn: 213259

10 years agoclang-format: Fix parsing of conditional expressions.
Daniel Jasper [Thu, 17 Jul 2014 12:22:04 +0000 (12:22 +0000)]
clang-format: Fix parsing of conditional expressions.

Before:
  aaaaaa = aaaaaaaaaaaa ? aaaaaaaaaa ? aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
      : aaaaaaaaaaaaaaaaaaaaaa
      : aaaaaaaaaaaaaaaaaaaaaaaaaaaa;

After:
  aaaaaa = aaaaaaaaaaaa
               ? aaaaaaaaaa ? aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
                            : aaaaaaaaaaaaaaaaaaaaaa
               : aaaaaaaaaaaaaaaaaaaaaaaaaaaa;

llvm-svn: 213258

10 years ago[OPENMP] Initial support for parsing and sema analysis of 'untied' clause.
Alexey Bataev [Thu, 17 Jul 2014 12:19:31 +0000 (12:19 +0000)]
[OPENMP] Initial support for parsing and sema analysis of 'untied' clause.

llvm-svn: 213257

10 years ago[NVPTX] Add more surface/texture intrinsics, including CUDA unified texture fetch
Justin Holewinski [Thu, 17 Jul 2014 11:59:04 +0000 (11:59 +0000)]
[NVPTX] Add more surface/texture intrinsics, including CUDA unified texture fetch

This also uses TSFlags to mark machine instructions that are surface/texture
accesses, as well as the vector width for surface operations.  This is used
to simplify some of the switch statements that need to detect surface/texture
instructions

llvm-svn: 213256

10 years agoUpstream an MS inline assembly test from Mozilla's inline assembly code
Ehsan Akhgari [Thu, 17 Jul 2014 11:38:22 +0000 (11:38 +0000)]
Upstream an MS inline assembly test from Mozilla's inline assembly code

Summary:
I'm planning on upstreaming some test cases for the inline assembly
usage in the Mozilla code base.  A lot of these test cases test the
recent fixes to this code.

Reviewers: rnk

Subscribers: cfe-commits

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

llvm-svn: 213255

10 years agoARM: support direct f16 <-> f64 conversions
Tim Northover [Thu, 17 Jul 2014 11:27:04 +0000 (11:27 +0000)]
ARM: support direct f16 <-> f64 conversions

ARMv8 has instructions to handle it, otherwise a libcall is needed.

llvm-svn: 213254

10 years ago[TABLEGEN] Do not crash on intrinsics with names longer than 40 characters
Justin Holewinski [Thu, 17 Jul 2014 11:23:29 +0000 (11:23 +0000)]
[TABLEGEN] Do not crash on intrinsics with names longer than 40 characters

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

llvm-svn: 213253

10 years agoCodeGen: generate single libcall for fptrunc -> f16 operations.
Tim Northover [Thu, 17 Jul 2014 11:12:12 +0000 (11:12 +0000)]
CodeGen: generate single libcall for fptrunc -> f16 operations.

Previously we asserted on this code. Currently compiler-rt doesn't
actually implement any of these new libcalls, but external help is
pretty much the only viable option for LLVM.

I've followed the much more generic "__truncST2" naming, as opposed to
the odd name for f32 -> f16 truncation. This can obviously be changed
later, or overridden by any targets that need to.

llvm-svn: 213252

10 years agoX86: support double extension of f16 type.
Tim Northover [Thu, 17 Jul 2014 11:04:04 +0000 (11:04 +0000)]
X86: support double extension of f16 type.

x86 has no native ability to extend an f16 to f64, but the same result
is obtained if we expand it into two separate extensions: f16 -> f32
-> f64.

Unfortunately the same is not true for truncate, so that still results
in a compilation failure.

llvm-svn: 213251

10 years agoPort memory barriers intrinsics to AArch64
Yi Kong [Thu, 17 Jul 2014 10:52:06 +0000 (10:52 +0000)]
Port memory barriers intrinsics to AArch64

Memory barrier __builtin_arm_[dmb, dsb, isb] intrinsics are required to
implement their corresponding ACLE and MSVC intrinsics.

This patch ports ARM dmb, dsb, isb intrinsic to AArch64.

Requires LLVM r213247.

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

llvm-svn: 213250

10 years agoIR: update Clang to use polymorphic __fp16 conversion intrinsics.
Tim Northover [Thu, 17 Jul 2014 10:51:31 +0000 (10:51 +0000)]
IR: update Clang to use polymorphic __fp16 conversion intrinsics.

There should be no change in semantics at this stage.

llvm-svn: 213249

10 years agoCodeGen: extend f16 conversions to permit types > float.
Tim Northover [Thu, 17 Jul 2014 10:51:23 +0000 (10:51 +0000)]
CodeGen: extend f16 conversions to permit types > float.

This makes the two intrinsics @llvm.convert.from.f16 and
@llvm.convert.to.f16 accept types other than simple "float". This is
only strictly needed for the truncate operation, since otherwise
double rounding occurs and there's no way to represent the strict IEEE
conversion. However, for symmetry we allow larger types in the extend
too.

During legalization, we can expand an "fp16_to_double" operation into
two extends for convenience, but abort when the truncate isn't legal. A new
libcall is probably needed here.

Even after this commit, various target tweaks are needed to actually use the
extended intrinsics. I've put these into separate commits for clarity, so there
are no actual tests of f64 conversion here.

llvm-svn: 213248

10 years agoPort memory barriers intrinsics to AArch64
Yi Kong [Thu, 17 Jul 2014 10:50:20 +0000 (10:50 +0000)]
Port memory barriers intrinsics to AArch64

Memory barrier __builtin_arm_[dmb, dsb, isb] intrinsics are required to
implement their corresponding ACLE and MSVC intrinsics.

This patch ports ARM dmb, dsb, isb intrinsic to AArch64.

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

llvm-svn: 213247

10 years ago[mips] .reginfo is 8 byte aligned on N32.
Daniel Sanders [Thu, 17 Jul 2014 10:10:04 +0000 (10:10 +0000)]
[mips] .reginfo is 8 byte aligned on N32.

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

llvm-svn: 213246

10 years agoMake the diagnostic message more complete to check the check name.
Alexander Kornienko [Thu, 17 Jul 2014 10:05:26 +0000 (10:05 +0000)]
Make the diagnostic message more complete to check the check name.

llvm-svn: 213245

10 years ago[mips] Correct ELF e_flags for the N32 ABI when using a mips-* triple rather than...
Daniel Sanders [Thu, 17 Jul 2014 10:02:08 +0000 (10:02 +0000)]
[mips] Correct ELF e_flags for the N32 ABI when using a mips-* triple rather than a mips64-* triple

Summary:
Generally speaking, mips-* vs mips64-* should not be used to make decisions
about the content or format of the ELF. This should be based on the ABI
and CPU in use. For example, `mips-linux-gnu-clang -mips64r2 -mabi=64`
should produce an ELF64 as should `mips64-linux-gnu-clang -mabi=64`.
Conversely, `mips64-linux-gnu-clang -mabi=n32` should produce an ELF32 as
should `mips-linux-gnu-clang -mips64r2 -mabi=n32`.

This patch fixes the e_flags but leaves the ELF32 vs ELF64 issue for now
since there is no apparent way to base this decision on the ABI and CPU.

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

llvm-svn: 213244

10 years ago[mips] Correct .MIPS.abiflags for -mfpxx on MIPS32r6
Daniel Sanders [Thu, 17 Jul 2014 09:57:23 +0000 (09:57 +0000)]
[mips] Correct .MIPS.abiflags for -mfpxx on MIPS32r6

Summary:
The cpr1_size field describes the minimum register width to run the program
rather than the size of the registers on the target. MIPS32r6 was acting
as if -mfp64 has been given because it starts off with 64-bit FPU registers.

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

llvm-svn: 213243

10 years ago[mips] Fix ELF e_flags related to -mabicalls and -mplt.
Daniel Sanders [Thu, 17 Jul 2014 09:52:56 +0000 (09:52 +0000)]
[mips] Fix ELF e_flags related to -mabicalls and -mplt.

Summary:
These options are not implemented yet but we act as if they are always
given.

The integrated assembler is driven by the clang driver so the e_flag test
cases should match the e_flags emitted by GCC+GAS rather than GAS
by itself.

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

llvm-svn: 213242

10 years ago[mips] Pass the ABI to the integrated assembler and add tests the existing arguments.
Daniel Sanders [Thu, 17 Jul 2014 09:46:40 +0000 (09:46 +0000)]
[mips] Pass the ABI to the integrated assembler and add tests the existing arguments.

Summary:
With this patch (and a corresponding LLVM patch), assembling an empty file with
GCC and Clang -fintegrated-as produce near identical objects. The remaining
differences are:
* GCC/GAS produce objects have a .pdr section
* GCC/GAS produce objects have a .gnu.attributes section
Other differences are insignificant such as precise file offsets and the order
of strings in the string table.

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

llvm-svn: 213241

10 years agoFix the prefix for arm64 triple
Yi Kong [Thu, 17 Jul 2014 09:43:27 +0000 (09:43 +0000)]
Fix the prefix for arm64 triple

Triple.cpp still returns "arm64" as prefix for arm64 triple, causing Clang not
being able to select the correct GCCBuiltin IR.

This patch changes the value to correct prefix "aarch64". Regression test will
be added in the coming patch.

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

llvm-svn: 213240

10 years ago[msan] Avoid redundant origin stores.
Evgeniy Stepanov [Thu, 17 Jul 2014 09:10:37 +0000 (09:10 +0000)]
[msan] Avoid redundant origin stores.

Origin is meaningless for fully initialized values. Avoid
storing origin for function arguments that are known to
be always initialized (i.e. shadow is a compile-time null
constant).

This is not about correctness, but purely an optimization.
Seems to affect compilation time of blacklisted functions
significantly.

llvm-svn: 213239

10 years ago[clang-tidy] MemsetZeroLenghtChecker: Don't crash trying to evaluate dependent values.
Benjamin Kramer [Thu, 17 Jul 2014 08:56:55 +0000 (08:56 +0000)]
[clang-tidy] MemsetZeroLenghtChecker: Don't crash trying to evaluate dependent values.

llvm-svn: 213238

10 years ago[OPENMP] Parsing/Sema analysis of directive 'master'
Alexander Musman [Thu, 17 Jul 2014 08:54:58 +0000 (08:54 +0000)]
[OPENMP] Parsing/Sema analysis of directive 'master'

llvm-svn: 213237

10 years agoConsistency on the tab/space
Sylvestre Ledru [Thu, 17 Jul 2014 08:40:35 +0000 (08:40 +0000)]
Consistency on the tab/space

llvm-svn: 213236

10 years agoFix Bug 14061 - scan-build crashes during postprocessing if BUGFILE no longer exists
Sylvestre Ledru [Thu, 17 Jul 2014 08:39:04 +0000 (08:39 +0000)]
Fix Bug 14061 -  scan-build crashes during postprocessing if BUGFILE no longer exists
Experienced with Thunderbird build

Patch by Matti Niemenmaa

llvm-svn: 213235

10 years ago[clang-tidy] Provide links to the google style guide for checks derived from it.
Benjamin Kramer [Thu, 17 Jul 2014 08:23:24 +0000 (08:23 +0000)]
[clang-tidy] Provide links to the google style guide for checks derived from it.

llvm-svn: 213233