platform/upstream/llvm.git
6 years ago[hot-cold-split] Add missing FileCheck invocations
Teresa Johnson [Mon, 22 Oct 2018 17:57:02 +0000 (17:57 +0000)]
[hot-cold-split] Add missing FileCheck invocations

Summary:
r344558 added some CHECK statements to split-cold-2.ll, but didn't add
any invocations of FileCheck. Add those here.

Reviewers: sebpop

Subscribers: llvm-commits

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

llvm-svn: 344928

6 years ago[llvm-exegesis] Fix name lookup ambiguity in MSVC after 344922
Fangrui Song [Mon, 22 Oct 2018 17:52:31 +0000 (17:52 +0000)]
[llvm-exegesis] Fix name lookup ambiguity in MSVC after 344922

llvm-svn: 344927

6 years ago[X86] getTargetConstantBitsFromNode - handle extraction from larger constant pool...
Simon Pilgrim [Mon, 22 Oct 2018 17:43:33 +0000 (17:43 +0000)]
[X86] getTargetConstantBitsFromNode - handle extraction from larger constant pool entries

First step towards removing X86ShuffleDecodeConstantPool usage from X86ISelLowering.cpp

llvm-svn: 344924

6 years ago[llvm-exegesis] Move namespace exegesis inside llvm::
Fangrui Song [Mon, 22 Oct 2018 17:10:47 +0000 (17:10 +0000)]
[llvm-exegesis] Move namespace exegesis inside llvm::

Summary:
This allows simplifying references of llvm::foo with foo when the needs
come in the future.

Reviewers: courbet, gchatelet

Reviewed By: gchatelet

Subscribers: javed.absar, tschuett, llvm-commits

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

llvm-svn: 344922

6 years agoRevert r344877 "[X86] Stop promoting integer loads to vXi64"
Craig Topper [Mon, 22 Oct 2018 16:59:24 +0000 (16:59 +0000)]
Revert r344877 "[X86] Stop promoting integer loads to vXi64"

Sam McCall reported miscompiles in some tensorflow code. Reverting while I try to figure out.

llvm-svn: 344921

6 years ago[test] Relax test/Other/opt-hot-cold-split.ll
Vedant Kumar [Mon, 22 Oct 2018 16:50:24 +0000 (16:50 +0000)]
[test] Relax test/Other/opt-hot-cold-split.ll

On some ARM bots, 'Target Pass Configuration' does not run after 'Target
Transform Info'. Relax this pipeline test to allow that.

This is the same fix as in r328167.

Bot URL: http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/4611

llvm-svn: 344919

6 years ago[llvm-mca] Remove a couple of using directives and a bunch of redundant namespace...
Andrea Di Biagio [Mon, 22 Oct 2018 16:28:07 +0000 (16:28 +0000)]
[llvm-mca] Remove a couple of using directives and a bunch of redundant namespace llvm prefixes. NFC

llvm-svn: 344916

6 years agoEnsure sanitizer check function calls have a !dbg location
Adrian Prantl [Mon, 22 Oct 2018 16:27:41 +0000 (16:27 +0000)]
Ensure sanitizer check function calls have a !dbg location

Function calls without a !dbg location inside a function that has a
DISubprogram make it impossible to construct inline information and
are rejected by the verifier. This patch ensures that sanitizer check
function calls have a !dbg location, by carrying forward the location
of the preceding instruction or by inserting an artificial location if
necessary.

This fixes a crash when compiling the attached testcase with -Os.

rdar://problem/45311226

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

llvm-svn: 344915

6 years agoDAG: Change behavior of fminnum/fmaxnum nodes
Matt Arsenault [Mon, 22 Oct 2018 16:27:27 +0000 (16:27 +0000)]
DAG: Change behavior of fminnum/fmaxnum nodes

Introduce new versions that follow the IEEE semantics
to help with legalization that may need quieted inputs.

There are some regressions from inserting unnecessary
canonicalizes when these are matched from fast math
fcmp + select which should be fixed in a future commit.

llvm-svn: 344914

6 years agoSome cleanups to the native pdb plugin [NFC].
Zachary Turner [Mon, 22 Oct 2018 16:19:07 +0000 (16:19 +0000)]
Some cleanups to the native pdb plugin [NFC].

This is mostly some cleanup done in the process of implementing
some basic support for types.  I tried to split up the patch a
bit to get some of the NFC portion of the patch out into a separate
commit, and this is the result of that.  It moves some code around,
deletes some spurious namespace qualifications, removes some
unnecessary header includes, forward declarations, etc.

llvm-svn: 344913

6 years ago[clangd] Support URISchemes configuration in BackgroundIndex.
Eric Liu [Mon, 22 Oct 2018 15:37:58 +0000 (15:37 +0000)]
[clangd] Support URISchemes configuration in BackgroundIndex.

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

llvm-svn: 344912

6 years ago[llvm-mca] Use llvm::ArrayRef in class SourceMgr. NFCI
Andrea Di Biagio [Mon, 22 Oct 2018 15:36:15 +0000 (15:36 +0000)]
[llvm-mca] Use llvm::ArrayRef in class SourceMgr. NFCI

Class SourceMgr now uses type ArrayRef<MCInst> to reference the
sequence of code from a "CodeRegion".

llvm-svn: 344911

6 years ago[X86][SSE] getTargetShuffleMask - pull out repeated shuffle mask element size. NFCI.
Simon Pilgrim [Mon, 22 Oct 2018 15:33:30 +0000 (15:33 +0000)]
[X86][SSE] getTargetShuffleMask - pull out repeated shuffle mask element size. NFCI.

llvm-svn: 344910

6 years agoRevert "[PDB] Extend IPDBSession's interface to retrieve frame data"
Aleksandr Urakov [Mon, 22 Oct 2018 15:30:48 +0000 (15:30 +0000)]
Revert "[PDB] Extend IPDBSession's interface to retrieve frame data"

This reverts commit b5c7e2f9a4dbb34e3667c4bb4972735eadd3247a.

llvm-svn: 344909

6 years ago[InstCombine] add tests for shuffle+insert folds; NFC
Sanjay Patel [Mon, 22 Oct 2018 15:26:27 +0000 (15:26 +0000)]
[InstCombine] add tests for shuffle+insert folds; NFC

llvm-svn: 344908

6 years ago[llvm-exegesis] Crash when assembling invalid Operand
Guillaume Chatelet [Mon, 22 Oct 2018 15:06:10 +0000 (15:06 +0000)]
[llvm-exegesis] Crash when assembling invalid Operand

llvm-svn: 344907

6 years ago[llvm-exegesis] Mark x86 segment register instructions as unsupported.
Guillaume Chatelet [Mon, 22 Oct 2018 14:55:43 +0000 (14:55 +0000)]
[llvm-exegesis] Mark x86 segment register instructions as unsupported.

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 344906

6 years ago[llvm-exegesis] Reject x86 instructions that use non uniform memory accesses
Guillaume Chatelet [Mon, 22 Oct 2018 14:46:08 +0000 (14:46 +0000)]
[llvm-exegesis] Reject x86 instructions that use non uniform memory accesses

Reviewers: courbet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 344905

6 years ago[X86] X86DAGToDAGISel: handle BZHI selection too, not just BEXTR.
Roman Lebedev [Mon, 22 Oct 2018 14:12:44 +0000 (14:12 +0000)]
[X86] X86DAGToDAGISel: handle BZHI selection too, not just BEXTR.

Summary:
As discussed in D52304 / IRC, we now have pattern matching for
'bit extract' in two places - tablegen and `X86DAGToDAGISel`.
There are 4 patterns.
And we will have a problem with `x &  (-1 >> (32 - y))` pattern.
* If the mask is one-use, then it is always unfolded into `x << (32 - y) >> (32 - y)` first.
  Thus, the existing test coverage is already broken.
* If it is not one-use, then it is not unfolded, and is matched as BZHI.
* If it is not one-use, we will not match it as BEXTR. And if it is one-use, it will have been unfolded already.
So we will either not handle that pattern for BEXTR, or not have test coverage for it.
This is bad.

As discussed with @craig.topper, let's unify this matching, and do everything in `X86DAGToDAGISel`.
Then we will not have code duplication, and will have proper test coverage.

This indeed does not affect any tests, and this is great.
It means that for these two patterns, the `X86DAGToDAGISel` is identical to the tablegen version.

Please review carefully, i'm not fully sure about that intrinsic change, and introduction of the new `X86ISD` opcode.

Reviewers: craig.topper, RKSimon, spatel

Reviewed By: craig.topper

Subscribers: llvm-commits, craig.topper

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

llvm-svn: 344904

6 years agoDocument bisect-skip-count
David Greene [Mon, 22 Oct 2018 14:04:13 +0000 (14:04 +0000)]
Document bisect-skip-count

Provide an example of how to use bisect-skip count to find bugs.

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

llvm-svn: 344903

6 years ago[X86][BMI1]: X86DAGToDAGISel: select BEXTR from x & ((1 << nbits) + (-1)) pattern
Roman Lebedev [Mon, 22 Oct 2018 13:54:17 +0000 (13:54 +0000)]
[X86][BMI1]: X86DAGToDAGISel: select BEXTR from  x & ((1 << nbits) + (-1))  pattern

Summary:
Trivial continuation of D52304.
While this pattern is not canonical, we do select it in the BZHI case,
so this should not be any different.

Reviewers: RKSimon, craig.topper, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 344902

6 years agoAlways search sysroot for GCC installs
David Greene [Mon, 22 Oct 2018 13:46:12 +0000 (13:46 +0000)]
Always search sysroot for GCC installs

Previously, if clang was configured with -DGCC_INSTALL_PREFIX, then it
would not search a provided sysroot for a gcc install. This caused a
number of regression tests to fail.  If a sysroot is given, skip
searching GCC_INSTALL_PREFIX as it is likely not valid for the
provided sysroot.

llvm-svn: 344901

6 years agoTest commit: change comment.
Petar Avramovic [Mon, 22 Oct 2018 13:27:50 +0000 (13:27 +0000)]
Test commit: change comment.

llvm-svn: 344900

6 years agoFix typo in a test file name.
Rui Ueyama [Mon, 22 Oct 2018 13:15:19 +0000 (13:15 +0000)]
Fix typo in a test file name.

llvm-svn: 344899

6 years agoSilence the -Wshadow warning for enumerators shadowing a type.
Aaron Ballman [Mon, 22 Oct 2018 13:05:53 +0000 (13:05 +0000)]
Silence the -Wshadow warning for enumerators shadowing a type.

Amends r344259 so that enumerators shadowing types are not diagnosed, as shadowing under those circumstances is rarely (if ever) an issue in practice.

llvm-svn: 344898

6 years ago[change-namespace] Enhance detection of conflicting namespaces.
Eric Liu [Mon, 22 Oct 2018 12:48:49 +0000 (12:48 +0000)]
[change-namespace] Enhance detection of conflicting namespaces.

Summary:
For example:
```
namespace util { class Base; }

namespace new {
namespace util { class Internal; }
}

namespace old {
util::Base b1;
}
```

When changing `old::` to `new::`, `util::` in namespace "new::" will conflict
with "new::util::" unless a leading "::" is added.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 344897

6 years ago[llvm-dwarfdump] - Fix win10 build bot failture.
George Rimar [Mon, 22 Oct 2018 12:18:30 +0000 (12:18 +0000)]
[llvm-dwarfdump] - Fix win10 build bot failture.

Bot failed:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/20877/steps/test/logs/stdio

This was broken after the
r344895 "[llvm-dwarfdump] - Add the support of parsing .debug_loclists."
because of wrong formatting specifiers used.

llvm-svn: 344896

6 years ago[llvm-dwarfdump] - Add the support of parsing .debug_loclists.
George Rimar [Mon, 22 Oct 2018 11:30:54 +0000 (11:30 +0000)]
[llvm-dwarfdump] - Add the support of parsing .debug_loclists.

This teaches llvm-dwarfdump to dump the content of .debug_loclists sections.

It converts the DWARFDebugLocDWO class to DWARFDebugLoclists,
teaches llvm-dwarfdump about .debug_loclists section and
adds the implementation for parsing the DW_LLE_offset_pair entries.

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

llvm-svn: 344895

6 years ago[PowerPC][NFC] Fix bugs in r+r to r+i conversion
Nemanja Ivanovic [Mon, 22 Oct 2018 11:22:59 +0000 (11:22 +0000)]
[PowerPC][NFC] Fix bugs in r+r to r+i conversion

The D-Form VSX loads introduced in ISA 3.0 are not direct D-Form equivalent of
the corresponding X-Forms since they only target the Altivec registers.
Namely LXSSPX can load into any of the 64 VSX registers whereas LXSSP can only
load into the upper 32 VSX registers. Similarly with the remaining affected
instructions.

There is currently no way that I can see to trigger the bug, but as we add other
ways of exploiting these instructions, there may very well be instances that do.

This is an NFC patch in practical terms since the changes it introduces can not
be triggered without an MIR test.

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

llvm-svn: 344894

6 years ago[CGProfile] Turn constant-size SmallVector into array
Benjamin Kramer [Mon, 22 Oct 2018 10:51:34 +0000 (10:51 +0000)]
[CGProfile] Turn constant-size SmallVector into array

No functionality change.

llvm-svn: 344893

6 years agoFix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Mon, 22 Oct 2018 10:46:37 +0000 (10:46 +0000)]
Fix MSVC "not all control paths return a value" warning. NFCI.

llvm-svn: 344892

6 years ago[OpenCL] Fix definitions of __builtin_(add|sub|mul)_overflow
Marco Antognini [Mon, 22 Oct 2018 10:41:07 +0000 (10:41 +0000)]
[OpenCL] Fix definitions of __builtin_(add|sub|mul)_overflow

Ensure __builtin_(add|sub|mul)_overflow return bool instead of void as per
specification (LanguageExtensions).

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

llvm-svn: 344891

6 years ago[ARM][AArch64] Add LLVM_FALLTHROUGH to silence warning [NFC]
Peter Smith [Mon, 22 Oct 2018 10:40:52 +0000 (10:40 +0000)]
[ARM][AArch64] Add LLVM_FALLTHROUGH to silence warning [NFC]

A follow up to D52784 to add in LLVM_FALLTHROUGH where there is an
intentional fall through in a switch statement. This will hopefully silence
a GCC warning.

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

llvm-svn: 344890

6 years ago[CodeComplete] Fix accessibility of protected members when accessing members implicitly.
Eric Liu [Mon, 22 Oct 2018 08:47:31 +0000 (08:47 +0000)]
[CodeComplete] Fix accessibility of protected members when accessing members implicitly.

Reviewers: ilya-biryukov

Subscribers: arphaman, cfe-commits

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

llvm-svn: 344889

6 years agoUse llvm::arrayRefFromStringRef
Sam Clegg [Mon, 22 Oct 2018 08:35:39 +0000 (08:35 +0000)]
Use llvm::arrayRefFromStringRef

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

llvm-svn: 344888

6 years ago[WebAssembly] Simplify --help message
Sam Clegg [Mon, 22 Oct 2018 08:34:37 +0000 (08:34 +0000)]
[WebAssembly] Simplify --help message

Update wasm to match ELF changes made rL333596.

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

llvm-svn: 344887

6 years ago[PDB] Extend IPDBSession's interface to retrieve frame data
Aleksandr Urakov [Mon, 22 Oct 2018 07:18:08 +0000 (07:18 +0000)]
[PDB] Extend IPDBSession's interface to retrieve frame data

Summary:
This patch just extends the `IPDBSession` interface to allow retrieving
of frame data through it, and adds an implementation over DIA. It is needed
for an implementation (for now with DIA) of the conversion from FPO programs
to DWARF expressions mentioned in D53086.

Reviewers: zturner, asmith, rnk

Reviewed By: asmith

Subscribers: mgorny, aprantl, JDevlieghere, llvm-commits

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

llvm-svn: 344886

6 years agoReleaseNotes: move readability-redundant-smartptr-get part down below new checks
Miklos Vajna [Mon, 22 Oct 2018 06:36:30 +0000 (06:36 +0000)]
ReleaseNotes: move readability-redundant-smartptr-get part down below new checks

llvm-svn: 344885

6 years ago[X86] Add patterns for vector and/or/xor/andn with other types than vXi64.
Craig Topper [Mon, 22 Oct 2018 06:30:22 +0000 (06:30 +0000)]
[X86] Add patterns for vector and/or/xor/andn with other types than vXi64.

This makes fast isel treat all legal vector types the same way. Previously only vXi64 was in the fast-isel tables.

This unfortunately prevents matching of andn by fast-isel for these types since the requires SelectionDAG. But we already had this issue for vXi64. So at least we're consistent now.

Interestinly it looks like fast-isel can't handle instructions with constant vector arguments so the the not part of the andn patterns is selected with SelectionDAG. This explains why VPTERNLOG shows up in some of the tests.

This is a subset of D53268. As I make progress on that, I will try to reduce the number of lines in the tablegen files.

llvm-svn: 344884

6 years ago[IAI,LV] Avoid creating a scalar epilogue due to gaps in interleave-groups when
Dorit Nuzman [Mon, 22 Oct 2018 06:17:09 +0000 (06:17 +0000)]
[IAI,LV] Avoid creating a scalar epilogue due to gaps in interleave-groups when
optimizing for size

LV is careful to respect -Os and not to create a scalar epilog in all cases
(runtime tests, trip-counts that require a remainder loop) except for peeling
due to gaps in interleave-groups. This patch fixes that; -Os will now have us
invalidate such interleave-groups and vectorize without an epilog.

The patch also removes a related FIXME comment that is now obsolete, and was
also inaccurate:
"FIXME: return None if loop requiresScalarEpilog(<MaxVF>), or look for a smaller
MaxVF that does not require a scalar epilog."
(requiresScalarEpilog() has nothing to do with VF).

Reviewers: Ayal, hsaito, dcaballe, fhahn

Reviewed By: Ayal

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

llvm-svn: 344883

6 years ago[XRay] Account for virtual memory re-use
Dean Michael Berris [Mon, 22 Oct 2018 06:11:50 +0000 (06:11 +0000)]
[XRay] Account for virtual memory re-use

Change the assumption when releasing memory to a buffer queue that new
generations might not be able to re-use the memory mapped addresses.

llvm-svn: 344882

6 years ago[XRay][compiler-rt] Generational Buffer Management
Dean Michael Berris [Mon, 22 Oct 2018 04:53:58 +0000 (04:53 +0000)]
[XRay][compiler-rt] Generational Buffer Management

Summary:
This change updates the buffer queue implementation to support using a
generation number to identify the lifetime of buffers. This first part
introduces the notion of the generation number, without changing the way
we handle the buffers yet.

What's missing here is the cleanup of the buffers. Ideally we'll keep
the two most recent generations. We need to ensure that before we do any
writes to the buffers, that we check the generation number(s) first.

Those changes will follow-on from this change.

Depends on D52588.

Reviewers: mboerger, eizan

Subscribers: llvm-commits, jfb

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

llvm-svn: 344881

6 years ago[XRay] Handle allocator exhaustion in segmented array
Dean Michael Berris [Mon, 22 Oct 2018 02:11:27 +0000 (02:11 +0000)]
[XRay] Handle allocator exhaustion in segmented array

Summary:
This change allows us to handle allocator exhaustion properly in the
segmented array implementation. Before this change, we relied on the
caller of the `trim` function to provide a valid number of elements to
trim. This change allows us to do the right thing in case the elements
to trim is greater than the size of the container.

Reviewers: mboerger, eizan

Subscribers: llvm-commits

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

llvm-svn: 344880

6 years ago[analyzer][UninitializedObjectChecker] No longer using nonloc::LazyCompoundVal
Kristof Umann [Sun, 21 Oct 2018 23:30:01 +0000 (23:30 +0000)]
[analyzer][UninitializedObjectChecker] No longer using nonloc::LazyCompoundVal

As rightly pointed out by @NoQ, nonloc::LazyCompoundVals were only used to acquire a constructed object's region, which isn't what LazyCompoundVal was made for.

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

llvm-svn: 344879

6 years ago[analyzer][www] Update alpha_checks.html
Kristof Umann [Sun, 21 Oct 2018 22:10:15 +0000 (22:10 +0000)]
[analyzer][www] Update alpha_checks.html

I added some missing doc. I have not developed any of these checkers, it might worth really inspecting whether I wrote something terribly incorrect.

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

llvm-svn: 344878

6 years ago[X86] Stop promoting integer loads to vXi64
Craig Topper [Sun, 21 Oct 2018 21:30:26 +0000 (21:30 +0000)]
[X86] Stop promoting integer loads to vXi64

Summary:
Theoretically this was done to simplify the amount of isel patterns that were needed. But it also meant a substantial number of our isel patterns have to match an explicit bitcast. By making the vXi32/vXi16/vXi8 types legal for loads, DAG combiner should be able to change the load type to remove the bitcast.

I had to add some additional plain load instruction patterns and a few other special cases, but overall the isel table has reduced in size by ~12000 bytes. So it looks like this promotion was hurting us more than helping.

I still have one crash in vector-trunc.ll that I'm hoping @RKSimon can help with. It seems to relate to using getTargetConstantFromNode on a load that was shrunk due to an extract_subvector combine after the constant pool entry was created. So we end up decoding more mask elements than the load size.

I'm hoping this patch will simplify the number of patterns needed to remove the and/or/xor promotion.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits, RKSimon

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

llvm-svn: 344877

6 years ago[Sanitizer] openbsd does not have sysctlbyname call
David Carlier [Sun, 21 Oct 2018 21:17:03 +0000 (21:17 +0000)]
[Sanitizer] openbsd does not have sysctlbyname call

Enabling only for FreeBSD.

Reviewers: krytarowski, vitalybuka

Reviewed By: krytarowski

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

llvm-svn: 344876

6 years agoRevert r344873 "foo"
Craig Topper [Sun, 21 Oct 2018 21:08:37 +0000 (21:08 +0000)]
Revert r344873 "foo"

Rebase gone wrong left this in my tree.

llvm-svn: 344875

6 years ago[X86] Remove SDIVREM8_SEXT_HREG/UDIVREM8_ZEXT_HREG and their associated DAG combine...
Craig Topper [Sun, 21 Oct 2018 21:07:27 +0000 (21:07 +0000)]
[X86] Remove SDIVREM8_SEXT_HREG/UDIVREM8_ZEXT_HREG and their associated DAG combine and target bits support. Use a post isel peephole instead.

Summary:
These nodes exist to overcome an isel problem where we can generate a zero extend of an AH register followed by an extract subreg, and another zero extend. The first zero extend exists to avoid a partial register update copying the AH register into the low 8-bits. The second zero extend exists if the user wanted the remainder zero extended.

To make this work we had a DAG combine to morph the DIVREM opcode to a special opcode that included the extend. But then we had to add the new node to computeKnownBits and computeNumSignBits to process the extension portion.

This patch instead removes all of that and adds a late peephole to detect the two extends.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 344874

6 years agofoo
Craig Topper [Sun, 21 Oct 2018 21:07:25 +0000 (21:07 +0000)]
foo

llvm-svn: 344873

6 years ago[DAGCombiner] reduce insert+bitcast+extract vector ops to truncate (PR39016)
Sanjay Patel [Sun, 21 Oct 2018 20:13:29 +0000 (20:13 +0000)]
[DAGCombiner] reduce insert+bitcast+extract vector ops to truncate (PR39016)

This is a late backend subset of the IR transform added with:
D52439

We can confirm that the conversion to a 'trunc' is correct by running:
$ opt -instcombine -data-layout="e"
(assuming the IR transforms are correct; change "e" to "E" for big-endian)

As discussed in PR39016:
https://bugs.llvm.org/show_bug.cgi?id=39016
...the pattern may emerge during legalization, so that's we are waiting for an
insertelement to become a scalar_to_vector in the pattern matching here.

The DAG allows for fun variations that are not possible in IR. Result types for
extracts and scalar_to_vector don't necessarily match input types, so that means
we have to be a bit more careful in the transform (see code comments).

The tests show that we don't handle cases that require a shift (as we did in the
IR version). I've left that as a potential follow-up because I'm not sure if
that's a real concern at this late stage.

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

llvm-svn: 344872

6 years ago[clang-tidy] add IgnoreMacros option to readability-redundant-smartptr-get
Miklos Vajna [Sun, 21 Oct 2018 19:16:25 +0000 (19:16 +0000)]
[clang-tidy] add IgnoreMacros option to readability-redundant-smartptr-get

And also enable it by default to be consistent with e.g. modernize-use-using.

This helps e.g. when running this check on client code where the macro is
provided by the system, so there is no easy way to modify it.

Reviewed By: JonasToth

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

llvm-svn: 344871

6 years ago[analyzer][NFC] Fix inconsistencies in AnalyzerOptions
Kristof Umann [Sun, 21 Oct 2018 18:19:32 +0000 (18:19 +0000)]
[analyzer][NFC] Fix inconsistencies in AnalyzerOptions

I'm in the process of refactoring AnalyzerOptions. The main motivation behind
here is to emit warnings if an invalid -analyzer-config option is given from the
command line, and be able to list them all.

This first NFC patch contains small modifications to make AnalyzerOptions.cpp a
little more consistent.

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

llvm-svn: 344870

6 years agoSchedule Hot Cold Splitting pass after most optimization passes
Aditya Kumar [Sun, 21 Oct 2018 18:11:56 +0000 (18:11 +0000)]
Schedule Hot Cold Splitting pass after most optimization passes

Summary:
In the new+old pass manager, hot cold splitting was schedule too early.
Thanks to Vedant for pointing this out.

Reviewers: sebpop, vsk

Reviewed By: sebpop, vsk

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 344869

6 years ago[X86][AVX] Enable lowerVectorShuffleAsLanePermuteAndPermute v16i16/v32i8 unary shuffl...
Simon Pilgrim [Sun, 21 Oct 2018 17:07:50 +0000 (17:07 +0000)]
[X86][AVX] Enable lowerVectorShuffleAsLanePermuteAndPermute v16i16/v32i8 unary shuffle lowering

llvm-svn: 344868

6 years ago[X86] Only extract constant pool shuffle mask data with zero offsets
Simon Pilgrim [Sun, 21 Oct 2018 11:55:56 +0000 (11:55 +0000)]
[X86] Only extract constant pool shuffle mask data with zero offsets

D53306 exposes an issue where we sometimes use constant pool data from bigger vectors than the target shuffle mask. This should be safe to do, but we have to be certain that we're using the bottom most part of the vector as the shuffle mask decoders have no way to peek into subvectors with non-zero offsets.

llvm-svn: 344867

6 years ago[WebAssembly] Change tabs to spaces in basic-assembly.s
Heejin Ahn [Sun, 21 Oct 2018 11:16:50 +0000 (11:16 +0000)]
[WebAssembly] Change tabs to spaces in basic-assembly.s

llvm-svn: 344866

6 years ago[AST, analyzer] Transform rvalue cast outputs to lvalues (fheinous-gnu-extensions)
Aleksei Sidorin [Sat, 20 Oct 2018 22:49:23 +0000 (22:49 +0000)]
[AST, analyzer] Transform rvalue cast outputs to lvalues (fheinous-gnu-extensions)

Despite the fact that cast expressions return rvalues, GCC still
handles such outputs as lvalues when compiling inline assembler.
In this commit, we are treating it by removing LValueToRValue
casts inside GCCAsmStmt outputs.

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

llvm-svn: 344864

6 years ago[ORC] Add some more basic sanity tests for the LLJIT.
Lang Hames [Sat, 20 Oct 2018 20:39:53 +0000 (20:39 +0000)]
[ORC] Add some more basic sanity tests for the LLJIT.

minimal.ll contains a main function that returns zero, and
single-function-call.ll contains a main function that calls a foo function that
returns zero. These minimal tests can help to rule out some trivial JIT bugs
when other tests fail.

This commit also renames hello.ll to global-ctors-and-dtors.ll, which better
reflects what it is actually testing.

llvm-svn: 344863

6 years ago[X86] Add more intrinsics to match icc.
Craig Topper [Sat, 20 Oct 2018 19:28:52 +0000 (19:28 +0000)]
[X86] Add more intrinsics to match icc.

This adds
_mm_loadu_epi8, _mm256_loadu_epi8, _mm512_loadu_epi8
_mm_loadu_epi16, _mm256_loadu_epi16, _mm512_loadu_epi16
_mm_storeu_epi8, _mm256_storeu_epi8, _mm512_storeu_epi8
_mm_storeu_epi16, _mm256_storeu_epi16, _mm512_storeu_epi16

llvm-svn: 344862

6 years ago[X86] Add missing intrinsics to match icc.
Craig Topper [Sat, 20 Oct 2018 19:28:50 +0000 (19:28 +0000)]
[X86] Add missing intrinsics to match icc.

This adds
_mm_and_epi32, _mm_and_epi64
_mm_andnot_epi32, _mm_andnot_epi64
_mm_or_epi32, _mm_or_epi64
_mm_xor_epi32, _mm_xor_epi64
_mm256_and_epi32, _mm256_and_epi64
_mm256_andnot_epi32, _mm256_andnot_epi64
_mm256_or_epi32, _mm256_or_epi64
_mm256_xor_epi32, _mm256_xor_epi64
_mm_loadu_epi32, _mm_loadu_epi64
_mm_load_epi32, _mm_load_epi64
_mm256_loadu_epi32, _mm256_loadu_epi64
_mm256_load_epi32, _mm256_load_epi64
_mm512_loadu_epi32, _mm512_loadu_epi64
_mm512_load_epi32, _mm512_load_epi64
_mm_storeu_epi32, _mm_storeu_epi64
_mm_store_epi32, _mm_load_epi64
_mm256_storeu_epi32, _mm256_storeu_epi64
_mm256_store_epi32, _mm256_load_epi64
_mm512_storeu_epi32, _mm512_storeu_epi64
_mm512_store_epi32,V _mm512_load_epi64

llvm-svn: 344861

6 years ago[InstCombine] add test for possible shuffle fold; NFC
Sanjay Patel [Sat, 20 Oct 2018 18:18:55 +0000 (18:18 +0000)]
[InstCombine] add test for possible shuffle fold; NFC

llvm-svn: 344860

6 years agoUse llvm::{all,any,none}_of instead std::{all,any,none}_of. NFC
Fangrui Song [Sat, 20 Oct 2018 17:53:42 +0000 (17:53 +0000)]
Use llvm::{all,any,none}_of instead std::{all,any,none}_of. NFC

llvm-svn: 344859

6 years ago[clangd] Fix unqualified make_unique after r344850. NFC
Sam McCall [Sat, 20 Oct 2018 17:40:12 +0000 (17:40 +0000)]
[clangd] Fix unqualified make_unique after r344850. NFC

llvm-svn: 344858

6 years ago[CostModel][X86] Add some initial extract/insert subvector shuffle cost tests
Simon Pilgrim [Sat, 20 Oct 2018 17:38:33 +0000 (17:38 +0000)]
[CostModel][X86] Add some initial extract/insert subvector shuffle cost tests

Just f64/i64 tests initially to demonstrate PR39368

llvm-svn: 344857

6 years agoCheck that __MAC_OS_X_VERSION_MIN_REQUIRED is defined before checking
Akira Hatanaka [Sat, 20 Oct 2018 17:35:50 +0000 (17:35 +0000)]
Check that __MAC_OS_X_VERSION_MIN_REQUIRED is defined before checking
whether it is too old.

llvm-svn: 344856

6 years ago[InstCombine] use 'match' to simplify code; NFC
Sanjay Patel [Sat, 20 Oct 2018 17:15:57 +0000 (17:15 +0000)]
[InstCombine] use 'match' to simplify code; NFC

llvm-svn: 344855

6 years ago[InstCombine] make code more flexible with lambda; NFC
Sanjay Patel [Sat, 20 Oct 2018 16:58:27 +0000 (16:58 +0000)]
[InstCombine] make code more flexible with lambda; NFC

I couldn't tell from svn history when these checks were added,
but it pre-dates the split of instcombine into its own directory
at rL92459.

The motivation for changing the check is partly shown by the
code in PR34724:
https://bugs.llvm.org/show_bug.cgi?id=34724

There are also existing regression tests for SLPVectorizer with
sequences of extract+insert that are likely assumed to become
shuffles by the vectorizer cost models.

llvm-svn: 344854

6 years ago[InstCombine] add explanatory comment for strange vector logic; NFC
Sanjay Patel [Sat, 20 Oct 2018 16:25:55 +0000 (16:25 +0000)]
[InstCombine] add explanatory comment for strange vector logic; NFC

llvm-svn: 344852

6 years ago[clangd] Namespace style cleanup in cpp files. NFC.
Sam McCall [Sat, 20 Oct 2018 15:30:37 +0000 (15:30 +0000)]
[clangd] Namespace style cleanup in cpp files. NFC.

Standardize on the most common namespace setup in our *.cpp files:
  using namespace llvm;
  namespace clang {
  namespace clangd {
  void foo(StringRef) { ... }
And remove redundant llvm:: qualifiers. (Except for cases like
make_unique where this causes problems with std:: and ADL).

This choice is pretty arbitrary, but some broad consistency is nice.
This is going to conflict with everything. Sorry :-/

Squash the other configurations:

A)
  using namespace llvm;
  using namespace clang;
  using namespace clangd;
  void clangd::foo(StringRef);
This is in some of the older files. (It prevents accidentally defining a
new function instead of one in the header file, for what that's worth).

B)
  namespace clang {
  namespace clangd {
  void foo(llvm::StringRef) { ... }
This is fine, but in practice the using directive often gets added over time.

C)
  namespace clang {
  namespace clangd {
  using namespace llvm; // inside the namespace
This was pretty common, but is a bit misleading: name lookup preferrs
clang::clangd::foo > clang::foo > llvm:: foo (no matter where the using
directive is).

llvm-svn: 344850

6 years ago[SLPVectorizer][X86] Add mul/and/or/xor unrolled reduction tests
Simon Pilgrim [Sat, 20 Oct 2018 15:17:27 +0000 (15:17 +0000)]
[SLPVectorizer][X86] Add mul/and/or/xor unrolled reduction tests

We miss arithmetic reduction for everything but Add/FAdd (I assume because that's the only cases which x86 has horizontal ops for.....)

llvm-svn: 344849

6 years ago[SLPVectorizer] regenerate test checks; NFC
Sanjay Patel [Sat, 20 Oct 2018 14:53:07 +0000 (14:53 +0000)]
[SLPVectorizer] regenerate test checks; NFC

llvm-svn: 344848

6 years ago[NFC][Test commit] Fix typos in a comment
Aleksei Sidorin [Sat, 20 Oct 2018 14:47:37 +0000 (14:47 +0000)]
[NFC][Test commit] Fix typos in a comment

llvm-svn: 344847

6 years ago[CostModel][X86] Add integer vector reduction cost tests
Simon Pilgrim [Sat, 20 Oct 2018 14:29:59 +0000 (14:29 +0000)]
[CostModel][X86] Add integer vector reduction cost tests

llvm-svn: 344846

6 years agoFix MSVC "truncation from 'double' to 'float'" warning. NFCI.
Simon Pilgrim [Sat, 20 Oct 2018 13:20:26 +0000 (13:20 +0000)]
Fix MSVC "truncation from 'double' to 'float'" warning. NFCI.

llvm-svn: 344845

6 years agoFix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Sat, 20 Oct 2018 13:18:49 +0000 (13:18 +0000)]
Fix MSVC "not all control paths return a value" warning. NFCI.

llvm-svn: 344844

6 years agoReplace setFeature macro with lambda to fix MSVC "shift count negative or too big...
Simon Pilgrim [Sat, 20 Oct 2018 13:16:31 +0000 (13:16 +0000)]
Replace setFeature macro with lambda to fix MSVC "shift count negative or too big" warnings. NFCI.

llvm-svn: 344843

6 years agoAdd an addAbsolute static function to Writer.cpp
Alexander Richardson [Sat, 20 Oct 2018 11:12:50 +0000 (11:12 +0000)]
Add an addAbsolute static function to Writer.cpp

Summary:
SymbolTable::addAbsolute() was removed in rL344305.
To me this is more readable than the lambda named `Add` and in our
out-of-tree CHERI target we use addAbsolute() in another function.

Reviewers: ruiu, espindola

Reviewed By: ruiu

Subscribers: kristina, emaste, llvm-commits

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

llvm-svn: 344842

6 years agoDebugInfo: Use base address specifiers more aggressively
David Blaikie [Sat, 20 Oct 2018 09:16:49 +0000 (09:16 +0000)]
DebugInfo: Use base address specifiers more aggressively

Using a base address specifier even for a single-element range is a size
win for object files (7 words versus 8 words - more significant savings
if the debug info is compressed (since it's 3 words of uncompressable
reloc + 4 compressable words compared to 6 uncompressable reloc + 2
compressable words) - does trade off executable size increase though.

llvm-svn: 344841

6 years ago[clang-query] Add option to print matcher expression
Stephen Kelly [Sat, 20 Oct 2018 09:13:59 +0000 (09:13 +0000)]
[clang-query] Add option to print matcher expression

Summary:
This is useful if using clang-query -f with a file containing multiple
matchers.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 344840

6 years agoAdd missed file from previous commit (r344838)
David Blaikie [Sat, 20 Oct 2018 08:55:51 +0000 (08:55 +0000)]
Add missed file from previous commit (r344838)

llvm-svn: 344839

6 years agoDebugInfo: Use DW_OP_addrx in DWARFv5
David Blaikie [Sat, 20 Oct 2018 08:54:05 +0000 (08:54 +0000)]
DebugInfo: Use DW_OP_addrx in DWARFv5

Reuse addresses in the address pool, even in non-split cases.

llvm-svn: 344838

6 years agoDebugInfo: Implement debug_rnglists.dwo
David Blaikie [Sat, 20 Oct 2018 08:12:36 +0000 (08:12 +0000)]
DebugInfo: Implement debug_rnglists.dwo

Save space/relocations in .o files by keeping dwo ranges in the dwo
file rather than the .o file.

llvm-svn: 344837

6 years agoDebugInfo: Use address pool forms in debug_rnglists
David Blaikie [Sat, 20 Oct 2018 07:36:39 +0000 (07:36 +0000)]
DebugInfo: Use address pool forms in debug_rnglists

Save no relocations by reusing addresses from the address pool.

llvm-svn: 344836

6 years agollvm-dwarfdump: Support RLE_addressx and RLE_startx_length in .debug_rnglists
David Blaikie [Sat, 20 Oct 2018 06:16:25 +0000 (06:16 +0000)]
llvm-dwarfdump: Support RLE_addressx and RLE_startx_length in .debug_rnglists

llvm-svn: 344835

6 years agoDebugInfo: Use debug_addr for non-dwo addresses in DWARF 5
David Blaikie [Sat, 20 Oct 2018 06:02:15 +0000 (06:02 +0000)]
DebugInfo: Use debug_addr for non-dwo addresses in DWARF 5

Putting addresses in the address pool, even with non-fission, can reduce
relocations - reusing the addresses from debug_info and debug_rnglists
(the latter coming soon)

llvm-svn: 344834

6 years ago[CodeGen] Use the mangle context owned by CodeGenModule to correctly
Akira Hatanaka [Sat, 20 Oct 2018 05:45:01 +0000 (05:45 +0000)]
[CodeGen] Use the mangle context owned by CodeGenModule to correctly
mangle types of lambda objects captured by a block instead of creating a
new mangle context everytime a captured field type is mangled.

This fixes a bug in IRGen's block helper merging code that was
introduced in r339438 where two blocks capturing two distinct lambdas
would end up sharing helper functions and the block descriptor. This
happened because the ID number used to distinguish lambdas defined
in the same context is reset everytime a mangled context is created.

rdar://problem/45314494

llvm-svn: 344833

6 years ago[X86] Add support for more than 32 features for __builtin_cpu_is
Craig Topper [Sat, 20 Oct 2018 03:51:52 +0000 (03:51 +0000)]
[X86] Add support for more than 32 features for __builtin_cpu_is

libgcc supports more than 32 features by adding a new 32-bit variable __cpu_features2.

This adds the clang support for checking these feature bits.

Patches for compiler-rt and llvm to support this are coming as well.

Probably still need an additional patch for target multiversioning in clang.

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

llvm-svn: 344832

6 years ago[X86] Add additional CPUs and features to Host.cpp and X86TargetParser.def to match...
Craig Topper [Sat, 20 Oct 2018 03:51:43 +0000 (03:51 +0000)]
[X86] Add additional CPUs and features to Host.cpp and X86TargetParser.def to match compiler-rt and enable __builtin_cpu_supports/__builtin_cpu_is support in clang

Summary: This matches LLVM to D53461 for compiler-rt.

Reviewers: echristo, erichkeane

Reviewed By: echristo

Subscribers: dberris, llvm-commits

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

llvm-svn: 344831

6 years ago[X86][compiler-rt] Add additional CPUs and features to the cpu detection to match...
Craig Topper [Sat, 20 Oct 2018 03:49:04 +0000 (03:49 +0000)]
[X86][compiler-rt] Add additional CPUs and features to the cpu detection to match libgcc

Summary: This patch adds additional features and cpus from libgcc. Unfortunately we've overflowed the existing 32-bits of features so we had to add a new __cpu_features2 variable to hold the additional bits. This matches libgcc as far as I can tell.

Reviewers: echristo

Reviewed By: echristo

Subscribers: dberris, llvm-commits

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

llvm-svn: 344830

6 years ago[libcxx] [test] Don't detect Windows' UCRT with TEST_COMPILER_C1XX
Billy Robert O'Neal III [Sat, 20 Oct 2018 03:35:45 +0000 (03:35 +0000)]
[libcxx] [test] Don't detect Windows' UCRT with TEST_COMPILER_C1XX

The test is trying to avoid saying aligned_alloc on Windows' UCRT, which does not (and can not) implement aligned_alloc. However, it's testing for c1xx, meaning clang on Windows will fail this test when using the UCRT.

llvm-svn: 344829

6 years agoMake -Wfor-loop-analysis work with C++17
Richard Trieu [Sat, 20 Oct 2018 02:15:58 +0000 (02:15 +0000)]
Make -Wfor-loop-analysis work with C++17

For now, disable the "variable in loop condition not modified" warning to not
be emitted when there is a structured binding variable in the loop condition.

https://bugs.llvm.org/show_bug.cgi?id=39285

llvm-svn: 344828

6 years agoDisable unittests/clangd/JSONTransportTests.cpp on versions of macosx
Akira Hatanaka [Sat, 20 Oct 2018 02:11:45 +0000 (02:11 +0000)]
Disable unittests/clangd/JSONTransportTests.cpp on versions of macosx
earlier than 10.13.

rdar://problem/45310173

llvm-svn: 344827

6 years ago[WebAssembly] Implement vector sext_inreg and tests with comparisons
Thomas Lively [Sat, 20 Oct 2018 01:35:23 +0000 (01:35 +0000)]
[WebAssembly] Implement vector sext_inreg and tests with comparisons

Summary: Depends on D53251.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 344826

6 years ago[WebAssembly] Custom lower i64x2 constant shifts to avoid wrap
Thomas Lively [Sat, 20 Oct 2018 01:31:18 +0000 (01:31 +0000)]
[WebAssembly] Custom lower i64x2 constant shifts to avoid wrap

Summary: Depends on D53057.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 344825

6 years ago[X86] When checking the bits in cpu_features for function multiversioning dispatcher...
Craig Topper [Sat, 20 Oct 2018 01:30:00 +0000 (01:30 +0000)]
[X86] When checking the bits in cpu_features for function multiversioning dispatcher in the resolver, make sure all the required bits are set. Not just one of them

Summary:
The multiversioning code repurposed the code from __builtin_cpu_supports for checking if a single feature is enabled. That code essentially performed (_cpu_features & (1 << C)) != 0. But with the multiversioning path, the mask is no longer guaranteed to be a power of 2. So we return true anytime any one of the bits in the mask is set not just all of the bits.

The correct check is (_cpu_features & mask) == mask

Reviewers: erichkeane, echristo

Reviewed By: echristo

Subscribers: cfe-commits

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

llvm-svn: 344824

6 years ago[analyzer] Be more plugin-friendly by moving static locals into .cpp files.
Artem Dergachev [Sat, 20 Oct 2018 00:29:24 +0000 (00:29 +0000)]
[analyzer] Be more plugin-friendly by moving static locals into .cpp files.

The GDMIndex functions return a pointer that's used as a key for looking up
data, but addresses of local statics defined in header files aren't the same
across shared library boundaries and the result is that analyzer plugins
can't access this data.

Event types are uniqued by using the addresses of a local static defined
in a header files, but it isn't the same across shared library boundaries
and plugins can't currently handle ImplicitNullDerefEvents.

Patches by Joe Ranieri!

Differential Revision: https://reviews.llvm.org/D52905
Differential Revision: https://reviews.llvm.org/D52906

llvm-svn: 344823

6 years ago[MachineCSE][GlobalISel] Making sure MachineCSE works mid-GlobalISel (again)
Roman Tereshin [Sat, 20 Oct 2018 00:06:15 +0000 (00:06 +0000)]
[MachineCSE][GlobalISel] Making sure MachineCSE works mid-GlobalISel (again)

Change of approach, it looks like it's a much better idea to deal with
the vregs that have LLTs and reg classes both properly, than trying to
avoid creating those across all GlobalISel passes and all targets.

The change mostly touches MachineRegisterInfo::constrainRegClass,
which is apparently only used by MachineCSE. The changes are NFC for
any pipeline but one that contains MachineCSE mid-GlobalISel.

NOTE on isCallerPreservedOrConstPhysReg change in MachineCSE:

    There is no test covering it as the only way to insert a new pass
(MachineCSE) from a command line I know of is llc's -run-pass option,
which only works with MIR, but MIRParser freezes reserved registers upon
MachineFunctions creation, making it impossible to reproduce the state
that exposes the issue.

Reviwed By: aditya_nandakumar

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

llvm-svn: 344822

6 years ago[libcxx] [test] Add missing <stdexcept> to map at tests.
Billy Robert O'Neal III [Fri, 19 Oct 2018 23:49:15 +0000 (23:49 +0000)]
[libcxx] [test] Add missing <stdexcept> to map at tests.

Reviewed as https://reviews.llvm.org/D50551

llvm-svn: 344821

6 years agoRepair thread-unsafe modifications of n_alive in F.pass.cpp
Billy Robert O'Neal III [Fri, 19 Oct 2018 23:45:45 +0000 (23:45 +0000)]
Repair thread-unsafe modifications of n_alive in F.pass.cpp

In this example, the ctor of G runs in the main thread in the expression G(), and also in the copy ctor of G() in the DECAY_COPY inside std::thread. The main thread destroys the G() instance at the semicolon, and the started thread destroys the G() after it returns. Thus there is a race between the threads on the n_alive variable.

The fix is to join with the background thread before attempting to destroy the G in the main thread.

llvm-svn: 344820