platform/upstream/llvm.git
7 years ago[Sema] Extend -Wenum-compare to handle mixed enum comparisons in switch statements
Gabor Horvath [Wed, 9 Aug 2017 08:57:09 +0000 (08:57 +0000)]
[Sema] Extend -Wenum-compare to handle mixed enum comparisons in switch statements

Patch by: Reka Nikolett Kovacs

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

llvm-svn: 310449

7 years ago[PPCGCodeGeneration] Compute element size in bytes for arrays correctly.
Siddharth Bhat [Wed, 9 Aug 2017 08:29:16 +0000 (08:29 +0000)]
[PPCGCodeGeneration] Compute element size in bytes for arrays correctly.

Previously, we used to compute this with `elementSizeInBits / 8`. This
would yield an element size of 0 when the array had element size < 8 in
bits.

To fix this, ask data layout what the size in bytes should be.

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

llvm-svn: 310448

7 years ago[X86] Add the rest of the ADC and SBB instructions to isDefConvertible.
Craig Topper [Wed, 9 Aug 2017 06:17:49 +0000 (06:17 +0000)]
[X86] Add the rest of the ADC and SBB instructions to isDefConvertible.

I don't know if this really affects anything. Just thought it was weird that we had all of the ADD/SUB/AND/OR/XOR instructions.

llvm-svn: 310447

7 years ago[InstCombine] Use regular dyn_cast instead of a matcher for a simple case. NFC
Craig Topper [Wed, 9 Aug 2017 06:17:48 +0000 (06:17 +0000)]
[InstCombine] Use regular dyn_cast instead of a matcher for a simple case. NFC

llvm-svn: 310446

7 years agoAttempt #2 to appease buildbots
George Burgess IV [Wed, 9 Aug 2017 06:07:08 +0000 (06:07 +0000)]
Attempt #2 to appease buildbots

"error: unable to create target: 'No available targets are compatible
with this triple.'"

llvm-svn: 310445

7 years agoAttempt to appease msc buildbot
George Burgess IV [Wed, 9 Aug 2017 05:20:05 +0000 (05:20 +0000)]
Attempt to appease msc buildbot

It was timing out on this test, but for reasons unrelated to the
specific bug it was testing for. Randomly breaking in gdb with `clang
-target i686-windows -fmsc-version=1700` reveals *many* frames from
MicrosoftCXXNameMangler. So, it would seem that some caching is needed
there, as well...

Fingers crossed that specifying a triple is sufficient to work around
this.

llvm-svn: 310444

7 years ago[ImplicitNullCheck] Fix the bug when dependent instruction accesses memory
Serguei Katkov [Wed, 9 Aug 2017 05:17:02 +0000 (05:17 +0000)]
[ImplicitNullCheck] Fix the bug when dependent instruction accesses memory

It is possible that dependent instruction may access memory.
In this case we must reject optimization because the memory change will
be visible in null handler basic block. So we will execute an instruction which
we must not execute if check fails.

Reviewers: sanjoy, reames
Reviewed By: sanjoy
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36392

llvm-svn: 310443

7 years agoFix broken pdb test.
Zachary Turner [Wed, 9 Aug 2017 04:48:16 +0000 (04:48 +0000)]
Fix broken pdb test.

For some reason I didn't see this failure the first time.  The
output format changed slightly, so we just have to update the
test for the new format.

llvm-svn: 310442

7 years ago[clang-fuzzer] Resolve proto dependencies
Vitaly Buka [Wed, 9 Aug 2017 04:45:00 +0000 (04:45 +0000)]
[clang-fuzzer] Resolve proto dependencies

llvm-svn: 310441

7 years agoFix -Wreorder-fields warning.
Zachary Turner [Wed, 9 Aug 2017 04:34:11 +0000 (04:34 +0000)]
Fix -Wreorder-fields warning.

llvm-svn: 310440

7 years ago[PDB] Fix an issue writing the publics stream.
Zachary Turner [Wed, 9 Aug 2017 04:23:59 +0000 (04:23 +0000)]
[PDB] Fix an issue writing the publics stream.

In the refactor to merge the publics and globals stream, a bug
was introduced that wrote the wrong value for one of the fields
of the PublicsStreamHeader.  This caused debugging in WinDbg
to break.

We had no way of dumping any of these fields, so in addition to
fixing the bug I've added dumping support for them along with a
test that verifies the correct value is written.

llvm-svn: 310439

7 years ago[PDB] Merge Global and Publics Builders.
Zachary Turner [Wed, 9 Aug 2017 04:23:25 +0000 (04:23 +0000)]
[PDB] Merge Global and Publics Builders.

The publics stream and globals stream are very similar. They both
contain a list of hash buckets that refer into a single shared stream,
the symbol record stream. Because of the need for each builder to manage
both an independent hash stream as well as a single shared record
stream, making the two builders be independent entities is not the right
design. This patch merges them into a single class, of which only a
single instance is needed to create all 3 streams.  PublicsStreamBuilder
and GlobalsStreamBuilder are now merged into the single GSIStreamBuilder
class, which writes all 3 streams at once.

Note that this patch does not contain any functionality change. So we're
still not yet writing any records to the globals stream. All we're doing
is making it so that when we do start writing records to the globals,
this refactor won't have to be part of that patch.

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

llvm-svn: 310438

7 years ago[AST] Cache intermediate visibility/linkage results
George Burgess IV [Wed, 9 Aug 2017 04:12:17 +0000 (04:12 +0000)]
[AST] Cache intermediate visibility/linkage results

This is a follow-up to r310436 with actual functional changes. Please
see that commit message for a description of why a cache is appearing
here.

Suggestions for less-bad ways of testing this are appreciated. :)

This fixes PR29160.

llvm-svn: 310437

7 years ago[AST] Move visibility computations into a class; NFC
George Burgess IV [Wed, 9 Aug 2017 04:02:49 +0000 (04:02 +0000)]
[AST] Move visibility computations into a class; NFC

This is patch 1 in a 2 patch series that aims to fix PR29160. Its goal
is to cache decl visibility/linkage for the duration of each
visibility+linkage query.

The simplest way I can see to do this is to put the visibility
calculation code that needs to (transitively) access this cache into a
class, which is what this patch does. Actual caching will come in patch
2. (Another way would be to keep the cache in ASTContext + manually
invalidate it or something, but that felt way too subtle to me.)

Caching visibility results across multiple queries seems a bit tricky,
since the user can add visibility attributes ~whenever they want, and
these attributes can apparently have far-reaching effects (e.g. class
visibility extends to its members, ...). Because a cache that's dropped
at the end of each top-level query seems to work nearly as well and
doesn't require any eviction logic, I opted for that design.

llvm-svn: 310436

7 years agoAllow operator delete to be an invalid Decl.
Richard Trieu [Wed, 9 Aug 2017 02:03:59 +0000 (02:03 +0000)]
Allow operator delete to be an invalid Decl.

Do not discard invalid Decl when searching for the operator delete function.
The lookup for this function always expects to find a result, so sometimes the
invalid Decl is the only choice possible.  This fixes PR34109.

llvm-svn: 310435

7 years ago[InstCombine] Add a test case for a missed opportunity to turn a select into logic...
Craig Topper [Wed, 9 Aug 2017 01:30:22 +0000 (01:30 +0000)]
[InstCombine] Add a test case for a missed opportunity to turn a select into logic ops.

llvm-svn: 310434

7 years ago[OpenMP] Fix bug regarding cubin integration into host binary
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 01:02:19 +0000 (01:02 +0000)]
[OpenMP] Fix bug regarding cubin integration into host binary
when a BindArchAction is used.

This is not a functional change.

Original Diff: D29654

llvm-svn: 310433

7 years ago[asan] Refactor thread creation bookkeeping
Vitaly Buka [Wed, 9 Aug 2017 00:38:57 +0000 (00:38 +0000)]
[asan] Refactor thread creation bookkeeping

Summary:
This is a pure refactoring change.  It paves the way for OS-specific
implementations, such as Fuchsia's, that can do most of the
per-thread bookkeeping work in the creator thread before the new
thread actually starts.  This model is simpler and cleaner, avoiding
some race issues that the interceptor code for thread creation has
to do for the existing OS-specific implementations.

Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: alekseyshl

Subscribers: phosek, filcab, llvm-commits, kubamracek

Tags: #sanitizers

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

llvm-svn: 310432

7 years ago[asan] Complete the Fuchsia port
Vitaly Buka [Wed, 9 Aug 2017 00:21:45 +0000 (00:21 +0000)]
[asan] Complete the Fuchsia port

Submitted on behalf of Roland McGrath.

Reviewers: kcc, eugenis, alekseyshl, vitalybuka

Reviewed By: vitalybuka

Subscribers: filcab, vitalybuka, srhines, kubamracek, mgorny, phosek, llvm-commits

Tags: #sanitizers

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

llvm-svn: 310431

7 years ago[AMDGPU] Revert r310429 changes in AMDKernelCodeT.h which broke some build bots.
Eugene Zelenko [Wed, 9 Aug 2017 00:06:29 +0000 (00:06 +0000)]
[AMDGPU] Revert r310429 changes in AMDKernelCodeT.h which broke some build bots.

llvm-svn: 310430

7 years ago[AMDGPU] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Tue, 8 Aug 2017 23:53:55 +0000 (23:53 +0000)]
[AMDGPU] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 310429

7 years agoTry to appease compiler and break multiline comment.
Kamil Rytarowski [Tue, 8 Aug 2017 23:31:21 +0000 (23:31 +0000)]
Try to appease compiler and break multiline comment.

llvm-svn: 310428

7 years agoSema: disable implicit conversion from _Complex to real types in C++.
Tim Northover [Tue, 8 Aug 2017 23:18:05 +0000 (23:18 +0000)]
Sema: disable implicit conversion from _Complex to real types in C++.

Converting a _Complex type to a real one simply discards the imaginary part.
This can easily lead to loss of information so for safety (and GCC
compatibility) this patch disallows that when the conversion would be implicit.

The one exception is bool, which actually compares both real and imaginary
parts and so is safe.

llvm-svn: 310427

7 years agoRevert "Lexer: always allow imaginary constants in GNU mode."
Tim Northover [Tue, 8 Aug 2017 23:17:51 +0000 (23:17 +0000)]
Revert "Lexer: always allow imaginary constants in GNU mode."

This reverts r310423. It was committed by mistake, I intended to commit the
improved diagnostics for implicit conversions instead.

llvm-svn: 310426

7 years agoRevert "[GlobalISel] Remove the GISelAccessor API."
Quentin Colombet [Tue, 8 Aug 2017 22:22:30 +0000 (22:22 +0000)]
Revert "[GlobalISel] Remove the GISelAccessor API."

This reverts commit r310115.

It causes a linker failure for the one of the unittests of AArch64 on one
of the linux bot:
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/3429

: && /home/fedora/gcc/install/gcc-7.1.0/bin/g++   -fPIC
-fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W
-Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wno-missing-field-initializers -pedantic -Wno-long-long
-Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment
-ffunction-sections -fdata-sections -O2
-L/home/fedora/gcc/install/gcc-7.1.0/lib64 -Wl,-allow-shlib-undefined
-Wl,-O3 -Wl,--gc-sections
unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o  -o
unittests/Target/AArch64/AArch64Tests
lib/libLLVMAArch64CodeGen.so.6.0.0svn lib/libLLVMAArch64Desc.so.6.0.0svn
lib/libLLVMAArch64Info.so.6.0.0svn lib/libLLVMCodeGen.so.6.0.0svn
lib/libLLVMCore.so.6.0.0svn lib/libLLVMMC.so.6.0.0svn
lib/libLLVMMIRParser.so.6.0.0svn lib/libLLVMSelectionDAG.so.6.0.0svn
lib/libLLVMTarget.so.6.0.0svn lib/libLLVMSupport.so.6.0.0svn -lpthread
lib/libgtest_main.so.6.0.0svn lib/libgtest.so.6.0.0svn -lpthread
-Wl,-rpath,/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib
&& :
unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o:(.toc+0x0):
undefined reference to `vtable for llvm::LegalizerInfo'
unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o:(.toc+0x8):
undefined reference to `vtable for llvm::RegisterBankInfo'

The particularity of this bot is that it is built with
BUILD_SHARED_LIBS=ON

However, I was not able to reproduce the problem so far.
Reverting to unblock the bot.

llvm-svn: 310425

7 years agoMy commit r310346 introduced some valid warnings. This cleans them up.
Nemanja Ivanovic [Tue, 8 Aug 2017 22:17:31 +0000 (22:17 +0000)]
My commit r310346 introduced some valid warnings. This cleans them up.

llvm-svn: 310424

7 years agoLexer: always allow imaginary constants in GNU mode.
Tim Northover [Tue, 8 Aug 2017 22:03:54 +0000 (22:03 +0000)]
Lexer: always allow imaginary constants in GNU mode.

llvm-svn: 310423

7 years ago[MachineOutliner] Ensure AArch64 outliner doesn't mess with W30 or LR
Jessica Paquette [Tue, 8 Aug 2017 21:51:26 +0000 (21:51 +0000)]
[MachineOutliner] Ensure AArch64 outliner doesn't mess with W30 or LR

Before, the outliner would mark all instructions that read from/modify LR as
illegal. This doesn't handle W30, which overlaps with LR. This shouldn't be
outlined.

This commit fixes that by making modifiesRegister() and readsRegister() look at
W30 + take in a TRI argument. This makes sure that modifiesRegister() and
readsRegister() won't outline either of W30 and LR.

https://reviews.llvm.org/D36435

llvm-svn: 310422

7 years ago[GVN] Remove stale entries in phitranslate cache when new phi is generated for PRE
Wei Mi [Tue, 8 Aug 2017 21:40:14 +0000 (21:40 +0000)]
[GVN] Remove stale entries in phitranslate cache when new phi is generated for PRE

When a new phi is generated for scalarpre of an expression, the phiTranslate cache
will become stale: Before PRE, the candidate expression must not be available in a
predecessor block, and phitranslate will cache the information. After PRE, the
expression will become available in all predecessor blocks, so the related entries
in phiTranslate cache becomes stale. The patch will simply remove the stale entries
so phiTranslate can be recomputed next time.

The stale entries in phitranslate cache will not affect correctness but will cause
missing PRE opportunity for later instructions.

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

llvm-svn: 310421

7 years agoBasicAA: assert on another case where aliasGEP shouldn't get a PartialAlias response
Nuno Lopes [Tue, 8 Aug 2017 21:25:26 +0000 (21:25 +0000)]
BasicAA: assert on another case where aliasGEP shouldn't get a PartialAlias response

llvm-svn: 310420

7 years ago[winasan] Fix hotpatching ntdll!strcpy for Win10 creators edition
Reid Kleckner [Tue, 8 Aug 2017 21:18:36 +0000 (21:18 +0000)]
[winasan] Fix hotpatching ntdll!strcpy for Win10 creators edition

The 9 byte nop is a suffix of the 10 byte nop, and we need at most 6
bytes.

ntdll's version of strcpy is written in assembly and is very clever.
strcat tail calls strcpy but with a slightly different arrangement of
argument registers at an alternate entry point. It looks like this:

  ntdll!strcpy:
  00007ffd`64e8a7a0 4c8bd9          mov     r11,rcx
  ntdll!__entry_from_strcat_in_strcpy:
  00007ffd`64e8a7a3 482bca          sub     rcx,rdx
  00007ffd`64e8a7a6 f6c207          test    dl,7

If we overwrite more than two bytes in our interceptor, that label will
no longer be a valid instruction boundary.

By recognizing the 9 byte nop, we use the two byte backwards branch to
start our trampoline, avoiding this issue.

Fixes https://github.com/google/sanitizers/issues/829

Patch by David Major

llvm-svn: 310419

7 years ago[mips] Enable `long_call/short_call` attributes on MIPS64
Simon Atanasyan [Tue, 8 Aug 2017 21:17:33 +0000 (21:17 +0000)]
[mips] Enable `long_call/short_call` attributes on MIPS64

This change enables `long_call/short_call/far/near` attributes on
MIPS64 targets.

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

llvm-svn: 310418

7 years agoAdd existing unit tests to Xcode project
Tim Hammerquist [Tue, 8 Aug 2017 20:59:20 +0000 (20:59 +0000)]
Add existing unit tests to Xcode project

Summary:
This adds gtest test files to the Xcode project which were
previously only in the cmake config. This is the first of several
planned merges.

Reviewers: beanz, spyffe, jingham

Reviewed By: jingham

Subscribers: lldb-commits

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

llvm-svn: 310417

7 years agoMake ICP uses PSI to check for hotness.
Dehao Chen [Tue, 8 Aug 2017 20:57:33 +0000 (20:57 +0000)]
Make ICP uses PSI to check for hotness.

Summary: Currently, ICP checks the count against a fixed value to see if it is hot enough to be promoted. This does not work for SamplePGO because sampled count may be much smaller. This patch uses PSI to check if the count is hot enough to be promoted.

Reviewers: davidxl, tejohnson, eraman

Reviewed By: davidxl

Subscribers: sanjoy, llvm-commits, mehdi_amini

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

llvm-svn: 310416

7 years ago[demangler] Rename some variables, NFC
Erik Pilkington [Tue, 8 Aug 2017 20:57:10 +0000 (20:57 +0000)]
[demangler] Rename some variables, NFC

llvm-svn: 310415

7 years agoAdd NetBSD support in asan_malloc_linux.cc
Kamil Rytarowski [Tue, 8 Aug 2017 20:52:54 +0000 (20:52 +0000)]
Add NetBSD support in asan_malloc_linux.cc

Summary:
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, kcc, fjricci, vitalybuka, filcab

Reviewed By: fjricci

Subscribers: llvm-commits, kubamracek, #sanitizers

Tags: #sanitizers

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

llvm-svn: 310414

7 years agoAdd NetBSD support in asan_symbolize.py
Kamil Rytarowski [Tue, 8 Aug 2017 20:50:07 +0000 (20:50 +0000)]
Add NetBSD support in asan_symbolize.py

Summary:
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, filcab, vitalybuka, kcc, fjricci

Reviewed By: fjricci

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 310413

7 years agoEnable ubsan on NetBSD
Kamil Rytarowski [Tue, 8 Aug 2017 20:49:20 +0000 (20:49 +0000)]
Enable ubsan on NetBSD

Summary:
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, kcc, filcab, fjricci

Reviewed By: fjricci

Subscribers: srhines, kubamracek, mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 310412

7 years agoReuse sanitizer_linux for NetBSD
Kamil Rytarowski [Tue, 8 Aug 2017 20:36:10 +0000 (20:36 +0000)]
Reuse sanitizer_linux for NetBSD

Summary:
Follow FreeBSD and reuse sanitizer_linux for NetBSD.

Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, kcc, filcab, vitalybuka, fjricci, dvyukov

Reviewed By: fjricci

Subscribers: dvyukov, emaste, kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 310411

7 years ago[codeview] Emit nested enums and typedefs from classes
Reid Kleckner [Tue, 8 Aug 2017 20:30:14 +0000 (20:30 +0000)]
[codeview] Emit nested enums and typedefs from classes

Previously we limited ourselves to only emitting nested classes, but we
need other kinds of types as well.

This fixes the Visual Studio STL visualizers, so that users can
visualize std::string and other objects.

llvm-svn: 310410

7 years ago[sanitizer-coverage] -fsanitize-coverage=bb,inline-8bit-counters
Kostya Serebryany [Tue, 8 Aug 2017 20:20:40 +0000 (20:20 +0000)]
[sanitizer-coverage] -fsanitize-coverage=bb,inline-8bit-counters

llvm-svn: 310409

7 years agoIntegrate Kostya's clang-proto-fuzzer with LLVM.
Matt Morehouse [Tue, 8 Aug 2017 20:15:04 +0000 (20:15 +0000)]
Integrate Kostya's clang-proto-fuzzer with LLVM.

Summary:
The clang-proto-fuzzer models a subset of C++ as a protobuf and
uses libprotobuf-mutator to generate interesting mutations of C++
programs.  Clang-proto-fuzzer has already found several bugs in
Clang (e.g., https://bugs.llvm.org/show_bug.cgi?id=33747,
https://bugs.llvm.org/show_bug.cgi?id=33749).

As with clang-fuzzer, clang-proto-fuzzer requires the following
cmake flags:
- CMAKE_C_COMPILER=clang
- CMAKE_CXX_COMPILER=clang++
- LLVM_USE_SANITIZE_COVERAGE=YES  // needed for libFuzzer
- LLVM_USE_SANITIZER=Address  // needed for libFuzzer

In addition, clang-proto-fuzzer requires:
- CLANG_ENABLE_PROTO_FUZZER=ON

clang-proto-fuzzer also requires the following dependencies:
- binutils  // needed for libprotobuf-mutator
- liblzma-dev  // needed for libprotobuf-mutator
- libz-dev  // needed for libprotobuf-mutator
- docbook2x  // needed for libprotobuf-mutator
- Recent version of protobuf [3.3.0 is known to work]

A working version of libprotobuf-mutator will automatically be
downloaded and built as an external project.

Implementation of clang-proto-fuzzer provided by Kostya
Serebryany.

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

Reviewers: kcc, vitalybuka, bogner

Reviewed By: kcc, vitalybuka

Subscribers: thakis, mgorny, cfe-commits

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

llvm-svn: 310408

7 years ago[InstCombine] Support pulling left shifts through a subtract with constant LHS
Craig Topper [Tue, 8 Aug 2017 20:14:11 +0000 (20:14 +0000)]
[InstCombine] Support pulling left shifts through a subtract with constant LHS

We already support pulling through an add with constant RHS. We can do the same for subtract.

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

llvm-svn: 310407

7 years ago[coverage] Special-case calls to noreturn functions.
Eli Friedman [Tue, 8 Aug 2017 20:10:14 +0000 (20:10 +0000)]
[coverage] Special-case calls to noreturn functions.

The code after a noreturn call doesn't execute.

The pattern in the testcase is pretty common in LLVM (a switch with
a default case that calls llvm_unreachable).

The original version of this patch was reverted in r309995 due to a
crash. This version includes a fix for that crash (testcase in
test/CoverageMapping/md.cpp).

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

llvm-svn: 310406

7 years ago[DAG] Introduce peekThroughBitcast function. NFCI.
Nirav Dave [Tue, 8 Aug 2017 20:01:18 +0000 (20:01 +0000)]
[DAG] Introduce peekThroughBitcast function. NFCI.

llvm-svn: 310405

7 years ago[DAG] Update comments. NFC.
Nirav Dave [Tue, 8 Aug 2017 19:52:19 +0000 (19:52 +0000)]
[DAG] Update comments. NFC.

llvm-svn: 310404

7 years agoThread Safety Analysis: warn on nonsensical attributes.
Josh Gao [Tue, 8 Aug 2017 19:44:35 +0000 (19:44 +0000)]
Thread Safety Analysis: warn on nonsensical attributes.

Add warnings in cases where an implicit `this` argument is expected to
attributes because either `this` doesn't exist because the attribute is
on a free function, or because `this` is on a type that doesn't have a
corresponding capability/lockable/scoped_lockable attribute.

Reviewers: delesley, aaron.ballman

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

llvm-svn: 310403

7 years agoReland "Thread Safety Analysis: fix assert_capability."
Josh Gao [Tue, 8 Aug 2017 19:44:34 +0000 (19:44 +0000)]
Reland "Thread Safety Analysis: fix assert_capability."

Delete the test that was broken by rL309725, and add it back in a
follow up commit. Also, improve the tests a bit.

Reviewers: delesley, aaron.ballman

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

llvm-svn: 310402

7 years agoPR19668, PR23034: Fix handling of move constructors and deleted copy
Richard Smith [Tue, 8 Aug 2017 19:12:28 +0000 (19:12 +0000)]
PR19668, PR23034: Fix handling of move constructors and deleted copy
constructors when deciding whether classes should be passed indirectly.

This fixes ABI differences between Clang and GCC:

 * Previously, Clang ignored the move constructor when making this
   determination. It now takes the move constructor into account, per
   https://github.com/itanium-cxx-abi/cxx-abi/pull/17 (this change may
   seem recent, but the ABI change was agreed on the Itanium C++ ABI
   list a long time ago).

 * Previously, Clang's behavior when the copy constructor was deleted
   was unstable -- depending on whether the lazy declaration of the
   copy constructor had been triggered, you might get different behavior.
   We now eagerly declare the copy constructor whenever its deletedness
   is unclear, and ignore deleted copy/move constructors when looking for
   a trivial such constructor.

This also fixes an ABI difference between Clang and MSVC:

 * If the copy constructor would be implicitly deleted (but has not been
   lazily declared yet), for instance because the class has an rvalue
   reference member, we would pass it directly. We now pass such a class
   indirectly, matching MSVC.

llvm-svn: 310401

7 years agoAdd NetBSD support in asan_interceptors.cc
Kamil Rytarowski [Tue, 8 Aug 2017 19:09:48 +0000 (19:09 +0000)]
Add NetBSD support in asan_interceptors.cc

Summary:
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, kcc, vitalybuka, filcab, fjricci

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 310400

7 years ago[AMDGPU] Add llvm.amdgpu.update.dpp intrinsic
Connor Abbott [Tue, 8 Aug 2017 18:52:22 +0000 (18:52 +0000)]
[AMDGPU] Add llvm.amdgpu.update.dpp intrinsic

Summary:
Now that we've made all the necessary backend changes, we can add a new
intrinsic which exposes the new capabilities to IR producers. Since
llvm.amdgpu.update.dpp is a strict superset of llvm.amdgpu.mov.dpp, we
should deprecate the former. We also add tests for all the functionality
that was added in previous changes, now that we can access it via an IR
construct.

Reviewers: tstellar, arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

llvm-svn: 310399

7 years ago[NewGVN] Use a cast instead of a dyn_cast.
Chad Rosier [Tue, 8 Aug 2017 18:41:49 +0000 (18:41 +0000)]
[NewGVN] Use a cast instead of a dyn_cast.

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

llvm-svn: 310397

7 years ago[PDB] Fix linking of function symbols and local variables.
Zachary Turner [Tue, 8 Aug 2017 18:34:44 +0000 (18:34 +0000)]
[PDB] Fix linking of function symbols and local variables.

The compiler outputs PROC32_ID symbols into the object files
for functions, and these symbols have an embedded type index
which, when copied to the PDB, refer to the IPI stream.  However,
the symbols themselves are also converted into regular symbols
(e.g. S_GPROC32_ID -> S_GPROC32), and type indices in the regular
symbol records refer to the TPI stream.  So this patch applies
two fixes to function records.
  1. It converts ID symbols to the proper non-ID record type.
  2. After remapping the type index from the object file's index
     space to the PDB file/IPI stream's index space, it then
     remaps that index to the TPI stream's index space by.

Besides functions, during the remapping process we were also
discarding symbol record types which we did not recognize.
In particular, we were discarding S_BPREL32 records, which is
what MSVC uses to describe local variables on the stack.  So
this patch fixes that as well by copying them to the PDB.

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

llvm-svn: 310394

7 years agodsymutil: support dwarf version mismatches between object and clang module
Adrian Prantl [Tue, 8 Aug 2017 18:26:12 +0000 (18:26 +0000)]
dsymutil: support dwarf version mismatches between object and clang module

This adds a missing call to maybeUpdateMaxDwarfVersion when visitng a
clang module. Failing to do so will cause a failure when emitting
DWARF 4 forms into a CU that AsmPrinter believes to be DWARF 2.

rdar://problem/33666528

llvm-svn: 310392

7 years agoNetBSD compatibility nit in asan_test_utils.h
Kamil Rytarowski [Tue, 8 Aug 2017 18:16:35 +0000 (18:16 +0000)]
NetBSD compatibility nit in asan_test_utils.h

Summary:
Do not include <malloc.h> on NetBSD, as this header
serves on this OS backward compatibility with K&R alias
for <stdlib.h>.

Sponsored by <The NetBSD Foundation>

Reviewers: vitalybuka, kcc, joerg, filcab, fjricci

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 310391

7 years ago[LoopVectorize] Fix assertion failure in Fcmp vectorization
Anna Thomas [Tue, 8 Aug 2017 18:07:44 +0000 (18:07 +0000)]
[LoopVectorize] Fix assertion failure in Fcmp vectorization

Summary:
When vectorizing fcmps we can trip on incorrect cast assertion when setting the
FastMathFlags after generating the vectorized FCmp.
This can happen if the FCmp can be folded to true or false directly. The fix
here is to set the FastMathFlag using the FastMathFlagBuilder *before* creating
the FCmp Instruction. This is what's done by other optimizations such as
InstCombine.
Added a test case which trips on cast assertion without this patch.

Reviewers: Ayal, mssimpso, mkuper, gilr

Reviewed by: Ayal, mssimpso

Subscribers: llvm-commits, mzolotukhin

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

llvm-svn: 310389

7 years agoRestore previous structure ABI behavior for bit-fields with the packed attribute...
Aaron Ballman [Tue, 8 Aug 2017 18:07:17 +0000 (18:07 +0000)]
Restore previous structure ABI behavior for bit-fields with the packed attribute for PS4 targets.

An ABI change was introduced in r254596 that modified structure layouts when the 'packed' attribute was used on one-byte bitfields. Since the PS4 target needs to maintain backwards compatibility for all structure layouts, this change reintroduces the old behavior for PS4 targets only. It also introduces PS4 specific cases to the relevant test.

Patch by Matthew Voss.

llvm-svn: 310388

7 years ago[OPENMP][DEBUG] Set proper address space info if required by target.
Alexey Bataev [Tue, 8 Aug 2017 18:04:06 +0000 (18:04 +0000)]
[OPENMP][DEBUG] Set proper address space info if required by target.

Arguments, passed to the outlined function, must have correct address
space info for proper Debug info support. Patch sets global address
space for arguments that are mapped and passed by reference.

Also, cuda-gdb does not handle reference types correctly, so reference
arguments are represented as pointers.

llvm-svn: 310387

7 years ago[X86] Support 'avx5124vnniw' and 'avx5124fmaps' for __builtin_cpu_supports.
Craig Topper [Tue, 8 Aug 2017 17:43:44 +0000 (17:43 +0000)]
[X86] Support 'avx5124vnniw' and 'avx5124fmaps' for __builtin_cpu_supports.

They still need to be implemented in the intrinsics, the command line, and the backend. But this change isn't dependent on any of that and resolves a TODO.

llvm-svn: 310386

7 years ago[test] Add descriptions and pseudocode to tests. NFC.
Michael Kruse [Tue, 8 Aug 2017 17:26:19 +0000 (17:26 +0000)]
[test] Add descriptions and pseudocode to tests. NFC.

llvm-svn: 310385

7 years agoRevert "[ARM] Fix assembly and disassembly for VMRS/VMSR"
Tim Northover [Tue, 8 Aug 2017 17:16:46 +0000 (17:16 +0000)]
Revert "[ARM] Fix assembly and disassembly for VMRS/VMSR"

This reverts r310243. Only MVFR2 is actually restricted to v8 and it'll be a
little while before we can get a proper fix together. Better that we allow
incorrect code than reject correct in the meantime.

llvm-svn: 310384

7 years ago[DomTree] Use a non-recursive DFS instead of a recursive one; NFC
Sanjoy Das [Tue, 8 Aug 2017 17:15:29 +0000 (17:15 +0000)]
[DomTree] Use a non-recursive DFS instead of a recursive one; NFC

Summary: The recursive DFS can stack overflow in pathological cases.

Reviewers: kuhar

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 310383

7 years ago[Availability] Don't make an availability attribute imply default visibility on macOS
Erik Pilkington [Tue, 8 Aug 2017 17:09:09 +0000 (17:09 +0000)]
[Availability] Don't make an availability attribute imply default visibility on macOS

Fixes PR33796, rdar://33655115

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

llvm-svn: 310382

7 years ago[DeLICM/ZoneAlgo] Remove duplicate code. NFC.
Michael Kruse [Tue, 8 Aug 2017 17:00:27 +0000 (17:00 +0000)]
[DeLICM/ZoneAlgo] Remove duplicate code. NFC.

DeLICM and ZoneAlgo both implemented filterKnownValInst.

Declare ZoneAlgo's version in the header and let DeLCIM use it.

llvm-svn: 310381

7 years agoUse SCEV information for the second level aliasing
Roman Gareev [Tue, 8 Aug 2017 16:50:28 +0000 (16:50 +0000)]
Use SCEV information for the second level aliasing

We introduce another level of alias metadata to distinguish the individual
non-aliasing accesses that have inter iteration alias-free base pointers
marked with "Inter iteration alias-free" mark nodes. To distinguish two
accesses, the comparison of raw pointers representing base pointers is used.

In case of, for example, ublas's prod function that implements GEMM, and
DeLiCM we can get accesses to same location represented by different raw
pointers. Consequently, we create different alias sets that can prevent
accesses from, for example, being sinked or hoisted.

To avoid the issue, we compare the corresponding SCEV information instead
of the corresponding raw pointers.

Reviewed-by: Tobias Grosser <tobias@grosser.es>
Differential Revision: https://reviews.llvm.org/D35761

llvm-svn: 310380

7 years agoRevert "[OPENMP][DEBUG] Set proper address space info if required by target."
Alexey Bataev [Tue, 8 Aug 2017 16:45:36 +0000 (16:45 +0000)]
Revert "[OPENMP][DEBUG] Set proper address space info if required by target."

This reverts commit r310377.

llvm-svn: 310379

7 years ago[KnownBits][ValueTracking] Move the math for calculating known bits for add/sub into...
Craig Topper [Tue, 8 Aug 2017 16:29:35 +0000 (16:29 +0000)]
[KnownBits][ValueTracking] Move the math for calculating known bits for add/sub into a static method in KnownBits object

I want to reuse this code in SimplifyDemandedBits handling of Add/Sub. This will make that easier.

Wonder if we should use it in SelectionDAG's computeKnownBits too.

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

llvm-svn: 310378

7 years ago[OPENMP][DEBUG] Set proper address space info if required by target.
Alexey Bataev [Tue, 8 Aug 2017 16:29:11 +0000 (16:29 +0000)]
[OPENMP][DEBUG] Set proper address space info if required by target.

Arguments, passed to the outlined function, must have correct address
space info for proper Debug info support. Patch sets global address
space for arguments that are mapped and passed by reference.

Also, cuda-gdb does not handle reference types correctly, so reference
arguments are represented as pointers.

llvm-svn: 310377

7 years agoUse "foo-12345.o.tmp" instead of "foo.o-12345" as temporary file name.
Nico Weber [Tue, 8 Aug 2017 16:21:23 +0000 (16:21 +0000)]
Use "foo-12345.o.tmp" instead of "foo.o-12345" as temporary file name.

This helps some tools that do things based on the output's extension.

For example, we got reports from users on Windows that have a tool that scan a
build output dir (but skip .obj files). The tool would keep the "foo.obj-12345"
file open, and then when clang tried to rename the temp file to the final
output filename, that would fail. By making the tempfile end in ".obj.tmp",
tools like this could now have a rule to ignore .tmp files.
This is a less ambitious reland of https://reviews.llvm.org/D36238

https://reviews.llvm.org/D36413

llvm-svn: 310376

7 years ago[RISCV] Fix warning about unused getSubtargetFeatureName()
Alex Bradbury [Tue, 8 Aug 2017 16:20:39 +0000 (16:20 +0000)]
[RISCV] Fix warning about unused getSubtargetFeatureName()

llvm-svn: 310375

7 years agoDo not use isl_set_project_out to get all loop prefixes
Roman Gareev [Tue, 8 Aug 2017 16:15:33 +0000 (16:15 +0000)]
Do not use isl_set_project_out to get all loop prefixes

Currently, only convex isolation sets can be efficiently processed by isl.
Consequently, as a temporary solution, we use a different algorithm for partial
tile isolation that helps to build convex isolation sets in some cases.

Reviewed-by: Tobias Grosser <tobias@grosser.es>
Differential Revision: https://reviews.llvm.org/D36278

llvm-svn: 310374

7 years agoBasicAA: aliasGEP shouldn't get a PartialAlias response here
Nuno Lopes [Tue, 8 Aug 2017 16:13:24 +0000 (16:13 +0000)]
BasicAA: aliasGEP shouldn't get a PartialAlias response here
add an assert() to ensure that's the case (as I'm not convinced it won't happen)

llvm-svn: 310373

7 years ago[DAGCombiner] simplifyShuffleMask - handle UNDEF inputs from shuffles as well as...
Simon Pilgrim [Tue, 8 Aug 2017 16:10:33 +0000 (16:10 +0000)]
[DAGCombiner] simplifyShuffleMask - handle UNDEF inputs from shuffles as well as BUILD_VECTOR

Minor extension to D36393

llvm-svn: 310372

7 years ago[clang-tidy] Add new readability non-idiomatic static access check
Gabor Horvath [Tue, 8 Aug 2017 15:33:48 +0000 (15:33 +0000)]
[clang-tidy] Add new readability non-idiomatic static access check

Patch by: Lilla Barancsuk

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

llvm-svn: 310371

7 years agoEnable COMPILER_RT_HAS_SANITIZER_COMMON on NetBSD
Kamil Rytarowski [Tue, 8 Aug 2017 15:25:26 +0000 (15:25 +0000)]
Enable COMPILER_RT_HAS_SANITIZER_COMMON on NetBSD

Summary:
Temporarily keep disabled COMPILER_RT_HAS_ASAN on NetBSD.

Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, filcab, kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: srhines, mgorny, #sanitizers, llvm-commits

Tags: #sanitizers

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

llvm-svn: 310370

7 years ago[RegisterPasses] Run polly-simplify also right after scop modeling
Tobias Grosser [Tue, 8 Aug 2017 15:14:46 +0000 (15:14 +0000)]
[RegisterPasses] Run polly-simplify also right after scop modeling

This allows us to get rid of stores that are overwritten within the very same
basic block, without ever being read beforehand. This simplification is
necessary for delicm to run on pb4's correlation.

llvm-svn: 310369

7 years agoNon-functional change. Fix test for D29654.
Gheorghe-Teodor Bercea [Tue, 8 Aug 2017 15:13:07 +0000 (15:13 +0000)]
Non-functional change. Fix test for D29654.

llvm-svn: 310368

7 years agoclang-format: [JS] fix union type spacing in object & array types.
Martin Probst [Tue, 8 Aug 2017 15:00:58 +0000 (15:00 +0000)]
clang-format: [JS] fix union type spacing in object & array types.

Summary:
Previously, clang-format would insert whitespace in union types nested in object
and array types, as it wouldn't recognize those as a type operator:

    const x: {foo: number | null};
    const x: [number | null];

While this is correct for actual binary operators, clang-format should not
insert whitespace into union and intersection types to mark those:

    const x: {foo: number|null};
    const x: [number|null];

This change propagates that the context is not an expression by inspecting
the preceding token and marking as non-expression if it was a type colon.

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 310367

7 years ago[clang-tidy] 'implicit cast' -> 'implicit conversion'
Alexander Kornienko [Tue, 8 Aug 2017 14:53:52 +0000 (14:53 +0000)]
[clang-tidy] 'implicit cast' -> 'implicit conversion'

Summary:
This patch renames checks, check options and changes messages to use correct
term "implicit conversion" instead of "implicit cast" (which has been in use in
Clang AST since ~10 years, but it's still technically incorrect w.r.t. C++
standard).

  * performance-implicit-cast-in-loop -> performance-implicit-conversion-in-loop
  * readability-implicit-bool-cast -> readability-implicit-bool-conversion
    - readability-implicit-bool-cast.AllowConditionalIntegerCasts ->
      readability-implicit-bool-conversion.AllowIntegerConditions
    - readability-implicit-bool-cast.AllowConditionalPointerCasts ->
      readability-implicit-bool-conversion.AllowPointerConditions

Reviewers: hokein, jdennett

Reviewed By: hokein

Subscribers: mgorny, JDevlieghere, xazax.hun, cfe-commits

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

llvm-svn: 310366

7 years agoclang-format: [JS] handle single lines comments ending in `\\`.
Martin Probst [Tue, 8 Aug 2017 14:52:42 +0000 (14:52 +0000)]
clang-format: [JS] handle single lines comments ending in `\\`.

Summary:
Previously, clang-format would consider the following code line to be part of
the comment and incorrectly format the rest of the file.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 310365

7 years agoRevert "[OPENMP][DEBUG] Set proper address space info if required by target."
Alexey Bataev [Tue, 8 Aug 2017 14:44:43 +0000 (14:44 +0000)]
Revert "[OPENMP][DEBUG] Set proper address space info if required by target."

This reverts commit r310360.

llvm-svn: 310364

7 years ago[RISCV] Add basic RISCVAsmParser (missing files)
Alex Bradbury [Tue, 8 Aug 2017 14:43:36 +0000 (14:43 +0000)]
[RISCV] Add basic RISCVAsmParser (missing files)

This commit adds the files missing from rL310361. Apologies for the noise.

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

llvm-svn: 310363

7 years ago[OpenMP] OpenMP device offloading code generation produces a cubin file which is...
Gheorghe-Teodor Bercea [Tue, 8 Aug 2017 14:33:05 +0000 (14:33 +0000)]
[OpenMP] OpenMP device offloading code generation produces a cubin file which is then integrated in the host binary using the host linker.
Diff: D29654

llvm-svn: 310362

7 years ago[RISCV] Add basic RISCVAsmParser
Alex Bradbury [Tue, 8 Aug 2017 14:32:35 +0000 (14:32 +0000)]
[RISCV] Add basic RISCVAsmParser

This doesn't yet support parsing things like %pcrel_hi(foo), but will handle
basic instructions with register or immediate operands.

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

llvm-svn: 310361

7 years ago[OPENMP][DEBUG] Set proper address space info if required by target.
Alexey Bataev [Tue, 8 Aug 2017 14:25:14 +0000 (14:25 +0000)]
[OPENMP][DEBUG] Set proper address space info if required by target.

Arguments, passed to the outlined function, must have correct address
space info for proper Debug info support. Patch sets global address
space for arguments that are mapped and passed by reference.

Also, cuda-gdb does not handle reference types correctly, so reference
arguments are represented as pointers.

llvm-svn: 310360

7 years ago[libclang] Fix PR34055 (incompatible update of clang-c/Index.h)
Nikolai Bozhenov [Tue, 8 Aug 2017 14:13:50 +0000 (14:13 +0000)]
[libclang] Fix PR34055 (incompatible update of clang-c/Index.h)

Fixes a regression introduced by r308218.

llvm-svn: 310359

7 years ago[PowerPC] Don't crash on larger splats achieved through 1-byte splats
Nemanja Ivanovic [Tue, 8 Aug 2017 13:52:45 +0000 (13:52 +0000)]
[PowerPC] Don't crash on larger splats achieved through 1-byte splats

We've implemented a 1-byte splat using XXSPLTISB on P9. However, LLVM will
produce a 1-byte splat even for wider element BUILD_VECTOR nodes. This patch
prevents crashing in that situation.

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

llvm-svn: 310358

7 years ago[globalisel][tablegen] Remove unnecessary ; to satisfy ubuntu-gcc7.1-werror.
Daniel Sanders [Tue, 8 Aug 2017 13:21:26 +0000 (13:21 +0000)]
[globalisel][tablegen] Remove unnecessary ; to satisfy ubuntu-gcc7.1-werror.

llvm-svn: 310357

7 years agoAppease compilers that have the -Wcovered-switch-default switch.
Nemanja Ivanovic [Tue, 8 Aug 2017 12:41:56 +0000 (12:41 +0000)]
Appease compilers that have the -Wcovered-switch-default switch.

llvm-svn: 310356

7 years ago[NFC] [PPCGCodeGen] Add missing REQUIRES: pollyacc line.
Siddharth Bhat [Tue, 8 Aug 2017 12:26:37 +0000 (12:26 +0000)]
[NFC] [PPCGCodeGen] Add missing REQUIRES: pollyacc line.

llvm-svn: 310354

7 years ago[ScopInfo] [NFC] Typo fix.
Siddharth Bhat [Tue, 8 Aug 2017 12:26:32 +0000 (12:26 +0000)]
[ScopInfo] [NFC] Typo fix.

"to conservative" -> "too conservative".

llvm-svn: 310353

7 years ago[X86] Improved X86::CMOV to Branch heuristic.
Amjad Aboud [Tue, 8 Aug 2017 12:17:56 +0000 (12:17 +0000)]
[X86] Improved X86::CMOV to Branch heuristic.
Resolved PR33954.
This patch contains two more constraints that aim to reduce the noise cases where we convert CMOV into branch for small gain, and end up spending more cycles due to overhead.

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

llvm-svn: 310352

7 years agoReuse interception_linux for NetBSD
Kamil Rytarowski [Tue, 8 Aug 2017 12:10:08 +0000 (12:10 +0000)]
Reuse interception_linux for NetBSD

Summary:
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, kcc, vitalybuka, filcab

Reviewed By: vitalybuka

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 310351

7 years ago[Polly] [PPCGCodeGeneration] Handle failing of invariant load hoisting gracefully.
Siddharth Bhat [Tue, 8 Aug 2017 12:00:59 +0000 (12:00 +0000)]
[Polly] [PPCGCodeGeneration] Handle failing of invariant load hoisting gracefully.

To do this, we replicate what `CodeGeneration` does. We expose
`markNodeUnreachable` from `CodeGeneration` to `PPCGCodeGeneration`.

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

llvm-svn: 310350

7 years agoDefine OFF_T as 64-bit integer on NetBSD
Kamil Rytarowski [Tue, 8 Aug 2017 11:40:15 +0000 (11:40 +0000)]
Define OFF_T as 64-bit integer on NetBSD

Summary:
All 32 and 64 bit NetBSD platforms define off_t as 64-bit integer.

Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, filcab, kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: emaste, kubamracek, llvm-commits

Tags: #sanitizers

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

llvm-svn: 310349

7 years ago[DeLICM] Properly handle PHI writes becoming empty partial writes.
Michael Kruse [Tue, 8 Aug 2017 11:27:12 +0000 (11:27 +0000)]
[DeLICM] Properly handle PHI writes becoming empty partial writes.

It is possible that partial writes are empty (write is never executed).
In this case, when in PHINode's incoming edge is never taken such that
the incoming write becomes an empty partial write, if enabled. The
issue is that when converting the union_map to an map, it's space
cannot be derived from the union_map itself. Rather, we need to
determine its space independently.

This fixes test-suite's MultiSource/Benchmarks/ASC_Sequoia/CrystalMk.

llvm-svn: 310348

7 years agoDarwin's toolchain should be initialized before openmp offloading
Alex Lorenz [Tue, 8 Aug 2017 11:22:21 +0000 (11:22 +0000)]
Darwin's toolchain should be initialized before openmp offloading
is processed

This fixes an 'openmp-offload.c' test failure introduced by r310263.

llvm-svn: 310347

7 years ago[PowerPC] Eliminate compares - add i32 sext/zext handling for SETLE/SETGE
Nemanja Ivanovic [Tue, 8 Aug 2017 11:20:44 +0000 (11:20 +0000)]
[PowerPC] Eliminate compares - add i32 sext/zext handling for SETLE/SETGE

Adds handling for SETLE/SETGE comparisons on i32 values. Furthermore, it adds
the handling for the special case where RHS == 0.

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

llvm-svn: 310346

7 years agoRevert r310291, r310300 and r310332 because of test failure on Darwin
Alex Lorenz [Tue, 8 Aug 2017 11:20:17 +0000 (11:20 +0000)]
Revert r310291, r310300 and r310332 because of test failure on Darwin

The commit r310291 introduced the failure. r310332 was a test fix commit and
r310300 was a followup commit. I reverted these two to avoid merge conflicts
when reverting.

The 'openmp-offload.c' test is failing on Darwin because the following
run lines:
// RUN:   touch %t1.o
// RUN:   touch %t2.o
// RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -save-temps -no-canonical-prefixes %t1.o %t2.o 2>&1 \
// RUN:   | FileCheck -check-prefix=CHK-TWOCUBIN %s

trigger the following assertion:

Driver.cpp:3418:
    assert(CachedResults.find(ActionTC) != CachedResults.end() &&
           "Result does not exist??");

llvm-svn: 310345

7 years ago[DAGCombiner] Simplify shuffle mask index if the referenced input element is UNDEF
Simon Pilgrim [Tue, 8 Aug 2017 11:03:30 +0000 (11:03 +0000)]
[DAGCombiner] Simplify shuffle mask index if the referenced input element is UNDEF

Fixes one of the cases in PR34041.

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

llvm-svn: 310344