platform/upstream/llvm.git
8 years agoAMDGPU: Fix bug causing crash due to invalid opencl version metadata.
Yaxun Liu [Wed, 20 Jul 2016 14:38:06 +0000 (14:38 +0000)]
AMDGPU: Fix bug causing crash due to invalid opencl version metadata.

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

llvm-svn: 276119

8 years ago[ELF] - Fixed integral constant overflow warning under MSVS 2015. NFC.
George Rimar [Wed, 20 Jul 2016 14:26:48 +0000 (14:26 +0000)]
[ELF] - Fixed integral constant overflow warning under MSVS 2015. NFC.

Under MSVS 2015 I observed integral constant overflow warning when aggregate initialization was used
to init the bit field. Patch fixes that.

llvm-svn: 276118

8 years ago[compiler-rt] [XRay] Basic initialization and flag definition for XRay runtime
Dean Michael Berris [Wed, 20 Jul 2016 14:14:50 +0000 (14:14 +0000)]
[compiler-rt] [XRay] Basic initialization and flag definition for XRay runtime

Summary:
This patch implements the initialisation and patching routines for the XRay runtime, along with the necessary trampolines for function entry/exit handling. For now we only define the basic hooks for allowing an implementation to define a handler that gets run on function entry/exit. We expose a minimal API for controlling the behaviour of the runtime (patching, cleanup, and setting the handler to invoke when instrumenting).

Depends on D19904

Reviewers: echristo, kcc, rnk

Subscribers: rnk, mehdi_amini, llvm-commits

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

llvm-svn: 276117

8 years agotsan: fix windows build
Dmitry Vyukov [Wed, 20 Jul 2016 12:50:49 +0000 (12:50 +0000)]
tsan: fix windows build

It's only asan that installs vectored SEH handler to map memory lazily.

llvm-svn: 276112

8 years agoclang-tidy modernize-loop-convert: preserve type of alias declaration (bug 28341)
Matthias Gehre [Wed, 20 Jul 2016 12:32:06 +0000 (12:32 +0000)]
clang-tidy modernize-loop-convert: preserve type of alias declaration (bug 28341)

Summary:
Previoly, the added test failed with the fillowing fixit:

     char v[5];

-    for(size_t i = 0; i < 5; ++i)
+    for(char value : v)
     {
-        unsigned char value = v[i];
         if (value > 127)

i.e. the variable 'value' changes from unsigned char to signed char. And
thus the following 'if' does not work anymore.

With this commit, the fixit is changed to:
     char v[5];

-    for(size_t i = 0; i < 5; ++i)
+    for(unsigned char value : v)
     {
-        unsigned char value = v[i];
         if (value > 127)

Reviewers: alexfh, klimek

Subscribers: cfe-commits

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

llvm-svn: 276111

8 years ago[clang-tidy] readability-identifier-naming - support for other case types
Kirill Bobyrev [Wed, 20 Jul 2016 12:28:38 +0000 (12:28 +0000)]
[clang-tidy] readability-identifier-naming - support for other case types

Added Camel_Snake_Case and camel_Snake_Back

class Camel_Snake_Case_Class_Name
{
  void private_Camel_Snake_Back_Method_Name();
}

Patch by James Reynolds!

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 276110

8 years ago[docs] Fixing Sphinx warnings to unclog the buildbot
Renato Golin [Wed, 20 Jul 2016 12:16:38 +0000 (12:16 +0000)]
[docs] Fixing Sphinx warnings to unclog the buildbot

Lots of blocks had "llvm" or "nasm" syntax types but either weren't following
the syntax, or the syntax has changed (and sphinx hasn't keep up) or the type
doesn't even exist (nasm?).

Other documents had :options: what were invalid. I only removed those that had
warnings, and left the ones that didn't, in order to follow the principle of
least surprise.

This is like this for ages, but the buildbot is now failing on errors. It may
take a while to upgrade the buildbot's sphinx, if that's even possible, but
that shouldn't stop us from getting docs updates (which seem down for quite
a while).

Also, we're not losing any syntax highlight, since when it doesn't parse, it
doesn't colour. Ie. those blocks are not being highlighted anyway.

I'm trying to get all docs in one go, so that it's easy to revert later if we
do fix, or at least easy to know what's to fix.

llvm-svn: 276109

8 years agoAvoid some binary searches.
Rafael Espindola [Wed, 20 Jul 2016 11:47:50 +0000 (11:47 +0000)]
Avoid some binary searches.

In here we are iterating relocations in order, so we can do the same
with the pieces of .eh_frame and avoid a binary search.

The link times I got with this patch were:

firefox
  master 7.22977811
  patch  7.141041442 0.987726225252
chromium
  master 4.478966851
  patch  4.506602207 1.00617002914
chromium fast
  master 1.894713371
  patch  1.866446889 0.98508139414
the gold plugin
  master 0.386193907
  patch  0.382374918 0.990111213743
clang
  master 0.654849589
  patch  0.647899815 0.989387220949
llvm-as
  master 0.037212718
  patch  0.036858172 0.990472450843
the gold plugin fsds
  master 0.410876711
  patch  0.407418613 0.991583611562
clang fsds
  master 0.734623069
  patch  0.728237526 0.991307728726
llvm-as fsds
  master 0.033446197
  patch  0.03302833 0.987506292569
scylla
  master 3.38134402
  patch  3.414188846 1.00971354166

llvm-svn: 276108

8 years agotsan: fix windows build
Dmitry Vyukov [Wed, 20 Jul 2016 11:43:52 +0000 (11:43 +0000)]
tsan: fix windows build

Currently fails as:

gotsan.cc: In function 'void* __sanitizer::__libc_memalign(__sanitizer::uptr, __sanitizer::uptr)':
gotsan.cc:6194:50: error: 'posix_memalign' was not declared in this scope
   uptr error = posix_memalign(&p, alignment, size);

Windows does not provide posix_memalign.

llvm-svn: 276107

8 years agoRevert "[InstCombine] Enable cast-folding in logic(cast(icmp), cast(icmp))"
Benjamin Kramer [Wed, 20 Jul 2016 11:40:16 +0000 (11:40 +0000)]
Revert "[InstCombine] Enable cast-folding in logic(cast(icmp), cast(icmp))"

Makes InstCombine infloop when compiling v8.

This reverts commit r275989 and r276105.

llvm-svn: 276106

8 years ago[InstCombine] Provide more test cases for cast-folding [NFC]
Tobias Grosser [Wed, 20 Jul 2016 11:24:27 +0000 (11:24 +0000)]
[InstCombine] Provide more test cases for cast-folding [NFC]

Summary: In r275989 we enabled the folding of `logic(cast(icmp), cast(icmp))` to `cast(logic(icmp, icmp))`. Here we add more test cases to assure this folding works for all logical operations `and`/`or`/`xor`.

Reviewers: grosser

Subscribers: llvm-commits

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

Contributed-by: Matthias Reisinger
llvm-svn: 276105

8 years ago[X86][SSE] Add cost model values for CTPOP of vectors
Simon Pilgrim [Wed, 20 Jul 2016 10:41:28 +0000 (10:41 +0000)]
[X86][SSE] Add cost model values for CTPOP of vectors

This patch adds costs for the vectorized implementations of CTPOP, the default values were seriously underestimating the cost of these and was encouraging vectorization on targets where serialized use of POPCNT would be much better.

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

llvm-svn: 276104

8 years agotsan: fix leak of shadow stacks
Dmitry Vyukov [Wed, 20 Jul 2016 10:29:08 +0000 (10:29 +0000)]
tsan: fix leak of shadow stacks

llvm-svn: 276103

8 years ago[X86][SSE] Reimplement SSE fp2si conversion intrinsics instead of using generic IR
Simon Pilgrim [Wed, 20 Jul 2016 10:18:01 +0000 (10:18 +0000)]
[X86][SSE] Reimplement SSE fp2si conversion intrinsics instead of using generic IR

D20859 and D20860 attempted to replace the SSE (V)CVTTPS2DQ and VCVTTPD2DQ truncating conversions with generic IR instead.

It turns out that the behaviour of these intrinsics is different enough from generic IR that this will cause problems, INF/NAN/out of range values are guaranteed to result in a 0x80000000 value - which plays havoc with constant folding which converts them to either zero or UNDEF. This is also an issue with the scalar implementations (which were already generic IR and what I was trying to match).

This patch changes both scalar and packed versions back to using x86-specific builtins.

It also deals with the other scalar conversion cases that are runtime rounding mode dependent and can have similar issues with constant folding.

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

llvm-svn: 276102

8 years ago[ARM] Skip inline asm memory operands in DAGToDAGISel
Diana Picus [Wed, 20 Jul 2016 09:48:24 +0000 (09:48 +0000)]
[ARM] Skip inline asm memory operands in DAGToDAGISel

Retry r275776 (no changes, we suspect the issue was with another commit).

The current logic for handling inline asm operands in DAGToDAGISel interprets
the operands by looking for constants, which should represent the flags
describing the kind of operand we're dealing with (immediate, memory, register
def etc). The operands representing actual data are skipped only if they are
non-const, with the exception of immediate operands which are skipped explicitly
when a flag describing an immediate is found.

The oversight is that memory operands may be const too (e.g. for device drivers
reading a fixed address), so we should explicitly skip the operand following a
flag describing a memory operand. If we don't, we risk interpreting that
constant as a flag, which is definitely not intended.

Fixes PR26038

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

llvm-svn: 276101

8 years ago[docs] fix cmake code-block warning
Renato Golin [Wed, 20 Jul 2016 09:47:09 +0000 (09:47 +0000)]
[docs] fix cmake code-block warning

This will unblock the llvm-sphinx-buildbot, which is currently failing due
to a warning being treated as error.

llvm-svn: 276100

8 years ago[docs] Add proposals to index file
Renato Golin [Wed, 20 Jul 2016 09:38:04 +0000 (09:38 +0000)]
[docs] Add proposals to index file

llvm-svn: 276099

8 years ago[include-fixer] Make error messages a bit prettier and make sure to
Benjamin Kramer [Wed, 20 Jul 2016 09:12:19 +0000 (09:12 +0000)]
[include-fixer] Make error messages a bit prettier and make sure to
include a newline at the end.

llvm-svn: 276098

8 years ago[docs] GitHub Proposal for LLVM
Renato Golin [Wed, 20 Jul 2016 09:09:58 +0000 (09:09 +0000)]
[docs] GitHub Proposal for LLVM

This document was crafted from the various (320+) emails between 2nd June and
20th July regarding the move to GitHub. It tried to consolidate every issue that
was raised and every solution that was presented to have a GitHub repository
with sub-modules.

It *does not* try to argue whether sub-modules are better or worse than any other
Git solution, nor if Git is better than any other VCS, nor if GitHub is better
than any other free code hosting service. This is just the final conclusions of
48 days and 320 emails (plus a lot of IRC discussions) on the LLVM community.

This document will be presented at the survey that the foundation will setup for
us to decide if we move to this solution or not. It reflects what was discussed
on the lists, but it's not authoritative. If something is not clear enough,
please refer to the mailing list discussions (hint: search for "GitHub").

Review: https://reviews.llvm.org/D22463
llvm-svn: 276097

8 years ago[include-fixer] Tweak: remove unintended const.
Haojian Wu [Wed, 20 Jul 2016 09:00:22 +0000 (09:00 +0000)]
[include-fixer] Tweak: remove unintended const.

llvm-svn: 276096

8 years agoSupport for standard model ARM TLS
Peter Smith [Wed, 20 Jul 2016 08:52:27 +0000 (08:52 +0000)]
Support for standard model ARM TLS

Add relocations and identification functions for the Initial Exec
and Global Dynamic TLS model defined in Addenda to, and Errata in,
the ABI for the ARM Architecture.

ARM uses variant 1 of the thread local storage data
structures as defined in ELF Handling for Thread-Local Storage.

The "experimental" descriptor based model that can be selected in
gcc, but not clang with -mtls-dialect=gnu2 is not supported.

The relocations R_ARM_TLS_LE12 and R_ARM_TLS_IE12GP are not
supported, I know of no ARM Toolchain that supports these relocations
as they limit the size of the TLS block.

No code relaxation is supported as the standard ARM TLS model puts
the relocations on literal data.

Support for the local dynamic model will come in a follow up patch.

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

llvm-svn: 276095

8 years agoUpdate isl to isl-0.17.1-171-g233f589
Tobias Grosser [Wed, 20 Jul 2016 07:52:42 +0000 (07:52 +0000)]
Update isl to isl-0.17.1-171-g233f589

This fixes an issue with equality detection that resulted in an assertion
being triggered during coalescing.

llvm-svn: 276094

8 years agoFix inheriting constructor test for std::function.
Eric Fiselier [Wed, 20 Jul 2016 06:46:22 +0000 (06:46 +0000)]
Fix inheriting constructor test for std::function.

The test I originally checked in only worked with ToT Clang. This patch
updates the test so that it works as far back as 3.5.

llvm-svn: 276093

8 years agoUnbreak is_constructible tests for Clang <= 3.7.
Eric Fiselier [Wed, 20 Jul 2016 06:36:11 +0000 (06:36 +0000)]
Unbreak is_constructible tests for Clang <= 3.7.

There is a bug in Clang's __is_constructible builtin that causes it
to return true for function types; ex [T = void()].

llvm-svn: 276092

8 years agoAdd missed test in r276090.
Eric Fiselier [Wed, 20 Jul 2016 05:22:35 +0000 (05:22 +0000)]
Add missed test in r276090.

llvm-svn: 276091

8 years agoMove std::function constructor SFINAE into template parameter list. Fixes PR20002.
Eric Fiselier [Wed, 20 Jul 2016 05:21:00 +0000 (05:21 +0000)]
Move std::function constructor SFINAE into template parameter list. Fixes PR20002.

Although inheriting constructors have already been fixed in Clang 3.9 I still
choose to fix std::function so users can derive from it with older compilers.

llvm-svn: 276090

8 years agoMinor cleanup -- clear name structure before parsing
Xinliang David Li [Wed, 20 Jul 2016 05:10:56 +0000 (05:10 +0000)]
Minor cleanup -- clear name structure before parsing

llvm-svn: 276089

8 years ago[AVX512] Add a missing NoVLX to give priority to the AVX512 version of the pattern.
Craig Topper [Wed, 20 Jul 2016 05:05:50 +0000 (05:05 +0000)]
[AVX512] Add a missing NoVLX to give priority to the AVX512 version of the pattern.

llvm-svn: 276088

8 years ago[X86] Use 'HasAVX1Only' to properly give priority to the AVX2 version without relying...
Craig Topper [Wed, 20 Jul 2016 05:05:48 +0000 (05:05 +0000)]
[X86] Use 'HasAVX1Only' to properly give priority to the AVX2 version without relying on file ordering.

llvm-svn: 276087

8 years ago[X86] Create some multiclasses to reduce the repeated patterns for VEXTRACT(F/I)128...
Craig Topper [Wed, 20 Jul 2016 05:05:46 +0000 (05:05 +0000)]
[X86] Create some multiclasses to reduce the repeated patterns for VEXTRACT(F/I)128/VINSERT(I/F)128. NFC

llvm-svn: 276086

8 years ago[X86] Create some wrapper multiclasses to create AVX and SSE shift instructions with...
Craig Topper [Wed, 20 Jul 2016 05:05:44 +0000 (05:05 +0000)]
[X86] Create some wrapper multiclasses to create AVX and SSE shift instructions with less repeated code. NFC

llvm-svn: 276085

8 years agoReimplement is_constructible fallback implementation. Fixes PR21574.
Eric Fiselier [Wed, 20 Jul 2016 05:01:24 +0000 (05:01 +0000)]
Reimplement is_constructible fallback implementation. Fixes PR21574.

The previous implementation relied highly on specializations to handle
special cases. This new implementation lets the compiler do the work when possible.

llvm-svn: 276084

8 years ago[Profile] implement interface to get profile path prefix
Xinliang David Li [Wed, 20 Jul 2016 04:26:09 +0000 (04:26 +0000)]
[Profile] implement interface to get profile path prefix

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

llvm-svn: 276083

8 years agoForgot to add a test for r276008.
David Majnemer [Wed, 20 Jul 2016 04:13:05 +0000 (04:13 +0000)]
Forgot to add a test for r276008.

llvm-svn: 276082

8 years agoRevert "Disable this-return argument forwarding on ARM/AArch64"
David Majnemer [Wed, 20 Jul 2016 04:13:01 +0000 (04:13 +0000)]
Revert "Disable this-return argument forwarding on ARM/AArch64"

Inference of the 'returned' attribute was fixed in r276008, lets try
turning the backend support back on.

This reverts commit r275677.

llvm-svn: 276081

8 years ago[LV] Add hotness attribute to missed-optimization remarks
Adam Nemet [Wed, 20 Jul 2016 04:03:43 +0000 (04:03 +0000)]
[LV] Add hotness attribute to missed-optimization remarks

The new OptimizationRemarkEmitter analysis pass is hooked up to both new
and old PM passes.

llvm-svn: 276080

8 years agoAdd a default-value bool flag pretty_print to the StructuredData Dump methods.
Jason Molenda [Wed, 20 Jul 2016 03:49:02 +0000 (03:49 +0000)]
Add a default-value bool flag pretty_print to the StructuredData Dump methods.
They will dump pretty-print (indentation, extra whitepsace) by default.
I'll make a change to ProcessGDBRemote soon so it stops sending JSON strings
to debugserver pretty-printed; it's unnecessary extra bytes being sent between
the two.

llvm-svn: 276079

8 years agoAdd tests for reference binding assertions in std::tuple.
Eric Fiselier [Wed, 20 Jul 2016 02:57:39 +0000 (02:57 +0000)]
Add tests for reference binding assertions in std::tuple.

Libc++ provides static assertions to detect reference binding issues inside
tuple. This patch adds tests for those diagnostics.

It should be noted that these static assertions technically violate the
standard since it allows these illegal bindings to occur.

Also see https://llvm.org/bugs/show_bug.cgi?id=20855

llvm-svn: 276078

8 years agoRevert "Revert r275883 and r275891. They seem to cause PR28608."
Michael Zolotukhin [Wed, 20 Jul 2016 01:55:27 +0000 (01:55 +0000)]
Revert "Revert r275883 and r275891. They seem to cause PR28608."

This reverts commit r276064, and thus reapplies r275891 and r275883 with
a fix for PR28608.

llvm-svn: 276077

8 years ago[Sema] Compute the nullability of a conditional expression based on the
Akira Hatanaka [Wed, 20 Jul 2016 01:48:11 +0000 (01:48 +0000)]
[Sema] Compute the nullability of a conditional expression based on the
nullabilities of its operands.

This patch defines a function to compute the nullability of conditional
expressions, which enables Sema to precisely detect implicit conversions
of nullable conditional expressions to nonnull pointers.

rdar://problem/25166556

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

llvm-svn: 276076

8 years agollvm-readobj: add some more aliases
Saleem Abdulrasool [Wed, 20 Jul 2016 01:16:28 +0000 (01:16 +0000)]
llvm-readobj: add some more aliases

Alias -d and -t from readelf in llvm-readobj which effectively replaces the
tool.

llvm-svn: 276075

8 years agoRevert r276069: MSVC bots not happy
Hubert Tong [Wed, 20 Jul 2016 01:05:31 +0000 (01:05 +0000)]
Revert r276069: MSVC bots not happy

llvm-svn: 276074

8 years agoFix r276069: add default argument for new parameter
Hubert Tong [Wed, 20 Jul 2016 00:57:56 +0000 (00:57 +0000)]
Fix r276069: add default argument for new parameter

llvm-svn: 276073

8 years ago[LSV] Don't assume that loads/stores appear in address order in the BB.
Justin Lebar [Wed, 20 Jul 2016 00:55:12 +0000 (00:55 +0000)]
[LSV] Don't assume that loads/stores appear in address order in the BB.

Summary:
getVectorizablePrefix previously didn't work properly in the face of
aliasing loads/stores.  It unwittingly assumed that the loads/stores
appeared in the BB in address order.  If they didn't, it would do the
wrong thing.

Reviewers: asbirlea, tstellarAMD

Subscribers: arsenm, llvm-commits, mzolotukhin

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

llvm-svn: 276072

8 years agoFix r276069: use LLVM_CONSTEXPR
Hubert Tong [Wed, 20 Jul 2016 00:41:30 +0000 (00:41 +0000)]
Fix r276069: use LLVM_CONSTEXPR

llvm-svn: 276071

8 years agoFixing a few places in this doc which look like obvious typos.
Yunzhong Gao [Wed, 20 Jul 2016 00:40:54 +0000 (00:40 +0000)]
Fixing a few places in this doc which look like obvious typos.

llvm-svn: 276070

8 years agoConcepts: Create space for requires-clause in TemplateParameterList; NFC
Hubert Tong [Wed, 20 Jul 2016 00:30:15 +0000 (00:30 +0000)]
Concepts: Create space for requires-clause in TemplateParameterList; NFC

Summary:
Space for storing the //constraint-expression// of the
//requires-clause// associated with a `TemplateParameterList` is
arranged by taking a bit out of the `NumParams` field for the purpose
of determining whether there is a //requires-clause// or not, and by
adding to the trailing objects tied to the `TemplateParameterList`. An
accessor is provided.

An appropriate argument is supplied to `TemplateParameterList::Create`
at the various call sites.

Serialization changes will addressed as the Concepts implementation
becomes more solid.

Drive-by fix:
This change also replaces the custom
`FixedSizeTemplateParameterListStorage` implementation with one that
follows the interface provided by `llvm::TrailingObjects`.

Reviewers: aaron.ballman, faisalv, rsmith

Subscribers: cfe-commits, nwilson

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

llvm-svn: 276069

8 years agoRevert "RegScavenging: Add scavengeRegisterBackwards()"
Matthias Braun [Wed, 20 Jul 2016 00:21:32 +0000 (00:21 +0000)]
Revert "RegScavenging: Add scavengeRegisterBackwards()"

Reverting this commit for now as it seems to be causing failures on
test-suite tests on the clang-ppc64le-linux-lnt bot.

This reverts commit r276044.

llvm-svn: 276068

8 years agoAdd SFINAE on additional overloads of std::complex functions. Fixes PR19921.
Eric Fiselier [Wed, 20 Jul 2016 00:14:10 +0000 (00:14 +0000)]
Add SFINAE on additional overloads of std::complex functions. Fixes PR19921.

The functions arg, conj, imag, norm, proj, and real have additional overloads
for arguments of integral or floating point types. However these overloads should
not allow conversions to the integral/floating point types, only exact matches.

This patch constrains these functions so they no longer allow conversions.

llvm-svn: 276067

8 years agoCodegen: Tail Duplication: Only duplicate into layout pred if it is a CFG Pred.
Kyle Butt [Wed, 20 Jul 2016 00:01:51 +0000 (00:01 +0000)]
Codegen: Tail Duplication: Only duplicate into layout pred if it is a CFG Pred.

Add a check that the layout predecessor of a block is an actual CFG
predecssor of the block as well. No current code fails this check, but
upcoming patches can trigger this, and it makes sense to separate it
out.

llvm-svn: 276066

8 years agos/Cocoa/Foundation/
Enrico Granata [Tue, 19 Jul 2016 23:58:23 +0000 (23:58 +0000)]
s/Cocoa/Foundation/

llvm-svn: 276065

8 years agoRevert r275883 and r275891. They seem to cause PR28608.
Sean Silva [Tue, 19 Jul 2016 23:54:29 +0000 (23:54 +0000)]
Revert r275883 and r275891. They seem to cause PR28608.

Revert "[LoopSimplify] Update LCSSA after separating nested loops."

This reverts commit r275891.

Revert "[LCSSA] Post-process PHI-nodes created by SSAUpdate when constructing LCSSA form."

This reverts commit r275883.

llvm-svn: 276064

8 years ago[PM] Port LoopUnroll.
Sean Silva [Tue, 19 Jul 2016 23:54:23 +0000 (23:54 +0000)]
[PM] Port LoopUnroll.

We just set PreserveLCSSA to always true since we don't have an
analogous method `mustPreserveAnalysisID(LCSSA)`.

Also port LoopInfo verifier pass to test LoopUnrollPass.

llvm-svn: 276063

8 years agoCodegen: Factor out canTailDuplicate
Kyle Butt [Tue, 19 Jul 2016 23:54:21 +0000 (23:54 +0000)]
Codegen: Factor out canTailDuplicate

canTailDuplicate accepts two blocks and returns true if the first can be
duplicated into the second successfully. Use this function to
encapsulate the heuristic.

llvm-svn: 276062

8 years agoFix an issue where the libc++ std::list formatter wasn't recognizing the new memory...
Enrico Granata [Tue, 19 Jul 2016 23:50:31 +0000 (23:50 +0000)]
Fix an issue where the libc++ std::list formatter wasn't recognizing the new memory layout correctly

rdar://problem/26999542

llvm-svn: 276061

8 years agoThis code block breaks the docs build (http://lab.llvm.org:8011/builders/llvm-sphinx...
Aaron Ballman [Tue, 19 Jul 2016 23:50:11 +0000 (23:50 +0000)]
This code block breaks the docs build (lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/11925/steps/docs-llvm-html/logs/stdio). Setting the code highlighting to none instead of llvm.

llvm-svn: 276060

8 years agoAdd heterogeneous comparator support for __debug_less. Fixes PR17147.
Eric Fiselier [Tue, 19 Jul 2016 23:27:18 +0000 (23:27 +0000)]
Add heterogeneous comparator support for __debug_less. Fixes PR17147.

llvm-svn: 276059

8 years ago[ADT] Warn on unused results from ArrayRef and StringRef functions that read like...
Justin Lebar [Tue, 19 Jul 2016 23:19:25 +0000 (23:19 +0000)]
[ADT] Warn on unused results from ArrayRef and StringRef functions that read like they might mutate.

Summary:
Functions like "slice" and "drop_front" sound like they might mutate the
underlying object, but they don't.  Warning on unused results would have
saved me an hour yesterday, and I'm sure I'm not the only one.

LLVM and Clang are clean wrt this warning after D22540.

Reviewers: majnemer

Subscribers: sanjoy, chandlerc, llvm-commits

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

llvm-svn: 276058

8 years agoGet rid of call to StringRef::substr that's never used.
Justin Lebar [Tue, 19 Jul 2016 23:19:22 +0000 (23:19 +0000)]
Get rid of call to StringRef::substr that's never used.

Summary: substr doesn't modify the string, so this line has no effect.

Reviewers: majnemer

Subscribers: llvm-commits

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

llvm-svn: 276057

8 years ago[LSV] Insert stores at the right point.
Justin Lebar [Tue, 19 Jul 2016 23:19:20 +0000 (23:19 +0000)]
[LSV] Insert stores at the right point.

Summary:
Previously, the insertion point for stores was the last instruction in
Chain *before calling getVectorizablePrefixEndIdx*.  Thus if
getVectorizablePrefixEndIdx didn't return Chain.size(), we still would
insert at the last instruction in Chain.

This patch changes our internal API a bit in an attempt to make it less
prone to this sort of error.  As a result, we end up recalculating the
Chain's boundary instructions, but I think worrying about the speed hit
of this is a premature optimization right now.

Reviewers: asbirlea, tstellarAMD

Subscribers: mzolotukhin, arsenm, llvm-commits

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

llvm-svn: 276056

8 years ago[LSV] Use make_range, and reformat a DEBUG message. NFC
Justin Lebar [Tue, 19 Jul 2016 23:19:18 +0000 (23:19 +0000)]
[LSV] Use make_range, and reformat a DEBUG message. NFC

Summary:
The DEBUG message was hard to read because two Values were being printed
on the same line with only the delimiter "aliases".  This change makes
us print each Value on its own line.

Reviewers: asbirlea

Subscribers: llvm-commits, arsenm, mzolotukhin

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

llvm-svn: 276055

8 years ago[LSV] Nix two global (ish) variables in the LoadStoreVectorizer. NFC
Justin Lebar [Tue, 19 Jul 2016 23:19:16 +0000 (23:19 +0000)]
[LSV] Nix two global (ish) variables in the LoadStoreVectorizer.  NFC

Reviewers: asbirlea

Subscribers: mzolotukhin, llvm-commits, arsenm

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

llvm-svn: 276054

8 years ago[LSV] Add detail to correct-order.ll test.
Justin Lebar [Tue, 19 Jul 2016 23:18:59 +0000 (23:18 +0000)]
[LSV] Add detail to correct-order.ll test.

Summary:
This helps keep us honest -- there were a number of ways we could screw
up and still have passed this test.

Reviewers: asbirlea

Subscribers: llvm-commits, arsenm

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

llvm-svn: 276053

8 years ago[libFuzzer] extend the messages printed by afl_driver
Kostya Serebryany [Tue, 19 Jul 2016 23:18:28 +0000 (23:18 +0000)]
[libFuzzer] extend the messages printed by afl_driver

llvm-svn: 276052

8 years agoAMDGPU: Change fdiv lowering based on !fpmath metadata
Matt Arsenault [Tue, 19 Jul 2016 23:16:53 +0000 (23:16 +0000)]
AMDGPU: Change fdiv lowering based on !fpmath metadata

If 2.5 ulp is acceptable, denormals are not required, and
isn't a reciprocal which will already be handled, replace
with a faster fdiv.

Simplify the lowering tests by using per function
subtarget features.

llvm-svn: 276051

8 years agoFix unused variable
Daniel Berlin [Tue, 19 Jul 2016 23:08:08 +0000 (23:08 +0000)]
Fix unused variable

llvm-svn: 276050

8 years ago[libcxx] Add support for benchmark tests using Google Benchmark.
Eric Fiselier [Tue, 19 Jul 2016 23:07:03 +0000 (23:07 +0000)]
[libcxx] Add support for benchmark tests using Google Benchmark.

Summary:
This patch does the following:

1. Checks in a copy of the Google Benchmark library into the libc++ repo under `utils/google-benchmark`.
2. Teaches libc++ how to build Google Benchmark against both (A) in-tree libc++ and (B) the platforms native STL.
3. Allows performance benchmarks to be built as part of the libc++ build.

Building the benchmarks (and Google Benchmark) is off by default. It must be enabled using the CMake option `-DLIBCXX_INCLUDE_BENCHMARKS=ON`. When this option is enabled the tests under `libcxx/benchmarks`  can be built using the `libcxx-benchmarks` target.

On Linux platforms where libstdc++ is the default STL the CMake option `-DLIBCXX_BUILD_BENCHMARKS_NATIVE_STDLIB=ON` can be used to build each benchmark test against libstdc++ as well. This is useful for comparing performance between standard libraries.

Support for benchmarks is currently very minimal. They must be manually run by the user and there is no mechanism for detecting performance regressions.

Known Issues:

* `-DLIBCXX_INCLUDE_BENCHMARKS=ON` is only supported for Clang, and not GCC, since the `-stdlib=libc++` option is needed to build Google Benchmark.

Reviewers: danalbert, dberlin, chandlerc, mclow.lists, jroelofs

Subscribers: chandlerc, dberlin, tberghammer, danalbert, srhines, hfinkel

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

llvm-svn: 276049

8 years agoMake GVN Hoisting obey optnone/bisect.
Paul Robinson [Tue, 19 Jul 2016 22:57:14 +0000 (22:57 +0000)]
Make GVN Hoisting obey optnone/bisect.

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

llvm-svn: 276048

8 years agoMake MemorySSA::dominates/locallydominates constant time
Daniel Berlin [Tue, 19 Jul 2016 22:49:43 +0000 (22:49 +0000)]
Make MemorySSA::dominates/locallydominates constant time

Summary: Make MemorySSA::dominates/locallydominates constant time

Reviewers: george.burgess.iv, gberry

Subscribers: llvm-commits

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

llvm-svn: 276046

8 years agoAdd AIX support to Path.inc, Host.h, and CMake.
Chandler Carruth [Tue, 19 Jul 2016 22:46:39 +0000 (22:46 +0000)]
Add AIX support to Path.inc, Host.h, and CMake.

Patch by Andrew Paprocki!

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

llvm-svn: 276045

8 years agoRegScavenging: Add scavengeRegisterBackwards()
Matthias Braun [Tue, 19 Jul 2016 22:37:09 +0000 (22:37 +0000)]
RegScavenging: Add scavengeRegisterBackwards()

This is a variant of scavengeRegister() that works for
enterBasicBlockEnd()/backward(). The benefit of the backward mode is
that it is not affected by incomplete kill flags.

This patch also changes
PrologEpilogInserter::doScavengeFrameVirtualRegs() to use the register
scavenger in backwards mode.

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

llvm-svn: 276044

8 years agoRegisterScavenger: Introduce backward() mode.
Matthias Braun [Tue, 19 Jul 2016 22:37:02 +0000 (22:37 +0000)]
RegisterScavenger: Introduce backward() mode.

This adds two pieces:
- RegisterScavenger:::enterBasicBlockEnd() which behaves similar to
  enterBasicBlock() but starts tracking at the end of the basic block.
- A RegisterScavenger::backward() method. It is subtly different
  from the existing unprocess() method which only considers uses with
  the kill flag set: If a value is dead at the end of a basic block with
  a last use inside the basic block, unprocess() will fail to mark it as
  live. However we cannot change/fix this behaviour because unprocess()
  needs to perform the exact reverse operation of forward().

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

llvm-svn: 276043

8 years agoregenerate checks
Sanjay Patel [Tue, 19 Jul 2016 22:32:15 +0000 (22:32 +0000)]
regenerate checks

llvm-svn: 276042

8 years ago[AArch64] Properly validate the reciprocal estimation.
Evandro Menezes [Tue, 19 Jul 2016 22:31:11 +0000 (22:31 +0000)]
[AArch64] Properly validate the reciprocal estimation.

Add check for legal data types when expanding into a Newton series.

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

llvm-svn: 276041

8 years ago[Profile] Test cleanup -- use new lit var for IR PGO tests /NFC
Xinliang David Li [Tue, 19 Jul 2016 22:12:00 +0000 (22:12 +0000)]
[Profile] Test cleanup -- use new lit var for IR PGO tests /NFC

llvm-svn: 276036

8 years ago[InstCombine] fold add(zext(xor X, C), C) --> sext X when C is INT_MIN in the source...
Sanjay Patel [Tue, 19 Jul 2016 22:09:34 +0000 (22:09 +0000)]
[InstCombine] fold add(zext(xor X, C), C) --> sext X when C is INT_MIN in the source type

The pattern may look more obviously like a sext if written as:

  define i32 @g(i16 %x) {
    %zext = zext i16 %x to i32
    %xor = xor i32 %zext, 32768
    %add = add i32 %xor, -32768
    ret i32 %add
  }

We already have that fold in visitAdd().

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

llvm-svn: 276035

8 years ago[Profile] Introduce lit test vars for IR based instrumentation
Xinliang David Li [Tue, 19 Jul 2016 21:55:55 +0000 (21:55 +0000)]
[Profile] Introduce lit test vars for IR based instrumentation

llvm-svn: 276034

8 years agoDon't check the value of the unset variables on iOS
Enrico Granata [Tue, 19 Jul 2016 21:50:39 +0000 (21:50 +0000)]
Don't check the value of the unset variables on iOS

llvm-svn: 276033

8 years agoAttempt to appease MSVC buildbots.
George Burgess IV [Tue, 19 Jul 2016 21:35:47 +0000 (21:35 +0000)]
Attempt to appease MSVC buildbots.

Broken by r276026.

llvm-svn: 276032

8 years ago[asan] trying to fix the android bot
Kostya Serebryany [Tue, 19 Jul 2016 21:35:01 +0000 (21:35 +0000)]
[asan] trying to fix the android bot

llvm-svn: 276031

8 years ago[AMDGPU] Remove spurious line (should've been removed in r276029).
Davide Italiano [Tue, 19 Jul 2016 21:16:30 +0000 (21:16 +0000)]
[AMDGPU] Remove spurious line (should've been removed in r276029).

llvm-svn: 276030

8 years ago[AMDGPU] Remove dead code.
Davide Italiano [Tue, 19 Jul 2016 21:10:49 +0000 (21:10 +0000)]
[AMDGPU] Remove dead code.

LGTM'd by Matt Arsenault.

llvm-svn: 276029

8 years ago[CFLAA] Make a test tell the truth. NFC.
George Burgess IV [Tue, 19 Jul 2016 20:56:41 +0000 (20:56 +0000)]
[CFLAA] Make a test tell the truth. NFC.

Dishonesty noted by Jia Chen.

llvm-svn: 276028

8 years ago[Profile] introduce reusable internal interfaces to find dir separator \NFC
Xinliang David Li [Tue, 19 Jul 2016 20:48:00 +0000 (20:48 +0000)]
[Profile] introduce reusable internal interfaces to find dir separator \NFC

llvm-svn: 276027

8 years ago[CFLAA] Add some interproc. analysis to CFLAnders.
George Burgess IV [Tue, 19 Jul 2016 20:47:15 +0000 (20:47 +0000)]
[CFLAA] Add some interproc. analysis to CFLAnders.

This patch adds function summary support to CFLAnders. It also comes
with a lot of tests! Woohoo!

Patch by Jia Chen.

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

llvm-svn: 276026

8 years agoNext step along the way to getting good error messages for bad archives.
Kevin Enderby [Tue, 19 Jul 2016 20:47:07 +0000 (20:47 +0000)]
Next step along the way to getting good error messages for bad archives.

This step builds on Lang Hames work to change Archive::child_iterator
for better interoperation with Error/Expected.  Building on that it is now
possible to return an error message when the size field of an archive
contains non-decimal characters.

llvm-svn: 276025

8 years agoadd even more missing tests for simplifySelectBitTest()
Sanjay Patel [Tue, 19 Jul 2016 20:47:00 +0000 (20:47 +0000)]
add even more missing tests for simplifySelectBitTest()

llvm-svn: 276024

8 years ago[CFLAA] Teach CFLAnders to distinguish reads from writes.
George Burgess IV [Tue, 19 Jul 2016 20:38:21 +0000 (20:38 +0000)]
[CFLAA] Teach CFLAnders to distinguish reads from writes.

This patch adds more specific edges to CFLAndersAliasAnalysis. The goal
of these edges is to give us more information about *how* two values
that MayAlias alias. With this, we can now tell cases like

a = b; // ergo, a may alias b

apart from

a = c;
b = c;

// so, a may alias b, but only because they were both assigned to c.

...And others.

Patch by Jia Chen.

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

llvm-svn: 276023

8 years agoAttempt to bring peace to -Werror buildbots.
Richard Smith [Tue, 19 Jul 2016 20:35:09 +0000 (20:35 +0000)]
Attempt to bring peace to -Werror buildbots.

llvm-svn: 276022

8 years ago[Profile] move utility interfaces to the right header /NFC
Xinliang David Li [Tue, 19 Jul 2016 20:31:46 +0000 (20:31 +0000)]
[Profile] move utility interfaces to the right header /NFC

llvm-svn: 276021

8 years ago[SemaObjC] Improve ObjCDictionaryLiteral and ObjCArryLiteral diagnostics
Bruno Cardoso Lopes [Tue, 19 Jul 2016 20:21:18 +0000 (20:21 +0000)]
[SemaObjC] Improve ObjCDictionaryLiteral and ObjCArryLiteral diagnostics

Sema actions on ObjCDictionaryLiteral and ObjCArryLiteral are currently
done as a side-effect of Sema upon parent expressions, which incurs of
delayed typo corrections for such literals to be performed by TypoTransforms
upon the ObjCDictionaryLiteral and ObjCArryLiteral themselves instead of
its elements individually.

This is specially bad because it was not designed to act on several
elements; searching through all possible combinations of corrections for
several elements is very expensive. Additionally, when one of the
elements has no correction candidate, we still explore all options and
at the end emit no typo corrections whatsoever.

Do the proper sema actions by acting on each element alone during appropriate
literal parsing time to get proper diagonistics and decent compile time
behavior.

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

rdar://problem/21046678

llvm-svn: 276020

8 years ago[Profile] use portable macro /NFC
Xinliang David Li [Tue, 19 Jul 2016 20:20:20 +0000 (20:20 +0000)]
[Profile] use portable macro /NFC

llvm-svn: 276019

8 years agoThis code block breaks the docs build (http://lab.llvm.org:8011/builders/llvm-sphinx...
Aaron Ballman [Tue, 19 Jul 2016 20:20:03 +0000 (20:20 +0000)]
This code block breaks the docs build (lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/11921/steps/docs-llvm-html/logs/stdio). Setting the code highlighting to none instead of llvm to hopefully get the bot stumbling back towards green.

llvm-svn: 276018

8 years agoUse posix_fallocate instead of ftruncate.
Rafael Espindola [Tue, 19 Jul 2016 20:19:56 +0000 (20:19 +0000)]
Use posix_fallocate instead of ftruncate.

This makes sure that space is actually available. With this change
running lld on a full file system causes it to exit with

failed to open foo: No space left on device

instead of crashing with a sigbus.

llvm-svn: 276017

8 years ago[libcxxabi] When catching an exception of type nullptr_t with a handler of
Richard Smith [Tue, 19 Jul 2016 20:19:37 +0000 (20:19 +0000)]
[libcxxabi] When catching an exception of type nullptr_t with a handler of
pointer-to-member type, produce a null value of the right type.

This fixes a bug where throwing an exception of type nullptr_t and catching it
as a pointer-to-member would not guarantee to produce a null value in the catch
handler. The fix is pretty simple: we statically allocate a constant null
pointer-to-data-member representation and a constant null
pointer-to-member-function representation, and produce the address of the
relevant value as the adjusted pointer for the exception.

llvm-svn: 276016

8 years ago[tsan] Don't instrument __llvm_gcov_global_state_pred or __llvm_gcda*
Vedant Kumar [Tue, 19 Jul 2016 20:16:08 +0000 (20:16 +0000)]
[tsan] Don't instrument __llvm_gcov_global_state_pred or __llvm_gcda*

r274801 did not go far enough to allow gcov+tsan to cooperate. With this
commit it's possible to run the following code without false positives:

  std::thread T1(fib), T2(fib);
  T1.join(); T2.join();

llvm-svn: 276015

8 years agoLet FuncAttrs infer the 'returned' argument attribute
David Majnemer [Tue, 19 Jul 2016 19:59:24 +0000 (19:59 +0000)]
Let FuncAttrs infer the 'returned' argument attribute

This reverts commit r275756.

llvm-svn: 276014

8 years agoARM: move feature for Thumb2 pkhbt/pkhtb onto architectures.
Tim Northover [Tue, 19 Jul 2016 19:49:13 +0000 (19:49 +0000)]
ARM: move feature for Thumb2 pkhbt/pkhtb onto architectures.

There's not much functional change, but it really is an architectural feature
(on v6T2, v7A, v7R and v7EM) rather than something each CPU implements
individually.

The main functional change is the default behaviour you get when specifying
only "-triple".

llvm-svn: 276013

8 years ago[GlobalISel] Mark newly-created gvregs as having a bank.
Ahmed Bougacha [Tue, 19 Jul 2016 19:48:36 +0000 (19:48 +0000)]
[GlobalISel] Mark newly-created gvregs as having a bank.

Also verify that we never try to set the size of a vreg associated
to a register class.

Report an error when we encounter that in MIR. Fix a testcase that
hit that error and had a size for no reason.

llvm-svn: 276012

8 years ago[GlobalISel] Simplify more RegClassOrRegBank is+get. NFC.
Ahmed Bougacha [Tue, 19 Jul 2016 19:47:06 +0000 (19:47 +0000)]
[GlobalISel] Simplify more RegClassOrRegBank is+get. NFC.

llvm-svn: 276011