platform/upstream/llvm.git
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

7 years agoRefactor getHostCPUName to allow testing on non-native hardware.
Kristof Beyls [Thu, 30 Mar 2017 07:24:49 +0000 (07:24 +0000)]
Refactor getHostCPUName to allow testing on non-native hardware.

This refactors getHostCPUName so that for the architectures that get the
host cpu info on linux from /proc/cpuinfo, the /proc/cpuinfo parsing
logic is present in the build, even if it wasn't built on a linux system
for that architecture.

Since the code is present in the build, we can then test that code also
on other systems, i.e. we don't need to have buildbots setup for all
architectures on linux to be able to test this. Instead, developers will
test this as part of the regression test run.

As an example, a few unit tests are added to test getHostCPUName for ARM
running linux. A unit test is preferred over a lit-based test, since the
expectation is that in the future, the functionality here will grow over
what can be tested with "llc -mcpu=native".

This is a preparation step to enable implementing the range of
improvements discussed on PR30516, such as adding AArch64 support,
support for big.LITTLE systems, reducing code duplication.

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

llvm-svn: 299060

7 years ago[APInt] Remove references to integerPartWidth outside of APFloat implentation.
Craig Topper [Thu, 30 Mar 2017 05:49:03 +0000 (05:49 +0000)]
[APInt] Remove references to integerPartWidth outside of APFloat implentation.

Turns out integerPartWidth only explicitly defines the width of the tc functions in the APInt class. Functions that aren't used by APInt implementation itself. Many places in the code base already assume APInt is made up of 64-bit pieces. Explicitly assuming 64-bit here doesn't make that situation much worse. A full audit would need to be done if it ever changes.

llvm-svn: 299059

7 years ago[APInt] Remove references to integerPartWidth and integerPart outside of APFloat...
Craig Topper [Thu, 30 Mar 2017 05:48:58 +0000 (05:48 +0000)]
[APInt] Remove references to integerPartWidth and integerPart outside of APFloat implentation.

Turns out integerPartWidth only explicitly defines the width of the tc functions in the APInt class. Functions that aren't used by APInt implementation itself. Many places in the code base already assume APInt is made up of 64-bit pieces. Explicitly assuming 64-bit here doesn't make that situation much worse. A full audit would need to be done if it ever changes.

llvm-svn: 299058

7 years agolibc++ testing: fix invalid python syntax
Mehdi Amini [Thu, 30 Mar 2017 05:21:33 +0000 (05:21 +0000)]
libc++ testing: fix invalid python syntax

llvm-svn: 299057

7 years agolibc++ testing: fix assertion around `use_system_cxx_lib`
Mehdi Amini [Thu, 30 Mar 2017 05:07:18 +0000 (05:07 +0000)]
libc++ testing: fix assertion around `use_system_cxx_lib`

Actually fix (hopefully) the assertions about `use_system_cxx_lib`,
the previous attempt failed because I misread the error.

llvm-svn: 299056

7 years agolibc++ config testing: `use_system_cxx_lib` can be a bool
Mehdi Amini [Thu, 30 Mar 2017 04:51:19 +0000 (04:51 +0000)]
libc++ config testing: `use_system_cxx_lib` can be a bool

Fix the libc++ Green Dragon bot.

llvm-svn: 299055

7 years agoReexport operator new / delete from libc++abi
Mehdi Amini [Thu, 30 Mar 2017 04:47:19 +0000 (04:47 +0000)]
Reexport operator new / delete from libc++abi

Both libc++ and libc++abi export a weak definition of operator
new/delete. On Darwin, this can often cause dirty __DATA in the
shared cache when having to switch from one to the other. Instead,
libc++ should reexport libc++abi's implementation of these symbols.

Patch by: Ted Kremenek <kremenek@apple.com>

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

llvm-svn: 299054

7 years agolibc++ testing: allow to provide a path for `use_system_cxx_lib`
Mehdi Amini [Thu, 30 Mar 2017 04:45:33 +0000 (04:45 +0000)]
libc++ testing: allow to provide a path for `use_system_cxx_lib`

As we're trying to setup testing / bots for all shipping version of libc++
on macOS/iOS, we'll need to be able to pass a path to where to find the
dylib for each previous version of the OS.

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

llvm-svn: 299053

7 years agoDo not pass an explicit reexported symbol list when building libc++ dylib if also...
Mehdi Amini [Thu, 30 Mar 2017 04:40:56 +0000 (04:40 +0000)]
Do not pass an explicit reexported symbol list when building libc++ dylib if also defining new/delete

llvm-svn: 299052

7 years ago[libFuzzer] remove a stale flag from tests, run value-profile-strncmp.test longer...
Kostya Serebryany [Thu, 30 Mar 2017 04:22:20 +0000 (04:22 +0000)]
[libFuzzer] remove a stale flag from tests, run value-profile-strncmp.test longer (hopefully, will fix the OSX bot)

llvm-svn: 299051

7 years ago[XRay][compiler-rt] Spell REQUIRES properly for x86_64-linux
Dean Michael Berris [Thu, 30 Mar 2017 03:50:56 +0000 (03:50 +0000)]
[XRay][compiler-rt] Spell REQUIRES properly for x86_64-linux

Until llvm-xray starts running/supporting binaries that are not ELF64 we
only run the FDR tests on x86_64-linux. Previous changes caused the
tests to not actually run on x86_64.

Follow-up on D31454.

llvm-svn: 299050

7 years ago[XRay][compiler-rt] Only run tests using llvm-xray in x86_64 for now
Dean Michael Berris [Thu, 30 Mar 2017 03:18:48 +0000 (03:18 +0000)]
[XRay][compiler-rt] Only run tests using llvm-xray in x86_64 for now

Followup on D31454.

llvm-svn: 299049

7 years ago[XRay][compiler-rt] XFAIL the FDR mode tests on aarch64-42vma
Dean Michael Berris [Thu, 30 Mar 2017 02:48:50 +0000 (02:48 +0000)]
[XRay][compiler-rt] XFAIL the FDR mode tests on aarch64-42vma

Followup on D31454.

llvm-svn: 299048

7 years ago[DAGCombine] A shuffle of a splat is always the splat itself
Zvi Rackover [Thu, 30 Mar 2017 01:42:57 +0000 (01:42 +0000)]
[DAGCombine]  A shuffle of a splat is always the splat itself

Summary:
Add a simplification:
shuffle (splat-shuffle), undef, M --> splat-shuffle

Fixes pr32449

Patch by Sanjay Patel

Reviewers: eli.friedman, RKSimon, spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 299047

7 years ago[libFuzzer] best effort support for -fsanitize-coverage=trace-pc instrumentation...
Kostya Serebryany [Thu, 30 Mar 2017 01:27:20 +0000 (01:27 +0000)]
[libFuzzer] best effort support for -fsanitize-coverage=trace-pc instrumentation. It is less efficient and precise than -fsanitize-coverage=trace-pc-guard, but still works

llvm-svn: 299046

7 years agoUse 'unsigned' for enum bitfields
Reid Kleckner [Thu, 30 Mar 2017 01:12:08 +0000 (01:12 +0000)]
Use 'unsigned' for enum bitfields

Fixes this clang warning on Windows:

warning: implicit truncation from 'clang::LangOptions::FPContractModeKind' to bit-field changes value from 2 to -2 [-Wbitfield-constant-conversion]
    fp_contract = LangOptions::FPC_Fast;
                ^ ~~~~~~~~~~~~~~~~~~~~~
llvm-svn: 299045

7 years ago[XRay][clang] Use llvm::to_string instead of std::string
Dean Michael Berris [Thu, 30 Mar 2017 01:05:09 +0000 (01:05 +0000)]
[XRay][clang] Use llvm::to_string instead of std::string

This should unbreak some bots.

Follow-up on D30388.

llvm-svn: 299044

7 years ago[asan] Support line numbers in StackVarDescr
Kuba Mracek [Thu, 30 Mar 2017 00:41:09 +0000 (00:41 +0000)]
[asan] Support line numbers in StackVarDescr

When -fsanitize-address-use-after-scope is used, the instrumentation produces line numbers in stack frame descriptions. This patch make sure the ASan runtime supports this format (ParseFrameDescription needs to be able to parse "varname:line") and prepares lit tests to allow line numbers in ASan report output.

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

llvm-svn: 299043

7 years ago[XRay][compiler-rt] Use llvm-xray in FDR mode tests
Dean Michael Berris [Thu, 30 Mar 2017 00:35:58 +0000 (00:35 +0000)]
[XRay][compiler-rt] Use llvm-xray in FDR mode tests

Summary:
This change allows us to do an end-to-end test of the FDR mode
implementation that uses the llvm-xray tooling to verify that what we
are both writing and reading the data in a consistent manner.

Reviewers: kpw, pelikan

Subscribers: llvm-commits

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

llvm-svn: 299042

7 years ago[XRay] Add -fxray-{always,never}-instrument= flags to clang
Dean Michael Berris [Thu, 30 Mar 2017 00:29:36 +0000 (00:29 +0000)]
[XRay] Add -fxray-{always,never}-instrument= flags to clang

Summary:
The -fxray-always-instrument= and -fxray-never-instrument= flags take
filenames that are used to imbue the XRay instrumentation attributes
using a whitelist mechanism (similar to the sanitizer special cases
list). We use the same syntax and semantics as the sanitizer blacklists
files in the implementation.

As implemented, we respect the attributes that are already defined in
the source file (i.e. those that have the
[[clang::xray_{always,never}_instrument]] attributes) before applying
the always/never instrument lists.

Reviewers: rsmith, chandlerc

Subscribers: jfb, mgorny, cfe-commits

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

llvm-svn: 299041

7 years agoMask out EXC_SYSCALL exceptions as well.
Jason Molenda [Thu, 30 Mar 2017 00:23:46 +0000 (00:23 +0000)]
Mask out EXC_SYSCALL exceptions as well.
<rdar://problem/31335814>

llvm-svn: 299040

7 years agoIf the DIUnit has flags passed on it then have DW_AT_producer be a combination of...
Eric Christopher [Wed, 29 Mar 2017 23:34:27 +0000 (23:34 +0000)]
If the DIUnit has flags passed on it then have DW_AT_producer be a combination of DICompileUnit::Producer and Flags.
The darwin behavior is unchanged and will continue to use DW_AT_APPLE_flags.

Patch by Zhizhou Yang

llvm-svn: 299038

7 years agoAdd the -grecord-gcc-switches option and pass the flags down on the compile unit.
Eric Christopher [Wed, 29 Mar 2017 23:34:20 +0000 (23:34 +0000)]
Add the -grecord-gcc-switches option and pass the flags down on the compile unit.

Patch by Zhizhou Yang

llvm-svn: 299037

7 years ago[sanitizers] Fix get_groups interceptor in sanitizer (https://reviews.llvm.org/D31332...
Kostya Serebryany [Wed, 29 Mar 2017 22:59:28 +0000 (22:59 +0000)]
[sanitizers] Fix get_groups interceptor in sanitizer (https://reviews.llvm.org/D31332, patch by Martin Liška)

llvm-svn: 299036

7 years ago[codeview] Fix buggy BeginIndexMapSize assertion
Reid Kleckner [Wed, 29 Mar 2017 22:51:22 +0000 (22:51 +0000)]
[codeview] Fix buggy BeginIndexMapSize assertion

This assert is just trying to test that processing each record adds
exactly one entry to the index map. The assert logic was wrong when the
first record in the type stream was a field list.

I've simplified the code by moving the LF_FIELDLIST-specific logic into
the callback for that record type.

llvm-svn: 299035

7 years ago[CodeGen] clean up and add tests for scalar and-of-setcc; NFC
Sanjay Patel [Wed, 29 Mar 2017 21:58:52 +0000 (21:58 +0000)]
[CodeGen] clean up and add tests for scalar and-of-setcc; NFC

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

llvm-svn: 299034

7 years agoUse FPContractModeKind universally
Adam Nemet [Wed, 29 Mar 2017 21:54:24 +0000 (21:54 +0000)]
Use FPContractModeKind universally

FPContractModeKind is the codegen option flag which is already ternary (off,
on, fast).  This makes it universally the type for the contractable info
across the front-end:

* In FPOptions (i.e. in the Sema + in the expression nodes).
* In LangOpts::DefaultFPContractMode which is the option that initializes
FPOptions in the Sema.

Another way to look at this change is that before fp-contractable on/off were
the only states handled to the front-end:
 * For "on", FMA folding was performed by  the front-end
 * For "fast", we simply forwarded the flag to TargetOptions to handle it in
 LLVM

Now off/on/fast are all exposed because for fast we will generate
fast-math-flags during CodeGen.

This is toward moving fp-contraction=fast from an LLVM TargetOption to a
FastMathFlag in order to fix PR25721.

---
This is a recommit of r299027 with an adjustment to the test
CodeGenCUDA/fp-contract.cu.  The test assumed that even
though -ffp-contract=on is passed FE-based folding of FMA won't happen.

This is obviously wrong since the user is asking for this explicitly with the
option.  CUDA is different that -ffp-contract=fast is on by default.

The test used to "work" because contract=fast and contract=on were maintained
separately and we didn't fold in the FE because contract=fast was on due to
the target-default.  This patch consolidates the contract=on/fast/off state
into a ternary state hence the change in behavior.
---

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

llvm-svn: 299033

7 years agoMove current thread data out of lsan_common on linux
Francis Ricci [Wed, 29 Mar 2017 21:49:47 +0000 (21:49 +0000)]
Move current thread data out of lsan_common on linux

Summary:
Now that we have a platform-specific non-common lsan file, use
it to store non-common lsan data.

Reviewers: kubamracek

Subscribers: llvm-commits

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

llvm-svn: 299032

7 years agoRemove failing check from platform specific darwin lsan initializer
Francis Ricci [Wed, 29 Mar 2017 21:49:13 +0000 (21:49 +0000)]
Remove failing check from platform specific darwin lsan initializer

Summary:
We currently don't have any platform specific darwin
lsan modules, don't force failure if they don't exist.

Reviewers: kubamracek

Subscribers: llvm-commits

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

llvm-svn: 299031

7 years ago[X86IselLowering] Remove extraneous semicolon. NFCI.
Davide Italiano [Wed, 29 Mar 2017 21:34:58 +0000 (21:34 +0000)]
[X86IselLowering] Remove extraneous semicolon. NFCI.

Unbreaks the build with GCC -Werror.

llvm-svn: 299030

7 years agoRevert "Use FPContractModeKind universally"
Adam Nemet [Wed, 29 Mar 2017 21:24:19 +0000 (21:24 +0000)]
Revert "Use FPContractModeKind universally"

This reverts commit r299027.

It's causing a test failure in clang's CodeGenCUDE/fp-contract.cu

llvm-svn: 299029

7 years agoCentralize libc++ test skipping logic
Pavel Labath [Wed, 29 Mar 2017 21:01:14 +0000 (21:01 +0000)]
Centralize libc++ test skipping logic

Summary:
This aims to replace the different decorators we've had on each libc++
test with a single solution. Each libc++ will be assigned to the
"libc++" category and a single central piece of code will decide whether
we are actually able to run libc++ test in the given configuration by
enabling or disabling the category (while giving the user the
opportunity to override this).

I started this effort because I wanted to get libc++ tests running on
android, and none of the existing decorators worked for this use case:
 - skipIfGcc - incorrect, we can build libc++ executables on android
 with gcc (in fact, after this, we can now do it on linux as well)
 - lldbutil.skip_if_library_missing - this checks whether libc++.so is
 loaded in the proces, which fails in case of a statically linked
 libc++ (this makes copying executables to the remote target easier to
 manage).

To make this work I needed to split out the pseudo_barrier code from the
force-included file, as libc++'s atomic does not play well with gcc on
linux, and this made every test fail, even though we need the code only
in the threading tests.

So far, I am only annotating one of the tests with this category. If
this does not break anything, I'll proceed to update the rest.

Reviewers: jingham, zturner, EricWF

Subscribers: srhines, lldb-commits

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

llvm-svn: 299028

7 years agoUse FPContractModeKind universally
Adam Nemet [Wed, 29 Mar 2017 20:39:49 +0000 (20:39 +0000)]
Use FPContractModeKind universally

FPContractModeKind is the codegen option flag which is already ternary (off,
on, fast).  This makes it universally the type for the contractable info
across the front-end:

* In FPOptions (i.e. in the Sema + in the expression nodes).
* In LangOpts::DefaultFPContractMode which is the option that initializes
FPOptions in the Sema.

Another way to look at this change is that before fp-contractable on/off were
the only states handled to the front-end:
 * For "on", FMA folding was performed by  the front-end
 * For "fast", we simply forwarded the flag to TargetOptions to handle it in
 LLVM

Now off/on/fast are all exposed because for fast we will generate
fast-math-flags during CodeGen.

This is toward moving fp-contraction=fast from an LLVM TargetOption to a
FastMathFlag in order to fix PR25721.

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

llvm-svn: 299027

7 years agorevert test commit r299024
Huihui Zhang [Wed, 29 Mar 2017 20:23:56 +0000 (20:23 +0000)]
revert test commit r299024

llvm-svn: 299026

7 years agoRemove parameter names from template instantiations to make them compact. NFC.
Rui Ueyama [Wed, 29 Mar 2017 20:15:29 +0000 (20:15 +0000)]
Remove parameter names from template instantiations to make them compact. NFC.

llvm-svn: 299025

7 years agotest commit, add blank line
Huihui Zhang [Wed, 29 Mar 2017 20:10:45 +0000 (20:10 +0000)]
test commit, add blank line

llvm-svn: 299024

7 years agoAdd NetBSD path for Debugging Information in Separate Files
Kamil Rytarowski [Wed, 29 Mar 2017 19:52:24 +0000 (19:52 +0000)]
Add NetBSD path for Debugging Information in Separate Files

Summary:
NetBSD stores debug information files in the `/usr/libdata/debug` path.

This change fixes debugging distribution executables, e.g. `look`(1):

```
$ lldb /usr/bin/look
(lldb) target create "/usr/bin/look"
Current executable set to '/usr/bin/look' (x86_64).
(lldb) b main
Breakpoint 1: where = look`main + 22 at look.c:107, address = 0x0000000000000da6
(lldb) r
Process 23473 launched: '/usr/bin/look' (x86_64)
Process 23473 stopped
* thread #1, stop reason = breakpoint 1.1
    frame #0: 0x0000000186600da6 look`main(argc=1, argv=0x00007f7fffc7c488) at look.c:107
   104
   105          string = NULL;
   106          file = _PATH_WORDS;
-> 107          termchar = '\0';
   108          while ((ch = getopt(argc, argv, "dft:")) != -1)
   109                  switch(ch) {
   110                  case 'd':
(lldb)
```

There is no `/usr/lib/debug` path on NeBSD, so remove it from search.

Sponsored by <The NetBSD Foundation>

Reviewers: jingham, emaste, kettenis, labath, joerg

Reviewed By: labath

Subscribers: aprantl, #lldb

Tags: #lldb

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

llvm-svn: 299023

7 years ago[DAGCombiner] Remove else after return. NFCI.
Davide Italiano [Wed, 29 Mar 2017 19:39:46 +0000 (19:39 +0000)]
[DAGCombiner] Remove else after return. NFCI.

llvm-svn: 299022