platform/upstream/llvm.git
9 years agoFix several accidental DOS line endings in source files
Dimitry Andric [Sun, 3 Jan 2016 17:22:03 +0000 (17:22 +0000)]
Fix several accidental DOS line endings in source files

Summary:
There are a number of files in the tree which have been accidentally checked in with DOS line endings.  Convert these to native line endings.

There are also a few files which have DOS line endings on purpose, and I have set the svn:eol-style property to 'CRLF' on those.

Reviewers: joerg, aaron.ballman

Subscribers: aaron.ballman, sanjoy, dsanders, llvm-commits

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

llvm-svn: 256707

9 years ago[X86][SSE41] Added test cases for improving insertps shuffles
Simon Pilgrim [Sun, 3 Jan 2016 17:14:15 +0000 (17:14 +0000)]
[X86][SSE41] Added test cases for improving insertps shuffles

As mentioned on D14261, an upcoming patch will improve combines of insertps instructions.

llvm-svn: 256706

9 years ago[X86][SSE] Added v4f32 shuffle with zero tests
Simon Pilgrim [Sun, 3 Jan 2016 17:02:56 +0000 (17:02 +0000)]
[X86][SSE] Added v4f32 shuffle with zero tests

This is mainly test cases for improvements to insertps matching, but pre-SSE41 shuffles could be improved as well

llvm-svn: 256705

9 years agoFix several accidental DOS line endings in source files
Dimitry Andric [Sun, 3 Jan 2016 15:55:40 +0000 (15:55 +0000)]
Fix several accidental DOS line endings in source files

Summary:
There are a number of files in the tree which have been accidentally checked in with DOS line endings. Convert these to native line endings.

There are also a few files which have DOS line endings on purpose, and I have set the svn:eol-style property to 'CRLF' on those.

Reviewers: joerg, aaron.ballman

Subscribers: aaron.ballman, cfe-commits

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

llvm-svn: 256704

9 years ago[TableGen] Simplify some code slightly. No need to check if the arrays are empty...
Craig Topper [Sun, 3 Jan 2016 08:57:41 +0000 (08:57 +0000)]
[TableGen] Simplify some code slightly. No need to check if the arrays are empty before printing. The loop can be made to print the same thing if the loop is empty. NFC

llvm-svn: 256703

9 years agoUse an ArrayRef to simplify repeated calculation of the array end. NFC
Craig Topper [Sun, 3 Jan 2016 08:45:36 +0000 (08:45 +0000)]
Use an ArrayRef to simplify repeated calculation of the array end. NFC

llvm-svn: 256702

9 years agoUse std::is_sorted instead of manual loops. NFC
Craig Topper [Sun, 3 Jan 2016 07:33:45 +0000 (07:33 +0000)]
Use std::is_sorted instead of manual loops. NFC

llvm-svn: 256701

9 years agoUse range-based for loop. NFC
Craig Topper [Sun, 3 Jan 2016 07:33:42 +0000 (07:33 +0000)]
Use range-based for loop. NFC

llvm-svn: 256700

9 years ago[TableGen] Replace a logically negated xor of bools with just an equality comparison...
Craig Topper [Sun, 3 Jan 2016 07:33:39 +0000 (07:33 +0000)]
[TableGen] Replace a logically negated xor of bools with just an equality comparison for readability. NFC

llvm-svn: 256699

9 years ago[TableGen] Use std::find_if and a lambda instead of manual loops.
Craig Topper [Sun, 3 Jan 2016 07:33:36 +0000 (07:33 +0000)]
[TableGen] Use std::find_if and a lambda instead of manual loops.

llvm-svn: 256698

9 years ago[TableGen] Fix a bug introduced in r256627. If the switch was not emitted we still...
Craig Topper [Sun, 3 Jan 2016 07:33:34 +0000 (07:33 +0000)]
[TableGen] Fix a bug introduced in r256627. If the switch was not emitted we still emitted a closing curly brace.

llvm-svn: 256697

9 years ago[TableGen] Use range-based for loops. NFC
Craig Topper [Sun, 3 Jan 2016 07:33:30 +0000 (07:33 +0000)]
[TableGen] Use range-based for loops. NFC

llvm-svn: 256696

9 years ago[PGO] simple refactoring (NFC)
Xinliang David Li [Sun, 3 Jan 2016 04:38:13 +0000 (04:38 +0000)]
[PGO] simple refactoring (NFC)

llvm-svn: 256695

9 years agoWinEHPrepare.cpp: Suppress a warning for -Asserts. [-Wunused-variable]
NAKAMURA Takumi [Sun, 3 Jan 2016 01:41:00 +0000 (01:41 +0000)]
WinEHPrepare.cpp: Suppress a warning for -Asserts. [-Wunused-variable]

llvm-svn: 256694

9 years agoRevert or r256638. I`ve lost a little piece of code when resolved conflicts right...
George Rimar [Sat, 2 Jan 2016 16:55:01 +0000 (16:55 +0000)]
Revert or r256638. I`ve lost a little piece of code when resolved conflicts right before commit. Sorry about that.
Test did not catch this either, so I`ll improve it and recommit later.

Original commit message:
[ELF] - Optimize .eh_frame section: remove CIE if all FDEs referencing it were removed.

This patch performs little optimization for eh_frame section.
If all FDE`s that referenced CIE are removed then CIE is also removed from output.
That can happen for example when dropping FDEs that point to dropped sections. Testcase showing that is included.
The same optimization was added to ld about 14 years ago: https://sourceware.org/ml/binutils/2001-12/msg00144.html, gold does not do that it seems.

Differential revision: http://reviews.llvm.org/D15564

llvm-svn: 256693

9 years ago[Verifier] Add braces to satisfy buildbots. NFC
Joseph Tremoulet [Sat, 2 Jan 2016 15:50:34 +0000 (15:50 +0000)]
[Verifier] Add braces to satisfy buildbots. NFC

Fix build break introduced by r256691.

llvm-svn: 256692

9 years ago[WinEH] Verify catchswitch handlers
Joseph Tremoulet [Sat, 2 Jan 2016 15:25:25 +0000 (15:25 +0000)]
[WinEH] Verify catchswitch handlers

Summary:
The handler list must be nonempty and consist solely of CatchPads.

Reviewers: rnk, andrew.w.kaylor, majnemer

Subscribers: llvm-commits

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

llvm-svn: 256691

9 years ago[WinEH] Tighten parentPad verifier checks
Joseph Tremoulet [Sat, 2 Jan 2016 15:24:24 +0000 (15:24 +0000)]
[WinEH] Tighten parentPad verifier checks

Summary: A catchswitch cannot be a parent of a cleanuppad or another catchswitch.

Reviewers: rnk, andrew.w.kaylor, majnemer

Subscribers: llvm-commits

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

llvm-svn: 256690

9 years ago[WinEH] Update catchrets with cloned successors
Joseph Tremoulet [Sat, 2 Jan 2016 15:22:36 +0000 (15:22 +0000)]
[WinEH] Update catchrets with cloned successors

Summary:
Add a pass to update catchrets when their successors get cloned; the
existing pass doesn't catch these because it walks the funclet whose
blocks are being cloned but the catchret is in a child funclet.

Also update the test for removing incoming PHI values; when the
predecessor is a catchret, the relevant color is the catchret's parentPad,
not its block's color.

Reviewers: andrew.w.kaylor, rnk, majnemer

Subscribers: llvm-commits

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

llvm-svn: 256689

9 years agoCorrect misleading formatting of several ifs followed by two statements without braces.
Yaron Keren [Sat, 2 Jan 2016 13:40:36 +0000 (13:40 +0000)]
Correct misleading formatting of several ifs followed by two statements without braces.
While the original code would work with or without braces, it makes sense to
set HaveSemi to true only if (!HaveSemi), otherwise it's already true, so I
put the assignment inside the if block. This addresses PR25998.

llvm-svn: 256688

9 years ago[WinEH] Add additional verification
David Majnemer [Sat, 2 Jan 2016 09:26:36 +0000 (09:26 +0000)]
[WinEH] Add additional verification

Recolor the IR to make sure our computed colors are not hiding any bugs.
Also, verifyFunction if we are running some post-preparation operations;
some of these operations can hide latent bugs.

llvm-svn: 256687

9 years agoReimplement __readeflags and __writeeflags on top of intrinsics
David Majnemer [Fri, 1 Jan 2016 06:50:08 +0000 (06:50 +0000)]
Reimplement __readeflags and __writeeflags on top of intrinsics

Lean on LLVM to provide this functionality now that it provides the
necessary intrinsics.

llvm-svn: 256686

9 years ago[X86] Add intrinsics for reading and writing to the flags register
David Majnemer [Fri, 1 Jan 2016 06:50:01 +0000 (06:50 +0000)]
[X86] Add intrinsics for reading and writing to the flags register

LLVM's targets need to know if stack pointer adjustments occur after the
prologue.  This is needed to correctly determine if the red-zone is
appropriate to use or if a frame pointer is required.

Normally, LLVM can figure this out very precisely by reasoning about the
contents of the MachineFunction.  There is an interesting corner case:
inline assembly.

The vast majority of inline assembly which will perform a push or pop is
done so to pair up with pushf or popf as appropriate.  Unfortunately,
this inline assembly doesn't mark the stack pointer as clobbered
because, well, it isn't.  The stack pointer is decremented and then
immediately incremented.  Because of this, LLVM was changed in r256456
to conservatively assume that inline assembly contain a sequence of
stack operations.  This is unfortunate because the vast majority of
inline assembly will not end up manipulating the stack pointer in any
way at all.

Instead, let's provide a more principled solution: an intrinsic.
FWIW, other compilers (MSVC and GCC among them) also provide this
functionality as an intrinsic.

llvm-svn: 256685

9 years ago[TrailingObjects] Fix "Convert classes in OpenMPClause.h" for MSVC
James Y Knight [Fri, 1 Jan 2016 01:12:48 +0000 (01:12 +0000)]
[TrailingObjects] Fix "Convert classes in OpenMPClause.h" for MSVC

"friend class OMPVarListClause" -> "friend OMPVarListClause".  It's a
template, not a class.

llvm-svn: 256684

9 years ago[TrailingObjects] Convert classes in OpenMPClause.h
James Y Knight [Fri, 1 Jan 2016 00:38:24 +0000 (00:38 +0000)]
[TrailingObjects] Convert classes in OpenMPClause.h

llvm-svn: 256683

9 years ago[LibCallSimplifier] propagate FMF when shrinking binary calls
Sanjay Patel [Thu, 31 Dec 2015 23:40:59 +0000 (23:40 +0000)]
[LibCallSimplifier] propagate FMF when shrinking binary calls

llvm-svn: 256682

9 years ago[X86] Remove a return after llvm_unreachable.
Craig Topper [Thu, 31 Dec 2015 22:40:48 +0000 (22:40 +0000)]
[X86] Remove a return after llvm_unreachable.

llvm-svn: 256681

9 years ago[X86] Move shuffle decoding for constant pool into the X86CodeGen library to remove...
Craig Topper [Thu, 31 Dec 2015 22:40:45 +0000 (22:40 +0000)]
[X86] Move shuffle decoding for constant pool into the X86CodeGen library to remove a layering violation in the Util library.

llvm-svn: 256680

9 years ago[LibCallSimplifier] propagate FMF when shrinking unary calls
Sanjay Patel [Thu, 31 Dec 2015 21:52:31 +0000 (21:52 +0000)]
[LibCallSimplifier] propagate FMF when shrinking unary calls

llvm-svn: 256679

9 years agochange function names to avoid accidentally matching the substring
Sanjay Patel [Thu, 31 Dec 2015 21:25:25 +0000 (21:25 +0000)]
change function names to avoid accidentally matching the substring

llvm-svn: 256678

9 years agoadd 'fast' attribute to calls to show that the flag isn't being propagated
Sanjay Patel [Thu, 31 Dec 2015 21:12:19 +0000 (21:12 +0000)]
add 'fast' attribute to calls to show that the flag isn't being propagated

llvm-svn: 256677

9 years agoVariable names start with an upper case letter; NFC
Sanjay Patel [Thu, 31 Dec 2015 16:16:58 +0000 (16:16 +0000)]
Variable names start with an upper case letter; NFC

llvm-svn: 256676

9 years agofix formatting; NFC
Sanjay Patel [Thu, 31 Dec 2015 16:10:49 +0000 (16:10 +0000)]
fix formatting; NFC

llvm-svn: 256675

9 years agoadd FMF for CreateCall variant
Sanjay Patel [Thu, 31 Dec 2015 15:39:34 +0000 (15:39 +0000)]
add FMF for CreateCall variant

The version with OpBundles was missed in:
http://reviews.llvm.org/rL255555

llvm-svn: 256674

9 years ago[AVX512] add PSRLQ and PSRLD Intrinsic
Michael Zuckerman [Thu, 31 Dec 2015 15:22:04 +0000 (15:22 +0000)]
[AVX512] add PSRLQ and PSRLD Intrinsic

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

llvm-svn: 256673

9 years ago[X86][PKU] add clang intrinsic for {RD|WR}PKRU
Asaf Badouh [Thu, 31 Dec 2015 14:14:07 +0000 (14:14 +0000)]
[X86][PKU] add clang intrinsic for {RD|WR}PKRU

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

llvm-svn: 256672

9 years ago[X86] Avoid folding scalar loads into unary sse intrinsics
Michael Kuperstein [Thu, 31 Dec 2015 09:45:16 +0000 (09:45 +0000)]
[X86] Avoid folding scalar loads into unary sse intrinsics

Not folding these cases tends to avoid partial register updates:
sqrtss (%eax), %xmm0
Has a partial update of %xmm0, while
movss (%eax), %xmm0
sqrtss %xmm0, %xmm0
Has a clobber of the high lanes immediately before the partial update,
avoiding a potential stall.

Given this, we only want to fold when optimizing for size.
This is consistent with the patterns we already have for some of
the fp/int converts, and in X86InstrInfo::foldMemoryOperandImpl()

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

llvm-svn: 256671

9 years ago[X86][PKU] Add {RD,WR}PKRU intrinsics
Asaf Badouh [Thu, 31 Dec 2015 08:31:13 +0000 (08:31 +0000)]
[X86][PKU] Add {RD,WR}PKRU intrinsics

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

llvm-svn: 256670

9 years ago[TableGen] Modify the AsmMatcherEmitter to only apply the table growth from r252440...
Craig Topper [Thu, 31 Dec 2015 08:18:23 +0000 (08:18 +0000)]
[TableGen] Modify the AsmMatcherEmitter to only apply the table growth from r252440 to the Hexagon target.

This restores the previous behavior of not including the mnemonic in the classes table for every target that starts instruction lines with the mnemonic. Not only did the table size increase by 1 entry, but the class enum increased in size which caused every class in the array to increase in size. It also grew the size of the function that parsers tokens into classes by a substantial amount.

This adds a new HasMnemonicFirst flag to all AsmParsers. It's set to 1 by default and Hexagon target overrides it to 0.

For the X86 target alone this recovers 324KB of size on the llvm-mc executable.

I believe the current state is still a bad design choice for the Hexagon target as it causes most of the parsing to do a linear search through the entire match table to comparing operands against every instruction until it finds one that works. At least for the other targets we do a binary search based on mnemonic over which to do the linear scan.

llvm-svn: 256669

9 years ago[TableGen] Use range-based for loops. NFC
Craig Topper [Thu, 31 Dec 2015 08:18:20 +0000 (08:18 +0000)]
[TableGen] Use range-based for loops. NFC

llvm-svn: 256668

9 years ago[PGO]: Implement Func PGO name string compression
Xinliang David Li [Thu, 31 Dec 2015 07:57:16 +0000 (07:57 +0000)]
[PGO]: Implement Func PGO name string compression

This is part of the effort/prepration to reduce the size
instr-pgo (object, binary, memory footprint, and raw data).

The functionality is currently off by default and not yet
used by any clients.

llvm-svn: 256667

9 years ago[OPENMP 4.5] Codegen for 'schedule' clause with monotonic/nonmonotonic modifiers.
Alexey Bataev [Thu, 31 Dec 2015 06:52:34 +0000 (06:52 +0000)]
[OPENMP 4.5] Codegen for 'schedule' clause with monotonic/nonmonotonic modifiers.
OpenMP 4.5 adds support for monotonic/nonmonotonic modifiers in 'schedule' clause. Add codegen for these modifiers.

llvm-svn: 256666

9 years ago[TrailingObjects] Fix bug in "Convert classes in ExprObjC.h"
James Y Knight [Thu, 31 Dec 2015 06:01:19 +0000 (06:01 +0000)]
[TrailingObjects] Fix bug in "Convert classes in ExprObjC.h"

(Detected by asan)

llvm-svn: 256665

9 years ago[MS ABI] Remove mangleCXXCatchHandlerType
David Majnemer [Thu, 31 Dec 2015 05:36:54 +0000 (05:36 +0000)]
[MS ABI] Remove mangleCXXCatchHandlerType

It's dead code, no functional change is intended.

llvm-svn: 256664

9 years ago[MS ABI] Change the ArgBackRefMap to hold const qualified pointers
David Majnemer [Thu, 31 Dec 2015 05:36:52 +0000 (05:36 +0000)]
[MS ABI] Change the ArgBackRefMap to hold const qualified pointers

Just a cleanup, no functional change is intended.

llvm-svn: 256663

9 years ago[MS ABI] Replace dead code with an assertion
David Majnemer [Thu, 31 Dec 2015 05:36:50 +0000 (05:36 +0000)]
[MS ABI] Replace dead code with an assertion

As per C++ [dcl.ref]p1, cv-qualified references are not valid. As such,
change the mangler to assert that this event does not happen.

llvm-svn: 256662

9 years ago[MSVC Compat] Diagnose multiple default ctors for dllexport'd classes
David Majnemer [Thu, 31 Dec 2015 05:36:46 +0000 (05:36 +0000)]
[MSVC Compat] Diagnose multiple default ctors for dllexport'd classes

The MS ABI emits a special default constructor closure thunk if a
default constructor has a weird calling convention or default arguments.

The MS ABI has a quirk: there can be only one such thunk because the
mangling scheme does not have room for distinct manglings.  We must
raise a diagnostic in this eventuality.

N.B.  MSVC sorta gets this right.  Multiple default constructors result
in the default constructor closure getting emitted but they seem to
get confused by which default constructors are reasonable to reference
from the closure.  We try to be a little more careful which results in
mild differences in behavior.

llvm-svn: 256661

9 years ago[TableGen] Move determination of IsIsolatedToken into the tokenizer instead of trying...
Craig Topper [Thu, 31 Dec 2015 05:01:45 +0000 (05:01 +0000)]
[TableGen] Move determination of IsIsolatedToken into the tokenizer instead of trying to search characters around the token. No functional change intended. Verified for in-tree targets.

llvm-svn: 256660

9 years ago[TrailingObjects] Convert classes in ExprObjC.h
James Y Knight [Thu, 31 Dec 2015 04:43:19 +0000 (04:43 +0000)]
[TrailingObjects] Convert classes in ExprObjC.h

llvm-svn: 256659

9 years ago[TrailingObjects] Convert remaining classes in Expr.h and ExprCXX.h
James Y Knight [Thu, 31 Dec 2015 04:18:25 +0000 (04:18 +0000)]
[TrailingObjects] Convert remaining classes in Expr.h and ExprCXX.h

llvm-svn: 256658

9 years agoImprove diagnostic for the case where a function template candidate is rejected
Richard Smith [Thu, 31 Dec 2015 02:02:54 +0000 (02:02 +0000)]
Improve diagnostic for the case where a function template candidate is rejected
by overload resolution because deduction succeeds, but the substituted
parameter type for some parameter (with deduced type) doesn't exactly match the
corresponding adjusted argument type.

llvm-svn: 256657

9 years agoRevert "Revert "[ptr-traits] Implement the base pointer traits using the actual""
Chandler Carruth [Wed, 30 Dec 2015 23:37:25 +0000 (23:37 +0000)]
Revert "Revert "[ptr-traits] Implement the base pointer traits using the actual""

This reverts commit r256642 and restores r256620 now that Tobias has
updated Polly.

There are still some potential problems with the code in Polly that I've
sent post-commit review about, but they're unlikely to break anything in
practice, and I'd like to avoid the rest of LLVM and Clang regressing
here.

llvm-svn: 256656

9 years ago[ValueTracking] fix bug computing isKnownToBeAPowerOfTwo() with arithmetic shift...
Sanjay Patel [Wed, 30 Dec 2015 22:40:52 +0000 (22:40 +0000)]
[ValueTracking] fix bug computing isKnownToBeAPowerOfTwo() with arithmetic shift right (PR25900)

This is a fix for:
https://llvm.org/bugs/show_bug.cgi?id=25900

If we think that an arithmetic right shift of a power of two is always a power of two,
an sdiv gets wrongly converted to udiv.

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

llvm-svn: 256655

9 years agoUse __rebind_pointer to avoid #ifdef block
Eric Fiselier [Wed, 30 Dec 2015 21:52:00 +0000 (21:52 +0000)]
Use __rebind_pointer to avoid #ifdef block

llvm-svn: 256654

9 years ago[ThinLTO] Rename variables used in metadata linking (NFC)
Teresa Johnson [Wed, 30 Dec 2015 21:13:55 +0000 (21:13 +0000)]
[ThinLTO] Rename variables used in metadata linking (NFC)

As suggested in review for r255909, rename MDMaterialized to AllowTemps,
and identify the name of the boolean flag being set in calls to
saveMetadataList.

llvm-svn: 256653

9 years ago[libcxx] Fix for ALL undefined behavior in <list>.
Eric Fiselier [Wed, 30 Dec 2015 20:57:59 +0000 (20:57 +0000)]
[libcxx] Fix for ALL undefined behavior in <list>.

Summary:
This patch fixes std::list for builtin pointer types in the current ABI version and fixes std::list for all fancy pointer types in the next ABI version. The patch was designed to minimize the amount of code needed to support both ABI configurations. Currently only ~5 lines of code differ.

Reviewers: danalbert, jroelofs, mclow.lists

Subscribers: dexonsmith, awi, cfe-commits

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

llvm-svn: 256652

9 years agoImplement [temp.deduct.type]p6: if the nested-name-specifier of a type is
Richard Smith [Wed, 30 Dec 2015 20:56:05 +0000 (20:56 +0000)]
Implement [temp.deduct.type]p6: if the nested-name-specifier of a type is
dependent, the type is a non-deduced context.

llvm-svn: 256651

9 years agoIslExprBuilder: Provide PointerLikeTypeTraits for isl_id
Tobias Grosser [Wed, 30 Dec 2015 20:11:48 +0000 (20:11 +0000)]
IslExprBuilder: Provide PointerLikeTypeTraits for isl_id

Providing an explicit PointerLikeTypeTraits implementation became necessary
since LLVM started in https://llvm.org/svn/llvm-project/llvm/trunk@256620
to automatically derive the pointer alignment from the pointer element type,
which does not work for incomplete types as used by isl. To ensure our code
still compiles, we provide an instantiation of PointerLikeTypeTraits for isl_id
which assumes no minimal alignment. isl pointers are likely to have a "higher"
alignment. We can exploit this later in case this becomes performance relevant.

llvm-svn: 256650

9 years agoScopDetection: Add include to make complete type of llvm::Region available
Tobias Grosser [Wed, 30 Dec 2015 20:11:43 +0000 (20:11 +0000)]
ScopDetection: Add include to make complete type of llvm::Region available

This is necessary for the recent ptr-traits work in LLVM, which now requires
complete type definitions.

llvm-svn: 256649

9 years agoEnsure MDNode used as key in metadata linking map cannot be RAUWed
Teresa Johnson [Wed, 30 Dec 2015 19:32:24 +0000 (19:32 +0000)]
Ensure MDNode used as key in metadata linking map cannot be RAUWed

As suggested in review for r255909, add a way to ensure that temporary
MD used as keys in the MetadataToID map during ThinLTO importing are not
RAUWed.

Add support for marking an MDNode as not replaceable. Clear the new
CanReplace flag when adding a temporary MD node to the MetadataToID map
and clear it when destroying the map.

llvm-svn: 256648

9 years ago[PGO]: Eliminate custom typedefs in the FreeBSD case
Xinliang David Li [Wed, 30 Dec 2015 19:18:55 +0000 (19:18 +0000)]
[PGO]: Eliminate custom typedefs in the FreeBSD case

Patch by: Sean Bruno

Use o/s provided sys/types.h to bring in Profiling types.

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

llvm-svn: 256647

9 years ago[ThinLTO] Check MDNode values saved for metadata linking (NFC)
Teresa Johnson [Wed, 30 Dec 2015 19:13:57 +0000 (19:13 +0000)]
[ThinLTO] Check MDNode values saved for metadata linking (NFC)

Add an assert suggested in review for r255909 to ensure that MDNodes
saved in the map used for metadata linking are either temporary or
resolved.

Also add a comment clarifying why we may need to save off non-MDNode
metadata.

llvm-svn: 256646

9 years agofix formatting; NFC
Sanjay Patel [Wed, 30 Dec 2015 18:31:30 +0000 (18:31 +0000)]
fix formatting; NFC

llvm-svn: 256645

9 years agoSilencing a -Wcast-qual warning; NFC.
Aaron Ballman [Wed, 30 Dec 2015 16:02:17 +0000 (16:02 +0000)]
Silencing a -Wcast-qual warning; NFC.

llvm-svn: 256644

9 years agoWhen performing an implicit from float to bool, the floating point value must be...
Aaron Ballman [Wed, 30 Dec 2015 14:26:07 +0000 (14:26 +0000)]
When performing an implicit from float to bool, the floating point value must be *exactly* zero in order for the conversion to result in 0. This does not involve a conversion through an integer value, and so truncation of the value is not performed.

This patch address PR25876.

llvm-svn: 256643

9 years agoRevert "[ptr-traits] Implement the base pointer traits using the actual"
Tobias Grosser [Wed, 30 Dec 2015 14:02:58 +0000 (14:02 +0000)]
Revert "[ptr-traits] Implement the base pointer traits using the actual"

The commit we revert is rather small, but it enables a larger piece of new
infrastructure that allows to detected misuses of pointer-traits at compile
time. Unfortunately, this change breaks with the use of incomplete types (e.g.
in Polly). As I am not aware of a simple fix on the Polly side, I temporarely
revert this commit to clean the bots and sync-up with Chandler how to best
adapt to these recent changes.

This reverts commit https://llvm.org/svn/llvm-project/llvm/trunk@256620.

llvm-svn: 256642

9 years agoDisable generating movt on FreeBSD.
Davide Italiano [Wed, 30 Dec 2015 13:53:25 +0000 (13:53 +0000)]
Disable generating movt on FreeBSD.

It's sort of an hack, but we have no choice.
The linker in the base system doesn't handle that correctly (yet).
Once FreeBSD will import lld, this can be backed out.

Patch by: Andrew Turner!

llvm-svn: 256641

9 years agoclang-format: Slightly row back on r256343 by increasing penalty for
Daniel Jasper [Wed, 30 Dec 2015 12:23:00 +0000 (12:23 +0000)]
clang-format: Slightly row back on r256343 by increasing penalty for
breaking between array subscripts.

Before:
  if (aaaaaaaaaaaaaaaaaaaaaaaa && aaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaa]
                                                     [aaaaaaaaaaaaa])
After:
  if (aaaaaaaaaaaaaaaaaaaaaaaa &&
      aaaaaaaaaaaaaaaaaaa[aaaaaaaaaaaaa][aaaaaaaaaaaaa])

llvm-svn: 256640

9 years ago[OPENMP 4.5] Allow 'ordered' clause on 'loop simd' constructs.
Alexey Bataev [Wed, 30 Dec 2015 12:06:23 +0000 (12:06 +0000)]
[OPENMP 4.5] Allow 'ordered' clause on 'loop simd' constructs.
OpenMP 4.5 allows to use 'ordered' clause without parameter on 'loop simd' constructs.

llvm-svn: 256639

9 years ago[ELF] - Optimize .eh_frame section: remove CIE if all FDEs referencing it were removed.
George Rimar [Wed, 30 Dec 2015 11:40:44 +0000 (11:40 +0000)]
[ELF] - Optimize .eh_frame section: remove CIE if all FDEs referencing it were removed.

This patch performs little optimization for eh_frame section.
If all FDE`s that referenced CIE are removed then CIE is also removed from output.
That can happen for example when dropping FDEs that point to dropped sections. Testcase showing that is included.
The same optimization was added to ld about 14 years ago: https://sourceware.org/ml/binutils/2001-12/msg00144.html, gold does not do that it seems.

Differential revision: http://reviews.llvm.org/D15564

llvm-svn: 256638

9 years ago[clang-tidy] Don't use delegating constructors
Alexander Kornienko [Wed, 30 Dec 2015 11:39:30 +0000 (11:39 +0000)]
[clang-tidy] Don't use delegating constructors

llvm-svn: 256637

9 years ago[clang-tidy] Use hasLocalStorage() to identify unnecessary copy initializations to...
Alexander Kornienko [Wed, 30 Dec 2015 11:35:50 +0000 (11:35 +0000)]
[clang-tidy] Use hasLocalStorage() to identify unnecessary copy initializations to exclude static local variables.

Summary: Since local static variables can outlive other local variables exclude them from the unnecessary copy initialization check.

Reviewers: alexfh

Patch by Felix Berger!

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

llvm-svn: 256636

9 years ago[clang-tidy] Add the missing Makefile
Alexander Kornienko [Wed, 30 Dec 2015 10:56:00 +0000 (10:56 +0000)]
[clang-tidy] Add the missing Makefile

llvm-svn: 256634

9 years ago[clang-tidy] Fix configure build
Alexander Kornienko [Wed, 30 Dec 2015 10:44:08 +0000 (10:44 +0000)]
[clang-tidy] Fix configure build

llvm-svn: 256633

9 years ago[clang-tidy] Add UnnecessaryCopyInitialization check to new "performance" module...
Alexander Kornienko [Wed, 30 Dec 2015 10:24:40 +0000 (10:24 +0000)]
[clang-tidy] Add UnnecessaryCopyInitialization check to new "performance" module in ClangTidy

Summary:
The patch adds a new ClangTidy check that detects when expensive-to-copy types are unnecessarily copy initialized from a const reference that has the same or are larger scope than the copy.

It currently only detects this when the copied variable is const qualified. But this will be extended to non const variables if they are only used in a const fashion.

Reviewers: alexfh

Subscribers: cfe-commits

Patch by Felix Berger!

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

llvm-svn: 256632

9 years agoclang-format: [JS] Support TypeScript 1.6 user defined type guards.
Daniel Jasper [Wed, 30 Dec 2015 08:00:58 +0000 (08:00 +0000)]
clang-format: [JS] Support TypeScript 1.6 user defined type guards.

Before:
  function foo(check: Object): check
  is{foo: string, bar: string, baz: string, foobar: string} {
    return 'bar' in check;
  }

After:
  function foo(check: Object):
      check is {foo: string, bar: string, baz: string, foobar: string} {
    return 'bar' in check;
  }

llvm-svn: 256631

9 years ago[ptr-traits] Add another complete type that is necessary for at least
Chandler Carruth [Wed, 30 Dec 2015 06:38:29 +0000 (06:38 +0000)]
[ptr-traits] Add another complete type that is necessary for at least
some of the build bots. Still can't reproduce these failures locally.

llvm-svn: 256630

9 years ago[ptr-traits] Some compilers (older Clang? unsure) on build bots need
Chandler Carruth [Wed, 30 Dec 2015 06:21:02 +0000 (06:21 +0000)]
[ptr-traits] Some compilers (older Clang? unsure) on build bots need
this constructor to be out of line in order to not require the complete
type of TemplateDecl.

Hopefully this will fix the build bots.

llvm-svn: 256629

9 years ago[TableGen] Remove unnecessary conversion from StringRef to std::string when outputtin...
Craig Topper [Wed, 30 Dec 2015 06:00:24 +0000 (06:00 +0000)]
[TableGen] Remove unnecessary conversion from StringRef to std::string when outputting to a raw_ostream. NFC

llvm-svn: 256628

9 years ago[TableGen] Remove raw_string_ostream by just emitting the header for the switch the...
Craig Topper [Wed, 30 Dec 2015 06:00:22 +0000 (06:00 +0000)]
[TableGen] Remove raw_string_ostream by just emitting the header for the switch the first time we emit a case. If the header was never emitted just print the default at the end. NFC

llvm-svn: 256627

9 years ago[TableGen] Use range-based for loops. NFC
Craig Topper [Wed, 30 Dec 2015 06:00:20 +0000 (06:00 +0000)]
[TableGen] Use range-based for loops. NFC

llvm-svn: 256626

9 years ago[TableGen] Move more things that come from variant into the AsmVariantInfo class...
Craig Topper [Wed, 30 Dec 2015 06:00:18 +0000 (06:00 +0000)]
[TableGen] Move more things that come from variant into the AsmVariantInfo class so we can reduce some parameters. NFC

llvm-svn: 256625

9 years ago[TableGen] Use 'size_t' instead of 'unsigned' to better match the argument types...
Craig Topper [Wed, 30 Dec 2015 06:00:15 +0000 (06:00 +0000)]
[TableGen] Use 'size_t' instead of 'unsigned' to better match the argument types of addAsmOperand. Simplify some code by using StringRef::find instead of std::find. These were previously done in r247527 and r247528, but another commit seems to have erased them. NFC

llvm-svn: 256624

9 years ago[MS ABI] Add variable templates to the NameBackReferences
David Majnemer [Wed, 30 Dec 2015 05:40:32 +0000 (05:40 +0000)]
[MS ABI] Add variable templates to the NameBackReferences

Only function template specializations are exempt from being added to
the NameBackReferences.  Redundant variable template specializations
should be appropriately substituted.

llvm-svn: 256623

9 years ago[MS ABI] Improve our mangling of pass_object_size
David Majnemer [Wed, 30 Dec 2015 05:13:03 +0000 (05:13 +0000)]
[MS ABI] Improve our mangling of pass_object_size

We didn't add the artificial pass_object_size arguments to the
backreference map which bloated the size of manglings which involved
pass_object_size with duplicate types.

This lets us go from:
?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@0W4__pass_object_size1@3@@Z

to:
?qux@PassObjectSize@@YAHQAHW4__pass_object_size1@__clang@@01@Z

llvm-svn: 256622

9 years agoFix locale feature testing in test suite.
Eric Fiselier [Wed, 30 Dec 2015 04:45:42 +0000 (04:45 +0000)]
Fix locale feature testing in test suite.

llvm-svn: 256621

9 years ago[ptr-traits] Implement the base pointer traits using the actual
Chandler Carruth [Wed, 30 Dec 2015 04:00:24 +0000 (04:00 +0000)]
[ptr-traits] Implement the base pointer traits using the actual
alignment of the pointee type!

This is the culmination of the ptr-traits work. Now the compiler will
catch me if I try to use a pointer to an empty struct as a key in
a dense map or inside a PointerIntPair or PointerUnion! This is much,
much better than sometimes corrupting data (and other times working
fine) due to insufficient alignment.

It also means that we will be much more diligent about rejecting other
uses of these constructs that aren't safe.

It also means that we can now be more aggressive with the constructs
when we actually have guaranteed higher alignment without specializing
stuff. I'll be going through and cleaning up all the current overrides
of these traits which are no longer necessary.

Many thanks to Richard, David, and others who helped me get all of this
together.

llvm-svn: 256620

9 years agoFix alignment issue in CodeGenFunction::PopCleanupBlock.
James Y Knight [Wed, 30 Dec 2015 03:58:33 +0000 (03:58 +0000)]
Fix alignment issue in CodeGenFunction::PopCleanupBlock.

It was copying an EHCleanupStack::Cleanup object into a
SmallVector<char>, with a comment saying that SmallVector's alignment is
always large enough. Unfortunately, that isn't actually true after
r162331 in 2012.

Expand the code (somewhat distastefully) to get a stack allocation with
a correct alignment.

llvm-svn: 256619

9 years ago[ptr-traits] Refactor how PointerIntPair does its pointer manipulation
Chandler Carruth [Wed, 30 Dec 2015 03:56:19 +0000 (03:56 +0000)]
[ptr-traits] Refactor how PointerIntPair does its pointer manipulation
to isolate it in a dependent helper class.

Without doing this, we end up requiring all of the pointer traits the
moment you even define a PointerIntPair. That makes them *incredibly*
hard to use, for example you can't use them at all inside a class for
pointers to that class!

This change sinks all the logic into a helper template class that only
needs to be fully instantiated when *using* the PointerIntPair. We still
get compile-time checking, but it is deferred long enough to make
tradition out-of-line method definitions (or just the normal deferred
method body parsing) sufficient to handle cycling references.

llvm-svn: 256618

9 years ago[ptr-traits] Add one more #include necessary to do strict alignment
Chandler Carruth [Wed, 30 Dec 2015 03:56:17 +0000 (03:56 +0000)]
[ptr-traits] Add one more #include necessary to do strict alignment
checking of pointers used in PointerIntPairs.

llvm-svn: 256617

9 years ago[ptr-traits] Add an #include to provide the complete type for Section
Chandler Carruth [Wed, 30 Dec 2015 03:48:24 +0000 (03:48 +0000)]
[ptr-traits] Add an #include to provide the complete type for Section
which is the pointee in a pointer keyed DenseMap.

Pointer keys in a DenseMap have their low bits used by the map
implementation and in order to do this safely we need to know the
alignment of the pointer. We can only do this if we have the complete
type of the pointee. This is part of larger cleanup across LLVM and
subprojects to allow us to start enforcing this strictly.

llvm-svn: 256616

9 years ago[ptr-traits] Add #includes of headers rather than forward declarations
Chandler Carruth [Wed, 30 Dec 2015 03:40:23 +0000 (03:40 +0000)]
[ptr-traits] Add #includes of headers rather than forward declarations
for types which are used as pointees in PointerUnions, PointerIntPairs,
and DenseMap pointer keys.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

I think this is the last patch for getting Clang clean here!!!

llvm-svn: 256615

9 years agoRevert r256606 due to compiler-rt sanitizer bot failures
Eric Fiselier [Wed, 30 Dec 2015 03:39:03 +0000 (03:39 +0000)]
Revert r256606 due to compiler-rt sanitizer bot failures

llvm-svn: 256614

9 years ago[ptr-traits] Move a class definition up to the top of this header so it
Chandler Carruth [Wed, 30 Dec 2015 03:33:22 +0000 (03:33 +0000)]
[ptr-traits] Move a class definition up to the top of this header so it
can be referenced as part of a PointerIntPair.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

llvm-svn: 256613

9 years ago[ptr-traits] Move methods manipulating PointerUnions, DenseMap pointer
Chandler Carruth [Wed, 30 Dec 2015 03:24:14 +0000 (03:24 +0000)]
[ptr-traits] Move methods manipulating PointerUnions, DenseMap pointer
keys, and PointerIntPairs where the pointee types are incomplete
out-of-line to where we have the complete type.

This is the standard pattern used throughout the AST library to address
the inherently mutually cross referenced nature of the AST.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

llvm-svn: 256612

9 years ago[ptr-traits] Switch the Redeclarable template to using a void pointer in
Chandler Carruth [Wed, 30 Dec 2015 03:09:25 +0000 (03:09 +0000)]
[ptr-traits] Switch the Redeclarable template to using a void pointer in
its PointerUnion rather than an ASTContext pointer.

Using pointers with PointerUnion really should be checking the pointee
type's alignment, and we can't do this without the complete type. The
Redeclarable template inherently can't know the complete type of
ASTContext because of its layering, and because it is a template its
methods can't reasonably be out-of-line the way we traditionally solve
circular references within the AST library.

After discussing this with Richard Smith, his suggestion which I have
implemented here was to just drop to a void* for the PointerUnion. This
essentially documents that we're going to completely ignore the type
(including its potential alignment consequences) for this code. There
are still of course dynamic guards that this ended up working correctly,
and because of the way the code is factored this doesn't leak outside of
the very narrow implementation guts of Redeclarable.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

llvm-svn: 256611

9 years ago[ptr-traits] Switch from a really wasteful SmallDenseMap of
Chandler Carruth [Wed, 30 Dec 2015 03:00:23 +0000 (03:00 +0000)]
[ptr-traits] Switch from a really wasteful SmallDenseMap of
SmallVector<.., 16> (16!!!!) objects to a simple SmallVector of pairs.

This no longer de-duplicates the common function pointers used during
deallocation, but this doesn't really seem worth the complexity and
overhead of managing the map-of-vectors. Notably, there is no reason to
assume that functions have the 4-byte alignment that DenseMap relies on,
and indeed this prevents checking the alignment of the DenseMap keys
because we can't even meaningfully query the alignment of functions
using our existing alignment tools.

Generally, function pointers don't seem like a great idea for keys in
a DenseMap. =]

I chatted with Richard Smith about this a bit as well and have written
down a FIXME because this *does* waste some memory and in general seems
a very clumsy memory management strategy. He would like to see a more
fundamental fix eventually here that tries to build a better pattern.

llvm-svn: 256610

9 years ago[ptr-traits] Stop using two bogus types as stand-ins for flags
Chandler Carruth [Wed, 30 Dec 2015 02:51:00 +0000 (02:51 +0000)]
[ptr-traits] Stop using two bogus types as stand-ins for flags
indicating the nature of the default argument in a ParmVarDecl.

Instead, this adds a proper enum stored exclusively in the ParmVarDecl
bits (which we have plenty of) for this. This even allows us to track
a previously unrepresented state in Clang when we parse a function
declaration with a default argument on a parameter but we cannot even
form an invalid expression node (for example, it is an invalid token).
Now, we can model this state in the AST at least, and potentially
improve recovery in this area in the future.

I've also cleaned up the functions managing both variable initializer
expressions and parameter default argument expresssions as much as
possible. I've left some comments about further improvements based on
a discussion with Richard Smith. Lots of credit to him for walking me
through exactly which of the *many* tradeoffs here he felt was the best
fit.

Should be NFC for now. I've tried my best to preserve existing behavior.

This is part of a series of patches to allow LLVM to check for complete
pointee types when computing its pointer traits. This is absolutely
necessary to get correct (or reproducible) results for things like how
many low bits are guaranteed to be zero.

llvm-svn: 256609

9 years ago[TrailingObjects] Convert CastExpr and subclasses.
James Y Knight [Wed, 30 Dec 2015 02:27:28 +0000 (02:27 +0000)]
[TrailingObjects] Convert CastExpr and subclasses.

llvm-svn: 256608

9 years agoClean up this code, NFC.
Richard Smith [Wed, 30 Dec 2015 01:06:52 +0000 (01:06 +0000)]
Clean up this code, NFC.

llvm-svn: 256607