platform/upstream/llvm.git
7 years agoFix FILL linker script command.
Rui Ueyama [Thu, 13 Apr 2017 23:40:00 +0000 (23:40 +0000)]
Fix FILL linker script command.

FILL command doesn't need a semicolon.
Fixes https://bugs.llvm.org/show_bug.cgi?id=32657

llvm-svn: 300280

7 years ago[Profile] PE binary coverage bug fix
Xinliang David Li [Thu, 13 Apr 2017 23:37:21 +0000 (23:37 +0000)]
[Profile] PE binary coverage bug fix

PR/32584

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

llvm-svn: 300279

7 years ago[Profile] PE binary coverage bug fix
Xinliang David Li [Thu, 13 Apr 2017 23:37:15 +0000 (23:37 +0000)]
[Profile] PE binary coverage bug fix

PR/32584

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

llvm-svn: 300278

7 years ago[Profile] PE binary coverage bug fix
Xinliang David Li [Thu, 13 Apr 2017 23:37:12 +0000 (23:37 +0000)]
[Profile] PE binary coverage bug fix

PR/32584

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

llvm-svn: 300277

7 years ago[AArch64] Avoid partial register writes on lane 0 of BUILD_VECTOR for i8/i16/f16
Adam Nemet [Thu, 13 Apr 2017 23:32:47 +0000 (23:32 +0000)]
[AArch64] Avoid partial register writes on lane 0 of BUILD_VECTOR for i8/i16/f16

This further improves Ahmed's change in rL299482.  See the new comment for the
rationale.

The patch recovers most of the regression for bzip2 after D31965. We're down
to +2.68% from +6.97%.

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

llvm-svn: 300276

7 years agoAMDGPU/GFX9: Do not use v_pack_b32_f16 when packing
Konstantin Zhuravlyov [Thu, 13 Apr 2017 23:17:00 +0000 (23:17 +0000)]
AMDGPU/GFX9: Do not use v_pack_b32_f16 when packing

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

llvm-svn: 300275

7 years agobuild_llvm_package.bat: Move to VS2017
Hans Wennborg [Thu, 13 Apr 2017 23:13:23 +0000 (23:13 +0000)]
build_llvm_package.bat: Move to VS2017

It's required for building the clang-format plugin after r300225.

llvm-svn: 300273

7 years ago[IR] Make getParamAttributes take argument numbers, not ArgNo+1
Reid Kleckner [Thu, 13 Apr 2017 23:12:13 +0000 (23:12 +0000)]
[IR] Make getParamAttributes take argument numbers, not ArgNo+1

Add hasParamAttribute() and use it instead of hasAttribute(ArgNo+1,
Kind) everywhere.

The fact that the AttributeList index for an argument is ArgNo+1 should
be a hidden implementation detail.

NFC

llvm-svn: 300272

7 years ago[docs] Regenerate diagnostics reference.
Richard Smith [Thu, 13 Apr 2017 22:44:22 +0000 (22:44 +0000)]
[docs] Regenerate diagnostics reference.

llvm-svn: 300271

7 years ago[docs] Fix a couple of typos in command line flag help text and regenerate documentation.
Richard Smith [Thu, 13 Apr 2017 22:39:49 +0000 (22:39 +0000)]
[docs] Fix a couple of typos in command line flag help text and regenerate documentation.

llvm-svn: 300270

7 years ago[bpf] Fix memory offset check for loads and stores
Alexei Starovoitov [Thu, 13 Apr 2017 22:24:13 +0000 (22:24 +0000)]
[bpf] Fix memory offset check for loads and stores

If the offset cannot fit into the instruction, an addition to the
pointer is emitted before the actual access. However, BPF offsets are
16-bit but LLVM considers them to be, for the matter of this check,
to be 32-bit long.

This causes the following program:

int bpf_prog1(void *ign)
{

volatile unsigned long t = 0x8983984739ull;
return *(unsigned long *)((0xffffffff8fff0002ull) + t);

}

To generate the following (wrong) code:

0: 18 01 00 00 39 47 98 83 00 00 00 00 89 00 00 00

r1 = 590618314553ll

2: 7b 1a f8 ff 00 00 00 00 *(u64 *)(r10 - 8) = r1
3: 79 a1 f8 ff 00 00 00 00 r1 = *(u64 *)(r10 - 8)
4: 79 10 02 00 00 00 00 00 r0 = *(u64 *)(r1 + 2)
5: 95 00 00 00 00 00 00 00 exit

Fix it by changing the offset check to 16-bit.

Patch by Nadav Amit <nadav.amit@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Differential Revision: https://reviews.llvm.org/D32055

llvm-svn: 300269

7 years agoMIRLangRef: Simplify/update documentation
Matthias Braun [Thu, 13 Apr 2017 22:14:45 +0000 (22:14 +0000)]
MIRLangRef: Simplify/update documentation

- Refer to options by `-option` instead of `option`
- Use `-mtriple=` instead of `-march` in the example (-march will still
  target the default operating system which is usually not what you want
  in a test)
- Rephrase sentence because output does not go to stdout by default (you
  need -o - for that as should be expected).

llvm-svn: 300268

7 years ago[Support] Fix ErrorOr assertion when /proc/cpuinfo doesn't exist.
Teresa Johnson [Thu, 13 Apr 2017 21:51:49 +0000 (21:51 +0000)]
[Support] Fix ErrorOr assertion when /proc/cpuinfo doesn't exist.

The ErrorOr should not be dereferenced on the error path.

Patch by Jacob Young

Reviewers: tejohnson

Subscribers: llvm-commits

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

llvm-svn: 300267

7 years agoAdd test for anonymous struct containing an implicitly private data member.
Richard Smith [Thu, 13 Apr 2017 21:51:04 +0000 (21:51 +0000)]
Add test for anonymous struct containing an implicitly private data member.

Patch by Jacob Young!

llvm-svn: 300266

7 years ago[InstCombine] Use APInt::getBitsSetFrom instead of inverting the result of getLowBits...
Craig Topper [Thu, 13 Apr 2017 21:49:48 +0000 (21:49 +0000)]
[InstCombine] Use APInt::getBitsSetFrom instead of inverting the result of getLowBitsSet. NFC

llvm-svn: 300265

7 years agoDiagnose attempt to take address of bitfield members in anonymous structs.
Richard Smith [Thu, 13 Apr 2017 21:49:46 +0000 (21:49 +0000)]
Diagnose attempt to take address of bitfield members in anonymous structs.

Patch by Jacob Young!

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

llvm-svn: 300264

7 years agoAdd "1" suffix if there's varaible ends with "2".
Rui Ueyama [Thu, 13 Apr 2017 21:37:56 +0000 (21:37 +0000)]
Add "1" suffix if there's varaible ends with "2".

If we knew that we'd add End2, Edata2 and Etext2, we'd name their
original symbols with "1". This patch does it.

llvm-svn: 300263

7 years agoPR32185: Revert r291512 and add a testcase for PR32185.
Richard Smith [Thu, 13 Apr 2017 21:37:24 +0000 (21:37 +0000)]
PR32185: Revert r291512 and add a testcase for PR32185.

This reverts an attempt to check that types match when matching a
dependently-typed non-type template parameter. (This comes up when matching the
parameters of a template template parameter against the parameters of a
template template argument.)

The matching rules here are murky at best. Our behavior after this revert is
definitely wrong for certain C++17 features (for 'auto' template parameter
types within the parameter list of a template template argument in particular),
but our behavior before this revert is wrong for some pre-existing testcases,
so reverting to our prior behavior seems like our best option.

llvm-svn: 300262

7 years ago[libcxx] Direct support for Fuchsia
Petr Hosek [Thu, 13 Apr 2017 21:29:21 +0000 (21:29 +0000)]
[libcxx] Direct support for Fuchsia

Fuchsia's libc was forked from musl, but has evolved sufficiently
since then so it no longer makes sense to pretend it's musl. This
change implements direct support for Fuchsia rather than
piggybacking on musl support.

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

llvm-svn: 300261

7 years ago[CMake][runtimes] Use -nodefaultlibs for the runtimes build
Petr Hosek [Thu, 13 Apr 2017 21:29:03 +0000 (21:29 +0000)]
[CMake][runtimes] Use -nodefaultlibs for the runtimes build

We may not have a working C++ standard library at this point so we
shouldn't rely on it when running CMake checks.

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

llvm-svn: 300260

7 years agoReplace a clever lambda helper with a simpler one.
Rui Ueyama [Thu, 13 Apr 2017 21:23:03 +0000 (21:23 +0000)]
Replace a clever lambda helper with a simpler one.

llvm-svn: 300259

7 years ago[llvm-pdbdump] Recursively dump class layout.
Zachary Turner [Thu, 13 Apr 2017 21:11:00 +0000 (21:11 +0000)]
[llvm-pdbdump] Recursively dump class layout.

llvm-svn: 300258

7 years ago[CMake] Support building Fuchsia toolchain on Darwin
Petr Hosek [Thu, 13 Apr 2017 21:09:42 +0000 (21:09 +0000)]
[CMake] Support building Fuchsia toolchain on Darwin

This is already supported on Linux but on Darwin it requires some
extra flags.

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

llvm-svn: 300257

7 years ago[ValueTracking] Remove duplicate call to computeKnownBits for the operands of Select.
Craig Topper [Thu, 13 Apr 2017 20:39:37 +0000 (20:39 +0000)]
[ValueTracking] Remove duplicate call to computeKnownBits for the operands of Select.

We call it unconditionally on the operands of the select. Then decide if its a min/max and call it on the min/max operands or on the select operands again. Either of those second calls will overwrite the results of the initial call so we can just delete the first call.

llvm-svn: 300256

7 years ago[LCSSA] Efficiently compute blocks dominating at least one exit.
Davide Italiano [Thu, 13 Apr 2017 20:36:59 +0000 (20:36 +0000)]
[LCSSA] Efficiently compute blocks dominating at least one exit.

For LCSSA purposes, loop BBs not dominating any of the exits aren't
interesting, as none of the values defined in these blocks can be
used outside the loop.

The way the code computed this information was by comparing each
BB of the loop with each of the exit blocks and ask the dominator tree
about their dominance relation. This is slow.

A more efficient way, implemented here, is that of starting from the
exit blocks and walking the dom upwards until we hit an header. By
transitivity, all the blocks we encounter in our path dominate an exit.

For the testcase provided in PR31851, this reduces compile time on
`opt -O2` by ~25%, going from 1m47s to 1m22s.

Thanks to Dan/MichaelZ for discussions/suggesting the approach/review.

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

llvm-svn: 300255

7 years agoFix -Wunused-value warning
Reid Kleckner [Thu, 13 Apr 2017 20:32:58 +0000 (20:32 +0000)]
Fix -Wunused-value warning

llvm-svn: 300254

7 years agoRevert accidentally-committed files in r300252.
Richard Smith [Thu, 13 Apr 2017 20:31:21 +0000 (20:31 +0000)]
Revert accidentally-committed files in r300252.

llvm-svn: 300253

7 years agoRemove all allocation and divisions from GreatestCommonDivisor
Richard Smith [Thu, 13 Apr 2017 20:29:59 +0000 (20:29 +0000)]
Remove all allocation and divisions from GreatestCommonDivisor

Switch from Euclid's algorithm to Stein's algorithm for computing GCD. This
avoids the (expensive) APInt division operation in favour of bit operations.
Remove all memory allocation from within the GCD loop by tweaking our `lshr`
implementation so it can operate in-place.

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

llvm-svn: 300252

7 years ago[InstCombine] Fix !prof metadata preservation for invokes
Reid Kleckner [Thu, 13 Apr 2017 20:26:38 +0000 (20:26 +0000)]
[InstCombine] Fix !prof metadata preservation for invokes

Summary:
Bug noticed by inspection.

Extend the test to handle invokes as well as calls, and rewrite it to
not depend on the inliner and other passes.

Also simplify the call site replacement code with CallSite, similar to
what I did to dead arg elimination and arg promotion (rL300235 and
rL300229).

Reviewers: danielcdh, davidxl

Subscribers: llvm-commits

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

llvm-svn: 300251

7 years ago[msan] Fix msan_test.cc by checking bind results before assuming IPv6 supported.
Vitaly Buka [Thu, 13 Apr 2017 20:25:24 +0000 (20:25 +0000)]
[msan] Fix msan_test.cc by checking bind results before assuming IPv6 supported.

llvm-svn: 300250

7 years agoRevert "[msan] Fix msan_test broken after r299884."
Vitaly Buka [Thu, 13 Apr 2017 20:25:20 +0000 (20:25 +0000)]
Revert "[msan] Fix msan_test broken after r299884."

This does not fix the test, it still fails to bind.

This reverts commit r300150.

llvm-svn: 300249

7 years agoDisable use of tls scanning on darwin leak sanitizer
Francis Ricci [Thu, 13 Apr 2017 20:14:15 +0000 (20:14 +0000)]
Disable use of tls scanning on darwin leak sanitizer

Summary:
These checks appear linux-specific, disable them on darwin, at
least for now.

Reviewers: kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300248

7 years agoMove Linux-specific lsan tests into a new directory
Francis Ricci [Thu, 13 Apr 2017 20:13:53 +0000 (20:13 +0000)]
Move Linux-specific lsan tests into a new directory

Summary:
These tests aren't supported on other platforms, move them
to their own directory.

Reviewers: kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300247

7 years ago[libc++] Add _LIBCPP_DISABLE_EXTERN_TEMPLATE config option
Shoaib Meenai [Thu, 13 Apr 2017 20:13:32 +0000 (20:13 +0000)]
[libc++] Add _LIBCPP_DISABLE_EXTERN_TEMPLATE config option

When the libc++ extern template macros were added, the intent was for it
to be possible for consumers of the headers to disable extern templates
(via `-D_LIBCPP_EXTERN_TEMPLATE(...)=`). Unfortunately, support for
specifying function-like macros varies on the command line varies across
compilers (e.g. MSVC doesn't support it at all), and cmake doesn't allow
it for the same reason. Add a non-function macro for this purpose.

The intended use is for libraries which want to use the libc++ headers
without taking a dependency on the libc++ library itself. I can name the
macro something which reflects its intent rather than its behavior (e.g.
`_LIBCPP_HEADER_ONLY`) if desired.

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

llvm-svn: 300246

7 years agoclang-format-vs licence.txt: drop svn:executable
Hans Wennborg [Thu, 13 Apr 2017 20:09:18 +0000 (20:09 +0000)]
clang-format-vs licence.txt: drop svn:executable

Not sure how it ended up with that property in the first place.

llvm-svn: 300245

7 years ago[LCSSA] Assert that we always have a valid loop.
Davide Italiano [Thu, 13 Apr 2017 20:05:37 +0000 (20:05 +0000)]
[LCSSA] Assert that we always have a valid loop.

We could otherwise add BBs not belonging to a loop in `formLCSSA`
and later crash when trying to iterate the loop blocks.

llvm-svn: 300244

7 years ago[LCSSA] Remove spurious whitespaces. NFCI.
Davide Italiano [Thu, 13 Apr 2017 20:02:27 +0000 (20:02 +0000)]
[LCSSA] Remove spurious whitespaces. NFCI.

llvm-svn: 300243

7 years ago[LCSSA] Use `auto` when the type is obvious. NFCI.
Davide Italiano [Thu, 13 Apr 2017 20:01:30 +0000 (20:01 +0000)]
[LCSSA] Use `auto` when the type is obvious. NFCI.

llvm-svn: 300242

7 years ago[DAG] Fold away temporary vector in store candidate merge NFC.
Nirav Dave [Thu, 13 Apr 2017 20:00:27 +0000 (20:00 +0000)]
[DAG] Fold away temporary vector in store candidate merge NFC.

llvm-svn: 300241

7 years agoSamplePGO: convert callsite samples map key from callsite_location to callsite_locati...
Dehao Chen [Thu, 13 Apr 2017 19:52:10 +0000 (19:52 +0000)]
SamplePGO: convert callsite samples map key from callsite_location to callsite_location+callee_name

Summary: For iterative SamplePGO, an indirect call can be speculatively promoted to multiple direct calls and get inlined. All these promoted direct calls will share the same callsite location (offset+discriminator). With the current implementation, we cannot distinguish between different promotion candidates and its inlined instance. This patch adds callee_name to the key of the callsite sample map. And added helper functions to get all inlined callee samples for a given callsite location. This helps the profile annotator promote correct targets and inline it before annotation, and ensures all indirect call targets to be annotated correctly.

Reviewers: davidxl, dnovillo

Reviewed By: davidxl

Subscribers: andreadb, llvm-commits

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

llvm-svn: 300240

7 years ago[ValueTracking] Prevent a call to computeKnownBits if we already know the state of...
Craig Topper [Thu, 13 Apr 2017 19:04:45 +0000 (19:04 +0000)]
[ValueTracking] Prevent a call to computeKnownBits if we already know the state of the bit we would calculate. Also reuse a temporary APInt instead of creating a new one.

llvm-svn: 300239

7 years ago[LV] Fix the vector code generation for first order recurrence
Anna Thomas [Thu, 13 Apr 2017 18:59:25 +0000 (18:59 +0000)]
[LV] Fix the vector code generation for first order recurrence

Summary:
In first order recurrences where phi's are used outside the loop,
we should generate an additional vector.extract of the second last element from
the vectorized phi update.
This is because we require the phi itself (which is the value at the second last
iteration of the vector loop) and not the phi's update within the loop.
Also fix the code gen when we just unroll, but don't vectorize.
Fixes PR32396.

Reviewers: mssimpso, mkuper, anemet

Subscribers: llvm-commits, mzolotukhin

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

llvm-svn: 300238

7 years agoRevert "Enable LSan on PowerPC64."
Alex Shlyapnikov [Thu, 13 Apr 2017 18:49:29 +0000 (18:49 +0000)]
Revert "Enable LSan on PowerPC64."

This reverts commit r300204. Breaks ASAN tests on PPC.

llvm-svn: 300237

7 years ago[InstCombine] fold X == 0 || X == -1 to one compare (PR32524)
Sanjay Patel [Thu, 13 Apr 2017 18:47:06 +0000 (18:47 +0000)]
[InstCombine] fold X == 0 || X == -1 to one compare (PR32524)

This is effectively a retry of:
https://reviews.llvm.org/rL299851
but now we have tests and an assert to make sure the bug
that was exposed with that attempt will not happen again.

I'll fix the code duplication and missing sibling fold next,
but I want to make this change as small as possible to reduce
risk since I messed it up last time.

This should fix:
https://bugs.llvm.org/show_bug.cgi?id=32524

llvm-svn: 300236

7 years ago[DAE] Simplify call site replacement code with CallSite NFC
Reid Kleckner [Thu, 13 Apr 2017 18:42:03 +0000 (18:42 +0000)]
[DAE] Simplify call site replacement code with CallSite NFC

llvm-svn: 300235

7 years agoImplement global pointer scanning for darwin leak sanitizer
Francis Ricci [Thu, 13 Apr 2017 18:40:19 +0000 (18:40 +0000)]
Implement global pointer scanning for darwin leak sanitizer

Reviewers: kubamracek, kcc, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300234

7 years ago[ValueTracking] Move a temporary APInt instead of copying it.
Craig Topper [Thu, 13 Apr 2017 18:25:53 +0000 (18:25 +0000)]
[ValueTracking] Move a temporary APInt instead of copying it.

llvm-svn: 300233

7 years agoRemove the binders from C++17. Reviewed as https://reviews.llvm.org/D31769
Marshall Clow [Thu, 13 Apr 2017 18:25:32 +0000 (18:25 +0000)]
Remove the binders from C++17. Reviewed as https://reviews.llvm.org/D31769

llvm-svn: 300232

7 years agoFollow-up to r300225: update ClangFormat.csproj too
Hans Wennborg [Thu, 13 Apr 2017 18:15:00 +0000 (18:15 +0000)]
Follow-up to r300225: update ClangFormat.csproj too

llvm-svn: 300231

7 years ago[InstCombine] Simplify attribute code with new AttributeList::get NFC
Reid Kleckner [Thu, 13 Apr 2017 18:11:03 +0000 (18:11 +0000)]
[InstCombine] Simplify attribute code with new AttributeList::get NFC

llvm-svn: 300230

7 years ago[ArgPromotion] Don't drop !prof metadata on promoted calls
Reid Kleckner [Thu, 13 Apr 2017 18:10:30 +0000 (18:10 +0000)]
[ArgPromotion] Don't drop !prof metadata on promoted calls

Noticed by inspection while doing attribute work. DAE, InstCombineCalls,
and ArgPromotion have a fair amount of duplicated code for hacking on
call sites, and you can find bugs by comparing them.

Add a test case for this.

llvm-svn: 300229

7 years agoAdd a test for __block variables + asan.
Adrian Prantl [Thu, 13 Apr 2017 18:06:59 +0000 (18:06 +0000)]
Add a test for __block variables + asan.

llvm-svn: 300228

7 years ago[AMDGPU] Combine DS operations with offsets bigger than byte
Stanislav Mekhanoshin [Thu, 13 Apr 2017 17:53:07 +0000 (17:53 +0000)]
[AMDGPU] Combine DS operations with offsets bigger than byte

In many cases ds operations can be combined even if offsets do not
fit into 8 bit encoding. What it takes is to adjust base address.

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

llvm-svn: 300227

7 years agoFollow-up to r300225: update ClangFormat.sln to VS2017
Hans Wennborg [Thu, 13 Apr 2017 17:47:47 +0000 (17:47 +0000)]
Follow-up to r300225: update ClangFormat.sln to VS2017

This got lost in the previous patch somehow.

llvm-svn: 300226

7 years agoWarning-free clang-format plugin install for VS 15.0
Hans Wennborg [Thu, 13 Apr 2017 17:42:45 +0000 (17:42 +0000)]
Warning-free clang-format plugin install for VS 15.0

With the new release of VS, it's required that all plugins migrate to
the new VSIX manifest format. The new format is backwards compatible
with all versions newer that Visual Studio 2012, so this migration
effectively drops support for older versions of the IDE.

It's also required that these new extensions are built with Visual
Studio 2017, so unfortunately it was necessary to migrate the project
and solution. Also removed COM references to EnvDTE and
Microsoft.VisualStudio.TextManager.Interop from the csproj, as they seem
to both be unnecessary and would trigger build warnings because of
changes to GAC.

Patch by Hugo Puhlmann!

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

llvm-svn: 300225

7 years ago[APSInt] Remove named And/Or/Xor methods.
Craig Topper [Thu, 13 Apr 2017 17:39:46 +0000 (17:39 +0000)]
[APSInt] Remove named And/Or/Xor methods.

No one uses them and I may improve the operator&, operator|, and operator^ to better reuse memory allocations like APInt.

llvm-svn: 300224

7 years agoclang-format-vs: Use a separate license.txt copy
Hans Wennborg [Thu, 13 Apr 2017 17:37:17 +0000 (17:37 +0000)]
clang-format-vs: Use a separate license.txt copy

The regular file used to display very poorly in the VSIX installer due
to long lines, wrapping etc.

llvm-svn: 300223

7 years ago[InstCombine] use similar ops for related folds; NFCI
Sanjay Patel [Thu, 13 Apr 2017 17:36:24 +0000 (17:36 +0000)]
[InstCombine] use similar ops for related folds; NFCI

It's less efficient to produce 'ule' than 'ult' since we know we're going to
canonicalize to 'ult', but we shouldn't have duplicated code for these folds.

As a trade-off, this was a pretty terrible way to make a '2'. :)
       if (LHSC == SubOne(RHSC))
         AddC = ConstantExpr::getSub(AddOne(RHSC), LHSC);

The next steps are to share the code to fix PR32524 and add the missing 'and'
fold that was left out when PR14708 was fixed:
https://bugs.llvm.org/show_bug.cgi?id=14708

llvm-svn: 300222

7 years agoDon't assume PTHREAD_CREATE_JOINABLE is 0 on all systems
Francis Ricci [Thu, 13 Apr 2017 17:28:52 +0000 (17:28 +0000)]
Don't assume PTHREAD_CREATE_JOINABLE is 0 on all systems

Summary:
Lsan was using PTHREAD_CREATE_JOINABLE/PTHREAD_CREATE_DETACHED
as truthy values, which works on Linux, where the values are 0 and 1,
but this fails on OS X, where the values are 1 and 2.

Set PTHREAD_CREATE_DETACHED to the correct value for a given system.

Reviewers: kcc, glider, kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300221

7 years agoKMP_HW_SUBSET extended with NUMA support when HWLOC enabled
Andrey Churbanov [Thu, 13 Apr 2017 17:15:07 +0000 (17:15 +0000)]
KMP_HW_SUBSET extended with NUMA support when HWLOC enabled

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

llvm-svn: 300220

7 years ago[APInt] Fix the returns description for the postfix increment/decrement operators...
Craig Topper [Thu, 13 Apr 2017 17:12:00 +0000 (17:12 +0000)]
[APInt] Fix the returns description for the postfix increment/decrement operators. NFC

llvm-svn: 300219

7 years agoImplement LWG#2855 - made easy by previous refactoring
Marshall Clow [Thu, 13 Apr 2017 16:57:42 +0000 (16:57 +0000)]
Implement LWG#2855 - made easy by previous refactoring

llvm-svn: 300218

7 years agoRevert r300213 "[APSInt] Add a static_assert to ensure APSInt is packed well with...
Craig Topper [Thu, 13 Apr 2017 16:54:25 +0000 (16:54 +0000)]
Revert r300213 "[APSInt] Add a static_assert to ensure APSInt is packed well with APInt after r300171"

MSVC doesn't pack derived classes the same way clang/gcc do.

llvm-svn: 300217

7 years agoCache size per class size in SizeClassAllocatorXLocalCache.
Alex Shlyapnikov [Thu, 13 Apr 2017 16:49:16 +0000 (16:49 +0000)]
Cache size per class size in SizeClassAllocatorXLocalCache.

Summary:
Allocator::ClassIdToSize() is not free and calling it in every
Allocate/Deallocate has noticeable impact on perf.
Reapplying D31991 with the appropriate fixes.

Reviewers: cryptoad

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 300216

7 years ago[Analysis] Support bitreverse in -demanded-bits pass
Brian Gesiak [Thu, 13 Apr 2017 16:44:25 +0000 (16:44 +0000)]
[Analysis] Support bitreverse in -demanded-bits pass

Summary:
* Add a bitreverse case in the demanded bits analysis pass.
* Add tests for the bitreverse (and bswap) intrinsic in the
  demanded bits pass.
* Add a test case to the BDCE tests: that manipulations to
  high-order bits are eliminated once the bits are reversed
  and then right-shifted.

Reviewers: mkuper, jmolloy, hfinkel, trentxintong

Reviewed By: jmolloy

Subscribers: llvm-commits

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

llvm-svn: 300215

7 years agoUse the clang-cl recognized spelling of --target=
Reid Kleckner [Thu, 13 Apr 2017 16:36:28 +0000 (16:36 +0000)]
Use the clang-cl recognized spelling of --target=

This fixes a warning. The test was passing without this change.

llvm-svn: 300214

7 years ago[APSInt] Add a static_assert to ensure APSInt is packed well with APInt after r300171.
Craig Topper [Thu, 13 Apr 2017 16:34:49 +0000 (16:34 +0000)]
[APSInt] Add a static_assert to ensure APSInt is packed well with APInt after r300171.

llvm-svn: 300213

7 years ago[DeLICM] Introduce unittesting infrastructure for Known and Written. NFC.
Michael Kruse [Thu, 13 Apr 2017 16:32:46 +0000 (16:32 +0000)]
[DeLICM] Introduce unittesting infrastructure for Known and Written. NFC.

llvm-svn: 300212

7 years ago[DeLICM] Export Known and Written to DeLICMTests. NFC.
Michael Kruse [Thu, 13 Apr 2017 16:32:39 +0000 (16:32 +0000)]
[DeLICM] Export Known and Written to DeLICMTests. NFC.

This will allow unittesting of new functionality based on
Known and Written.

llvm-svn: 300211

7 years ago[DeLICM] Add Knowledge::Known. NFC.
Michael Kruse [Thu, 13 Apr 2017 16:32:31 +0000 (16:32 +0000)]
[DeLICM] Add Knowledge::Known. NFC.

This field will later contain a ValInst that is known to be stored
in an occupied array element.

llvm-svn: 300210

7 years agoRe-land "[clang-cl] Make all sanitizer flags available in clang-cl"
Reid Kleckner [Thu, 13 Apr 2017 16:32:26 +0000 (16:32 +0000)]
Re-land "[clang-cl] Make all sanitizer flags available in clang-cl"

Adding RUN lines with %clang_cl was causing these tests to fail on Mac
because absolute paths there tend to start with "/User/", which is
recognized as the "/U" flag.

Re-lands r300122

llvm-svn: 300209

7 years ago[DeLICM] Make Knowledge::Written an isl::union_map. NFC.
Michael Kruse [Thu, 13 Apr 2017 16:32:25 +0000 (16:32 +0000)]
[DeLICM] Make Knowledge::Written an isl::union_map. NFC.

The map will later point to a ValInst that is written.

llvm-svn: 300208

7 years ago[DeLICM] Rename Knowledge to KnowledgeStr. NFC.
Michael Kruse [Thu, 13 Apr 2017 16:32:16 +0000 (16:32 +0000)]
[DeLICM] Rename Knowledge to KnowledgeStr. NFC.

Some debuggers get confused by different class of the same name
defined independently in different translation units.

llvm-svn: 300207

7 years ago[libc++] Explicitly set output directory for DLL
Shoaib Meenai [Thu, 13 Apr 2017 16:27:38 +0000 (16:27 +0000)]
[libc++] Explicitly set output directory for DLL

DLLs on Windows are treated as runtime targets. Explicitly set the
output directory for them, to be consistent with other platforms.

llvm-svn: 300206

7 years agoLTO: Pass SF_Executable flag through to InputFile::Symbol
Tobias Edler von Koch [Thu, 13 Apr 2017 16:24:14 +0000 (16:24 +0000)]
LTO: Pass SF_Executable flag through to InputFile::Symbol

Summary:
The linker needs to be able to determine whether a symbol is text or data to
handle the case of a common being overridden by a strong definition in an
archive. If the archive contains a text member of the same name as the common,
that function is discarded. However, if the archive contains a data member of
the same name, that strong definition overrides the common. This is a behavior
of ld.bfd, which the Qualcomm linker also supports in LTO.

Here's a test case to illustrate:

####

cat > 1.c << \!
int blah;
!

cat > 2.c << \!
int blah() {
  return 0;
}
!

cat > 3.c << \!
int blah = 20;
!

clang -c 1.c
clang -c 2.c
clang -c 3.c

ar cr lib.a 2.o 3.o
ld 1.o lib.a -t

####

The correct output is:

1.o
(lib.a)3.o

Thanks to Shankar Easwaran and Hemant Kulkarni for the test case!

Reviewers: mehdi_amini, rafael, pcc, davide

Reviewed By: pcc

Subscribers: davide, llvm-commits, inglorion

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

llvm-svn: 300205

7 years agoEnable LSan on PowerPC64.
Alex Shlyapnikov [Thu, 13 Apr 2017 16:17:32 +0000 (16:17 +0000)]
Enable LSan on PowerPC64.

Summary:
With D31555 commited, looks like basic LSan functionality
works on PPC64. Time to enable LSan there.

Reviewers: eugenis

Subscribers: nemanjai, llvm-commits

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

llvm-svn: 300204

7 years ago[Hexagon] Unxfail passing tests
Krzysztof Parzyszek [Thu, 13 Apr 2017 16:05:35 +0000 (16:05 +0000)]
[Hexagon] Unxfail passing tests

r300198 fixed a problem that caused two tests to be xfailed. Unxfail
these tests now, since they are passing.

llvm-svn: 300203

7 years ago[InstCombine] fix assert to not always be true
Sanjay Patel [Thu, 13 Apr 2017 16:05:01 +0000 (16:05 +0000)]
[InstCombine] fix assert to not always be true

llvm-svn: 300202

7 years ago[InstCombine] add/move tests for or-of-icmps; NFC
Sanjay Patel [Thu, 13 Apr 2017 15:46:39 +0000 (15:46 +0000)]
[InstCombine] add/move tests for or-of-icmps; NFC

If we had these tests, the bug caused by https://reviews.llvm.org/rL299851 would have been caught sooner.
There's also an assert in the code that should have caught that bug, but the assert line itself has a bug.

llvm-svn: 300201

7 years agoRe-apply "[GVNHoist] Move GVNHoist to function simplification part of pipeline."
Geoff Berry [Thu, 13 Apr 2017 15:36:25 +0000 (15:36 +0000)]
Re-apply "[GVNHoist] Move GVNHoist to function simplification part of pipeline."

This reverts commit r296872 now that PR32153 has been fixed.

llvm-svn: 300200

7 years ago[Hexagon] Implement HexagonTargetLowering::CanLowerReturn
Krzysztof Parzyszek [Thu, 13 Apr 2017 15:05:51 +0000 (15:05 +0000)]
[Hexagon] Implement HexagonTargetLowering::CanLowerReturn

Patch by Michael Wu.

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

llvm-svn: 300199

7 years ago[Hexagon] Fix "LowerFormalArguments emitted a value with the wrong type!" assertion
Krzysztof Parzyszek [Thu, 13 Apr 2017 15:00:18 +0000 (15:00 +0000)]
[Hexagon] Fix "LowerFormalArguments emitted a value with the wrong type!" assertion

Patch by Michael Wu.

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

llvm-svn: 300198

7 years agoRefactor throw_with_nested. NFC.
Marshall Clow [Thu, 13 Apr 2017 14:41:45 +0000 (14:41 +0000)]
Refactor throw_with_nested. NFC.

llvm-svn: 300197

7 years agoUse methods to access data stored with frame instructions
Serge Pavlov [Thu, 13 Apr 2017 14:10:52 +0000 (14:10 +0000)]
Use methods to access data stored with frame instructions

Instructions CALLSEQ_START..CALLSEQ_END and their target dependent
counterparts keep data like frame size, stack adjustment etc. These
data are accessed by getOperand using hard coded indices. It is
error prone way. This change implements the access by special methods,
which improve readability and allow changing data representation without
massive changes of index values.

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

llvm-svn: 300196

7 years agoFree zone name when destroying malloc zone
Francis Ricci [Thu, 13 Apr 2017 14:00:24 +0000 (14:00 +0000)]
Free zone name when destroying malloc zone

Summary:
The darwin interceptor for malloc_destroy_zone manually frees the
zone struct, but does not free the name component. Make sure to
free the name if it has been set.

Reviewers: kubamracek, alekseyshl

Subscribers: llvm-commits

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

llvm-svn: 300195

7 years ago[lsan] Reenable lsan tests on ARM bots
Maxim Ostapenko [Thu, 13 Apr 2017 12:00:56 +0000 (12:00 +0000)]
[lsan] Reenable lsan tests on ARM bots

This patch addresses pr32636. Enable lsan tests on ARM bots filtering out Thumb targets.
Tested locally on ARM Arndale board in two configurations:

1) CFLAGS="-march=armv7-a"
Testing Time: 37.57s
Expected Passes    : 69
Unsupported Tests  : 7

2) CFLAGS="-march=armv7-a -mthumb"
Testing Time: 0.16s
Unsupported Tests  : 76

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

llvm-svn: 300194

7 years agollvm/test/BugPoint/compile-custom.ll: Use %/s for its path not to be mis-escaped.
NAKAMURA Takumi [Thu, 13 Apr 2017 11:40:32 +0000 (11:40 +0000)]
llvm/test/BugPoint/compile-custom.ll: Use %/s for its path not to be mis-escaped.

llvm-svn: 300193

7 years ago[ELF] Tidy up handleARMTlsRelocation [NFC]
Peter Smith [Thu, 13 Apr 2017 10:56:40 +0000 (10:56 +0000)]
[ELF] Tidy up handleARMTlsRelocation [NFC]

Replace addModuleReloc with AddTlsReloc so that we can use it for both the
module relocation and the offset relocation.

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

llvm-svn: 300192

7 years agoAdd TEST_NOEXCEPT_FALSE to support D31738
Eric Fiselier [Thu, 13 Apr 2017 10:17:23 +0000 (10:17 +0000)]
Add TEST_NOEXCEPT_FALSE to support D31738

llvm-svn: 300191

7 years ago[X86] Added missing mayLoad/mayStore attributes to some X86 instructions.
Ayman Musa [Thu, 13 Apr 2017 10:03:45 +0000 (10:03 +0000)]
[X86] Added missing mayLoad/mayStore attributes to some X86 instructions.

Throughout the effort of automatically generating the X86 memory folding tables these missing information were encountered.
This is a preparation work for a future patch including the automation of these tables.

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

llvm-svn: 300190

7 years ago[analyzer] Enforce super-region classes for various memory regions.
Artem Dergachev [Thu, 13 Apr 2017 09:56:07 +0000 (09:56 +0000)]
[analyzer] Enforce super-region classes for various memory regions.

We now check the type of the super-region pointer for most SubRegion classes
in compile time; some checks are run-time though.

This is an API-breaking change (we now require explicit casts to specific region
sub-classes), but in practice very few checkers are affected.

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

llvm-svn: 300189

7 years ago[DWARF] - Simplify (use dyn_cast instead of isa + cast).
George Rimar [Thu, 13 Apr 2017 09:52:50 +0000 (09:52 +0000)]
[DWARF] - Simplify (use dyn_cast instead of isa + cast).

This addresses post commit review comments for r300039.

llvm-svn: 300188

7 years ago[analyzer] Add numerous assertions to SVal, SymExpr, and MemRegion classes.
Artem Dergachev [Thu, 13 Apr 2017 09:48:05 +0000 (09:48 +0000)]
[analyzer] Add numerous assertions to SVal, SymExpr, and MemRegion classes.

Clean up vtable anchors (remove anchors for regions that have regular
out-of-line virtual methods, add anchors for regions that don't have those).

Fix private/public methods (all constructors should now be private for leaf
classes, protected for abstract classes).

No functional change intended, only extra sanity checks and cleanups.

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

llvm-svn: 300187

7 years ago[globalisel][tablegen] Report more detail in some SelectionDAG import failures. NFC
Daniel Sanders [Thu, 13 Apr 2017 09:45:37 +0000 (09:45 +0000)]
[globalisel][tablegen] Report more detail in some SelectionDAG import failures. NFC

Reviewers: ab, t.p.northover, qcolombet, aditya_nandakumar, rovka

Reviewed By: ab

Subscribers: dberris, kristof.beyls, igorb, llvm-commits

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

llvm-svn: 300186

7 years agoReverting cmake/modules/AddLLVM.cmake changes from revision 300184 (Added by mistake).
Ayman Musa [Thu, 13 Apr 2017 09:26:49 +0000 (09:26 +0000)]
Reverting cmake/modules/AddLLVM.cmake changes from revision 300184 (Added by mistake).

llvm-svn: 300185

7 years ago[X86] Change instructions names to keep consistency with the naming convention. NFC
Ayman Musa [Thu, 13 Apr 2017 09:12:32 +0000 (09:12 +0000)]
[X86] Change instructions names to keep consistency with the naming convention. NFC

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

llvm-svn: 300184

7 years ago[LV] Refactor ILV to provide vectorizeInstruction(); NFC
Ayal Zaks [Thu, 13 Apr 2017 09:07:23 +0000 (09:07 +0000)]
[LV] Refactor ILV to provide vectorizeInstruction(); NFC

Refactoring InnerLoopVectorizer's vectorizeBlockInLoop() to provide
vectorizeInstruction(). Aligning DeadInstructions with its only user.
Facilitates driving the transformation by VPlan - follows
https://reviews.llvm.org/D28975 and its tentative breakdown.

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

llvm-svn: 300183

7 years ago[ELF] Mark ARM Exceptions that refer to folded code as not live
Peter Smith [Thu, 13 Apr 2017 08:52:58 +0000 (08:52 +0000)]
[ELF] Mark ARM Exceptions that refer to folded code as not live

ARM Exception Index Table sections .ARM.exidx have an implicit dependency
on code sections via SHF_LINK_ORDER. When code sections are folded by ICF
we must mark the unique .ARM.exidx table that describes it as not live
to prevent an illegal entry in the exception table.

Note that we do not try and follow the relocations from the .ARM.exidx
section to the .ARM.extab sections to mark these as not live. Leaving
these sections is not a correctness problem. In theory these could be
removed via an application of garbage collection.

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

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

llvm-svn: 300182

7 years agoRevert "[clang-cl] Make all sanitizer flags available in clang-cl"
Akira Hatanaka [Thu, 13 Apr 2017 08:02:29 +0000 (08:02 +0000)]
Revert "[clang-cl] Make all sanitizer flags available in clang-cl"

This reverts commit 47979b20b475664013d19382fc6875b5b9f3ed9d.

This was causing a couple of bots to fail.

http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/30152

llvm-svn: 300181

7 years agoRevert "Cache size per class size in SizeClassAllocatorXLocalCache."
Diana Picus [Thu, 13 Apr 2017 07:39:04 +0000 (07:39 +0000)]
Revert "Cache size per class size in SizeClassAllocatorXLocalCache."

This reverts commit r300107 because it broke the ARM and AArch64
buildbots.

llvm-svn: 300180