platform/upstream/llvm.git
10 years agoImprove robustness of tests for module flags metadata
Oliver Stannard [Thu, 19 Jun 2014 16:10:21 +0000 (16:10 +0000)]
Improve robustness of tests for module flags metadata

Fix clang tests to not break if the ID numbers of module flags metadata
nodes change.

llvm-svn: 211276

10 years agoEmit DWARF info for all code section in an assembly file
Oliver Stannard [Thu, 19 Jun 2014 15:52:37 +0000 (15:52 +0000)]
Emit DWARF info for all code section in an assembly file

Currently, when using llvm as an assembler, DWARF debug information is only
generated for the .text section. This patch modifies this so that DWARF info
is emitted for all executable sections.

llvm-svn: 211273

10 years agoEmit DWARF3 call frame information when DWARF3+ debug info is requested
Oliver Stannard [Thu, 19 Jun 2014 15:39:33 +0000 (15:39 +0000)]
Emit DWARF3 call frame information when DWARF3+ debug info is requested

Currently, llvm always emits a DWARF CIE with a version of 1, even when emitting
DWARF 3 or 4, which both support CIE version 3. This patch makes it emit the
newer CIE version when we are emitting DWARF 3 or 4. This will not reduce
compatibility, as we already emit other DWARF3/4 features, and is worth doing as
the DWARF3 spec removed some ambiguities in the interpretation of call frame
information.

It also fixes a minor bug where the "return address" field of the CIE was
encoded as a ULEB128, which is only valid when the CIE version is 3. There are
no test changes for this, because (as far as I can tell) none of the platforms
that we test have a return address register with a DWARF register number >127.

llvm-svn: 211272

10 years ago[mips] Implementation of dli.
Matheus Almeida [Thu, 19 Jun 2014 15:08:04 +0000 (15:08 +0000)]
[mips] Implementation of dli.

Patch by David Chisnall
His work was sponsored by: DARPA, AFRL

Some small modifications to the original patch: we now error if
it's not possible to expand an instruction (mips-expansions-bad.s has some
examples). Added some comments to the expansions.

llvm-svn: 211271

10 years agoFix assertion hit or bogus compiler error in cases when instantiating ObjC property...
Argyrios Kyrtzidis [Thu, 19 Jun 2014 14:45:16 +0000 (14:45 +0000)]
Fix assertion hit or bogus compiler error in cases when instantiating ObjC property accesses used with overloaded binary operators.

rdar://17153478

llvm-svn: 211270

10 years ago[mips] Small update to the logic behind the expansion of assembly pseudo instructions.
Matheus Almeida [Thu, 19 Jun 2014 14:39:14 +0000 (14:39 +0000)]
[mips] Small update to the logic behind the expansion of assembly pseudo instructions.

Summary:
The functions that do the expansion now return false on success and true otherwise. This is so
we can catch some errors during the expansion (e.g.: immediate too large). The next patch adds some test cases.

Reviewers: vmedic

Reviewed By: vmedic

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

llvm-svn: 211269

10 years agoUpdated comments as suggested by Rafael. Thanks.
Dinesh Dwivedi [Thu, 19 Jun 2014 14:11:53 +0000 (14:11 +0000)]
Updated comments as suggested by Rafael. Thanks.

llvm-svn: 211268

10 years ago[c++1z] Implement N3994: a range-based for loop can declare a variable with super...
Richard Smith [Thu, 19 Jun 2014 11:42:00 +0000 (11:42 +0000)]
[c++1z] Implement N3994: a range-based for loop can declare a variable with super-terse notation

  for (x : range) { ... }

which is equivalent to

  for (auto &&x : range) { ... }

llvm-svn: 211267

10 years agoAdded instruction combine to transform few more negative values addition to subtracti...
Dinesh Dwivedi [Thu, 19 Jun 2014 10:36:52 +0000 (10:36 +0000)]
Added instruction combine to transform few more negative values addition to subtraction (Part 1)
This patch enables transforms for following patterns.
  (x + (~(y & c) + 1)   -->   x - (y & c)
  (x + (~((y >> z) & c) + 1)   -->   x - ((y>>z) & c)

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

llvm-svn: 211266

10 years ago[X86] Teach how to combine horizontal binop even in the presence of undefs.
Andrea Di Biagio [Thu, 19 Jun 2014 10:29:41 +0000 (10:29 +0000)]
[X86] Teach how to combine horizontal binop even in the presence of undefs.

Before this change, the backend was unable to fold a build_vector dag
node with UNDEF operands into a single horizontal add/sub.

This patch teaches how to combine a build_vector with UNDEF operands into a
horizontal add/sub when possible. The algorithm conservatively avoids to combine
a build_vector with only a single non-UNDEF operand.

Added test haddsub-undef.ll to verify that we correctly fold horizontal binop
even in the presence of UNDEFs.

llvm-svn: 211265

10 years ago[sanitizer] Intercept pthread_*attr_get*.
Evgeniy Stepanov [Thu, 19 Jun 2014 10:19:57 +0000 (10:19 +0000)]
[sanitizer] Intercept pthread_*attr_get*.

This is a resubmit of r211166 reverted due to osx breakage.

llvm-svn: 211264

10 years ago[Mips] Make r26-1.test test case independent from external input files.
Simon Atanasyan [Thu, 19 Jun 2014 10:18:58 +0000 (10:18 +0000)]
[Mips] Make r26-1.test test case independent from external input files.

llvm-svn: 211263

10 years ago[OPENMP] Improved diagnostic messages for vars with the predetermined data sharing...
Alexey Bataev [Thu, 19 Jun 2014 09:13:45 +0000 (09:13 +0000)]
[OPENMP] Improved diagnostic messages for vars with the predetermined data sharing attributes and reformatting

llvm-svn: 211262

10 years agoRefactored and updated SimplifyUsingDistributiveLaws() to
Dinesh Dwivedi [Thu, 19 Jun 2014 08:29:18 +0000 (08:29 +0000)]
Refactored and updated SimplifyUsingDistributiveLaws() to
 * Find factorization opportunities using identity values.
 * Find factorization opportunities by treating shl(X, C) as mul (X, shl(C))
 * Keep NSW flag while simplifying instruction using factorization.

This fixes PR19263.

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

llvm-svn: 211261

10 years agoCommandLine: bail out when options get multiply registered
Alp Toker [Thu, 19 Jun 2014 07:25:25 +0000 (07:25 +0000)]
CommandLine: bail out when options get multiply registered

These errors are strictly unrecoverable and indicate serious issues such as
conflicting option names or an incorrectly linked LLVM distribution.

With this change, the errors actually get detected so tests don't pass
silently.

llvm-svn: 211260

10 years agoRemove OwningPtr.h and associated tests
Alp Toker [Thu, 19 Jun 2014 07:25:18 +0000 (07:25 +0000)]
Remove OwningPtr.h and associated tests

llvm::OwningPtr is superseded by std::unique_ptr.

llvm-svn: 211259

10 years agoInstCombine: Stop two transforms dueling
David Majnemer [Thu, 19 Jun 2014 07:14:33 +0000 (07:14 +0000)]
InstCombine: Stop two transforms dueling

InstCombineMulDivRem has:
// Canonicalize (X+C1)*CI -> X*CI+C1*CI.

InstCombineAddSub has:
// W*X + Y*Z --> W * (X+Z)  iff W == Y

These two transforms could fight with each other if C1*CI would not fold
away to something simpler than a ConstantExpr mul.

The InstCombineMulDivRem transform only acted on ConstantInts until
r199602 when it was changed to operate on all Constants in order to
let it fire on ConstantVectors.

To fix this, make this transform more careful by checking to see if we
actually folded away C1*CI.

This fixes PR20079.

llvm-svn: 211258

10 years agoMove -dwarf-version to an MC level command line option so it's
Eric Christopher [Thu, 19 Jun 2014 06:22:08 +0000 (06:22 +0000)]
Move -dwarf-version to an MC level command line option so it's
used by all of the MC level tools and codegen. Fix up all uses
in the compiler to use this and set it on the context accordingly.

llvm-svn: 211257

10 years agoRemove unnecessary include.
Eric Christopher [Thu, 19 Jun 2014 06:22:05 +0000 (06:22 +0000)]
Remove unnecessary include.

llvm-svn: 211256

10 years ago80-column fixups.
Eric Christopher [Thu, 19 Jun 2014 06:22:01 +0000 (06:22 +0000)]
80-column fixups.

llvm-svn: 211255

10 years agoConvert some assert(0) to llvm_unreachable or fold an 'if' condition into the assert.
Craig Topper [Thu, 19 Jun 2014 06:10:58 +0000 (06:10 +0000)]
Convert some assert(0) to llvm_unreachable or fold an 'if' condition into the assert.

llvm-svn: 211254

10 years agoR600: Add a few tests I forgot to add.
Matt Arsenault [Thu, 19 Jun 2014 04:24:43 +0000 (04:24 +0000)]
R600: Add a few tests I forgot to add.

These belong with r210827

llvm-svn: 211253

10 years agoMove optimization of some cases of (A & C1)|(B & C2) from instcombine to instsimplify...
Nick Lewycky [Thu, 19 Jun 2014 03:51:46 +0000 (03:51 +0000)]
Move optimization of some cases of (A & C1)|(B & C2) from instcombine to instsimplify. Patch by Rahul Jain, plus some last minute changes by me -- you can blame me for any bugs.

llvm-svn: 211252

10 years agoMake instsimplify's analysis of icmp eq/ne use computeKnownBits to determine whether...
Nick Lewycky [Thu, 19 Jun 2014 03:35:49 +0000 (03:35 +0000)]
Make instsimplify's analysis of icmp eq/ne use computeKnownBits to determine whether the icmp is always true or false. Patch by Suyog Sarda!

llvm-svn: 211251

10 years agoRemove redundant code in InstCombineShift, no functionality change because instsimpli...
Nick Lewycky [Thu, 19 Jun 2014 03:28:28 +0000 (03:28 +0000)]
Remove redundant code in InstCombineShift, no functionality change because instsimplify already does this and instcombine calls instsimplify a few lines above. Patch by Suyog Sarda!

llvm-svn: 211250

10 years agoMS asm: Properly handle quoted symbol names
David Majnemer [Thu, 19 Jun 2014 01:25:43 +0000 (01:25 +0000)]
MS asm: Properly handle quoted symbol names

We would get confused by '@' characters in symbol names, we would
mistake the text following them for the variant kind.

When an identifier a string, the variant kind will never show up inside
of it.  Instead, check to see if there is a variant following the
string.

This fixes PR19965.

llvm-svn: 211249

10 years agoDiagnoseUnknownTypename always emits a diagnostic and returns true
Reid Kleckner [Thu, 19 Jun 2014 01:23:22 +0000 (01:23 +0000)]
DiagnoseUnknownTypename always emits a diagnostic and returns true

Make it return void and delete the dead code in the parser that handled
the case where it might return false.  This has been dead since 2010
when John deleted Action.h.

llvm-svn: 211248

10 years agoR600/SI: Add intrinsics for various math instructions.
Matt Arsenault [Thu, 19 Jun 2014 01:19:19 +0000 (01:19 +0000)]
R600/SI: Add intrinsics for various math instructions.

These will be used for custom lowering and for library
implementations of various math functions, so it's useful
to expose these as builtins.

llvm-svn: 211247

10 years agoFix breakage from r211244 by using LLVM_EXPLICIT to avoid using explicit operators...
David Blaikie [Thu, 19 Jun 2014 01:09:49 +0000 (01:09 +0000)]
Fix breakage from r211244 by using LLVM_EXPLICIT to avoid using explicit operators under MSVC where they're not supported.

llvm-svn: 211246

10 years agoUnbreak the build after r211244.
David Blaikie [Thu, 19 Jun 2014 00:43:19 +0000 (00:43 +0000)]
Unbreak the build after r211244.

These operator overloads were unneeded (once the const correctness in
PooledStringPtr was corrected) and inefficient (since the strings are
pooled the pointers can just be compared for equality instead of doing
strcmp).

llvm-svn: 211245

10 years agoPR10140 - StringPool's PooledStringPtr has non-const operator== causing bad OR-result.
Nikola Smiljanic [Thu, 19 Jun 2014 00:26:49 +0000 (00:26 +0000)]
PR10140 - StringPool's PooledStringPtr has non-const operator== causing bad OR-result.

Mark conversion operator explicit and const qualify comparison operators.

llvm-svn: 211244

10 years agoObjective-C ARC. Allow conversion of (void*) pointers to
Fariborz Jahanian [Wed, 18 Jun 2014 23:52:49 +0000 (23:52 +0000)]
Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
in the context of pointer comparison as this is in effect
a +0 context. // rdar://16627903

llvm-svn: 211243

10 years agoActually make a real scoped locker rather than constructing one that gets immediately...
Jim Ingham [Wed, 18 Jun 2014 23:40:13 +0000 (23:40 +0000)]
Actually make a real scoped locker rather than constructing one that gets immediately thrown away...

llvm-svn: 211242

10 years agoAdd a lock in the UnwindTable class so two Targets won't try
Jason Molenda [Wed, 18 Jun 2014 23:32:53 +0000 (23:32 +0000)]
Add a lock in the UnwindTable class so two Targets won't try
to modify the same UnwindTable object simultaneously.  Fix
HistoryThread and HistoryUnwind's mutex lock acqusition to
retain the lock for the duration of the operation instead of
releasing the temporary immediately.
<rdar://problem/17055023>

llvm-svn: 211241

10 years agoSema: Static redeclaration after extern declarations is a Microsoft Extension
David Majnemer [Wed, 18 Jun 2014 23:26:25 +0000 (23:26 +0000)]
Sema: Static redeclaration after extern declarations is a Microsoft Extension

CL permits static redeclarations to follow extern declarations.  The
storage specifier on the latter declaration has no effect.

This fixes PR20034.

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

llvm-svn: 211238

10 years agoObjective-C. Revert my patch in r211234.
Fariborz Jahanian [Wed, 18 Jun 2014 23:22:38 +0000 (23:22 +0000)]
Objective-C. Revert my patch in r211234.

llvm-svn: 211237

10 years agoMissing reduction detection test cases
Johannes Doerfert [Wed, 18 Jun 2014 23:08:14 +0000 (23:08 +0000)]
Missing reduction detection test cases

llvm-svn: 211235

10 years agoObjective-C ARC. Allow conversion of (void*) pointers to
Fariborz Jahanian [Wed, 18 Jun 2014 22:50:40 +0000 (22:50 +0000)]
Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
by recognizing this as a +0 context. // rdar://16627903

llvm-svn: 211234

10 years agoMove ARMJITInfo off of the TargetMachine and down onto the subtarget.
Eric Christopher [Wed, 18 Jun 2014 22:48:09 +0000 (22:48 +0000)]
Move ARMJITInfo off of the TargetMachine and down onto the subtarget.
This required untangling a mess of headers that included around.

This a recommit of r210953 with a fix for the removed accessor
for JITInfo.

llvm-svn: 211233

10 years agoUse stdint macros for specifying size of constants
Matt Arsenault [Wed, 18 Jun 2014 22:11:03 +0000 (22:11 +0000)]
Use stdint macros for specifying size of constants

llvm-svn: 211231

10 years agoTeach llvm-size to know about Mach-O universal files (aka fat files) and
Kevin Enderby [Wed, 18 Jun 2014 22:04:40 +0000 (22:04 +0000)]
Teach llvm-size to know about Mach-O universal files (aka fat files) and
fat files containing archives.

Also fix a bug in MachOUniversalBinary::ObjectForArch::ObjectForArch()
where it needed a >= when comparing the Index with the number of
objects in a fat file.  As the index starts at 0.

llvm-svn: 211230

10 years agoR600: Handle fnearbyint
Matt Arsenault [Wed, 18 Jun 2014 22:03:45 +0000 (22:03 +0000)]
R600: Handle fnearbyint

The difference from rint isn't really relevant here,
so treat them as equivalent. OpenCL doesn't have nearbyint,
so this is sort of pointless other than for completeness.

llvm-svn: 211229

10 years agoR600/SI: add gather4 and getlod intrinsics (v3)
Marek Olsak [Wed, 18 Jun 2014 22:00:29 +0000 (22:00 +0000)]
R600/SI: add gather4 and getlod intrinsics (v3)

This contains all the previous patches + getlod support on top of it.
It doesn't use SDNodes anymore, so it's quite small.
It also adds v16i8 to SReg_128, which is used for the sampler descriptor.

Reviewed-by: Tom Stellard
llvm-svn: 211228

10 years agotests: relax ms-intrinsics test
Saleem Abdulrasool [Wed, 18 Jun 2014 21:48:44 +0000 (21:48 +0000)]
tests: relax ms-intrinsics test

Relax the tests to allow for differences between release and debug builds.  This
should fix the buildbots.

Thanks to Benjamin Kramer and Eric Christo for their invaluable tip that this
was release build specific issue.

llvm-svn: 211227

10 years agoUse LL suffix for literal that should be 64-bits.
Matt Arsenault [Wed, 18 Jun 2014 21:40:43 +0000 (21:40 +0000)]
Use LL suffix for literal that should be 64-bits.

This hopefully fixes Windows

llvm-svn: 211225

10 years agoRelax the cl-inputs.c test a little bit in case link.exe is on PATH
Reid Kleckner [Wed, 18 Jun 2014 21:34:36 +0000 (21:34 +0000)]
Relax the cl-inputs.c test a little bit in case link.exe is on PATH

llvm-svn: 211224

10 years ago[MS-ABI] Implement typeid
Warren Hunt [Wed, 18 Jun 2014 21:15:55 +0000 (21:15 +0000)]
[MS-ABI] Implement typeid
This patch enables clang to generate calls to __RTtypeid when lowering
typeid on win32 targets.  Test cases are included.

llvm-svn: 211223

10 years agoAdd a symbols() range and use a range loop.
Rafael Espindola [Wed, 18 Jun 2014 21:14:57 +0000 (21:14 +0000)]
Add a symbols() range and use a range loop.

llvm-svn: 211222

10 years agoSimplify code.
Rafael Espindola [Wed, 18 Jun 2014 21:08:17 +0000 (21:08 +0000)]
Simplify code.

We can delete the objects earlier now that we are copying the names to a buffer.

llvm-svn: 211221

10 years agoMC: do not add comment string to the AsmToken in AsmLexer::LexLineComment
Saleem Abdulrasool [Wed, 18 Jun 2014 20:57:32 +0000 (20:57 +0000)]
MC: do not add comment string to the AsmToken in AsmLexer::LexLineComment

Fixes macros with varargs if the macro instantiation has a trailing comment.

Patch by Janne Grunau!

llvm-svn: 211219

10 years agoMCAsmParser: full support for gas' '.if{cond} expression' directives
Saleem Abdulrasool [Wed, 18 Jun 2014 20:57:28 +0000 (20:57 +0000)]
MCAsmParser: full support for gas' '.if{cond} expression' directives

Patch by Janne Grunau!

llvm-svn: 211218

10 years agoCodeGen: improve ms instrincics support
Saleem Abdulrasool [Wed, 18 Jun 2014 20:51:10 +0000 (20:51 +0000)]
CodeGen: improve ms instrincics support

Add support for _InterlockedCompareExchangePointer, _InterlockExchangePointer,
_InterlockExchange.  These are available as a compiler intrinsic on ARM and x86.
These are used directly by the Windows SDK headers without use of the intrin
header.

llvm-svn: 211216

10 years agoObjective-C. Check for integer overflow in Objective-C's
Fariborz Jahanian [Wed, 18 Jun 2014 20:49:02 +0000 (20:49 +0000)]
Objective-C. Check for integer overflow in Objective-C's
boxed expression. // rdar://16417427

llvm-svn: 211215

10 years agoReplace Execution Engine's mutex with std::recursive_mutex.
Zachary Turner [Wed, 18 Jun 2014 20:17:35 +0000 (20:17 +0000)]
Replace Execution Engine's mutex with std::recursive_mutex.

This change has a bit of a trickle down effect due to the fact that
there are a number of derived implementations of ExecutionEngine,
and that the mutex is not tightly encapsulated so is used by other
classes directly.

Reviewed by: rnk

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

llvm-svn: 211214

10 years agoRevert a C API difference that I incorrectly introduced.
Rafael Espindola [Wed, 18 Jun 2014 20:07:35 +0000 (20:07 +0000)]
Revert a C API difference that I incorrectly introduced.

LLVMGetBitcodeModuleInContext should not take ownership on error. I will
try to localize this odd api requirement, but this should get the bots green.

llvm-svn: 211213

10 years agoDon't allow multiple line entries with the same address to exist sequentially.
Greg Clayton [Wed, 18 Jun 2014 19:55:34 +0000 (19:55 +0000)]
Don't allow multiple line entries with the same address to exist sequentially.

The compiler, when JIT'ing code, can emit illegal DWARF line tables (address is line table sequences must increase). This changes fixes that issue by replacing previous line entries whose start address is the same with the new line entry to avoid having multiple line entries with the same address. Since the address range of lines entries is determined by the delta between the current and next line entry, this shouldn't cause any issues.

llvm-svn: 211212

10 years agoAdd pown
Jeroen Ketema [Wed, 18 Jun 2014 19:42:23 +0000 (19:42 +0000)]
Add pown

Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 211211

10 years agoAdd missing undefs
Jeroen Ketema [Wed, 18 Jun 2014 19:37:34 +0000 (19:37 +0000)]
Add missing undefs

Reviewed-by: Tom Stellard <tom@stellard.net>
llvm-svn: 211210

10 years ago[analyzer] Don't create new PostStmt nodes if we don't have to.
Jordan Rose [Wed, 18 Jun 2014 19:23:30 +0000 (19:23 +0000)]
[analyzer] Don't create new PostStmt nodes if we don't have to.

Doing this caused us to mistakenly think we'd seen a particular state before
when we actually hadn't, which resulted in false negatives. Credit to
Rafael Auler for discovering this issue!

llvm-svn: 211209

10 years agoMake getBaseObject static.
Rafael Espindola [Wed, 18 Jun 2014 19:08:47 +0000 (19:08 +0000)]
Make getBaseObject static.

Thanks to David Majnemer for noticing.

llvm-svn: 211208

10 years agoChange IRObjectFile to parse the bitcode lazily.
Rafael Espindola [Wed, 18 Jun 2014 19:05:24 +0000 (19:05 +0000)]
Change IRObjectFile to parse the bitcode lazily.

The main point of this class is to provide a cheap object interface to a bitcode
file, so it has to be as lazy as possible.

llvm-svn: 211207

10 years agoRevert "[sanitizer] Intercept pthread_*attr_get*."
Arnold Schwaighofer [Wed, 18 Jun 2014 19:04:47 +0000 (19:04 +0000)]
Revert "[sanitizer] Intercept pthread_*attr_get*."

This reverts commit r211166. It broke public mac os x bots.

llvm-svn: 211206

10 years agoRemove BitcodeReader::setBufferOwned.
Rafael Espindola [Wed, 18 Jun 2014 18:55:41 +0000 (18:55 +0000)]
Remove BitcodeReader::setBufferOwned.

We do have use cases for the bitcode reader owning the buffer or not, but we
always know which one we have when we construct it.

It might be possible to simplify this further, but this is a step in the
right direction.

llvm-svn: 211205

10 years agoSimply test for available locations in optimization remarks.
Diego Novillo [Wed, 18 Jun 2014 18:46:58 +0000 (18:46 +0000)]
Simply test for available locations in optimization remarks.

When emitting optimization remarks, we test for the presence of
instruction locations by testing for a valid llvm.dbg.cu annotation.
This is slightly inefficient because we can simply ask whether the
debug location we have is known or not.

Additionally, if my current plan works, I will need to remove the
llvm.dbg.cu annotation from the IL (or prevent it from being generated)
when -Rpass is used without -g.  In those cases, we'll want to generate
line tables but we will want to prevent code generation from emitting
DWARF code for them.

Tested on x86_64.

llvm-svn: 211204

10 years ago[PowerPC] Remove unnecessary load of r12 in indirect call
Ulrich Weigand [Wed, 18 Jun 2014 18:33:36 +0000 (18:33 +0000)]
[PowerPC] Remove unnecessary load of r12 in indirect call

When looking at the 64-bit SVR4 indirect call sequence, I noticed
an unnecessary load of r12.  And indeed the code says:

  // R12 must contain the address of an indirect callee.

But this is not correct; in the 64-bit SVR4 (ELFv1) ABI, there is
no need to load r12 at this point.  It seems this code and comment
is a remnant of code originally shared with the Darwin ABI ...

This patch simply removes the unnecessary load.

llvm-svn: 211203

10 years agoUpdate to the latest registered ELF e_machine names and values.
Rafael Espindola [Wed, 18 Jun 2014 18:30:15 +0000 (18:30 +0000)]
Update to the latest registered ELF e_machine names and values.

Patch by John Wolf!

llvm-svn: 211202

10 years agoRun clang-format in a small chunk of code I am about to change.
Rafael Espindola [Wed, 18 Jun 2014 18:26:53 +0000 (18:26 +0000)]
Run clang-format in a small chunk of code I am about to change.

llvm-svn: 211201

10 years agoAdd an option for debugserver to propagate its environment to programs it launches...
Greg Clayton [Wed, 18 Jun 2014 18:26:50 +0000 (18:26 +0000)]
Add an option for debugserver to propagate its environment to programs it launches using the --forward-env or -F:

% ./debugserver --forward-env localhost:1234 -- /bin/ls
% ./debugserver -F localhost:1234 -- /bin/ls

Also allow new environment variables to be set using the "--env" or "-e":

% ./debugserver --env FOO=1 --env BAR=2 localhost:1234 -- /bin/ls
% ./debugserver -e FOO=1 -e BAR=2 localhost:1234 -- /bin/ls

<rdar://problem/17350654>

llvm-svn: 211200

10 years agoProfileData: Fix copy-paste type in RawInstrProfReader
Justin Bogner [Wed, 18 Jun 2014 18:20:44 +0000 (18:20 +0000)]
ProfileData: Fix copy-paste type in RawInstrProfReader

These deleted definitions had the wrong types.

Patch by Alex L!

llvm-svn: 211199

10 years ago[ARM] [MC] Refactor the constant pool classes
Weiming Zhao [Wed, 18 Jun 2014 18:17:25 +0000 (18:17 +0000)]
[ARM] [MC] Refactor the constant pool classes

ARMTargetStreamer implements ConstantPool and AssmeblerConstantPools
to keep track of assembler-generated constant pools that are used for
ldr-pseudo.

When implementing ldr-pseudo for AArch64, these two classes can be reused.
So this patch factors them out from ARM target to the general MC lib.

llvm-svn: 211198

10 years agoObjective-C. Try to fix the test in buildbot in my last patch.
Fariborz Jahanian [Wed, 18 Jun 2014 18:16:37 +0000 (18:16 +0000)]
Objective-C. Try to fix the test in buildbot in my last patch.

llvm-svn: 211197

10 years agoADT: correct typo in comment
Ed Maste [Wed, 18 Jun 2014 18:08:55 +0000 (18:08 +0000)]
ADT: correct typo in comment

llvm-svn: 211196

10 years agoObjective-C. Attributes on class declarations carry over
Fariborz Jahanian [Wed, 18 Jun 2014 17:58:27 +0000 (17:58 +0000)]
Objective-C. Attributes on class declarations carry over
to forward class declarations for diagnosis.
// rdar://16681279

llvm-svn: 211195

10 years agoR600: Expand vector fceil
Jan Vesely [Wed, 18 Jun 2014 17:57:29 +0000 (17:57 +0000)]
R600: Expand vector fceil

Move fp64 fceil tests to fceil64.ll

v2: rebase

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 211194

10 years ago[PowerPC] Simplify and improve loading into TOC register
Ulrich Weigand [Wed, 18 Jun 2014 17:52:49 +0000 (17:52 +0000)]
[PowerPC] Simplify and improve loading into TOC register

During an indirect function call sequence on the 64-bit SVR4 ABI,
generate code must load and then restore the TOC register.

This does not use a regular LOAD instruction since the TOC
register r2 is marked as reserved.  Instead, the are two
special instruction patterns:

 let RST = 2, DS = 2 in
 def LDinto_toc: DSForm_1a<58, 0, (outs), (ins g8rc:$reg),
                     "ld 2, 8($reg)", IIC_LdStLD,
                     [(PPCload_toc i64:$reg)]>, isPPC64;

 let RST = 2, DS = 10, RA = 1 in
 def LDtoc_restore : DSForm_1a<58, 0, (outs), (ins),
                     "ld 2, 40(1)", IIC_LdStLD,
                     [(PPCtoc_restore)]>, isPPC64;

Note that these not only restrict the destination of the
load to r2, but they also restrict the *source* of the
load to particular address combinations.  The latter is
a problem when we want to support the ELFv2 ABI, since
there the TOC save slot is no longer at 40(1).

This patch replaces those two instructions with a single
instruction pattern that only hard-codes r2 as destination,
but supports generic addresses as source.  This will allow
supporting the ELFv2 ABI, and also helps generate more
efficient code for calls to absolute addresses (allowing
simplification of the ppc64-calls.ll test case).

llvm-svn: 211193

10 years agoWork around ridiculous warning.
Matt Arsenault [Wed, 18 Jun 2014 17:45:58 +0000 (17:45 +0000)]
Work around ridiculous warning.

Apparently C++ doesn't really have hex floating point constants.

llvm-svn: 211192

10 years agoFormatting improvements in the <string_view> synopsis suggested by RSmith. No functio...
Marshall Clow [Wed, 18 Jun 2014 17:44:04 +0000 (17:44 +0000)]
Formatting improvements in the <string_view> synopsis suggested by RSmith. No functionality change.

llvm-svn: 211191

10 years ago[PowerPC] Add back test case for absolute calls (removed in r211174)
Ulrich Weigand [Wed, 18 Jun 2014 17:28:56 +0000 (17:28 +0000)]
[PowerPC] Add back test case for absolute calls (removed in r211174)

As requested by Hal Finkel, this adds back a test for calls to
a known-constant function pointer value, and verifies that the
64-bit SVR4 indirect function call sequence is used.

llvm-svn: 211190

10 years agoMake clang-cl accept .lib inputs (PR20065)
Hans Wennborg [Wed, 18 Jun 2014 17:21:50 +0000 (17:21 +0000)]
Make clang-cl accept .lib inputs (PR20065)

Patch by Ehsan Akhgari!

(Tiny tweak by me: renamed PathSegment to LibDir.)

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

llvm-svn: 211189

10 years agoAdd a triple so that right syntax is choosen on mac osx systems
Arnold Schwaighofer [Wed, 18 Jun 2014 17:20:49 +0000 (17:20 +0000)]
Add a triple so that right syntax is choosen on mac osx systems

llvm-svn: 211188

10 years agoR600/SI: Add intrinsics for brev instructions
Matt Arsenault [Wed, 18 Jun 2014 17:13:57 +0000 (17:13 +0000)]
R600/SI: Add intrinsics for brev instructions

llvm-svn: 211187

10 years agoR600/SI: Prettier operand printing for 64-bit ops.
Matt Arsenault [Wed, 18 Jun 2014 17:13:51 +0000 (17:13 +0000)]
R600/SI: Prettier operand printing for 64-bit ops.

Copy what is done for 32-bit already so the order is about the same.

llvm-svn: 211186

10 years ago[mips] SYNC $stype instruction was added in Mips32
Matheus Almeida [Wed, 18 Jun 2014 17:10:30 +0000 (17:10 +0000)]
[mips] SYNC $stype instruction was added in Mips32
but SYNC with an implied operand ($stype = 0) is valid since Mips2.

llvm-svn: 211185

10 years agoFix a memory leak in the error path.
Rafael Espindola [Wed, 18 Jun 2014 17:07:15 +0000 (17:07 +0000)]
Fix a memory leak in the error path.

llvm-svn: 211184

10 years agoR600: Implement f64 ftrunc, ffloor and fceil.
Matt Arsenault [Wed, 18 Jun 2014 17:05:30 +0000 (17:05 +0000)]
R600: Implement f64 ftrunc, ffloor and fceil.

CI has instructions for these, so this fixes them for older hardware.

llvm-svn: 211183

10 years agoR600: Custom lower f64 frint for pre-CI
Matt Arsenault [Wed, 18 Jun 2014 17:05:26 +0000 (17:05 +0000)]
R600: Custom lower f64 frint for pre-CI

llvm-svn: 211182

10 years agoR600/SI: Temporary fix for f64 fneg
Matt Arsenault [Wed, 18 Jun 2014 17:05:22 +0000 (17:05 +0000)]
R600/SI: Temporary fix for f64 fneg

This should be a source modifier, but this unblocks
most of my math patches.

llvm-svn: 211181

10 years agoR600/SI: Comparisons set vcc.
Matt Arsenault [Wed, 18 Jun 2014 16:53:48 +0000 (16:53 +0000)]
R600/SI: Comparisons set vcc.

llvm-svn: 211178

10 years agoDriver: correct the backend option spelling
Saleem Abdulrasool [Wed, 18 Jun 2014 16:52:24 +0000 (16:52 +0000)]
Driver: correct the backend option spelling

The backend option does not have an '-enable' prefix.

llvm-svn: 211177

10 years ago[X86] AVX512: Add non-temporal stores
Adam Nemet [Wed, 18 Jun 2014 16:51:10 +0000 (16:51 +0000)]
[X86] AVX512: Add non-temporal stores

Note that I followed the AVX2 convention here and didn't add LLVM intrinsics
for stores.  These can be generated with the nontemporal hint on LLVM IR
stores (see new test). The GCC builtins are lowered directly into nontemporal
stores.

<rdar://problem/17082571>

llvm-svn: 211176

10 years ago[X86] AVX512: Specify compressed displacement for vmovntdqa
Adam Nemet [Wed, 18 Jun 2014 16:51:07 +0000 (16:51 +0000)]
[X86] AVX512: Specify compressed displacement for vmovntdqa

Use the max 64-bit element size with EVEX_CD8.  This should work since element
size is ignored for a full-vector access (FVM).

llvm-svn: 211175

10 years ago[PowerPC] Do not use BLA with the 64-bit SVR4 ABI
Ulrich Weigand [Wed, 18 Jun 2014 16:14:04 +0000 (16:14 +0000)]
[PowerPC] Do not use BLA with the 64-bit SVR4 ABI

The PowerPC back-end uses BLA to implement calls to functions at
known-constant addresses, which is apparently used for certain
system routines on Darwin.

However, with the 64-bit SVR4 ABI, this is actually incorrect.
An immediate function pointer value on this platform is not
directly usable as a target address for BLA:
- in the ELFv1 ABI, the function pointer value refers to the
  *function descriptor*, not the code address
- in the ELFv2 ABI, the function pointer value refers to the
  global entry point, but BL(A) would only be correct when
  calling the *local* entry point

This bug didn't show up since using immediate function pointer
values is not usually done in the 64-bit SVR4 ABI in the first
place.  However, I ran into this issue with a certain use case
of LLVM as JIT, where immediate function pointer values were
uses to implement callbacks from JITted code to helpers in
statically compiled code.

Fixed by simply not using BLA with the 64-bit SVR4 ABI.

llvm-svn: 211174

10 years agoInherit dll attributes to static locals
Hans Wennborg [Wed, 18 Jun 2014 15:55:13 +0000 (15:55 +0000)]
Inherit dll attributes to static locals

This makes us handle static locals in exported/imported functions correctly.

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

llvm-svn: 211173

10 years agoDo not XFAIL test/tools/llvm-cov tests on powerpc64le
Ulrich Weigand [Wed, 18 Jun 2014 15:52:18 +0000 (15:52 +0000)]
Do not XFAIL test/tools/llvm-cov tests on powerpc64le

All tests in test/tools/llvm-cov fail on big-endian targets and are
supposed to be XFAILed there.  However, including "powerpc64" in the
XFAIL line is now incorrect, since that matches both powerpc64- and
powerpc64le- targets, and the tests pass on the latter.

Update the XFAIL lines to use powerpc64- instead (like mips64-).

llvm-svn: 211172

10 years ago[PowerPC] Fix emitting instruction pairs on LE
Ulrich Weigand [Wed, 18 Jun 2014 15:37:07 +0000 (15:37 +0000)]
[PowerPC] Fix emitting instruction pairs on LE

My patch r204634 to emit instructions in little-endian format failed to
handle those special cases where we emit a pair of instructions from a
single LLVM MC instructions (like the bl; nop pairs used to implement
the call sequence).

In those cases, we still need to emit the "first" instruction (the one
in the more significant word) first, on both big and little endian,
and not swap them.

llvm-svn: 211171

10 years agoSupport LE in RelocVisitor::visitELF_PPC64_*
Ulrich Weigand [Wed, 18 Jun 2014 15:15:49 +0000 (15:15 +0000)]
Support LE in RelocVisitor::visitELF_PPC64_*

Since we now support both LE and BE PPC64 variants, use of getAddend64BE
is no longer correct.  Use the generic getELFRelocationAddend instead,
as was already done for Mips.

llvm-svn: 211170

10 years ago[mips] Fix expansion of memory operation if destination register is not a GPR.
Matheus Almeida [Wed, 18 Jun 2014 14:49:56 +0000 (14:49 +0000)]
[mips] Fix expansion of memory operation if destination register is not a GPR.

Summary:
The assembler tries to reuse the destination register for memory operations whenever
it can but it's not possible to do so if the destination register is not a GPR.

Example:
  ldc1 $f0, sym
should expand to:
  lui $at, %hi(sym)
  ldc1 $f0, %lo(sym)($at)

It's entirely wrong to expand to:
  lui $f0, %hi(sym)
  ldc1 $f0, %lo(sym)($f0)

Reviewers: dsanders

Reviewed By: dsanders

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

llvm-svn: 211169

10 years ago[mips] Report correct location when "erroring" about the use of $at when it's not...
Matheus Almeida [Wed, 18 Jun 2014 14:46:05 +0000 (14:46 +0000)]
[mips] Report correct location when "erroring" about the use of $at when it's not available.

Summary: This removes the FIXMEs from test/MC/Mips/mips-noat.s.

Reviewers: dsanders

Reviewed By: dsanders

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

llvm-svn: 211168

10 years ago[mips][mips64r6] Add BLTC and BLTUC instructions
Zoran Jovanovic [Wed, 18 Jun 2014 14:36:00 +0000 (14:36 +0000)]
[mips][mips64r6] Add BLTC and BLTUC instructions
Differential Revision: http://reviews.llvm.org/D3923

llvm-svn: 211167

10 years ago[sanitizer] Intercept pthread_*attr_get*.
Evgeniy Stepanov [Wed, 18 Jun 2014 14:16:41 +0000 (14:16 +0000)]
[sanitizer] Intercept pthread_*attr_get*.

llvm-svn: 211166