platform/upstream/llvm.git
7 years ago[SimplifyCFG] Update workaround for PR30188 to also include loads
James Molloy [Wed, 7 Sep 2016 08:40:20 +0000 (08:40 +0000)]
[SimplifyCFG] Update workaround for PR30188 to also include loads

I should have realised this the first time around, but if we're avoiding sinking stores where the operands come from allocas so they don't create selects, we also have to do the same for loads because SROA will be just as defective looking at loads of selected addresses as stores.

Fixes PR30188 (again).

llvm-svn: 280792

7 years ago[CMake] Use CMake's default RPATH for the unit tests
Diana Picus [Wed, 7 Sep 2016 08:37:15 +0000 (08:37 +0000)]
[CMake] Use CMake's default RPATH for the unit tests

In the top-level CMakeLists.txt, we set CMAKE_BUILD_WITH_INSTALL_RPATH to ON,
and then for the unit tests we set it to <test>/../../lib. This works for tests
that live in unittest/<whatever>, but not for those that live in subdirectories
e.g. unittest/Transforms/IPO or unittest/ExecutionEngine/Orc. When building
with BUILD_SHARED_LIBRARIES, such tests don't manage to find their libraries.

Since the tests are run from the build directory, it makes sense to set their
RPATH for the build tree, rather than the install tree. This is the default in
CMake since 2.6, so all we have to do is set CMAKE_BUILD_WITH_INSTALL_RPATH to
OFF for the unit tests.

llvm-svn: 280791

7 years ago[SimplifyCFG] Check PHI uses more accurately
James Molloy [Wed, 7 Sep 2016 08:15:54 +0000 (08:15 +0000)]
[SimplifyCFG] Check PHI uses more accurately

PR30292 showed a case where our PHI checking wasn't correct. We were checking that all values were used by the same PHI before deciding to sink, but we weren't checking that the incoming values for that PHI were what we expected. As a result, we had to bail out after block splitting which caused us to never reach a steady state in SimplifyCFG.

Fixes PR30292.

llvm-svn: 280790

7 years ago[PowerPC] Fix address-offset folding for plain addi
Hal Finkel [Wed, 7 Sep 2016 07:36:11 +0000 (07:36 +0000)]
[PowerPC] Fix address-offset folding for plain addi

When folding an addi into a memory access that can take an immediate offset, we
were implicitly assuming that the existing offset was zero. This was incorrect.
If we're dealing with an addi with a plain constant, we can add it to the
existing offset (assuming that doesn't overflow the immediate, etc.), but if we
have anything else (i.e. something that will become a relocation expression),
we'll go back to requiring the existing immediate offset to be zero (because we
don't know what the requirements on that relocation expression might be - e.g.
maybe it is paired with some addis in some relevant way).

On the other hand, when dealing with a plain addi with a regular constant
immediate, the alignment restrictions (from the TOC base pointer, etc.) are
irrelevant.

I've added the test case from PR30280, which demonstrated the bug, but also
demonstrates a missed optimization opportunity (i.e. we don't need the memory
accesses at all).

Fixes PR30280.

llvm-svn: 280789

7 years agoSupport ABSOLUE keyword in symbol assignments
Eugene Leviant [Wed, 7 Sep 2016 07:08:43 +0000 (07:08 +0000)]
Support ABSOLUE keyword in symbol assignments

This patch allows making section defined symbols absolute:
.foo : {
  begin_foo = ABSOLUTE(.);
  *(.foo)
}

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

llvm-svn: 280788

7 years agoOpenCL: Defining __ENDIAN_LITTLE__ and fix target endianness
Matt Arsenault [Wed, 7 Sep 2016 07:08:02 +0000 (07:08 +0000)]
OpenCL: Defining __ENDIAN_LITTLE__ and fix target endianness

OpenCL requires __ENDIAN_LITTLE__ be set for little endian targets.
The default for targets was also apparently big endian, so AMDGPU
was incorrectly reported as big endian. Set this from the triple
so targets don't have another place to set the endianness.

llvm-svn: 280787

7 years agoFix whitespace issues
Matt Arsenault [Wed, 7 Sep 2016 07:07:59 +0000 (07:07 +0000)]
Fix whitespace issues

^M and extra space

llvm-svn: 280786

7 years agoAVX512F: FMA intrinsic + FNEG - sequence optimization
Elena Demikhovsky [Wed, 7 Sep 2016 06:54:28 +0000 (06:54 +0000)]
AVX512F: FMA intrinsic + FNEG - sequence optimization

The previous commit (r280368 - https://reviews.llvm.org/D23313) does not cover AVX-512F, KNL set.
FNEG(x) operation is lowered to (bitcast (vpxor (bitcast x), (bitcast constfp(0x80000000))).
It happens because FP XOR is not supported for 512-bit data types on KNL and we use integer XOR instead.
I added pattern match for integer XOR.

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

llvm-svn: 280785

7 years agoAMDGPU: Make some scalar instructions commutable
Matt Arsenault [Wed, 7 Sep 2016 06:25:55 +0000 (06:25 +0000)]
AMDGPU: Make some scalar instructions commutable

llvm-svn: 280784

7 years agoRemove unnecessary call to getAllocatableRegClass
Matt Arsenault [Wed, 7 Sep 2016 06:16:45 +0000 (06:16 +0000)]
Remove unnecessary call to getAllocatableRegClass

This reapplies r252565 and r252674, effectively reverting r252956.

This allows VS_32/VS_64 to be unallocatable like they should be.

llvm-svn: 280783

7 years ago[X86] Add hasSideEffects=0 to some instructions.
Craig Topper [Wed, 7 Sep 2016 04:46:15 +0000 (04:46 +0000)]
[X86] Add hasSideEffects=0 to some instructions.

llvm-svn: 280782

7 years ago[AVX-512] Add support for commuting masked instructions in findCommutedOpIndices...
Craig Topper [Wed, 7 Sep 2016 04:46:11 +0000 (04:46 +0000)]
[AVX-512] Add support for commuting masked instructions in findCommutedOpIndices. The default implementation doesn't skip the mask input or the preserved input.

llvm-svn: 280781

7 years agoAvoid compile error by giving the test type a user defined default constructor
Eric Fiselier [Wed, 7 Sep 2016 03:50:36 +0000 (03:50 +0000)]
Avoid compile error by giving the test type a user defined default constructor

llvm-svn: 280780

7 years agoFix PR#30303 - no matching function for call to '__ptr_in_range'
Marshall Clow [Wed, 7 Sep 2016 03:32:06 +0000 (03:32 +0000)]
Fix PR#30303 - no matching function for call to '__ptr_in_range'

llvm-svn: 280779

7 years agoRevert "CodeGen: ensure that libcalls are always AAPCS CC"
Saleem Abdulrasool [Wed, 7 Sep 2016 03:17:19 +0000 (03:17 +0000)]
Revert "CodeGen: ensure that libcalls are always AAPCS CC"

This reverts SVN r280683.  Revert until I figure out why this is breaking lli
tests.

llvm-svn: 280778

7 years agoImprove constexpr tests for std::any
Eric Fiselier [Wed, 7 Sep 2016 02:38:48 +0000 (02:38 +0000)]
Improve constexpr tests for std::any

llvm-svn: 280777

7 years agoFix clang's handling of the copy performed in the second phase of class
Richard Smith [Wed, 7 Sep 2016 02:14:33 +0000 (02:14 +0000)]
Fix clang's handling of the copy performed in the second phase of class
copy-initialization. We previously got this wrong in a couple of ways:
 - we only looked for copy / move constructors and constructor templates for
   this copy, and thus would fail to copy in cases where doing so should use
   some other constructor (but see core issue 670),
 - we mishandled the special case for disabling user-defined conversions that
   blocks infinite recursion through repeated application of a copy constructor
   (applying it in slightly too many cases) -- though as far as I can tell,
   this does not ever actually affect the result of overload resolution, and
 - we misapplied the special-case rules for constructors taking a parameter
   whose type is a (reference to) the same class type by incorrectly assuming
   that only happens for copy/move constructors (it also happens for
   constructors instantiated from templates and those inherited from base
   classes).

These changes should only affect strange corner cases (for instance, where the
copy constructor exists but has a non-const-qualified parameter type), so for
the most part it only causes us to produce more 'candidate' notes, but see the
test changes for other cases whose behavior is affected.

llvm-svn: 280776

7 years agoFix PR30260 - optional<const T> not working.
Eric Fiselier [Wed, 7 Sep 2016 01:56:07 +0000 (01:56 +0000)]
Fix PR30260 - optional<const T> not working.

This patch fixes PR30260 by using a (void*) cast on the placement argument
to placement new to casts away the const. See also http://llvm.org/PR30260.

As a drive by change this patch also changes the header guard for
<experimental/optional> to _LIBCPP_EXPERIMENTAL_OPTIONAL from _LIBCPP_OPTIONAL.

llvm-svn: 280775

7 years agoFix typo in comment, NFC
Nick Lewycky [Wed, 7 Sep 2016 01:49:41 +0000 (01:49 +0000)]
Fix typo in comment, NFC

llvm-svn: 280774

7 years agoEnable installation of libc++experimental by default.
Eric Fiselier [Wed, 7 Sep 2016 01:15:10 +0000 (01:15 +0000)]
Enable installation of libc++experimental by default.

When libc++experimental was originally created it was empty and therefore there
was no reason to install it. Now that the library contains
<experimental/memory_resource> and <experimental/filesystem> there is a good
reason to install it.

Specifically this patch enables the installation whenever LIBCXX_INSTALL_LIBRARY
is true and LIBCPP_ENABLE_EXPERIMENTAL_LIBRARY is true.

llvm-svn: 280773

7 years ago[LTO] Rename variables to be more explicative.
Davide Italiano [Wed, 7 Sep 2016 01:08:31 +0000 (01:08 +0000)]
[LTO] Rename variables to be more explicative.

Thanks to Mehdi for the suggestion!

llvm-svn: 280772

7 years agoImprove CMake output when registering benchmarks
Eric Fiselier [Wed, 7 Sep 2016 00:57:26 +0000 (00:57 +0000)]
Improve CMake output when registering benchmarks

llvm-svn: 280771

7 years ago[opt] Remove an unused argument to runPassPipeline().
Davide Italiano [Wed, 7 Sep 2016 00:48:47 +0000 (00:48 +0000)]
[opt] Remove an unused argument to runPassPipeline().

I have plans to use this API also in libLTO (and maybe lld).

llvm-svn: 280770

7 years agoRe-add "Make FieldList records print as a YAML sequence"
Zachary Turner [Tue, 6 Sep 2016 23:45:47 +0000 (23:45 +0000)]
Re-add "Make FieldList records print as a YAML sequence"

This was originally submitted in r280549, and reverted in r280577
due to breaking one MSVC buildbot.  The issue is that MSVC 2013
doesn't synthesize move constructors.  So even though i was
writing std::move(A) it was copying it, leading to a bogus ArrayRef.
The solution here is to simply remove the std::vector<> from the
type, since it is unused and unnecessary.  This way the ArrayRef
continues to point into the original memory backing the CVType.

llvm-svn: 280769

7 years ago[scan-build-py] Increase precision of timestamp in report directory name
Devin Coughlin [Tue, 6 Sep 2016 23:42:51 +0000 (23:42 +0000)]
[scan-build-py] Increase precision of timestamp in report directory name

This commit improves compatibility with the perl version of scan-build.

The perl version of scan-build produces output report directories with
increasing lexicographic ordering. This ordering is relied on by the CmpRuns.py
tool in utils/analyzer when comparing results for build commands with multiple
steps. That tool tries to line up the output directory for each step between
different runs of the analyzer based on the increasing directory name.

The python version of scan-build uses file.mkdtemp() with a time stamp
prefix to create report directories. The timestamp has a 1-second precision.
This means that when analysis of a single build step takes less than a second
the ordering property that CmpRuns.py expects will sometimes not hold,
depending on the timing and the random suffix generated by mkdtemp(). Ultimately
this causes CmpRuns to incorrectly correlate results from build steps and report
spurious differences between runs.

This commit increases the precision of the timestamp used in scan-build-py to
the microsecond level. This approach still has the same underlying issue -- but
in practice analysis of any build step is unlikely to take less than a
millisecond.

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

llvm-svn: 280768

7 years ago[DAGCombine] More fixups to SETCC legality checking (visitANDLike/visitORLike)
Hal Finkel [Tue, 6 Sep 2016 23:02:23 +0000 (23:02 +0000)]
[DAGCombine] More fixups to SETCC legality checking (visitANDLike/visitORLike)

I might have called this "r246507, the sequel". It fixes the same issue, as the
issue has cropped up in a few more places. The underlying problem is that
isSetCCEquivalent can pick up select_cc nodes with a result type that is not
legal for a setcc node to have, and if we use that type to create new setcc
nodes, nothing fixes that (and so we've violated the contract that the
infrastructure has with the backend regarding setcc node types).

Fixes PR30276.

For convenience, here's the commit message from r246507, which explains the
problem is greater detail:

[DAGCombine] Fixup SETCC legality checking

SETCC is one of those special node types for which operation actions (legality,
etc.) is keyed off of an operand type, not the node's value type. This makes
sense because the value type of a legal SETCC node is determined by its
operands' value type (via the TLI function getSetCCResultType). When the
SDAGBuilder creates SETCC nodes, it either creates them with an MVT::i1 value
type, or directly with the value type provided by TLI.getSetCCResultType.

The first problem being fixed here is that DAGCombine had several places
querying TLI.isOperationLegal on SETCC, but providing the return of
getSetCCResultType, instead of the operand type directly. This does not mean
what the author thought, and "luckily", most in-tree targets have SETCC with
Custom lowering, instead of marking them Legal, so these checks return false
anyway.

The second problem being fixed here is that two of the DAGCombines could create
SETCC nodes with arbitrary (integer) value types; specifically, those that
would simplify:

  (setcc a, b, op1) and|or (setcc a, b, op2) -> setcc a, b, op3
     (which is possible for some combinations of (op1, op2))

If the operands of the and|or node are actual setcc nodes, then this is not an
issue (because the and|or must share the same type), but, the relevant code in
DAGCombiner::visitANDLike and DAGCombiner::visitORLike actually calls
DAGCombiner::isSetCCEquivalent on each operand, and that function will
recognise setcc-like select_cc nodes with other return types. And, thus, when
creating new SETCC nodes, we need to be careful to respect the value-type
constraint. This is even true before type legalization, because it is quite
possible for the SELECT_CC node to have a legal type that does not happen to
match the corresponding TLI.getSetCCResultType type.

To be explicit, there is nothing that later fixes the value types of SETCC
nodes (if the type is legal, but does not happen to match
TLI.getSetCCResultType). Creating SETCCs with an MVT::i1 value type seems to
work only because, either MVT::i1 is not legal, or it is what
TLI.getSetCCResultType returns if it is legal. Fixing that is a larger change,
however. For the time being, restrict the relevant transformations to produce
only SETCC nodes with a value type matching TLI.getSetCCResultType (or MVT::i1
prior to type legalization).

Fixes PR24636.

llvm-svn: 280767

7 years agoSimplify a boolean expression by using the De Morgan's law.
Rui Ueyama [Tue, 6 Sep 2016 22:50:48 +0000 (22:50 +0000)]
Simplify a boolean expression by using the De Morgan's law.

llvm-svn: 280766

7 years ago[llvm-cov] Use colors consistently in the summary
Vedant Kumar [Tue, 6 Sep 2016 22:46:00 +0000 (22:46 +0000)]
[llvm-cov] Use colors consistently in the summary

Use the same color for counts and percentages. There doesn't seem to be
a reason for them to be different, and the summary looks more consistent
this way.

llvm-svn: 280765

7 years ago[llvm-cov] Clean up the summary class, delete dead code (NFC)
Vedant Kumar [Tue, 6 Sep 2016 22:45:57 +0000 (22:45 +0000)]
[llvm-cov] Clean up the summary class, delete dead code (NFC)

llvm-svn: 280764

7 years agoRevert "Fix tests on Windows."
Zachary Turner [Tue, 6 Sep 2016 22:40:11 +0000 (22:40 +0000)]
Revert "Fix tests on Windows."

This reverts commit 9b757b6e3946311802972409f38c6cefbea917b3.

This seems to cause strange breakages about on Ubuntu.

llvm-svn: 280763

7 years agoExplicitly require DominatorTreeAnalysis pass for instsimplify pass.
Dehao Chen [Tue, 6 Sep 2016 22:17:16 +0000 (22:17 +0000)]
Explicitly require DominatorTreeAnalysis pass for instsimplify pass.

Summary: DominatorTreeAnalysis is always required by instsimplify.

Reviewers: danielcdh, davidxl

Subscribers: llvm-commits

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

llvm-svn: 280760

7 years agoFix tests on Windows.
Zachary Turner [Tue, 6 Sep 2016 22:14:22 +0000 (22:14 +0000)]
Fix tests on Windows.

This wasn't actually a problem with the reformat, but rather a
problem with Visual Studio 2015 Update 3, which uses some c++14
features in its standard libraries.  So we had to change -std=c++11
to -std=c++14.

llvm-svn: 280759

7 years agoPut the LLVM_ALIGNAS directive in the right place.
Zachary Turner [Tue, 6 Sep 2016 22:02:06 +0000 (22:02 +0000)]
Put the LLVM_ALIGNAS directive in the right place.

llvm-svn: 280758

7 years agoMake LLDB compile on Windows after the reformat.
Zachary Turner [Tue, 6 Sep 2016 21:52:14 +0000 (21:52 +0000)]
Make LLDB compile on Windows after the reformat.

Most of these issues arose as a result of header re-ordering, but
it turned up a real bug, which is that MSVC doesn't support
__attribute__((packed)) or __attribute__((aligned)).  This was
working before because there's a Windows header that #defines
__attribute__(x) to nothing.  We should fix this by removing
that #define entirely, and dealing with the fallout separately
which may turn up even more bugs.

I fixed this by replacing them with the corresponding LLVM
macros which understand how to do these operations on all the
different compilers.

llvm-svn: 280757

7 years ago[llvm-cov] Add the project summary to the text coverage report for each source file.
Ying Yi [Tue, 6 Sep 2016 21:41:38 +0000 (21:41 +0000)]
[llvm-cov] Add the project summary to the text coverage report for each source file.

This patch is a spin-off from https://reviews.llvm.org/D23922. It extends the text view to preserve the same feature as the html view.

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

llvm-svn: 280756

7 years agoReorder FreeBSD Host.cpp #includes to fix build
Ed Maste [Tue, 6 Sep 2016 21:25:31 +0000 (21:25 +0000)]
Reorder FreeBSD Host.cpp #includes to fix build

llvm-svn: 280755

7 years agoTry 2 - Remove <cstdlib> include from `<exception>`
Eric Fiselier [Tue, 6 Sep 2016 21:25:27 +0000 (21:25 +0000)]
Try 2 - Remove <cstdlib> include from `<exception>`

This patch removes the `<cstdlib>` include from exception where it is no longer
needed. Unlike my previous attempt this patch also adds <cstdlib> where needed
in other headers like <new> and <typeinfo>.

This won't fix the Firefox build issues discussed on IRC but it is more correct
for libc++.

llvm-svn: 280754

7 years agoFix shared library build.
Rafael Espindola [Tue, 6 Sep 2016 21:06:55 +0000 (21:06 +0000)]
Fix shared library build.

llvm-svn: 280753

7 years agoRevert r280743 and r280745. Remove <cstdlib> include from `<exception>`
Eric Fiselier [Tue, 6 Sep 2016 21:06:41 +0000 (21:06 +0000)]
Revert r280743 and r280745. Remove <cstdlib> include from `<exception>`

Apparently I missed a number of additional include which need to be added.
Reverting so I can recommit as a single patch with all of the required includes.

llvm-svn: 280752

7 years ago*** This commit represents a complete reformatting of the LLDB source code
Kate Stone [Tue, 6 Sep 2016 20:57:50 +0000 (20:57 +0000)]
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style.  This kind of mass change has
*** two obvious implications:

Firstly, merging this particular commit into a downstream fork may be a huge
effort.  Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit.  The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):

    find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
    find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;

The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.

Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit.  There are alternatives available that will attempt
to look through this change and find the appropriate prior commit.  YMMV.

llvm-svn: 280751

7 years agoAvoid using alignas and constexpr.
Rafael Espindola [Tue, 6 Sep 2016 20:36:24 +0000 (20:36 +0000)]
Avoid using alignas and constexpr.

This requires removing the custom allocator, since Demangle cannot
depend on Support and so cannot use Compiler.h.

llvm-svn: 280750

7 years ago[AMDGPU] Wave and register controls
Konstantin Zhuravlyov [Tue, 6 Sep 2016 20:29:10 +0000 (20:29 +0000)]
[AMDGPU] Wave and register controls

- Add missing test

llvm-svn: 280749

7 years ago[CMake] Cleanup LLVM_OPTIMIZED_TABLEGEN
Chris Bieneman [Tue, 6 Sep 2016 20:27:07 +0000 (20:27 +0000)]
[CMake] Cleanup LLVM_OPTIMIZED_TABLEGEN

This cleanup removes the need for the native support library to have its own target. That target was only needed because makefile builds were tripping over each other if two tablegen targets were building at the same time. This causes problems because the parallel make invocations through CMake can't communicate with each other. This is fixed by invoking make directly instead of through CMake which is how we handle this in External Project invocations.

The other part of the cleanup is to mark the custom commands as USES_TERMINAL. This is a bit of a hack, but we need to ensure that Ninja generators don't invoke multiple tablegen targets in the same build dir in parallel, because that too would be bad.

Marking as USES_TERMINAL does have some downside for Ninja because it results in decreased parallelism, but correct builds are worth the minor loss and LLVM_OPTIMZIED_TABLEGEN is such a huge win, it is worth it.

llvm-svn: 280748

7 years ago[AMDGPU] Wave and register controls
Konstantin Zhuravlyov [Tue, 6 Sep 2016 20:22:28 +0000 (20:22 +0000)]
[AMDGPU] Wave and register controls

- Implemented amdgpu-flat-work-group-size attribute
- Implemented amdgpu-num-active-waves-per-eu attribute
- Implemented amdgpu-num-sgpr attribute
- Implemented amdgpu-num-vgpr attribute
- Dynamic LDS constraints are in a separate patch

Patch by Tom Stellard and Konstantin Zhuravlyov

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

llvm-svn: 280747

7 years agoTry to fix a circular dependency in the modules build.
Rafael Espindola [Tue, 6 Sep 2016 20:16:19 +0000 (20:16 +0000)]
Try to fix a circular dependency in the modules build.

llvm-svn: 280746

7 years agoAdd missing <cstdlib> include. Sorry about the bot breakage
Eric Fiselier [Tue, 6 Sep 2016 20:10:13 +0000 (20:10 +0000)]
Add missing <cstdlib> include. Sorry about the bot breakage

llvm-svn: 280745

7 years agoAMDGPU/SI: Teach SIInstrInfo::FoldImmediate() to fold immediates into copies
Tom Stellard [Tue, 6 Sep 2016 20:00:26 +0000 (20:00 +0000)]
AMDGPU/SI: Teach SIInstrInfo::FoldImmediate() to fold immediates into copies

Summary:
I put this code here, because I want to re-use it in a few other places.
This supersedes some of the immediate folding code we have in SIFoldOperands.
I think the peephole optimizers is probably a better place for folding
immediates into copies, since it does some register coalescing in the same time.

This will also make it easier to transition SIFoldOperands into a smarter pass,
where it looks at all uses of instruction at once to determine the optimal way to
fold operands.  Right now, the pass just considers one operand at a time.

Reviewers: arsenm

Subscribers: wdng, nhaehnle, arsenm, llvm-commits, kzhuravl

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

llvm-svn: 280744

7 years agoRemove unneeded includes in <exception> after removing __libcpp_throw
Eric Fiselier [Tue, 6 Sep 2016 19:56:40 +0000 (19:56 +0000)]
Remove unneeded includes in <exception> after removing __libcpp_throw

llvm-svn: 280743

7 years agoAMDGPU : Add XNACK feature to GPUs that support it.
Wei Ding [Tue, 6 Sep 2016 19:55:17 +0000 (19:55 +0000)]
AMDGPU : Add XNACK feature to GPUs that support it.

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

llvm-svn: 280742

7 years ago[include-fixer] Fix some Clang-tidy modernize-use-override and Include What You Use...
Eugene Zelenko [Tue, 6 Sep 2016 19:53:26 +0000 (19:53 +0000)]
[include-fixer] Fix some Clang-tidy modernize-use-override and Include What You Use warnings; other minor fixes.

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

llvm-svn: 280741

7 years agoFix ItaniumDemangle.cpp build with MSVC 2013
Reid Kleckner [Tue, 6 Sep 2016 19:39:56 +0000 (19:39 +0000)]
Fix ItaniumDemangle.cpp build with MSVC 2013

llvm-svn: 280740

7 years ago[llvm-cov] Add the "Go to first unexecuted line" feature.
Ying Yi [Tue, 6 Sep 2016 19:31:18 +0000 (19:31 +0000)]
[llvm-cov] Add the "Go to first unexecuted line" feature.

This patch provides easy navigation to find the zero count lines, especially useful when the source file is very large.

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

llvm-svn: 280739

7 years ago[SE] Rename PlatformInterfaces to PlatformDevice
Jason Henline [Tue, 6 Sep 2016 19:27:00 +0000 (19:27 +0000)]
[SE] Rename PlatformInterfaces to PlatformDevice

Summary:
The only interface that we ever plan to have in this file is
PlatformDevice, so it makes sense to rename the file to reflect that.

Reviewers: jprice

Subscribers: parallel_libs-commits

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

llvm-svn: 280737

7 years ago[AArch64] Adjust the scheduling model for Exynos M1.
Evandro Menezes [Tue, 6 Sep 2016 19:22:29 +0000 (19:22 +0000)]
[AArch64] Adjust the scheduling model for Exynos M1.

Further refine the model for branches.

llvm-svn: 280736

7 years ago[AArch64] Adjust the scheduling model for Exynos M1.
Evandro Menezes [Tue, 6 Sep 2016 19:22:27 +0000 (19:22 +0000)]
[AArch64] Adjust the scheduling model for Exynos M1.

Further refine the model for stores.

llvm-svn: 280735

7 years ago[AArch64] Adjust the scheduling model for Exynos M1.
Evandro Menezes [Tue, 6 Sep 2016 19:22:19 +0000 (19:22 +0000)]
[AArch64] Adjust the scheduling model for Exynos M1.

Further refine the model for loads.

llvm-svn: 280734

7 years agoUse the demangler in llvm.
Rafael Espindola [Tue, 6 Sep 2016 19:17:14 +0000 (19:17 +0000)]
Use the demangler in llvm.

llvm-svn: 280733

7 years agoAdd an c++ itanium demangler to llvm.
Rafael Espindola [Tue, 6 Sep 2016 19:16:48 +0000 (19:16 +0000)]
Add an c++ itanium demangler to llvm.

This adds a copy of the demangler in libcxxabi.

The code also has no dependencies on anything else in LLVM. To enforce
that I added it as another library. That way a BUILD_SHARED_LIBS will
fail if anyone adds an use of StringRef for example.

The no llvm dependency combined with the fact that this has to build
on linux, OS X and Windows required a few changes to the code. In
particular:

    No constexpr.
    No alignas

On OS X at least this library has only one global symbol:
__ZN4llvm16itanium_demangleEPKcPcPmPi

My current plan is:

    Commit something like this
    Change lld to use it
    Change lldb to use it as the fallback

    Add a few #ifdefs so that exactly the same file can be used in
    libcxxabi to export abi::__cxa_demangle.

Once the fast demangler in lldb can handle any names this
implementation can be replaced with it and we will have the one true
demangler.

llvm-svn: 280732

7 years agoclang-format: [JS] whitespace required between ! and as.
Martin Probst [Tue, 6 Sep 2016 18:55:34 +0000 (18:55 +0000)]
clang-format: [JS] whitespace required between ! and as.

Summary:
Before:
    x!as string
After:
    x! as string

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 280731

7 years agoclang-format: [JS] ignore comments when wrapping returns.
Martin Probst [Tue, 6 Sep 2016 18:39:30 +0000 (18:39 +0000)]
clang-format: [JS] ignore comments when wrapping returns.

Summary:
When code contains a comment between `return` and the value:

    return /* lengthy comment here */ (
        lengthyValueComesHere);

Do not wrap before the comment, as that'd break the code through JS' automatic
semicolon insertion.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 280730

7 years ago[ELF] Add support for -no-gc-sections flag
Petr Hosek [Tue, 6 Sep 2016 18:28:49 +0000 (18:28 +0000)]
[ELF] Add support for -no-gc-sections flag

This flag is supported by both BFD ld and gold and is occasionally
used to negate the effect of -gc-sections flag.

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

llvm-svn: 280729

7 years agoModules: Fix an assertion in DeclContext::buildLookup.
Manman Ren [Tue, 6 Sep 2016 18:16:54 +0000 (18:16 +0000)]
Modules: Fix an assertion in DeclContext::buildLookup.

When calling getMostRecentDecl, we can pull in more definitions from
a module. We call getPrimaryContext afterwards to make sure that
we buildLookup on a primary context.

rdar://27926200

llvm-svn: 280728

7 years agofix formatting; NFC
Sanjay Patel [Tue, 6 Sep 2016 18:16:31 +0000 (18:16 +0000)]
fix formatting; NFC

llvm-svn: 280727

7 years ago[MCTargetDesc] Delete dead code. Found by GCC7 -Wunused-function.
Davide Italiano [Tue, 6 Sep 2016 18:02:09 +0000 (18:02 +0000)]
[MCTargetDesc] Delete dead code. Found by GCC7 -Wunused-function.

Also unbreak newer gcc build with -Werror.

llvm-svn: 280726

7 years ago[Release notes] Fix links.
Eugene Zelenko [Tue, 6 Sep 2016 17:52:44 +0000 (17:52 +0000)]
[Release notes] Fix links.

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

llvm-svn: 280725

7 years agoAdd a comment.
Rui Ueyama [Tue, 6 Sep 2016 17:46:43 +0000 (17:46 +0000)]
Add a comment.

llvm-svn: 280724

7 years agoFix comment formatting for DebugInfoFlags.def
Victor Leschuk [Tue, 6 Sep 2016 17:22:48 +0000 (17:22 +0000)]
Fix comment formatting for DebugInfoFlags.def

llvm-svn: 280722

7 years agoUpdated .clang-format rules so bring LLDB in line with LLVM standards.
Kate Stone [Tue, 6 Sep 2016 17:19:00 +0000 (17:19 +0000)]
Updated .clang-format rules so bring LLDB in line with LLVM standards.

llvm-svn: 280721

7 years agobugpoint: Return Errors instead of passing around strings
Justin Bogner [Tue, 6 Sep 2016 17:18:22 +0000 (17:18 +0000)]
bugpoint: Return Errors instead of passing around strings

This replaces the threading of `std::string &Error` through all of
these APIs with checked Error returns instead. There are very few
places here that actually emit any errors right now, but threading the
APIs through will allow us to replace a bunch of exit(1)'s that are
scattered through this code with proper error handling.

This is more or less NFC, but does move around where a couple of error
messages are printed out.

llvm-svn: 280720

7 years ago[SE] Remove Platform*Handle classes
Jason Henline [Tue, 6 Sep 2016 17:07:22 +0000 (17:07 +0000)]
[SE] Remove Platform*Handle classes

Summary:
As pointed out by jprice, these classes don't serve a purpose. Instead,
we stay consistent with the way memory is managed and let the Stream and
Kernel classes directly hold opaque handles to device Stream and Kernel
instances, respectively.

Reviewers: jprice, jlebar

Subscribers: parallel_libs-commits

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

llvm-svn: 280719

7 years agoFormatting with clang-format patch r280701
Leny Kholodov [Tue, 6 Sep 2016 17:06:14 +0000 (17:06 +0000)]
Formatting with clang-format patch r280701

llvm-svn: 280718

7 years ago[RDF] Ignore undef use operands
Krzysztof Parzyszek [Tue, 6 Sep 2016 17:03:13 +0000 (17:03 +0000)]
[RDF] Ignore undef use operands

llvm-svn: 280717

7 years agoFormatting with clang-format patch r280700
Leny Kholodov [Tue, 6 Sep 2016 17:03:02 +0000 (17:03 +0000)]
Formatting with clang-format patch r280700

llvm-svn: 280716

7 years ago[SelectionDAG] Simplify extract_subvector( insert_subvector ( Vec, In, Idx ), Idx...
Simon Pilgrim [Tue, 6 Sep 2016 16:42:05 +0000 (16:42 +0000)]
[SelectionDAG] Simplify extract_subvector( insert_subvector ( Vec, In, Idx ), Idx ) -> In

If we are extracting a subvector that has just been inserted then we should just use the original inserted subvector.

This has come up in certain several x86 shuffle lowering cases where we are crossing 128-bit lanes.

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

llvm-svn: 280715

7 years agoAdd #include <cstdio> to unbreak build (missing definition of stderr)
Krzysztof Parzyszek [Tue, 6 Sep 2016 16:26:49 +0000 (16:26 +0000)]
Add #include <cstdio> to unbreak build (missing definition of stderr)

llvm-svn: 280714

7 years ago[JumpThreading] Only write back branch-weight MDs for blocks that originally had...
Adam Nemet [Tue, 6 Sep 2016 16:08:33 +0000 (16:08 +0000)]
[JumpThreading] Only write back branch-weight MDs for blocks that originally had PGO info

Currently the pass updates branch weights in the IR if the function has
any PGO info (entry frequency is set).  However we could still have
regions of the CFG that does not have branch weights collected (e.g. a
cold region).  In this case we'd use static estimates.  Since static
estimates for branches are determined independently, they are
inconsistent.  Updating them can "randomly" inflate block frequencies.

I've run into this in a completely cold loop of h264ref from
SPEC.  -Rpass-with-hotness showed the loop to be completely cold during
inlining (before JT) but completely hot during vectorization (after JT).

The new testcase demonstrate the problem.  We check array elements
against 1, 2 and 3 in a loop.  The check against 3 is the loop-exiting
check.  The block names should be self-explanatory.

In this example, jump threading incorrectly updates the weight of the
loop-exiting branch to 0, drastically inflating the frequency of the
loop (in the range of billions).

There is no run-time profile info for edges inside the loop, so branch
probabilities are estimated.  These are the resulting branch and block
frequencies for the loop body:

                check_1 (16)
            (8) /  |
            eq_1   | (8)
                \  |
                check_2 (16)
            (8) /  |
            eq_2   | (8)
                \  |
                check_3 (16)
            (1) /  |
       (loop exit) | (15)
                   |
              (back edge)

First we thread eq_1 -> check_2 to check_3.  Frequencies are updated to
remove the frequency of eq_1 from check_2 and then from the false edge
leaving check_2.  Changed frequencies are highlighted with * *:

                check_1 (16)
            (8) /  |
           eq_1~   | (8)
           /       |
          /     check_2 (*8*)
         /  (8) /  |
         \  eq_2   | (*0*)
          \     \  |
           ` --- check_3 (16)
            (1) /  |
       (loop exit) | (15)
                   |
              (back edge)

Next we thread eq_1 -> check_3 and eq_2 -> check_3 to check_1 as new
back edges.  Frequencies are updated to remove the frequency of eq_1 and
eq_3 from check_3 and then the false edge leaving check_3 (changed
frequencies are highlighted with * *):

                  check_1 (16)
              (8) /  |
             eq_1~   | (8)
             /       |
            /     check_2 (*8*)
           /  (8) /  |
          /-- eq_2~  | (*0*)
  (back edge)        |
                  check_3 (*0*)
            (*0*) /  |
         (loop exit) | (*0*)
                     |
                (back edge)

As a result, the loop exit edge ends up with 0 frequency which in turn makes
the loop header to have maximum frequency.

There are a few potential problems here:

1. The profile data seems odd.  There is a single profile sample of the
loop being entered.  On the other hand, there are no weights inside the
loop.

2. Based on static estimation we shouldn't set edges to "extreme"
values, i.e. extremely likely or unlikely.

3. We shouldn't create profile metadata that is calculated from static
estimation.  I am not sure what policy is but it seems to make sense to
treat profile metadata as something that is known to originate from
profiling.  Estimated probabilities should only be reflected in BPI/BFI.

Any one of these would probably fix the immediate problem.  I went for 3
because I think it's a good policy to have and added a FIXME about 2.

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

llvm-svn: 280713

7 years agoFix for Bindings/Go/go.test after patch r280700
Leny Kholodov [Tue, 6 Sep 2016 15:03:54 +0000 (15:03 +0000)]
Fix for Bindings/Go/go.test after patch r280700

llvm-svn: 280711

7 years ago[Sparc][Leon] Corrected supported atomics size for processors supporting Leon CASA...
Chris Dewhurst [Tue, 6 Sep 2016 14:41:09 +0000 (14:41 +0000)]
[Sparc][Leon] Corrected supported atomics size for processors supporting Leon CASA instruction back to 32 bits.

This was erroneously checked-in for 64 bits while trying to find if there was a way to get 64 bit atomicity in Leon processors. There is not and this change should not have been checked-in. There is no unit test for this as the existing unit tests test for behaviour to 32 bits, which was the original intention of the code.

llvm-svn: 280710

7 years agoMark R_GOTREL_FROM_END as a relative expression.
Rafael Espindola [Tue, 6 Sep 2016 13:57:15 +0000 (13:57 +0000)]
Mark R_GOTREL_FROM_END as a relative expression.

Fixes pr30282.

llvm-svn: 280709

7 years ago[ELF] - Linkerscript: implemented FILL command as alias for =fillexpr
George Rimar [Tue, 6 Sep 2016 13:51:57 +0000 (13:51 +0000)]
[ELF] - Linkerscript: implemented FILL command as alias for =fillexpr

Patch implements FILL just as alias for =fillexpr.
This allows to make implementation much shorted and simpler than D24186.

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

llvm-svn: 280708

7 years agoFixing an MSVC error from rL280692
Dimitar Vlahovski [Tue, 6 Sep 2016 12:48:10 +0000 (12:48 +0000)]
Fixing an MSVC error from rL280692

MSVC emits an error when one uses a const variable in a lambda without
capturing it.

gcc and clang don't emit an error in this scenario.

llvm-svn: 280707

7 years ago[mips] Tighten FastISel restrictions
Simon Dardis [Tue, 6 Sep 2016 12:36:24 +0000 (12:36 +0000)]
[mips] Tighten FastISel restrictions

LLVM PR/29052 highlighted that FastISel for MIPS attempted to lower
arguments assuming that it was using the paired 32bit registers to
perform operations for f64. This mode of operation is not supported
for MIPSR6.

This patch resolves the reported issue by adding additional checks
for unsupported floating point unit configuration.

Thanks to mike.k for reporting this issue!

Reviewers: seanbruno, vkalintiris

Differential Review: https://reviews.llvm.org/D23795

llvm-svn: 280706

7 years ago[PPC] Claim stack frame before storing into it, if no red zone is present
Krzysztof Parzyszek [Tue, 6 Sep 2016 12:30:00 +0000 (12:30 +0000)]
[PPC] Claim stack frame before storing into it, if no red zone is present

Unlike PPC64, PPC32/SVRV4 does not have red zone. In the absence of it
there is no guarantee that this part of the stack will not be modified
by any interrupt. To avoid this, make sure to claim the stack frame first
before storing into it.

This fixes https://llvm.org/bugs/show_bug.cgi?id=26519.

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

llvm-svn: 280705

7 years agoSecond round of fixups for r280692
Pavel Labath [Tue, 6 Sep 2016 11:08:02 +0000 (11:08 +0000)]
Second round of fixups for r280692

Android targets don't have std::to_string and std::stoul. Use llvm::to_string and strtoul
instead.

llvm-svn: 280704

7 years agoRevert "Intel(R) Memory Protection Extensions (Intel(R) MPX) support."
Dimitar Vlahovski [Tue, 6 Sep 2016 11:00:37 +0000 (11:00 +0000)]
Revert "Intel(R) Memory Protection Extensions (Intel(R) MPX) support."

This reverts commit rL280668 because the register tests fail on i386
Linux.

I investigated a little bit what causes the failure - there are missing
registers when running 'register read -a'.
This is the output I got at the bottom:
"""
...
Memory Protection Extensions:
      bnd0 = {0x0000000000000000 0x0000000000000000}
      bnd1 = {0x0000000000000000 0x0000000000000000}
      bnd2 = {0x0000000000000000 0x0000000000000000}
      bnd3 = {0x0000000000000000 0x0000000000000000}

unknown:
2 registers were unavailable.
"""

Also looking at the packets exchanged between the client and server:
"""
...
history[308] tid=0x7338 <  19> send packet: $qRegisterInfo4a#d7
history[309] tid=0x7338 < 130> read packet:
$name:bnd0;bitsize:128;offset:1032;encoding:vector;format:vector-uint64;set:Memory
Protection Extensions;ehframe:101;dwarf:101;#48
history[310] tid=0x7338 <  19> send packet: $qRegisterInfo4b#d8
history[311] tid=0x7338 < 130> read packet:
$name:bnd1;bitsize:128;offset:1048;encoding:vector;format:vector-uint64;set:Memory
Protection Extensions;ehframe:102;dwarf:102;#52
history[312] tid=0x7338 <  19> send packet: $qRegisterInfo4c#d9
history[313] tid=0x7338 < 130> read packet:
$name:bnd2;bitsize:128;offset:1064;encoding:vector;format:vector-uint64;set:Memory
Protection Extensions;ehframe:103;dwarf:103;#53
history[314] tid=0x7338 <  19> send packet: $qRegisterInfo4d#da
history[315] tid=0x7338 < 130> read packet:
$name:bnd3;bitsize:128;offset:1080;encoding:vector;format:vector-uint64;set:Memory
Protection Extensions;ehframe:104;dwarf:104;#54
history[316] tid=0x7338 <  19> send packet: $qRegisterInfo4e#db
history[317] tid=0x7338 <  76> read packet:
$name:bndcfgu;bitsize:64;offset:1096;encoding:vector;format:vector-uint8;#99
history[318] tid=0x7338 <  19> send packet: $qRegisterInfo4f#dc
history[319] tid=0x7338 <  78> read packet:
$name:bndstatus;bitsize:64;offset:1104;encoding:vector;format:vector-uint8;#8e
...
"""

The bndcfgu and bndstatus registers don't have the 'Memory Protections
Extension' set. I looked at the code and it seems that that is set
correctly.

So I'm not sure what's the problem or where does it come from.

Also there is a second failure related to something like this in the
tests:
"""
registerSet.GetName().lower()
"""

For some reason the registerSet.GetName() returns None.

llvm-svn: 280703

7 years ago[clang-cl] Check that we are in clang cl mode before enabling support for the CL...
Pierre Gousseau [Tue, 6 Sep 2016 10:48:27 +0000 (10:48 +0000)]
[clang-cl] Check that we are in clang cl mode before enabling support for the CL environment variable.

Checking for the type of the command line tokenizer should not be the criteria to enable support for the CL environment variable, this change checks that we are in clang-cl mode instead.

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

llvm-svn: 280702

7 years agoDebugInfo: use llvm::DINode::DIFlags type for debug info flags
Leny Kholodov [Tue, 6 Sep 2016 10:48:04 +0000 (10:48 +0000)]
DebugInfo: use llvm::DINode::DIFlags type for debug info flags

Use llvm::DINode::DIFlags type (strongly typed enum) for debug flags instead of unsigned int to avoid problems on platforms with sizeof(int) < 4: we already have flags with values > (1 << 16).

Patch by: Victor Leschuk <vleschuk@gmail.com>

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

llvm-svn: 280701

7 years agoDebugInfo: use strongly typed enum for debug info flags
Leny Kholodov [Tue, 6 Sep 2016 10:46:28 +0000 (10:46 +0000)]
DebugInfo: use strongly typed enum for debug info flags

Use ADT/BitmaskEnum for DINode::DIFlags for the following purposes:

Get rid of unsigned int for flags to avoid problems on platforms with sizeof(int) < 4
Flags are now strongly typed
Patch by: Victor Leschuk <vleschuk@gmail.com>

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

llvm-svn: 280700

7 years ago[OpenCL] Remove access qualifiers on images in arg info metadata.
Alexey Bader [Tue, 6 Sep 2016 10:10:28 +0000 (10:10 +0000)]
[OpenCL] Remove access qualifiers on images in arg info metadata.

Summary:
Remove access qualifiers on images in arg info metadata:
 * kernel_arg_type
 * kernel_arg_base_type

Image access qualifiers are inseparable from type in clang implementation,
but OpenCL spec provides a special query to get access qualifier
via clGetKernelArgInfo with CL_KERNEL_ARG_ACCESS_QUALIFIER.

Besides that OpenCL conformance test_api get_kernel_arg_info expects
image types without access qualifier.

Patch by Evgeniy Tyurin.

Reviewers: bader, yaxunl, Anastasia

Subscribers: cfe-commits

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

llvm-svn: 280699

7 years ago[RegisterScavenger] Remove aliasing registers of operands from the candidate set
Silviu Baranga [Tue, 6 Sep 2016 10:10:21 +0000 (10:10 +0000)]
[RegisterScavenger] Remove aliasing registers of operands from the candidate set

Summary:
In addition to not including the register operand of the current
instruction also don't include any aliasing registers. We can't consider
these as candidates because using them will clobber the corresponding
register operand of the current instruction.

This change doesn't include a test case and it would probably be difficult
to produce a stable one since the bug depends on the results of register
allocation.

Reviewers: MatzeB, qcolombet, hfinkel

Subscribers: hfinkel, llvm-commits

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

llvm-svn: 280698

7 years agoFix build breakage in r280692
Pavel Labath [Tue, 6 Sep 2016 10:04:22 +0000 (10:04 +0000)]
Fix build breakage in r280692

The commit introduced an array of const objects, which libstdc++ does not like. Make the object
non-const.

Also fix a compiler warning while I'm in there.

llvm-svn: 280697

7 years ago[AVX-512] Fix masked VPERMI2PS isel when the index comes from a bitcast.
Craig Topper [Tue, 6 Sep 2016 06:56:59 +0000 (06:56 +0000)]
[AVX-512] Fix masked VPERMI2PS isel when the index comes from a bitcast.

We need to bitcast the index operand to a floating point type so that it matches the result type. If not then the passthru part of the DAG will be a bitcast from the index's original type to the destination type. This makes it very difficult to match. The other option would be to add 5 sets of patterns for every other possible type.

llvm-svn: 280696

7 years ago[AVX-512] Add a test case to show that we don't select masked vpermi2ps when the...
Craig Topper [Tue, 6 Sep 2016 05:45:27 +0000 (05:45 +0000)]
[AVX-512] Add a test case to show that we don't select masked vpermi2ps when the index operand comes from a bitcast.

It doesn't work because we're looking for a bitcast from the v4i32 index operand to v4f32 for the passthru part of the DAG. But since the index is bitcasted from v2i64 and bitcasts fold, we actually have a bitcast from v2i64 to v4f32 in the passthru part of the DAG.

Taken from optimized output from clang's test case.

llvm-svn: 280695

7 years ago[X86] Remove unused encoding from IntrinsicType enum.
Craig Topper [Tue, 6 Sep 2016 05:45:24 +0000 (05:45 +0000)]
[X86] Remove unused encoding from IntrinsicType enum.

llvm-svn: 280694

7 years ago[X86] Fix indentation. NFC
Craig Topper [Tue, 6 Sep 2016 05:45:21 +0000 (05:45 +0000)]
[X86] Fix indentation. NFC

llvm-svn: 280693

7 years agoAdded the "frame diagnose" command and use its output to make crash info better.
Sean Callanan [Tue, 6 Sep 2016 04:48:36 +0000 (04:48 +0000)]
Added the "frame diagnose" command and use its output to make crash info better.

When a process stops due to a crash, we get the crashing instruction and the
crashing memory location (if there is one).  From the user's perspective it is
often unclear what the reason for the crash is in a symbolic sense.

To address this, I have added new fuctionality to StackFrame to parse the
disassembly and reconstruct the sequence of dereferneces and offsets that were
applied to a known variable (or fuction retrn value) to obtain the invalid
pointer.

This makes use of enhancements in the disassembler, as well as new information
provided by the DWARF expression infrastructure, and is exposed through a
"frame diagnose" command.  It is also used to provide symbolic information, when
available, in the event of a crash.

The algorithm is very rudimentary, and it needs a bunch of work, including
  - better parsing for assembly, preferably with help from LLVM
  - support for non-Apple platforms
  - cleanup of the algorithm core, preferably to make it all work in terms of
    Operands instead of register/offset pairs
  - improvement of the GetExpressioPath() logic to make prettier expression
    paths, and
  - better handling of vtables.
I welcome all suggestios, improvements, and testcases.

llvm-svn: 280692

7 years agoRevert "bugpoint: Stop threading errors through APIs that never fail"
Justin Bogner [Tue, 6 Sep 2016 04:45:37 +0000 (04:45 +0000)]
Revert "bugpoint: Stop threading errors through APIs that never fail"

This isn't the right thing to do - it turns out a number of the APIs
that "never fail" just exit(1) if something bad happens. We can and
should thread Error through this instead.

That diff will make more sense with this reverted. Sorry for the
noise.

This reverts r280690

llvm-svn: 280691

7 years agobugpoint: Stop threading errors through APIs that never fail
Justin Bogner [Tue, 6 Sep 2016 04:04:13 +0000 (04:04 +0000)]
bugpoint: Stop threading errors through APIs that never fail

This simplifies ListReducer and most of its subclasses by removing the
std::string &Error that was threaded through all of them but almost
never used. If we end up needing error handling in more places here we
can reinstate it using llvm::Error instead of these unwieldy strings.

The 2 cases (out of 12) that actually can hit the error cases are a
little bit awkward now, but those will clean up as I refactor this API
further.

llvm-svn: 280690

7 years agoARM: workaround bundled operation predication
Saleem Abdulrasool [Tue, 6 Sep 2016 04:00:12 +0000 (04:00 +0000)]
ARM: workaround bundled operation predication

This is a Windows ARM specific issue.  If the code path in the if conversion
ends up using a relocation which will form a IMAGE_REL_ARM_MOV32T, we end up
with a bundle to ensure that the mov.w/mov.t pair is not split up.  This is
normally fine, however, if the branch is also predicated, then we end up trying
to predicate the bundle.

For now, report a bundle as being unpredicatable.  Although this is false, this
would trigger a failure case previously anyways, so this is no worse.  That is,
there should not be any code which would previously have been if converted and
predicated which would not be now.

Under certain circumstances, it may be possible to "predicate the bundle".  This
would require scanning all bundle instructions, and ensure that the bundle
contains only predicatable instructions, and converting the bundle into an IT
block sequence.  If the bundle is larger than the maximal IT block length (4
instructions), it would require materializing multiple IT blocks from the single
bundle.

llvm-svn: 280689

7 years agoRevert "DebugInfo: use strongly typed enum for debug info flags"
Mehdi Amini [Tue, 6 Sep 2016 03:26:37 +0000 (03:26 +0000)]
Revert "DebugInfo: use strongly typed enum for debug info flags"

This reverts commit r280686, bots are broken.

llvm-svn: 280688