platform/upstream/llvm.git
7 years ago[LoopUnroll] Implement profile-based loop peeling
Michael Kuperstein [Wed, 30 Nov 2016 21:13:57 +0000 (21:13 +0000)]
[LoopUnroll] Implement profile-based loop peeling

This implements PGO-driven loop peeling.

The basic idea is that when the average dynamic trip-count of a loop is known,
based on PGO, to be low, we can expect a performance win by peeling off the
first several iterations of that loop.
Unlike unrolling based on a known trip count, or a trip count multiple, this
doesn't save us the conditional check and branch on each iteration. However,
it does allow us to simplify the straight-line code we get (constant-folding,
etc.). This is important given that we know that we will usually only hit this
code, and not the actual loop.

This is currently disabled by default.

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

llvm-svn: 288274

7 years ago[InstCombine] allow more narrowing transforms for logic ops
Sanjay Patel [Wed, 30 Nov 2016 20:48:54 +0000 (20:48 +0000)]
[InstCombine] allow more narrowing transforms for logic ops

We had a limited version of this for scalar 'and'; this expands
the transform to 'or' and 'xor' and allows vectors types too.

llvm-svn: 288273

7 years agoProspective MSVC workaround.
John McCall [Wed, 30 Nov 2016 20:46:55 +0000 (20:46 +0000)]
Prospective MSVC workaround.

llvm-svn: 288272

7 years agoRelease memory to OS only when the requested range covers the entire page
Evgeniy Stepanov [Wed, 30 Nov 2016 20:41:59 +0000 (20:41 +0000)]
Release memory to OS only when the requested range covers the entire page

Summary:
The current code was sometimes attempting to release huge chunks of
memory due to undesired RoundUp/RoundDown interaction when the requested
range is fully contained within one memory page.

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits

Patch by Aleksey Shlyapnikov.

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

llvm-svn: 288271

7 years ago[InstCombine] add tests to show potentially missed logic+trunc transforms; NFC
Sanjay Patel [Wed, 30 Nov 2016 20:20:49 +0000 (20:20 +0000)]
[InstCombine] add tests to show potentially missed logic+trunc transforms; NFC

llvm-svn: 288270

7 years agoFinish adopting ConstantInitBuilder in CGObjCGNU. NFC.
John McCall [Wed, 30 Nov 2016 20:19:46 +0000 (20:19 +0000)]
Finish adopting ConstantInitBuilder in CGObjCGNU.  NFC.

llvm-svn: 288269

7 years agoCODE_OWNERS: Take ownership of Loop Strenght Reduce.
Quentin Colombet [Wed, 30 Nov 2016 19:55:49 +0000 (19:55 +0000)]
CODE_OWNERS: Take ownership of Loop Strenght Reduce.

llvm-svn: 288268

7 years ago[Sema] Teach -Wcast-align to look at the aligned attribute of the
Akira Hatanaka [Wed, 30 Nov 2016 19:42:03 +0000 (19:42 +0000)]
[Sema] Teach -Wcast-align to look at the aligned attribute of the
declared variables.

Teach Sema to check the aligned attribute attached to variable
declarations so that it doesn't issue spurious warnings.

rdar://problem/26517471

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

llvm-svn: 288267

7 years ago[git-llvm] Use --force-interactive when commiting to enable SVN to prompt password
Mehdi Amini [Wed, 30 Nov 2016 19:12:53 +0000 (19:12 +0000)]
[git-llvm] Use --force-interactive when commiting to enable SVN to prompt password

When svn does not know the password and it has to prompt, it needs to query.
However it won't when invoked from the Python script and instead fails with:

svn: E215004: Authentication failed and interactive prompting is disabled; see the --force-interactive option

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

llvm-svn: 288266

7 years agoFix macro check for ABI breacking check: should use #if instead of #ifndef
Mehdi Amini [Wed, 30 Nov 2016 19:08:41 +0000 (19:08 +0000)]
Fix macro check for ABI breacking check: should use #if instead of #ifndef

llvm-svn: 288265

7 years ago[LibFuzzer] Split up some functions among different headers.
Zachary Turner [Wed, 30 Nov 2016 19:06:14 +0000 (19:06 +0000)]
[LibFuzzer] Split up some functions among different headers.

In an effort to get libfuzzer working on Windows, we need to make
a distinction between what functions require platform specific
code (e.g. different code on Windows vs Linux) and what code
doesn't.  IO functions, for example, tend to be platform
specific.

This patch separates out some of the functions which will need
to have platform specific implementations into different headers,
so that we can then provide different implementations for each
platform.

Aside from that, this patch contains no functional change.  It
is purely a re-organization.

Patch by Marcos Pividori
Differential Revision: https://reviews.llvm.org/D27230

llvm-svn: 288264

7 years ago[analyzer] Construct temporary objects of correct types, destroy them properly.
Artem Dergachev [Wed, 30 Nov 2016 19:02:44 +0000 (19:02 +0000)]
[analyzer] Construct temporary objects of correct types, destroy them properly.

When constructing a temporary object region, which represents the result of
MaterializeTemporaryExpr, track down the sub-expression for which the temporary
is necessary with a trick similar to the approach used in CodeGen, namely
by using Expr::skipRValueSubobjectAdjustments().

Then, create the temporary object region with type of that sub-expression.
That type would propagate further in a path-sensitive manner.

During destruction of lifetime-extened temporaries, consult the type of
the temporary object region, rather than the type of the lifetime-extending
variable, in order to call the correct destructor (fixes pr17001) and,
at least, not to crash by trying to call a destructor of a plain type
(fixes pr19539).

rdar://problem/29131302
rdar://problem/29131576

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

llvm-svn: 288263

7 years agoAMDGPU: Move mir tests into mir test directory
Matt Arsenault [Wed, 30 Nov 2016 18:50:26 +0000 (18:50 +0000)]
AMDGPU: Move mir tests into mir test directory

llvm-svn: 288262

7 years ago[InstCombine] update test to use FileCheck and auto-generate checks; NFC
Sanjay Patel [Wed, 30 Nov 2016 18:49:56 +0000 (18:49 +0000)]
[InstCombine] update test to use FileCheck and auto-generate checks; NFC

llvm-svn: 288261

7 years ago[analyzer] SValExplainer: Support ObjC ivars and __block variables.
Artem Dergachev [Wed, 30 Nov 2016 18:26:43 +0000 (18:26 +0000)]
[analyzer] SValExplainer: Support ObjC ivars and __block variables.

Additionally, explain the difference between normal and heap-based
symbolic regions.

llvm-svn: 288260

7 years ago[X86][SSE] Added tests showing missed combines of ANDs with shuffles.
Simon Pilgrim [Wed, 30 Nov 2016 18:15:10 +0000 (18:15 +0000)]
[X86][SSE] Added tests showing missed combines of ANDs with shuffles.

llvm-svn: 288259

7 years ago[clang-tidy] Make format style customizable
Jonas Devlieghere [Wed, 30 Nov 2016 18:06:42 +0000 (18:06 +0000)]
[clang-tidy] Make format style customizable

Summary: I came across an outstanding FIXME to make the format style customizable. Inspired by the include fixer, I added an new option `-style` to configure the fallback style in case no clang-format configuration file is found. The default remains "llvm".

Reviewers: Prazek, aaron.ballman, hokein, alexfh

Subscribers: cfe-commits, malcolm.parsons

Tags: #clang-tools-extra

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

llvm-svn: 288258

7 years ago[analyzer] Minor fixes and improvements to debug.ExprInspection
Artem Dergachev [Wed, 30 Nov 2016 17:57:18 +0000 (17:57 +0000)]
[analyzer] Minor fixes and improvements to debug.ExprInspection

- Fix the bug with transition handling in ExprInspectionChecker's
  checkDeadSymbols implementation.

- Test this bug by adding a new function clang_analyzer_numTimesReached() to
  catch number of passes through the code, which should be handy for testing
  against unintended state splits.

- Add two more functions should help debugging issues quickly without running
  the debugger or dumping exploded graphs - clang_analyzer_dump() which dump()s
  an SVal argument to a warning message, and clang_analyzer_printState(), which
  dump()s the current program state to stderr.

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

llvm-svn: 288257

7 years agoFix some Clang-tidy and Include What You Use warnings; other minor fixes (NFC).
Eugene Zelenko [Wed, 30 Nov 2016 17:48:10 +0000 (17:48 +0000)]
Fix some Clang-tidy and Include What You Use warnings; other minor fixes (NFC).

This preparation to remove SetVector.h dependency on SmallSet.h.

llvm-svn: 288256

7 years ago[scudo] 32-bit and hardware agnostic support
Kostya Kortchinsky [Wed, 30 Nov 2016 17:32:20 +0000 (17:32 +0000)]
[scudo] 32-bit and hardware agnostic support

Summary:
This update introduces i386 support for the Scudo Hardened Allocator, and
offers software alternatives for functions that used to require hardware
specific instruction sets. This should make porting to new architectures
easier.

Among the changes:
- The chunk header has been changed to accomodate the size limitations
  encountered on 32-bit architectures. We now fit everything in 64-bit. This
  was achieved by storing the amount of unused bytes in an allocation rather
  than the size itself, as one can be deduced from the other with the help
  of the GetActuallyAllocatedSize function. As it turns out, this header can
  be used for both 64 and 32 bit, and as such we dropped the requirement for
  the 128-bit compare and exchange instruction support (cmpxchg16b).
- Add 32-bit support for the checksum and the PRNG functions: if the SSE 4.2
  instruction set is supported, use the 32-bit CRC32 instruction, and in the
  XorShift128, use a 32-bit based state instead of 64-bit.
- Add software support for CRC32: if SSE 4.2 is not supported, fallback on a
  software implementation.
- Modify tests that were not 32-bit compliant, and expand them to cover more
  allocation and alignment sizes. The random shuffle test has been deactivated
  for linux-i386 & linux-i686 as the 32-bit sanitizer allocator doesn't
  currently randomize chunks.

Reviewers: alekseyshl, kcc

Subscribers: filcab, llvm-commits, tberghammer, danalbert, srhines, mgorny, modocache

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

llvm-svn: 288255

7 years ago[InstCombine] auto-generate checks for select+bitwise logic tests; NFC
Sanjay Patel [Wed, 30 Nov 2016 17:07:21 +0000 (17:07 +0000)]
[InstCombine] auto-generate checks for select+bitwise logic tests; NFC

llvm-svn: 288254

7 years ago[AArch64] Fix useful bits detection for BFM instructions
Silviu Baranga [Wed, 30 Nov 2016 17:04:22 +0000 (17:04 +0000)]
[AArch64] Fix useful bits detection for BFM instructions

Summary:
When computing useful bits for a BFM instruction, we need
to take into consideration the case where both operands
of the BFM are equal and provide data that we need to track.

Not doing this can cause us to miss useful bits.

Fixes PR31138 (https://llvm.org/bugs/show_bug.cgi?id=31138)

Reviewers: t.p.northover, jmolloy

Subscribers: evandro, gberry, srhines, pirama, mcrosier, aemerson, llvm-commits, rengolin

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

llvm-svn: 288253

7 years ago[WebAssembly] Add llvm-objdump support for wasm file format
Derek Schuff [Wed, 30 Nov 2016 16:49:11 +0000 (16:49 +0000)]
[WebAssembly] Add llvm-objdump support for wasm file format

This is the first part of an effort to add wasm binary
support across all llvm tools.

Patch by Sam Clegg

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

llvm-svn: 288251

7 years ago[X86][SSE] Add support for target shuffle constant folding
Simon Pilgrim [Wed, 30 Nov 2016 16:33:46 +0000 (16:33 +0000)]
[X86][SSE] Add support for target shuffle constant folding

Initial support for target shuffle constant folding in cases where all shuffle inputs are constant. We may be able to relax this and merge shuffles with only some constant inputs in the future.

I've added the helper function getTargetConstantBitsFromNode (based off a similar function in X86ShuffleDecodeConstantPool.cpp) that could be reused for other cases requiring constant vector extraction.

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

llvm-svn: 288250

7 years ago[LibFuzzer] Add macro flags for Posix and Windows.
Zachary Turner [Wed, 30 Nov 2016 16:32:54 +0000 (16:32 +0000)]
[LibFuzzer] Add macro flags for Posix and Windows.

This is the beginning of an effort to get libfuzzer working on
Windows.  This is a NFC to just add some macros for platform
detection on Windows.

Patch by Marcos Pividori
Differential Revision: https://reviews.llvm.org/D27229

llvm-svn: 288249

7 years ago[SelectionDAG] Refactor TargetLowering::expandMUL (NFC)
Nicolai Haehnle [Wed, 30 Nov 2016 16:26:33 +0000 (16:26 +0000)]
[SelectionDAG] Refactor TargetLowering::expandMUL (NFC)

Summary: Further preparation for the expansion of MUL_LOHI added in D24956.

Reviewers: efriedma, RKSimon

Subscribers: llvm-commits

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

llvm-svn: 288248

7 years agoFix handling of consecutive slashes in FileSpec::GetNormalizedPath()
Pavel Labath [Wed, 30 Nov 2016 16:08:45 +0000 (16:08 +0000)]
Fix handling of consecutive slashes in FileSpec::GetNormalizedPath()

The core of the function was actually handling them correctly. However, the
early exit was being too optimistic and did not give the function a chance to
fire if the path did not contain dots as well.

Fix that and add a couple of unit tests.

llvm-svn: 288247

7 years ago[Support] Use HAVE_DLOPEN to guard dlopen(3) usage
Pavel Labath [Wed, 30 Nov 2016 15:34:29 +0000 (15:34 +0000)]
[Support] Use HAVE_DLOPEN to guard dlopen(3) usage

Summary:
The usage was previously guarded by HAVE_DLFCN. This breaks on Android with
LLVM_BUILD_STATIC as the platform does not provide a static version of libdl.
Using HAVE_DLOPEN fixes it as the code will only get used if we are actually able
to link an executable using dlopen.

Reviewers: rafael, beanz

Subscribers: tberghammer, danalbert, llvm-commits

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

llvm-svn: 288246

7 years ago[AArch64] use exact checks; NFC
Sanjay Patel [Wed, 30 Nov 2016 15:00:43 +0000 (15:00 +0000)]
[AArch64] use exact checks; NFC

llvm-svn: 288245

7 years ago[include-fixer] Don't skip repeated lookups in plugin mode.
Benjamin Kramer [Wed, 30 Nov 2016 14:37:40 +0000 (14:37 +0000)]
[include-fixer] Don't skip repeated lookups in plugin mode.

In this mode not all the errors are fixed so it doesn't make sense to
ignore later ones.

llvm-svn: 288244

7 years ago[PowerPC] Preserve machine dominator tree in PPCVSXFMAMutate
Krzysztof Parzyszek [Wed, 30 Nov 2016 13:31:09 +0000 (13:31 +0000)]
[PowerPC] Preserve machine dominator tree in PPCVSXFMAMutate

It is needed by LiveIntervalAnalysis.

llvm-svn: 288243

7 years agoUpdated test with -verify-machineinstrs to check for PR21931
Simon Pilgrim [Wed, 30 Nov 2016 13:21:12 +0000 (13:21 +0000)]
Updated test with -verify-machineinstrs to check for PR21931

llvm-svn: 288242

7 years agoConvert most of the Process class to Timeout<>
Pavel Labath [Wed, 30 Nov 2016 11:56:32 +0000 (11:56 +0000)]
Convert most of the Process class to Timeout<>

This changes most of the class to use the new Timeout class. The one function
left is RunThreadPlan, which I left for a separate change as the function is
massive. A couple of things to call out:
- I've renamed the affected functions to match the listener interface names. This
  should also help catch any places I did not convert at compile time.
- I've deleted the WaitForState function as it was unused.

llvm-svn: 288241

7 years ago[X86][SSE] Add tests demonstrating missed opportunities to combine 64-bit element...
Simon Pilgrim [Wed, 30 Nov 2016 11:30:33 +0000 (11:30 +0000)]
[X86][SSE] Add tests demonstrating missed opportunities to combine 64-bit element unpacks with horizontal pair ops.

llvm-svn: 288240

7 years agoFix OSX build for r288238
Pavel Labath [Wed, 30 Nov 2016 11:09:47 +0000 (11:09 +0000)]
Fix OSX build for r288238

llvm-svn: 288239

7 years agoUse Timeout<> in the Listener class
Pavel Labath [Wed, 30 Nov 2016 10:41:42 +0000 (10:41 +0000)]
Use Timeout<> in the Listener class

Summary:
Communication classes use the Timeout<> class to specify the timeout. Listener
class was converted to chrono some time ago, but it used a different meaning for
a timeout of zero (Listener: infinite wait, Communication: no wait). Instead,
Listener provided separate functions which performed a non-blocking event read.

This converts the Listener class to the new Timeout class, to improve
consistency. It also allows us to get merge the different GetNextEvent*** and
WaitForEvent*** functions into one. No functional change intended.

Reviewers: jingham, clayborg, zturner

Subscribers: lldb-commits

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

llvm-svn: 288238

7 years agoRemove a spurious reference to ProcessElfCore
Pavel Labath [Wed, 30 Nov 2016 10:25:02 +0000 (10:25 +0000)]
Remove a spurious reference to ProcessElfCore

We were referencing a the process class from a register context, which seems
intuitively wrong. Also, the comment above that code is now definitely incorrect,
as ProcessElfCore now does support floating point registers. Also, the code
wasn't really doing anything, as it was just skipping a zero-initialization of a
field that was most likely zero-initialized anyway. Linux elf core FPR test still
passes after this.

llvm-svn: 288237

7 years agoRemove an x86-ism from RegisterInfoInterface
Pavel Labath [Wed, 30 Nov 2016 10:17:58 +0000 (10:17 +0000)]
Remove an x86-ism from RegisterInfoInterface

Summary:
While adding FPR support to x86 elf core files (D26300), we ended up adding a
very x86-specific function to the general RegisterInfoInterface class, which I
didn't catch in review. This removes that function. The only reason we needed
it was to find the offset of the FXSAVE area. This is the same as the offset of
the first register within that area, so we might as well use that.

Reviewers: clayborg, dvlahovski

Subscribers: lldb-commits

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

llvm-svn: 288236

7 years agoApply clang-tidy's 'performance-faster-string-find' check to LLVM.
Benjamin Kramer [Wed, 30 Nov 2016 10:01:11 +0000 (10:01 +0000)]
Apply clang-tidy's 'performance-faster-string-find' check to LLVM.

No functionality change intended.

llvm-svn: 288235

7 years ago[asan] Avoid redundant poisoning checks in __sanitizer_contiguous_container_find_bad_...
Maxim Ostapenko [Wed, 30 Nov 2016 09:11:47 +0000 (09:11 +0000)]
[asan] Avoid redundant poisoning checks in __sanitizer_contiguous_container_find_bad_address.

__sanitizer_contiguous_container_find_bad_address computes three regions of a
container to check for poisoning: begin, middle, end. The issue is that in current
design the first region can be significantly larger than kMaxRangeToCheck.

Proposed patch fixes a typo to calculate the first region properly.

Patch by Ivan Baravy.

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

llvm-svn: 288234

7 years agoRevert 'Test commit as per developer policy'
Jonas Devlieghere [Wed, 30 Nov 2016 08:24:43 +0000 (08:24 +0000)]
Revert 'Test commit as per developer policy'

llvm-svn: 288233

7 years agoTest commit as per developer policy
Jonas Devlieghere [Wed, 30 Nov 2016 08:06:23 +0000 (08:06 +0000)]
Test commit as per developer policy

llvm-svn: 288232

7 years agoProspective GCC build fix: the unelaborated form of this friend
John McCall [Wed, 30 Nov 2016 04:18:19 +0000 (04:18 +0000)]
Prospective GCC build fix: the unelaborated form of this friend
declaration should find the right type, assuming it's supported
evenly across all our hosts.

llvm-svn: 288231

7 years agomake -fprofile-instr-generate and -fprofile-instr-use work with clang-cl
Bob Haarman [Wed, 30 Nov 2016 03:25:36 +0000 (03:25 +0000)]
make -fprofile-instr-generate and -fprofile-instr-use work with clang-cl

Summary: Makes -fprofile-instr-generate and -fprofile-instr-use work
with clang-cl so that profile-guided optimization can be used.

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

llvm-svn: 288230

7 years agoSwitch CGObjCMac to use ConstantInitBuilder. Whew.
John McCall [Wed, 30 Nov 2016 02:39:18 +0000 (02:39 +0000)]
Switch CGObjCMac to use ConstantInitBuilder.  Whew.

Not strictly NFC because I did change the order of emission of
some global constants, but it shouldn't make any difference.

llvm-svn: 288229

7 years agoChange how we manage groups in ICF.
Rui Ueyama [Wed, 30 Nov 2016 01:50:03 +0000 (01:50 +0000)]
Change how we manage groups in ICF.

Previously, on each iteration in ICF, we scan the entire vector of
input sections to find boundaries of groups having the same ID.

This patch changes the algorithm so that we now have a vector of ranges.
Each range contains a starting index and an ending index of the group.
So we no longer have to search boundaries on each iteration.

Performance-wise, this seems neutral. Instead of searching boundaries,
we now have to maintain ranges. But I think this is more readable
than the previous implementation.

Moreover, this makes easy to parallelize the main loop of ICF,
which I'll do in a follow-up patch.

llvm-svn: 288228

7 years agoFix -Winconsistent-missing-override in CodeGenAction.cpp
Reid Kleckner [Wed, 30 Nov 2016 01:32:53 +0000 (01:32 +0000)]
Fix -Winconsistent-missing-override in CodeGenAction.cpp

llvm-svn: 288227

7 years agoRevert "[GVN] Basic optimization remark support"
Adam Nemet [Wed, 30 Nov 2016 01:14:35 +0000 (01:14 +0000)]
Revert "[GVN] Basic optimization remark support"

This reverts commit r288210.

The failure on the stage2 LTO build is back.

llvm-svn: 288226

7 years ago[RuntimeDyld] Skip undefined symbols when building the symbol table.
Lang Hames [Wed, 30 Nov 2016 01:12:07 +0000 (01:12 +0000)]
[RuntimeDyld] Skip undefined symbols when building the symbol table.

Storing these in the symbol table (with zero values) is just wasted space.

llvm-svn: 288225

7 years ago[asan] Allow re-exec in instrumented unit tests on Darwin (fix unit tests on macOS...
Kuba Mracek [Wed, 30 Nov 2016 00:46:04 +0000 (00:46 +0000)]
[asan] Allow re-exec in instrumented unit tests on Darwin (fix unit tests on macOS <=10.10)

This fixes https://llvm.org/bugs/show_bug.cgi?id=30285. On macOS 10.10 and lower, instrumented unit tests still need to be able to re-exec to make interceptors work.

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

llvm-svn: 288224

7 years agoFix formatting issue from r288207
Hans Wennborg [Wed, 30 Nov 2016 00:31:39 +0000 (00:31 +0000)]
Fix formatting issue from r288207

llvm-svn: 288223

7 years agoGive this test that uses Itanium mangling a triple
Reid Kleckner [Wed, 30 Nov 2016 00:31:16 +0000 (00:31 +0000)]
Give this test that uses Itanium mangling a triple

llvm-svn: 288222

7 years agoStop handling interesting deserialized decls after HandleTranslationUnit
Reid Kleckner [Wed, 30 Nov 2016 00:25:36 +0000 (00:25 +0000)]
Stop handling interesting deserialized decls after HandleTranslationUnit

Other AST consumers can deserialize interesting decls that we might
codegen, but they won't make it to the final object file and can trigger
assertions in debug information generation after finalization.

llvm-svn: 288221

7 years ago[c++1z] Improve support for -fno-exceptions: we can't just ignore exception
Richard Smith [Wed, 30 Nov 2016 00:13:55 +0000 (00:13 +0000)]
[c++1z] Improve support for -fno-exceptions: we can't just ignore exception
specifications in this mode in C++17, since they're part of the function type,
so check and diagnose them like we would if exceptions were enabled.

Better ideas welcome.

llvm-svn: 288220

7 years ago[PowerPC] Improvements for BUILD_VECTOR Vol. 2
Nemanja Ivanovic [Tue, 29 Nov 2016 23:57:54 +0000 (23:57 +0000)]
[PowerPC] Improvements for BUILD_VECTOR Vol. 2

This patch corresponds to review:
https://reviews.llvm.org/D26023

This patch adds support for converting a vector of loads into a single load if
the loads are consecutive (in either direction).

llvm-svn: 288219

7 years ago[PowerPC] Improvements for BUILD_VECTOR Vol. 2
Nemanja Ivanovic [Tue, 29 Nov 2016 23:36:03 +0000 (23:36 +0000)]
[PowerPC] Improvements for BUILD_VECTOR Vol. 2

This patch corresponds to review:
https://reviews.llvm.org/D25980

This is the 2nd patch in a series of 4 that improve the lowering and combining
for BUILD_VECTOR nodes on PowerPC. This particular patch combines a build vector
of fp-to-int conversions into an fp-to-int conversion of a build vector of fp
values. For example:
Converts (build_vector (fp_to_[su]i $A), (fp_to_[su]i $B), ...)
Into (fp_to_[su]i (build_vector $A, $B, ...))).
Which is a natural match for much cleaner code.

llvm-svn: 288218

7 years agoAdd another missing dependency.
Peter Collingbourne [Tue, 29 Nov 2016 23:22:55 +0000 (23:22 +0000)]
Add another missing dependency.

llvm-svn: 288217

7 years agoRevert r288212 due to lldb failure.
Paul Robinson [Tue, 29 Nov 2016 23:20:35 +0000 (23:20 +0000)]
Revert r288212 due to lldb failure.

llvm-svn: 288216

7 years ago[lanai] Manually match 0/-1 with R0/R1.
Jacques Pienaar [Tue, 29 Nov 2016 23:01:09 +0000 (23:01 +0000)]
[lanai] Manually match 0/-1 with R0/R1.

Summary: Previously 0 and -1 was matched via tablegen rules. But this could cause problems where a physical register was being used where a virtual register was expected (seen in optimizeSelect and TwoAddressInstructionPass). Instead follow AArch64 and match in DAGToDAGISel.

Reviewers: eliben, majnemer

Subscribers: llvm-commits, aemerson

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

llvm-svn: 288215

7 years agoRevert https://reviews.llvm.org/rL287679
Nemanja Ivanovic [Tue, 29 Nov 2016 23:00:33 +0000 (23:00 +0000)]
Revert https://reviews.llvm.org/rL287679

This commit caused some miscompiles that did not show up on any of the bots.
Reverting until we can investigate the cause of those failures.

llvm-svn: 288214

7 years agoFix some Clang-tidy and Include What You Use warnings; other minor fixes (NFC).
Eugene Zelenko [Tue, 29 Nov 2016 22:44:24 +0000 (22:44 +0000)]
Fix some Clang-tidy and Include What You Use warnings; other minor fixes (NFC).

This preparation to remove SetVector.h dependency on SmallSet.h.

llvm-svn: 288213

7 years agoEmit 'no line' information for interesting 'orphan' instructions.
Paul Robinson [Tue, 29 Nov 2016 22:41:16 +0000 (22:41 +0000)]
Emit 'no line' information for interesting 'orphan' instructions.

DWARF specifies that "line 0" really means "no appropriate source
location" in the line table.  Use this for branch targets and some
other cases that have no specified source location, to prevent
inheriting unfortunate line numbers from physically preceding
instructions (which might be from completely unrelated source).

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

llvm-svn: 288212

7 years ago[X86][AVX512VL] Improved testing of vcvtpd2ps, vcvtpd2dq/vcvtpd2udq and vcvttpd2dq...
Simon Pilgrim [Tue, 29 Nov 2016 22:38:30 +0000 (22:38 +0000)]
[X86][AVX512VL] Improved testing of vcvtpd2ps, vcvtpd2dq/vcvtpd2udq and vcvttpd2dq/vcvttpd2udq implicit zeroing of upper 64-bits of xmm result

Ensure that masked instruction doesn't assume implicit zeroing.

llvm-svn: 288211

7 years ago[GVN] Basic optimization remark support
Adam Nemet [Tue, 29 Nov 2016 22:37:01 +0000 (22:37 +0000)]
[GVN] Basic optimization remark support

[recommiting patches one-by-one to see which breaks the stage2 LTO bot]

Follow-on patches will add more interesting cases.

The goal of this patch-set is to get the GVN messages printed in
opt-viewer from Dhrystone as was presented in my Dev Meeting talk.  This
is the optimization view for the function (the last remark in the
function has a bug which is fixed in this series):
http://lab.llvm.org:8080/artifacts/opt-view_test-suite/build/SingleSource/Benchmarks/Dhrystone/CMakeFiles/dry.dir/html/_org_test-suite_SingleSource_Benchmarks_Dhrystone_dry.c.html#L430

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

llvm-svn: 288210

7 years ago[X86][AVX512DQVL] Improved testing of vcvtqq2ps/vcvtuqq2ps implicit zeroing of upper...
Simon Pilgrim [Tue, 29 Nov 2016 22:36:28 +0000 (22:36 +0000)]
[X86][AVX512DQVL] Improved testing of vcvtqq2ps/vcvtuqq2ps implicit zeroing of upper 64-bits of xmm result

Ensure that masked instruction doesn't assume implicit zeroing.

llvm-svn: 288209

7 years ago[c++1z] PR31210: ignore exception specification when matching the type of a
Richard Smith [Tue, 29 Nov 2016 22:32:05 +0000 (22:32 +0000)]
[c++1z] PR31210: ignore exception specification when matching the type of a
builtin with the type of an explicit declaration of the same function.

llvm-svn: 288208

7 years agoDon't try to merge DLL attributes on redeclaration of invalid decl (PR31069)
Hans Wennborg [Tue, 29 Nov 2016 22:31:00 +0000 (22:31 +0000)]
Don't try to merge DLL attributes on redeclaration of invalid decl (PR31069)

llvm-svn: 288207

7 years ago[AArch64] allow and-not-compare transform to form 'bics'
Sanjay Patel [Tue, 29 Nov 2016 22:28:58 +0000 (22:28 +0000)]
[AArch64] allow and-not-compare transform to form 'bics'

This target hook was added with D19087:
https://reviews.llvm.org/D19087

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

llvm-svn: 288206

7 years agoAdd documentation for the PDB Module Info stream.
Zachary Turner [Tue, 29 Nov 2016 22:14:56 +0000 (22:14 +0000)]
Add documentation for the PDB Module Info stream.

llvm-svn: 288205

7 years ago[Profile] Fix value profiler eviction bug
Xinliang David Li [Tue, 29 Nov 2016 22:00:54 +0000 (22:00 +0000)]
[Profile] Fix value profiler eviction bug

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

llvm-svn: 288204

7 years agogetObjCEncodingForMethodDecl cannot fail. Simplify. NFC.
John McCall [Tue, 29 Nov 2016 21:57:00 +0000 (21:57 +0000)]
getObjCEncodingForMethodDecl cannot fail.  Simplify.  NFC.

llvm-svn: 288203

7 years agoBitcode: Add a more comprehensive multi-module test now that we have both llvm-cat...
Peter Collingbourne [Tue, 29 Nov 2016 21:55:09 +0000 (21:55 +0000)]
Bitcode: Add a more comprehensive multi-module test now that we have both llvm-cat and llvm-modextract.

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

llvm-svn: 288202

7 years agoAdd llvm-modextract tool.
Peter Collingbourne [Tue, 29 Nov 2016 21:54:33 +0000 (21:54 +0000)]
Add llvm-modextract tool.

This program is for testing features that rely on multi-module bitcode files.
It takes a multi-module bitcode file, extracts one of the modules and writes
it to the output file.

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

llvm-svn: 288201

7 years ago[StructurizeCFG] Fix infinite loop in rebuildSSA.
Justin Lebar [Tue, 29 Nov 2016 21:49:02 +0000 (21:49 +0000)]
[StructurizeCFG] Fix infinite loop in rebuildSSA.

Michel Dänzer reported that r288051, "[StructurizeCFG] Use range-based
for loops", introduced a bug into rebuildSSA, wherein we were iterating
over an instruction's use list while modifying it, without taking care
to do this correctly.

llvm-svn: 288200

7 years agoAdd to llvm-objdump the -no-leading-headers option with the use of the -macho option.
Kevin Enderby [Tue, 29 Nov 2016 21:43:40 +0000 (21:43 +0000)]
Add to llvm-objdump the -no-leading-headers option with the use of the -macho option.

In some cases the leading headers of the file name, archive member and
architecture slice name in the output of lvm-objdump is not wanted so the
tool’s output can be directly used by scripts.  This matches the -X option
of the Apple otool(1) program.

rdar://28491674

llvm-svn: 288199

7 years agoAdd missing dependency.
Peter Collingbourne [Tue, 29 Nov 2016 21:02:19 +0000 (21:02 +0000)]
Add missing dependency.

llvm-svn: 288198

7 years agoDon't declare IsEnumDeclComplete as extern
Reid Kleckner [Tue, 29 Nov 2016 20:46:24 +0000 (20:46 +0000)]
Don't declare IsEnumDeclComplete as extern

Otherwise MSVC and clang-cl will see "extern inline" after merging
redeclarations and emit it in all TUs that include Type.h and Decl.h.

Noticed by inspection, since it's always the first thing to get emitted.

llvm-svn: 288197

7 years agoChange Error unittest to use the LLVM_ENABLE_ABI_BREAKING_CHECKS instead of NDEBUG
Mehdi Amini [Tue, 29 Nov 2016 20:45:48 +0000 (20:45 +0000)]
Change Error unittest to use the LLVM_ENABLE_ABI_BREAKING_CHECKS instead of NDEBUG

This is consistent with the header (after r288087) and fixes the
test for the configuration:
  -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF

llvm-svn: 288196

7 years agoBitcode: Introduce BitcodeWriter interface.
Peter Collingbourne [Tue, 29 Nov 2016 20:43:47 +0000 (20:43 +0000)]
Bitcode: Introduce BitcodeWriter interface.

This interface allows clients to write multiple modules to a single
bitcode file. Also introduce the llvm-cat utility which can be used
to create a bitcode file containing multiple modules.

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

llvm-svn: 288195

7 years ago[AArch64] Add a basic SchedMachineModel for Falkor.
Chad Rosier [Tue, 29 Nov 2016 20:00:27 +0000 (20:00 +0000)]
[AArch64] Add a basic SchedMachineModel for Falkor.

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

llvm-svn: 288194

7 years agoSupport constant expression evaluation for wchar_t versions of simple string
Richard Smith [Tue, 29 Nov 2016 19:45:17 +0000 (19:45 +0000)]
Support constant expression evaluation for wchar_t versions of simple string
functions, in order to support constexpr std::char_traits<wchar_t>.

llvm-svn: 288193

7 years agoUse CallSite to simplify code
David Blaikie [Tue, 29 Nov 2016 19:42:27 +0000 (19:42 +0000)]
Use CallSite to simplify code

llvm-svn: 288192

7 years agoAMDGPU: Disallow exec as SMEM instruction operand
Matt Arsenault [Tue, 29 Nov 2016 19:39:53 +0000 (19:39 +0000)]
AMDGPU: Disallow exec as SMEM instruction operand

This is not in the list of valid inputs for the encoding.
When spilling, copies from exec can be folded directly
into the spill instruction which results in broken
stores.

This only fixes the operand constraints, more codegen
work is required to avoid emitting the invalid
spills.

This sort of breaks the dbg.value test. Because the
register class of the s_load_dwordx2 changes, there
is a copy to SReg_64, and the copy is the operand
of dbg_value. The copy is later dead, and removed
from the dbg_value.

llvm-svn: 288191

7 years agoAMDGPU: Use SGPR_64 for argument lowerings
Matt Arsenault [Tue, 29 Nov 2016 19:39:48 +0000 (19:39 +0000)]
AMDGPU: Use SGPR_64 for argument lowerings

llvm-svn: 288190

7 years ago[LiveRangeEdit] Handle instructions with no defs correctly.
Geoff Berry [Tue, 29 Nov 2016 19:31:35 +0000 (19:31 +0000)]
[LiveRangeEdit] Handle instructions with no defs correctly.

Summary:
The code in LiveRangeEdit::eliminateDeadDef() that computes isOrigDef
doesn't handle instructions in which operand 0 is not a def (e.g. KILL)
correctly.  Add a check that operand 0 is a def before doing the rest of
the isOrigDef computation.

Reviewers: qcolombet, MatzeB, wmi

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 288189

7 years agoAMDGPU: Rename flat operands to match mubuf
Matt Arsenault [Tue, 29 Nov 2016 19:30:44 +0000 (19:30 +0000)]
AMDGPU: Rename flat operands to match mubuf

Use vaddr/vdst for the same purposes.

This also fixes a beg in SIInsertWaits for the
operand check. The stored value operand is currently called
data0 in the single offset case, not data.

llvm-svn: 288188

7 years agoAMDGPU: Use else if
Matt Arsenault [Tue, 29 Nov 2016 19:30:41 +0000 (19:30 +0000)]
AMDGPU: Use else if

llvm-svn: 288187

7 years ago[sanitizer] Add macOS minimum deployment target to all compiler invocations in lit...
Kuba Mracek [Tue, 29 Nov 2016 19:25:53 +0000 (19:25 +0000)]
[sanitizer] Add macOS minimum deployment target to all compiler invocations in lit tests

The Clang driver on macOS decides the deployment target based on various things, like your host OS version, the SDK version and some environment variables, which makes lit tests pass or fail based on your environment. Let's make sure we run all lit tests with `-mmacosx-version-min=${SANITIZER_MIN_OSX_VERSION}` (10.9 unless overriden).

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

llvm-svn: 288186

7 years agoAMDGPU: Materialize frame index before add
Matt Arsenault [Tue, 29 Nov 2016 19:20:48 +0000 (19:20 +0000)]
AMDGPU: Materialize frame index before add

It isn't generally safe to fold the frame index
directly into the operand since it will possibly
not be an inline immediate after it is expanded.

This surprisingly seems to produce better code, since
the FI doesn't prevent folding other immediate operands.

llvm-svn: 288185

7 years agoAMDGPU: Refactor immediate folding logic
Matt Arsenault [Tue, 29 Nov 2016 19:20:42 +0000 (19:20 +0000)]
AMDGPU: Refactor immediate folding logic

Change the logic for when to fold immediates to
consider the destination operand rather than the
source of the materializing mov instruction.

No change yet, but this will allow for correctly handling
i16/f16 operands. Since 32-bit moves are used to materialize
constants for these, the same bitvalue will not be in the
register.

llvm-svn: 288184

7 years ago[AArch64] add tests for bics; NFC
Sanjay Patel [Tue, 29 Nov 2016 19:15:27 +0000 (19:15 +0000)]
[AArch64] add tests for bics; NFC

llvm-svn: 288183

7 years agoUse StringRefZ explicitly instead of const char *.
Rui Ueyama [Tue, 29 Nov 2016 19:11:39 +0000 (19:11 +0000)]
Use StringRefZ explicitly instead of const char *.

This patch is to avoid an implicit conversion from const char * to
StringRefZ, to make it apparent where we are using StringRefZ.

llvm-svn: 288182

7 years agoAdd back some of the previous lldb-server dependencies
Pavel Labath [Tue, 29 Nov 2016 18:38:09 +0000 (18:38 +0000)]
Add back some of the previous lldb-server dependencies

It seems a debug build of lldb-server will not complete without these, as the
linker is not able to strip out code that aggressively. Add those back until I
can figure out how to break the dependency chains.

llvm-svn: 288181

7 years ago[AArch64] add tests to show select transforms; NFC
Sanjay Patel [Tue, 29 Nov 2016 18:35:04 +0000 (18:35 +0000)]
[AArch64] add tests to show select transforms; NFC

llvm-svn: 288180

7 years agoRevert "[GVN] Basic optimization remark support"
Adam Nemet [Tue, 29 Nov 2016 18:32:04 +0000 (18:32 +0000)]
Revert "[GVN] Basic optimization remark support"

This reverts commit r288046.

Trying to see if the revert fixes a compiler crash during a stage2 LTO
build with a GVN backtrace.

llvm-svn: 288179

7 years agoRevert "[GVN, OptDiag] Include the value that is forwarded in load elimination"
Adam Nemet [Tue, 29 Nov 2016 18:32:00 +0000 (18:32 +0000)]
Revert "[GVN, OptDiag] Include the value that is forwarded in load elimination"

This reverts commit r288047.

Trying to see if the revert fixes a compiler crash during a stage2 LTO
build with a GVN backtrace.

llvm-svn: 288178

7 years agoRevert "[GVN, OptDiag] Print the interesting instructions involved in missed load...
Adam Nemet [Tue, 29 Nov 2016 18:31:53 +0000 (18:31 +0000)]
Revert "[GVN, OptDiag] Print the interesting instructions involved in missed load-elimination"

This reverts commit r288090.

Trying to see if the revert fixes a compiler crash during a stage2 LTO
build with a GVN backtrace.

llvm-svn: 288177

7 years ago[AArch64] Fold spills of COPY of WZR/XZR
Geoff Berry [Tue, 29 Nov 2016 18:28:32 +0000 (18:28 +0000)]
[AArch64] Fold spills of COPY of WZR/XZR

Summary:
In AArch64InstrInfo::foldMemoryOperandImpl, catch more cases where the
COPY being spilled is copying from WZR/XZR, but the source register is
not in the COPY destination register's regclass.

For example, when spilling:

  %vreg0 = COPY %XZR ; %vreg0:GPR64common

without this change, the code in TargetInstrInfo::foldMemoryOperand()
and canFoldCopy() that normally handles cases like this would fail to
optimize since %XZR is not in GPR64common.  So the spill code generated
would be:

  %vreg0 = COPY %XZR
  STR %vreg

instead of the new code generated:

  STR %XZR

Reviewers: qcolombet, MatzeB

Subscribers: mcrosier, aemerson, t.p.northover, llvm-commits, rengolin

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

llvm-svn: 288176

7 years agoFix some Clang-tidy modernize-use-default and Include What You Use warnings; other...
Eugene Zelenko [Tue, 29 Nov 2016 18:24:01 +0000 (18:24 +0000)]
Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes (NFC).

This preparation to remove SetVector.h dependency on SmallSet.h.

llvm-svn: 288175

7 years agoFix some Clang-tidy modernize-use-default and Include What You Use warnings; other...
Eugene Zelenko [Tue, 29 Nov 2016 18:14:12 +0000 (18:14 +0000)]
Fix some Clang-tidy modernize-use-default and Include What You Use warnings; other minor fixes (NFC).

This preparation to remove SetVector.h dependency on SmallSet.h.

llvm-svn: 288174