platform/upstream/llvm.git
7 years ago[libFuzzer] simplify the code a bit
Kostya Serebryany [Fri, 31 Mar 2017 04:17:45 +0000 (04:17 +0000)]
[libFuzzer] simplify the code a bit

llvm-svn: 299180

7 years ago[libFuzzer] tests: don't test 64-bit comparison on 32-bit builds
Kostya Serebryany [Fri, 31 Mar 2017 03:51:40 +0000 (03:51 +0000)]
[libFuzzer] tests: don't test 64-bit comparison on 32-bit builds

llvm-svn: 299179

7 years agoAdd target-cpu
Teresa Johnson [Fri, 31 Mar 2017 03:49:52 +0000 (03:49 +0000)]
Add target-cpu

Sigh, another follow-on fix needed for test in r299152 causing bot
failures. We also need the target-cpu for the ThinLTO BE clang
invocation.

llvm-svn: 299178

7 years ago[libFuzzer] ensure that strncmp is not inlined in a test
Kostya Serebryany [Fri, 31 Mar 2017 03:34:33 +0000 (03:34 +0000)]
[libFuzzer] ensure that strncmp is not inlined in a test

llvm-svn: 299177

7 years agoAdd more target triples to test
Teresa Johnson [Fri, 31 Mar 2017 03:27:47 +0000 (03:27 +0000)]
Add more target triples to test

Third and hopefully final fix to test for r299152 that is causing bot
failures: make sure the target triple specified for the ThinLTO backend
clang invocations as well.

llvm-svn: 299176

7 years ago[asan] Turn -fsanitize-address-use-after-scope on by default [compiler-rt part]
Kuba Mracek [Fri, 31 Mar 2017 03:00:29 +0000 (03:00 +0000)]
[asan] Turn -fsanitize-address-use-after-scope on by default [compiler-rt part]

AddressSanitizer has an optional compile-time flag, -fsanitize-address-use-after-scope, which enables detection of use-after-scope bugs. We'd like to have this feature on by default, because it is already very well tested, it's used in several projects already (LLVM automatically enables it when using -DLLVM_USE_SANITIZER=Address), it's low overhead and there are no known issues or incompatibilities.

This patch enables use-after-scope by default via the Clang driver, where we set true as the default value for AsanUseAfterScope. This also causes the lifetime markers to be generated whenever fsanitize=address is used. This has some nice consequences, e.g. we now have line numbers for all local variables.

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

llvm-svn: 299175

7 years ago[asan] Turn -fsanitize-address-use-after-scope on by default [clang part]
Kuba Mracek [Fri, 31 Mar 2017 03:00:09 +0000 (03:00 +0000)]
[asan] Turn -fsanitize-address-use-after-scope on by default [clang part]

AddressSanitizer has an optional compile-time flag, -fsanitize-address-use-after-scope, which enables detection of use-after-scope bugs. We'd like to have this feature on by default, because it is already very well tested, it's used in several projects already (LLVM automatically enables it when using -DLLVM_USE_SANITIZER=Address), it's low overhead and there are no known issues or incompatibilities.

This patch enables use-after-scope by default via the Clang driver, where we set true as the default value for AsanUseAfterScope. This also causes the lifetime markers to be generated whenever fsanitize=address is used. This has some nice consequences, e.g. we now have line numbers for all local variables.

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

llvm-svn: 299174

7 years agoFix new compile command in test
Teresa Johnson [Fri, 31 Mar 2017 02:55:31 +0000 (02:55 +0000)]
Fix new compile command in test

My previous attempt to fix bot failures from r299152 didn't add the
necessary option to get bitcode out of the cc1 step.

llvm-svn: 299173

7 years ago[XRay][docs] Add XRayExample to docindex.
Dean Michael Berris [Fri, 31 Mar 2017 02:51:19 +0000 (02:51 +0000)]
[XRay][docs] Add XRayExample to docindex.

llvm-svn: 299172

7 years agoRevert r299168 and r299169 due to library dependency issues.
Peter Collingbourne [Fri, 31 Mar 2017 02:44:50 +0000 (02:44 +0000)]
Revert r299168 and r299169 due to library dependency issues.

http://bb.pgr.jp/builders/i686-mingw32-RA-on-linux/builds/25073/steps/build_llvmclang/logs/stdio

llvm-svn: 299171

7 years agoAdd triple to new test
Teresa Johnson [Fri, 31 Mar 2017 02:36:47 +0000 (02:36 +0000)]
Add triple to new test

Attempt to fix bot errors from r299152 by using clang_cc1 and specifying
target triple to compile step.

llvm-svn: 299170

7 years agoFix 32-bit build.
Peter Collingbourne [Fri, 31 Mar 2017 02:32:53 +0000 (02:32 +0000)]
Fix 32-bit build.

llvm-svn: 299169

7 years agoLTO: Reduce memory consumption by creating an in-memory symbol table for InputFiles...
Peter Collingbourne [Fri, 31 Mar 2017 02:28:30 +0000 (02:28 +0000)]
LTO: Reduce memory consumption by creating an in-memory symbol table for InputFiles. NFCI.

Introduce symbol table data structures that can be potentially written to
disk, have the LTO library build those data structures using temporarily
constructed modules and redirect the LTO library implementation to go through
those data structures. This allows us to remove the LLVMContext and Modules
owned by InputFile.

With this change I measured a peak memory consumption decrease from 5.4GB to
2.8GB in a no-op incremental ThinLTO link of Chromium on Linux. The impact on
memory consumption is larger in COFF linkers where we are currently forced
to materialize all metadata in order to read linker options. Peak memory
consumption linking a large piece of Chromium for Windows with full LTO and
debug info decreases from >64GB (OOM) to 15GB.

Part of PR27551.

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

llvm-svn: 299168

7 years ago[libFuzzer] make sure we don't execute libFuzzer's mem* and str* hooks while calling...
Kostya Serebryany [Fri, 31 Mar 2017 02:21:28 +0000 (02:21 +0000)]
[libFuzzer] make sure we don't execute libFuzzer's mem* and str* hooks while calling mem*/str* inside libFuzzer itself

llvm-svn: 299167

7 years agoTemporarily revert "[PPC] In PPCBoolRetToInt change the bool value to i64 if the...
Eric Christopher [Fri, 31 Mar 2017 02:16:54 +0000 (02:16 +0000)]
Temporarily revert "[PPC] In PPCBoolRetToInt change the bool value to i64 if the target is ppc64" as it's causing test failures, I've given Carrot a testcase offline.

This reverts commit r298955.

llvm-svn: 299153

7 years ago[ThinLTO] Set up lto::Config properly for codegen in ThinLTO backends
Teresa Johnson [Fri, 31 Mar 2017 02:05:15 +0000 (02:05 +0000)]
[ThinLTO] Set up lto::Config properly for codegen in ThinLTO backends

Summary:
This involved refactoring out pieces of
EmitAssemblyHelper::CreateTargetMachine for use in runThinLTOBackend.

Subsumes D31114.

Reviewers: mehdi_amini, pcc

Subscribers: Prazek, cfe-commits

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

llvm-svn: 299152

7 years agoUpdate x86-64 ABI link with the one from linuxbase.org since the other
Eric Christopher [Fri, 31 Mar 2017 01:59:40 +0000 (01:59 +0000)]
Update x86-64 ABI link with the one from linuxbase.org since the other
seems to be down.

llvm-svn: 299151

7 years ago[XRay][tools] Remove some assertions in llvm-xray graph
Dean Michael Berris [Fri, 31 Mar 2017 01:56:45 +0000 (01:56 +0000)]
[XRay][tools] Remove some assertions in llvm-xray graph

Summary:
Assertions assuming that function calls may not have zero durations do
not seem to hold in the wild. There are valid cases where the conversion
of the tsc counters end up becoming zero-length durations. These
assertions don't really hold and the algorithms don't need those to be
true for them to work.

Reviewers: dblaikie, echristo

Subscribers: llvm-commits

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

llvm-svn: 299150

7 years agoFix typo, defind -> defined.
Eric Christopher [Fri, 31 Mar 2017 01:46:30 +0000 (01:46 +0000)]
Fix typo, defind -> defined.

llvm-svn: 299149

7 years agoFix typo, defind -> defined.
Eric Christopher [Fri, 31 Mar 2017 01:45:39 +0000 (01:45 +0000)]
Fix typo, defind -> defined.

llvm-svn: 299148

7 years agoDon't add a newline if the object description already has one.
Jim Ingham [Fri, 31 Mar 2017 01:32:57 +0000 (01:32 +0000)]
Don't add a newline if the object description already has one.

<rdar://problem/25755431>

llvm-svn: 299147

7 years ago[clang-tidy] Revert D31406 (Reuse FileID in getLocation)
Chih-Hung Hsieh [Fri, 31 Mar 2017 01:11:11 +0000 (01:11 +0000)]
[clang-tidy] Revert D31406 (Reuse FileID in getLocation)

Somehow the change failed test clang-tidy/llvm-include-order.cpp
on Windows platform.

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

llvm-svn: 299146

7 years ago[libFuzzer] try to fix value-profile-strncmp on the Mac bot
Kostya Serebryany [Fri, 31 Mar 2017 00:52:39 +0000 (00:52 +0000)]
[libFuzzer] try to fix value-profile-strncmp on the Mac bot

llvm-svn: 299145

7 years agoTry to fix the libcxx build with mingw64
Reid Kleckner [Fri, 31 Mar 2017 00:34:05 +0000 (00:34 +0000)]
Try to fix the libcxx build with mingw64

Summary:
mingw64 has lots of default libs that libc++ and its test programs
should link against.

With this patch, cmake now runs successfully with GCC on Windows.

Reviewers: mati865, EricWF

Subscribers: mgorny, cfe-commits

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

llvm-svn: 299144

7 years ago[libc++abi] Remove missed use of config.h
Shoaib Meenai [Fri, 31 Mar 2017 00:29:25 +0000 (00:29 +0000)]
[libc++abi] Remove missed use of config.h

llvm-svn: 299143

7 years agoModuleSummaryAnalysis: Use a more precise #include. NFC.
Peter Collingbourne [Fri, 31 Mar 2017 00:08:24 +0000 (00:08 +0000)]
ModuleSummaryAnalysis: Use a more precise #include. NFC.

llvm-svn: 299142

7 years ago[WebAssembly] Initial linking metadata support
Dan Gohman [Thu, 30 Mar 2017 23:58:19 +0000 (23:58 +0000)]
[WebAssembly] Initial linking metadata support

Add support for the new relocations and linking metadata section support in
https://github.com/WebAssembly/tool-conventions/blob/master/Linking.md. In
particular, this allows LLVM to indicate which variable is the stack pointer,
so that it can be linked with other objects.

This also adds support for emitting type relocations for call_indirect
instructions.

Right now, this is mainly tested by using wabt and hexdump to examine the
output on selected testcases. We'll add more tests as the design stablizes
and more of the pieces are in place.

llvm-svn: 299141

7 years agoAMDGPU: Rename isKernel
Matt Arsenault [Thu, 30 Mar 2017 23:58:04 +0000 (23:58 +0000)]
AMDGPU: Rename isKernel

What we really want to do is distinguish functions that may
be called by other functions, and graphics shaders are not
called kernels.

llvm-svn: 299140

7 years ago[XRay][docs] Examples for how to use XRay
Dean Michael Berris [Thu, 30 Mar 2017 23:46:36 +0000 (23:46 +0000)]
[XRay][docs] Examples for how to use XRay

Summary:
This document is an attempt at showing how XRay could be used to debug
latency issues with LLVM tools, and how to use the llvm-xray tool to
analyse XRay traces.

Reviewers: echristo, mehdi_amini, davide

Subscribers: llvm-commits

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

llvm-svn: 299133

7 years agoThinLTOBitcodeWriter: Use Module::global_values(). NFCI.
Peter Collingbourne [Thu, 30 Mar 2017 23:43:08 +0000 (23:43 +0000)]
ThinLTOBitcodeWriter: Use Module::global_values(). NFCI.

llvm-svn: 299132

7 years agoLangRef: Don't refer to a 'generic' address space.
Matt Arsenault [Thu, 30 Mar 2017 23:36:47 +0000 (23:36 +0000)]
LangRef: Don't refer to a 'generic' address space.

Consistently call this the default address space.

llvm-svn: 299131

7 years agoFixup for r299085: Keep the scribble.cc test on Darwin only, while I investigate...
Kuba Mracek [Thu, 30 Mar 2017 23:34:44 +0000 (23:34 +0000)]
Fixup for r299085: Keep the scribble.cc test on Darwin only, while I investigate why this test sometimes fails on Linux.

llvm-svn: 299130

7 years ago[libc++abi] Delete config.h
Shoaib Meenai [Thu, 30 Mar 2017 23:31:33 +0000 (23:31 +0000)]
[libc++abi] Delete config.h

Summary: It's now completely empty, so we can remove it entirely.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 299129

7 years agoUpdate comments.
Rui Ueyama [Thu, 30 Mar 2017 22:57:49 +0000 (22:57 +0000)]
Update comments.

llvm-svn: 299128

7 years agofixup: use CHECK for non-atttribute sets
Dean Michael Berris [Thu, 30 Mar 2017 22:46:49 +0000 (22:46 +0000)]
fixup: use CHECK for non-atttribute sets

llvm-svn: 299127

7 years ago[XRay][clang] Fix the -fxray-instruction-threshold flag processing
Dean Michael Berris [Thu, 30 Mar 2017 22:46:45 +0000 (22:46 +0000)]
[XRay][clang] Fix the -fxray-instruction-threshold flag processing

Summary:
The refactoring introduced a regression in the flag processing for
-fxray-instruction-threshold which causes it to not get passed properly.
This change should restore the previous behaviour.

Reviewers: rnk, pelikan

Subscribers: cfe-commits

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

llvm-svn: 299126

7 years agoAdd testcase for r299124.
Eric Christopher [Thu, 30 Mar 2017 22:35:10 +0000 (22:35 +0000)]
Add testcase for r299124.

Patch by Tim Shen!

llvm-svn: 299125

7 years agogetPristineRegs is not accurately considering shrink wrapping puts
Eric Christopher [Thu, 30 Mar 2017 22:34:20 +0000 (22:34 +0000)]
getPristineRegs is not accurately considering shrink wrapping puts
registers not saved in certain blocks. Use explicit getCalleeSavedInfo
and isLiveIn instead.

This fixes pr32292.

Patch by Tim Shen!

llvm-svn: 299124

7 years ago[InstCombine] Fix typo last->least. NFC
Craig Topper [Thu, 30 Mar 2017 22:28:55 +0000 (22:28 +0000)]
[InstCombine] Fix typo last->least. NFC

llvm-svn: 299123

7 years agoAMDGPU: Add all atomicrmw fields to atomic.inc/dec
Matt Arsenault [Thu, 30 Mar 2017 22:21:40 +0000 (22:21 +0000)]
AMDGPU: Add all atomicrmw fields to atomic.inc/dec

Add scope, order, isVolatile

llvm-svn: 299122

7 years ago[InstSimplify] Use m_SignBit instead of calling getSignBit and using m_Specific....
Craig Topper [Thu, 30 Mar 2017 22:21:16 +0000 (22:21 +0000)]
[InstSimplify] Use m_SignBit instead of calling getSignBit and using m_Specific. NFCI

llvm-svn: 299121

7 years ago[InstSimplify] Use APInt::isMaxSignedValue() instead of comparing with ~APInt::getSig...
Craig Topper [Thu, 30 Mar 2017 22:10:54 +0000 (22:10 +0000)]
[InstSimplify] Use APInt::isMaxSignedValue() instead of comparing with ~APInt::getSignBit. NFC

llvm-svn: 299120

7 years ago[clang-tidy] Reuse FileID in getLocation
Chih-Hung Hsieh [Thu, 30 Mar 2017 22:09:17 +0000 (22:09 +0000)]
[clang-tidy] Reuse FileID in getLocation

One FileID per warning will increase and overflow NextLocalOffset
when input file is large with many warnings.
Reusing FileID avoids this problem.

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

llvm-svn: 299119

7 years ago[SimplifyIndvar] Replace the sdiv used by IV if we can prove both of its operands...
Hongbin Zheng [Thu, 30 Mar 2017 21:56:56 +0000 (21:56 +0000)]
[SimplifyIndvar] Replace the sdiv used by IV if we can prove both of its operands are non-negative

Since there is no sdiv in SCEV, an 'udiv' is a better canonical form than an 'sdiv' as the user of induction variable

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

llvm-svn: 299118

7 years agoClang changes for alloc_align attribute
Erich Keane [Thu, 30 Mar 2017 21:48:55 +0000 (21:48 +0000)]
Clang changes for alloc_align attribute

GCC has the alloc_align attribute, which is similar to assume_aligned, except the attribute's parameter is the index of the integer parameter that needs aligning to.

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

llvm-svn: 299117

7 years agoadd NetBSD files to Xcode project to resolve failure from r299109
Tim Hammerquist [Thu, 30 Mar 2017 21:27:51 +0000 (21:27 +0000)]
add NetBSD files to Xcode project to resolve failure from r299109

llvm-svn: 299116

7 years agoInclude filenames in error messages to report broken files.
Rui Ueyama [Thu, 30 Mar 2017 21:13:00 +0000 (21:13 +0000)]
Include filenames in error messages to report broken files.

llvm-svn: 299115

7 years ago[AVX-512] Fix bad comment from r299112. NFC
Craig Topper [Thu, 30 Mar 2017 21:05:33 +0000 (21:05 +0000)]
[AVX-512] Fix bad comment from r299112. NFC

llvm-svn: 299114

7 years agoUse os.path.realpath when tracking the cwd.
Rafael Espindola [Thu, 30 Mar 2017 21:05:31 +0000 (21:05 +0000)]
Use os.path.realpath when tracking the cwd.

This is needed by TestCases/Posix/coverage-direct.cc

The problem is that the test does:

mkdir <dir>
cd <dir>
cd ..
rm -rf <dir>
<more commands>

the current directory currently looks like "/.../<dir>/../" which
doesn't exist when dir is deleted.

at some point we should probably switch to using the os current
directory (specially if we want to add subshell), but this is a small
incremental improvement.

llvm-svn: 299113

7 years ago[AVX-512] Fix another case where fastisel was generating a GR8 to VK1 copy. This...
Craig Topper [Thu, 30 Mar 2017 21:02:52 +0000 (21:02 +0000)]
[AVX-512] Fix another case where fastisel was generating a GR8 to VK1 copy. This time after calls returning i1.

Fixes PR32472.

llvm-svn: 299112

7 years agolit: support redirect from globs
Rafael Espindola [Thu, 30 Mar 2017 20:48:58 +0000 (20:48 +0000)]
lit: support redirect from globs

This adds support for commands like

FileCheck < foobar*

which is used by some asan tests because the file they want to read
has a pid in the name.

llvm-svn: 299111

7 years agoDo not enclose an entire file with namespaces.
Rui Ueyama [Thu, 30 Mar 2017 20:31:19 +0000 (20:31 +0000)]
Do not enclose an entire file with namespaces.

This change is to improve consistency with other files.

llvm-svn: 299110

7 years agoBattery of NetBSD support improvements
Kamil Rytarowski [Thu, 30 Mar 2017 20:25:29 +0000 (20:25 +0000)]
Battery of NetBSD support improvements

Summary:
Include initial support for:
 - single step mode (PT_STEP)
 - single step trap handling (TRAP_TRACE)
 - exec() trap (TRAP_EXEC)
 - add placeholder interfaces for FPR
 - initial code for NetBSD core(5) files
 - minor tweaks

While there improve style of altered elf-core/ files.

This code raises the number of passing tests on NetBSD to around 50% (600+/1200+).

The introduced code is subject to improve afterwards for additional features and bug fixes.

Sponsored by <The NetBSD Foundation>

Reviewers: labath, joerg, emaste, kettenis

Reviewed By: labath

Subscribers: srhines, #lldb

Tags: #lldb

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

llvm-svn: 299109

7 years ago[AMDGPU] Add GlobalOpt parameter to Always Inliner pass
Stanislav Mekhanoshin [Thu, 30 Mar 2017 20:16:02 +0000 (20:16 +0000)]
[AMDGPU] Add GlobalOpt parameter to Always Inliner pass

If set to false it does not remove global aliases. With this parameter
set to false it should be safe to run the pass before link.

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

llvm-svn: 299108

7 years agoTeach stripNonLineTableDebugInfo() to remap DILocations in !llvm.loop nodes.
Adrian Prantl [Thu, 30 Mar 2017 20:10:56 +0000 (20:10 +0000)]
Teach stripNonLineTableDebugInfo() to remap DILocations in !llvm.loop nodes.

llvm-svn: 299107

7 years agoAdd parsing of mllvm command line options.
Rui Ueyama [Thu, 30 Mar 2017 20:10:40 +0000 (20:10 +0000)]
Add parsing of mllvm command line options.

Patch by Alberto Magni
Original patch by Kyungwoo Lee <kyulee@microsoft.com>

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

llvm-svn: 299106

7 years agoFix LWG 2934 - optional<const T> doesn't compare with T
Eric Fiselier [Thu, 30 Mar 2017 20:06:52 +0000 (20:06 +0000)]
Fix LWG 2934 - optional<const T> doesn't compare with T

llvm-svn: 299105

7 years ago[Object] Remove check for BIND_OPCODE_DONE/REBASE_OPCODE_DONE.
Juergen Ributzka [Thu, 30 Mar 2017 19:56:50 +0000 (19:56 +0000)]
[Object] Remove check for BIND_OPCODE_DONE/REBASE_OPCODE_DONE.

BIND_OPCODE_DONE/REBASE_OPCODE_DONE may appear at the end of the opcode array,
but they are not required to. The linker only adds them as padding to align the
opcodes to pointer size.

This fixes rdar://problem/31285560.

llvm-svn: 299104

7 years ago[AArch64ISelLowering] Remove `else` after `return` in LowerGlobalTLSAddress.
Davide Italiano [Thu, 30 Mar 2017 19:52:31 +0000 (19:52 +0000)]
[AArch64ISelLowering] Remove `else` after `return` in LowerGlobalTLSAddress.

llvm-svn: 299103

7 years ago[AArch64] Simplify isSingExtended()/isZeroExtended(). NFCI.
Davide Italiano [Thu, 30 Mar 2017 19:46:18 +0000 (19:46 +0000)]
[AArch64] Simplify isSingExtended()/isZeroExtended(). NFCI.

llvm-svn: 299102

7 years ago[WebAssembly] Improve support for WebAssembly binary format
Derek Schuff [Thu, 30 Mar 2017 19:44:09 +0000 (19:44 +0000)]
[WebAssembly] Improve support for WebAssembly binary format

Mostly this change adds support converting to and from
YAML which will allow us to write more test cases for
the WebAssembly MC and lld ports.

Better support for objdump, readelf, and nm will be in
followup CLs.

I had to update the two wasm test binaries because they
used the old style 'name' section which is no longer
supported.

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

Patch by Sam Clegg

llvm-svn: 299101

7 years agoImplement LWG 2842 - optional(U&&) needs to SFINAE on decay_t<in_place_t>
Eric Fiselier [Thu, 30 Mar 2017 19:43:50 +0000 (19:43 +0000)]
Implement LWG 2842 - optional(U&&) needs to SFINAE on decay_t<in_place_t>

llvm-svn: 299100

7 years agoFixup for r299085: Disable the scribble.cc test on AArch64.
Kuba Mracek [Thu, 30 Mar 2017 19:36:49 +0000 (19:36 +0000)]
Fixup for r299085: Disable the scribble.cc test on AArch64.

llvm-svn: 299099

7 years agoFollowing r297661, disable dup workaround to disable duplicate STDOUT fd closing...
Yaron Keren [Thu, 30 Mar 2017 19:30:51 +0000 (19:30 +0000)]
Following r297661, disable dup workaround to disable duplicate STDOUT fd closing and instead directly prevent closing of STD* file descriptors.

We do not want to close STDOUT as there may have been several uses of it
such as the case: llc %s -o=- -pass-remarks-output=- -filetype=asm
which cause multiple closes of STDOUT_FILENO and/or use-after-close of it.
Using dup() in getFD doesn't work as we end up with original STDOUT_FILENO
open anyhow.

reviewed by Rafael Espindola

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

llvm-svn: 299098

7 years agoChange the error message format for undefined symbols.
Rui Ueyama [Thu, 30 Mar 2017 19:13:47 +0000 (19:13 +0000)]
Change the error message format for undefined symbols.

Previously, undefined symbol errors are one line like this
and wasn't easy to read.

  /ssd/clang/bin/ld.lld: error: /ssd/llvm-project/lld/ELF/Writer.cpp:207: undefined symbol 'lld::elf::EhFrameSection<llvm::object::ELFType<(llvm::support::endianness)0, true> >::addSection(lld::elf::InputSectionBase*)'

This patch make it more structured like this.

  bin/ld.lld: error: undefined symbol: lld::elf::EhFrameSection<llvm::object::ELFType<(llvm::support::endianness)0, true>
  >>> Referenced by Writer.cpp:207 (/ssd/llvm-project/lld/ELF/Writer.cpp:207)
  >>>               Writer.cpp.o in archive lib/liblldELF.a

Discussion thread:
http://lists.llvm.org/pipermail/llvm-dev/2017-March/111459.html

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

llvm-svn: 299097

7 years ago[DAGCombiner] Initial support for the fast-math flag contract
Adam Nemet [Thu, 30 Mar 2017 18:53:04 +0000 (18:53 +0000)]
[DAGCombiner] Initial support for the fast-math flag contract

Now alternatively to the TargetOption.AllowFPOpFusion global flag, FMUL->FADD
can also use the per operation FMF to allow fusion.

The idea here is not to port everything to the new scheme (e.g. fused
multiply-and-sub will be ported later) but that this work all the way from
clang.

The transformation is conditionalized on *both* the FADD and the FMUL having
the FMF contract flag.

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

llvm-svn: 299096

7 years agoRevert r298776 - Expression: add missing linkage to RuntimeDyld ...
Michal Gorny [Thu, 30 Mar 2017 18:24:07 +0000 (18:24 +0000)]
Revert r298776 - Expression: add missing linkage to RuntimeDyld ...

This needs to be addressed within LLVM itself.

llvm-svn: 299095

7 years agoCorrecting a typo; NFC.
Aaron Ballman [Thu, 30 Mar 2017 18:11:20 +0000 (18:11 +0000)]
Correcting a typo; NFC.

llvm-svn: 299094

7 years ago[CodeGen] Pass SDAG an ORE, and replace FastISel stats with remarks.
Ahmed Bougacha [Thu, 30 Mar 2017 17:49:58 +0000 (17:49 +0000)]
[CodeGen] Pass SDAG an ORE, and replace FastISel stats with remarks.

In the long-term, we want to replace statistics with something
finer-grained that lets us gather per-function data.
Remarks are that replacement.

Create an ORE instance in SelectionDAGISel, and pass it to
SelectionDAG.

SelectionDAG was used so that we can emit remarks from all
SelectionDAG-related code, including TargetLowering and DAGCombiner.
This isn't used in the current patch but Adam tells me he's interested
for the fp-contract combines.

Use the ORE instance to emit FastISel failures as remarks (instead of
the mix of dbgs() dumps and statistics that we currently have).

Eventually, we want to have an API that tells us whether remarks are
enabled (http://llvm.org/PR32352) so that we don't emit expensive
remarks (in this case, dumping IR) when it's not needed.  For now, use
'isEnabled' as a crude replacement.

This does mean that the replacement for '-fast-isel-verbose' is now
'-pass-remarks-missed=isel'.  Additionally, clang users also need to
enable remark diagnostics, using '-Rpass-missed=isel'.

This also removes '-fast-isel-verbose2': there are no static statistics
that we want to only enable in asserts builds, so we can always use
the remarks regardless of the build type.

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

llvm-svn: 299093

7 years agoFixup for r299085: On Windows %p doesn't print 0x prefix.
Kuba Mracek [Thu, 30 Mar 2017 17:48:41 +0000 (17:48 +0000)]
Fixup for r299085: On Windows %p doesn't print 0x prefix.

llvm-svn: 299092

7 years ago[DAGCombiner] add helper function for visitORLike; NFCI
Sanjay Patel [Thu, 30 Mar 2017 17:32:42 +0000 (17:32 +0000)]
[DAGCombiner] add helper function for visitORLike; NFCI

This combines all of the equivalent clean-ups for foldAndOfSetCCs:
https://reviews.llvm.org/rL298938
https://reviews.llvm.org/rL298940
https://reviews.llvm.org/rL298944
https://reviews.llvm.org/rL298949
https://reviews.llvm.org/rL298950
https://reviews.llvm.org/rL299002
https://reviews.llvm.org/rL299013

The sins of code duplication are on full display here:
each function is missing a fold that wasn't copied over from its logical sibling.

llvm-svn: 299091

7 years agoFixup for r299085: Print all output to stderr.
Kuba Mracek [Thu, 30 Mar 2017 17:21:51 +0000 (17:21 +0000)]
Fixup for r299085: Print all output to stderr.

llvm-svn: 299090

7 years agoFixup for r299085: Include stdint.h in scribble.cc to make uintptr_t available.
Kuba Mracek [Thu, 30 Mar 2017 17:01:35 +0000 (17:01 +0000)]
Fixup for r299085: Include stdint.h in scribble.cc to make uintptr_t available.

llvm-svn: 299089

7 years ago[yaml2obj] Enable and fix tests
Chris Bieneman [Thu, 30 Mar 2017 16:35:02 +0000 (16:35 +0000)]
[yaml2obj] Enable and fix tests

Summary:
These tests were not being run because the yaml extension
wasn't be picked up by lit.

This change also fixes the tests which themselves were broken.

Patch By: Sam Clegg

Reviewers: beanz

Reviewed By: beanz

Subscribers: fhahn

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

llvm-svn: 299088

7 years ago[libc++abi] Remove unistd.h include
Shoaib Meenai [Thu, 30 Mar 2017 16:27:09 +0000 (16:27 +0000)]
[libc++abi] Remove unistd.h include

This was originally there for the _POSIX_THREADS define, to detect the
presence of pthreads. That went away with the externalized threading
support, so the include can go away too.

config.h is now completely empty. A follow-up commit will remove it
entirely.

llvm-svn: 299087

7 years ago[tsan] Add interceptor for xpc_connection_cancel to avoid false positives
Kuba Mracek [Thu, 30 Mar 2017 15:48:25 +0000 (15:48 +0000)]
[tsan] Add interceptor for xpc_connection_cancel to avoid false positives

TSan reports a false positive when using xpc_connection_cancel. We're missing a happens-before edge from xpc_connection_cancel to the event handler on the same connection.

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

llvm-svn: 299086

7 years ago[asan] Implement "scribble" flags, which overwrite free'd memory with 0x55
Kuba Mracek [Thu, 30 Mar 2017 15:44:57 +0000 (15:44 +0000)]
[asan] Implement "scribble" flags, which overwrite free'd memory with 0x55

This patch implements "Malloc Scribble" in ASan via "max_free_fill_size" and "free_fill_byte" flags, which can be used to overwrite free()'d memory. We also match the behavior of MallocScribble and MallocPreScribble env vars on macOS (see https://developer.apple.com/library/content/documentation/Performance/Conceptual/ManagingMemory/Articles/MallocDebug.html), which is a helpful tool to detect use-after-free bugs that happen in non-instrumented code.

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

llvm-svn: 299085

7 years agoavoid a subshell.
Rafael Espindola [Thu, 30 Mar 2017 15:02:24 +0000 (15:02 +0000)]
avoid a subshell.

Instead of using grep -v we can just expand the globs a bit.

llvm-svn: 299084

7 years agoSpelling mistakes in comments. NFCI. (PR27635)
Simon Pilgrim [Thu, 30 Mar 2017 14:13:19 +0000 (14:13 +0000)]
Spelling mistakes in comments. NFCI. (PR27635)

llvm-svn: 299083

7 years agoEnable leak detection on linux-i686 by default
Francis Ricci [Thu, 30 Mar 2017 14:05:46 +0000 (14:05 +0000)]
Enable leak detection on linux-i686 by default

Summary:
This is already assumed by the test suite, and by
asan_flags.cc.

Reviewers: m.ostapenko, vitalybuka, kubamracek, kcc

Subscribers: llvm-commits

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

llvm-svn: 299082

7 years agoUse FileCheck instead of [.
Rafael Espindola [Thu, 30 Mar 2017 14:02:08 +0000 (14:02 +0000)]
Use FileCheck instead of [.

llvm-svn: 299081

7 years ago[ARC][ObjC++] Use ObjC semantic rules for comparisons between a pointer and
Alex Lorenz [Thu, 30 Mar 2017 13:48:33 +0000 (13:48 +0000)]
[ARC][ObjC++] Use ObjC semantic rules for comparisons between a pointer and
an ObjC object pointer

When ARC is enabled in Objective-C++, comparisons between a pointer and
Objective-C object pointer typically result in errors like this:
"invalid operands to a binary expression". This error message can be quite
confusing as it doesn't provide a solution to the problem, unlike the non-C++
diagnostic: "implicit conversion of Objective-C pointer type 'id' to C pointer
type 'void *' requires a bridged cast" (it also provides fix-its). This commit
forces comparisons between pointers and Objective-C object pointers in ARC to
use the Objective-C semantic rules to ensure that a better diagnostic is
reported.

rdar://31103857

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

llvm-svn: 299080

7 years agoMove NumRegParameters Module Flag. NFCI.
Nirav Dave [Thu, 30 Mar 2017 13:41:44 +0000 (13:41 +0000)]
Move NumRegParameters Module Flag. NFCI.

llvm-svn: 299079

7 years ago[Sema][ObjC] Avoid the "type of property does not match type of accessor"
Alex Lorenz [Thu, 30 Mar 2017 13:33:51 +0000 (13:33 +0000)]
[Sema][ObjC] Avoid the "type of property does not match type of accessor"
warning for methods that resemble the setters of readonly properties

rdar://30415679

llvm-svn: 299078

7 years agoAdd LIT_USE_INTERNAL_SHELL to compiler-rt tests.
Rafael Espindola [Thu, 30 Mar 2017 13:33:22 +0000 (13:33 +0000)]
Add LIT_USE_INTERNAL_SHELL to compiler-rt tests.

I am working on improving our internal bot infrastructure. One thing
that is unique to the ps4 is that we want to run the posix tests, but
have to execute them on windows.

We currently have a local hack to use a shell on windows, but it is
pretty much impossible to get all all the tools to play nice with all
the heuristics for what is a path and what is a command line option.

This adds support LIT_USE_INTERNAL_SHELL and I will then try to fix
the tests that fail with it but adding the missing features.

llvm-svn: 299077

7 years agoUse count instead of grep -c.
Rafael Espindola [Thu, 30 Mar 2017 13:22:30 +0000 (13:22 +0000)]
Use count instead of grep -c.

Using count is more common in llvm and avoids a subshell.

llvm-svn: 299076

7 years agoTest commit.
Andrew Ng [Thu, 30 Mar 2017 13:17:25 +0000 (13:17 +0000)]
Test commit.

Correct assertion messages in MachineOperand for some of the setters.

llvm-svn: 299075

7 years agoSpelling mistakes in comments. NFCI.
Simon Pilgrim [Thu, 30 Mar 2017 13:10:33 +0000 (13:10 +0000)]
Spelling mistakes in comments. NFCI.

Based on corrections mentioned in patch for clang for PR27635

llvm-svn: 299074

7 years agoAdd `replace` interface with range in AtomicChange.
Haojian Wu [Thu, 30 Mar 2017 13:07:38 +0000 (13:07 +0000)]
Add `replace` interface with range in AtomicChange.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: alexshap, klimek, cfe-commits

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

llvm-svn: 299073

7 years agoSpelling mistakes in comments. NFCI.
Simon Pilgrim [Thu, 30 Mar 2017 12:59:53 +0000 (12:59 +0000)]
Spelling mistakes in comments. NFCI.

Based on corrections mentioned in patch for clang for PR27635

llvm-svn: 299072

7 years ago[clang-tidy] fix docs in hicpp checks
Jonathan Coe [Thu, 30 Mar 2017 12:59:41 +0000 (12:59 +0000)]
[clang-tidy] fix docs in hicpp checks

Fix for sphinx-doc warnings in r299068.

llvm-svn: 299071

7 years ago[clang-tidy] fix for linker errors in hicpp checks
Jonathan Coe [Thu, 30 Mar 2017 12:31:02 +0000 (12:31 +0000)]
[clang-tidy] fix for linker errors in hicpp checks

Speculative fix for linker errors in r299068.

llvm-svn: 299070

7 years agoSpelling mistakes in comments. NFCI.
Simon Pilgrim [Thu, 30 Mar 2017 12:30:15 +0000 (12:30 +0000)]
Spelling mistakes in comments. NFCI.

llvm-svn: 299069

7 years ago[clang-tidy] add aliases for hicpp module
Jonathan Coe [Thu, 30 Mar 2017 11:57:54 +0000 (11:57 +0000)]
[clang-tidy] add aliases for hicpp module

Summary: Add some hicpp checks that can be implmented as alises for existing clang-tidy checks:
hicpp-explicit-conversions
hicpp-function-size
hicpp-named-parameter
hicpp-invalid-access-moved
hicpp-member-init
hicpp-new-delete-operators
hicpp-noexcept-move
hicpp-special-member-functions
hicpp-undelegated-constructor
hicpp-use-equals-default
hicpp-use-equals-delete
hicpp-use-override

Reviewers: dberlin, jbcoe, aaron.ballman, alexfh

Reviewed By: aaron.ballman

Subscribers: JDevlieghere

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

Patch By: Jonas Toth

llvm-svn: 299068

7 years agoRevert "Make naming in Host.h in line with coding standards."
Kristof Beyls [Thu, 30 Mar 2017 11:06:25 +0000 (11:06 +0000)]
Revert "Make naming in Host.h in line with coding standards."

This reverts r299062, which caused build failures on Windows.
It also reverts the attempts to fix the windows builds in r299064 and r299065.
The introduction of namespace llvm::sys::detail makes MSVC, and seemingly also
mingw, complain about ambiguity with the existing namespace llvm::detail.
E.g.:
C:\b\slave\sanitizer-windows\llvm\include\llvm/Support/MathExtras.h(184): error C2872: 'detail': ambiguous symbol
C:\b\slave\sanitizer-windows\llvm\include\llvm/Support/PointerLikeTypeTraits.h(31): note: could be 'llvm::detail'
C:\b\slave\sanitizer-windows\llvm\include\llvm/Support/Host.h(80): note: or       'llvm::sys::detail'

In r299064 and r299065 I tried to fix these ambiguities, based on the errors
reported in the log files. It seems however that the build stops early when
this kind of error is encountered, and many build-then-fix-iterations on
Windows may be needed to fix this. Therefore reverting r299062 for now to
get the build working again on Windows.

llvm-svn: 299066

7 years agoAnother attempt fix the Windows builds
Kristof Beyls [Thu, 30 Mar 2017 10:47:41 +0000 (10:47 +0000)]
Another attempt fix the Windows builds

By changing more detail::... to llvm::detail::...

llvm-svn: 299065

7 years agoAttempt to fix the Windows builds by using llvm::detail::... instead of detail::...
Kristof Beyls [Thu, 30 Mar 2017 10:14:40 +0000 (10:14 +0000)]
Attempt to fix the Windows builds by using llvm::detail::... instead of detail::...

llvm-svn: 299064

7 years ago[globalisel][tablegen] Change Expected<bool> to Error and rename functions.
Daniel Sanders [Thu, 30 Mar 2017 09:36:33 +0000 (09:36 +0000)]
[globalisel][tablegen] Change Expected<bool> to Error and rename functions.

Functions that still return Expected<X> are now called createAndImport*()

Changing the return type was requested in the review comments for r299001

llvm-svn: 299063

7 years agoMake naming in Host.h in line with coding standards.
Kristof Beyls [Thu, 30 Mar 2017 09:31:59 +0000 (09:31 +0000)]
Make naming in Host.h in line with coding standards.

Based on post-commit review comments by Chandler Carruth on
https://reviews.llvm.org/D31236. Thanks!

llvm-svn: 299062

7 years ago[sanitizer] Move fread and fwrite interceptors to sanitizer_common
Maxim Ostapenko [Thu, 30 Mar 2017 07:25:33 +0000 (07:25 +0000)]
[sanitizer] Move fread and fwrite interceptors to sanitizer_common

{M, T, E}San have fread and fwrite interceptors, let's move them to sanitizer_common to enable ASan checks as well.

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

llvm-svn: 299061