platform/upstream/llvm.git
9 years agoRevert r225085, it caused PR22096.
Nico Weber [Wed, 7 Jan 2015 18:23:08 +0000 (18:23 +0000)]
Revert r225085, it caused PR22096.

PR22096 has several test cases that assert that look fairly different. I'm
adding one of those as an automated test, but when relanding the other cases
should probably be checked as well.

llvm-svn: 225361

9 years agoX86: Allow the stack probe size to be configurable per function
David Majnemer [Wed, 7 Jan 2015 18:14:07 +0000 (18:14 +0000)]
X86: Allow the stack probe size to be configurable per function

LLVM emits stack probes on Windows targets to ensure that the stack is
correctly accessed.  However, the amount of stack allocated before
emitting such a probe is hardcoded to 4096.

It is desirable to have this be configurable so that a function might
opt-out of stack probes.  Our level of granularity is at the function
level instead of, say, the module level to permit proper generation of
code after LTO.

Patch by Andrew H!

N.B.  The inliner needs to be updated to properly consider what happens
after inlining a function with a specific stack-probe-size into another
function with a different stack-probe-size.

llvm-svn: 225360

9 years agoDebug info: pass in the correct size for a pointer to a member function.
Adrian Prantl [Wed, 7 Jan 2015 17:49:30 +0000 (17:49 +0000)]
Debug info: pass in the correct size for a pointer to a member function.
This corrects a bug I introduced in r224781.

llvm-svn: 225359

9 years agoR600/SI: Refactor SIFoldOperands to simplify immediate folding
Tom Stellard [Wed, 7 Jan 2015 17:42:16 +0000 (17:42 +0000)]
R600/SI: Refactor SIFoldOperands to simplify immediate folding

This will make a future patch much less intrusive.

llvm-svn: 225358

9 years ago[X86] Teach FCOPYSIGN lowering to recognize constant magnitudes.
Ahmed Bougacha [Wed, 7 Jan 2015 17:33:03 +0000 (17:33 +0000)]
[X86] Teach FCOPYSIGN lowering to recognize constant magnitudes.

For code like:
    float foo(float x) { return copysign(1.0, x); }
We used to generate:
    andps  <-0.000000e+00,0,0,0>, %xmm0
    movss  <1.000000e+00>, %xmm1
    andps  <nan>, %xmm1
    orps   %xmm0, %xmm1
Basically doing an abs(1.0f) in the two middle instructions.

We now generate:
    andps  <-0.000000e+00,0,0,0>, %xmm0
    orps   <1.000000e+00,0,0,0>, %xmm0

Builds on cleanups r223415, r223542.
rdar://19049548
Differential Revision: http://reviews.llvm.org/D6555

llvm-svn: 225357

9 years agoImprovements to emacs packages for llvm and tablegen mode.
Rafael Espindola [Wed, 7 Jan 2015 15:52:51 +0000 (15:52 +0000)]
Improvements to emacs packages for llvm and tablegen mode.

* Both files have valid package headers and footers (you can verify
with M-x checkdoc).
* Fixed style warnings generated by checkdoc.
* Fixed a byte-compiler warning in llvm-mode.el.
* Ensure that the modes are autoloaded, so users do not need to
(require 'llvm-mode) to use them.

Patch by Wilfred Hughes.

llvm-svn: 225356

9 years agoReverting r225319; since there is a folder named Examples, attempting to add a target...
Aaron Ballman [Wed, 7 Jan 2015 14:47:12 +0000 (14:47 +0000)]
Reverting r225319; since there is a folder named Examples, attempting to add a target of the same name causes problems for IDEs like Visual Studio.

llvm-svn: 225355

9 years agoManually specify the folder that Kaleidescope should reside in for CMake-produced...
Aaron Ballman [Wed, 7 Jan 2015 14:26:07 +0000 (14:26 +0000)]
Manually specify the folder that Kaleidescope should reside in for CMake-produced solutions that care about such things (like MSVC). This takes the Kaleidescope target out of the root solution folder and places it into the Examples folder where it belongs.

llvm-svn: 225354

9 years agoManually specify the folder that llvm-ranlib should reside in for CMake-produced...
Aaron Ballman [Wed, 7 Jan 2015 14:19:15 +0000 (14:19 +0000)]
Manually specify the folder that llvm-ranlib should reside in for CMake-produced solutions that care about such things (like MSVC). This takes llvm-ranlib out of the root solution folder and places it into the Tools folder where it belongs.

llvm-svn: 225353

9 years agoclang-format: Understand single-line comments at the end of blocks.
Daniel Jasper [Wed, 7 Jan 2015 14:00:11 +0000 (14:00 +0000)]
clang-format: Understand single-line comments at the end of blocks.

This prevents clang-format from moving/aligning the comment in the
snippet:
  void f() {
    int i; // some comment
    // some unrelated comment
  }

llvm-svn: 225352

9 years agoNew method SDep::isNormalMemoryOrBarrier() in ScheduleDAGInstrs.cpp.
Jonas Paulsson [Wed, 7 Jan 2015 13:38:29 +0000 (13:38 +0000)]
New method SDep::isNormalMemoryOrBarrier() in ScheduleDAGInstrs.cpp.

Used to iterate over previously added memory dependencies in
adjustChainDeps() and iterateChainSucc().

SDep::isCtrl() was previously used in these places, that also gave
anti and output edges. The code may be worse if these are followed,
because MisNeedChainEdge() will conservatively return true since a
non-memory instruction has no memory operands, and a false chain dep
will be added. It is also unnecessary since all memory accesses of
interest will be reached by memory dependencies, and there is a budget
limit for the number of edges traversed.

This problem was found on an out-of-tree target with enabled alias
analysis. No test case for an in-tree target has been found.

Reviewed by Hal Finkel.

llvm-svn: 225351

9 years agoFix typos in comment and option help texts.
Jonas Paulsson [Wed, 7 Jan 2015 13:20:57 +0000 (13:20 +0000)]
Fix typos in comment and option help texts.

For -enable-aa-sched-mi and -use-tbaa-in-sched-mi.

llvm-svn: 225350

9 years agoclang-format: Fix unary operator detection.
Daniel Jasper [Wed, 7 Jan 2015 12:19:53 +0000 (12:19 +0000)]
clang-format: Fix unary operator detection.

Before:
  ** outparam = 1;

After:
  **outparam = 1;

llvm-svn: 225349

9 years ago[ARM] Add missing Tag_DIV_use tests.
Charlie Turner [Wed, 7 Jan 2015 11:37:40 +0000 (11:37 +0000)]
[ARM] Add missing Tag_DIV_use tests.

llvm-svn: 225348

9 years agoFix regression in r225266.
Asiri Rathnayake [Wed, 7 Jan 2015 11:22:58 +0000 (11:22 +0000)]
Fix regression in r225266.

The change in r225266 was reviewed under D6722. But the commit r225266 has a
typo, causing some MCHammer failures. This patch fixes it.

Change-Id: I573efcff25003af7478ac02548ebbe929fc7f5fd
llvm-svn: 225347

9 years ago[PM] Give slightly less horrible names to the utility pass templates for
Chandler Carruth [Wed, 7 Jan 2015 11:14:51 +0000 (11:14 +0000)]
[PM] Give slightly less horrible names to the utility pass templates for
requiring and invalidating specific analyses. Also make their printed
names match their class names. Writing these out as prose really doesn't
make sense to me any more.

llvm-svn: 225346

9 years ago[X86] Merge a switch statement inside a default case of another switch statement...
Craig Topper [Wed, 7 Jan 2015 08:10:38 +0000 (08:10 +0000)]
[X86] Merge a switch statement inside a default case of another switch statement on the same variable. There was no additional code in the default so this should be no functional change.

llvm-svn: 225345

9 years ago[X86] Don't mark the shift by 1 instructions as isConvertibleToThreeAddress. There...
Craig Topper [Wed, 7 Jan 2015 08:10:36 +0000 (08:10 +0000)]
[X86] Don't mark the shift by 1 instructions as isConvertibleToThreeAddress. There is no handling for them.

llvm-svn: 225344

9 years ago[X86] Remove some unused TYPE enums from the disassembler.
Craig Topper [Wed, 7 Jan 2015 07:47:52 +0000 (07:47 +0000)]
[X86] Remove some unused TYPE enums from the disassembler.

llvm-svn: 225343

9 years agoUse explicit StringRef Type
Tobias Grosser [Wed, 7 Jan 2015 07:43:34 +0000 (07:43 +0000)]
Use explicit StringRef Type

We previously used a Twine here, but as pointed out by David Blaikie
and Mehdi Amini storing a temporary StringRef in a Twine is not a good
idea, as the StringRef will be freed before the Twine is used leaving
a Twine that points to uninitialized memory. We now make it explicit that
we use a StringRef here.

llvm-svn: 225342

9 years agoRevert r225165 and r225169
Karthik Bhat [Wed, 7 Jan 2015 06:34:34 +0000 (06:34 +0000)]
Revert r225165 and r225169
Even thouh gcc produces simialr instructions as Owen pointed out the two patterns aren’t equivalent in the case
where the original subtraction could have caused an overflow.
Reverting the same.

llvm-svn: 225341

9 years agoFix comment typo.
Nico Weber [Wed, 7 Jan 2015 05:25:05 +0000 (05:25 +0000)]
Fix comment typo.

llvm-svn: 225340

9 years agoPE/COFF: teach ARMNT backend about ADDR32NB for exports
Saleem Abdulrasool [Wed, 7 Jan 2015 04:20:26 +0000 (04:20 +0000)]
PE/COFF: teach ARMNT backend about ADDR32NB for exports

This adds the ability to export symbols from a DLL built for ARMNT.  Add this
support first to help work towards adding support for import thunks on Windows
on ARM.  In order to generate the exports, add support for
IMAGE_REL_ARM_ADDR32NB relocations.

llvm-svn: 225339

9 years ago[ADT][SmallVector] Flip an assert comparison to avoid overflows yielding false-negati...
Ahmed Bougacha [Wed, 7 Jan 2015 02:42:01 +0000 (02:42 +0000)]
[ADT][SmallVector] Flip an assert comparison to avoid overflows yielding false-negatives. NFC.

r221973 changed SmallVector::operator[] to use size_t instead of unsigned.

Before that, on 64bit platforms, when a large index (say -1) was passed,
truncating it to unsigned avoided an overflow when computing 'begin() + idx',
and failed the range checking assertion, as expected.
With r221973, idx isn't truncated, so the addition wraps to
'(char*)begin() - 1', and doesn't fire anymore when it should have done so.

This commit changes the comparison to instead compute 'end() - begin()'
(i.e., 'size()'), which avoids potentially overflowing additions, and
correctly triggers the assertion when values such as -1 are passed.
Note that the problem already existed before that revision, on platforms
where sizeof(size_t) == sizeof(unsigned).

llvm-svn: 225338

9 years ago[asan] add flag quarantine_size_mb, deprecate quarantine_size
Kostya Serebryany [Wed, 7 Jan 2015 02:37:52 +0000 (02:37 +0000)]
[asan] add flag quarantine_size_mb, deprecate quarantine_size

llvm-svn: 225337

9 years ago[TSan] Fix Go build.
Alexey Samsonov [Wed, 7 Jan 2015 02:12:41 +0000 (02:12 +0000)]
[TSan] Fix Go build.

llvm-svn: 225336

9 years agoIR: Remove MDNode::getWhenValsUnresolved()
Duncan P. N. Exon Smith [Wed, 7 Jan 2015 02:10:42 +0000 (02:10 +0000)]
IR: Remove MDNode::getWhenValsUnresolved()

Remove dead code.  Use `MDNode::get()` instead.

llvm-svn: 225335

9 years agoRemove invalid TODO
Duncan P. N. Exon Smith [Wed, 7 Jan 2015 02:09:51 +0000 (02:09 +0000)]
Remove invalid TODO

We can't drop support for RAUW entirely in `MDNode`s, since it's
required for graph construction.  This comment was from before I'd done
the math on that (out-of-tree), and never should have been committed.

llvm-svn: 225334

9 years ago[PM] Fix a pretty nasty bug where the new pass manager would invalidate
Chandler Carruth [Wed, 7 Jan 2015 01:58:35 +0000 (01:58 +0000)]
[PM] Fix a pretty nasty bug where the new pass manager would invalidate
passes too many time.

I think this is actually the issue that someone raised with me at the
developer's meeting and in an email, but that we never really got to the
bottom of. Having all the testing utilities made it much easier to dig
down and uncover the core issue.

When a pass manager is running many passes over a single function, we
need it to invalidate the analyses between each run so that they can be
re-computed as needed. We also need to track the intersection of
preserved higher-level analyses across all the passes that we run (for
example, if there is one module analysis which all the function analyses
preserve, we want to track that and propagate it). Unfortunately, this
interacted poorly with any enclosing pass adaptor between two IR units.
It would see the intersection of preserved analyses, and need to
invalidate any other analyses, but some of the un-preserved analyses
might have already been invalidated *and recomputed*! We would fail to
propagate the fact that the analysis had already been invalidated.

The solution to this struck me as really strange at first, but the more
I thought about it, the more natural it seemed. After a nice discussion
with Duncan about it on IRC, it seemed even nicer. The idea is that
invalidating an analysis *causes* it to be preserved! Preserving the
lack of result is trivial. If it is recomputed, great. Until something
*else* invalidates it again, we're good.

The consequence of this is that the invalidate methods on the analysis
manager which operate over many passes now consume their
PreservedAnalyses object, update it to "preserve" every analysis pass to
which it delivers an invalidation (regardless of whether the pass
chooses to be removed, or handles the invalidation itself by updating
itself). Then we return this augmented set from the invalidate routine,
letting the pass manager take the result and use the intersection of
*that* across each pass run to compute the final preserved set. This
accounts for all the places where the early invalidation of an analysis
has already "preserved" it for a future run.

I've beefed up the testing and adjusted the assertions to show that we
no longer repeatedly invalidate or compute the analyses across nested
pass managers.

llvm-svn: 225333

9 years agoMake DynamicLoaderPOSIXDYLD::DidAttach to deduce a target executable by pid if no...
Oleksiy Vyalov [Wed, 7 Jan 2015 01:28:37 +0000 (01:28 +0000)]
Make DynamicLoaderPOSIXDYLD::DidAttach to deduce a target executable by pid if no executable hasn't been assigned to a target so far.

http://reviews.llvm.org/D6740

llvm-svn: 225332

9 years agoR600/SI: Add check for amdgcn triple forgotten in r225276.
Tom Stellard [Wed, 7 Jan 2015 01:17:37 +0000 (01:17 +0000)]
R600/SI: Add check for amdgcn triple forgotten in r225276.

llvm-svn: 225331

9 years ago[ELF] Remove {ELF,}GNULinkerScript.
Rui Ueyama [Wed, 7 Jan 2015 01:13:08 +0000 (01:13 +0000)]
[ELF] Remove {ELF,}GNULinkerScript.

Instead of representing a linker script file as an "InputElement",
parse and evaluate scripts in the driver as we see them.

Linker scripts are not regular input files (regular file is one of
object, archive, or shared library file). They are more like
extended command line options. Linker script handling was needlessly
complicated because of that inappropriate abstraction (besides
excessive class hierarchy -- there is no such thing like ELF linker
script but we had two classes there for some reason.)

LinkerScript was one of a few remaining InputElement subclasses
that can be expanded to multiple files. With this patch, we are one
step closer to retire InputElement.

http://reviews.llvm.org/D6648

llvm-svn: 225330

9 years agoAnalysis: Reformulate WillNotOverflowUnsignedAdd for reusability
David Majnemer [Wed, 7 Jan 2015 00:39:50 +0000 (00:39 +0000)]
Analysis: Reformulate WillNotOverflowUnsignedAdd for reusability

WillNotOverflowUnsignedAdd's smarts will live in ValueTracking as
computeOverflowForUnsignedAdd.  It now returns a tri-state result:
never overflows, always overflows and sometimes overflows.

llvm-svn: 225329

9 years agoInstCombine: Just a small tidy-up
David Majnemer [Wed, 7 Jan 2015 00:39:42 +0000 (00:39 +0000)]
InstCombine: Just a small tidy-up

llvm-svn: 225328

9 years ago[Sanitizer] Change the runtime flag representation.
Alexey Samsonov [Wed, 7 Jan 2015 00:38:00 +0000 (00:38 +0000)]
[Sanitizer] Change the runtime flag representation.

This mirrors r225239 to all the rest sanitizers:
ASan, DFSan, LSan, MSan, TSan, UBSan.

Now the runtime flag type, name, default value and
description is located in the single place in the
.inc file.

llvm-svn: 225327

9 years agoDo not use a const Twine here
Tobias Grosser [Wed, 7 Jan 2015 00:30:01 +0000 (00:30 +0000)]
Do not use a const Twine here

This has caused segfaults when using Polly in the context of Julia, that are
not reproducible on my machine in 'make check-polly'.

llvm-svn: 225326

9 years ago[PowerPC] Transform a README.txt entry into a FIXME
Hal Finkel [Wed, 7 Jan 2015 00:15:29 +0000 (00:15 +0000)]
[PowerPC] Transform a README.txt entry into a FIXME

Remove the README.txt entry regarding register allocation of CR logical ops,
and replace it with a FIXME in PPCInstrInfo.td. The text in the README.txt was
not really accurate, and thanks goes to Pat Haugen (and Bill Schmidt) from IBM
for clarifying what was intended and highlighting the relevant text in the ISA
specification.

llvm-svn: 225325

9 years agoFix grammar-o in comment.
Nico Weber [Tue, 6 Jan 2015 23:54:59 +0000 (23:54 +0000)]
Fix grammar-o in comment.

llvm-svn: 225324

9 years ago[asan] add a flag soft_rss_limit_mb
Kostya Serebryany [Tue, 6 Jan 2015 23:53:32 +0000 (23:53 +0000)]
[asan] add a flag soft_rss_limit_mb

llvm-svn: 225323

9 years agoSuppress clang warnings in a codegen test.
Rafael Espindola [Tue, 6 Jan 2015 23:53:13 +0000 (23:53 +0000)]
Suppress clang warnings in a codegen test.

This makes the output of FileCheck way easier to read since this test hits
many warnings.

llvm-svn: 225322

9 years agocmake: Fix 'examples' target after r225319
Duncan P. N. Exon Smith [Tue, 6 Jan 2015 23:52:35 +0000 (23:52 +0000)]
cmake: Fix 'examples' target after r225319

Add the missing `DEPENDS` keyword.  r225319 did almost the right thing
(I didn't notice the problem with it because `Kaleidoscope-Ch8` wasn't
building at all).

llvm-svn: 225321

9 years agoKaleidoscope: Value => Metadata
Duncan P. N. Exon Smith [Tue, 6 Jan 2015 23:48:22 +0000 (23:48 +0000)]
Kaleidoscope: Value => Metadata

llvm-svn: 225320

9 years agocmake: Add 'examples' target
Duncan P. N. Exon Smith [Tue, 6 Jan 2015 23:42:49 +0000 (23:42 +0000)]
cmake: Add 'examples' target

llvm-svn: 225319

9 years agocmake: Add Kaleidoscope target
Duncan P. N. Exon Smith [Tue, 6 Jan 2015 23:39:37 +0000 (23:39 +0000)]
cmake: Add Kaleidoscope target

llvm-svn: 225318

9 years agoAdds UriParser::Parse and unit tests
Vince Harron [Tue, 6 Jan 2015 23:38:24 +0000 (23:38 +0000)]
Adds UriParser::Parse and unit tests

This can be used to parse URIs passed to 'platform connect'

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

llvm-svn: 225317

9 years agoFix needed for the new terminal test I previously checked in. It was crashing due...
Greg Clayton [Tue, 6 Jan 2015 23:33:34 +0000 (23:33 +0000)]
Fix needed for the new terminal test I previously checked in. It was crashing due to a NULL dereference.

llvm-svn: 225316

9 years agoAdd a subdirectory in CMake for Chapter 8.
Eric Christopher [Tue, 6 Jan 2015 23:23:24 +0000 (23:23 +0000)]
Add a subdirectory in CMake for Chapter 8.

llvm-svn: 225315

9 years agoAdd __builtin_amdgpu_class
Matt Arsenault [Tue, 6 Jan 2015 23:14:57 +0000 (23:14 +0000)]
Add __builtin_amdgpu_class

llvm-svn: 225314

9 years agoConvert CoreInputGraph.
Rui Ueyama [Tue, 6 Jan 2015 23:06:49 +0000 (23:06 +0000)]
Convert CoreInputGraph.

This is a part of InputGraph cleanup to represent input files as a flat
list of Files (and some meta-nodes for group etc.)

We cannot achieve that goal in one gigantic patch, so I split the task
into small steps as shown below.

(Recap the progress so far: Currently InputGraph contains a list of
InputElements. Each InputElement contain one File (that used to have
multiple Files, but I eliminated that use case in r223867). Files are
currently instantiated in Driver::link(), but I already made a change
to separate file parsing from object instantiation (r224102), so we
can safely instantiate Files when we need them, instead of wrapping
a file with the wrapper class (FileNode class). InputGraph used to
act like a generator class by interpreting groups by itself, but it's
now just a container of a list of InputElements (r223867).)

1. Instantiate Files in the driver and wrap them with WrapperNode.
WrapperNode is a temporary class that allows us to instantiate Files
in the driver while keep using the current InputGraph data structure.

This patch demonstrates how this step 1 looks like, using Core driver
as an example.

2. Do the same thing for the other drivers.

When step 2 is done, an InputGraph consists of GroupEnd objects or
WrapperNodes each of which contains one File. Other types of
FileNode subclasses are removed.

3. Replace InputGraph with std::vector<std::unique_ptr<InputElement>>.
InputGraph is already just a container of list of InputElements,
so this step removes that needless class.

4. Remove WrapperNode.

We need some code cleanup between each step, because many classes
do a bit odd things (e.g. InputGraph::getGroupSize()). I'll straight
things up as I need to.

llvm-svn: 225313

9 years ago[PowerPC] Add support for -mcmpb
Hal Finkel [Tue, 6 Jan 2015 23:06:41 +0000 (23:06 +0000)]
[PowerPC] Add support for -mcmpb

In r225106, support for the CMPB instruction was added to the PowerPC backend.
This adds the associated GCC-compatible feature flag.

llvm-svn: 225312

9 years agoRevert r224935 "Refactor duplicated code. No intended functionality change."
Lang Hames [Tue, 6 Jan 2015 23:04:36 +0000 (23:04 +0000)]
Revert r224935 "Refactor duplicated code. No intended functionality change."

This is affecting the behavior of some ObjC++ / AArch64 test cases on Darwin.
Reverting to get the bots green while I track down the source of the changed
behavior.

llvm-svn: 225311

9 years agoR600/SI: Add combine for isinfinite pattern
Matt Arsenault [Tue, 6 Jan 2015 23:00:46 +0000 (23:00 +0000)]
R600/SI: Add combine for isinfinite pattern

llvm-svn: 225310

9 years agoAdd isNegative helper to ConstantFPSDNode
Matt Arsenault [Tue, 6 Jan 2015 23:00:44 +0000 (23:00 +0000)]
Add isNegative helper to ConstantFPSDNode

llvm-svn: 225309

9 years agoAdd isInfinity helper to ConstantFPSDNode
Matt Arsenault [Tue, 6 Jan 2015 23:00:43 +0000 (23:00 +0000)]
Add isInfinity helper to ConstantFPSDNode

llvm-svn: 225308

9 years agoR600/SI: Pattern match isinf to v_cmp_class instructions
Matt Arsenault [Tue, 6 Jan 2015 23:00:41 +0000 (23:00 +0000)]
R600/SI: Pattern match isinf to v_cmp_class instructions

llvm-svn: 225307

9 years agoR600/SI: Add basic DAG combines for fp_class
Matt Arsenault [Tue, 6 Jan 2015 23:00:39 +0000 (23:00 +0000)]
R600/SI: Add basic DAG combines for fp_class

llvm-svn: 225306

9 years agoR600/SI: Add class intrinsic
Matt Arsenault [Tue, 6 Jan 2015 23:00:37 +0000 (23:00 +0000)]
R600/SI: Add class intrinsic

llvm-svn: 225305

9 years agoFix using wrong intrinsic in test
Matt Arsenault [Tue, 6 Jan 2015 23:00:33 +0000 (23:00 +0000)]
Fix using wrong intrinsic in test

This is a leftover from renaming the intrinsic.
It's surprising the unknown llvm. intrinsic wasn't rejected.

llvm-svn: 225304

9 years agoUpdate for .ll syntax change.
Rafael Espindola [Tue, 6 Jan 2015 22:55:40 +0000 (22:55 +0000)]
Update for .ll syntax change.

llvm-svn: 225303

9 years agoChange the .ll syntax for comdats and add a syntactic sugar.
Rafael Espindola [Tue, 6 Jan 2015 22:55:16 +0000 (22:55 +0000)]
Change the .ll syntax for comdats and add a syntactic sugar.

In order to make comdats always explicit in the IR, we decided to make
the syntax a bit more compact for the case of a GlobalObject in a
comdat with the same name.

Just dropping the $name causes problems for

@foo = globabl i32 0, comdat
$bar = comdat ...

and

declare void @foo() comdat
$bar = comdat ...

So the syntax is changed to

@g1 = globabl i32 0, comdat($c1)
@g2 = globabl i32 0, comdat

and

declare void @foo() comdat($c1)
declare void @foo() comdat

llvm-svn: 225302

9 years ago[PowerPC] Reuse a load operand in int->fp conversions
Hal Finkel [Tue, 6 Jan 2015 22:31:02 +0000 (22:31 +0000)]
[PowerPC] Reuse a load operand in int->fp conversions

int->fp conversions on PPC must be done through memory loads and stores. On a
modern core, this process begins by storing the int value to memory, then
loading it using a (sometimes special) FP load instruction. Unfortunately, we
would do this even when the value to be converted was itself a load, and we can
just use that same memory location instead of copying it to another first.
There is a slight complication when handling int_to_fp(fp_to_int(x)) pairs,
because the fp_to_int operand has not been lowered when the int_to_fp is being
lowered. We handle this specially by invoking fp_to_int's lowering logic
(partially) and getting the necessary memory location (some trivial refactoring
was done to make this possible).

This is all somewhat ugly, and it would be nice if some later CodeGen stage
could just clean this stuff up, but because doing so would involve modifying
target-specific nodes (or instructions), it is not immediately clear how that
would work.

Also, remove a related entry from the README.txt for which we now generate
reasonable code.

llvm-svn: 225301

9 years agoMove a test to the new tests directory.
Dan Albert [Tue, 6 Jan 2015 22:18:27 +0000 (22:18 +0000)]
Move a test to the new tests directory.

I had written the patch that added this test before the tests were
moved into tests/std, so the test ended up in the wrong directory.

llvm-svn: 225300

9 years agoPut FreeBSD note types in their own namespace
Ed Maste [Tue, 6 Jan 2015 22:13:48 +0000 (22:13 +0000)]
Put FreeBSD note types in their own namespace

Note types are inherently OS-specific, but some note type names are
common to both FreeBSD and Linux.

llvm-svn: 225299

9 years ago[Sanitizer] Improve unit tests in COMPILER_RT_DEBUG=ON mode.
Alexey Samsonov [Tue, 6 Jan 2015 20:58:40 +0000 (20:58 +0000)]
[Sanitizer] Improve unit tests in COMPILER_RT_DEBUG=ON mode.

Propagate -DSANITIZER_DEBUG definition to unit tests.
Make sure unit tests depend on compiler-rt headers.

llvm-svn: 225298

9 years agoRemove a lock acquisition from ProcessWindows::OnExitProcess.
Zachary Turner [Tue, 6 Jan 2015 20:56:12 +0000 (20:56 +0000)]
Remove a lock acquisition from ProcessWindows::OnExitProcess.

This was causing a race condition where DoDestroy() would acquire
the lock and then initiate a shutdown and then wait for it to
complete.  But part of the shutdown involved acquiring the same
lock from a different thread.  So the main thread would timeout
waiting for the shutdown to complete and return too soon.

The end result of this is that SBProcess::Kill() was broken on
Windows.

llvm-svn: 225297

9 years agoUse amdgcn triple for SI+ GPUs
Tom Stellard [Tue, 6 Jan 2015 20:42:12 +0000 (20:42 +0000)]
Use amdgcn triple for SI+ GPUs

llvm-svn: 225296

9 years agoMake registerPollyPasses public
Tobias Grosser [Tue, 6 Jan 2015 20:40:33 +0000 (20:40 +0000)]
Make registerPollyPasses public

This function is needed for the integration of Polly into Julia.

llvm-svn: 225295

9 years agoR600: Handle amdgcn triple
Tom Stellard [Tue, 6 Jan 2015 20:34:47 +0000 (20:34 +0000)]
R600: Handle amdgcn triple

For now there is no difference between amdgcn and r600.

llvm-svn: 225294

9 years agoUse -DSANITIZER_DEBUG=1 if COMPILER_RT_DEBUG=ON, now that PR22083 is fixed.
Alexey Samsonov [Tue, 6 Jan 2015 20:25:34 +0000 (20:25 +0000)]
Use -DSANITIZER_DEBUG=1 if COMPILER_RT_DEBUG=ON, now that PR22083 is fixed.

llvm-svn: 225293

9 years agoUse a Factory Method for MachineFunctionInfo Creation
Mehdi Amini [Tue, 6 Jan 2015 20:05:02 +0000 (20:05 +0000)]
Use a Factory Method for MachineFunctionInfo Creation

The goal is to allows MachineFunctionInfo to override this create
function to customize the creation.
No change intended in existing backend in this patch.

llvm-svn: 225292

9 years ago[Hexagon] Adding compound jump encodings.
Colin LeMahieu [Tue, 6 Jan 2015 20:03:31 +0000 (20:03 +0000)]
[Hexagon] Adding compound jump encodings.

llvm-svn: 225291

9 years agoR600/SI: Insert s_waitcnt before s_barrier instructions.
Tom Stellard [Tue, 6 Jan 2015 19:52:07 +0000 (19:52 +0000)]
R600/SI: Insert s_waitcnt before s_barrier instructions.

This ensures that all memory operations are complete when all threads
reach the barrier.

llvm-svn: 225290

9 years agoR600/SI: Fix dependency calculation for DS writes instructions in SIInsertWaits
Tom Stellard [Tue, 6 Jan 2015 19:52:04 +0000 (19:52 +0000)]
R600/SI: Fix dependency calculation for DS writes instructions in SIInsertWaits

In DS write instructions, the address operand comes before the value
operand(s) which is reversed from every other instruction type.

The SIInsertWait assumed that the first use for each instruction
was the value, so for DS write it was protecting the address
operand with s_waitcnt instructions when it should have been
protecting the value operand.

llvm-svn: 225289

9 years agoRevert "Reapply: Teach SROA how to update debug info for fragmented variables."
Adrian Prantl [Tue, 6 Jan 2015 19:47:27 +0000 (19:47 +0000)]
Revert "Reapply: Teach SROA how to update debug info for fragmented variables."
because of a tsan buildbot failure.
This reverts commit 225272.

Fix should be coming soon.

llvm-svn: 225288

9 years agoMake a test UNSUPPORTED if libcpp-has-no-threads.
Dan Albert [Tue, 6 Jan 2015 19:32:30 +0000 (19:32 +0000)]
Make a test UNSUPPORTED if libcpp-has-no-threads.

llvm-svn: 225287

9 years agoAppease MSAN buildbots.
Dan Albert [Tue, 6 Jan 2015 19:23:25 +0000 (19:23 +0000)]
Appease MSAN buildbots.

This is just a compile time test, but we have MSAN buildbots that will
fail since `exp` was uninitialized.

llvm-svn: 225286

9 years agoFix PR 22106; make std::swap work for multi-dimensional arrays. Thanks to Peter Gries...
Marshall Clow [Tue, 6 Jan 2015 19:20:49 +0000 (19:20 +0000)]
Fix PR 22106; make std::swap work for multi-dimensional arrays. Thanks to Peter Griess for the report and suggested fix

llvm-svn: 225285

9 years agoAdded a test case for launching a process in a separate terminal window to ensure...
Greg Clayton [Tue, 6 Jan 2015 19:17:58 +0000 (19:17 +0000)]
Added a test case for launching a process in a separate terminal window to ensure we don't regress on this.

A recent POSIX host thread issue where HostThreadPosix::Join() wasn't returning the thread result was responsible for this regression, yet we had no test case covering this so it wasn't discovered.

llvm-svn: 225284

9 years ago[Hexagon] Adding encoding for misc v4 instructions: boundscheck, tlbmatch, dcfetch.
Colin LeMahieu [Tue, 6 Jan 2015 19:03:20 +0000 (19:03 +0000)]
[Hexagon] Adding encoding for misc v4 instructions: boundscheck, tlbmatch, dcfetch.

llvm-svn: 225283

9 years agoThis patch teaches IndVarSimplify to add nuw and nsw to certain kinds
Sanjoy Das [Tue, 6 Jan 2015 19:02:56 +0000 (19:02 +0000)]
This patch teaches IndVarSimplify to add nuw and nsw to certain kinds
of operations that provably don't overflow. For example, we can prove
%civ.inc below does not sign-overflow. With this change,
IndVarSimplify changes %civ.inc to an add nsw.

  define i32 @foo(i32* %array, i32* %length_ptr, i32 %init) {
   entry:
    %length = load i32* %length_ptr, !range !0
    %len.sub.1 = sub i32 %length, 1
    %upper = icmp slt i32 %init, %len.sub.1
    br i1 %upper, label %loop, label %exit

   loop:
    %civ = phi i32 [ %init, %entry ], [ %civ.inc, %latch ]
    %civ.inc = add i32 %civ, 1
    %cmp = icmp slt i32 %civ.inc, %length
    br i1 %cmp, label %latch, label %break

   latch:
    store i32 0, i32* %array
    %check = icmp slt i32 %civ.inc, %len.sub.1
    br i1 %check, label %loop, label %break

   break:
    ret i32 %civ.inc

   exit:
    ret i32 42
  }

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

llvm-svn: 225282

9 years ago[ubsan] disable coverage-levels.cc on darwin until we can investigate what's wrong...
Kostya Serebryany [Tue, 6 Jan 2015 18:48:49 +0000 (18:48 +0000)]
[ubsan] disable coverage-levels.cc on darwin until we can investigate what's wrong there.

llvm-svn: 225281

9 years agoObey [atomics.types.operations.req]/21 for GCC.
Dan Albert [Tue, 6 Jan 2015 18:39:37 +0000 (18:39 +0000)]
Obey [atomics.types.operations.req]/21 for GCC.

Summary:
Excerpt from [atomics.types.operations.req]/21:

> When only one memory_order argument is supplied, the value of
> success is order, and the value of failure is order except that a
> value of memory_order_acq_rel shall be replaced by the value
> memory_order_acquire and a value of memory_order_release shall be
> replaced by the value memory_order_relaxed.

Clean up some copy pasta while I'm here (someone added a return
statement to a void function).

Reviewers: EricWF, jroelofs, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 225280

9 years ago[Hexagon] Adding encoding information for absolute address loads.
Colin LeMahieu [Tue, 6 Jan 2015 18:38:26 +0000 (18:38 +0000)]
[Hexagon] Adding encoding information for absolute address loads.

llvm-svn: 225279

9 years agoSelectionDAGBuilder: move constant initialization out of loop
Mehdi Amini [Tue, 6 Jan 2015 18:20:04 +0000 (18:20 +0000)]
SelectionDAGBuilder: move constant initialization out of loop

No semantic change intended.

Reviewers: resistor

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

llvm-svn: 225278

9 years agoR600/SI: Add a stub GCNTargetMachine
Tom Stellard [Tue, 6 Jan 2015 18:00:21 +0000 (18:00 +0000)]
R600/SI: Add a stub GCNTargetMachine

This is equivalent to the AMDGPUTargetMachine now, but it is the
starting point for separating R600 and GCN functionality into separate
targets.

It is recommened that users start using the gcn triple for GCN-based
GPUs, because using the r600 triple for these GPUs will be deprecated in
the future.

llvm-svn: 225277

9 years agoTriple: Add amdgcn triple
Tom Stellard [Tue, 6 Jan 2015 18:00:00 +0000 (18:00 +0000)]
Triple: Add amdgcn triple

This will be used for AMD GPUs with the Graphics Core Next architecture,
which are currently using by the r600 triple.

llvm-svn: 225276

9 years agoR600/SI: Remove MachineFunction dump from AsmPrinter
Tom Stellard [Tue, 6 Jan 2015 17:59:56 +0000 (17:59 +0000)]
R600/SI: Remove MachineFunction dump from AsmPrinter

The dump was dependent on a feature string, which meant that it couldn't
be disabled or enable on a per compile basis.

llvm-svn: 225275

9 years ago[CodeGenPrepare] Improved logic to speculate calls to cttz/ctlz.
Andrea Di Biagio [Tue, 6 Jan 2015 17:41:18 +0000 (17:41 +0000)]
[CodeGenPrepare] Improved logic to speculate calls to cttz/ctlz.

This patch improves the logic added at revision 224899 (see review D6728) that
teaches the backend when it is profitable to speculate calls to cttz/ctlz.

The original algorithm conservatively avoided speculating more than one
instruction from a basic block in a control flow grap modelling an if-statement.
In particular, the only allowed instruction (excluding the terminator) was a
call to cttz/ctlz. However, there are cases where we could be less conservative
and still be able to speculate a call to cttz/ctlz.

With this patch, CodeGenPrepare now tries to speculate a cttz/ctlz if the
result is zero extended/truncated in the same basic block, and the zext/trunc
instruction is "free" for the target.

Added new test cases to CodeGen/X86/cttz-ctlz.ll

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

llvm-svn: 225274

9 years ago[libcxx] Set _LIBCPP_ELAST for mingw.
Dan Albert [Tue, 6 Jan 2015 17:34:51 +0000 (17:34 +0000)]
[libcxx] Set _LIBCPP_ELAST for mingw.

Reviewers: K-ballo, mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: jfb, jroelofs, majnemer, cfe-commits

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

llvm-svn: 225273

9 years agoReapply: Teach SROA how to update debug info for fragmented variables.
Adrian Prantl [Tue, 6 Jan 2015 17:14:10 +0000 (17:14 +0000)]
Reapply: Teach SROA how to update debug info for fragmented variables.
This also rolls in the changes discussed in http://reviews.llvm.org/D6766.
Defers migrating the debug info for new allocas until after all partitions
are created.

Thanks to Chandler for reviewing!

llvm-svn: 225272

9 years agoDon't loop endlessly for MachO files with 0 ncmds
Filipe Cabecinhas [Tue, 6 Jan 2015 17:08:26 +0000 (17:08 +0000)]
Don't loop endlessly for MachO files with 0 ncmds

llvm-svn: 225271

9 years ago[Hexagon] Fix 225267. GP register is not yet fully implemented. Removing Uses ...
Colin LeMahieu [Tue, 6 Jan 2015 16:52:38 +0000 (16:52 +0000)]
[Hexagon] Fix 225267.  GP register is not yet fully implemented.  Removing Uses [GP] maintains existing behavior.

llvm-svn: 225270

9 years agoImplement a very basic colored syntax highlighting for llvm-dwarfdump.
Adrian Prantl [Tue, 6 Jan 2015 16:50:25 +0000 (16:50 +0000)]
Implement a very basic colored syntax highlighting for llvm-dwarfdump.
The color scheme is the same as the one used by the colorize dwarfdump
script on Darwin.
A new --color option can be used to forcibly turn color on or off.

http://reviews.llvm.org/D6852

llvm-svn: 225269

9 years ago[PowerPC] Add a regression test for r225251
Hal Finkel [Tue, 6 Jan 2015 16:46:37 +0000 (16:46 +0000)]
[PowerPC] Add a regression test for r225251

In r225251, I removed an old entry from the README.txt file. While there are
several contributing factors (including pieces in Clang's ABI code), upon
further reflection, the backend part deserves a regression test.

llvm-svn: 225268

9 years ago[Hexagon] Adding dealloc_return encoding and absolute address stores.
Colin LeMahieu [Tue, 6 Jan 2015 16:15:15 +0000 (16:15 +0000)]
[Hexagon] Adding dealloc_return encoding and absolute address stores.

llvm-svn: 225267

9 years ago[ARM] Cleanup so_imm* tblgen defintions
Asiri Rathnayake [Tue, 6 Jan 2015 15:55:09 +0000 (15:55 +0000)]
[ARM] Cleanup so_imm* tblgen defintions

No functional changes. Support for ARM's modified immediate syntax was added
in r223113 and r223115 (review: D6408). That patch introduced the mod_imm*
tblegen definitions which renders the existing so_imm* definitions redundant.
This patch gets rid of them completely.

Reviewed as: D6722

llvm-svn: 225266

9 years agoConvert fcmp with 0.0 from casted integers to icmp
Matt Arsenault [Tue, 6 Jan 2015 15:50:59 +0000 (15:50 +0000)]
Convert fcmp with 0.0 from casted integers to icmp

This is already handled in general when it is known the
conversion can't lose bits with smaller integer types
casted into wider floating point types.

This pattern happens somewhat often in GPU programs that cast
workitem intrinsics to float, which are often compared with 0.

Specifically handle the special case of compares with zero which
should also be known to not lose information. I had a more general
version of this which allows equality compares if the casted float is
exactly representable in the integer, but I'm not 100% confident that
is always correct.

Also fold cases that aren't integers to true / false.

llvm-svn: 225265

9 years agowww: Draft changelog for the upcoming release.
Tobias Grosser [Tue, 6 Jan 2015 12:57:44 +0000 (12:57 +0000)]
www: Draft changelog for the upcoming release.

llvm-svn: 225264

9 years agoFix html
Tobias Grosser [Tue, 6 Jan 2015 12:31:31 +0000 (12:31 +0000)]
Fix html

llvm-svn: 225263

9 years agoWe currently do not create these result for polly
Tobias Grosser [Tue, 6 Jan 2015 12:30:26 +0000 (12:30 +0000)]
We currently do not create these result for polly

We should reconsider this after having switched to imath (instead of gmp)
as the default isl backend, as this would allow us to keep a copy of isl
in the polly svn and to consequently make it easier to distribute Polly.

llvm-svn: 225262