platform/upstream/llvm.git
7 years agoclang/test/CoverageMapping/unused_names.c: Relax an expression for targeting PECOFF.
NAKAMURA Takumi [Fri, 14 Apr 2017 03:16:48 +0000 (03:16 +0000)]
clang/test/CoverageMapping/unused_names.c: Relax an expression for targeting PECOFF.

llvm-svn: 300303

7 years agoFix test failure on windows: pass module to getInstrProfXXName calls
Xinliang David Li [Fri, 14 Apr 2017 03:03:24 +0000 (03:03 +0000)]
Fix test failure on windows: pass module to getInstrProfXXName calls

llvm-svn: 300302

7 years agoRemove unused function /nfc
Xinliang David Li [Fri, 14 Apr 2017 03:01:25 +0000 (03:01 +0000)]
Remove unused function /nfc

llvm-svn: 300301

7 years agoObject, LTO: Add target triple to irsymtab and LTO API.
Peter Collingbourne [Fri, 14 Apr 2017 02:55:06 +0000 (02:55 +0000)]
Object, LTO: Add target triple to irsymtab and LTO API.

Start using it in LLD to avoid needing to read bitcode again just to get the
target triple, and in llvm-lto2 to avoid printing symbol table information
that is inappropriate for the target.

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

llvm-svn: 300300

7 years agoNewGVN: Don't propagate over phi backedges where undef causes us to
Daniel Berlin [Fri, 14 Apr 2017 02:53:37 +0000 (02:53 +0000)]
NewGVN: Don't propagate over phi backedges where undef causes us to
have >1 value, unless we can prove the phi node is cycle free.

Fixes PR 32607.

llvm-svn: 300299

7 years agoCOFF: Remove some unused fields.
Peter Collingbourne [Fri, 14 Apr 2017 02:34:47 +0000 (02:34 +0000)]
COFF: Remove some unused fields.

llvm-svn: 300298

7 years agoELF: Remove some dead code.
Peter Collingbourne [Fri, 14 Apr 2017 02:34:32 +0000 (02:34 +0000)]
ELF: Remove some dead code.

llvm-svn: 300297

7 years agoRemove empty test directory for nonexistent standard clause.
Richard Smith [Fri, 14 Apr 2017 02:04:44 +0000 (02:04 +0000)]
Remove empty test directory for nonexistent standard clause.

llvm-svn: 300296

7 years ago[docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin
Vedant Kumar [Fri, 14 Apr 2017 01:59:44 +0000 (01:59 +0000)]
[docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin

Printing out stack traces along with UBSan diagnostics is unsupported on
Darwin. That's because it isn't possible to use the fast unwinder or the
slow unwinder.

Apparently, it's inappropriate to use the fast unwinder for UBSan
issues. I'm not exactly sure why (see the comment in ubsan_diag.cc).
Forcing use of the fast unwinder produces decent results, AFAICT.

Darwin also does not appear to have a slow unwinder suitable for use
with the sanitizers. Apparently that's because of PR20800 [1][2]. But
that bug has been fixed. I'm not sure if there is anything preventing
use of the slow unwinder now.

Currently, passing UBSAN_OPTIONS=print_stacktrace=1 does nothing on
Darwin. This isn't good, but it might be a while before we can fix the
situation, so we should at least document it.

[1] https://github.com/google/sanitizers/issues/137
"We can't use the slow unwinder on OSX now, because Clang produces
incorrect unwind info for the ASan runtime functions on OSX
(http://llvm.org/PR20800)."

[2] https://bugs.llvm.org/show_bug.cgi?id=20800
Bug 20800 - Invalid compact unwind info generated for a function without
frame pointers on OSX

llvm-svn: 300295

7 years agoRemove useless local variable.
Rui Ueyama [Fri, 14 Apr 2017 01:35:04 +0000 (01:35 +0000)]
Remove useless local variable.

llvm-svn: 300294

7 years agoReplace uintX_t with uint64_t.
Rui Ueyama [Fri, 14 Apr 2017 01:34:45 +0000 (01:34 +0000)]
Replace uintX_t with uint64_t.

We generally want to use uint64_t instead of uintX_t if the 64-bit
type works for both 32-bit and 64-bit because it is simpler than
the variable-size type.

llvm-svn: 300293

7 years agoUse range-for; NFC
Sanjoy Das [Fri, 14 Apr 2017 01:33:15 +0000 (01:33 +0000)]
Use range-for; NFC

llvm-svn: 300292

7 years agoUse transform instead of manual loop; NFC
Sanjoy Das [Fri, 14 Apr 2017 01:33:13 +0000 (01:33 +0000)]
Use transform instead of manual loop; NFC

llvm-svn: 300291

7 years agoRevert r300287.
Kuba Mracek [Fri, 14 Apr 2017 01:00:03 +0000 (01:00 +0000)]
Revert r300287.

llvm-svn: 300290

7 years agoLLVMCodeGen: Add ProfileData into deps corresponding to r300277.
NAKAMURA Takumi [Fri, 14 Apr 2017 00:36:06 +0000 (00:36 +0000)]
LLVMCodeGen: Add ProfileData into deps corresponding to r300277.

llvm-svn: 300289

7 years ago[AMDGPU] added SIInstrInfo::getAddNoCarry() helper
Stanislav Mekhanoshin [Fri, 14 Apr 2017 00:33:44 +0000 (00:33 +0000)]
[AMDGPU] added SIInstrInfo::getAddNoCarry() helper

Addressed rest of post submit comments from D31993.

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

llvm-svn: 300288

7 years ago[ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt
Kuba Mracek [Fri, 14 Apr 2017 00:32:43 +0000 (00:32 +0000)]
[ObjC] Fix lifetime markers of loop variable in EmitObjCForCollectionStmt

CodeGenFunction::EmitObjCForCollectionStmt currently emits lifetime markers for the loop variable in an inconsistent way:  lifetime.start is emitted before the loop is entered, but lifetime.end is emitted inside the loop.  AddressSanitizer uses these markers to track out-of-scope accesses to local variables, and we get false positives in Obj-C foreach loops (in the 2nd iteration of the loop). The markers of the loop variable need to be either both inside the loop (so that we poison and unpoison the variable in each iteration), or both outside. This patch implements the "both inside" approach.

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

llvm-svn: 300287

7 years ago[ORC] Re-enable the Error/Expected unit tests that were disabled in r300177.
Lang Hames [Fri, 14 Apr 2017 00:06:12 +0000 (00:06 +0000)]
[ORC] Re-enable the Error/Expected unit tests that were disabled in r300177.

The tests were failing due to an occasional deadlock in SerializationTraits
for Error: Both serializers and deserializers were protected by a single
mutex and in the unit test (where both ends of the RPC are in the same
process) one side might obtain the mutex, then block waiting for input,
leaving the other side of the connection unable to obtain the mutex to
write the data the first side was waiting for. Splitting the mutex into
two (one for serialization, one for deserialization) appears to have fixed the
issue.

llvm-svn: 300286

7 years agoSimplify some Verifier attribute checks with AttributeSet
Reid Kleckner [Fri, 14 Apr 2017 00:06:06 +0000 (00:06 +0000)]
Simplify some Verifier attribute checks with AttributeSet

Now that we have a type that can represent the attributes on a single
return, function, or parameter, we can pass it around directly rather
than passing around AttributeList and Idx. Removes some more one-based
argument attribute index counting.

NFC

llvm-svn: 300285

7 years agoRemove useless namespaces.
Rui Ueyama [Thu, 13 Apr 2017 23:49:54 +0000 (23:49 +0000)]
Remove useless namespaces.

llvm-svn: 300284

7 years agoFix PR31934: forming refs to functions with enable_if attrs.
George Burgess IV [Thu, 13 Apr 2017 23:47:08 +0000 (23:47 +0000)]
Fix PR31934: forming refs to functions with enable_if attrs.

llvm-svn: 300283

7 years agoMIRLangRef: Add a section on simplifying .mir tests
Matthias Braun [Thu, 13 Apr 2017 23:45:14 +0000 (23:45 +0000)]
MIRLangRef: Add a section on simplifying .mir tests

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

llvm-svn: 300282

7 years agoRename readOutputSectionFiller parseFill.
Rui Ueyama [Thu, 13 Apr 2017 23:40:19 +0000 (23:40 +0000)]
Rename readOutputSectionFiller parseFill.

"read" is used as a prefix for functions that read tokens from input
streams. This function doesn't really read anything, but just parses
a given string as an integer, so rename.

llvm-svn: 300281

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