platform/upstream/llvm.git
9 years agoUpdate for llvm api change.
Rafael Espindola [Sat, 13 Jun 2015 12:50:13 +0000 (12:50 +0000)]
Update for llvm api change.

llvm-svn: 239671

9 years agoUpdate for llvm api change.
Rafael Espindola [Sat, 13 Jun 2015 12:50:07 +0000 (12:50 +0000)]
Update for llvm api change.

llvm-svn: 239670

9 years agoBring in a BumpPtrStringSaver from lld and simplify the interface.
Rafael Espindola [Sat, 13 Jun 2015 12:49:52 +0000 (12:49 +0000)]
Bring in a BumpPtrStringSaver from lld and simplify the interface.

StringSaver now always saves to a BumpPtrAllocator.

The only reason for having the virtual saveImpl is so lld can have a
thread safe version.

The reason for the distinct BumpPtrStringSaver class is to avoid the
virtual destructor.

llvm-svn: 239669

9 years agoCleanup result_of tests and fix issues with the C++03 result_of.
Eric Fiselier [Sat, 13 Jun 2015 08:25:24 +0000 (08:25 +0000)]
Cleanup result_of tests and fix issues with the C++03 result_of.

The two main fixes this patch contains are:
- use __identity_t instead of common_type. common_type was used as an
  identity metafunction but the decay resulted in incorrect results.
- Pointers to free functions were not counted as functions. Remove the pointer
  before checking if a type is a function.

llvm-svn: 239668

9 years agoRemove warnings about old CMake options
Eric Fiselier [Sat, 13 Jun 2015 07:31:55 +0000 (07:31 +0000)]
Remove warnings about old CMake options

llvm-svn: 239667

9 years agoFix PR12999 - unordered_set::insert calls operator new when no insert occurs
Eric Fiselier [Sat, 13 Jun 2015 07:18:32 +0000 (07:18 +0000)]
Fix PR12999 -  unordered_set::insert calls operator new when no insert occurs

Summary:
when `unordered_set::insert(value_type&&)` was called it would be treated like `unordered_set::emplace(Args&&)` and it would allocate and construct a node before trying to insert it.
This caused unnecessary allocations when the value was already in the set. This patch adds an overload to `__hash_table::__insert_unique` that specifically handles `value_type&&` more link `value_type const &`.

This patch also adds a single unified insert function for values into  `__hash_table` called `__insert_unique_value` that handles the cases for `__insert_unique(value_type&&)` and `__insert_unique(value_type const &)`.

This patch fixes PR12999: http://llvm.org/bugs/show_bug.cgi?id=12999.

Reviewers: mclow.lists, titus, danalbert

Reviewed By: danalbert

Subscribers: cfe-commits

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

llvm-svn: 239666

9 years agoAdd `-verify-ignore-unexpected` option to ignore unexpected diagnostics in VerifyDiag...
Eric Fiselier [Sat, 13 Jun 2015 07:11:40 +0000 (07:11 +0000)]
Add `-verify-ignore-unexpected` option to ignore unexpected diagnostics in VerifyDiagnosticsConsumer

Summary:
The goal of this patch is to make `-verify` easier to use when testing libc++. The `notes` attached to compile error diagnostics are numerous and relatively unstable when they reference libc++ header internals. This patch allows libc++ to write stable compilation failure tests by allowing unexpected diagnostic messages to be ignored where they are not relevant.

This patch adds a new CC1 flag called `-verify-ignore-unexpected`. `-verify-ignore-unexpected` tells `VerifyDiagnosticsConsumer` to ignore *all* unexpected diagnostic messages. `-verify-ignore-unexpected=<LevelList>` can be used to only ignore certain diagnostic levels. `<LevelList>` is a comma separated list of diagnostic levels to ignore. The supported levels are `note`, `remark`, `warning` and `error`.

Reviewers: bogner, grosser, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 239665

9 years ago[libcxx] Fix detection of __is_final.
Eric Fiselier [Sat, 13 Jun 2015 07:08:02 +0000 (07:08 +0000)]
[libcxx] Fix detection of __is_final.

Summary: Currently we only enable the use of __is_final(...) with Clang. GCC also provides __is_final(...) since 4.7 in all standard modes. This patch creates the macro _LIBCPP_HAS_IS_FINAL to note the availability of `__is_final`.

Reviewers: danalbert, mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 239664

9 years ago[LIT] Fix failing LIT tests
Eric Fiselier [Sat, 13 Jun 2015 06:55:44 +0000 (06:55 +0000)]
[LIT] Fix failing LIT tests

Summary:
I spend some time trying to get the LIT test suite passing. Here are the changes that I needed to make on my machine.

I made the following changes for the following reasons.

1. google-test.py: The Google test format now checks for "[  PASSED  ] 1 test." to check if a test passes.
2. discovery.py: The output appears in a different order on my machine than it did in the test.
3. unittest-adaptor.py: The output appears in a different order on my machine than it did in the test.
4. The classname is now formed differently in `getJUnitXML(...)`.

I'm not sure what is causing the output order to differ in discovery.py and unittest-adaptor.py. Does anybody have any thoughts?

Reviewers: ddunbar, danalbert, jroelofs

Reviewed By: jroelofs

Subscribers: llvm-commits

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

llvm-svn: 239663

9 years ago[libcxx] Use __decltype instead of __typeof__
Eric Fiselier [Sat, 13 Jun 2015 06:27:17 +0000 (06:27 +0000)]
[libcxx] Use __decltype instead of __typeof__

Summary:
Both clang and GCC provide C++11 decltype semantics as __decltype in c++03 mode. We should use this instead of __typeof__ when availble.

GCC added __decltype in 4.6.0, and AFAIK clang provided __decltype ever since 3.3. Unfortunately `__has_builtin(__decltype)` doesn't work for clang so we need to check the compiler version instead.

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 239662

9 years agoAMDGPU: s/R600/AMDGPU/ in the Makefiles
Tom Stellard [Sat, 13 Jun 2015 05:11:14 +0000 (05:11 +0000)]
AMDGPU: s/R600/AMDGPU/ in the Makefiles

Now the library names in the Makefiles match the library names in
LLVMBuild.txt.

This should hopefully fix the remaining bot failures.

llvm-svn: 239661

9 years agoconfigure: Remove non-portable fall-through operator: ;&
Tom Stellard [Sat, 13 Jun 2015 03:46:48 +0000 (03:46 +0000)]
configure: Remove non-portable fall-through operator: ;&

This was added in r239657.

llvm-svn: 239660

9 years agoRename TargetSubtargetInfo::enablePostMachineScheduler() to enablePostRAScheduler()
Matthias Braun [Sat, 13 Jun 2015 03:42:16 +0000 (03:42 +0000)]
Rename TargetSubtargetInfo::enablePostMachineScheduler() to enablePostRAScheduler()

r213101 changed the behaviour of this method to not only affect the
PostMachineScheduler scheduler but also the PostRAScheduler scheduler,
renaming should make this fact clear. Also document that the preferred
way is to specify this in the scheduling model instead of overriding
this method.

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

llvm-svn: 239659

9 years agoMachineLICM: Use TargetSchedModel instead of just itineraries
Matthias Braun [Sat, 13 Jun 2015 03:42:11 +0000 (03:42 +0000)]
MachineLICM: Use TargetSchedModel instead of just itineraries

This will use Itinieraries if available, but will also work if just a
MCSchedModel is available.

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

llvm-svn: 239658

9 years agoR600 -> AMDGPU rename
Tom Stellard [Sat, 13 Jun 2015 03:28:10 +0000 (03:28 +0000)]
R600 -> AMDGPU rename

llvm-svn: 239657

9 years agoRevert r239213: "clang-cl: Implement /GL in terms of -flto."
Hans Wennborg [Sat, 13 Jun 2015 02:53:50 +0000 (02:53 +0000)]
Revert r239213: "clang-cl: Implement /GL in terms of -flto."

Reverting until it's easier to use this in a real-world build, e.g.
when the linker can handle it.

llvm-svn: 239656

9 years agoMake __void_t unary and always provide it.
Eric Fiselier [Sat, 13 Jun 2015 02:36:07 +0000 (02:36 +0000)]
Make __void_t unary and always provide it.

llvm-svn: 239655

9 years agoLWG2442: call_once() shouldn't DECAY_COPY(). Patch from K-Ballo.
Eric Fiselier [Sat, 13 Jun 2015 02:23:00 +0000 (02:23 +0000)]
LWG2442: call_once() shouldn't DECAY_COPY(). Patch from K-Ballo.

This patch fixes LWG issue 2422 by removing the DECAY_COPY from call once.
The review can be found here: http://reviews.llvm.org/D10191

llvm-svn: 239654

9 years agoEnable __is_trivially* intrinsics for GCC 5.1
Eric Fiselier [Sat, 13 Jun 2015 02:18:44 +0000 (02:18 +0000)]
Enable __is_trivially* intrinsics for GCC 5.1

Until GCC 5.1 the __is_trivially* intrinsics were not provided. Enable use of
the builtins for GCC 5.1.

Also enable Reference qualified member functions for GCC 4.9 and greater.

This patch also defines _GNUC_VER to 0 when __GNUC__ is not defined because
libc++ assumes _GNUC_VER is always defined.

llvm-svn: 239653

9 years agodocs: grammar adjustments in clang manpage
Saleem Abdulrasool [Sat, 13 Jun 2015 01:21:58 +0000 (01:21 +0000)]
docs: grammar adjustments in clang manpage

Fix a few typos and run-on sentences in the clang POD documentation.

Patch by Brian R. Gaeke!

llvm-svn: 239652

9 years ago[CodeGen] Don't evaluate immediate inlineasm arguments using isICE().
Ahmed Bougacha [Sat, 13 Jun 2015 01:16:10 +0000 (01:16 +0000)]
[CodeGen] Don't evaluate immediate inlineasm arguments using isICE().

Instead, just EvaluateAsInt().

Follow-up to r239549: rsmith points out that isICE() is expensive;
seems like it's not the right concept anyway, as it fails on
`static const' in C, and will actually trigger the assert below on:
    test/Sema/inline-asm-validate-x86.c

llvm-svn: 239651

9 years agoRevert 239644.
Matt Wala [Sat, 13 Jun 2015 01:08:00 +0000 (01:08 +0000)]
Revert 239644.

llvm-svn: 239650

9 years agoRefactor is_member_function_pointer to use is_function and not __member_function_traits.
Eric Fiselier [Sat, 13 Jun 2015 00:33:13 +0000 (00:33 +0000)]
Refactor is_member_function_pointer to use is_function and not __member_function_traits.

Replacing the dependancy on __member_function_traits with is_function allows
is_member_function_pointer to work more often. In particular it allows it to
work when we don't have variadic templates but the function has an arity > 3.

llvm-svn: 239649

9 years agoPrevent dependancy on libatomic when using GCC to provide <atomic>.
Eric Fiselier [Sat, 13 Jun 2015 00:23:07 +0000 (00:23 +0000)]
Prevent dependancy on libatomic when using GCC to provide <atomic>.

The __atomic_is_lock_free(...) function sometimes requires linkage to libatomic
if it cannot be evaluated at compile time. Remove __c11_atomic_is_lock_free
and use __atomic_is_lock_free(sizeof(Tp)) directly so that it can be evaluated
at compile time.

llvm-svn: 239648

9 years agoAArch64: map bare-metal arm64-macho triple to MachO MC layer.
Tim Northover [Fri, 12 Jun 2015 23:37:11 +0000 (23:37 +0000)]
AArch64: map bare-metal arm64-macho triple to MachO MC layer.

Far better than an assertion about expecting ELF.

llvm-svn: 239647

9 years agoFix returning error message in LLVMLinkModules
Eli Bendersky [Fri, 12 Jun 2015 23:26:42 +0000 (23:26 +0000)]
Fix returning error message in LLVMLinkModules

On error, the temporary output stream wouldn't be flushed and therefore the
caller would see an empty error message.

Patch by Antoine Pitrou

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

llvm-svn: 239646

9 years ago[Orc] Tidy up initialization based on review feedback for r239561 from dblaikie.
Lang Hames [Fri, 12 Jun 2015 23:13:06 +0000 (23:13 +0000)]
[Orc] Tidy up initialization based on review feedback for r239561 from dblaikie.

NFC.

llvm-svn: 239645

9 years ago[Scalarizer] Fix potential for stale data in Scattered across invocations
Matt Wala [Fri, 12 Jun 2015 22:49:11 +0000 (22:49 +0000)]
[Scalarizer] Fix potential for stale data in Scattered across invocations

Summary:
Scalarizer has two data structures that hold information about changes
to the function, Gathered and Scattered. These are cleared in finish()
at the end of runOnFunction() if finish() detects any changes to the
function.

However, finish() was checking for changes by only checking if
Gathered was non-empty. The function visitStore() only modifies
Scattered without touching Gathered. As a result, Scattered could have
ended up having stale data if Scalarizer only scalarized store
instructions. Since the data in Scattered is used during the execution
of the pass, this introduced dangling pointer errors.

The fix is to check whether both Scattered and Gathered are empty
before deciding what to do in finish().

Reviewers: srhines

Reviewed By: srhines

Subscribers: llvm-commits

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

llvm-svn: 239644

9 years ago[CodeGen] Use IRBuilder to create llvm.lifetime intrinsics.
Alexey Samsonov [Fri, 12 Jun 2015 22:31:32 +0000 (22:31 +0000)]
[CodeGen] Use IRBuilder to create llvm.lifetime intrinsics.

Summary:
In addition to easier syntax, IRBuilder makes sure to set correct
debug locations for newly added instructions (bitcast and
llvm.lifetime itself). This restores the original behavior, which
was modified by r234581 (reapplied as r235553).

Extend one of the tests to check for debug locations.

Test Plan: regression test suite

Reviewers: aadg, dblaikie

Subscribers: cfe-commits, majnemer

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

llvm-svn: 239643

9 years ago[Orc] Tidy up the CompileOnDemand layer based on commit review from dblaikie.
Lang Hames [Fri, 12 Jun 2015 22:22:50 +0000 (22:22 +0000)]
[Orc] Tidy up the CompileOnDemand layer based on commit review from dblaikie.

NFC.

llvm-svn: 239642

9 years ago[COFF] Spell the namespace correctly.
Davide Italiano [Fri, 12 Jun 2015 21:37:55 +0000 (21:37 +0000)]
[COFF] Spell the namespace correctly.

llvm-svn: 239641

9 years ago[Orc] Fix a bug in the CompileOnDemand layer where stub decls were not cloned
Lang Hames [Fri, 12 Jun 2015 21:31:15 +0000 (21:31 +0000)]
[Orc] Fix a bug in the CompileOnDemand layer where stub decls were not cloned
into partitions. Also, add an option to clone stub definitions (not just decls)
into partitions: these definitions could be inlined in some places to avoid the
overhead of calling via the stub.

Found by inspection - no test case yet, although I plan to add a unit test for
this once the CompileOnDemand layer refactoring settles down.

llvm-svn: 239640

9 years ago[ms] Don't try to delay lookup for failures in SFINAE context (PR23823)
Hans Wennborg [Fri, 12 Jun 2015 21:23:23 +0000 (21:23 +0000)]
[ms] Don't try to delay lookup for failures in SFINAE context (PR23823)

The underlying problem in PR23823 already existed before my recent change
in r239558, but that change made it worse (failing not only for undeclared
symbols, but also failed overload resolution). This makes Clang not try to
delay the lookup in SFINAE context. I assume no current code is relying on
SFINAE working with lookups that need to be delayed, because that never
seems to have worked.

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

llvm-svn: 239639

9 years ago[CGCall] Fix potential invalid iterator decrement in findDominatingStoreToReturnValue.
Alexey Samsonov [Fri, 12 Jun 2015 21:05:32 +0000 (21:05 +0000)]
[CGCall] Fix potential invalid iterator decrement in findDominatingStoreToReturnValue.

If llvm.lifetime.end turns out to be the first instruction in the last
basic block, we can decrement the iterator twice, going past rend.
At the moment, this can never happen because llvm.lifetime.end always
goes immediately after bitcast, but relying on this is very brittle.

llvm-svn: 239638

9 years agoR600/SI: Add assembler support for FLAT instructions
Tom Stellard [Fri, 12 Jun 2015 20:47:06 +0000 (20:47 +0000)]
R600/SI: Add assembler support for FLAT instructions

- Add glc, slc, and tfe operands to flat instructions
- Add missing flat instructions
- Fix the encoding of flat_load_dwordx3 and flat_store_dwordx3.

llvm-svn: 239637

9 years agoRangify several for loops in ValueEnumerator constructor.
Yaron Keren [Fri, 12 Jun 2015 20:18:20 +0000 (20:18 +0000)]
Rangify several for loops in ValueEnumerator constructor.

llvm-svn: 239636

9 years agoQuote the user provided string in the warning message and update
Eric Christopher [Fri, 12 Jun 2015 20:13:50 +0000 (20:13 +0000)]
Quote the user provided string in the warning message and update
tests accordingly.

llvm-svn: 239635

9 years ago[Hexagon] Making intrinsic tests agnostic to register allocation. Narrowing intrinsi...
Colin LeMahieu [Fri, 12 Jun 2015 19:57:32 +0000 (19:57 +0000)]
[Hexagon] Making intrinsic tests agnostic to register allocation.  Narrowing intrinsic parameters to appropriate width.

llvm-svn: 239634

9 years agoDriver: only set -mlinker-version based on host if it's valid
Tim Northover [Fri, 12 Jun 2015 19:21:35 +0000 (19:21 +0000)]
Driver: only set -mlinker-version based on host if it's valid

We were adding an extra "-mlinker-version" argument to the invocation
based on a value inferred from "ld -v". This is set by the build
systems to either a sane value or an empty string (e.g. for custom
built ld), which we don't want to pass on.

No test really possible because the value depends on both host system
and how CMake was invoked.

llvm-svn: 239633

9 years agoWrap some long lines in LLVMBuild files. NFC
Douglas Katzman [Fri, 12 Jun 2015 18:44:57 +0000 (18:44 +0000)]
Wrap some long lines in LLVMBuild files. NFC

As suggested by jroelofs in a prior review (D9752),
it makes sense to generally prefer multi-line format.

llvm-svn: 239632

9 years agoAdd 'shave' processor name to Triple
Douglas Katzman [Fri, 12 Jun 2015 18:31:38 +0000 (18:31 +0000)]
Add 'shave' processor name to Triple

Based on ArchType, Clang's driver can select a non-Clang compiler.
String parsing in Clang would have sufficed if it were only that,
however this change anticipates true llvm support.

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

llvm-svn: 239631

9 years ago[builtins] Hide long double fp_test.h helpers if it's not fp128.
Ahmed Bougacha [Fri, 12 Jun 2015 18:28:47 +0000 (18:28 +0000)]
[builtins] Hide long double fp_test.h helpers if it's not fp128.

Like we do for the various __*tf* tests, check that long double is the
128bit type we expect directly in the header. The latter is now used by
unrelated tests (__*hf* since r237161), and those tests will break for
no reason if uint128_t doesn't exist, and long double isn't fp128.

llvm-svn: 239630

9 years agoRefix a use of explicit pointer types in GEP constant folding
David Blaikie [Fri, 12 Jun 2015 18:22:03 +0000 (18:22 +0000)]
Refix a use of explicit pointer types in GEP constant folding

In the glorious future of opaque pointer types, it won't be possible to
retrieve the pointee type of a pointer type which is what's being done
in this GEP loop - but the first iteration is always a pointer type and
the loop doesn't care about that case, except whether or not the index
is a constant.

So pull that special case out before the loop and start at the second
iteration (index 1) instead.

Originally committed in r236670 and reverted with a test case in
r239015. This change keeps the test case working while also avoiding
depending on pointee types.

llvm-svn: 239629

9 years agoFix a typo in a comment in MemCpyOpt (test commit)
Matt Wala [Fri, 12 Jun 2015 18:16:51 +0000 (18:16 +0000)]
Fix a typo in a comment in MemCpyOpt (test commit)

llvm-svn: 239628

9 years agoRangify two for loops in BitcodeReader.cpp.
Yaron Keren [Fri, 12 Jun 2015 18:13:20 +0000 (18:13 +0000)]
Rangify two for loops in BitcodeReader.cpp.

llvm-svn: 239627

9 years agoRemove unnecessary MCExpr.h include from MCSymbol.h
Pete Cooper [Fri, 12 Jun 2015 18:07:34 +0000 (18:07 +0000)]
Remove unnecessary MCExpr.h include from MCSymbol.h

MCSymbol.h already forwards declares MCExpr and only uses MCExpr* so doesn't
need to include the header.

llvm-svn: 239626

9 years ago[MS ABI] Lock-in the derived memptr rep. for base-to-derived conversions
David Majnemer [Fri, 12 Jun 2015 17:55:44 +0000 (17:55 +0000)]
[MS ABI] Lock-in the derived memptr rep. for base-to-derived conversions

We would get this right in the case where an explicit cast was formed
but not when we were performing an implicit conversion.

This fixes PR23828.

llvm-svn: 239625

9 years agoRemove a bunch of inline keywords from User. NFC.
Pete Cooper [Fri, 12 Jun 2015 17:48:21 +0000 (17:48 +0000)]
Remove a bunch of inline keywords from User.  NFC.

This came up in the patch review for http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150608/281362.html.

llvm-svn: 239624

9 years agoMove OperandList to be allocated prior to User for hung off subclasses.
Pete Cooper [Fri, 12 Jun 2015 17:48:18 +0000 (17:48 +0000)]
Move OperandList to be allocated prior to User for hung off subclasses.

For hung off uses, we need a Use* to tell use where the operands are.
This was User::OperandList but we want to remove that to save space
of all subclasses which aren't making use of 'hung off uses'.

Hung off uses now allocate their own 'OperandList' Use* in the
User::new which they call.

getOperandList() now uses the hung off uses bit to work out where the
Use* for the OperandList lives.  If a User has hung off uses, then this
bit tells them to go back a single Use* from the User* and use that
value as the OperandList.

If a User has no hung off uses, then we get the first operand by
subtracting (NumOperands * sizeof(Use)) from the User this pointer.

This saves a pointer from User and all subclasses.  Given the average
size of a subclass of User is 112 or 128 bytes, this saves around 7% of space
With malloc tending to align to 16-bytes the real saving is typically more like 3.5%.

On 'opt -O2 verify-uselistorder.lto.bc', peak memory usage prior to this change
is 149MB and after is 143MB so the savings are around 2.5% of peak.

Looking at some passes which allocate many Instructions and Values, parseIR drops
from 54.25MB to 52.21MB while the Inliner calls to Instruction::clone() drops
from 28.20MB to 27.05MB.

Reviewed by Duncan Exon Smith.

llvm-svn: 239623

9 years agoAdded a version of User::new for hung off uses.
Pete Cooper [Fri, 12 Jun 2015 17:48:14 +0000 (17:48 +0000)]
Added a version of User::new for hung off uses.

There are now 2 versions of User::new.  The first takes a size_t and is the current
implementation for subclasses which need 0 or more Use's allocated for their operands.

The new version takes no extra arguments to say that this subclass needs 'hung off uses'.
The HungOffUses bool is now set in this version of User::new and we can assert in
allocHungOffUses that we are allowed to have hung off uses.
This ensures we call the correct version of User::new for subclasses which need hung off uses.

A future commit will then allocate space for a single Use* which will be used
in place of User::OperandList once that field has been removed.

Reviewed by Duncan Exon Smith.

llvm-svn: 239622

9 years agoRename NumOperands to make it clear its managed by the User. NFC.
Pete Cooper [Fri, 12 Jun 2015 17:48:10 +0000 (17:48 +0000)]
Rename NumOperands to make it clear its managed by the User. NFC.

This is to try make it very clear that subclasses shouldn't be changing
the value directly.  Now that OperandList for normal instructions is computed
using the NumOperands, its critical that the NumOperands is accurate or we
could compute the wrong offset to the first operand.

I looked over all places which update NumOperands and they are all safe.
Hung off use User's don't use NumOperands to compute the OperandList so they
are safe to continue to manipulate it.  The only other User which changed it
was GlobalVariable which has an optional init list but always allocated space
for a single Use.  It was correctly setting NumOperands to 1 before setting an
initializer, and setting it to 0 after clearing the init list, so the order was safe.

Added some comments to that code to make sure that this isn't changed in future
without being aware of this constraint.

Reviewed by Duncan Exon Smith.

llvm-svn: 239621

9 years agoReplace all accesses to User::OperandList with getter and setter methods. NFC.
Pete Cooper [Fri, 12 Jun 2015 17:48:05 +0000 (17:48 +0000)]
Replace all accesses to User::OperandList with getter and setter methods. NFC.

We don't want anyone to access OperandList directly as its going to be removed
and computed instead.  This uses getter's and setter's instead in which we
can later change the underlying implementation of OperandList.

Reviewed by Duncan Exon Smith.

llvm-svn: 239620

9 years agoAllow case-insensitive values for -mcpu for AArch64 target in line with GCC.
Gabor Ballabas [Fri, 12 Jun 2015 17:33:37 +0000 (17:33 +0000)]
Allow case-insensitive values for -mcpu for AArch64 target in line with GCC.

GCC allows case-insensitive values for -mcpu, -march and -mtune options.
This patch implements the same behaviour for the -mcpu option for the AArch64 target.

llvm-svn: 239619

9 years agoHave the ELF symbol predicates match more directly the spec.
Rafael Espindola [Fri, 12 Jun 2015 17:23:39 +0000 (17:23 +0000)]
Have the ELF symbol predicates match more directly the spec.

The underlaying issues is that this code can't really know if an OS specific or
processor specific section number should return true or false.

One option would be to assert or return an error, but that looks like over
engineering since extensions are not that common.

It seems better to have these be direct implementation of the ELF spec so that
they are natural for someone familiar with ELF reading the code.

Code that does have to handle OS/Architecture specific values can do it at
a higher level.

llvm-svn: 239618

9 years agoUse Clang version numbers for the Windows VERSIONINFO resource.
Greg Bedwell [Fri, 12 Jun 2015 16:33:38 +0000 (16:33 +0000)]
Use Clang version numbers for the Windows VERSIONINFO resource.

When setting the VERSIONINFO resource to embed version information into exe and
DLL files on Windows, override the default LLVM version number values with their
clang equivalents.

llvm-svn: 239617

9 years agoDon't create instructions from ConstantExpr's in CFLAliasAnalysis.
Pete Cooper [Fri, 12 Jun 2015 16:13:54 +0000 (16:13 +0000)]
Don't create instructions from ConstantExpr's in CFLAliasAnalysis.

The CFLAA code currently calls ConstantExpr::getAsInstruction which creates an instruction from a constant expr.

We then pass that instruction to the InstVisitor to analyze it.

Its not necessary to create these instructions as we can just cast from Constant to Operator in the visitor.  This is how other InstVisitor’s such as SelectionDAGBuilder handle ConstantExpr.

llvm-svn: 239616

9 years ago[Mips] Handle TLS relocations in -static linking mode
Simon Atanasyan [Fri, 12 Jun 2015 16:13:14 +0000 (16:13 +0000)]
[Mips] Handle TLS relocations in -static linking mode

llvm-svn: 239615

9 years ago[Mips] Define _gpxxx symbols in both static/dynamic linking modes
Simon Atanasyan [Fri, 12 Jun 2015 16:13:00 +0000 (16:13 +0000)]
[Mips] Define _gpxxx symbols in both static/dynamic linking modes

llvm-svn: 239614

9 years ago[Mips] Setup EI_ABIVERSION flag
Simon Atanasyan [Fri, 12 Jun 2015 16:12:50 +0000 (16:12 +0000)]
[Mips] Setup EI_ABIVERSION flag

- Set EI_ABIVERSION to '1' in case of non-PIC executable.
- Set EI_ABIVERSION to '3' in case of using FP64/FP64A floating point ABI.

llvm-svn: 239613

9 years agoIn MSVC builds embed a VERSIONINFO resource in our exe and DLL files.
Greg Bedwell [Fri, 12 Jun 2015 15:58:29 +0000 (15:58 +0000)]
In MSVC builds embed a VERSIONINFO resource in our exe and DLL files.

This reinstates my commits r238740/r238741 which I reverted due to a failure
in the clang-cl selfhost tests on Windows.  I've now fixed the issue in
clang-cl that caused the failure so hopefully all should be well now.

llvm-svn: 239612

9 years agoThis patch makes the NEON intrinsics vget_lane_f16, vgetq_lane_f16,
Luke Cheeseman [Fri, 12 Jun 2015 15:52:39 +0000 (15:52 +0000)]
This patch makes the NEON intrinsics vget_lane_f16, vgetq_lane_f16,
vset_lane_f16 and vsetq_lane_f16 available in AArch32.

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

llvm-svn: 239610

9 years agoscan-build: Remove useless whitespace in File path
Sylvestre Ledru [Fri, 12 Jun 2015 15:50:27 +0000 (15:50 +0000)]
scan-build: Remove useless whitespace in File path
Patch by Honggyu Kim

Summary:
This patch removes useless whitespace in File path in index.html
Previously, a File directory path is copied and pasted as below:
  arch /arm /kernel /stacktrace.c

It just removes the whitespace between directories and makes the
copied string as below:
  arch/arm/kernel/stacktrace.c

The output looks same in html format, but the copied directory path
can be pasted as it looks.

Reviewers: krememek, zaks.anna, sylvestre.ledru

Reviewed By: sylvestre.ledru

Subscribers: aemerson, cfe-commits

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

llvm-svn: 239609

9 years agoAllow ToolChain to decide if Clang is not the right C compiler.
Douglas Katzman [Fri, 12 Jun 2015 15:45:21 +0000 (15:45 +0000)]
Allow ToolChain to decide if Clang is not the right C compiler.

Removed comment in Driver::ShouldUseClangCompiler implying that there
was an opt-out ability at that point - there isn't.

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

llvm-svn: 239608

9 years agopush_back() loop -> append() for random access iterators.
Benjamin Kramer [Fri, 12 Jun 2015 15:31:50 +0000 (15:31 +0000)]
push_back() loop -> append() for random access iterators.

append will resize the vector to the optimal size. No functional change
intended.

llvm-svn: 239607

9 years ago[clang-format] Use in-class initializers to simplify constructor.
Benjamin Kramer [Fri, 12 Jun 2015 14:39:08 +0000 (14:39 +0000)]
[clang-format] Use in-class initializers to simplify constructor.

Sadly C++11 doesn't let us use initializers on bitfield members (DR1341). NFC.

llvm-svn: 239606

9 years ago[clang-format] Reorder and pack ParenState members to minimize padding
Benjamin Kramer [Fri, 12 Jun 2015 13:07:03 +0000 (13:07 +0000)]
[clang-format] Reorder and pack ParenState members to minimize padding

sizeof(ParenState) goes from 64 bytes to 52 bytes. NFC.

llvm-svn: 239605

9 years ago[clang-format] Hoist vector allocation out of loop. NFC.
Benjamin Kramer [Fri, 12 Jun 2015 13:06:57 +0000 (13:06 +0000)]
[clang-format] Hoist vector allocation out of loop. NFC.

llvm-svn: 239604

9 years agoRemove a hack that tries to align '*'.
Rafael Espindola [Fri, 12 Jun 2015 12:42:13 +0000 (12:42 +0000)]
Remove a hack that tries to align '*'.

The alignment is not required, so we can just remove it for now.

The old code is a hack as it depends on the buffer management to find
the current column.

If the alignment is really desirable, the proper way to do it is
to pass in a formatted_raw_stream that knows the current column.

llvm-svn: 239603

9 years agoDon't depend on the interleaving of stdout and stderr.
Rafael Espindola [Fri, 12 Jun 2015 12:20:03 +0000 (12:20 +0000)]
Don't depend on the interleaving of stdout and stderr.

That can change as we change the buffering.

llvm-svn: 239602

9 years ago[ASan] format AddressSanitizer.cpp with `clang-format -style=Google`, NFC
Alexander Potapenko [Fri, 12 Jun 2015 11:27:06 +0000 (11:27 +0000)]
[ASan] format AddressSanitizer.cpp with `clang-format -style=Google`, NFC

llvm-svn: 239601

9 years agoclang-format: Always add space before lambda-{
Daniel Jasper [Fri, 12 Jun 2015 09:59:16 +0000 (09:59 +0000)]
clang-format: Always add space before lambda-{

Before:
  int c = []() -> int *{ return 2; }();

After:
  int c = []() -> int * { return 2; }();

Based on patch by James Dennett (http://reviews.llvm.org/D10410), thank you!

llvm-svn: 239600

9 years ago[ARM] Disabling vfp4 should disable fp16
John Brawn [Fri, 12 Jun 2015 09:38:51 +0000 (09:38 +0000)]
[ARM] Disabling vfp4 should disable fp16

ARMTargetParser::getFPUFeatures should disable fp16 whenever it
disables vfp4, as otherwise something like -mcpu=cortex-a7 -mfpu=none
leaves us with fp16 enabled (though the only effect that will have is
a wrong build attribute).

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

llvm-svn: 239599

9 years agoReplace duplicated iplist<T> types with the corresponding typedefs.
Yaron Keren [Fri, 12 Jun 2015 08:19:32 +0000 (08:19 +0000)]
Replace duplicated iplist<T> types with the corresponding typedefs.

llvm-svn: 239598

9 years agoclang-format: Understand C-style case in case label.
Daniel Jasper [Fri, 12 Jun 2015 07:15:33 +0000 (07:15 +0000)]
clang-format: Understand C-style case in case label.

Before:
  case (my_int) ONE:

After:
  case (my_int)ONE:

This fixed llvm.org/PR23760

llvm-svn: 239597

9 years agoRangify for loops, NFC.
Yaron Keren [Fri, 12 Jun 2015 05:15:27 +0000 (05:15 +0000)]
Rangify for loops, NFC.

llvm-svn: 239596

9 years agoclang-format: [JS] Support "export enum" declarations.
Daniel Jasper [Fri, 12 Jun 2015 05:08:18 +0000 (05:08 +0000)]
clang-format: [JS] Support "export enum" declarations.

llvm-svn: 239595

9 years agoclang-format: [JS] Add tests to ensure clang-format doesn't break code
Daniel Jasper [Fri, 12 Jun 2015 04:58:27 +0000 (04:58 +0000)]
clang-format: [JS] Add tests to ensure clang-format doesn't break code
by triggering automatic semicolon insertion changes.

NFC intended. Patch by Martin Probst.

llvm-svn: 239594

9 years agoclang-format: [JS] Fix regression caused by r239592.
Daniel Jasper [Fri, 12 Jun 2015 04:56:34 +0000 (04:56 +0000)]
clang-format: [JS] Fix regression caused by r239592.

Without it, it would do:

  interface I {
    x: string;
  } var y;

llvm-svn: 239593

9 years agoclang-format: [JS] fix incorrectly collapsed lines after export
Daniel Jasper [Fri, 12 Jun 2015 04:52:02 +0000 (04:52 +0000)]
clang-format: [JS] fix incorrectly collapsed lines after export
statement.

When an exported function would follow a class declaration, it would not
be recognized as a stand-alone function. That would then collapse the
following line with the current one, e.g.

  class C {}
  export function f() {} var x;

llvm-svn: 239592

9 years agoWrap to 80 columns. No behavior change.
Nico Weber [Fri, 12 Jun 2015 04:44:52 +0000 (04:44 +0000)]
Wrap to 80 columns. No behavior change.

llvm-svn: 239591

9 years agoLowerBitSets: Give names to aliases of unnamed bitset element objects.
Peter Collingbourne [Fri, 12 Jun 2015 03:25:05 +0000 (03:25 +0000)]
LowerBitSets: Give names to aliases of unnamed bitset element objects.

It is valid for globals to be unnamed, but aliases must have a name. To avoid
creating invalid IR, we need to assign names to any aliases we create that
point to unnamed objects that have been moved into combined globals.

llvm-svn: 239590

9 years agoRevert commit r239480 as it causes https://code.google.com/p/chromium/issues/detail...
Teresa Johnson [Fri, 12 Jun 2015 03:12:00 +0000 (03:12 +0000)]
Revert commit r239480 as it causes https://code.google.com/p/chromium/issues/detail?id=499508#c3.

llvm-svn: 239589

9 years agoRevert commit r239481 as it is dependent on reverted llvm commit r239480.
Teresa Johnson [Fri, 12 Jun 2015 03:11:50 +0000 (03:11 +0000)]
Revert commit r239481 as it is dependent on reverted llvm commit r239480.

llvm-svn: 239588

9 years agoAdd missing #include, found by modules build.
Richard Smith [Fri, 12 Jun 2015 02:13:45 +0000 (02:13 +0000)]
Add missing #include, found by modules build.

llvm-svn: 239587

9 years ago[SanitizerCoverage] Use llvm::getDISubprogram() to get location of the entry basic...
Alexey Samsonov [Fri, 12 Jun 2015 01:48:47 +0000 (01:48 +0000)]
[SanitizerCoverage] Use llvm::getDISubprogram() to get location of the entry basic block.

DebugLoc::getFnDebugLoc() should soon be removed. Also,
getDISubprogram() might become more effective soon and wouldn't need to
scan debug locations at all, if function-level metadata would be emitted
by Clang.

llvm-svn: 239586

9 years ago[GVN] Use a simpler form of IRBuilder constructor.
Alexey Samsonov [Fri, 12 Jun 2015 01:39:48 +0000 (01:39 +0000)]
[GVN] Use a simpler form of IRBuilder constructor.

Summary:
A side effect of this change is that it IRBuilder now automatically
created debug info locations for new instructions, which is the
same as debug location of insertion point. This is fine for the
functions in questions (GetStoreValueForLoad and
GetMemInstValueForLoad), as they are used in two situations:
  * GVN::processLoad, which tries to eliminate a load. In this case
    new instructions would have the same debug location as the load they
    eventually replace;
  * MaterializeAdjustedValue, which adds new instructions to the end
    of the basic blocks, which could later be used to replace the load
    definition. In this case we don't yet know the way the load would
    be eventually replaced (either by assembling the precomputed values
    via PHI, or by using them directly), so just using the basic block
    strategy seems to be reasonable. There is also a special case
    in the code that *would* adjust the location of the last
    instruction replacing the load definition to the location of the
    load.

Test Plan: regression test suite

Reviewers: echristo, dberlin, dblaikie

Subscribers: llvm-commits

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

llvm-svn: 239585

9 years ago[GVN] Use IRBuilder more actively instead of creating instructions manually.
Alexey Samsonov [Fri, 12 Jun 2015 01:39:45 +0000 (01:39 +0000)]
[GVN] Use IRBuilder more actively instead of creating instructions manually.

llvm-svn: 239584

9 years agoAdd a warning for unsupported elements of the target attribute.
Eric Christopher [Fri, 12 Jun 2015 01:36:05 +0000 (01:36 +0000)]
Add a warning for unsupported elements of the target attribute.

Since we're ignoring the tune= and fpmath= attributes go ahead
and add a warning alerting people to the fact that we're going
to ignore that part of it during code generation and tie it to
the attribute warning set.

llvm-svn: 239583

9 years agoHandle fpmath= in the target attribute.
Eric Christopher [Fri, 12 Jun 2015 01:36:00 +0000 (01:36 +0000)]
Handle fpmath= in the target attribute.

Right now we're ignoring the fpmath attribute since there's no
backend support for a feature like this and to do so would require
checking the validity of the strings and doing general subtarget
feature parsing of valid and invalid features with the target
attribute feature.

llvm-svn: 239582

9 years agoHandle -mno-<feature> in target attribute strings by replacing the
Eric Christopher [Fri, 12 Jun 2015 01:35:58 +0000 (01:35 +0000)]
Handle -mno-<feature> in target attribute strings by replacing the
-mno- with a -<feature> to match how we handle this in the rest
of the frontend.

llvm-svn: 239581

9 years agoAdd support for tune= to the target attribute support by ignoring it.
Eric Christopher [Fri, 12 Jun 2015 01:35:56 +0000 (01:35 +0000)]
Add support for tune= to the target attribute support by ignoring it.

We don't currently support the -mtune option in any useful way
so ignoring the annotation is fine.

llvm-svn: 239580

9 years agoAdd support for the the target attribute.
Eric Christopher [Fri, 12 Jun 2015 01:35:52 +0000 (01:35 +0000)]
Add support for the the target attribute.

Modeled after the gcc attribute of the same name, this feature
allows source level annotations to correspond to backend code
generation. In llvm particular parlance, this allows the adding
of subtarget features and changing the cpu for a particular function
based on source level hints.

This has been added into the existing support for function level
attributes without particular verification for any target outside
of whether or not the backend will support the features/cpu given
(similar to section, etc).

llvm-svn: 239579

9 years ago[modules] Apply name visibility rules to names found by ADL.
Richard Smith [Fri, 12 Jun 2015 01:32:13 +0000 (01:32 +0000)]
[modules] Apply name visibility rules to names found by ADL.

llvm-svn: 239578

9 years agoFix PR23293 - Do not unlock shared state before notifying consumers.
Eric Fiselier [Fri, 12 Jun 2015 00:41:34 +0000 (00:41 +0000)]
Fix PR23293 - Do not unlock shared state before notifying consumers.

Within the shared state methods do not unlock the lock guards manually. This
could cause a race condition where the shared state is destroyed before the
method is complete.

llvm-svn: 239577

9 years ago[IRGen] Fix the MSVC2013 build
David Majnemer [Fri, 12 Jun 2015 00:17:26 +0000 (00:17 +0000)]
[IRGen] Fix the MSVC2013 build

llvm-svn: 239576

9 years ago[modules] Fix crash with multiple levels of default template argument merging.
Richard Smith [Thu, 11 Jun 2015 23:46:11 +0000 (23:46 +0000)]
[modules] Fix crash with multiple levels of default template argument merging.

llvm-svn: 239575

9 years ago[WinEH] Put finally pointers in the handler scope table field
Reid Kleckner [Thu, 11 Jun 2015 23:37:18 +0000 (23:37 +0000)]
[WinEH] Put finally pointers in the handler scope table field

We were putting them in the filter field, which is correct for 64-bit
but wrong for 32-bit.

Also switch the order of scope table entry emission so outermost entries
are emitted first, and fix an obvious state assignment bug.

llvm-svn: 239574

9 years ago[cleanup] Remove some unused #ifdef's
Sean Silva [Thu, 11 Jun 2015 23:34:13 +0000 (23:34 +0000)]
[cleanup] Remove some unused #ifdef's

This is all going through the VFS layer now, so there's nothing
platform-specific here.

llvm-svn: 239573

9 years agoAdd assume_safety option for pragma loop vectorize and interleave.
Tyler Nowicki [Thu, 11 Jun 2015 23:23:17 +0000 (23:23 +0000)]
Add assume_safety option for pragma loop vectorize and interleave.

Specifying #pragma clang loop vectorize(assume_safety) on a loop adds the
mem.parallel_loop_access metadata to each load/store operation in the loop. This
metadata tells loop access analysis (LAA) to skip memory dependency checking.

llvm-svn: 239572

9 years agoMC: Prune \return corresponding to r239552. [-Wdocumentation]
NAKAMURA Takumi [Thu, 11 Jun 2015 23:04:56 +0000 (23:04 +0000)]
MC: Prune \return corresponding to r239552. [-Wdocumentation]

llvm-svn: 239571