platform/upstream/llvm.git
5 years ago[testsuite] Split Objective-C new syntax test
Jonas Devlieghere [Fri, 5 Apr 2019 22:06:53 +0000 (22:06 +0000)]
[testsuite] Split Objective-C new syntax test

This splits the second longest test into separate test cases. Similar to
what we did for the Objective-C data formatters in r357786.

llvm-svn: 357824

5 years ago[Lexer] NFC: Fix an off-by-one bug in getAsCharRange().
Artem Dergachev [Fri, 5 Apr 2019 21:48:52 +0000 (21:48 +0000)]
[Lexer] NFC: Fix an off-by-one bug in getAsCharRange().

As the unit test demonstrates, subtracting 1 from the offset was unnecessary.

The only user of this function was the plist file emitter (in Static Analyzer
and ARCMigrator). It means that a lot of Static Analyzer's plist arrows
are in fact off by one character. The patch carefully preserves this
completely incorrect behavior and causes no functional change,
i.e. no plist format breakage.

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

llvm-svn: 357823

5 years ago[LLVM-C] Begin to Expose A More General Binary Interface
Robert Widmann [Fri, 5 Apr 2019 21:36:50 +0000 (21:36 +0000)]
[LLVM-C] Begin to Expose A More General Binary Interface

Summary:
Provides a new type, `LLVMBinaryRef`, and a binding to `llvm::object::createBinary` for more general interoperation with binary files than `LLVMObjectFileRef`.  It also provides the proper non-consuming API for input buffers and populates an out parameter for error handling if necessary - two things the previous API did not do.

In a follow-up, I'll define section and symbol iterators and begin to build upon the existing test infrastructure.

This patch is a first step towards deprecating that API and replacing it with something more robust.

Reviewers: deadalnix, whitequark

Reviewed By: whitequark

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 357822

5 years ago[gn] Support for building compiler-rt builtins
Petr Hosek [Fri, 5 Apr 2019 21:30:40 +0000 (21:30 +0000)]
[gn] Support for building compiler-rt builtins

This is support for building compiler-rt builtins, The library build
should be complete for a subset of supported platforms, but not all
CMake options have been replicated in GN.

We always use the just built compiler to build all the runtimes, which
is equivalent to the CMake runtimes build. This simplifies the build
configuration because we don't need to support arbitrary host compiler
and can always assume the latest Clang. With GN's toolchain support,
this is significantly more efficient than the CMake runtimes build.

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

llvm-svn: 357821

5 years ago[globalisel] Allow combiners to query legality
Daniel Sanders [Fri, 5 Apr 2019 21:22:17 +0000 (21:22 +0000)]
[globalisel] Allow combiners to query legality

llvm-svn: 357820

5 years ago[PDB Docs] Delete * LINKER * Stream information.
Zachary Turner [Fri, 5 Apr 2019 21:16:00 +0000 (21:16 +0000)]
[PDB Docs] Delete * LINKER * Stream information.

This is actually just a module debug info stream, so it should
technically be covered by a discussion of the module list.

llvm-svn: 357819

5 years ago[libc++][CMake] Make sure the benchmarks link against libc++abi
Louis Dionne [Fri, 5 Apr 2019 21:05:32 +0000 (21:05 +0000)]
[libc++][CMake] Make sure the benchmarks link against libc++abi

The refactoring in r357811 made it so that we didn't add the ABI library
to the list of LIBCXX_LIBRARIES. As a result, benchmarks didn't link to
the ABI library and were missing symbols. This broke the build bots.

As a drive-by fix, we also provide the SHARED ABI library to the linker
script instead of the STATIC ABI library.

This couldn't be discovered on Apple platforms because libc++.dylib
re-exports libc++abi.dylib symbols there.

llvm-svn: 357818

5 years ago[CMake] Don't explicitly use LLVM_LIBRARY_DIR in standalone builds
Alex Langford [Fri, 5 Apr 2019 21:01:50 +0000 (21:01 +0000)]
[CMake] Don't explicitly use LLVM_LIBRARY_DIR in standalone builds

Summary:
This line is unnecessary because add_llvm_executable will handle
linking the correct LLVM libraries for you. LLDB standalone builds are totally
fine without this.

In the best case, having this line here is harmless. In the worst case it can
cause link issues.

If you build lldb-server for android using the standalone build, this line
will cause LLVM_LIBRARY_DIR to be the first place you look for libraries.
This is an issue because if you built libc++, it will try to link against
that one instead of the one from the android NDK.  Meanwhile, the LLVM libraries
you're linking against were linked against the libc++ from the NDK.

Ideally, we would take advantage of the AFTER option for link_directories(), but
that was not available in LLDB's minimum supported version of CMake (CMake 3.4.3).

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

llvm-svn: 357817

5 years ago[InstCombine] add more tests for fmul+fdiv+sqrt; NFC
Sanjay Patel [Fri, 5 Apr 2019 20:54:35 +0000 (20:54 +0000)]
[InstCombine] add more tests for fmul+fdiv+sqrt; NFC

llvm-svn: 357816

5 years ago[globalisel] Support 3-type legalForCartesianProduct()
Daniel Sanders [Fri, 5 Apr 2019 20:47:13 +0000 (20:47 +0000)]
[globalisel] Support 3-type legalForCartesianProduct()

llvm-svn: 357815

5 years agoFix PR41395 - __cxa_vec_new may overflow in allocation size calculation.
Eric Fiselier [Fri, 5 Apr 2019 20:38:43 +0000 (20:38 +0000)]
Fix PR41395 - __cxa_vec_new may overflow in allocation size calculation.

llvm-svn: 357814

5 years ago[Test] Remove no_debug_info_test decorator from Obj-C data formatters.
Jonas Devlieghere [Fri, 5 Apr 2019 20:37:52 +0000 (20:37 +0000)]
[Test] Remove no_debug_info_test decorator from Obj-C data formatters.

As discussed in https://reviews.llvm.org/D60300.

llvm-svn: 357813

5 years ago[LLVM-C] Add bindings to insert basic blocks
Robert Widmann [Fri, 5 Apr 2019 20:32:43 +0000 (20:32 +0000)]
[LLVM-C] Add bindings to insert basic blocks

Summary:
Now that we can create standalone basic blocks, it's useful to be able to append them.  Add bindings to

- Insert a basic block after the current insertion block
- Append a basic block to the end of a function's list of basic blocks

Reviewers: whitequark, deadalnix, harlanhaskins

Reviewed By: whitequark, harlanhaskins

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

llvm-svn: 357812

5 years ago[libc++] Localize CMake code only related to the shared library
Louis Dionne [Fri, 5 Apr 2019 20:29:54 +0000 (20:29 +0000)]
[libc++] Localize CMake code only related to the shared library

Summary:
There's a lot of CMake logic that's only relevant to the shared library,
yet it was using a code path and setting variables that impact both the
shared and the static libraries. This patch moves this logic so that it
clearly only impacts the shared library.

Reviewers: phosek, smeenai, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 357811

5 years ago[analyzer] NoStoreFuncVisitor: Suppress reports with no-store in system headers.
Artem Dergachev [Fri, 5 Apr 2019 20:18:53 +0000 (20:18 +0000)]
[analyzer] NoStoreFuncVisitor: Suppress reports with no-store in system headers.

The idea behind this heuristic is that normally the visitor is there to
inform the user that a certain function may fail to initialize a certain
out-parameter. For system header functions this is usually dictated by the
contract, and it's unlikely that the header function has accidentally
forgot to put the value into the out-parameter; it's more likely
that the user has intentionally skipped the error check.

Warnings on skipped error checks are more like security warnings;
they aren't necessarily useful for all users, and they should instead
be introduced on a per-API basis.

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

llvm-svn: 357810

5 years ago[X86] Enable tail calls for CallingConv::Swift
Francis Visoiu Mistrih [Fri, 5 Apr 2019 20:18:25 +0000 (20:18 +0000)]
[X86] Enable tail calls for CallingConv::Swift

It's currently only enabled on AArch64 (enabled in r281376).

llvm-svn: 357809

5 years ago[X86] Preserve operand flag when expanding TCRETURNri
Francis Visoiu Mistrih [Fri, 5 Apr 2019 20:18:21 +0000 (20:18 +0000)]
[X86] Preserve operand flag when expanding TCRETURNri

The expansion of TCRETURNri(64) would not keep operand flags like
undef/renamable/etc. which can result in machine verifier issues.

Also add plumbing to be able to use `-run-pass=x86-pseudo`.

llvm-svn: 357808

5 years agoUse binary write mode in WriteToFile function to avoid appended \r characters on...
Vitaly Buka [Fri, 5 Apr 2019 20:17:03 +0000 (20:17 +0000)]
Use binary write mode in WriteToFile function to avoid appended \r characters on Windows

Summary:
When using libfuzzer on Windows, in the contents of a crash sample, bytes that can be mistaken for a \n are replaced by a \r\n sequence. As a consequence, crashes are not reproducible. This patch will open files in binary mode to fix this issue. The patch does not affect POSIX systems.

Patch by tuktuk

Reviewers: kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: dexonsmith, jdoerfert, llvm-commits, #sanitizers

Tags: #llvm, #sanitizers

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

llvm-svn: 357807

5 years agoELF: De-template ELFFileBase. NFCI.
Peter Collingbourne [Fri, 5 Apr 2019 20:16:26 +0000 (20:16 +0000)]
ELF: De-template ELFFileBase. NFCI.

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

llvm-svn: 357806

5 years ago[AMDGPU] Add MachineDCE pass after RenameIndependentSubregs
Stanislav Mekhanoshin [Fri, 5 Apr 2019 20:11:32 +0000 (20:11 +0000)]
[AMDGPU] Add MachineDCE pass after RenameIndependentSubregs

Detect dead lanes can create some dead defs. Then RenameIndependentSubregs
will break a REG_SEQUENCE which may use these dead defs. At this point
a dead instruction can be removed but we do not run a DCE anymore.

MachineDCE was only running before live variable analysis. The patch
adds a mean to preserve LiveIntervals and SlotIndexes in case it works
past this.

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

llvm-svn: 357805

5 years agoFurther refactor cxa_guard.cpp
Eric Fiselier [Fri, 5 Apr 2019 19:58:15 +0000 (19:58 +0000)]
Further refactor cxa_guard.cpp

This patch is a part of a series of patches to cleanup
our implementation of __cxa_acquire et al. No functionality
change was intended.

This patch does two primary things.

It introduces the GuardObject class to abstract the reading
and writing to the guard object. In future, it will be used
to ensure atomic accesses are used when needed.

It also introduces the GuardValue class used to represent
values of the guard object. It is an abstraction to access
and write to the various different bits of a guard.

llvm-svn: 357804

5 years ago[clang-fuzzer] Include ExternalProject before using it.
Matt Morehouse [Fri, 5 Apr 2019 19:47:17 +0000 (19:47 +0000)]
[clang-fuzzer] Include ExternalProject before using it.

Some versions of CMake require ExternalProject to be included before we
can use ExternalProject_Add.

llvm-svn: 357803

5 years ago[X86] Merge the different Jcc instructions for each condition code into single instru...
Craig Topper [Fri, 5 Apr 2019 19:28:09 +0000 (19:28 +0000)]
[X86] Merge the different Jcc instructions for each condition code into single instructions that store the condition code as an operand.

Summary:
This avoids needing an isel pattern for each condition code. And it removes translation switches for converting between Jcc instructions and condition codes.

Now the printer, encoder and disassembler take care of converting the immediate. We use InstAliases to handle the assembly matching. But we print using the asm string in the instruction definition. The instruction itself is marked IsCodeGenOnly=1 to hide it from the assembly parser.

Reviewers: spatel, lebedev.ri, courbet, gchatelet, RKSimon

Reviewed By: RKSimon

Subscribers: MatzeB, qcolombet, eraman, hiraditya, arphaman, llvm-commits

Tags: #llvm

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

llvm-svn: 357802

5 years ago[X86] Merge the different SETcc instructions for each condition code into single...
Craig Topper [Fri, 5 Apr 2019 19:27:49 +0000 (19:27 +0000)]
[X86] Merge the different SETcc instructions for each condition code into single instructions that store the condition code as an operand.

Summary:
This avoids needing an isel pattern for each condition code. And it removes translation switches for converting between SETcc instructions and condition codes.

Now the printer, encoder and disassembler take care of converting the immediate. We use InstAliases to handle the assembly matching. But we print using the asm string in the instruction definition. The instruction itself is marked IsCodeGenOnly=1 to hide it from the assembly parser.

Reviewers: andreadb, courbet, RKSimon, spatel, lebedev.ri

Reviewed By: andreadb

Subscribers: hiraditya, lebedev.ri, llvm-commits

Tags: #llvm

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

llvm-svn: 357801

5 years ago[X86] Merge the different CMOV instructions for each condition code into single instr...
Craig Topper [Fri, 5 Apr 2019 19:27:41 +0000 (19:27 +0000)]
[X86] Merge the different CMOV instructions for each condition code into single instructions that store the condition code as an immediate.

Summary:
Reorder the condition code enum to match their encodings. Move it to MC layer so it can be used by the scheduler models.

This avoids needing an isel pattern for each condition code. And it removes
translation switches for converting between CMOV instructions and condition
codes.

Now the printer, encoder and disassembler take care of converting the immediate.
We use InstAliases to handle the assembly matching. But we print using the
asm string in the instruction definition. The instruction itself is marked
IsCodeGenOnly=1 to hide it from the assembly parser.

This does complicate the scheduler models a little since we can't assign the
A and BE instructions to a separate class now.

I plan to make similar changes for SETcc and Jcc.

Reviewers: RKSimon, spatel, lebedev.ri, andreadb, courbet

Reviewed By: RKSimon

Subscribers: gchatelet, hiraditya, kristina, lebedev.ri, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 357800

5 years agoFix error in NamedDeclPrinterTest
David Goldman [Fri, 5 Apr 2019 19:17:24 +0000 (19:17 +0000)]
Fix error in NamedDeclPrinterTest

Caused by D56924, shouldn't use raw string literals in macros.

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

llvm-svn: 357799

5 years ago[gn] Rebase paths in symlink_or_copy against root_build_dir
Petr Hosek [Fri, 5 Apr 2019 19:13:54 +0000 (19:13 +0000)]
[gn] Rebase paths in symlink_or_copy against root_build_dir

We should be always rebasing paths against root_build_dir which is
the directory where scripts are run from, not root_out_dir which is
the current toolchain directory. The latter can result in invalid
paths when the action is being used from a non-default toolchain.

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

llvm-svn: 357798

5 years ago[gn] Make -no-exceptions flag a config
Petr Hosek [Fri, 5 Apr 2019 19:12:37 +0000 (19:12 +0000)]
[gn] Make -no-exceptions flag a config

This allows it to be disabled for targets that need exceptions
like libunwind, libc++abi and libc++.

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

llvm-svn: 357797

5 years ago[LCG] Add aliased functions as LCG roots
Guozhi Wei [Fri, 5 Apr 2019 18:51:08 +0000 (18:51 +0000)]
[LCG] Add aliased functions as LCG roots

Current LCG doesn't check aliased functions. So if an internal function has a public alias it will not be added to CG SCC, but it is still reachable from outside through the alias.
So this patch adds aliased functions to SCC.

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

llvm-svn: 357795

5 years ago[libc++] Add XFAILs for istream tests that were added in r357775
Louis Dionne [Fri, 5 Apr 2019 18:50:47 +0000 (18:50 +0000)]
[libc++] Add XFAILs for istream tests that were added in r357775

We fixed incorrect behavior of input streams in r357775 and tests were
added accordingly. However, older versions of macOS don't have the
change in the dylib yet, so the tests fail on those platforms.

llvm-svn: 357794

5 years ago[docs] Fix rst title in clang langext docs. NFCI
Kristina Brooks [Fri, 5 Apr 2019 18:26:43 +0000 (18:26 +0000)]
[docs] Fix rst title in clang langext docs. NFCI

Fix an odd line in LanguageExtensions.rst which
rendered incorrectly due to an underscore being
mixed in with dashes.

llvm-svn: 357793

5 years ago[AMDGPU] rename vi-insts into gfx8-insts
Stanislav Mekhanoshin [Fri, 5 Apr 2019 18:25:00 +0000 (18:25 +0000)]
[AMDGPU] rename vi-insts into gfx8-insts

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

llvm-svn: 357792

5 years ago[AMDGPU] predicate and feature refactoring
Stanislav Mekhanoshin [Fri, 5 Apr 2019 18:24:34 +0000 (18:24 +0000)]
[AMDGPU] predicate and feature refactoring

We have done some predicate and feature refactoring lately but
did not upstream it. This is to sync.

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

llvm-svn: 357791

5 years agoTry to fix Sphinx bot.
Zachary Turner [Fri, 5 Apr 2019 18:06:42 +0000 (18:06 +0000)]
Try to fix Sphinx bot.

llvm-svn: 357790

5 years agolit: make rm python 3 friendly (NFC)
Saleem Abdulrasool [Fri, 5 Apr 2019 18:00:49 +0000 (18:00 +0000)]
lit: make rm python 3 friendly (NFC)

Add some alterations for python 3 compatibility.

llvm-svn: 357789

5 years ago[PDB Docs] Finish documentation for PDB Info Stream.
Zachary Turner [Fri, 5 Apr 2019 17:59:26 +0000 (17:59 +0000)]
[PDB Docs] Finish documentation for PDB Info Stream.

The information about the named stream map and feature codes
was not present.  This patch adds it.

llvm-svn: 357788

5 years agoAdd .noindex to the gitignore
Jonas Devlieghere [Fri, 5 Apr 2019 17:57:42 +0000 (17:57 +0000)]
Add .noindex to the gitignore

The .noindex suffix is used on macOS to prevent Spotlight from indexing
its contents. These folders contain test output from dotest.py and
should be ignored when dotest is run from the LLDB source directory.

llvm-svn: 357787

5 years ago[testsuite] Split Objective-C data formatter
Jonas Devlieghere [Fri, 5 Apr 2019 17:57:40 +0000 (17:57 +0000)]
[testsuite] Split Objective-C data formatter

The testcase for objective-c data formatters is very big as it checks a
bunch of stuff. This is annoying when using the lit test driver, because
it prevents us from running the different cases in parallel. As a
result, it's always one of the last few tests that complete. This patch
splits the test into multiple files that share a common base class. This
way lit can run the different tests in parallel.

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

llvm-svn: 357786

5 years ago[PDB Docs] Add info about the hash adjustment buffer.
Zachary Turner [Fri, 5 Apr 2019 17:12:37 +0000 (17:12 +0000)]
[PDB Docs] Add info about the hash adjustment buffer.

This necessitates adding a document describing the serialized
hash table format.  This document is currently empty, although
it will be filled out in followup patches.

llvm-svn: 357784

5 years agogn build: Merge 357768 and 357770
Nico Weber [Fri, 5 Apr 2019 17:05:54 +0000 (17:05 +0000)]
gn build: Merge 357768 and 357770

llvm-svn: 357783

5 years ago[InstCombine] add tests for fdiv+fmul; NFC
Sanjay Patel [Fri, 5 Apr 2019 17:00:57 +0000 (17:00 +0000)]
[InstCombine] add tests for fdiv+fmul; NFC

llvm-svn: 357782

5 years agogn build: Merge r357719
Nico Weber [Fri, 5 Apr 2019 16:57:34 +0000 (16:57 +0000)]
gn build: Merge r357719

llvm-svn: 357781

5 years ago[InstCombine] add tests for sqrt+fdiv+fmul; NFC
Sanjay Patel [Fri, 5 Apr 2019 16:52:57 +0000 (16:52 +0000)]
[InstCombine] add tests for sqrt+fdiv+fmul; NFC

Examples based on recent llvm-dev thread. These are specific
patterns of more general enhancements that would solve these.

llvm-svn: 357780

5 years ago[CUDA][Windows] Last fix for the clang Bug 38811 "Clang fails to compile with CUDA...
Evgeny Mankov [Fri, 5 Apr 2019 16:51:10 +0000 (16:51 +0000)]
[CUDA][Windows] Last fix for the clang Bug 38811 "Clang fails to compile with CUDA-9.x on Windows" (https://bugs.llvm.org/show_bug.cgi?id=38811).

[IMPORTANT]
With that last fix, CUDA has just started being compiling by clang on Windows after nearly a year and two clang’s major releases (7 and 8).
As long as the last LLVM release, in which clang was compiling CUDA on Windows successfully, was 6.0.1, this fix and two previous have to be included into upcoming 7.1.0 and 8.0.1 releases.

[How to repro]
clang++.exe -x cuda "c:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.0\0_Simple\simplePrintf\simplePrintf.cu" -I"c:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.0\common\inc" --cuda-gpu-arch=sm_50 --cuda-path="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0" -L"c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64" -lcudart.lib  -v

[Output]
In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:390:11: error: no matching function for call to '__isinfl'
  return (__isinfl(a) != 0);
          ^~~~~~~~
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2662:14: note: candidate function not viable: call to __host__ function from __device__ function
__func__(int __isinfl(long double a))
             ^
In file included from <built-in>:1:
In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:438:11: error: no matching function for call to '__isnanl'
  return (__isnanl(a) != 0);
          ^~~~~~~~
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2672:14: note: candidate function not viable: call to __host__ function from __device__ function
__func__(int __isnanl(long double a))
             ^
In file included from <built-in>:1:
In file included from C:\GIT\LLVM\trunk-for-submits\llvm-64-release-vs2017-15.9.9\dist\lib\clang\9.0.0\include\__clang_cuda_runtime_wrapper.h:327:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:486:11: error: no matching function for call to '__finitel'
  return (__finitel(a) != 0);
          ^~~~~~~~~
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0/include\crt/math_functions.hpp:2652:14: note: candidate function not viable: call to __host__ function from __device__ function
__func__(int __finitel(long double a))
             ^
3 errors generated when compiling for sm_50.

[Solution]
Add missing long double device functions' declarations. Provide only declarations to prevent any use of long double on the device side, because CUDA does not support long double on the device side.

[Testing]
{Windows 10, Ubuntu 16.04.5}/{Visual C++ 2017 15.9.9, gcc+ 5.4.0}/CUDA {8.0, 9.0, 9.1, 9.2, 10.0, 10.1}

Reviewed by: Artem Belevich

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

llvm-svn: 357779

5 years agolit: support long paths on Windows
Saleem Abdulrasool [Fri, 5 Apr 2019 16:48:00 +0000 (16:48 +0000)]
lit: support long paths on Windows

Use ctypes to call into SHFileOperationW with the extended NT path to allow us
to remove paths which exceed 261 characters on Windows. This functionality is
exercised by swift's test suite.

llvm-svn: 357778

5 years agoAdd documentation for PDB TPI/IPI Stream.
Zachary Turner [Fri, 5 Apr 2019 16:43:42 +0000 (16:43 +0000)]
Add documentation for PDB TPI/IPI Stream.

llvm-svn: 357777

5 years ago[InstCombine] add test to show reassociation that creates a denormal constant; NFC
Sanjay Patel [Fri, 5 Apr 2019 16:42:21 +0000 (16:42 +0000)]
[InstCombine] add test to show reassociation that creates a denormal constant; NFC

llvm-svn: 357776

5 years ago[libc++] Fix error flags and exceptions propagated from input stream operations
Louis Dionne [Fri, 5 Apr 2019 16:33:37 +0000 (16:33 +0000)]
[libc++] Fix error flags and exceptions propagated from input stream operations

Summary:
This is a re-application of r357533 and r357531. They had been reverted
because we thought the commits broke the LLDB data formatters, but it
turns out this was because only r357531 had been included in the CI
run.

Before this patch, we would only ever throw an exception if the badbit
was set on the stream. The Standard is currently very unclear on how
exceptions should be propagated and what error flags should be set by
the input stream operations. This commit changes libc++ to behave under
a different (but valid) interpretation of the Standard. This interpretation
of the Standard matches what other implementations are doing.

This effectively implements the wording in p1264r0. It hasn't been voted
into the Standard yet, however there is wide agreement that the fix is
correct and it's just a matter of time before the fix is standardized.

PR21586
PR15949
rdar://problem/15347558

Reviewers: mclow.lists, EricWF

Subscribers: christof, dexonsmith, cfe-commits

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

llvm-svn: 357775

5 years agoRevert "[llvm-readobj] Improve error message for --string-dump"
Stephen Tozer [Fri, 5 Apr 2019 16:32:25 +0000 (16:32 +0000)]
Revert "[llvm-readobj] Improve error message for --string-dump"

This reverts commit 681b0798dbbc6b3500c9930977ec8a274b142acb.

Reverted due to causing build failures: llvm-svn: 357772

llvm-svn: 357774

5 years agoChange some dyn_cast to more apropriate isa. NFC
Fangrui Song [Fri, 5 Apr 2019 16:16:23 +0000 (16:16 +0000)]
Change some dyn_cast to more apropriate isa. NFC

llvm-svn: 357773

5 years ago[llvm-readobj] Improve error message for --string-dump
Stephen Tozer [Fri, 5 Apr 2019 16:15:50 +0000 (16:15 +0000)]
[llvm-readobj] Improve error message for --string-dump

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

This patch changes the error message when the section specified by
--string-dump cannot be found by including the name of the section in
the error message and changing the prefix text to not imply that the
file itself was invalid. As part of this change some uses of
std::error_code have been replaced with the llvm Error class to better
encapsulate the error info (rather than passing File strings around),
and the WithColor class replaces string literal error prefixes.

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

llvm-svn: 357772

5 years ago[format] Add correct punctuation to comment
Stephen Tozer [Fri, 5 Apr 2019 15:59:07 +0000 (15:59 +0000)]
[format] Add correct punctuation to comment

Test commit that adds a grammatically correct full stop to a single
comment.

llvm-svn: 357771

5 years ago[Tooling] add a Heuristic field indicating that a CompileCommand was guessed.
Sam McCall [Fri, 5 Apr 2019 15:22:20 +0000 (15:22 +0000)]
[Tooling] add a Heuristic field indicating that a CompileCommand was guessed.

Summary:
Use cases:
 - a tool that dumps the heuristic used for each header in a project can
   be used to evaluate changes to the heuristic
 - we want to expose this information to users in clangd as it affects
   accuracy/reliability of editor features
 - express interpolation tests more directly

Reviewers: ilya-biryukov, klimek

Subscribers: ioeric, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 357770

5 years agoAdd an option do not dump the generated object on disk
Guillaume Chatelet [Fri, 5 Apr 2019 15:18:59 +0000 (15:18 +0000)]
Add an option do not dump the generated object on disk

Reviewers: courbet

Subscribers: llvm-commits, bdb

Tags: #llvm

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

llvm-svn: 357769

5 years ago[LibTooling] Add Transformer, a library for source-to-source transformations.
Yitzhak Mandelbaum [Fri, 5 Apr 2019 15:14:05 +0000 (15:14 +0000)]
[LibTooling] Add Transformer, a library for source-to-source transformations.

Summary: Adds a basic version of Transformer, a library supporting the concise specification of clang-based source-to-source transformations.  A full discussion of the end goal can be found on the cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling".

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: ioeric, ABataev, mgorny, jfb, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 357768

5 years ago[ExpandMemCmp][NFC] Add tests for `memcmp(p, q, n) < 0` case.
Clement Courbet [Fri, 5 Apr 2019 15:03:25 +0000 (15:03 +0000)]
[ExpandMemCmp][NFC] Add tests for `memcmp(p, q, n) < 0` case.

llvm-svn: 357767

5 years ago[SelectionDAG] Add fcmp UNDEF handling to SelectionDAG::FoldSetCC
Simon Pilgrim [Fri, 5 Apr 2019 14:56:21 +0000 (14:56 +0000)]
[SelectionDAG] Add fcmp UNDEF handling to SelectionDAG::FoldSetCC

Second half of PR40800, this patch adds DAG undef handling to fcmp instructions to match the behavior in llvm::ConstantFoldCompareInstruction, this permits constant folding of vector comparisons where some elements had been reduced to UNDEF (by SimplifyDemandedVectorElts etc.).

This involves a lot of tweaking to reduced tests as bugpoint loves to reduce fcmp arguments to undef........

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

llvm-svn: 357765

5 years ago[LibTooling] Add "SourceCode" library for functions relating to source-code manipulation.
Yitzhak Mandelbaum [Fri, 5 Apr 2019 14:05:03 +0000 (14:05 +0000)]
[LibTooling] Add "SourceCode" library for functions relating to source-code manipulation.

Summary:
Introduces a utility library in Refactoring/ to collect routines related to
source-code manipulation.  In this change, we move "extended-range" functions
from the FixIt library (in clangTooling) to this new library.

We need to use this functionality in Refactoring/ and cannot access it if it
resides in Tooling/, because that would cause clangToolingRefactor to depend on
clangTooling, which would be a circular dependency.

Reviewers: ilya-biryukov, ioeric

Reviewed By: ilya-biryukov

Subscribers: mgorny, cfe-commits

Tags: #clang

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

llvm-svn: 357764

5 years agoGlobalISel: Add another overload of buildUnmerge
Matt Arsenault [Fri, 5 Apr 2019 14:03:07 +0000 (14:03 +0000)]
GlobalISel: Add another overload of buildUnmerge

It's annoying to have to create an array of the result type,
particularly when you don't care about the size of the value.

llvm-svn: 357763

5 years agoAMDGPU/GlobalISel: Fix non-power-of-2 select
Matt Arsenault [Fri, 5 Apr 2019 14:03:04 +0000 (14:03 +0000)]
AMDGPU/GlobalISel: Fix non-power-of-2 select

llvm-svn: 357762

5 years ago[llvm] Add isa_and_nonnull
Don Hinton [Fri, 5 Apr 2019 13:59:24 +0000 (13:59 +0000)]
[llvm] Add isa_and_nonnull

Summary:
Add new ``isa_and_nonnull<>`` operator that works just like
the ``isa<>`` operator, except that it allows for a null pointer as an
argument (which it then returns false).

Reviewers: lattner, aaron.ballman, greened

Reviewed By: lattner

Subscribers: hubert.reinterpretcast, llvm-commits

Tags: #llvm

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

llvm-svn: 357761

5 years ago[DAGCombiner][x86] scalarize splatted vector FP ops
Sanjay Patel [Fri, 5 Apr 2019 13:32:17 +0000 (13:32 +0000)]
[DAGCombiner][x86] scalarize splatted vector FP ops

There are a variety of vector patterns that may be profitably reduced to a
scalar op when scalar ops are performed using a subset (typically, the
first lane) of the vector register file.

For x86, this is true for float/double ops and element 0 because
insert/extract is just a sub-register rename.

Other targets should likely enable the hook in a similar way.

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

llvm-svn: 357760

5 years ago[TextAPI] Fix off-by-one error in the bit index extraction loop
Petar Jovanovic [Fri, 5 Apr 2019 12:58:15 +0000 (12:58 +0000)]
[TextAPI] Fix off-by-one error in the bit index extraction loop

The loop in findNextSetBit() runs one pass more than it should.

On 64-bit architectures this does not cause a problem, but 32-bit
architectures mask the shift count to 5 bits which limits the number of
shifts inside a range of 0 to 31. Shifting by 32 has the same effect as
shifting by 0, so if the first bit in the set is 1, the function will return
with Index different from EndIndexVal. Because of that, range-based for
loops iterating thorough architectures will continue until hitting a 0 in
the set, resulting in n additional iterations, where n is equal to the
number of consecutive 1 bits at the start the set.

Ultimately TBDv1.WriteFile and TBDv2.WriteFile will output additional
architectures causing a failure in the unit tests.

Patch by Milos Stojanovic.

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

llvm-svn: 357759

5 years ago[Symbolize] Replace map<SymbolDesc, StringRef> with sorted vector
Fangrui Song [Fri, 5 Apr 2019 12:52:04 +0000 (12:52 +0000)]
[Symbolize] Replace map<SymbolDesc, StringRef> with sorted vector

llvm-svn: 357758

5 years ago[X86][AVX] Add PR34584 masked store test cases
Simon Pilgrim [Fri, 5 Apr 2019 11:34:30 +0000 (11:34 +0000)]
[X86][AVX] Add PR34584 masked store test cases

llvm-svn: 357757

5 years ago[X86] Add SSE/AVX1/AVX2 masked trunc+store tests
Simon Pilgrim [Fri, 5 Apr 2019 11:22:28 +0000 (11:22 +0000)]
[X86] Add SSE/AVX1/AVX2 masked trunc+store tests

llvm-svn: 357756

5 years agomodify-python-lldb.py: Insert initialization code with swig instead
Pavel Labath [Fri, 5 Apr 2019 09:56:55 +0000 (09:56 +0000)]
modify-python-lldb.py: Insert initialization code with swig instead

This is the last functional change to the generated python module being
done by modify-python-lldb.py. The remaining code just deals with
reformatting of comments.

llvm-svn: 357755

5 years agoFix r357749 for big-endian architectures
Pavel Labath [Fri, 5 Apr 2019 08:43:54 +0000 (08:43 +0000)]
Fix r357749 for big-endian architectures

We need to read the strings from the minidump files as little-endian,
regardless of the host byte order.

I definitely remember thinking about this case while writing the patch
(and in fact, I have implemented that for the "write" case), but somehow
I have ended up not implementing the byte swapping when reading the
data. This adds the necessary byte-swapping and should hopefully fix
test failures on big-endian bots.

llvm-svn: 357754

5 years ago[Sanitizers] Provide __internal_dup on Solaris
Rainer Orth [Fri, 5 Apr 2019 08:42:21 +0000 (08:42 +0000)]
[Sanitizers] Provide __internal_dup on Solaris

Both LLVM 8.0.0 and current trunk fail to link libclang_rt.ubsan.standalone-*.so
on Solaris 11/x86 with GCC 8.1.0:

  Undefined first referenced
   symbol       in file
  Scanning dependencies of target clang_rt.asan_cxx-x86_64
  __sanitizer::internal_dup(int)      ../sanitizer_common/CMakeFiles/RTSanitizerCommon.i386.dir/sanitizer_posix.cc.o
  ld: fatal: symbol referencing errors
  collect2: error: ld returned 1 exit status
  make[2]: *** [projects/compiler-rt/lib/ubsan/CMakeFiles/clang_rt.ubsan_standalone-dynamic-i386.dir/build.make:233: lib/clang/9.0.0/lib/sunos/libclang_rt.ubsan_standalone-i386.so] Error 1

Fixed by providing an implementation, which allowed the i386-pc-solaris2.11 build
to finish.

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

llvm-svn: 357753

5 years ago[RISCV] Implement adding a displacement to a BlockAddress
Roger Ferrer Ibanez [Fri, 5 Apr 2019 08:40:57 +0000 (08:40 +0000)]
[RISCV] Implement adding a displacement to a BlockAddress

Recent change rL357393 uses MachineInstrBuilder::addDisp to add a based on a
BlockAddress but this case was not implemented.

This patch adds the missing case and a test for RISC-V that exercises the new
case.

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

llvm-svn: 357752

5 years ago[Sanitizers] Fix sanitizer_linux_libcdep.cc compilation on Solaris
Rainer Orth [Fri, 5 Apr 2019 08:40:08 +0000 (08:40 +0000)]
[Sanitizers] Fix sanitizer_linux_libcdep.cc compilation on Solaris

Both LLVM 8.0.0 and current trunk fail to compile on Solaris 11/x86 with
GCC 8.1.0:

  /vol/llvm/src/llvm/dist/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc: In function ‘void __sanitizer::ReExec()’:
  /vol/llvm/src/llvm/dist/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:831:14: error: ‘getexecname’ was not declared in this scope
     pathname = getexecname();
                ^~~~~~~~~~~
  /vol/llvm/src/llvm/dist/projects/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc:831:14: note: suggested alternative: ‘gethostname’
     pathname = getexecname();
                ^~~~~~~~~~~
                gethostname

This is easily fixed by including <stdlib.h> which declares that function.
With that patch, compilation continues.

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

llvm-svn: 357751

5 years agoFix MSVC build for r357749
Pavel Labath [Fri, 5 Apr 2019 08:26:58 +0000 (08:26 +0000)]
Fix MSVC build for r357749

MSVC found the bare "make_unique" invocation ambiguous (between std::
and llvm:: versions). Explicitly qualifying the call with llvm:: should
hopefully fix it.

llvm-svn: 357750

5 years agoMinidump: Add support for reading/writing strings
Pavel Labath [Fri, 5 Apr 2019 08:06:26 +0000 (08:06 +0000)]
Minidump: Add support for reading/writing strings

Summary:
Strings in minidump files are stored as a 32-bit length field, giving
the length of the string in *bytes*, which is followed by the
appropriate number of UTF16 code units. The string is also supposed to
be null-terminated, and the null-terminator is not a part of the length
field. This patch:
- adds support for reading these strings out of the minidump file (this
  implementation does not depend on proper null-termination)
- adds support for writing them to a minidump file
- using the previous two pieces implements proper (de)serialization of
  the CSDVersion field of the SystemInfo stream. Previously, this was
  only read/written as hex, and no attempt was made to access the
  referenced string -- now this string is read and written correctly.

The changes are tested via yaml2obj|obj2yaml round-trip as well as a
unit test which checks the corner cases of the string deserialization
logic.

Reviewers: jhenderson, zturner, clayborg

Subscribers: llvm-commits, aprantl, markmentovai, amccarth, lldb-commits

Tags: #llvm

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

llvm-svn: 357749

5 years agoMinidumpParser: use minidump parser in llvm/Object
Pavel Labath [Fri, 5 Apr 2019 07:56:39 +0000 (07:56 +0000)]
MinidumpParser: use minidump parser in llvm/Object

This patch removes the lower layers of the minidump parsing code from
the MinidumpParser class, and replaces it with the minidump parser in
llvm.

Not all functionality is already avaiable in the llvm class, but it is
enough for us to be able to stop enumerating streams manually, and rely
on the minidump directory parsing code from the llvm class.

This also removes some checked-in binaries which were used to test error
handling in the parser, as the error handling is now done (and tested)
in llvm. Instead I just add one test that ensures we correctly propagate
the errors reported by the llvm parser. The input for this test can be
written in yaml instead of a checked-in binary.

llvm-svn: 357748

5 years agoTestVCCode_step: replace assertTrue with more specific assertions
Pavel Labath [Fri, 5 Apr 2019 07:56:26 +0000 (07:56 +0000)]
TestVCCode_step: replace assertTrue with more specific assertions

When this test fails (flakes) all we get is an error message like "False
is not True". This replaces patterns like assertTrue(a == b) with
assertEqual(a, b), so we get a better error message (and hopefully a
hint as to why the test is flaky).

llvm-svn: 357747

5 years ago[SelectionDAG] Compute known bits of CopyFromReg
Piotr Sobczak [Fri, 5 Apr 2019 07:44:09 +0000 (07:44 +0000)]
[SelectionDAG] Compute known bits of CopyFromReg

Summary:
Teach SelectionDAG how to compute known bits of ISD::CopyFromReg if
the virtual reg used has one def only.

This can be particularly useful when calling isBaseWithConstantOffset()
with the ISD::CopyFromReg argument, as more optimizations may get enabled
in the result.

Also add a missing truncation on X86, found by testing of this patch.

Change-Id: Id1c9fceec862d118c54a5b53adf72ada5d6daefa

Reviewers: bogner, craig.topper, RKSimon

Reviewed By: RKSimon

Subscribers: lebedev.ri, nemanjai, jvesely, nhaehnle, javed.absar, jsji, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 357745

5 years agoPDBFPO: Use references instead of pointers, where possible
Pavel Labath [Fri, 5 Apr 2019 07:28:52 +0000 (07:28 +0000)]
PDBFPO: Use references instead of pointers, where possible

Summary:
The code was passing pointers around, expecting they would be not null.
In c++ it is possible to convey this notion explicitly by using a
reference instead.

Not all uses of pointers could be converted to references (e.g. one
can't store references in a container), but this will at least make it
locally obvious that code is dealing with nonnull pointers.

Reviewers: aleksandr.urakov, amccarth

Subscribers: lldb-commits

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

llvm-svn: 357744

5 years ago[X86] Promote i16 SRA instructions to i32
Craig Topper [Fri, 5 Apr 2019 06:32:50 +0000 (06:32 +0000)]
[X86] Promote i16 SRA instructions to i32

We already promote SRL and SHL to i32.

This will introduce sign extends sometimes which might be harder to deal with than the zero we use for promoting SRL. I ran this through some of our internal benchmark lists and didn't see any major regressions.

I think there might be some DAG combine improvement opportunities in the test changes here.

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

llvm-svn: 357743

5 years ago[FastISel] Fix crash for gc.relocate lowring
Serguei Katkov [Fri, 5 Apr 2019 05:41:08 +0000 (05:41 +0000)]
[FastISel] Fix crash for gc.relocate lowring

Lowering safepoint checks that all gc.relocaes observed in safepoint
must be lowered. However Fast-Isel is able to skip dead gc.relocate.

To resolve this issue we just ignore dead gc.relocate in the check.

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

llvm-svn: 357742

5 years ago[TSan][libdispatch] Make test work on Linux, pt. 2
Julian Lettner [Fri, 5 Apr 2019 02:05:57 +0000 (02:05 +0000)]
[TSan][libdispatch] Make test work on Linux, pt. 2

llvm-svn: 357741

5 years ago[test] Specify an explicit darwin version in a triple in
Alex Lorenz [Fri, 5 Apr 2019 01:48:11 +0000 (01:48 +0000)]
[test] Specify an explicit darwin version in a triple in
`test/Driver/debug-options.c` to ensure that the driver
selects the DWARF 2 version as intended by the test.

Fixes the `test/Driver/debug-options.c` test regression on GreenDragon
on macOS that started failing after r357713.

llvm-svn: 357740

5 years agoELF: Simplify. NFCI.
Peter Collingbourne [Fri, 5 Apr 2019 01:31:40 +0000 (01:31 +0000)]
ELF: Simplify. NFCI.

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

llvm-svn: 357739

5 years agoRemove redundant parameters. NFC.
Rui Ueyama [Fri, 5 Apr 2019 01:30:09 +0000 (01:30 +0000)]
Remove redundant parameters. NFC.

llvm-svn: 357738

5 years ago[WebAssembly] Include function in wasm table when used in R_WASM_TABLE_INDEX_REL_SLEB
Sam Clegg [Fri, 5 Apr 2019 00:35:12 +0000 (00:35 +0000)]
[WebAssembly] Include function in wasm table when used in R_WASM_TABLE_INDEX_REL_SLEB

This should have been part of rL357710 but was overlooked because
in our test code the function in question was also used in other
relocations that caused it to be added to the table anyway.

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

llvm-svn: 357737

5 years agoNFC: Move API uses of MD5::MD5Result to Optional rather than a pointer.
Eric Christopher [Thu, 4 Apr 2019 23:34:38 +0000 (23:34 +0000)]
NFC: Move API uses of MD5::MD5Result to Optional rather than a pointer.

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

llvm-svn: 357736

5 years agoInclude invoke'd functions for recursive extract
David Callahan [Thu, 4 Apr 2019 23:30:47 +0000 (23:30 +0000)]
Include invoke'd functions for recursive extract

Summary: When recursively extracting a function from a bit code file, include functions mentioned in InvokeInst as well as CallInst

Reviewers: loladiro, espindola, volkan

Reviewed By: loladiro

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 357735

5 years agoAn unreachable block may have a route to a reachable block, don't fast-path return...
Nick Lewycky [Thu, 4 Apr 2019 23:09:40 +0000 (23:09 +0000)]
An unreachable block may have a route to a reachable block, don't fast-path return that it can't.

A block reachable from the entry block can't have any route to a block that's not reachable from the entry block (if it did, that route would make it reachable from the entry block). That is the intended performance optimization for isPotentiallyReachable. For the case where we ask whether an unreachable from entry block has a route to a reachable from entry block, we can't conclude one way or the other. Fix a bug where we claimed there could be no such route.

The fix in rL357425 ironically reintroduced the very bug it was fixing but only when a DominatorTree is provided. This fixes the remaining bug.

llvm-svn: 357734

5 years ago[TextAPI] Prefix all architecture enums to fix the build on i386.
Juergen Ributzka [Thu, 4 Apr 2019 22:56:50 +0000 (22:56 +0000)]
[TextAPI] Prefix all architecture enums to fix the build on i386.

Summary: This changes the Architecture enum to use a prefix (AK_) to prevent the
preprocessor from replacing i386 with 1 when building llvm/clang for i386.

Reviewers: steven_wu, lhames, mstorsjo

Reviewed By: mstorsjo

Subscribers: hiraditya, jkorous, dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 357733

5 years ago[libFuzzer] Another follow up fix for Data Flow scripts in Py3.
Max Moroz [Thu, 4 Apr 2019 22:55:18 +0000 (22:55 +0000)]
[libFuzzer] Another follow up fix for Data Flow scripts in Py3.

Reviewers: Dor1s

Reviewed By: Dor1s

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 357732

5 years ago[IR] Refactor attribute methods in Function class (NFC)
Evandro Menezes [Thu, 4 Apr 2019 22:40:06 +0000 (22:40 +0000)]
[IR] Refactor attribute methods in Function class (NFC)

Rename the functions that query the optimization kind attributes.

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

llvm-svn: 357731

5 years ago[libFuzzer] Fix output format in data flow merge script after Py3 change.
Max Moroz [Thu, 4 Apr 2019 22:21:27 +0000 (22:21 +0000)]
[libFuzzer] Fix output format in data flow merge script after Py3 change.

Reviewers: Dor1s

Reviewed By: Dor1s

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 357730

5 years ago[TSan][libdispatch] Make test work on Linux
Julian Lettner [Thu, 4 Apr 2019 21:55:40 +0000 (21:55 +0000)]
[TSan][libdispatch] Make test work on Linux

llvm-svn: 357729

5 years agoRemove unneeded ymath.h include from int_math.h
Reid Kleckner [Thu, 4 Apr 2019 21:47:15 +0000 (21:47 +0000)]
Remove unneeded ymath.h include from int_math.h

This avoids a conflict between stdbool.h, which defines bool to _Bool in
xkeycheck.h. From what I can tell, ymath.h is an internal header, and
the intention is that users should include math.h directly instead. It
doesn't appear to provide declarations of anything required for our
builtins. This include was added back in r249513 from 2015, and it's
possible that ymath.h provided something this code needed at the time,
but today it does not.

llvm-svn: 357728

5 years ago[TSan][libdispatch] Stricter checks via `--implicit-check-not`
Julian Lettner [Thu, 4 Apr 2019 21:25:56 +0000 (21:25 +0000)]
[TSan][libdispatch] Stricter checks via `--implicit-check-not`

`--implicit-check-not='ThreadSanitizer'` checks in the entire output
while `// CHECK-NOT: ThreadSanitizer` only checks after (before) the
previous (next) match.

llvm-svn: 357727

5 years ago[libFuzzer] Make DataFlow scripts Python3 compatible.
Max Moroz [Thu, 4 Apr 2019 21:20:36 +0000 (21:20 +0000)]
[libFuzzer] Make DataFlow scripts Python3 compatible.

Summary:
Python2 will hit end of life soon: https://pythonclock.org/
This change also makes the integration with OSS-Fuzz a bit simpler:
https://github.com/google/oss-fuzz/issues/1632

Reviewers: morehouse, kcc

Reviewed By: morehouse

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 357726

5 years ago[winasan] Fix strrchr interception with vs2019 CRT
Reid Kleckner [Thu, 4 Apr 2019 21:08:02 +0000 (21:08 +0000)]
[winasan] Fix strrchr interception with vs2019 CRT

strrchr in vs2019 CRT begins with unrecognized instructions.

VCRUNTIME140!strrchr:
4533c9         xor     r9d, r9d
4c8bc1         mov     r8, rcx

Patch by Christopher Reid!

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

llvm-svn: 357725

5 years agoMake SourceManager::createFileID(UnownedTag, ...) take a const llvm::MemoryBuffer*
Nico Weber [Thu, 4 Apr 2019 21:06:41 +0000 (21:06 +0000)]
Make SourceManager::createFileID(UnownedTag, ...) take a const llvm::MemoryBuffer*

Requires making the llvm::MemoryBuffer* stored by SourceManager const,
which in turn requires making the accessors for that return const
llvm::MemoryBuffer*s and updating all call sites.

The original motivation for this was to use it and fix the TODO in
CodeGenAction.cpp's ConvertBackendLocation() by using the UnownedTag
version of createFileID, and since llvm::SourceMgr* hands out a const
llvm::MemoryBuffer* this is required. I'm not sure if fixing the TODO
this way actually works, but this seems like a good change on its own
anyways.

No intended behavior change.

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

llvm-svn: 357724

5 years agoFix some MCTargetOptions Doxygen comments (NFC)
Scott Linder [Thu, 4 Apr 2019 20:35:57 +0000 (20:35 +0000)]
Fix some MCTargetOptions Doxygen comments (NFC)

llvm-svn: 357723

5 years ago[OpenMP] Fix hang on Windows
Jonathan Peyton [Thu, 4 Apr 2019 20:35:29 +0000 (20:35 +0000)]
[OpenMP] Fix hang on Windows

Debug dump on large machine shows when many OpenMP threads (401 in total)
sleep on a barrier, one of the innermost nesting levels sleeps
on a child's b_arrived flag whose value is equal to 4 and is equal to
checker value. i.e., (1) sleep bit is 0, and (2) done_check() would
return true if called.

It is unclear how this might happen. It could be Windows Server 2016's
error of EnterCriticalSection / LeaveCriticalSection, or
error of WaitForSingleObject / SetEvent / ResetEvent, or
error in the library which is very difficult to find.

As a workaround, change INFINITE wait to timed wait, so that each
thread awakens each 5 seconds (the timeout was chosen arbitrary to not
disturb other threads much), check flag condition under the lock, and
either go to sleep again or stop sleeping as a result of the check.

Patch by Andrey Churbanov

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

llvm-svn: 357722

5 years agoSpecial case ObjCPropertyDecl for printing
David Goldman [Thu, 4 Apr 2019 20:13:22 +0000 (20:13 +0000)]
Special case ObjCPropertyDecl for printing

ObjCPropertyDecl should use the category interface as a context similar to what is done for methods.

Previously category methods would be printed as `::property`; now they are printed as `Class::property`.

llvm-svn: 357720