platform/upstream/llvm.git
8 years agoRemove excessive padding from PTHWriter
Alexander Shaposhnikov [Tue, 13 Sep 2016 20:17:57 +0000 (20:17 +0000)]
Remove excessive padding from PTHWriter

The class PTHWriter is in lib/Frontend/CacheTokens.cpp
inside the anonymous namespace.
This diff changes the order of fields an removes excessive padding.
Test plan: make -j8 check-clang

Differential revision: https://reviews.llvm.org/D23902

llvm-svn: 281385

8 years ago[SE] Use real HostPlatformDevice for testing
Jason Henline [Tue, 13 Sep 2016 20:14:44 +0000 (20:14 +0000)]
[SE] Use real HostPlatformDevice for testing

Summary:
Replace uses of SimpleHostPlatformDevice in tests with
HostPlatformDevice.

Reviewers: jlebar

Subscribers: jlebar, jprice, parallel_libs-commits

Differential Revision: https://reviews.llvm.org/D24519

llvm-svn: 281384

8 years ago[SemaObjC] Be more strict while parsing type arguments and protocols
Bruno Cardoso Lopes [Tue, 13 Sep 2016 20:04:35 +0000 (20:04 +0000)]
[SemaObjC] Be more strict while parsing type arguments and protocols

Fix a crash-on-invalid.

When parsing type arguments and protocols,
parseObjCTypeArgsOrProtocolQualifiers() calls ParseTypeName(), which tries to
find matching tokens for '[', '(', etc whenever they appear among potential
type names. If unmatched, ParseTypeName() yields a tok::eof token stream. This
leads to crashes since the parsing at this point is not expected to go beyond
the param list closing '>'.

Fix that by properly handling tok::eof in
parseObjCTypeArgsOrProtocolQualifiers() callers.

Differential Revision: https://reviews.llvm.org/D23852

rdar://problem/25063557

llvm-svn: 281383

8 years agoWork around MSVC 2013's inability to default move special members.
Richard Smith [Tue, 13 Sep 2016 20:00:02 +0000 (20:00 +0000)]
Work around MSVC 2013's inability to default move special members.

llvm-svn: 281382

8 years agoInline small funciton.
Rui Ueyama [Tue, 13 Sep 2016 19:56:27 +0000 (19:56 +0000)]
Inline small funciton.

llvm-svn: 281381

8 years agoFix comments.
Rui Ueyama [Tue, 13 Sep 2016 19:56:25 +0000 (19:56 +0000)]
Fix comments.

llvm-svn: 281380

8 years agoReapply "InstCombine: Reduce trunc (shl x, K) width."
Matt Arsenault [Tue, 13 Sep 2016 19:43:57 +0000 (19:43 +0000)]
Reapply "InstCombine: Reduce trunc (shl x, K) width."

This reapplies r272987 with a fix for infinitely looping
when the truncated value is another shift of a constant.

llvm-svn: 281379

8 years agoAdd bunch of _Interlocked builtins
Albert Gutowski [Tue, 13 Sep 2016 19:43:33 +0000 (19:43 +0000)]
Add bunch of _Interlocked builtins

Reviewers: compnerd, thakis, Prazek, majnemer, rnk

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D24153

llvm-svn: 281378

8 years ago[SE] Host platform implementation
Jason Henline [Tue, 13 Sep 2016 19:28:02 +0000 (19:28 +0000)]
[SE] Host platform implementation

Summary:
This implementation does not currently support multiple concurrent streams, and
it won't allow kernels to be launched with grids larger than one block or
blocks larger than one thread. These limitations could be removed in the future
by launching new threads on the host, but that is not done in this
implementation.

Reviewers: jlebar

Subscribers: beanz, mgorny, jprice, parallel_libs-commits

Differential Revision: https://reviews.llvm.org/D24473

llvm-svn: 281377

8 years agoAArch64: Cleanup tailcall CC check, enable swiftcc.
Matthias Braun [Tue, 13 Sep 2016 19:27:38 +0000 (19:27 +0000)]
AArch64: Cleanup tailcall CC check, enable swiftcc.

Cleanup/change the code that checks for possible tailcall conventions to
look the same as the one in the X86 target. This makes the distinction
between calling conventions that can guarnatee tailcalls and the ones
that may tailcall more obvious.

- Add Swift to the mayTailCall list
- PreserveMost seemed to be incorrectly part of the guarnteed tail call
  list, move it to the mayTailCall list.

llvm-svn: 281376

8 years agoAdd some MS aliases for existing intrinsics
Albert Gutowski [Tue, 13 Sep 2016 19:26:42 +0000 (19:26 +0000)]
Add some MS aliases for existing intrinsics

Reviewers: thakis, compnerd, majnemer, rsmith, rnk

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D24330

llvm-svn: 281375

8 years ago[SE] Add .clang-format
Jason Henline [Tue, 13 Sep 2016 19:25:43 +0000 (19:25 +0000)]
[SE] Add .clang-format

Summary:
The .clang-tidy file is copied from the top-level LLVM source directory.

Also fix warnings generated by clang-format:

* Moved SimpleHostPlatformDevice.h so its header include guard could
  have the right format.
* Changed signatures of methods taking llvm::Twine by value to take it
  by const ref instead.
* Add "noexcept" to some move constructors and assignment operators.
* Removed a bunch of places where single-statement loops and
  conditionals were surrounded with braces. (This was not found by the
  current clang-tidy, but with a local patch that I hope to upstream
  soon.)

Reviewers: jlebar, jprice

Subscribers: parallel_libs-commits

Differential Revision: https://reviews.llvm.org/D24468

llvm-svn: 281374

8 years ago[analyzer] Fix ExprEngine::VisitMemberExpr
Alexander Shaposhnikov [Tue, 13 Sep 2016 19:17:20 +0000 (19:17 +0000)]
[analyzer] Fix ExprEngine::VisitMemberExpr

AST may contain intermediate ParenExpr nodes
between MemberExpr and ArrayToPointerDecay.
This diff adjusts the check in ExprEngine::VisitMemberExpr accordingly.
Test plan: make -j8 check-clang-analysis

Differential revision: https://reviews.llvm.org/D24484

llvm-svn: 281373

8 years agoAMDGPU: Remove code I think is dead
Matt Arsenault [Tue, 13 Sep 2016 19:15:25 +0000 (19:15 +0000)]
AMDGPU: Remove code I think is dead

As far as I can tell, resolveFrameIndex is supposed to be
called with a legal offset, so inserting an add shouldn't be
necessary.

llvm-svn: 281372

8 years agoSwitch to 64-bit allocator on android/aarch64.
Evgeniy Stepanov [Tue, 13 Sep 2016 19:05:33 +0000 (19:05 +0000)]
Switch to 64-bit allocator on android/aarch64.

This uses the "very compact" size class mapping that fits in the
39-bit address space.

llvm-svn: 281371

8 years ago.clang-tidy: correct style name is 'camelBack' not 'lowerCase'.
Mike Aizatsky [Tue, 13 Sep 2016 19:04:26 +0000 (19:04 +0000)]
.clang-tidy: correct style name is 'camelBack' not 'lowerCase'.

Summary: clang-tidy doesn't like to complain.

Differential Revision: https://reviews.llvm.org/D24413

llvm-svn: 281370

8 years agoAMDGPU: Support commuting a FrameIndex operand
Matt Arsenault [Tue, 13 Sep 2016 19:03:12 +0000 (19:03 +0000)]
AMDGPU: Support commuting a FrameIndex operand

llvm-svn: 281369

8 years ago[LV] Clean up uniform induction variable analysis (NFC)
Matthew Simpson [Tue, 13 Sep 2016 19:01:45 +0000 (19:01 +0000)]
[LV] Clean up uniform induction variable analysis (NFC)

llvm-svn: 281368

8 years ago[clang-cl] Diagnose duplicate uuids.
Nico Weber [Tue, 13 Sep 2016 18:55:26 +0000 (18:55 +0000)]
[clang-cl] Diagnose duplicate uuids.

This mostly behaves cl.exe's behavior, even though clang-cl is stricter in some
corner cases and more lenient in others (see the included test).

To make the uuid declared previously here diagnostic work correctly, tweak
stripTypeAttributesOffDeclSpec() to keep attributes in the right order.

https://reviews.llvm.org/D24469

llvm-svn: 281367

8 years ago[LTO] Don't pass SF_Undefined symbols to the IRmover.
Davide Italiano [Tue, 13 Sep 2016 18:45:13 +0000 (18:45 +0000)]
[LTO] Don't pass SF_Undefined symbols to the IRmover.

This should fix PR 30363.

llvm-svn: 281366

8 years agoFix MSVC 2013 build by using our <thread> wrapper header
Reid Kleckner [Tue, 13 Sep 2016 18:40:04 +0000 (18:40 +0000)]
Fix MSVC 2013 build by using our <thread> wrapper header

llvm-svn: 281365

8 years ago[asan] Re-poison all redzones on activation.
Evgeniy Stepanov [Tue, 13 Sep 2016 18:38:40 +0000 (18:38 +0000)]
[asan] Re-poison all redzones on activation.

When running with start_deactivated=1 in ASAN_OPTIONS, heap redzones
are not poisoned until the first instrumented module is loaded. This
can cause false negatives even on memory allocated after activation,
because redzones are normally poisoned only once when a new allocator
region is mapped.

This change attempts to fix it by iterating over all existing
allocator chunks and poisoning their redzones.

llvm-svn: 281364

8 years agoWork around a GCC 4.7-specific issue: due to implementing older rules for
Richard Smith [Tue, 13 Sep 2016 18:35:34 +0000 (18:35 +0000)]
Work around a GCC 4.7-specific issue: due to implementing older rules for
implicit declarations of move operations, GCC 4.7 would find that SelectPiece
has neither a move constructor nor a copy constructor. The copy constructor was
(correctly) deleted because the class has a member of move-only type, and the
move constructor was (incorrectly, per current C++ rules) not provided because
the class has a copy-only base class (in turn because it explicitly declares a
destructor).

llvm-svn: 281363

8 years ago[DAGCombiner] Use APInt directly in (shl (zext (srl x, C)), C) combine range test
Simon Pilgrim [Tue, 13 Sep 2016 18:33:29 +0000 (18:33 +0000)]
[DAGCombiner] Use APInt directly in (shl (zext (srl x, C)), C) combine range test

To avoid assertion, we must ensure that the inner shift constant is within range before calling ConstantSDNode::getZExtValue(). We already know that the outer shift constant is in range.

Followup to D23007

llvm-svn: 281362

8 years agoRevert r281336 (and r281337), it caused PR30372.
Nico Weber [Tue, 13 Sep 2016 18:17:00 +0000 (18:17 +0000)]
Revert r281336 (and r281337), it caused PR30372.

llvm-svn: 281361

8 years agoSome more pointer safety in Breakpoint.
Zachary Turner [Tue, 13 Sep 2016 17:53:38 +0000 (17:53 +0000)]
Some more pointer safety in Breakpoint.

Plumb unique_ptrs<> all the way through the baton interface.
NFC, this is a minor improvement to remove the possibility of an
accidental pointer ownership issue.

Reviewed By: jingham
Differential Revision: https://reviews.llvm.org/D24495

llvm-svn: 281360

8 years ago[Myriad]: set LeonCASA processor feature
Douglas Katzman [Tue, 13 Sep 2016 17:51:41 +0000 (17:51 +0000)]
[Myriad]: set LeonCASA processor feature

llvm-svn: 281359

8 years agoObjectiveC Generics: Start using ObjCTypeParamType.
Manman Ren [Tue, 13 Sep 2016 17:41:05 +0000 (17:41 +0000)]
ObjectiveC Generics: Start using ObjCTypeParamType.

For ObjC type parameter, we used to have TypedefType that is canonicalized to
id or the bound type. We can't represent "T <protocol>" and thus will lose
the type information in the following example:
@interface MyMutableDictionary<KeyType, ObjectType> : NSObject
- (void)setObject:(ObjectType)obj forKeyedSubscript:(KeyType <NSCopying>)key;
@end
MyMutableDictionary<NSString *, NSString *> *stringsByString;
NSNumber *n1, *n2;
stringsByString[n1] = n2;
--> no warning on type mismatch of the key.

To fix the problem, we introduce a new type ObjCTypeParamType that supports
a list of protocol qualifiers.

We create ObjCTypeParamType for ObjCTypeParamDecl when we create
ObjCTypeParamDecl. We also substitute ObjCTypeParamType instead of TypedefType
on an ObjCTypeParamDecl.

rdar://24619481
rdar://25060179

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

llvm-svn: 281358

8 years agoAMDGPU: Fix target options fp32/64-denormals
Yaxun Liu [Tue, 13 Sep 2016 17:37:09 +0000 (17:37 +0000)]
AMDGPU: Fix target options fp32/64-denormals

Fix target options for fp32/64-denormals so that

+fp64-denormals is set if fp64 is supported
-fp32-denormals if fp32 denormals is not supported, or -cl-denorms-are-zero is set
+fp32-denormals if fp32 denormals is supported and -cl-denorms-are-zero is not set

If target feature fp32/64-denormals is explicitly set, they will override default options and options deduced from -cl-denorms-are-zero.

Differential Revision: https://reviews.llvm.org/D24512

llvm-svn: 281357

8 years ago[X86][SSE] Added AVX512F and additional vector truncate test cases
Simon Pilgrim [Tue, 13 Sep 2016 17:34:56 +0000 (17:34 +0000)]
[X86][SSE] Added AVX512F and additional vector truncate test cases

trunc16i16_16i8 is currently commented out due to PR25684

llvm-svn: 281356

8 years agoObjectiveC generics: Add ObjCTypeParamType in the type system.
Manman Ren [Tue, 13 Sep 2016 17:25:08 +0000 (17:25 +0000)]
ObjectiveC generics: Add ObjCTypeParamType in the type system.

We also need to add ObjCTypeParamTypeLoc. ObjCTypeParamType supports the
representation of "T <protocol>" where T is a type parameter. Before this,
we use TypedefType to represent the type parameter for ObjC.

ObjCTypeParamType has "ObjCTypeParamDecl *OTPDecl" and it extends from
ObjCProtocolQualifiers. It is a non-canonical type and is canonicalized
to the underlying type with the protocol qualifiers.

rdar://24619481
rdar://25060179

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

llvm-svn: 281355

8 years ago[DAGCombiner] Use APInt directly in (shl (ext (shl x, c1)), c2) combine
Simon Pilgrim [Tue, 13 Sep 2016 17:15:28 +0000 (17:15 +0000)]
[DAGCombiner] Use APInt directly in (shl (ext (shl x, c1)), c2) combine

Fix failure to detect out of range shift constants leading to assert in ConstantSDNode::getZExtValue()

Followup to D23007

llvm-svn: 281354

8 years agoObjectiveC: Refactor applyObjCProtocolQualifiers.
Manman Ren [Tue, 13 Sep 2016 17:03:12 +0000 (17:03 +0000)]
ObjectiveC: Refactor applyObjCProtocolQualifiers.

To construct the canonical type of ObjCTypeParamType, we need to apply
qualifiers on ObjCObjectPointerType. The updated applyObjCProtocolQualifiers
handles this case by merging the protocol lists, constructing a new
ObjCObjectType, then a new ObjCObjectPointerType.

rdar://24619481
rdar://25060179

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

llvm-svn: 281353

8 years agofixup Xcode build for removal of MIUtilParse.*
Todd Fiala [Tue, 13 Sep 2016 16:53:07 +0000 (16:53 +0000)]
fixup Xcode build for removal of MIUtilParse.*

llvm-svn: 281352

8 years agoAdd a class ObjCProtocolQualifiers to wrap APIs for ObjC protocol list.
Manman Ren [Tue, 13 Sep 2016 16:45:29 +0000 (16:45 +0000)]
Add a class ObjCProtocolQualifiers to wrap APIs for ObjC protocol list.

Now ObjCObjectType extends from ObjCProtocolQualifiers. We save number of
protocols in ObjCProtocolQualifiers.

This is in preparation of adding a new type class ObjCTypeParamType that
can take protocol qualifiers.

rdar://24619481
rdar://25060179

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

llvm-svn: 281351

8 years agoFix misleading comment for getOrEnforceKnownAlignment
Matt Arsenault [Tue, 13 Sep 2016 16:39:43 +0000 (16:39 +0000)]
Fix misleading comment for getOrEnforceKnownAlignment

It does not return 0 to indicate failure, and returns the known
alignment.

llvm-svn: 281350

8 years agoFix a merge mishap in rL281348
Dimitar Vlahovski [Tue, 13 Sep 2016 16:22:15 +0000 (16:22 +0000)]
Fix a merge mishap in rL281348

llvm-svn: 281349

8 years agoMinidumpParsing: pid, modules, exceptions, strings
Dimitar Vlahovski [Tue, 13 Sep 2016 15:54:38 +0000 (15:54 +0000)]
MinidumpParsing: pid, modules, exceptions, strings

Summary:
Added parsing of the MiscInfo data stream.
The main member of it that we care about is the process_id
On Linux generated Minidump (from breakpad) we don't have
the MiscInfo, we have the /proc/$pid/status from where we can get the
pid.
Also parsing the module list - the list of all of the loaded
modules/shared libraries.
Parsing the exception stream.
Parsing MinidumpStrings.

I have unit tests for all of that.
Also added some tests using a Minidump generated from Windows tools (not
from breakpad)

Reviewers: labath, zturner

Subscribers: beanz, lldb-commits

Differential Revision: https://reviews.llvm.org/D24385

llvm-svn: 281348

8 years ago[SE] Stop using llvm-config --cxxflags
Jason Henline [Tue, 13 Sep 2016 15:44:18 +0000 (15:44 +0000)]
[SE] Stop using llvm-config --cxxflags

Summary:
Build configuration was adding $(llvm-config --cxxflags) to the
StreamExecutor CXXFLAGS, but this was causing "-O3" to be passed even
for debug builds, and was making debugging difficult.

The llvm-config call was originally introduced to handle the -fno-rtti
flag because an RTTI StreamExecutor could not link with a no-RTTI LLVM.
This patch converts to using LLVM_ENABLE_RTTI and only adding the
`-fno-rtti` flag if needed, not all the rest of the LLVM CXXFLAGS.

I have tested this with clang-4.0 and gcc-4.8 on Ubuntu. Some work will
probably have to be done to support MSVC.

Reviewers: jlebar

Subscribers: beanz, jprice, parallel_libs-commits, mgorny

Differential Revision: https://reviews.llvm.org/D24474

llvm-svn: 281347

8 years agoTraversing template paramter lists of DeclaratorDecls and/or TagDecls.
Nico Weber [Tue, 13 Sep 2016 15:05:04 +0000 (15:05 +0000)]
Traversing template paramter lists of DeclaratorDecls and/or TagDecls.

The unit tests in this patch demonstrate the need to traverse template
parameter lists of DeclaratorDecls (e.g. VarDecls, CXXMethodDecls) and
TagDecls (e.g. EnumDecls, RecordDecls).

Fixes PR29042.
https://reviews.llvm.org/D24268

Patch from Lukasz
Łukasz Anforowicz <lukasza@chromium.org>!

llvm-svn: 281345

8 years agoRemove redundant comma around parenthesis in parameter list.
Eric Liu [Tue, 13 Sep 2016 15:02:43 +0000 (15:02 +0000)]
Remove redundant comma around parenthesis in parameter list.

Reviewers: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D24501

llvm-svn: 281344

8 years ago[ConstantFold] Improve the bitcast folding logic for constant vectors.
Andrea Di Biagio [Tue, 13 Sep 2016 14:50:47 +0000 (14:50 +0000)]
[ConstantFold] Improve the bitcast folding logic for constant vectors.

The constant folder didn't know how to always fold bitcasts of constant integer
vectors. In particular, it was unable to handle the case where a constant vector
had some undef elements, and the resulting (i.e. bitcasted) vector type had more
elements than the original vector type.

Example:
  %cast = bitcast <2 x i64><i64 undef, i64 2> to <4 x i32>

On a little endian target, %cast could have been folded to:
  <4 x i32><i32 undef, i32 undef, i32 2, i32 0>

This patch improves the folding logic by teaching how to correctly propagate
undef elements in the folded vector.

Differential Revision: https://reviews.llvm.org/D24301

llvm-svn: 281343

8 years ago[asan] Add missing include for rand()
Jonas Hahnfeld [Tue, 13 Sep 2016 14:42:40 +0000 (14:42 +0000)]
[asan] Add missing include for rand()

llvm-svn: 281342

8 years ago[X86] Regenerated shift combine tests.
Simon Pilgrim [Tue, 13 Sep 2016 14:41:39 +0000 (14:41 +0000)]
[X86] Regenerated shift combine tests.

Added x86_64 tests

llvm-svn: 281341

8 years ago[modules] Re-enable some previously excluded files.
Vassil Vassilev [Tue, 13 Sep 2016 14:41:35 +0000 (14:41 +0000)]
[modules] Re-enable some previously excluded files.

Our modules support seems to be able to handle them nowadays.

Patch by Cristina Cristescu!

llvm-svn: 281340

8 years ago[Hexagon] Clear the flow queue after visiting a single instruction
Krzysztof Parzyszek [Tue, 13 Sep 2016 14:36:55 +0000 (14:36 +0000)]
[Hexagon] Clear the flow queue after visiting a single instruction

llvm-svn: 281339

8 years agoEnable merging of SHF_MERGE sections with linker scripts.
Rafael Espindola [Tue, 13 Sep 2016 14:23:14 +0000 (14:23 +0000)]
Enable merging of SHF_MERGE sections with linker scripts.

This also fixes the related problem of non SHF_MERGE sections with
different flags not being merged.

Fixes pr30355.

llvm-svn: 281338

8 years agoApply Clang-format to MCAsmParser.cpp NFC.
Nirav Dave [Tue, 13 Sep 2016 13:57:16 +0000 (13:57 +0000)]
Apply Clang-format to MCAsmParser.cpp NFC.

llvm-svn: 281337

8 years agoDefer asm errors to post-statement failure
Nirav Dave [Tue, 13 Sep 2016 13:55:06 +0000 (13:55 +0000)]
Defer asm errors to post-statement failure

Recommitting after fixing AsmParser Initialization.

Allow errors to be deferred and emitted as part of clean up to simplify
and shorten Assembly parser code. This will allow error messages to be
emitted in helper functions and be modified by the caller which has
better context.

As part of this many minor cleanups to the Parser:

* Unify parser cleanup on error
* Add Workaround for incorrect return values in ParseDirective instances
* Tighten checks on error-signifying return values for parser functions
  and fix in-tree TargetParsers to be more consistent with the changes.
* Fix AArch64 test cases checking for spurious error messages that are
  now fixed.

These changes should be backwards compatible with current Target Parsers
so long as the error status are correctly returned in appropriate
functions.

Reviewers: rnk, majnemer

Subscribers: aemerson, jyknight, llvm-commits

Differential Revision: https://reviews.llvm.org/D24047

llvm-svn: 281336

8 years ago[LoopInterchange] Minor refactor. NFC.
Chad Rosier [Tue, 13 Sep 2016 13:30:30 +0000 (13:30 +0000)]
[LoopInterchange] Minor refactor. NFC.

llvm-svn: 281334

8 years agoGPGPU: Use const_cast to avoid compiler warning [NFC]
Tobias Grosser [Tue, 13 Sep 2016 13:22:27 +0000 (13:22 +0000)]
GPGPU: Use const_cast to avoid compiler warning [NFC]

llvm-svn: 281333

8 years ago[InstSimplify] Add tests to show missed bitcast folding opportunities.
Andrea Di Biagio [Tue, 13 Sep 2016 13:17:42 +0000 (13:17 +0000)]
[InstSimplify] Add tests to show missed bitcast folding opportunities.

InstSimplify doesn't always know how to fold a bitcast of a constant vector.
In particular, the logic in InstSimplify doesn't know how to handle the case
where the constant vector in input contains some undef elements, and the
number of elements is smaller than the number of elements of the bitcast
vector type.

llvm-svn: 281332

8 years agoDon't use else if after return. Tidy comments. NFC.
Chad Rosier [Tue, 13 Sep 2016 13:08:53 +0000 (13:08 +0000)]
Don't use else if after return. Tidy comments. NFC.

llvm-svn: 281331

8 years agoTypo. NFC.
Chad Rosier [Tue, 13 Sep 2016 13:00:29 +0000 (13:00 +0000)]
Typo. NFC.

llvm-svn: 281330

8 years agoRefactor duplicated code. NFC.
Rafael Espindola [Tue, 13 Sep 2016 13:00:06 +0000 (13:00 +0000)]
Refactor duplicated code. NFC.

llvm-svn: 281329

8 years ago[LoopInterchange] Tidy up and remove unnecessary dyn_casts. NFC.
Chad Rosier [Tue, 13 Sep 2016 12:56:04 +0000 (12:56 +0000)]
[LoopInterchange] Tidy up and remove unnecessary dyn_casts. NFC.

llvm-svn: 281328

8 years agoRevert "[ARM] Promote small global constants to constant pools"
James Molloy [Tue, 13 Sep 2016 12:45:51 +0000 (12:45 +0000)]
Revert "[ARM] Promote small global constants to constant pools"

This reverts commit r281314. Speculatively revert as it's possible this caused linker errors: http://lab.llvm.org:8011/builders/clang-native-arm-lnt/builds/19656

llvm-svn: 281327

8 years agoRemove InstCombine test file
Sam Parker [Tue, 13 Sep 2016 12:33:06 +0000 (12:33 +0000)]
Remove InstCombine test file

My previous commit should of removed a test file but I missed it.

llvm-svn: 281326

8 years agoTurn createKey into a static helper. NFC.
Rafael Espindola [Tue, 13 Sep 2016 12:25:30 +0000 (12:25 +0000)]
Turn createKey into a static helper. NFC.

llvm-svn: 281325

8 years ago[ARM] Add ".code 32" to functions in the ARM instruction set
Pablo Barrio [Tue, 13 Sep 2016 12:18:15 +0000 (12:18 +0000)]
[ARM] Add ".code 32" to functions in the ARM instruction set

Before, only Thumb functions were marked as ".code 16". These
".code x" directives are effective until the next directive of its
kind is encountered. Therefore, in code with interleaved ARM and
Thumb functions, it was possible to declare a function as ARM and
end up with a Thumb function after assembly. A test has been added.

An existing test has also been fixed to take this change into
account.

Reviewers: aschwaighofer, t.p.northover, jmolloy, rengolin

Subscribers: aemerson, rengolin, llvm-commits

Differential Revision: https://reviews.llvm.org/D24337

llvm-svn: 281324

8 years ago[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently
James Molloy [Tue, 13 Sep 2016 12:12:32 +0000 (12:12 +0000)]
[Thumb] Teach ISel how to lower compares of AND bitmasks efficiently

For the common pattern (CMPZ (AND x, #bitmask), #0), we can do some more efficient instruction selection if the bitmask is one consecutive sequence of set bits (32 - clz(bm) - ctz(bm) == popcount(bm)).

1) If the bitmask touches the LSB, then we can remove all the upper bits and set the flags by doing one LSLS.
2) If the bitmask touches the MSB, then we can remove all the lower bits and set the flags with one LSRS.
3) If the bitmask has popcount == 1 (only one set bit), we can shift that bit into the sign bit with one LSLS and change the condition query from NE/EQ to MI/PL (we could also implement this by shifting into the carry bit and branching on BCC/BCS).
4) Otherwise, we can emit a sequence of LSLS+LSRS to remove the upper and lower zero bits of the mask.

1-3 require only one 16-bit instruction and can elide the CMP. 4 requires two 16-bit instructions but can elide the CMP and doesn't require materializing a complex immediate, so is also a win.

llvm-svn: 281323

8 years agoEnable simplify libcalls for ARM PCS
Sam Parker [Tue, 13 Sep 2016 12:10:14 +0000 (12:10 +0000)]
Enable simplify libcalls for ARM PCS

Teach SimplifyLibcalls that in can treat functions annotated with
apcs, aapcs or aapcs_vfp like normal C functions if they only take
and return integer or pointer values, and the target is not iOS.

Differential Revision: https://reviews.llvm.org/D24453

llvm-svn: 281322

8 years ago[llvm-cov] - Included footer "Generated by llvm-cov -- llvm version <version number...
Ying Yi [Tue, 13 Sep 2016 11:28:31 +0000 (11:28 +0000)]
[llvm-cov] - Included footer "Generated by llvm-cov -- llvm version <version number>" in the coverage report.

The llvm-cov version information will be useful to the user when comparing the code coverage across different versions of llvm-cov. This patch provides the llvm-cov version information in the generated coverage report.

Differential Revision: https://reviews.llvm.org/D24457

llvm-svn: 281321

8 years agoDelete dead code.
Rafael Espindola [Tue, 13 Sep 2016 11:28:22 +0000 (11:28 +0000)]
Delete dead code.

We already handle this is createSections.

llvm-svn: 281320

8 years ago[ARM] Support ldr.w in pseudo instruction ldr rd,=immediate
Peter Smith [Tue, 13 Sep 2016 11:15:51 +0000 (11:15 +0000)]
[ARM] Support ldr.w in pseudo instruction ldr rd,=immediate

The changes made in r269352, r269353 and r269354 to support the
transformation of the ldr rd,=immediate to mov introduced a regression
from 3.8 (ldr.w rd, =immediate) not supported.

This change puts support back in for ldr.w by means of a t2InstAlias for
the .w form. The .w is ignored in ARM state and propagated to the ldr in
Thumb2.

llvm-svn: 281319

8 years ago[ELF] - Versionscript: support mangled symbols with the same name.
George Rimar [Tue, 13 Sep 2016 10:45:39 +0000 (10:45 +0000)]
[ELF] - Versionscript: support mangled symbols with the same name.

This is PR30312. Info from bug page:

Both of these symbols demangle to abc::abc():
_ZN3abcC1Ev
_ZN3abcC2Ev
(These would be abc's complete object constructor and base object constructor, respectively.)
however with "abc::abc()" in the version script only one of the two receives the symbol version.

Patch fixes that.
It uses testcase created by Ed Maste (D24306).

Differential revision: https://reviews.llvm.org/D24336

llvm-svn: 281318

8 years agoRemove MIUtilParse (no longer used)
Pavel Labath [Tue, 13 Sep 2016 10:39:12 +0000 (10:39 +0000)]
Remove MIUtilParse (no longer used)

Summary: follow-up to https://reviews.llvm.org/D23882

Reviewers: dawn, krytarowski, labath, ki.stfu

Subscribers: beanz, mgorny, labath, ki.stfu, lldb-commits

Differential Revision: https://reviews.llvm.org/D23883
Author: Michał Górny <mgorny@gentoo.org>

llvm-svn: 281317

8 years agoRevert accidentally checked in change in r281315.
Vassil Vassilev [Tue, 13 Sep 2016 10:38:26 +0000 (10:38 +0000)]
Revert accidentally checked in change in r281315.

llvm-svn: 281316

8 years agoSimplify. NFC.
Vassil Vassilev [Tue, 13 Sep 2016 10:36:12 +0000 (10:36 +0000)]
Simplify. NFC.

llvm-svn: 281315

8 years ago[ARM] Promote small global constants to constant pools
James Molloy [Tue, 13 Sep 2016 10:28:11 +0000 (10:28 +0000)]
[ARM] Promote small global constants to constant pools

If a constant is unamed_addr and is only used within one function, we can save
on the code size and runtime cost of an indirection by changing the global's storage
to inside the constant pool. For example, instead of:

      ldr r0, .CPI0
      bl printf
      bx lr
    .CPI0: &format_string
    format_string: .asciz "hello, world!\n"

We can emit:

      adr r0, .CPI0
      bl printf
      bx lr
    .CPI0: .asciz "hello, world!\n"

This can cause significant code size savings when many small strings are used in one
function (4 bytes per string).

llvm-svn: 281314

8 years ago[clang-tidy] Fix naming in container-size-empty.
Kirill Bobyrev [Tue, 13 Sep 2016 10:19:13 +0000 (10:19 +0000)]
[clang-tidy] Fix naming in container-size-empty.

llvm-svn: 281313

8 years ago[WebAssembly] Trying to fix broken tests in CodeGen/WebAssembly caused by r281285.
Eric Liu [Tue, 13 Sep 2016 10:05:44 +0000 (10:05 +0000)]
[WebAssembly] Trying to fix broken tests in CodeGen/WebAssembly caused by r281285.

Reviewers: bkramer, ddcc, dschuff, sunfish

Subscribers: jfb, llvm-commits, dschuff

Differential Revision: https://reviews.llvm.org/D24497

llvm-svn: 281312

8 years agoUse value directly instead of reference. NFC.
Michael Kruse [Tue, 13 Sep 2016 09:56:05 +0000 (09:56 +0000)]
Use value directly instead of reference. NFC.

The alias to the array element is read-only and a primitive type (pointer),
therefore use the value directly instead of a reference to it.

llvm-svn: 281311

8 years ago[libcxx] Fix gcc builds.
Asiri Rathnayake [Tue, 13 Sep 2016 09:32:32 +0000 (09:32 +0000)]
[libcxx] Fix gcc builds.

Step around a gcc pre-processor defect which causes it to fail to
parse the __has_include macro check.

llvm-svn: 281310

8 years agoFix linux build after rL281273
Tamas Berghammer [Tue, 13 Sep 2016 09:27:21 +0000 (09:27 +0000)]
Fix linux build after rL281273

llvm-svn: 281309

8 years agoRemove MVT:i1 xor instruction before SELECT. (Performance improvement).
Ayman Musa [Tue, 13 Sep 2016 09:12:45 +0000 (09:12 +0000)]
Remove MVT:i1 xor instruction before SELECT. (Performance improvement).

Differential Revision: https://reviews.llvm.org/D23764

llvm-svn: 281308

8 years ago[clang-tidy] Extend readability-container-size-empty to arbitrary class with size...
Kirill Bobyrev [Tue, 13 Sep 2016 08:58:11 +0000 (08:58 +0000)]
[clang-tidy] Extend readability-container-size-empty to arbitrary class with size() and empty()

This patch extends readability-container-size-empty check allowing it to produce
warnings not only for STL containers, but also for containers, which provide two
functions matching following signatures:

* `size_type size() const;`
* `bool empty() const;`

Where `size_type` can be any kind of integer type.

This functionality was proposed in https://llvm.org/bugs/show_bug.cgi?id=26823
by Eugene Zelenko.

Approval: alexfh

Reviewers: alexfh, aaron.ballman, Eugene.Zelenko

Subscribers: etienneb, Prazek, hokein, xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D24349

llvm-svn: 281307

8 years agoRevert of r281304 as it is causing build bot failures in hexagon
Sjoerd Meijer [Tue, 13 Sep 2016 08:51:59 +0000 (08:51 +0000)]
Revert of r281304 as it is causing build bot failures in hexagon
hwloop regression tests. These tests pass locally; will be investigating
where these differences come from.

llvm-svn: 281306

8 years agoGPGPU: Allow region statements
Tobias Grosser [Tue, 13 Sep 2016 08:42:10 +0000 (08:42 +0000)]
GPGPU: Allow region statements

llvm-svn: 281305

8 years agoThis adds a new field isAdd to MCInstrDesc. The ARM and Hexagon instruction
Sjoerd Meijer [Tue, 13 Sep 2016 08:08:06 +0000 (08:08 +0000)]
This adds a new field isAdd to MCInstrDesc. The ARM and Hexagon instruction
descriptions now tag add instructions, and the Hexagon backend is using this to
identify loop induction statements.

Patch by Sam Parker and Sjoerd Meijer.

Differential Revision: https://reviews.llvm.org/D23601

llvm-svn: 281304

8 years agoGPGPU: Extend types when array sizes have smaller types
Tobias Grosser [Tue, 13 Sep 2016 08:02:14 +0000 (08:02 +0000)]
GPGPU: Extend types when array sizes have smaller types

This prevents a compiler crash.

llvm-svn: 281303

8 years agoAVX-512: Fix for PR28175 - Scalar code optimization.
Elena Demikhovsky [Tue, 13 Sep 2016 07:57:00 +0000 (07:57 +0000)]
AVX-512: Fix for PR28175 - Scalar code optimization.

Optimized (truncate (assertzext x) to i1) and anyext i1 to i8/16/32.
Optimization of this patterns is a one more step towards i1 optimization on AVX-512.

Differential Revision: https://reviews.llvm.org/D24456

llvm-svn: 281302

8 years ago[AArch64] Support stackmap/patchpoint in getInstSizeInBytes
Diana Picus [Tue, 13 Sep 2016 07:45:17 +0000 (07:45 +0000)]
[AArch64] Support stackmap/patchpoint in getInstSizeInBytes

We currently return 4 for stackmaps and patchpoints, which is very optimistic
and can in rare cases cause the branch relaxation pass to fail to relax certain
branches.

This patch causes getInstSizeInBytes to return a pessimistic estimate of the
size as the number of bytes requested in the stackmap/patchpoint. In the future,
we could provide a more accurate estimate by sharing some of the logic in
AArch64::LowerSTACKMAP/PATCHPOINT.

Fixes part of https://llvm.org/bugs/show_bug.cgi?id=28750

Differential Revision: https://reviews.llvm.org/D24073

llvm-svn: 281301

8 years ago[X86] Remove masked shufpd/shufps intrinsics and autoupgrade to native vector shuffle...
Craig Topper [Tue, 13 Sep 2016 07:40:53 +0000 (07:40 +0000)]
[X86] Remove masked shufpd/shufps intrinsics and autoupgrade to native vector shuffles. They were removed from clang previously but accidentally left in the backend.

llvm-svn: 281300

8 years ago[X86] Remove some dead intrinsics. They aren't implemented and clang doesn't referenc...
Craig Topper [Tue, 13 Sep 2016 07:40:48 +0000 (07:40 +0000)]
[X86] Remove some dead intrinsics. They aren't implemented and clang doesn't reference them.

llvm-svn: 281299

8 years agoAllow register variables in naked functions.
Nikola Smiljanic [Tue, 13 Sep 2016 07:02:02 +0000 (07:02 +0000)]
Allow register variables in naked functions.

llvm-svn: 281298

8 years ago[Docs] Fix a broken link in the Kaleidoscope tutorial.
Davide Italiano [Tue, 13 Sep 2016 06:31:37 +0000 (06:31 +0000)]
[Docs] Fix a broken link in the Kaleidoscope tutorial.

Patch by: Alfred Perlstein <alfred@FreeBSD.org>

llvm-svn: 281297

8 years ago[LTO] Only expose the dataLayout string instead of the whole module.
Davide Italiano [Tue, 13 Sep 2016 06:29:17 +0000 (06:29 +0000)]
[LTO] Only expose the dataLayout string instead of the whole module.

Differential Revision: https://reviews.llvm.org/D24494

llvm-svn: 281296

8 years agoAdapt test case to recent change in Global Variable Definition
Tobias Grosser [Tue, 13 Sep 2016 05:19:26 +0000 (05:19 +0000)]
Adapt test case to recent change in Global Variable Definition

llvm-svn: 281295

8 years agoclang-format: Add Java detection to git-clang-format.
Stephen Hines [Tue, 13 Sep 2016 05:00:20 +0000 (05:00 +0000)]
clang-format: Add Java detection to git-clang-format.

Summary: This change adds "java" to the list of known extensions that clang-format supports.

Patch by Luis Hector Chavez

Reviewers: djasper

Subscribers: srhines, cfe-commits

Differential Revision: https://reviews.llvm.org/D24401

llvm-svn: 281294

8 years agoReapply r281276 with passing -emit-llvm in one of the tests
Adam Nemet [Tue, 13 Sep 2016 04:32:40 +0000 (04:32 +0000)]
Reapply r281276 with passing -emit-llvm in one of the tests

Original commit message:

Add -fdiagnostics-show-hotness

Summary:
I've recently added the ability for optimization remarks to include the
hotness of the corresponding code region.  This uses PGO and allows
filtering of the optimization remarks by relevance.  The idea was first
discussed here:
http://thread.gmane.org/gmane.comp.compilers.llvm.devel/98334

The general goal is to produce a YAML file with the remarks.  Then, an
external tool could dynamically filter these by hotness and perhaps by
other things.

That said it makes sense to also expose this at the more basic level
where we just include the hotness info with each optimization remark.
For example, in D22694, the clang flag was pretty useful to measure the
overhead of the additional analyses required to include hotness.
(Without the flag we don't even run the analyses.)

For the record, Hal has already expressed support for the idea of this
patch on IRC.

Differential Revision: https://reviews.llvm.org/D23284

llvm-svn: 281293

8 years agoRevert "[Support][CommandLine] Add cl::getRegisteredSubcommands()"
Zachary Turner [Tue, 13 Sep 2016 04:11:57 +0000 (04:11 +0000)]
Revert "[Support][CommandLine] Add cl::getRegisteredSubcommands()"

This reverts r281290, as it breaks unit tests.
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/303

llvm-svn: 281292

8 years agoReduce the number of simultaneous debug sessions to 10 and remove
Jason Molenda [Tue, 13 Sep 2016 02:45:45 +0000 (02:45 +0000)]
Reduce the number of simultaneous debug sessions to 10 and remove
the expectedFlakeyDarwin annotation.

I've been running this test in isolation on my macOS Sierra system
and haven't seen a failure in 20-30 runs.  The number of simultaneous
debug sessions that it spins up could be a problem when the testbots
are running under load, so I'm reducing this from 20 simultaneous
debug sessions to see if we can get enough stability to leave this
enabled.

llvm-svn: 281291

8 years ago[Support][CommandLine] Add cl::getRegisteredSubcommands()
Dean Michael Berris [Tue, 13 Sep 2016 02:35:00 +0000 (02:35 +0000)]
[Support][CommandLine] Add cl::getRegisteredSubcommands()

This should allow users of the library to get a range to iterate through
all the subcommands that are registered to the global parser. This
allows users to define subcommands in libraries that self-register to
have dispatch done at a different stage (like main). It allows for
writing code like the following:

    for (auto *S : cl::getRegisteredSubcommands()) {
      if (*S) {
// Dispatch on S->getName().
      }
    }

This change also contains tests that show this usage pattern.

Reviewers: zturner, dblaikie, echristo

Subscribers: llvm-commits, mehdi_amini

Differential Revision: https://reviews.llvm.org/D24489

llvm-svn: 281290

8 years ago[lib/LTO] Expose getModule() in lto::InputFile.
Davide Italiano [Tue, 13 Sep 2016 02:22:02 +0000 (02:22 +0000)]
[lib/LTO] Expose getModule() in lto::InputFile.

lld will use this to get the datalayout string and emit a
diagnostic if empty.

llvm-svn: 281289

8 years agoAdd a few const's (thanks Zachary) and return shared or unique pointers
Jim Ingham [Tue, 13 Sep 2016 01:58:08 +0000 (01:58 +0000)]
Add a few const's (thanks Zachary) and return shared or unique pointers
in places where they help prevent leaks.

llvm-svn: 281288

8 years agoHandle empty message in static_asserts.
Richard Trieu [Tue, 13 Sep 2016 01:37:01 +0000 (01:37 +0000)]
Handle empty message in static_asserts.

llvm-svn: 281287

8 years agoFix interaction between serialization and c++1z feature.
Richard Trieu [Tue, 13 Sep 2016 01:20:40 +0000 (01:20 +0000)]
Fix interaction between serialization and c++1z feature.

In c++1z, static_assert is not required to have a StringLiteral message, where
previously it was required.  Update the AST Reader to be able to handle a
null StringLiteral.

llvm-svn: 281286

8 years agoUpdate Clang for D20147 ("DebugInfo: New metadata representation for global variables.")
Peter Collingbourne [Tue, 13 Sep 2016 01:13:19 +0000 (01:13 +0000)]
Update Clang for D20147 ("DebugInfo: New metadata representation for global variables.")

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

llvm-svn: 281285

8 years agoDebugInfo: New metadata representation for global variables.
Peter Collingbourne [Tue, 13 Sep 2016 01:12:59 +0000 (01:12 +0000)]
DebugInfo: New metadata representation for global variables.

This patch reverses the edge from DIGlobalVariable to GlobalVariable.
This will allow us to more easily preserve debug info metadata when
manipulating global variables.

Fixes PR30362. A program for upgrading test cases is attached to that
bug.

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

llvm-svn: 281284