platform/upstream/llvm.git
8 years agoUpdate LWG 2767 and add test case
Eric Fiselier [Sun, 16 Oct 2016 03:45:06 +0000 (03:45 +0000)]
Update LWG 2767 and add test case

llvm-svn: 284324

8 years agoUpdate status for std::optional LWG issues and fix an optional SFINAE bug
Eric Fiselier [Sun, 16 Oct 2016 03:21:35 +0000 (03:21 +0000)]
Update status for std::optional LWG issues and fix an optional SFINAE bug

llvm-svn: 284323

8 years agoUpdate issue status for LWG 2744
Eric Fiselier [Sun, 16 Oct 2016 02:51:50 +0000 (02:51 +0000)]
Update issue status for LWG 2744

llvm-svn: 284322

8 years agoUpdate issue status for LWG 2768 and 2769
Eric Fiselier [Sun, 16 Oct 2016 01:43:43 +0000 (01:43 +0000)]
Update issue status for LWG 2768 and 2769

llvm-svn: 284321

8 years ago[ArmFastISel] Kill dead code. NFCI.
Davide Italiano [Sun, 16 Oct 2016 01:09:39 +0000 (01:09 +0000)]
[ArmFastISel] Kill dead code. NFCI.

llvm-svn: 284320

8 years agoUpdate notes for LWG 2678
Eric Fiselier [Sun, 16 Oct 2016 00:49:33 +0000 (00:49 +0000)]
Update notes for LWG 2678

llvm-svn: 284319

8 years agoImplement LWG 2712 and update other issues status
Eric Fiselier [Sun, 16 Oct 2016 00:47:59 +0000 (00:47 +0000)]
Implement LWG 2712 and update other issues status

llvm-svn: 284318

8 years agoRevert "[analyzer] Re-apply r283093 "Add extra notes to ObjCDeallocChecker""
Devin Coughlin [Sun, 16 Oct 2016 00:30:08 +0000 (00:30 +0000)]
Revert "[analyzer] Re-apply r283093 "Add extra notes to ObjCDeallocChecker""

Revert:
r283662: [analyzer] Re-apply r283093 "Add extra notes to ObjCDeallocChecker"
r283660: [analyzer] Fix build error after r283660 - remove constexpr strings.

It was causing an internal build bot to fail. It looks like in some cases
adding an extra note can cause scan-build plist output to drop a diagnostic
altogether.

llvm-svn: 284317

8 years agoImplement LWG 2681 and 2682
Eric Fiselier [Sun, 16 Oct 2016 00:29:22 +0000 (00:29 +0000)]
Implement LWG 2681 and 2682

llvm-svn: 284316

8 years agoMark LWG 2680 as done
Eric Fiselier [Sat, 15 Oct 2016 23:12:30 +0000 (23:12 +0000)]
Mark LWG 2680 as done

llvm-svn: 284315

8 years agoImplement LWG 2672.
Eric Fiselier [Sat, 15 Oct 2016 23:05:04 +0000 (23:05 +0000)]
Implement LWG 2672.

llvm-svn: 284314

8 years agoImplement modified LWG 2665
Eric Fiselier [Sat, 15 Oct 2016 22:37:42 +0000 (22:37 +0000)]
Implement modified LWG 2665

llvm-svn: 284313

8 years ago[MachineMemOperand] Move synchronization scope and atomic orderings from SDNode to...
Konstantin Zhuravlyov [Sat, 15 Oct 2016 22:01:18 +0000 (22:01 +0000)]
[MachineMemOperand] Move synchronization scope and atomic orderings from SDNode to MachineMemOperand, and remove redundant getAtomic* member functions from SelectionDAG.

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

llvm-svn: 284312

8 years ago[GVN/PRE] Hoist global values outside of loops.
Davide Italiano [Sat, 15 Oct 2016 21:35:23 +0000 (21:35 +0000)]
[GVN/PRE] Hoist global values outside of loops.

In theory this could be generalized to move anything where
we prove the operands are available, but that would require
rewriting PRE. As NewGVN will hopefully come soon, and we're
trying to rewrite PRE in terms of NewGVN+MemorySSA, it's probably
not worth spending too much time on it. Fix provided by
Daniel Berlin!

llvm-svn: 284311

8 years agoImplement LWG2664 and update its status
Eric Fiselier [Sat, 15 Oct 2016 21:29:44 +0000 (21:29 +0000)]
Implement LWG2664 and update its status

llvm-svn: 284310

8 years agoUpdate the status of issues
Eric Fiselier [Sat, 15 Oct 2016 20:58:51 +0000 (20:58 +0000)]
Update the status of issues

llvm-svn: 284309

8 years ago[X86][SSE] Added some basic examples of knownbits failing for vector types
Simon Pilgrim [Sat, 15 Oct 2016 19:29:26 +0000 (19:29 +0000)]
[X86][SSE] Added some basic examples of knownbits failing for vector types

computeKnownBits only returns the common bits of each vector element instead of only the elements that are actually used

llvm-svn: 284308

8 years agoTest commit. (NFC)
Li Huang [Sat, 15 Oct 2016 19:00:04 +0000 (19:00 +0000)]
Test commit. (NFC)

llvm-svn: 284307

8 years ago[X86] Regenerate known bits test
Simon Pilgrim [Sat, 15 Oct 2016 18:56:38 +0000 (18:56 +0000)]
[X86] Regenerate known bits test

llvm-svn: 284306

8 years ago[AVX-512] Add shuffle comments for vbroadcast instructions.
Craig Topper [Sat, 15 Oct 2016 16:26:07 +0000 (16:26 +0000)]
[AVX-512] Add shuffle comments for vbroadcast instructions.

llvm-svn: 284305

8 years ago[AVX-512] Rename VPBROADCASTI32X2 and VPBROADCASTF32X2 instruction classes to match...
Craig Topper [Sat, 15 Oct 2016 16:26:02 +0000 (16:26 +0000)]
[AVX-512] Rename VPBROADCASTI32X2 and VPBROADCASTF32X2 instruction classes to match the mnemonic which does not include a 'P'.

llvm-svn: 284304

8 years ago[SimplifyCFG] Use the error checking provided by getPrevNode.
Benjamin Kramer [Sat, 15 Oct 2016 13:15:05 +0000 (13:15 +0000)]
[SimplifyCFG] Use the error checking provided by getPrevNode.

BasicBlock::size is O(insts), making this loop O(blocks*insts), which
can be really slow on generated code. getPrevNode already checks if
we're at the beginning of the block and returns nullptr if so, just use
that instead. No functionality change intended.

llvm-svn: 284303

8 years agocmake: avoid "zero-length gnu_printf format string" warning in gcc 6.1.1
Tobias Grosser [Sat, 15 Oct 2016 05:08:12 +0000 (05:08 +0000)]
cmake: avoid "zero-length gnu_printf format string" warning in gcc 6.1.1

Contributed-by: Andy Gibbs <andyg1001@hotmail.co.uk>
llvm-svn: 284302

8 years ago[libFuzzer] swap bytes in integers when handling CMP traces
Kostya Serebryany [Sat, 15 Oct 2016 04:00:07 +0000 (04:00 +0000)]
[libFuzzer] swap bytes in integers when handling CMP traces

llvm-svn: 284301

8 years agoDisable a silly GCC diagnostic for combining a scanf length specifier with the
Richard Smith [Sat, 15 Oct 2016 01:59:52 +0000 (01:59 +0000)]
Disable a silly GCC diagnostic for combining a scanf length specifier with the
'*' specifier. Apparently the GNU folks want to discourage self-documenting
code.

llvm-svn: 284300

8 years ago[libFuzzer] better algorithm for -minimize_crash
Kostya Serebryany [Sat, 15 Oct 2016 01:00:24 +0000 (01:00 +0000)]
[libFuzzer] better algorithm for -minimize_crash

llvm-svn: 284299

8 years agoAMDGPU/SI: Handle s_getreg hazard in GCNHazardRecognizer
Tom Stellard [Sat, 15 Oct 2016 00:58:14 +0000 (00:58 +0000)]
AMDGPU/SI: Handle s_getreg hazard in GCNHazardRecognizer

Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, llvm-commits, tony-tye

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

llvm-svn: 284298

8 years agoADT: Use LLVM_NODISCARD instead of LLVM_ATTRIBUTE_UNUSED_RESULT for APInt
Justin Bogner [Sat, 15 Oct 2016 00:22:06 +0000 (00:22 +0000)]
ADT: Use LLVM_NODISCARD instead of LLVM_ATTRIBUTE_UNUSED_RESULT for APInt

Instead of annotating (most of) the APInt API, we can just annotate
the type directly. This is less code and it will warn in more cases.

llvm-svn: 284297

8 years agoThis test is no longer failing for gmodules.
Jim Ingham [Sat, 15 Oct 2016 00:04:38 +0000 (00:04 +0000)]
This test is no longer failing for gmodules.

llvm-svn: 284296

8 years agoFix typo in comment
Vitaly Buka [Sat, 15 Oct 2016 00:02:20 +0000 (00:02 +0000)]
Fix typo in comment

llvm-svn: 284295

8 years agoDon't compile cxa_thread_atexit.cpp with -DLIBCXX_ENABLE_THREADS=OFF
Vitaly Buka [Fri, 14 Oct 2016 23:51:41 +0000 (23:51 +0000)]
Don't compile cxa_thread_atexit.cpp with -DLIBCXX_ENABLE_THREADS=OFF

Reviewers: rmaprath

Subscribers: beanz, mgorny

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

llvm-svn: 284294

8 years ago[Coverage] Support for C++17 if initializers
Vedant Kumar [Fri, 14 Oct 2016 23:38:16 +0000 (23:38 +0000)]
[Coverage] Support for C++17 if initializers

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

llvm-svn: 284293

8 years ago[Coverage] Support for C++17 switch initializers
Vedant Kumar [Fri, 14 Oct 2016 23:38:13 +0000 (23:38 +0000)]
[Coverage] Support for C++17 switch initializers

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

llvm-svn: 284292

8 years ago[clang-move] Use cl::list for the list of names
Alexander Shaposhnikov [Fri, 14 Oct 2016 23:16:25 +0000 (23:16 +0000)]
[clang-move] Use cl::list for the list of names

This diff replaces manual parsing of the comma-separated list of names with
cl::list and cl::CommaSeparated.
Test plan: make -j8 check-clang-tools

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

llvm-svn: 284291

8 years ago[NFC] Loop Versioning for LICM code clean up
Evgeny Astigeevich [Fri, 14 Oct 2016 23:00:36 +0000 (23:00 +0000)]
[NFC] Loop Versioning for LICM code clean up

- Removed unused class members.
- Made class internal data private.
- Made class scoped data function scoped where it's possible.
- Replace naked new/delete with unique_ptr.
- Made resources guaranteed to be freed.

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

llvm-svn: 284290

8 years agoPrevent new/delete replacement tests from being optimized away.
Eric Fiselier [Fri, 14 Oct 2016 22:47:08 +0000 (22:47 +0000)]
Prevent new/delete replacement tests from being optimized away.

llvm-svn: 284289

8 years agoSema: honour dllexport in itanium more faithfully
Saleem Abdulrasool [Fri, 14 Oct 2016 22:25:46 +0000 (22:25 +0000)]
Sema: honour dllexport in itanium more faithfully

Although the itanium environment uses the itanium layout for C++, treat the
dllexport semantics more similarly to the MSVC specification.  This preserves
the existing behaviour for the use of the itanium ABI on non-windows-itanium
environments.  Export the inline definitions too.

llvm-svn: 284288

8 years agoGlobalISel: rename legalizer components to match others.
Tim Northover [Fri, 14 Oct 2016 22:18:18 +0000 (22:18 +0000)]
GlobalISel: rename legalizer components to match others.

The previous names were both misleading (the MachineLegalizer actually
contained the info tables) and inconsistent with the selector & translator (in
having a "Machine") prefix. This should make everything sensible again.

The only functional change is the name of a couple of command-line options.

llvm-svn: 284287

8 years agoSupport: Add LLVM_NODISCARD with C++17's [[nodiscard]] semantics
Justin Bogner [Fri, 14 Oct 2016 22:04:17 +0000 (22:04 +0000)]
Support: Add LLVM_NODISCARD with C++17's [[nodiscard]] semantics

This is essentially a more powerful version of our current
LLVM_ATTRIBUTE_UNUSED_RESULT, in that it can also be applied to types
and generate warnings whenever an object of that type is returned by
value and the value is discarded.

I'll replace uses of LLVM_ATTRIBUTE_UNUSED_RESULT and remove that
macro in follow up commits.

llvm-svn: 284286

8 years agoAdd more swift calling convention tests
Arnold Schwaighofer [Fri, 14 Oct 2016 21:55:56 +0000 (21:55 +0000)]
Add more swift calling convention tests

llvm-svn: 284285

8 years agoReinstate r284008 reverted in r284081, with two fixes:
Richard Smith [Fri, 14 Oct 2016 21:41:24 +0000 (21:41 +0000)]
Reinstate r284008 reverted in r284081, with two fixes:

1) Merge and demote variable definitions when we find a redefinition in
MergeVarDecls, not only when we find one in AddInitializerToDecl (we only reach
the second case if it's the addition of the initializer itself that converts an
existing declaration into a definition).

2) When rebuilding a redeclaration chain for a variable, if we merge two
definitions together, mark the definitions as merged so the retained definition
is made visible whenever the demoted definition would have been.

Original commit message (from r283882):

[modules] PR28752: Do not instantiate variable declarations which are not visible.

Original patch by Vassil Vassilev! Changes listed above are mine.

llvm-svn: 284284

8 years agohardware_physical_concurrency() should return 1 when LLVM is built with LLVM_ENABLE_T...
Mehdi Amini [Fri, 14 Oct 2016 21:32:35 +0000 (21:32 +0000)]
hardware_physical_concurrency() should return 1 when LLVM is built with LLVM_ENABLE_THREADS=OFF

llvm-svn: 284283

8 years agoClarify XFAIL comments
Eric Fiselier [Fri, 14 Oct 2016 21:30:35 +0000 (21:30 +0000)]
Clarify XFAIL comments

llvm-svn: 284282

8 years agoPowerPC: specify full triple to avoid different Darwin asm syntax.
Tim Northover [Fri, 14 Oct 2016 21:25:29 +0000 (21:25 +0000)]
PowerPC: specify full triple to avoid different Darwin asm syntax.

llvm-svn: 284281

8 years ago[ARM] add tests for PR30660
Sanjay Patel [Fri, 14 Oct 2016 20:52:43 +0000 (20:52 +0000)]
[ARM] add tests for PR30660

llvm-svn: 284280

8 years ago[PowerPC] add tests for PR30661
Sanjay Patel [Fri, 14 Oct 2016 20:51:41 +0000 (20:51 +0000)]
[PowerPC] add tests for PR30661

llvm-svn: 284279

8 years agoDefine Contiki OS toolchain
David L Kreitzer [Fri, 14 Oct 2016 20:44:33 +0000 (20:44 +0000)]
Define Contiki OS toolchain

Patch by Michael LeMay

Differential revision: http://reviews.llvm.org/D19854

llvm-svn: 284278

8 years ago__builtin_fpclassify missing one int parameter
David Sheinkman [Fri, 14 Oct 2016 20:43:37 +0000 (20:43 +0000)]
__builtin_fpclassify missing one int parameter

Patch by Tania Albarghouthi.

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

llvm-svn: 284277

8 years ago[PPC] Shorter sequence to load 64bit constant with same hi/lo words
Guozhi Wei [Fri, 14 Oct 2016 20:41:50 +0000 (20:41 +0000)]
[PPC] Shorter sequence to load 64bit constant with same hi/lo words

This is a patch to implement pr30640.

When a 64bit constant has the same hi/lo words, we can use rldimi to copy the low word into high word of the same register.

This optimization caused failure of test case bperm.ll because of not optimal heuristic in function SelectAndParts64. It chooses AND or ROTATE to extract bit groups from a register, and OR them together. This optimization lowers the cost of loading 64bit constant mask used in AND method, and causes different code sequence. But actually ROTATE method is better in this test case. The reason is in ROTATE method the final OR operation can be avoided since rldimi can insert the rotated bits into target register directly. So this patch also enhances SelectAndParts64 to prefer ROTATE method when the two methods have same cost and there are multiple bit groups need to be ORed together.

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

llvm-svn: 284276

8 years ago[libFuzzer] remove subdir fuzzer-test-suite as it is now superseded with https:/...
Kostya Serebryany [Fri, 14 Oct 2016 20:26:40 +0000 (20:26 +0000)]
[libFuzzer] remove subdir fuzzer-test-suite as it is now superseded with https://github.com/google/fuzzer-test-suite

llvm-svn: 284275

8 years ago[libFuzzer] add -trace_cmp=1 (guiding mutations based on the observed CMP instruction...
Kostya Serebryany [Fri, 14 Oct 2016 20:20:33 +0000 (20:20 +0000)]
[libFuzzer] add -trace_cmp=1 (guiding mutations based on the observed CMP instructions). This is a reincarnation of the previously deleted -use_traces, but using a different approach for collecting traces. Still a toy, but at least it scales well. Also fix -merge in trace-pc-guard mode

llvm-svn: 284273

8 years agoImplement no_sanitize_address for global vars
Douglas Katzman [Fri, 14 Oct 2016 19:55:09 +0000 (19:55 +0000)]
Implement no_sanitize_address for global vars

llvm-svn: 284272

8 years ago[linux] When pre-reserving stack pages to work around broken address space
Richard Smith [Fri, 14 Oct 2016 19:51:36 +0000 (19:51 +0000)]
[linux] When pre-reserving stack pages to work around broken address space
layout for PIE binaries, ask the OS how much stack space is already in use to
avoid stack overflow if we are run with more than 512K of combined command line
arguments + environment variables.

llvm-svn: 284271

8 years agovim: add `norecurse` attribute
Saleem Abdulrasool [Fri, 14 Oct 2016 19:48:34 +0000 (19:48 +0000)]
vim: add `norecurse` attribute

Add missing attribute to the keyword set.

llvm-svn: 284270

8 years agovim: add `comdat` keyword
Saleem Abdulrasool [Fri, 14 Oct 2016 19:48:31 +0000 (19:48 +0000)]
vim: add `comdat` keyword

The attribute may be applied to a function.  Highlight it as a keyword.

llvm-svn: 284269

8 years ago[DAG] avoid creating illegal node when transforming negated shifted sign bit
Sanjay Patel [Fri, 14 Oct 2016 19:46:31 +0000 (19:46 +0000)]
[DAG] avoid creating illegal node when transforming negated shifted sign bit

Eli noted this potential bug in the post-commit thread for:
https://reviews.llvm.org/rL284239
...but I'm not sure how to trigger it, so there's no test case yet.

llvm-svn: 284268

8 years agoAMDGPU/SI: Use new SimplifyDemandedBits helper for multi-use operations
Tom Stellard [Fri, 14 Oct 2016 19:14:29 +0000 (19:14 +0000)]
AMDGPU/SI: Use new SimplifyDemandedBits helper for multi-use operations

Summary:
We are using this helper for our 24-bit arithmetic combines, so we are now able to eliminate multi-use operations that mask the high-bits of 24-bit inputs (e.g. and x, 0xffffff)

Reviewers: arsenm, nhaehnle

Subscribers: tony-tye, arsenm, kzhuravl, wdng, nhaehnle, llvm-commits, yaxunl

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

llvm-svn: 284267

8 years agoTargetLowering: Add SimplifyDemandedBits() helper to TargetLoweringOpt
Tom Stellard [Fri, 14 Oct 2016 19:14:26 +0000 (19:14 +0000)]
TargetLowering: Add SimplifyDemandedBits() helper to TargetLoweringOpt

Summary:
The main purpose of this new helper is to enable simplifying operations that
have multiple uses.  SimplifyDemandedBits does not handle multiple uses
currently, and this new function makes it possible to optimize:

and v1, v0, 0xffffff
mul24 v2, v1, v1      ; Multiply ignoring high 8-bits.

To:

mul24 v2, v0, v0

Where before this would not be optimized, because v1 has multiple uses.

Reviewers: bogner, arsenm

Subscribers: nhaehnle, wdng, llvm-commits

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

llvm-svn: 284266

8 years ago[Sema] Refactor context checking for availability diagnostics
Erik Pilkington [Fri, 14 Oct 2016 19:08:01 +0000 (19:08 +0000)]
[Sema] Refactor context checking for availability diagnostics

This commit combines a couple of redundant functions that do availability
attribute context checking into a more correct/simpler one.

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

llvm-svn: 284265

8 years agoThe real fix for post-r284255 failures
Krzysztof Parzyszek [Fri, 14 Oct 2016 19:06:25 +0000 (19:06 +0000)]
The real fix for post-r284255 failures

llvm-svn: 284264

8 years agoModule: emit initializers in submodules when importing the parent module.
Manman Ren [Fri, 14 Oct 2016 18:55:44 +0000 (18:55 +0000)]
Module: emit initializers in submodules when importing the parent module.

When importing the parent module, module initializers in submodules should
be emitted.

rdar://28740482

llvm-svn: 284263

8 years agoWorkaround to eliminate check-llvm failures after r284255
Krzysztof Parzyszek [Fri, 14 Oct 2016 18:36:42 +0000 (18:36 +0000)]
Workaround to eliminate check-llvm failures after r284255

llvm-svn: 284262

8 years agoAdd a pass to optimize patterns of vectorized interleaved memory accesses for
David L Kreitzer [Fri, 14 Oct 2016 18:20:41 +0000 (18:20 +0000)]
Add a pass to optimize patterns of vectorized interleaved memory accesses for
X86. The pass optimizes as a unit the entire wide load + shuffles pattern
produced by interleaved vectorization. This initial patch optimizes one pattern
(64-bit elements interleaved by a factor of 4). Future patches will generalize
to additional patterns.

Patch by Farhana Aleen

Differential revision: http://reviews.llvm.org/D24681

llvm-svn: 284260

8 years agoRevert r284256 due to test failure
Ed Maste [Fri, 14 Oct 2016 18:20:12 +0000 (18:20 +0000)]
Revert r284256 due to test failure

llvm-svn: 284259

8 years ago[sanitizers] -Wno-macro-redefined for libc++ build
Vitaly Buka [Fri, 14 Oct 2016 18:19:02 +0000 (18:19 +0000)]
[sanitizers] -Wno-macro-redefined for libc++ build

llvm-svn: 284258

8 years agoAMDGPU/SI: Don't allow unaligned scratch access
Tom Stellard [Fri, 14 Oct 2016 18:10:39 +0000 (18:10 +0000)]
AMDGPU/SI: Don't allow unaligned scratch access

Summary: The hardware doesn't support this.

Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, llvm-commits, tony-tye

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

llvm-svn: 284257

8 years agoLink static PIE programs against rcrt0.o on OpenBSD
Ed Maste [Fri, 14 Oct 2016 17:59:53 +0000 (17:59 +0000)]
Link static PIE programs against rcrt0.o on OpenBSD

Patch by Stefan Kempf.

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

llvm-svn: 284256

8 years ago[RDF] Switch RegisterRef to be a pair (Register, LaneMask)
Krzysztof Parzyszek [Fri, 14 Oct 2016 17:57:55 +0000 (17:57 +0000)]
[RDF] Switch RegisterRef to be a pair (Register, LaneMask)

Use PackedRegisterRef to store the register information in the graph nodes.

This commit also removes support for virtual registers. It has never been
tested or used. It will be possible to add it back if there is a need.

llvm-svn: 284255

8 years ago[safestack] Use non-thread-local unsafe stack pointer for Contiki OS
David L Kreitzer [Fri, 14 Oct 2016 17:56:00 +0000 (17:56 +0000)]
[safestack] Use non-thread-local unsafe stack pointer for Contiki OS

Patch by Michael LeMay

Differential revision: http://reviews.llvm.org/D19852

llvm-svn: 284254

8 years agoImplement __stosb intrinsic as a volatile memset
Albert Gutowski [Fri, 14 Oct 2016 17:33:05 +0000 (17:33 +0000)]
Implement __stosb intrinsic as a volatile memset

Summary: We need `__stosb` to be an intrinsic, because SecureZeroMemory function uses it without including intrin.h. Implementing it as a volatile memset is not consistent with MSDN specification, but it gives us target-independent IR while keeping the most important properties of `__stosb`.

Reviewers: rnk, hans, thakis, majnemer

Subscribers: cfe-commits

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

llvm-svn: 284253

8 years agoRevert "In preparation for removing getNameWithPrefix off of
Eric Christopher [Fri, 14 Oct 2016 17:28:23 +0000 (17:28 +0000)]
Revert "In preparation for removing getNameWithPrefix off of
TargetMachine," as it's causing sanitizer/memory issues until I
can track down this set.

This reverts commit r284203

llvm-svn: 284252

8 years ago[Coverage] Support loading multiple binaries into a CoverageMapping
Vedant Kumar [Fri, 14 Oct 2016 17:16:53 +0000 (17:16 +0000)]
[Coverage] Support loading multiple binaries into a CoverageMapping

Add support for loading multiple coverage readers into a single
CoverageMapping instance. This should make it easier to prepare a
unified coverage report for multiple binaries.

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

llvm-svn: 284251

8 years ago[CMake] Populate LLDB.framework's headers directory
Chris Bieneman [Fri, 14 Oct 2016 17:09:55 +0000 (17:09 +0000)]
[CMake] Populate LLDB.framework's headers directory

Summary:
This patch adds support for installing public headers in LLDB.framework, and symlinking the headers into the build directory.

While writing the patch I discovered a bug in CMake that prevents applying POST_BUILD steps to framework targets (https://gitlab.kitware.com/cmake/cmake/issues/16363).

I've implemented the support using POST_BUILD steps wrapped under a CMake version check with a TODO so that we can track the fix.

Reviewers: tfiala, zturner, spyffe

Subscribers: lldb-commits, mgorny

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

llvm-svn: 284250

8 years agoMove alignTo computation inside the if.
Rafael Espindola [Fri, 14 Oct 2016 17:01:39 +0000 (17:01 +0000)]
Move alignTo computation inside the if.

This is an improvement when compiling with llvm. llvm doesn't inline
the call to insert, so the align is always executed and shows up in
the profile.

With gcc the call to insert is inlined and the align computation moved
and done only if needed.

With this patch we explicitly only compute it if it is needed.

In the two tests with debug info, the speedup was

scylla
  master 3.008959365
  patch  2.932080942 1.02621974786x faster

firefox
  master 6.709823604
  patch  6.592387227 1.01781393795x faster

In all others the difference was in the noise.

llvm-svn: 284249

8 years ago[X86] Take advantage of the lzcnt instruction on btver2 architectures when ORing...
Pierre Gousseau [Fri, 14 Oct 2016 16:41:38 +0000 (16:41 +0000)]
[X86] Take advantage of the lzcnt instruction on btver2 architectures when ORing comparisons to zero.

This change adds transformations such as:
  zext(or(setcc(eq, (cmp x, 0)), setcc(eq, (cmp y, 0))))
  To:
  srl(or(ctlz(x), ctlz(y)), log2(bitsize(x))
This optimisation is beneficial on Jaguar architecture only, where lzcnt has a good reciprocal throughput.
Other architectures such as Intel's Haswell/Broadwell or AMD's Bulldozer/PileDriver do not benefit from it.
For this reason the change also adds a "HasFastLZCNT" feature which gets enabled for Jaguar.

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

llvm-svn: 284248

8 years ago[InstCombine] use m_APInt to allow sub with constant folds for splat vectors
Sanjay Patel [Fri, 14 Oct 2016 16:31:54 +0000 (16:31 +0000)]
[InstCombine] use m_APInt to allow sub with constant folds for splat vectors

llvm-svn: 284247

8 years ago[docs] Update some obsolete information in BitCodeFormat docs.
Mehdi Amini [Fri, 14 Oct 2016 16:23:09 +0000 (16:23 +0000)]
[docs] Update some obsolete information in BitCodeFormat docs.

Summary:
* Describe new (3.3) parameter attribute group encoding, leaving old encoding there with a note about legacy
* Bring TYPE_BLOCK docs up to date
* Remove docs about obsolete (pre 3.0) TYPE_SYMTAB_BLOCK, TST_CODE_ENTRY
* Fix a couple of incorrect comments and remove one unused enum definition along the way

This addresses https://llvm.org/bugs/show_bug.cgi?id=28941.

Patch by: Ismail Badawi <ibadawi@cisco.com>

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

llvm-svn: 284246

8 years ago[InstCombine] add tests for missing vector folds
Sanjay Patel [Fri, 14 Oct 2016 15:55:34 +0000 (15:55 +0000)]
[InstCombine] add tests for missing vector folds

llvm-svn: 284245

8 years ago[InstCombine] auto-generate checks
Sanjay Patel [Fri, 14 Oct 2016 15:41:25 +0000 (15:41 +0000)]
[InstCombine] auto-generate checks

llvm-svn: 284244

8 years ago[InstCombine] remove redundant test
Sanjay Patel [Fri, 14 Oct 2016 15:36:28 +0000 (15:36 +0000)]
[InstCombine] remove redundant test

This test was apparently checking for 2 independent folds, but we have
plenty of tests for those individual folds already. We are lacking
vector tests, however, because we don't have the shift folds for vectors.

llvm-svn: 284243

8 years ago[InstCombine] update test to use FileCheck and auto-generate checks
Sanjay Patel [Fri, 14 Oct 2016 15:30:31 +0000 (15:30 +0000)]
[InstCombine] update test to use FileCheck and auto-generate checks

llvm-svn: 284242

8 years ago[InstCombine] sub X, sext(bool Y) -> add X, zext(bool Y)
Sanjay Patel [Fri, 14 Oct 2016 15:24:31 +0000 (15:24 +0000)]
[InstCombine] sub X, sext(bool Y) -> add X, zext(bool Y)

Prefer add/zext because they are better supported in terms of value-tracking.

Note that the backend should be prepared for this IR canonicalization
(including vector types) after:
https://reviews.llvm.org/rL284015

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

llvm-svn: 284241

8 years agoDefine "contiki" OS specifier.
David L Kreitzer [Fri, 14 Oct 2016 14:41:46 +0000 (14:41 +0000)]
Define "contiki" OS specifier.

Patch by Michael LeMay

Differential revision: http://reviews.llvm.org/D24897

llvm-svn: 284240

8 years ago[DAG] add folds for negated shifted sign bit
Sanjay Patel [Fri, 14 Oct 2016 14:26:47 +0000 (14:26 +0000)]
[DAG] add folds for negated shifted sign bit

The same folds exist in InstCombine already.

This came up as part of:
https://reviews.llvm.org/D25485

llvm-svn: 284239

8 years ago[x86] add tests to show missing folds for negated shifted sign bit
Sanjay Patel [Fri, 14 Oct 2016 14:14:40 +0000 (14:14 +0000)]
[x86] add tests to show missing folds for negated shifted sign bit

llvm-svn: 284238

8 years ago[libcxx] Improve the gcc workaround for the missing __has_include macro.
Asiri Rathnayake [Fri, 14 Oct 2016 13:56:58 +0000 (13:56 +0000)]
[libcxx] Improve the gcc workaround for the missing __has_include macro.

NFC.

llvm-svn: 284237

8 years ago[clang-move] Don't overuse Replacements::add.
Haojian Wu [Fri, 14 Oct 2016 13:43:49 +0000 (13:43 +0000)]
[clang-move] Don't overuse Replacements::add.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 284236

8 years ago[clang-tidy] Add additional diagnostic to misc-use-after-move
Martin Bohme [Fri, 14 Oct 2016 13:23:39 +0000 (13:23 +0000)]
[clang-tidy] Add additional diagnostic to misc-use-after-move

Summary:
This adds a diagnostic to the misc-use-after-move check that is output when the
use happens on a later loop iteration than the move, for example:

    A a;
    for (int i = 0; i < 10; ++i) {
      a.foo();
      std::move(a);
    }

This situation can be confusing to users because, in terms of source code
location, the use is above the move. This can make it look as if the warning
is a false positive, particularly if the loop is long but the use and move are
close together.

In cases like these, misc-use-after-move will now output an additional
diagnostic:

  a.cpp:393:7: note: the use happens in a later loop iteration than the move

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 284235

8 years ago[ELF] - Added support of PT_OPENBSD_RANDOMIZE
George Rimar [Fri, 14 Oct 2016 13:02:22 +0000 (13:02 +0000)]
[ELF] - Added support of PT_OPENBSD_RANDOMIZE

This is 30646.

PT_OPENBSD_RANDOMIZE
The array element specifies the location and size of a part of the memory image of the program that must be filled with random data before any code in the object is executed. The memory region specified by a segment of this type may overlap the region specified by a PT_GNU_RELRO segment, in which case the intersection will be filled with random data before being marked read-only.

Reference links:
http://man.openbsd.org/OpenBSD-current/man5/elf.5
https://github.com/openbsd/src/commit/c494713c450d98da3f2e1451ee8c7fb675a7c461

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

llvm-svn: 284234

8 years ago[clang-move] Add header guard for the new header.
Haojian Wu [Fri, 14 Oct 2016 13:01:36 +0000 (13:01 +0000)]
[clang-move] Add header guard for the new header.

Summary:
The header guard generated by clang-move isn't always a perfect
style, just avoid getting the header included multiple times during
compiling period.

Also, we can use llvm-Header-guard clang-tidy check to correct the guard
automatically.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 284233

8 years ago[libcxx] Do not declare the thread api when __external_threading is present
Asiri Rathnayake [Fri, 14 Oct 2016 13:00:07 +0000 (13:00 +0000)]
[libcxx] Do not declare the thread api when __external_threading is present

This fixes a small omission where even when __external_threading is provided,
we attempt to declare a pthread based threading API. Instead, we should leave
out everything for the __external_threading header to take care of.

The __threading_support header provides a proof-of-concept externally threaded
libc++ variant when _LIBCPP_HAS_THREAD_API_EXTERNAL is defined. But if the
__external_threading header is present, we should exclude all of that POC stuff.

Reviewers: EricWF

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

llvm-svn: 284232

8 years ago[LLDB-MI] Minor cleanup of CMICmnLLDBUtilSBValue class
Vadim Macagon [Fri, 14 Oct 2016 12:58:02 +0000 (12:58 +0000)]
[LLDB-MI] Minor cleanup of CMICmnLLDBUtilSBValue class

Summary:
Placeholder c-strings don't need to be instance variables.

Reviewers: ki.stfu, abidh

Subscribers: lldb-commits

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

llvm-svn: 284231

8 years agoDisable Modules when building the libc++ sources.
Eric Fiselier [Fri, 14 Oct 2016 12:56:52 +0000 (12:56 +0000)]
Disable Modules when building the libc++ sources.

Libc++ will not build with modules enabled. In order to support an in-tree
libc++ when LLVM_ENABLE_MODULES is ON we need to explicitly disable the feature.

Unfortunately the libc++ sources are fundamentally non-modular. For example
iostream.cpp defines cout, cerr, wout, ... as char buffers instead of streams
in order to better control initialization/destruction. Not shockingly Clang
diagnoses this. Many other sources files define _LIBCPP_BUILDING_FOO macros to
provide definitions for normally inline symbols (See bind.cpp). Finally The
current module.map prohibits using <strstream> in C++11 so we can't build
strstream.cpp.

I think I can fix most of these issues but until then just disable modules.

llvm-svn: 284230

8 years agoFix for PR30632: Name mangling issue.
Alexey Bataev [Fri, 14 Oct 2016 12:43:59 +0000 (12:43 +0000)]
Fix for PR30632: Name mangling issue.

There was a bug in the implementation of captured statements. If it has
a lambda expression in it and the same lambda expression is used outside
the captured region, clang produced an error:
```
error: definition with same mangled name as another definition
```
Here is an example:
```
struct A {
 template <typename L>
 void g(const L&) { }
};

template<typename T>
void f() {
  {
    A().g([](){});
  }
  A().g([](){});
}

int main() {
  f<void>();
}
```

Error report:
```
main.cpp:3:10: error: definition with same mangled name as another
definition
    void g(const L&) { }
             ^
main.cpp:3:10: note: previous definition is here
```
Patch fixes this bug.

llvm-svn: 284229

8 years agoRemoved duplicate header include
Eric Liu [Fri, 14 Oct 2016 11:48:10 +0000 (11:48 +0000)]
Removed duplicate header include

Reviewers: ioeric

Subscribers: klimek

Patch by Krasimir Georgiev!

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

llvm-svn: 284228

8 years ago[ELF] - Do not crash when object has multiple SHT_MIPS_OPTIONS
George Rimar [Fri, 14 Oct 2016 11:10:36 +0000 (11:10 +0000)]
[ELF] - Do not crash when object has multiple SHT_MIPS_OPTIONS

Issue was revealed by AFl and I was able to generate such object using yaml2obj.

When object has more than one SHT_MIPS_OPTIONS,
each except the last one is destroyed after placing into Sections array.
Sections array contains dead pointers finally. LLD may crash then.

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

llvm-svn: 284227

8 years ago[ELF] - Implemented -z wxneeded.
George Rimar [Fri, 14 Oct 2016 10:34:36 +0000 (10:34 +0000)]
[ELF] - Implemented -z wxneeded.

-z wxneeded creates a PHDR PT_OPENBSD_WXNEEDED.

PT_OPENBSD_WXNEEDED
The array element specifies that a process executing this file may need to be able to map or protect memory regions as simultaneously executable and writable. If the system is unable or unwilling to permit that for this executable then it may fail immediately. This segment type is meaningful only for executable files and is ignored in other objects.

http://man.openbsd.org/OpenBSD-current/man5/elf.5

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

llvm-svn: 284226

8 years agoWork around Clang driver segfault when --coverage is used with -c and /dev/null
Eric Fiselier [Fri, 14 Oct 2016 10:30:33 +0000 (10:30 +0000)]
Work around Clang driver segfault when --coverage is used with -c and /dev/null

llvm-svn: 284225

8 years agoAMDGPU: Select 64-bit {ADD,SUB}{C,E} nodes
Nicolai Haehnle [Fri, 14 Oct 2016 10:30:00 +0000 (10:30 +0000)]
AMDGPU: Select 64-bit {ADD,SUB}{C,E} nodes

Summary:
This will be used for 64-bit MULHU, which is in turn used for the 64-bit
divide-by-constant optimization (see D24822).

Reviewers: arsenm, tstellarAMD

Subscribers: kzhuravl, wdng, yaxunl, llvm-commits, tony-tye

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

llvm-svn: 284224

8 years ago[GlobalISel] Get the AArch64 tests to work on Linux
Diana Picus [Fri, 14 Oct 2016 10:19:40 +0000 (10:19 +0000)]
[GlobalISel] Get the AArch64 tests to work on Linux

Mostly this just means changing the triple from aarch64-apple-ios to the generic
aarch64--. Only one test needs more significant changes, but GlobalISel already
does the right thing so it's ok to just change the checks.

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

llvm-svn: 284223