platform/upstream/llvm.git
8 years agoRemove unused TimeValue include
Pavel Labath [Wed, 9 Nov 2016 14:53:37 +0000 (14:53 +0000)]
Remove unused TimeValue include

llvm-svn: 286372

8 years agoRemove TimeValue usage from lldb/Host
Pavel Labath [Wed, 9 Nov 2016 14:53:32 +0000 (14:53 +0000)]
Remove TimeValue usage from lldb/Host

llvm-svn: 286371

8 years agoAdd a convenience getObj method. NFC.
Rafael Espindola [Wed, 9 Nov 2016 14:39:20 +0000 (14:39 +0000)]
Add a convenience getObj method. NFC.

llvm-svn: 286370

8 years agoRemove TimeValue usage from lldb/Interpreter
Pavel Labath [Wed, 9 Nov 2016 14:33:22 +0000 (14:33 +0000)]
Remove TimeValue usage from lldb/Interpreter

llvm-svn: 286369

8 years ago[Hexagon] Eliminate Insert4 pseudo-instruction, use combines instead
Krzysztof Parzyszek [Wed, 9 Nov 2016 14:16:29 +0000 (14:16 +0000)]
[Hexagon] Eliminate Insert4 pseudo-instruction, use combines instead

llvm-svn: 286368

8 years agoclang-format: [TypeScript] Fix bug in handling of non-null operator.
Daniel Jasper [Wed, 9 Nov 2016 14:12:55 +0000 (14:12 +0000)]
clang-format: [TypeScript] Fix bug in handling of non-null operator.

Before:
  var i = x!-1;

After:
  var i = x! - 1;

llvm-svn: 286367

8 years agoRemove TimeValue usage from lldb/Core. NFC.
Pavel Labath [Wed, 9 Nov 2016 14:04:08 +0000 (14:04 +0000)]
Remove TimeValue usage from lldb/Core. NFC.

llvm-svn: 286366

8 years ago[AST] Dump dependent scope member expression with its member name
Alex Lorenz [Wed, 9 Nov 2016 14:02:18 +0000 (14:02 +0000)]
[AST] Dump dependent scope member expression with its member name

llvm-svn: 286365

8 years ago[ELF] - Enable reproduce-error.s under windows.
George Rimar [Wed, 9 Nov 2016 13:55:30 +0000 (13:55 +0000)]
[ELF] - Enable reproduce-error.s under windows.

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

llvm-svn: 286364

8 years ago[CodeCompletion] Show block invocation results for block property setters
Alex Lorenz [Wed, 9 Nov 2016 13:43:18 +0000 (13:43 +0000)]
[CodeCompletion] Show block invocation results for block property setters

This commit changes the code completion results for block property setters:
The default block property result is now a block invocation rather than a simple
property reference.

rdar://28846196

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

llvm-svn: 286363

8 years ago[SystemZ] A few fixes in scheduler files.
Jonas Paulsson [Wed, 9 Nov 2016 12:47:57 +0000 (12:47 +0000)]
[SystemZ] A few fixes in scheduler files.

Review: U Weigand
llvm-svn: 286362

8 years agoRemove TimeValue usage from Scalar/SROA.cpp. NFC.
Pavel Labath [Wed, 9 Nov 2016 12:07:12 +0000 (12:07 +0000)]
Remove TimeValue usage from Scalar/SROA.cpp. NFC.

llvm-svn: 286361

8 years agoFix expectation in TestStaticVariables.py after rL286302
Tamas Berghammer [Wed, 9 Nov 2016 11:52:12 +0000 (11:52 +0000)]
Fix expectation in TestStaticVariables.py after rL286302

The debug info emitted by clang for static variables improved by
rL286302 and it exposed an incorrect test expactation because now LLDB
able to displays more data 9thanks to better debug info) then before.

llvm-svn: 286360

8 years agoZero-initialize chrono duration objects
Pavel Labath [Wed, 9 Nov 2016 11:43:57 +0000 (11:43 +0000)]
Zero-initialize chrono duration objects

The default duration constructor does not zero-initialize the object, we need to
do that manually.

llvm-svn: 286359

8 years ago[dsymutil] Replace TimeValue with TimePoint
Pavel Labath [Wed, 9 Nov 2016 11:43:52 +0000 (11:43 +0000)]
[dsymutil] Replace TimeValue with TimePoint

Summary:
All changes are pretty straight-forward. I chose to use TimePoints with
second precision, as that is all that seems to be required here.

Reviewers: friss, zturner

Subscribers: llvm-commits

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

llvm-svn: 286358

8 years agoReplace TimeValue with TimePoint in BuildSystem.cpp. NFC.
Pavel Labath [Wed, 9 Nov 2016 11:19:39 +0000 (11:19 +0000)]
Replace TimeValue with TimePoint in BuildSystem.cpp. NFC.

llvm-svn: 286357

8 years ago[VFS] Replace TimeValue usage with std::chrono
Pavel Labath [Wed, 9 Nov 2016 10:52:22 +0000 (10:52 +0000)]
[VFS] Replace TimeValue usage with std::chrono

Summary: NFCI

Reviewers: benlangmuir, zturner

Subscribers: cfe-commits

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

llvm-svn: 286356

8 years agoDisplay the pointer value in the libstdc++ unique_ptr summary
Pavel Labath [Wed, 9 Nov 2016 10:42:29 +0000 (10:42 +0000)]
Display the pointer value in the libstdc++ unique_ptr summary

Summary:
r284830 added a summary provider for unique_ptr in libstdc++, whose value printed
the value of the pointee. This is a bit unintuitive as it becomes unobvious that
the value actually is a pointer, and we lose the way to actually obtain the
pointer value.

Change that to print the pointer value instead. The pointee value can still be
obtained through the synthetic children.

Reviewers: tberghammer, granata.enrico

Subscribers: lldb-commits

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

llvm-svn: 286355

8 years ago[Sema] Avoid -Wshadow warnings for shadowed variables that aren't captured
Alex Lorenz [Wed, 9 Nov 2016 10:38:57 +0000 (10:38 +0000)]
[Sema] Avoid -Wshadow warnings for shadowed variables that aren't captured
by lambdas with an explicit capture list

This commit avoids the -Wshadow warning for variables which shadow variables
that aren't captured by lambdas with an explicit capture list. It provides an
additional note that points to location of the explicit capture.

The old behaviour is preserved with -Wshadow-all or -Wshadow-uncaptured-local.

rdar://17135966

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

llvm-svn: 286354

8 years ago[ELF] ARM and AArch64 undefined weak reference values
Peter Smith [Wed, 9 Nov 2016 10:22:29 +0000 (10:22 +0000)]
[ELF] ARM and AArch64 undefined weak reference values

The ARM 32 and 64-bit ABI does not use 0 for undefined weak references
that are used in PC relative relocations. In particular:
- A branch relocation to an undefined weak resolves to the next
  instruction. Effectively making the branch a no-op
- In all other cases the symbol resolves to the place so that S + A - P
  resolves to A.

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

llvm-svn: 286353

8 years agoDisable windows-only minidump plugin
Pavel Labath [Wed, 9 Nov 2016 10:16:11 +0000 (10:16 +0000)]
Disable windows-only minidump plugin

Summary:
This commit disables the windows-only minidump plugin and enables the new
cross-platform plugin for windows minidump files. Test decorators are adjusted to
reflect that: windows minidump tests can now run  on all platforms. The exception
is the tests that create minidump files, as that functionality is not available
yet.  I've checked that this works on windows and linux.

Reviewers: amccarth, zturner

Subscribers: dvlahovski, lldb-commits

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

llvm-svn: 286352

8 years ago[mips] Add non-const getter for the Elf_Mips_Options class. NFC
Simon Atanasyan [Wed, 9 Nov 2016 10:14:55 +0000 (10:14 +0000)]
[mips] Add non-const getter for the Elf_Mips_Options class. NFC

llvm-svn: 286351

8 years ago[MachineScheduler] Comments fixing.
Jonas Paulsson [Wed, 9 Nov 2016 09:59:27 +0000 (09:59 +0000)]
[MachineScheduler] Comments fixing.

The name/comment of the third argument to the ScheduleDAGMI constructor
is RemoveKillFlags and not IsPostRA. Only the comments are changed.

Review: A Trick
llvm-svn: 286350

8 years agoRemove TimeValue usage from Core/Module
Pavel Labath [Wed, 9 Nov 2016 09:59:18 +0000 (09:59 +0000)]
Remove TimeValue usage from Core/Module

Summary:
The only interesting part here is that TimePoint and TimeValue have different
natural string representations, which affects "target modules list" output. It
is now "2016-07-09 04:02:21.000000000", whereas previously in was
"Sat Jul  9 04:02:21 2016". I wanted to check if we're OK with that.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 286349

8 years ago[ELF] - Ignore -stats command line option.
George Rimar [Wed, 9 Nov 2016 08:59:59 +0000 (08:59 +0000)]
[ELF] - Ignore -stats command line option.

llvm-svn: 286348

8 years ago[ARM] Loop Strength Reduction crashes when targeting ARM or Thumb.
Alexandros Lamprineas [Wed, 9 Nov 2016 08:53:07 +0000 (08:53 +0000)]
[ARM] Loop Strength Reduction crashes when targeting ARM or Thumb.

Scalar Evolution asserts when not all the operands of an Add Recurrence
Expression are loop invariants. Loop Strength Reduction should only
create affine Add Recurrences, so that both the start and the step of
the expression are loop invariants.

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

llvm-svn: 286347

8 years agoPacify lint check
Jonas Hahnfeld [Wed, 9 Nov 2016 08:36:45 +0000 (08:36 +0000)]
Pacify lint check

llvm-svn: 286346

8 years ago[AVX-512] Add lowering to cvttpd2udq/cvttps2udq for fptoui v2f64/2f32 to 2i32
Craig Topper [Wed, 9 Nov 2016 07:48:51 +0000 (07:48 +0000)]
[AVX-512] Add lowering to cvttpd2udq/cvttps2udq for fptoui v2f64/2f32 to 2i32

This patch adds support for fptoui to 2i32 from both 2f64 and 2f32, building on Simon's change for the signed version in r284459 and using AVX-512 instructions.

If we don't have VLX support we need to use a 512-bit operation for v2f64->v2i32 and extract the result.

It also recognises that cvttpd2udq zeroes the upper 64-bits of the xmm result.

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

llvm-svn: 286345

8 years ago[X86] Lower AVX512 and SSE intrinsics for CVTTPD2DQ to X86ISD::CVTTPD2DQ.
Craig Topper [Wed, 9 Nov 2016 07:31:32 +0000 (07:31 +0000)]
[X86] Lower AVX512 and SSE intrinsics for CVTTPD2DQ to X86ISD::CVTTPD2DQ.

Summary: This allows the SSE intrinsic to use the EVEX instruction when available. It also fixes EVEX to not use a weird (v4i32 (fp_to_sint v2f64)) node and it merges some isel patterns. This also fixes some cases that weren't combining vzmovl with cvttpd2dq to remove extra moves.

Reviewers: delena, zvi, RKSimon

Subscribers: llvm-commits

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

llvm-svn: 286344

8 years ago[AVX-512] Add more varied alignments to tests for storing the lower 128-bits of a...
Craig Topper [Wed, 9 Nov 2016 05:38:47 +0000 (05:38 +0000)]
[AVX-512] Add more varied alignments to tests for storing the lower 128-bits of a 256 or 512-bit subvector extract.

llvm-svn: 286343

8 years ago[AVX-512] Use alignedstore256 in patterns that look for stores of the lower 256-bits...
Craig Topper [Wed, 9 Nov 2016 05:31:57 +0000 (05:31 +0000)]
[AVX-512] Use alignedstore256 in patterns that look for stores of the lower 256-bits of a 512-bit vector to use a 256-bit aligned store.

Previously we were only checking for 16 byte alignment instead of 32 byte alignment. Fixes PR30947.

llvm-svn: 286342

8 years ago[AVX-512] Add test cases to demonstrate PR30947. We accidentally use 32 byte aligned...
Craig Topper [Wed, 9 Nov 2016 05:31:53 +0000 (05:31 +0000)]
[AVX-512] Add test cases to demonstrate PR30947. We accidentally use 32 byte aligned store instructions when the original store was only 16 byte aligned if the store is from the lower bits of a subvector extract.

llvm-svn: 286341

8 years ago[AVX-512] Make VBMI instruction set enabling imply that the BWI instruction set is...
Craig Topper [Wed, 9 Nov 2016 04:51:03 +0000 (04:51 +0000)]
[AVX-512] Make VBMI instruction set enabling imply that the BWI instruction set is also enabled.

Summary: This is needed to make the v64i8 and v32i16 types legal for the 512-bit VBMI instructions. Fixes PR30912.

Reviewers: delena, zvi

Subscribers: RKSimon, cfe-commits

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

llvm-svn: 286340

8 years ago[AVX-512] Make VBMI instruction set enabling imply that the BWI instruction set is...
Craig Topper [Wed, 9 Nov 2016 04:50:48 +0000 (04:50 +0000)]
[AVX-512] Make VBMI instruction set enabling imply that the BWI instruction set is also enabled.

Summary:
This is needed to make the v64i8 and v32i16 types legal for the 512-bit VBMI instructions. Fixes PR30912.

Reviewers: delena, zvi

Subscribers: llvm-commits

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

llvm-svn: 286339

8 years agoScopInfo: only run code needed for ASSERT in DEBUG mode
Tobias Grosser [Wed, 9 Nov 2016 04:24:49 +0000 (04:24 +0000)]
ScopInfo: only run code needed for ASSERT in DEBUG mode

Suggested-by: Johannes Doerfert
llvm-svn: 286338

8 years ago[libc++abi] Remove the test for checking using of fallback malloc in case of dynamic...
Igor Kudrin [Wed, 9 Nov 2016 04:14:31 +0000 (04:14 +0000)]
[libc++abi] Remove the test for checking using of fallback malloc in case of dynamic memory exhaustion.

This test is too fragile and doesn't add significant value. See https://reviews.llvm.org/D26150 for some details.

llvm-svn: 286337

8 years agoDoxygen comments for avxintrin.h.
Ekaterina Romanova [Wed, 9 Nov 2016 03:58:30 +0000 (03:58 +0000)]
Doxygen comments for avxintrin.h.

Added doxygen comments to avxintrin.h's intrinsics. As of now, around 75% of the
intrinsics in this file are documented here. The patches for the other 25% will be se
nt out later.

Removed extra spaces in emmitrin.h.

Note: The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.

llvm-svn: 286336

8 years agoWhen deciding whether to use the source remapping dictionary from
Jason Molenda [Wed, 9 Nov 2016 03:42:12 +0000 (03:42 +0000)]
When deciding whether to use the source remapping dictionary from
a dSYM per-uuid plist, only use it when the DBGVersion key has a
value of 2 or greater.

<rdar://problem/28889578>
<rdar://problem/29131339>

llvm-svn: 286335

8 years agoRevert "[CMake] Check runtimes subdir when looking for libcxx and libuwind"
Petr Hosek [Wed, 9 Nov 2016 03:38:21 +0000 (03:38 +0000)]
Revert "[CMake] Check runtimes subdir when looking for libcxx and libuwind"

This reverts commit eecb79506d88b268fb0d00cce178213b4aa17933.

llvm-svn: 286334

8 years ago[CMake] Check runtimes subdir when looking for libcxxabi
Petr Hosek [Wed, 9 Nov 2016 03:22:28 +0000 (03:22 +0000)]
[CMake] Check runtimes subdir when looking for libcxxabi

The runtimes subdir is the new location for runtimes, we should
include it when looking for libcxxabi headers.

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

llvm-svn: 286333

8 years ago[CMake] Check runtimes subdir when looking for libcxx and libuwind
Petr Hosek [Wed, 9 Nov 2016 03:22:19 +0000 (03:22 +0000)]
[CMake] Check runtimes subdir when looking for libcxx and libuwind

The runtimes subdir is the new location for runtimes, we should
include it when looking for libcxx and libunwind headers.

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

llvm-svn: 286332

8 years ago[index] Fix issue with protocol name locations in conformance list of an ObjC class...
Argyrios Kyrtzidis [Wed, 9 Nov 2016 02:47:07 +0000 (02:47 +0000)]
[index] Fix issue with protocol name locations in conformance list of an ObjC class when they come from a typedef.

The ObjC class protocol list assumes there is an associated location for each protocol but no location is provided
when the protocol list comes from a typedef, and we end up with a buffer overflow when trying to get locations for the protocol names.

Fixes crash of rdar://28980278.

llvm-svn: 286331

8 years ago[XRay][docs] Fix llvm snippets to be well-formed
Dean Michael Berris [Wed, 9 Nov 2016 02:12:13 +0000 (02:12 +0000)]
[XRay][docs] Fix llvm snippets to be well-formed

llvm-svn: 286330

8 years agoRevert "[ThinLTO] Prevent exporting of locals used/defined in module level asm"
Mehdi Amini [Wed, 9 Nov 2016 01:45:13 +0000 (01:45 +0000)]
Revert "[ThinLTO] Prevent exporting of locals used/defined in module level asm"

This reverts commit r286297.
Introduces a dependency from libAnalysis to libObject, which I missed
during the review.

llvm-svn: 286329

8 years ago[doc] Remove explicit CMake version requirement for MSVC
Mehdi Amini [Wed, 9 Nov 2016 01:44:42 +0000 (01:44 +0000)]
[doc] Remove explicit CMake version requirement for MSVC

The global minimum one is way past this version.

llvm-svn: 286328

8 years agoSplit Header into individual fields.
Rafael Espindola [Wed, 9 Nov 2016 01:42:41 +0000 (01:42 +0000)]
Split Header into individual fields.

This is similar to what was done for InputSection.

With this the various fields are stored in host order and only
converted to target order when writing.

llvm-svn: 286327

8 years agoBitcode: Remove the remnants of the BitcodeDiagnosticInfo class.
Peter Collingbourne [Wed, 9 Nov 2016 01:09:11 +0000 (01:09 +0000)]
Bitcode: Remove the remnants of the BitcodeDiagnosticInfo class.

The BitcodeReader no longer produces BitcodeDiagnosticInfo diagnostics.
The only remaining reference was in the gold plugin; the code there has been
dead since we stopped producing InvalidBitcodeSignature error codes in r225562.
While at it remove the InvalidBitcodeSignature error code.

llvm-svn: 286326

8 years agoEnable Loop Sink pass for functions that has profile.
Dehao Chen [Wed, 9 Nov 2016 00:58:19 +0000 (00:58 +0000)]
Enable Loop Sink pass for functions that has profile.

Summary: For functions with profile data, we are confident that loop sink will be optimal in sinking code.

Reviewers: davidxl, hfinkel

Subscribers: mehdi_amini, mzolotukhin, llvm-commits

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

llvm-svn: 286325

8 years agoclang-cl: Pass /Zc:threadSafeInit through to MSVC with /fallback (PR30948)
Hans Wennborg [Wed, 9 Nov 2016 00:56:42 +0000 (00:56 +0000)]
clang-cl: Pass /Zc:threadSafeInit through to MSVC with /fallback (PR30948)

llvm-svn: 286324

8 years agoBitcode: Change the BitcodeReader to use llvm::Error internally.
Peter Collingbourne [Wed, 9 Nov 2016 00:51:04 +0000 (00:51 +0000)]
Bitcode: Change the BitcodeReader to use llvm::Error internally.

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

llvm-svn: 286323

8 years agoEmit debug info for global constants whose address is taken exactly once.
Adrian Prantl [Wed, 9 Nov 2016 00:42:03 +0000 (00:42 +0000)]
Emit debug info for global constants whose address is taken exactly once.

Add a check to the DeclCache before emitting debug info for a
GlobalVariable a second time and just attach the previsously created one to it.

<rdar://problem/26721101>

llvm-svn: 286322

8 years ago[asan] Ignore host LD_LIBRARY_PATH in device tests.
Evgeniy Stepanov [Wed, 9 Nov 2016 00:33:43 +0000 (00:33 +0000)]
[asan] Ignore host LD_LIBRARY_PATH in device tests.

I'm not sure why is it there, but it is breaking tests on Android N
because of unexpected linker output about an empty LD_LIBRARY_PATH
entry.

llvm-svn: 286321

8 years ago[asan] Disable unexpected passing test.
Evgeniy Stepanov [Wed, 9 Nov 2016 00:33:41 +0000 (00:33 +0000)]
[asan] Disable unexpected passing test.

This test fails on some versions of Android and passes on other versions.
Replace XFAIL with UNSUPPORTED.

llvm-svn: 286320

8 years ago[XRay][Docs] Add documentation for XRay in LLVM
Dean Michael Berris [Wed, 9 Nov 2016 00:24:58 +0000 (00:24 +0000)]
[XRay][Docs] Add documentation for XRay in LLVM

Summary:
This is the initial version of the documentation for how to use XRay as
it stands in LLVM, Clang, and compiler-rt. We leave some room for later
expansion mentioining what is work in progress and what could be
expected moving forward.

We also give a high level overview of future work that's both ongoing
and planned.

Reviewers: echristo, dblaikie, chandlerc

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 286319

8 years ago[ValueTracking] recognize obfuscated variants of umin/umax
Sanjay Patel [Wed, 9 Nov 2016 00:24:44 +0000 (00:24 +0000)]
[ValueTracking] recognize obfuscated variants of umin/umax

The smallest tests that expose this are codegen tests (because SelectionDAGBuilder::visitSelect() uses matchSelectPattern
to create UMAX/UMIN nodes), but it's also possible to see the effects in IR alone with folds of min/max pairs.

If these were written as unsigned compares in IR, InstCombine canonicalizes the unsigned compares to signed compares.
Ie, running the optimizer pessimizes the codegen for this case without this patch:

define <4 x i32> @umax_vec(<4 x i32> %x) {
  %cmp = icmp ugt <4 x i32> %x, <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>
  %sel = select <4 x i1> %cmp, <4 x i32> %x, <4 x i32> <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>
  ret <4 x i32> %sel
}

$ ./opt umax.ll -S | ./llc -o - -mattr=avx

vpmaxud LCPI0_0(%rip), %xmm0, %xmm0

$ ./opt -instcombine umax.ll -S | ./llc -o - -mattr=avx

vpxor %xmm1, %xmm1, %xmm1
vpcmpgtd  %xmm0, %xmm1, %xmm1
vmovaps LCPI0_0(%rip), %xmm2    ## xmm2 = [2147483647,2147483647,2147483647,2147483647]
vblendvps %xmm1, %xmm0, %xmm2, %xmm0

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

llvm-svn: 286318

8 years ago[cmake] Fix handling compiler-rt in LLVM_ENABLE_PROJECTS by turning any "-" into "_"
Mehdi Amini [Wed, 9 Nov 2016 00:23:20 +0000 (00:23 +0000)]
[cmake] Fix handling compiler-rt in LLVM_ENABLE_PROJECTS by turning any "-" into "_"

llvm-svn: 286317

8 years agoAdded the ability to dump hex bytes easily into a raw_ostream.
Greg Clayton [Wed, 9 Nov 2016 00:15:54 +0000 (00:15 +0000)]
Added the ability to dump hex bytes easily into a raw_ostream.

Unit tests were added to verify this functionality keeps working correctly.

Example output for raw hex bytes:
llvm::ArrayRef<uint8_t> Bytes = ...;
llvm::outs() << format_hex_bytes(Bytes);
554889e5 4881ec70 04000048 8d051002
00004c8d 05fd0100 004c8b0d d0020000

Example output for raw hex bytes with offsets:
llvm::outs() << format_hex_bytes(Bytes, 0x100000d10);
0x0000000100000d10: 554889e5 4881ec70 04000048 8d051002
0x0000000100000d20: 00004c8d 05fd0100 004c8b0d d0020000

Example output for raw hex bytes with ASCII with offsets:
llvm::outs() << format_hex_bytes_with_ascii(Bytes, 0x100000d10);
0x0000000100000d10: 554889e5 4881ec70 04000048 8d051002 |UH.?H.?p...H....|
0x0000000100000d20: 00004c8d 05fd0100 004c8b0d d0020000 |..L..?...L..?...|

The default groups bytes into 4 byte groups, but this can be changed to 1 byte:
llvm::outs() << format_hex_bytes(Bytes, 0x100000d10, 16 /*NumPerLine*/, 1 /*ByteGroupSize*/);
0x0000000100000d10: 55 48 89 e5 48 81 ec 70 04 00 00 48 8d 05 10 02
0x0000000100000d20: 00 00 4c 8d 05 fd 01 00 00 4c 8b 0d d0 02 00 00

llvm::outs() << format_hex_bytes(Bytes, 0x100000d10, 16 /*NumPerLine*/, 2 /*ByteGroupSize*/);
0x0000000100000d10: 5548 89e5 4881 ec70 0400 0048 8d05 1002
0x0000000100000d20: 0000 4c8d 05fd 0100 004c 8b0d d002 0000

llvm::outs() << format_hex_bytes(Bytes, 0x100000d10, 8 /*NumPerLine*/, 1 /*ByteGroupSize*/);
0x0000000100000d10: 55 48 89 e5 48 81 ec 70
0x0000000100000d18: 04 00 00 48 8d 05 10 02
0x0000000100000d20: 00 00 4c 8d 05 fd 01 00
0x0000000100000d28: 00 4c 8b 0d d0 02 00 00

https://reviews.llvm.org/D26405

llvm-svn: 286316

8 years ago[InstCombine] fix profitability equation for max-of-nots transform
Sanjay Patel [Wed, 9 Nov 2016 00:13:11 +0000 (00:13 +0000)]
[InstCombine] fix profitability equation for max-of-nots transform

As the test change shows, we can increase the critical path by adding
a 'not' instruction, so make sure that we're actually removing an
instruction if we do this transform.

This transform could also cause us to miss folds of min/max pairs.

llvm-svn: 286315

8 years ago[InstCombine] reduce indentation; NFC
Sanjay Patel [Tue, 8 Nov 2016 23:49:15 +0000 (23:49 +0000)]
[InstCombine] reduce indentation; NFC

llvm-svn: 286314

8 years ago[CUDA] Use only the GVALinkage on function definitions.
Justin Lebar [Tue, 8 Nov 2016 23:45:51 +0000 (23:45 +0000)]
[CUDA] Use only the GVALinkage on function definitions.

Summary:
Previously we'd look at the GVALinkage of whatever FunctionDecl you
happened to be calling.

This is not right.  In the absence of the gnu_inline attribute, to be
handled separately, the function definition determines the function's
linkage.  So we need to wait until we get a def before we can know
whether something is known-emitted.

Reviewers: tra

Subscribers: cfe-commits, rsmith

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

llvm-svn: 286313

8 years ago"thread backtrace" should use the thread-stop-format.
Jim Ingham [Tue, 8 Nov 2016 23:43:36 +0000 (23:43 +0000)]
"thread backtrace" should use the thread-stop-format.

<rdar://problem/28273697>

llvm-svn: 286312

8 years ago[CMake] Get libunwind building under LLVM/runtimes
Petr Hosek [Tue, 8 Nov 2016 23:02:49 +0000 (23:02 +0000)]
[CMake] Get libunwind building under LLVM/runtimes

The new LLVM runtimes directory requires the same conventions to be
followed across the runtime projects. These changes make libunwind
build under the runtimes subdirectory.

This patch contains the following changes:

* Rename LLVM_CONFIG to LLVM_CONFIG_PATH
* Check if compiler supports C++11 (required by libunwind)

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

llvm-svn: 286308

8 years ago[change-namespace] shorten namespace qualifier based on UsingDecl and UsingDirectiveDecl.
Eric Liu [Tue, 8 Nov 2016 22:44:17 +0000 (22:44 +0000)]
[change-namespace] shorten namespace qualifier based on UsingDecl and UsingDirectiveDecl.

Summary:
when replacing symbol references in moved namespaces, trying to make the replace
name as short as possible by considering UsingDecl (i.e. UsingShadow) and
UsingDirectiveDecl (i.e. using namespace decl).

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 286307

8 years ago[analyzer] Provide Contains() on ImmutableMap program state partial trait.
Dominic Chen [Tue, 8 Nov 2016 22:39:14 +0000 (22:39 +0000)]
[analyzer] Provide Contains() on ImmutableMap program state partial trait.

Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

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

llvm-svn: 286306

8 years agoFix some size_t / uint32_t ambiguity errors.
Zachary Turner [Tue, 8 Nov 2016 22:30:11 +0000 (22:30 +0000)]
Fix some size_t / uint32_t ambiguity errors.

llvm-svn: 286305

8 years ago[CodeView] Hook up CodeViewRecordIO to type serialization path.
Zachary Turner [Tue, 8 Nov 2016 22:24:53 +0000 (22:24 +0000)]
[CodeView] Hook up CodeViewRecordIO to type serialization path.

Previously support had been added for using CodeViewRecordIO
to read (deserialize) CodeView type records.  This patch adds
support for writing those same records.  With this patch,
reading and writing of CodeView type records finally uses a single
codepath.

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

llvm-svn: 286304

8 years agoFix some cases where we were printf'ing StringRefs.
Zachary Turner [Tue, 8 Nov 2016 22:23:50 +0000 (22:23 +0000)]
Fix some cases where we were printf'ing StringRefs.

llvm-svn: 286303

8 years agoEmit the DW_AT_type for a C++ static member definition
Adrian Prantl [Tue, 8 Nov 2016 22:11:38 +0000 (22:11 +0000)]
Emit the DW_AT_type for a C++ static member definition
if it is more specific than the one in its DW_AT_specification.

If a static member is an array, the translation unit containing the
member definition may have a more specific type (including its length)
than TUs only seeing the class declaration. This patch adds a
DW_AT_type to the member's DW_TAG_variable in addition to the
DW_AT_specification in these cases. The member type in the
DW_AT_specification still shows the more generic type (without the
length) to avoid defeating type uniquing.

The DWARF standard discourages “duplicating” a DW_AT_type in a member
variable definition but doesn’t explicitly forbid it.  Having the more
specific type (with the array length) available is what allows the
debugger to print the contents of a static array member variable.

https://reviews.llvm.org/D26368
rdar://problem/28706946

llvm-svn: 286302

8 years agoFix up the formats.html for the addition of the thread-stop-format.
Jim Ingham [Tue, 8 Nov 2016 22:05:29 +0000 (22:05 +0000)]
Fix up the formats.html for the addition of the thread-stop-format.

<rdar://problem/28273697>

llvm-svn: 286301

8 years agoGlobalISel: make sure debugging variables are appropriately elided in release builds.
David L. Jones [Tue, 8 Nov 2016 22:03:23 +0000 (22:03 +0000)]
GlobalISel: make sure debugging variables are appropriately elided in release builds.

Summary:
There are two variables here that break. This change constrains both of them to
debug builds (via DEBUG() or #ifndef NDEBUG).

Reviewers: bkramer, t.p.northover

Subscribers: mehdi_amini, vkalintiris

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

llvm-svn: 286300

8 years ago[libFuzzer] minor docs update
Kostya Serebryany [Tue, 8 Nov 2016 21:57:37 +0000 (21:57 +0000)]
[libFuzzer] minor docs update

llvm-svn: 286299

8 years agoRevert "Define __ANDROID_API__ for all Android builds."
Stephen Hines [Tue, 8 Nov 2016 21:54:49 +0000 (21:54 +0000)]
Revert "Define __ANDROID_API__ for all Android builds."

Summary: This reverts commit a8804ddd9fe71304b28e5b834d134fe93e568ee0.

Subscribers: cfe-commits, pirama, eugenis, tberghammer, danalbert

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

llvm-svn: 286298

8 years ago[ThinLTO] Prevent exporting of locals used/defined in module level asm
Teresa Johnson [Tue, 8 Nov 2016 21:53:35 +0000 (21:53 +0000)]
[ThinLTO] Prevent exporting of locals used/defined in module level asm

Summary:
This patch uses the same approach added for inline asm in r285513 to
similarly prevent promotion/renaming of locals used or defined in module
level asm.

All static global values defined in normal IR and used in module level asm
should be included on either the llvm.used or llvm.compiler.used global.
The former were already being flagged as NoRename in the summary, and
I've simply added llvm.compiler.used values to this handling.

Module level asm may also contain defs of values. We need to prevent
export of any refs to local values defined in module level asm (e.g. a
ref in normal IR), since that also requires renaming/promotion of the
local. To do that, the summary index builder looks at all values in the
module level asm string that are not marked Weak or Global, which is
exactly the set of locals that are defined. A summary is created for
each of these local defs and flagged as NoRename.

This required adding handling to the BitcodeWriter to look at GV
declarations to see if they have a summary (rather than skipping them
all).

Finally, added an assert to IRObjectFile::CollectAsmUndefinedRefs to
ensure that an MCAsmParser is available, otherwise the module asm parse
would silently fail. Initialized the asm parser in the opt tool for use
in testing this fix.

Fixes PR30610.

Reviewers: mehdi_amini

Subscribers: johanengelen, krasin, llvm-commits

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

llvm-svn: 286297

8 years ago[asan] Speed up compilation of large C++ stringmaps (tons of allocas) with ASan
Kuba Brecka [Tue, 8 Nov 2016 21:30:41 +0000 (21:30 +0000)]
[asan] Speed up compilation of large C++ stringmaps (tons of allocas) with ASan

This addresses PR30746, <https://llvm.org/bugs/show_bug.cgi?id=30746>. The ASan pass iterates over entry-block instructions and checks each alloca whether it's in NonInstrumentedStaticAllocaVec, which is apparently slow. This patch gathers the instructions to move during visitAllocaInst.

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

llvm-svn: 286296

8 years agoDefine __ANDROID_API__ for all Android builds.
Stephen Hines [Tue, 8 Nov 2016 21:23:26 +0000 (21:23 +0000)]
Define __ANDROID_API__ for all Android builds.

Summary:
Bug: https://llvm.org/bugs/show_bug.cgi?id=30940

This macro (along with __ANDROID__) should always be defined for Android
targets. We set it to the major (only) version of the Android API being
compiled for. The Android version is able to be set as an integer suffix
for any valid Android target.

Reviewers: danalbert, eugenis

Subscribers: cfe-commits, pirama, eugenis, tberghammer, danalbert

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

llvm-svn: 286295

8 years ago[BasicAA] Teach BasicAA to handle the inaccessiblememonly and inaccessiblemem_or_argm...
Andrew Kaylor [Tue, 8 Nov 2016 21:07:42 +0000 (21:07 +0000)]
[BasicAA] Teach BasicAA to handle the inaccessiblememonly and inaccessiblemem_or_argmemonly attributes

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

llvm-svn: 286294

8 years agoAArch64DeadRegisterDefinitionsPass: Fix Changed flag
Matthias Braun [Tue, 8 Nov 2016 20:59:03 +0000 (20:59 +0000)]
AArch64DeadRegisterDefinitionsPass: Fix Changed flag

Fix a bug in the calculation of the changed flag introduced in r285488.

llvm-svn: 286293

8 years agoUse a default constructor. (NFC)
Adrian Prantl [Tue, 8 Nov 2016 20:48:38 +0000 (20:48 +0000)]
Use a default constructor. (NFC)
Thanks to David Blaikie for suggesting this.

llvm-svn: 286292

8 years ago[TBAA] Drop support for "old style" scalar TBAA tags
Sanjoy Das [Tue, 8 Nov 2016 20:46:01 +0000 (20:46 +0000)]
[TBAA] Drop support for "old style" scalar TBAA tags

Summary:
We've had support for auto upgrading old style scalar TBAA access
metadata tags into the "new" struct path aware TBAA metadata for 3 years
now.  The only way to actually generate old style TBAA was explicitly
through the IRBuilder API.  I think this is a good time for dropping
support for old style scalar TBAA.

I'm not removing support for textual or bitcode upgrade -- if you have
IR with the old style scalar TBAA tags that go through the AsmParser orf
the bitcode parser before LLVM sees them, they will keep working as
usual.

Note:

  %val = load i32, i32* %ptr, !tbaa !N
  !N = < scalar tbaa node >

is equivalent to

  %val = load i32, i32* %ptr, !tbaa !M
  !N = < scalar tbaa node >
  !M = !{!N, !N, 0}

Reviewers: manmanren, chandlerc, sunfish

Subscribers: mcrosier, llvm-commits, mgorny

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

llvm-svn: 286291

8 years ago[asan/win] Add init hooks to .CRT$XLAB
Reid Kleckner [Tue, 8 Nov 2016 20:45:45 +0000 (20:45 +0000)]
[asan/win] Add init hooks to .CRT$XLAB

Summary:
User applications may register hooks in the .CRT$XL* callback list,
which is called very early by the loader. This is very common in
Chromium:
https://cs.chromium.org/search/?q=CRT.XL&sq=package:chromium&type=cs

This has flown under the radar for a long time because the loader
appears to catch exceptions originating from these callbacks. It's a
real problem when you're debugging an asan application, though, since it
makes the program crash early.

The solution is to add our own callback to this list, and sort it very
early in the list like we do elsewhere. Also add a test with such an
instrumented callback, and test that it gets called with asan.

Reviewers: etienneb

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 286290

8 years agoGlobalISel: allow CodeGen to fallback on VReg type/class issues.
Tim Northover [Tue, 8 Nov 2016 20:39:03 +0000 (20:39 +0000)]
GlobalISel: allow CodeGen to fallback on VReg type/class issues.

After instruction selection we perform some checks on each VReg just before
discarding the type information. These checks were assertions before, but that
breaks the fallback path so this patch moves the logic into the main flow and
reports a better error on failure.

llvm-svn: 286289

8 years agoClean up the stop printing header lines.
Jim Ingham [Tue, 8 Nov 2016 20:36:40 +0000 (20:36 +0000)]
Clean up the stop printing header lines.

I added a "thread-stop-format" to distinguish between the form
that is just the thread info (since the stop printing immediately prints
the frame info) and one with more frame 0 info - which is useful for
"thread list" and the like.

I also added a frame.no-debug boolean to the format entities so you can
print frame information differently between frames with source info and those
without.

This closes https://reviews.llvm.org/D26383.
<rdar://problem/28273697>

llvm-svn: 286288

8 years agoSimplify getLocation() function.
Rui Ueyama [Tue, 8 Nov 2016 20:30:19 +0000 (20:30 +0000)]
Simplify getLocation() function.

All tests pass without the first parameter, so I guess we don't need it.

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

llvm-svn: 286287

8 years agoStore the size the same way as any other OutputSection. NFC.
Rafael Espindola [Tue, 8 Nov 2016 20:25:44 +0000 (20:25 +0000)]
Store the size the same way as any other OutputSection. NFC.

llvm-svn: 286286

8 years ago[SystemZ] Add missing FP extension instructions
Ulrich Weigand [Tue, 8 Nov 2016 20:18:41 +0000 (20:18 +0000)]
[SystemZ] Add missing FP extension instructions

This completes assembler / disassembler support for all BFP
instructions provided by the floating-point extensions facility.
The instructions added here are not currently used for codegen.

llvm-svn: 286285

8 years ago[SystemZ] Add program mask and addressing mode instructions
Ulrich Weigand [Tue, 8 Nov 2016 20:17:02 +0000 (20:17 +0000)]
[SystemZ] Add program mask and addressing mode instructions

Add several instructions that operate on the program mask
or the addressing mode.  These are not really needed for
code generation under Linux, but are provided for completeness
for the assembler/disassembler.

llvm-svn: 286284

8 years ago[SystemZ] Model access registers as LLVM registers
Ulrich Weigand [Tue, 8 Nov 2016 20:15:26 +0000 (20:15 +0000)]
[SystemZ] Model access registers as LLVM registers

Add the 16 access registers as LLVM registers.  This allows removing
a lot of special cases in the assembler and disassembler where we
were handling access registers; this can all just use the generic
register code now.

Also add a bunch of instructions to operate on access registers,
for assembler/disassembler use only.  No change in code generation
intended.

llvm-svn: 286283

8 years agoRename a function to avoid function overloading. NFC.
Rui Ueyama [Tue, 8 Nov 2016 20:02:23 +0000 (20:02 +0000)]
Rename a function to avoid function overloading. NFC.

llvm-svn: 286282

8 years ago[clang-move] Move all code from old.h/cc directly when moving all class declarations...
Haojian Wu [Tue, 8 Nov 2016 19:55:13 +0000 (19:55 +0000)]
[clang-move] Move all code from old.h/cc directly when moving all class declarations from old.h.

Summary: When moving all code to new.h/cc,  these code also will be formatted based on the given code style.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 286281

8 years ago[LoopDistribute] Preserve GlobalsAA also in the new Pass Manager.
Davide Italiano [Tue, 8 Nov 2016 19:52:32 +0000 (19:52 +0000)]
[LoopDistribute] Preserve GlobalsAA also in the new Pass Manager.

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

llvm-svn: 286280

8 years agoRemove FormatContext from libClang as it is now unused.
Daniel Jasper [Tue, 8 Nov 2016 19:47:19 +0000 (19:47 +0000)]
Remove FormatContext from libClang as it is now unused.

llvm-svn: 286279

8 years agoDon't store Twine in a local variable.
Eli Friedman [Tue, 8 Nov 2016 19:43:56 +0000 (19:43 +0000)]
Don't store Twine in a local variable.

Fixes post-commit review comment from r286177.

llvm-svn: 286275

8 years ago[WebAssembly] Convert stackified IMPLICIT_DEF into constant 0.
Dan Gohman [Tue, 8 Nov 2016 19:40:38 +0000 (19:40 +0000)]
[WebAssembly] Convert stackified IMPLICIT_DEF into constant 0.

Since IMPLIFIT_DEF instructions are omitted in the output, when the output
of an IMPLICIT_DEF instruction is stackified, the resulting register lacks
an explicit push, leading to a push/pop mismatch. Fix this by converting
such IMPLICIT_DEFs into CONST_I32 0 instructions so that they have explicit
pushes.

llvm-svn: 286274

8 years ago[GlobalISel] Dump all instructions inserted by selector.
Ahmed Bougacha [Tue, 8 Nov 2016 19:27:13 +0000 (19:27 +0000)]
[GlobalISel] Dump all instructions inserted by selector.

This is helpful when multiple instructions are inserted.

llvm-svn: 286273

8 years ago[GlobalISel] Permit select() to erase.
Ahmed Bougacha [Tue, 8 Nov 2016 19:27:10 +0000 (19:27 +0000)]
[GlobalISel] Permit select() to erase.

Erasing reverse_iterators is problematic; iterate manually.
While there, keep track of the range of inserted instructions.
It can miss instructions inserted elsewhere, but those are harder
to track.

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

llvm-svn: 286272

8 years ago[LibcallsShrinkWrap] This pass doesn't preserve the CFG.
Davide Italiano [Tue, 8 Nov 2016 19:18:20 +0000 (19:18 +0000)]
[LibcallsShrinkWrap] This pass doesn't preserve the CFG.

For example, it invalidates the domtree, causing assertions
in later passes which need dominator infos. Make it preserve
GlobalsAA, as suggested by Eli.

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

llvm-svn: 286271

8 years agoFix typo in comment. NFC.
Chad Rosier [Tue, 8 Nov 2016 19:10:25 +0000 (19:10 +0000)]
Fix typo in comment. NFC.

llvm-svn: 286270

8 years agoCODE_OWNERS: Take ownership of the loop vectorizer.
Michael Kuperstein [Tue, 8 Nov 2016 18:44:40 +0000 (18:44 +0000)]
CODE_OWNERS: Take ownership of the loop vectorizer.

llvm-svn: 286269

8 years ago[SystemZ] Always use semantic instruction classes
Ulrich Weigand [Tue, 8 Nov 2016 18:37:48 +0000 (18:37 +0000)]
[SystemZ] Always use semantic instruction classes

Define a couple of additional semantic classes and use them
throughout the .td files to make them more consistent and
more easily readable.

No functional change.

llvm-svn: 286268

8 years ago[SystemZ] Refactor InstRR* instruction format patterns
Ulrich Weigand [Tue, 8 Nov 2016 18:36:31 +0000 (18:36 +0000)]
[SystemZ] Refactor InstRR* instruction format patterns

This changes the InstRR (and related) patterns to no longer
automatically add an "r" at the end of the mnemonic.  This
makes the .td files more obviously understandable, and also
allows using the patterns for those few instructions that
do not follow the *r scheme.

Also add some more sub-formats of the RRF format class, to
match operand names and sequence from the PoP better.

No functional change.

llvm-svn: 286267