platform/upstream/llvm.git
9 years agorange-for some things
David Blaikie [Wed, 3 Dec 2014 19:58:49 +0000 (19:58 +0000)]
range-for some things

llvm-svn: 223263

9 years agoSimplify CodeGenRegBank::inferMatchingSuperRegClass & its caller by passing an iterat...
David Blaikie [Wed, 3 Dec 2014 19:58:48 +0000 (19:58 +0000)]
Simplify CodeGenRegBank::inferMatchingSuperRegClass & its caller by passing an iterator rather than index

llvm-svn: 223262

9 years agoSimplify ownership of RegClasses by using list<CodeGenRegisterClass> instead of vecto...
David Blaikie [Wed, 3 Dec 2014 19:58:45 +0000 (19:58 +0000)]
Simplify ownership of RegClasses by using list<CodeGenRegisterClass> instead of vector<CodeGenRegisterClass*>

This complicates a few algorithms due to not having random access, but
not by a huge degree I don't think (open to debate/design
discussion/etc).

llvm-svn: 223261

9 years agoRange-for some stuff related to RegClasses, and comment cases where range-for isn...
David Blaikie [Wed, 3 Dec 2014 19:58:41 +0000 (19:58 +0000)]
Range-for some stuff related to RegClasses, and comment cases where range-for isn't suitable.

llvm-svn: 223260

9 years agoMake the Verifier more strict about gc.statepoints
Philip Reames [Wed, 3 Dec 2014 19:53:15 +0000 (19:53 +0000)]
Make the Verifier more strict about gc.statepoints

The recently added documentation for statepoints claimed that we checked the parameters of the various intrinsics for validity.  This patch adds the code to actually do so.  I also removed a couple of redundant checks for conditions which are checked elsewhere in the Verifier and simplified the logic using the helper functions from Statepoint.h.

llvm-svn: 223259

9 years agoASan CMakeLists.txt: fix bad indent; NFC
Hans Wennborg [Wed, 3 Dec 2014 19:05:42 +0000 (19:05 +0000)]
ASan CMakeLists.txt: fix bad indent; NFC

llvm-svn: 223258

9 years agoAdd TableGen info for Power8.
Will Schmidt [Wed, 3 Dec 2014 18:46:30 +0000 (18:46 +0000)]
Add TableGen info for Power8.
This is based on the Power7 version, with units added and renamed to match P8.

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

llvm-svn: 223257

9 years agoChange the name to be in style.
Roman Divacky [Wed, 3 Dec 2014 18:39:44 +0000 (18:39 +0000)]
Change the name to be in style.

llvm-svn: 223255

9 years agoFix sphinx error from Statepoints.rst
Matt Arsenault [Wed, 3 Dec 2014 18:35:11 +0000 (18:35 +0000)]
Fix sphinx error from Statepoints.rst

It was complaining it wasn't included in any toctree

llvm-svn: 223254

9 years agoR600/SI: Move SIInsertWaits into AMDGPUPassConfig::addPreSched2()
Tom Stellard [Wed, 3 Dec 2014 18:27:08 +0000 (18:27 +0000)]
R600/SI: Move SIInsertWaits into AMDGPUPassConfig::addPreSched2()

This pass needs to be run after PrologEpilogInserter, because
that pass may inserter spill code which reads or writes memory.

llvm-svn: 223253

9 years agoR600/SI: Don't run SI passes on R600 subtargets
Tom Stellard [Wed, 3 Dec 2014 18:27:05 +0000 (18:27 +0000)]
R600/SI: Don't run SI passes on R600 subtargets

llvm-svn: 223252

9 years agoUse timeout when reading debugserver's port from a named pipe.
Oleksiy Vyalov [Wed, 3 Dec 2014 18:19:16 +0000 (18:19 +0000)]
Use timeout when reading debugserver's port from a named pipe.

http://reviews.llvm.org/D6490

llvm-svn: 223251

9 years agoMake ArgumentsAdjuster an std::function (clang-tools-extra part of D6505).
Alexander Kornienko [Wed, 3 Dec 2014 17:53:03 +0000 (17:53 +0000)]
Make ArgumentsAdjuster an std::function (clang-tools-extra part of D6505).

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

llvm-svn: 223249

9 years agoMake ArgumentsAdjuster an std::function.
Alexander Kornienko [Wed, 3 Dec 2014 17:53:02 +0000 (17:53 +0000)]
Make ArgumentsAdjuster an std::function.

Reviewers: klimek

Reviewed By: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 223248

9 years agoAArch64: fix wrong-endian parameter passing.
Tim Northover [Wed, 3 Dec 2014 17:49:26 +0000 (17:49 +0000)]
AArch64: fix wrong-endian parameter passing.

The blocked arguments code didn't take account of the hacks needed to support
it.

llvm-svn: 223247

9 years ago[NFC] Fixing pendantic warning extra semicolons.
Colin LeMahieu [Wed, 3 Dec 2014 17:36:39 +0000 (17:36 +0000)]
[NFC] Fixing pendantic warning extra semicolons.

llvm-svn: 223246

9 years ago[Hexagon] [NFC] Moving function implementations out of header. Clang-formatting...
Colin LeMahieu [Wed, 3 Dec 2014 17:35:39 +0000 (17:35 +0000)]
[Hexagon] [NFC] Moving function implementations out of header.  Clang-formatting files.

llvm-svn: 223245

9 years agoFix test to use the right metadata node (reapply r223239 plus a fix) and also to...
Nick Lewycky [Wed, 3 Dec 2014 17:32:44 +0000 (17:32 +0000)]
Fix test to use the right metadata node (reapply r223239 plus a fix) and also to use the correct path to the GCNO file.

llvm-svn: 223244

9 years ago[Hexagon] [NFC] Renaming *packetStart to *packetBegin
Colin LeMahieu [Wed, 3 Dec 2014 17:31:43 +0000 (17:31 +0000)]
[Hexagon] [NFC] Renaming *packetStart to *packetBegin

llvm-svn: 223243

9 years agoFix isThreadModelSupported()'s comment. NFC
Jonathan Roelofs [Wed, 3 Dec 2014 17:04:52 +0000 (17:04 +0000)]
Fix isThreadModelSupported()'s comment. NFC

llvm-svn: 223241

9 years agoRevert r223239, which broke some bots.
Alexander Potapenko [Wed, 3 Dec 2014 16:03:08 +0000 (16:03 +0000)]
Revert r223239, which broke some bots.

llvm-svn: 223240

9 years agoFix the metadata number used by llvm.gcov to match the number of the inserted metadat...
Alexander Potapenko [Wed, 3 Dec 2014 15:15:58 +0000 (15:15 +0000)]
Fix the metadata number used by llvm.gcov to match the number of the inserted metadata node.

llvm-svn: 223239

9 years agoSilencing several "multiple copy constructors" warnings from MSVC; NFC.
Aaron Ballman [Wed, 3 Dec 2014 14:44:16 +0000 (14:44 +0000)]
Silencing several "multiple copy constructors" warnings from MSVC; NFC.

llvm-svn: 223238

9 years agoSilencing a 32-bit implicit conversion warning in MSVC; NFC.
Aaron Ballman [Wed, 3 Dec 2014 14:39:58 +0000 (14:39 +0000)]
Silencing a 32-bit implicit conversion warning in MSVC; NFC.

llvm-svn: 223237

9 years agomsan] Add compile-time checks for missing origins.
Evgeniy Stepanov [Wed, 3 Dec 2014 14:15:53 +0000 (14:15 +0000)]
msan] Add compile-time checks for missing origins.

This change makes MemorySanitizer instrumentation a bit more strict
about instructions that have no origin id assigned to them.

This would have caught the bug that was fixed in r222918.

This is re-commit of r222997, reverted in r223211, with 3 more
missing origins added.

llvm-svn: 223236

9 years ago[clang-tidy] Update help messages and docs.
Alexander Kornienko [Wed, 3 Dec 2014 14:03:03 +0000 (14:03 +0000)]
[clang-tidy] Update help messages and docs.

Fixed incorrect examples of configuration, clarified the usage of -dump-config.

llvm-svn: 223235

9 years agoclang-format: Fix fake parentheses placement with comments.
Daniel Jasper [Wed, 3 Dec 2014 14:02:59 +0000 (14:02 +0000)]
clang-format: Fix fake parentheses placement with comments.

Before:
  return (a > b
          // comment1
      // comment2
      || c);

After:
  return (a > b
      // comment1
      // comment2
      || c);

llvm-svn: 223234

9 years ago[msan] Change the way origin ids are built.
Evgeniy Stepanov [Wed, 3 Dec 2014 13:58:40 +0000 (13:58 +0000)]
[msan] Change the way origin ids are built.

Previously, all origin ids were "chained" origins, i.e values of
ChainedOriginDepot. This added a level of indirection for simple
stack and heap allocation, which were represented as chains of
length 1. This costs both RAM and CPU, but provides a joined 2**29
origin id space. It also made function (any instrumented function)
entry non-async-signal-safe, but that does not really matter because
memory stores in track-origins=2 mode are not async-signal-safe anyway.

With this change, the type of the origin is encoded in origin id.
See comment in msan_origin.h for more details. This reduces chained and stack
origin id range to 2**28 each, but leaves extra 2**31 for heap origins.

This change should not have any user-visible effects.

llvm-svn: 223233

9 years ago[clang-tidy] Make a test independent of the default check set.
Alexander Kornienko [Wed, 3 Dec 2014 13:48:46 +0000 (13:48 +0000)]
[clang-tidy] Make a test independent of the default check set.

llvm-svn: 223232

9 years ago[asan] Fix stale_stack_leak.cc test in ASan-UAR mode.
Evgeniy Stepanov [Wed, 3 Dec 2014 13:35:41 +0000 (13:35 +0000)]
[asan] Fix stale_stack_leak.cc test in ASan-UAR mode.

This test does an intentional use-after-return, but this is not the focus of
the test, so ignore it.

llvm-svn: 223230

9 years ago[msan] Add one more test for the handling of stack origins.
Evgeniy Stepanov [Wed, 3 Dec 2014 13:26:56 +0000 (13:26 +0000)]
[msan] Add one more test for the handling of stack origins.

llvm-svn: 223229

9 years agoclang-format: Fix expression parser not closing stuff at end of stmt.
Daniel Jasper [Wed, 3 Dec 2014 13:20:49 +0000 (13:20 +0000)]
clang-format: Fix expression parser not closing stuff at end of stmt.

Uncovered by a Java test case:

Before:
  public some.package.Type someFunction( // comment
      int parameter) {}

After:
  public some.package.Type someFunction( // comment
                          int parameter) {}

llvm-svn: 223228

9 years agoRemove unnecessary changes committed in r223222.
Hafiz Abid Qadeer [Wed, 3 Dec 2014 12:48:19 +0000 (12:48 +0000)]
Remove unnecessary changes committed in r223222.
There were 2 different patches in discussion. One using ioctl
and other using select. We decided to use the ioctl but committed
code also have some changes which were only needed for 'select'.
This patch removes them.

llvm-svn: 223227

9 years ago[msan] Re-enable one test.
Evgeniy Stepanov [Wed, 3 Dec 2014 12:11:33 +0000 (12:11 +0000)]
[msan] Re-enable one test.

It has been fixed a long time ago.

llvm-svn: 223226

9 years ago[OPENMP] Code formatting and improvement, no functional changes.
Alexey Bataev [Wed, 3 Dec 2014 12:11:24 +0000 (12:11 +0000)]
[OPENMP] Code formatting and improvement, no functional changes.

llvm-svn: 223225

9 years agoInstCombine: simplify signed range checks
Erik Eckstein [Wed, 3 Dec 2014 10:39:15 +0000 (10:39 +0000)]
InstCombine: simplify signed range checks

Try to convert two compares of a signed range check into a single unsigned compare.
Examples:
(icmp sge x, 0) & (icmp slt x, n) --> icmp ult x, n
(icmp slt x, 0) | (icmp sgt x, n) --> icmp ugt x, n

llvm-svn: 223224

9 years agoFix a hang on OSX while executing -exec-run.
Hafiz Abid Qadeer [Wed, 3 Dec 2014 10:23:06 +0000 (10:23 +0000)]
Fix a hang on OSX while executing -exec-run.
Now we wait for input to become available before blocking in fgets.
More details on problem can be found in
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20141201/014290.html

Patch from dawn@burble.org.

llvm-svn: 223222

9 years ago[PowerPC] Print all inline-asm consts as signed numbers
Hal Finkel [Wed, 3 Dec 2014 09:37:50 +0000 (09:37 +0000)]
[PowerPC] Print all inline-asm consts as signed numbers

Almost all immediates in PowerPC assembly (both 32-bit and 64-bit) are signed
numbers, and it is important that we print them as such. To make sure that
happens, we change PPCTargetLowering::LowerAsmOperandForConstraint so that it
does all intermediate checks on a signed-extended int64_t value, and then
creates the resulting target constant using MVT::i64. This will ensure that all
negative values are printed as negative values (mirroring what is done in other
backends to achieve the same sign-extension effect).

This came up in the context of inline assembly like this:
  "add%I2   %0,%0,%2", ..., "Ir"(-1ll)
where we used to print:
  addi   3,3,4294967295
and gcc would print:
  addi   3,3,-1
and gas accepts both forms, but our builtin assembler (correctly) does not. Now
we print -1 like gcc does.

While here, I replaced a bunch of custom integer checks with isInt<16> and
friends from MathExtras.h.

Thanks to Paul Hargrove for the bug report.

llvm-svn: 223220

9 years agoPreserve LD_LIBRARY_PATH when using the 'env' command
Hal Finkel [Wed, 3 Dec 2014 08:19:17 +0000 (08:19 +0000)]
Preserve LD_LIBRARY_PATH when using the 'env' command

In many Linux environments (and similar), just-built applications won't run
correctly without making use of the current LD_LIBRARY_PATH environmental
variable in order to find dynamic libraries. Propagate it through the 'env'
command (hopefully this works on all platforms).

llvm-svn: 223219

9 years agoEmit ABI_FP_rounding attribute.
Charlie Turner [Wed, 3 Dec 2014 08:12:26 +0000 (08:12 +0000)]
Emit ABI_FP_rounding attribute.

LLVM understands a -enable-sign-dependent-rounding-fp-math codegen option. When
the user has specified this option, the Tag_ABI_FP_rounding attribute should be
emitted with value 1. This option currently does not appear to disable
transformations and optimizations that assume default floating point rounding
behavior, AFAICT, but the intention should be recorded in the build attributes,
regardless of what the compiler actually does with the intention.

Change-Id: If838578df3dc652b6f2796b8d152545674bcb30e
llvm-svn: 223218

9 years agoAdd tests for default value of Tag_ABI_FP_rounding.
Charlie Turner [Wed, 3 Dec 2014 07:59:50 +0000 (07:59 +0000)]
Add tests for default value of Tag_ABI_FP_rounding.

Change-Id: I051866d073fc6ce87ce3e693a3762da6d81f4393
llvm-svn: 223217

9 years agoFix a typo in the documentation of LTO
Benjamin Poulain [Wed, 3 Dec 2014 07:32:36 +0000 (07:32 +0000)]
Fix a typo in the documentation of LTO

Fix defininitions->definitions.

Reviewed by David Blaikie.

llvm-svn: 223216

9 years agoAsk the module for its the identified types.
Rafael Espindola [Wed, 3 Dec 2014 07:18:23 +0000 (07:18 +0000)]
Ask the module for its the identified types.

When lazy reading a module, the types used in a function will not be visible to
a TypeFinder until the body is read.

This patch fixes that by asking the module for its identified struct types.
If a materializer is present, the module asks it. If not, it uses a TypeFinder.

This fixes pr21374.

I will be the first to say that this is ugly, but it was the best I could find.

Some of the options I looked at:

* Asking the LLVMContext. This could be made to work for gold, but not currently
  for ld64. ld64 will load multiple modules into a single context before merging
  them. This causes us to see types from future merges. Unfortunately,
  MappedTypes is not just a cache when it comes to opaque types. Once the
  mapping has been made, we have to remember it for as long as the key may
  be used. This would mean moving MappedTypes to the Linker class and having
  to drop the Linker::LinkModules static methods, which are visible from C.

* Adding an option to ignore function bodies in the TypeFinder. This would
  fix the PR by picking the worst result. It would work, but unfortunately
  we are currently quite dependent on the upfront type merging. I will
  try to reduce our dependency, but it is not clear that we will be able
  to get rid of it for now.

The only clean solution I could think of is making the Module own the types.
This would have other advantages, but it is a much bigger change. I will
propose it, but it is nice to have this fixed while that is discussed.

With the gold plugin, this patch takes the number of types in the LTO clang
binary from 52817 to 49669.

llvm-svn: 223215

9 years agoADT: Rename argument in emplace_back_impl
Duncan P. N. Exon Smith [Wed, 3 Dec 2014 05:53:24 +0000 (05:53 +0000)]
ADT: Rename argument in emplace_back_impl

Rename a functor argument in r223201 from `emplace` to `construct` to
reduce confusion.

llvm-svn: 223212

9 years agoRevert r222997. The newly added compile-time checks are finding missing origins,...
Nick Lewycky [Wed, 3 Dec 2014 05:47:00 +0000 (05:47 +0000)]
Revert r222997. The newly added compile-time checks are finding missing origins, testcase is being reduced and a PR will be posted shortly.

llvm-svn: 223211

9 years agoLoopVectorize: Remove unnecessary RAUW
Duncan P. N. Exon Smith [Wed, 3 Dec 2014 05:41:20 +0000 (05:41 +0000)]
LoopVectorize: Remove unnecessary RAUW

Remove an unnecessary `MDNode::replaceAllUsesWith()`.  In the preceding
line, `TheLoop->setLoopID()` visits all backedges and sets the new loop
ID.  This sufficiently updates the loop metadata.

Metadata RAUW is going away as part of PR21532.

llvm-svn: 223210

9 years agoHandle delayed corrections in a couple more error paths in ParsePostfixExpressionSuffix.
Kaelyn Takata [Wed, 3 Dec 2014 05:30:54 +0000 (05:30 +0000)]
Handle delayed corrections in a couple more error paths in ParsePostfixExpressionSuffix.

llvm-svn: 223209

9 years agoR600/SI: Fix SIFixSGPRCopies for copies to physical registers
Matt Arsenault [Wed, 3 Dec 2014 05:22:39 +0000 (05:22 +0000)]
R600/SI: Fix SIFixSGPRCopies for copies to physical registers

This shows up when operands required to be passed in VCC are copied
to.

llvm-svn: 223208

9 years agoR600/SI: Remove incorrect assertion
Matt Arsenault [Wed, 3 Dec 2014 05:22:38 +0000 (05:22 +0000)]
R600/SI: Remove incorrect assertion

This can be a COPY to a physical register, such as VCC

llvm-svn: 223207

9 years agoR600/SI: Remove i1 pseudo VALU ops
Matt Arsenault [Wed, 3 Dec 2014 05:22:35 +0000 (05:22 +0000)]
R600/SI: Remove i1 pseudo VALU ops

Select i1 logical ops directly to 64-bit SALU instructions.
Vector i1 values are always really in SGPRs, with each
bit for each item in the wave. This saves about 4 instructions
when and/or/xoring any condition, and also helps write conditions
that need to be passed in vcc.

This should work correctly now that the SGPR live range
fixing pass works. More work is needed to eliminate the VReg_1
pseudo regclass and possibly the entire SILowerI1Copies pass.

llvm-svn: 223206

9 years agoR600/SI: Fix suspicious indexing
Matt Arsenault [Wed, 3 Dec 2014 05:22:32 +0000 (05:22 +0000)]
R600/SI: Fix suspicious indexing

The loop is over the operands of an instruction, and checks the
register with the sub reg index of the dest register. This probably
meant to be checking the sub reg index of the same operand.

llvm-svn: 223205

9 years agoR600/SI: Fix running SILowerI1Copies a second time
Matt Arsenault [Wed, 3 Dec 2014 05:22:30 +0000 (05:22 +0000)]
R600/SI: Fix running SILowerI1Copies a second time

llvm-svn: 223204

9 years agoR600/SI: Fix live range error hidden by SIFoldOperands
Matt Arsenault [Wed, 3 Dec 2014 05:22:29 +0000 (05:22 +0000)]
R600/SI: Fix live range error hidden by SIFoldOperands

m0 is treated as a virtual register class with a single register
rather than the physical register it really is. This was updating
the live range of the used virtual copy of m0 from the first ds_read
instruction, and leaving the unused copy unchanged. This resulted in a
"Live segment doesn't end at a valid instruction" verifier error because
the erased instructions. Update the live range of the second copy (which
should be dead).

No test since I'm not sure how to trigger this with SIFoldOperands
enabled.

llvm-svn: 223203

9 years agoADT: Add SmallVector<>::emplace_back(): fixup
Duncan P. N. Exon Smith [Wed, 3 Dec 2014 04:49:16 +0000 (04:49 +0000)]
ADT: Add SmallVector<>::emplace_back(): fixup

Add missing `void` return type from `!LLVM_HAS_VARIADIC_TEMPLATES` case
in r223201.

llvm-svn: 223202

9 years agoADT: Add SmallVector<>::emplace_back()
Duncan P. N. Exon Smith [Wed, 3 Dec 2014 04:45:09 +0000 (04:45 +0000)]
ADT: Add SmallVector<>::emplace_back()

llvm-svn: 223201

9 years ago[PECOFF] Fix a bug in /export option handler.
Rui Ueyama [Wed, 3 Dec 2014 04:34:20 +0000 (04:34 +0000)]
[PECOFF] Fix a bug in /export option handler.

/export option can be given multiple times to specify multiple
symbols to be exported. /export accepts both decorated and
undecorated name.

If you give both undecorated and decorated name of the same symbol
to /export, they are resolved to the same symbol. In this case,
we need to de-duplicate the exported names, so that we don't have
duplicated items in the export symbol table in a DLL.

We remove duplicate items from a vector. The bug was there.
Because we had pointers pointing to elements of the vector,
after an item is removed, they would point wrong elements.

This patch is to remove these pointers. Added a test for that case.

llvm-svn: 223200

9 years agoStructurizeCFG: Use LoopInfo analysis for better loop detection
Tom Stellard [Wed, 3 Dec 2014 04:28:32 +0000 (04:28 +0000)]
StructurizeCFG: Use LoopInfo analysis for better loop detection

We were assuming that each back-edge in a region represented a unique
loop, which is not always the case.  We need to use LoopInfo to
correctly determine which back-edges are loops.

llvm-svn: 223199

9 years agoNVPTX: Delete dead code
Duncan P. N. Exon Smith [Wed, 3 Dec 2014 04:13:23 +0000 (04:13 +0000)]
NVPTX: Delete dead code

`MDNode` does not inherit from `User`, and it never has a name.

llvm-svn: 223198

9 years agoR600/SI: Enable inline assembly
Tom Stellard [Wed, 3 Dec 2014 04:08:00 +0000 (04:08 +0000)]
R600/SI: Enable inline assembly

We just needed to remove the assertion in
AMDGPURegisterInfo::getFrameRegister(), which is called when
initializing the parser for inline assembly.

llvm-svn: 223197

9 years agoUpdate setMCJITMemoryManager call to keep in line with llvm r223183.
Jason Molenda [Wed, 3 Dec 2014 04:02:03 +0000 (04:02 +0000)]
Update setMCJITMemoryManager call to keep in line with llvm r223183.
Patch from Ryan Goodfellow.

llvm-svn: 223196

9 years ago[OCaml] [cmake] Disable OCaml bindings if ctypes >=0.3 is not found.
Peter Zotov [Wed, 3 Dec 2014 03:39:01 +0000 (03:39 +0000)]
[OCaml] [cmake] Disable OCaml bindings if ctypes >=0.3 is not found.

llvm-svn: 223195

9 years agoR600/SI: Change mubuf offsets to print as decimal
Matt Arsenault [Wed, 3 Dec 2014 03:12:13 +0000 (03:12 +0000)]
R600/SI: Change mubuf offsets to print as decimal

This matches SC's behavior.

llvm-svn: 223194

9 years agoEmit the entry block first and the exit block second, then all the blocks in between...
Nick Lewycky [Wed, 3 Dec 2014 02:45:01 +0000 (02:45 +0000)]
Emit the entry block first and the exit block second, then all the blocks in between afterwards. This is what gcc always does, and some out of tree tools depend on that.

llvm-svn: 223193

9 years agoGCRelocateOperands: Try to appease msc17.
NAKAMURA Takumi [Wed, 3 Dec 2014 02:40:24 +0000 (02:40 +0000)]
GCRelocateOperands: Try to appease msc17.

llvm-svn: 223192

9 years agoUpdate test to check for prologue instead of prefix
Peter Collingbourne [Wed, 3 Dec 2014 02:37:10 +0000 (02:37 +0000)]
Update test to check for prologue instead of prefix

llvm-svn: 223191

9 years agoUBSan now uses prologue data instead of prefix data
Peter Collingbourne [Wed, 3 Dec 2014 02:08:51 +0000 (02:08 +0000)]
UBSan now uses prologue data instead of prefix data

As the semantics of prefix data has changed. See D6454.

Patch by Ben Gamari!

Test Plan: Testsuite

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

llvm-svn: 223190

9 years agoPrologue support
Peter Collingbourne [Wed, 3 Dec 2014 02:08:38 +0000 (02:08 +0000)]
Prologue support

Patch by Ben Gamari!

This redefines the `prefix` attribute introduced previously and
introduces a `prologue` attribute.  There are a two primary usecases
that these attributes aim to serve,

  1. Function prologue sigils

  2. Function hot-patching: Enable the user to insert `nop` operations
     at the beginning of the function which can later be safely replaced
     with a call to some instrumentation facility

  3. Runtime metadata: Allow a compiler to insert data for use by the
     runtime during execution. GHC is one example of a compiler that
     needs this functionality for its tables-next-to-code functionality.

Previously `prefix` served cases (1) and (2) quite well by allowing the user
to introduce arbitrary data at the entrypoint but before the function
body. Case (3), however, was poorly handled by this approach as it
required that prefix data was valid executable code.

Here we redefine the notion of prefix data to instead be data which
occurs immediately before the function entrypoint (i.e. the symbol
address). Since prefix data now occurs before the function entrypoint,
there is no need for the data to be valid code.

The previous notion of prefix data now goes under the name "prologue
data" to emphasize its duality with the function epilogue.

The intention here is to handle cases (1) and (2) with prologue data and
case (3) with prefix data.

References
----------

This idea arose out of discussions[1] with Reid Kleckner in response to a
proposal to introduce the notion of symbol offsets to enable handling of
case (3).

[1] http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-May/073235.html

Test Plan: testsuite

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

llvm-svn: 223189

9 years agoExceptionDemo: Let setMCJITMemoryManager() take unique_ptr, since r223183.
NAKAMURA Takumi [Wed, 3 Dec 2014 02:05:51 +0000 (02:05 +0000)]
ExceptionDemo: Let setMCJITMemoryManager() take unique_ptr, since r223183.

llvm-svn: 223188

9 years ago[X86][MC] Intel syntax: accept implicit memory operand sizes larger than 80.
Ahmed Bougacha [Wed, 3 Dec 2014 02:03:26 +0000 (02:03 +0000)]
[X86][MC] Intel syntax: accept implicit memory operand sizes larger than 80.

The X86AsmParser intel handling was refactored in r216481, making it
try each different memory operand size to see which one matches.
Operand sizes larger than 80 ("[xyz]mmword ptr") were forgotten, which
led to an "invalid operand" error for code such as:
  movdqa [rax], xmm0

llvm-svn: 223187

9 years agoAdd support for has_feature(cxx_alignof) and has_feature(c_alignof).
Nico Weber [Wed, 3 Dec 2014 01:25:49 +0000 (01:25 +0000)]
Add support for has_feature(cxx_alignof) and has_feature(c_alignof).

r142020 added support for has_feature(cxx_alignas). This does the same for
alignof.

llvm-svn: 223186

9 years agoFix incorrect codegen for devirtualized calls to virtual overloaded operators.
Nico Weber [Wed, 3 Dec 2014 01:21:41 +0000 (01:21 +0000)]
Fix incorrect codegen for devirtualized calls to virtual overloaded operators.

Consider this program:

    struct A {
      virtual void operator-() { printf("base\n"); }
    };
    struct B final : public A {
      virtual void operator-() override { printf("derived\n"); }
    };

    int main() {
      B* b = new B;
      -static_cast<A&>(*b);
    }

Before this patch, clang saw the virtual call to A::operator-(), figured out
that it can be devirtualized, and then just called A::operator-() directly,
without going through the vtable.  Instead, it should've looked up which
operator-() the call devirtualizes to and should've called that.

For regular virtual member calls, clang gets all this right already. So
instead of giving EmitCXXOperatorMemberCallee() all the logic that
EmitCXXMemberCallExpr() already has, cut the latter function into two pieces,
call the second piece EmitCXXMemberOrOperatorMemberCallExpr(), and use it also
to generate code for calls to virtual member operators.

This way, virtual overloaded operators automatically don't get devirtualized
if they have covariant returns (like it was done for regular calls in r218602),
etc.

This also happens to fix (or at least improve) codegen for explicit constructor
calls (`A a; a.A::A()`) in MS mode with -fsanitize-address-field-padding=1.

(This adjustment for virtual operator calls seems still wrong with the MS ABI.)

llvm-svn: 223185

9 years agoPR21706: -Wunsequenced was missing warnings when leaving a sequenced region that...
Richard Smith [Wed, 3 Dec 2014 01:05:50 +0000 (01:05 +0000)]
PR21706: -Wunsequenced was missing warnings when leaving a sequenced region that contained side effects.

llvm-svn: 223184

9 years ago[MCJIT] Unique-ptrify the RTDyldMemoryManager member of MCJIT. NFC.
Lang Hames [Wed, 3 Dec 2014 00:51:19 +0000 (00:51 +0000)]
[MCJIT] Unique-ptrify the RTDyldMemoryManager member of MCJIT. NFC.

llvm-svn: 223183

9 years ago[PowerPC] Fix readcyclecounter to be custom expanded for all 32-bit targets
Hal Finkel [Wed, 3 Dec 2014 00:19:17 +0000 (00:19 +0000)]
[PowerPC] Fix readcyclecounter to be custom expanded for all 32-bit targets

We need to use the custom expansion of readcyclecounter on all 32-bit targets
(even those with 64-bit registers). This should fix the ppc64 buildbot.

llvm-svn: 223182

9 years ago[asan] fix four asan tests to run in use-after-return mode
Kostya Serebryany [Wed, 3 Dec 2014 00:08:41 +0000 (00:08 +0000)]
[asan] fix four asan tests to run in use-after-return mode

llvm-svn: 223181

9 years agoAArch64: strengthen Darwin ABI alignment assumptions
Tim Northover [Tue, 2 Dec 2014 23:53:43 +0000 (23:53 +0000)]
AArch64: strengthen Darwin ABI alignment assumptions

A global variable without an explicit alignment specified should be assumed to
be ABI-aligned according to its type, like on other platforms. This allows us
to use better memory operations when accessing it.

rdar://18533701

llvm-svn: 223180

9 years agoFullProduct should be _FullProduct
David Majnemer [Tue, 2 Dec 2014 23:44:40 +0000 (23:44 +0000)]
FullProduct should be _FullProduct

llvm-svn: 223179

9 years agoUse a typed enum instead of 'unsigned char' for packed field. NFC.
Pete Cooper [Tue, 2 Dec 2014 23:34:23 +0000 (23:34 +0000)]
Use a typed enum instead of 'unsigned char' for packed field.  NFC.

This makes it easier to debug Twine as the 'Kind' fields now show their enum values in lldb and not escaped characters.

llvm-svn: 223178

9 years agoEnsure typos in the default values of template parameters get diagnosed.
Kaelyn Takata [Tue, 2 Dec 2014 23:32:20 +0000 (23:32 +0000)]
Ensure typos in the default values of template parameters get diagnosed.

llvm-svn: 223177

9 years agoIntrin: shrx_u64 should be _shrx_u64
David Majnemer [Tue, 2 Dec 2014 23:30:26 +0000 (23:30 +0000)]
Intrin: shrx_u64 should be _shrx_u64

llvm-svn: 223176

9 years agoIntrin: Add _umul128
David Majnemer [Tue, 2 Dec 2014 23:30:24 +0000 (23:30 +0000)]
Intrin: Add _umul128

Implement _umul128; it provides the high and low halves of a 128-bit
multiply.  We can simply use our __int128 arithmetic to implement this,
we generate great code for it:
        movq    %rdx, %rax
        mulq    %rcx
        movq    %rdx, (%r8)
        retq

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

llvm-svn: 223175

9 years agoMark the armv7 q0-q3 and q8-q15 registers as volatile (not callee
Jason Molenda [Tue, 2 Dec 2014 23:21:05 +0000 (23:21 +0000)]
Mark the armv7 q0-q3 and q8-q15 registers as volatile (not callee
preserved) in the ABI.

Realistically lldb isn't able to track register saves of any of
the neon regs right now so we should probably mark all of the
regs as unavailable when you're not on stack frame 0...

<rdar://problem/19115127>

llvm-svn: 223174

9 years agoInstrProf: Use the same names for variables as we use in the profile
Justin Bogner [Tue, 2 Dec 2014 23:15:30 +0000 (23:15 +0000)]
InstrProf: Use the same names for variables as we use in the profile

There's no need to use different names for the local variables than we
use in the profile itself, and it's a bit simpler and easier to debug
if we're consistent.

llvm-svn: 223173

9 years agoAArch64: don't be too greedy when folding :lo12: accesses into mem ops.
Tim Northover [Tue, 2 Dec 2014 23:13:39 +0000 (23:13 +0000)]
AArch64: don't be too greedy when folding :lo12: accesses into mem ops.

This frequently leads to cases like:
   ldr xD, [xN, :lo12:var]
   add xA, xN, :lo12:var
   ldr xD, [xA, #8]

where the ADD would have been needed anyway, and the two distinct addressing
modes can prevent the formation of an ldp. Because of how we handle ADRP
(aggressively forming an ADRP/ADD pseudo-inst at ISel time), this pattern also
results in duplicated ADRP instructions (one on its own to cover the ldr, and
one combined with the add).

llvm-svn: 223172

9 years agoPR21302. Vectorize only bottom-tested loops.
Michael Zolotukhin [Tue, 2 Dec 2014 22:59:06 +0000 (22:59 +0000)]
PR21302. Vectorize only bottom-tested loops.

rdar://problem/18886083

llvm-svn: 223171

9 years agoApply loop-rotate to several vectorizer tests.
Michael Zolotukhin [Tue, 2 Dec 2014 22:59:02 +0000 (22:59 +0000)]
Apply loop-rotate to several vectorizer tests.

Such loops shouldn't be vectorized due to the loops form.
After applying loop-rotate (+simplifycfg) the tests again start to check
what they are intended to check.

llvm-svn: 223170

9 years agoAnother warning with no group name bites the dust.
Fariborz Jahanian [Tue, 2 Dec 2014 22:42:52 +0000 (22:42 +0000)]
Another warning with no group name bites the dust.
rdar://19116886

llvm-svn: 223168

9 years agoInstrProf: Remove some pointless indirection (NFC)
Justin Bogner [Tue, 2 Dec 2014 22:38:52 +0000 (22:38 +0000)]
InstrProf: Remove some pointless indirection (NFC)

It doesn't make much sense to have std::unique_ptrs of std::string and
std::vector. Avoid some useless indirection by using these types
directly.

llvm-svn: 223166

9 years ago[X86][SSE] Keep 4i32 vector insertions in integer domain on SSE4.1 targets
Simon Pilgrim [Tue, 2 Dec 2014 22:31:23 +0000 (22:31 +0000)]
[X86][SSE] Keep 4i32 vector insertions in integer domain on SSE4.1 targets

4i32 shuffles for single insertions into zero vectors lowers to X86vzmovl which was using (v)blendps - causing domain switch stalls. This patch fixes this by using (v)pblendw instead.

The updated tests on test/CodeGen/X86/sse41.ll still contain a domain stall due to the use of insertps - I'm looking at fixing this in a future patch.

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

llvm-svn: 223165

9 years agoReplace InternalScopedBuffer<char> with InternalScopedString where applicable.
Alexey Samsonov [Tue, 2 Dec 2014 22:20:11 +0000 (22:20 +0000)]
Replace InternalScopedBuffer<char> with InternalScopedString where applicable.

Summary: No functionality change.

Test Plan: make check-all

Reviewers: kcc

Reviewed By: kcc

Subscribers: llvm-commits

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

llvm-svn: 223164

9 years agoGive lit a --xunit-xml-output option for saving results in xunit format
Chris Matthews [Tue, 2 Dec 2014 22:19:21 +0000 (22:19 +0000)]
Give lit a --xunit-xml-output option for saving results in xunit format

  --xunit-xml-output saves test results to disk in JUnit's xml format. This will allow Jenkins to report the details of a lit run.

  Based on a patch by David Chisnall.

llvm-svn: 223163

9 years agoDiagnose TypoExprs in a couple of error cases in ParsePostfixExpressionSuffix.
Kaelyn Takata [Tue, 2 Dec 2014 22:05:35 +0000 (22:05 +0000)]
Diagnose TypoExprs in a couple of error cases in ParsePostfixExpressionSuffix.

Also have CorrectDelayedTyposInExpr check that the Expr* isn't null
before trying to access its members. Fixes PR21679.

llvm-svn: 223162

9 years ago[PowerPC] Implement readcyclecounter for PPC32
Hal Finkel [Tue, 2 Dec 2014 22:01:00 +0000 (22:01 +0000)]
[PowerPC] Implement readcyclecounter for PPC32

We've long supported readcyclecounter on PPC64, but it is easier there (the
read of the 64-bit time-base register can be accomplished via a single
instruction). This now provides an implementation for PPC32 as well. On PPC32,
the time-base register is still 64 bits, but can only be read 32 bits at a time
via two separate SPRs. The ISA manual explains how to do this properly (it
involves re-reading the upper bits and looping if the counter has wrapped while
being read).

This requires PPC to implement a custom integer splitting legalization for the
READCYCLECOUNTER node, turning it into a target-specific SDAG node, which then
gets turned into a pseudo-instruction, which is then expanded to the necessary
sequence (which has three SPR reads, the comparison and the branch).

Thanks to Paul Hargrove for pointing out to me that this was still unimplemented.

llvm-svn: 223161

9 years agoR600/SI: Emit amd_kernel_code_t header for AMDGPU environment
Tom Stellard [Tue, 2 Dec 2014 22:00:07 +0000 (22:00 +0000)]
R600/SI: Emit amd_kernel_code_t header for AMDGPU environment

llvm-svn: 223160

9 years agoMake sure that the TargetOptions operator== is checking the
Eric Christopher [Tue, 2 Dec 2014 21:57:15 +0000 (21:57 +0000)]
Make sure that the TargetOptions operator== is checking the
full contents of the class.

llvm-svn: 223159

9 years agoAdd missing #include to fix Android build.
Alexey Samsonov [Tue, 2 Dec 2014 21:40:41 +0000 (21:40 +0000)]
Add missing #include to fix Android build.

llvm-svn: 223157

9 years ago[AArch64][Stackmaps] Optimize stackmap shadows on AArch64.
Lang Hames [Tue, 2 Dec 2014 21:36:24 +0000 (21:36 +0000)]
[AArch64][Stackmaps] Optimize stackmap shadows on AArch64.

Reduce the number of nops emitted for stackmap shadows on AArch64 by counting
non-stackmap instructions up to the next branch target towards the requested
shadow.

<rdar://problem/14959522>

llvm-svn: 223156

9 years agoFix broken test suite on Windows after r223091.
Zachary Turner [Tue, 2 Dec 2014 21:32:44 +0000 (21:32 +0000)]
Fix broken test suite on Windows after r223091.

Differential Revision: http://reviews.llvm.org/D6484
Reviewed by: Oleksiy Vyalov

llvm-svn: 223155

9 years agoR600/SI: Move more information into SIProgramInfo struct
Tom Stellard [Tue, 2 Dec 2014 21:28:53 +0000 (21:28 +0000)]
R600/SI: Move more information into SIProgramInfo struct

llvm-svn: 223154

9 years agoAdd bindings for the rest of the MCJIT options that we previously
Eric Christopher [Tue, 2 Dec 2014 21:09:01 +0000 (21:09 +0000)]
Add bindings for the rest of the MCJIT options that we previously
had support for. We're still missing a binding for an MCJIT
memory manager.

llvm-svn: 223153