OSDN Git Service

android-x86/external-llvm.git
7 years ago[DAGCombiner] mulhi + 1 never overflow.
Amaury Sechet [Wed, 1 Mar 2017 23:44:17 +0000 (23:44 +0000)]
[DAGCombiner] mulhi + 1 never overflow.

Summary:
This can be used to optimize large multiplications after legalization.

Depends on D29565

Reviewers: mkuper, spatel, RKSimon, zvi, bkramer, aaboud, craig.topper

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296711 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[GlobalISel] Add a way for targets to enable GISel.
Ahmed Bougacha [Wed, 1 Mar 2017 23:33:08 +0000 (23:33 +0000)]
[GlobalISel] Add a way for targets to enable GISel.

Until now, we've had to use -global-isel to enable GISel.  But using
that on other targets that don't support it will result in an abort, as we
can't build a full pipeline.
Additionally, we want to experiment with enabling GISel by default for
some targets: we can't just enable GISel by default, even among those
target that do have some support, because the level of support varies.

This first step adds an override for the target to explicitly define its
level of support.  For AArch64, do that using
a new command-line option (I know..):
  -aarch64-enable-global-isel-at-O=<N>
Where N is the opt-level below which GISel should be used.

Default that to -1, so that we still don't enable GISel anywhere.
We're not there yet!

While there, remove a couple LLVM_UNLIKELYs.  Building the pipeline is
such a cold path that in practice that shouldn't matter at all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296710 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoImprove mulhi overflow test. NFC
Amaury Sechet [Wed, 1 Mar 2017 23:31:19 +0000 (23:31 +0000)]
Improve mulhi overflow test. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296709 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Fix insert point for store rescheduling.
Eli Friedman [Wed, 1 Mar 2017 23:20:29 +0000 (23:20 +0000)]
[ARM] Fix insert point for store rescheduling.

In ARMPreAllocLoadStoreOpt::RescheduleOps, LastOp should be the last
operation which we want to merge. If we break out of the loop because
an operation has the wrong offset, we shouldn't use that operation as
LastOp.

This patch fixes some cases where we would sink stores for no reason.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296708 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd polly to svn:ignore.
Eli Friedman [Wed, 1 Mar 2017 23:16:35 +0000 (23:16 +0000)]
Add polly to svn:ignore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296705 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Check correct instructions for load/store rescheduling.
Eli Friedman [Wed, 1 Mar 2017 22:56:20 +0000 (22:56 +0000)]
[ARM] Check correct instructions for load/store rescheduling.

This code starts from the high end of the sorted vector of offsets, and
works backwards: it tries to find contiguous offsets, process them, then
pops them from the end of the vector. Most of the code agrees with this
order of processing, but one loop doesn't: it instead processes elements
from the low end of the vector (which are nodes with unrelated offsets).
Fix that loop to process the correct elements.

This has a few implications. One, we don't incorrectly return early when
processing multiple groups of offsets in the same block (which allows
rescheduling prera-ldst-insertpt.mir). Two, we pick the correct insert
point for loads, so they're correctly sorted (which affects the
scheduling of vldm-liveness.ll). I think it might also impact some of
the heuristics slightly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296701 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAGCombiner] fold binops with constant into select-of-constants
Sanjay Patel [Wed, 1 Mar 2017 22:51:31 +0000 (22:51 +0000)]
[DAGCombiner] fold binops with constant into select-of-constants

This is part of the ongoing attempt to improve select codegen for all targets and select
canonicalization in IR (see D24480 for more background). The transform is a subset of what
is done in InstCombine's FoldOpIntoSelect().

I first noticed a regression in the x86 avx512-insert-extract.ll tests with a patch that
hopes to convert more selects to basic math ops. This appears to be a general missing DAG
transform though, so I added tests for all standard binops in rL296621
(PowerPC was chosen semi-randomly; it has scripted FileCheck support, but so do ARM and x86).

The poor output for "sel_constants_shl_constant" is tracked with:
https://bugs.llvm.org/show_bug.cgi?id=32105

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296699 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Constant Hoisting] Avoid inserting instructions before EH pads
Reid Kleckner [Wed, 1 Mar 2017 22:41:12 +0000 (22:41 +0000)]
[Constant Hoisting] Avoid inserting instructions before EH pads

Now that terminators can be EH pads, this code needs to iterate over the
immediate dominators of the EH pad to find a valid insertion point.

Fix for PR32107

Patch by Robert Olliff!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296698 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[MC] Fix MachineLocation constructor broken in r294685 (NFC).
Eugene Zelenko [Wed, 1 Mar 2017 22:28:23 +0000 (22:28 +0000)]
[MC] Fix MachineLocation constructor broken in r294685 (NFC).

Problem spotted by Frej Drejhammar.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296697 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd test case for mulhi's overflow. NFC
Amaury Sechet [Wed, 1 Mar 2017 22:27:21 +0000 (22:27 +0000)]
Add test case for mulhi's overflow. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296696 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DebugInfo] [DWARFv5] Unique abbrevs for DIEs with different implicit_const values
Victor Leschuk [Wed, 1 Mar 2017 22:13:42 +0000 (22:13 +0000)]
[DebugInfo] [DWARFv5] Unique abbrevs for DIEs with different implicit_const values

Take DW_FORM_implicit_const attribute value into account when profiling
DIEAbbrevData.

Currently if we have two similar types with implicit_const attributes and
different values we end up with only one abbrev in .debug_abbrev section.
For example consider two structures: S1 with implicit_const attribute ATTR
and value VAL1 and S2 with implicit_const ATTR and value VAL2.
The .debug_abbrev section will contain only 1 related record:

[N] DW_TAG_structure_type       DW_CHILDREN_yes
        DW_AT_ATTR        DW_FORM_implicit_const  VAL1
        // ....

This is incorrect as struct S2 (with VAL2) will use abbrev record with VAL1.

With this patch we will have two different abbreviations here:

[N] DW_TAG_structure_type       DW_CHILDREN_yes
        DW_AT_ATTR        DW_FORM_implicit_const  VAL1
        // ....

[M] DW_TAG_structure_type       DW_CHILDREN_yes
        DW_AT_ATTR        DW_FORM_implicit_const  VAL2
        // ....

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296691 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAGCombiner] Remove non-ascii character and reflow comment.
Benjamin Kramer [Wed, 1 Mar 2017 22:10:43 +0000 (22:10 +0000)]
[DAGCombiner] Remove non-ascii character and reflow comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296690 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLIU:::Query: Query LiveRange instead of LiveInterval; NFC
Matthias Braun [Wed, 1 Mar 2017 21:48:12 +0000 (21:48 +0000)]
LIU:::Query: Query LiveRange instead of LiveInterval; NFC

- We only need the information from the base class, not the additional
  details in the LiveInterval class.
- Spread more `const`
- Some code cleanup

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296684 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoElide argument copies during instruction selection
Reid Kleckner [Wed, 1 Mar 2017 21:42:00 +0000 (21:42 +0000)]
Elide argument copies during instruction selection

Summary:
Avoids tons of prologue boilerplate when arguments are passed in memory
and left in memory. This can happen in a debug build or in a release
build when an argument alloca is escaped.  This will dramatically affect
the code size of x86 debug builds, because X86 fast isel doesn't handle
arguments passed in memory at all. It only handles the x86_64 case of up
to 6 basic register parameters.

This is implemented by analyzing the entry block before ISel to identify
copy elision candidates. A copy elision candidate is an argument that is
used to fully initialize an alloca before any other possibly escaping
uses of that alloca. If an argument is a copy elision candidate, we set
a flag on the InputArg. If the the target generates loads from a fixed
stack object that matches the size and alignment requirements of the
alloca, the SelectionDAG builder will delete the stack object created
for the alloca and replace it with the fixed stack object. The load is
left behind to satisfy any remaining uses of the argument value. The
store is now dead and is therefore elided. The fixed stack object is
also marked as mutable, as it may now be modified by the user, and it
would be invalid to rematerialize the initial load from it.

Supersedes D28388

Fixes PR26328

Reviewers: chandlerc, MatzeB, qcolombet, inglorion, hans

Subscribers: igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296683 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoNew tool: opt-stats.py
Adam Nemet [Wed, 1 Mar 2017 21:35:00 +0000 (21:35 +0000)]
New tool: opt-stats.py

I am planning to use this tool to find too noisy (missed) optimization
remarks.  Long term it may actually be better to just have another tool that
exports the remarks into an sqlite database and perform queries like this in
SQL.

This splits out the YAML parsing from opt-viewer.py into a new Python module
optrecord.py.

This is the result of the script on the LLVM testsuite:

Total number of remarks        714433

Top 10 remarks by pass:
  inline                         52%
  gvn                            24%
  licm                           13%
  loop-vectorize                  5%
  asm-printer                     3%
  loop-unroll                     1%
  regalloc                        1%
  inline-cost                     0%
  slp-vectorizer                  0%
  loop-delete                     0%

Top 10 remarks:
  gvn/LoadClobbered              20%
  inline/Inlined                 19%
  inline/CanBeInlined            18%
  inline/NoDefinition             9%
  licm/LoadWithLoopInvariantAddressInvalidated  6%
  licm/Hoisted                    6%
  asm-printer/InstructionCount    3%
  inline/TooCostly                3%
  gvn/LoadElim                    3%
  loop-vectorize/MissedDetails    2%

Beside some refactoring, I also changed optrecords not to use context to
access global data (max_hotness).  Because of the separate module this would
have required splitting context into two.  However it's not possible to access
the optrecord context from the SourceFileRenderer when calling back to
Remark.RelativeHotness.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296682 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRe-enable BinaryStreamTest.StreamReaderObject.
Zachary Turner [Wed, 1 Mar 2017 21:30:06 +0000 (21:30 +0000)]
Re-enable BinaryStreamTest.StreamReaderObject.

This was failing because I was using memcmp to compare two
objects that included padding bytes, which were uninitialized.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296681 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[APInt] Optimize APInt creation from uint64_t
Craig Topper [Wed, 1 Mar 2017 21:06:18 +0000 (21:06 +0000)]
[APInt] Optimize APInt creation from uint64_t

Summary:
This patch moves the clearUnusedBits calls into the two different initialization paths for APInt from a uint64_t. This allows the compiler to better optimize the clearing of the unused bits for the single word case. And it puts the clearing for the multi word case into the initSlowCase function to save code. In the common case of initializing with 0 this allows the clearing to be completely optimized out for the single word case.

On my local x86 build this is showing a ~45kb reduction in the size of the opt binary.

Reviewers: RKSimon, hans, majnemer, davide, MatzeB

Reviewed By: hans

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296677 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLIU::Query: Remove unused getter; NFC
Matthias Braun [Wed, 1 Mar 2017 21:02:56 +0000 (21:02 +0000)]
LIU::Query: Remove unused getter; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296676 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLIU::Query: Remove always false member+getter; NFC
Matthias Braun [Wed, 1 Mar 2017 21:02:52 +0000 (21:02 +0000)]
LIU::Query: Remove always false member+getter; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296675 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLiveIntervalUnion: Remove unused functions; NFC
Matthias Braun [Wed, 1 Mar 2017 21:02:47 +0000 (21:02 +0000)]
LiveIntervalUnion: Remove unused functions; NFC

Remove two unused functions that are in fact bad API and should not be
called anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296674 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] use -instnamer and auto-generate complete checks; NFC
Sanjay Patel [Wed, 1 Mar 2017 20:59:56 +0000 (20:59 +0000)]
[InstCombine] use -instnamer and auto-generate complete checks; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296673 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDisable BinaryStreamTest.StreamReaderObject.
Zachary Turner [Wed, 1 Mar 2017 20:58:28 +0000 (20:58 +0000)]
Disable BinaryStreamTest.StreamReaderObject.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296672 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] add vector tests for more coverage of D30502; NFC
Sanjay Patel [Wed, 1 Mar 2017 20:31:23 +0000 (20:31 +0000)]
[x86] add vector tests for more coverage of D30502; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296671 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoImprove scheduling with branch coalescing
Nemanja Ivanovic [Wed, 1 Mar 2017 20:29:34 +0000 (20:29 +0000)]
Improve scheduling with branch coalescing

This patch adds a MachineSSA pass that coalesces blocks that branch
on the same condition.

Committing on behalf of Lei Huang.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296670 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAG] Prevent Stale nodes from entering worklist
Nirav Dave [Wed, 1 Mar 2017 20:19:38 +0000 (20:19 +0000)]
[DAG] Prevent Stale nodes from entering worklist

Add check that deleted nodes do not get added to worklist. This can
occur when a node's operand is simplified to an existing node.

This fixes PR32108.

Reviewers: jyknight, hfinkel, chandlerc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296668 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd test cases for merging stores of multiply used stores
Nirav Dave [Wed, 1 Mar 2017 20:18:14 +0000 (20:18 +0000)]
Add test cases for merging stores of multiply used stores

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296667 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RDF] Replace {} with explicit constructor, since not all compilers like it
Krzysztof Parzyszek [Wed, 1 Mar 2017 19:59:28 +0000 (19:59 +0000)]
[RDF] Replace {} with explicit constructor, since not all compilers like it

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296666 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoNewGVN: Add debug counter for value numbering
Daniel Berlin [Wed, 1 Mar 2017 19:59:26 +0000 (19:59 +0000)]
NewGVN: Add debug counter for value numbering

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296665 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DWARF] Print leading zeros in type signature
Paul Robinson [Wed, 1 Mar 2017 19:43:29 +0000 (19:43 +0000)]
[DWARF] Print leading zeros in type signature

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296663 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RDF] Add recursion limit to getAllReachingDefsRec
Krzysztof Parzyszek [Wed, 1 Mar 2017 19:30:42 +0000 (19:30 +0000)]
[RDF] Add recursion limit to getAllReachingDefsRec

For large programs this function can take significant amounts of time.
Let it abort gracefully when the program is too complex.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296662 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PDB] Fix and re-enable BinaryStreamArray test.
Zachary Turner [Wed, 1 Mar 2017 19:29:11 +0000 (19:29 +0000)]
[PDB] Fix and re-enable BinaryStreamArray test.

This was due to the test stream choosing an arbitrary partition
index for introducing the discontinuity rather than choosing
an index that would be correctly aligned for the type of data.

Also added an assertion into FixedStreamArray so that this will
be caught on all bots in the future, and not just the UBSan bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296661 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReorder fields for better packing. (NFC)
Paul Robinson [Wed, 1 Mar 2017 19:26:41 +0000 (19:26 +0000)]
Reorder fields for better packing. (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296660 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoenable building with LTO on Windows using clang-cl and lld
Bob Haarman [Wed, 1 Mar 2017 19:22:18 +0000 (19:22 +0000)]
enable building with LTO on Windows using clang-cl and lld

Summary: With clang-cl gaining support for link-time optimization, we can now enable builds using LTO when using clang-cl and lld on Windows. To do this, we must not pass the -flto flag to the linker; lld-link does not understand it, but will perform LTO automatically when it encounters bitcode files. We also don't pass /Brepro when using LTO - the compiler doesn't generate object files for LTO, so passing the flag would only result in a warning about it being unused.

Reviewers: rnk, ruiu, hans

Reviewed By: hans

Subscribers: mgorny, mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296658 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAlphabetize some cases (NFC)
Paul Robinson [Wed, 1 Mar 2017 19:01:47 +0000 (19:01 +0000)]
Alphabetize some cases (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296655 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r296575 "[SLP] Fixes the bug due to absence of in order uses of scalars which...
Hans Wennborg [Wed, 1 Mar 2017 18:57:16 +0000 (18:57 +0000)]
Revert r296575 "[SLP] Fixes the bug due to absence of in order uses of scalars which needs to be available"

It caused miscompiles, e.g. in Chromium (PR32109).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296654 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DWARF] Default lower bound should respect requested DWARF version.
Paul Robinson [Wed, 1 Mar 2017 18:32:37 +0000 (18:32 +0000)]
[DWARF] Default lower bound should respect requested DWARF version.

DWARF may define a default lower-bound for arrays in languages defined
in a particular DWARF version.  But the logic to suppress an
unnecessary lower-bound attribute was looking at the hard-coded
default DWARF version, not the version that had been requested.

Also updated the list with all languages defined in DWARF v5.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296652 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAGCombiner] Support {a|s}ext, {a|z|s}ext load nodes in load combine
Artur Pilipenko [Wed, 1 Mar 2017 18:12:29 +0000 (18:12 +0000)]
[DAGCombiner] Support {a|s}ext, {a|z|s}ext load nodes in load combine

Resubmit r295336 after the bug with non-zero offset patterns on BE targets is fixed (r296336).

Support {a|s}ext, {a|z|s}ext load nodes as a part of load combine patters.

Reviewed By: filcab

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296651 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Fix testcase accidentally broken by r296645
Krzysztof Parzyszek [Wed, 1 Mar 2017 17:53:42 +0000 (17:53 +0000)]
[Hexagon] Fix testcase accidentally broken by r296645

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296647 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Fix lowering of formal arguments of type i1
Krzysztof Parzyszek [Wed, 1 Mar 2017 17:30:10 +0000 (17:30 +0000)]
[Hexagon] Fix lowering of formal arguments of type i1

On Hexagon, values of type i1 are passed in registers of type i32,
even though i1 is not a legal value for these registers. This is a
special case and needs special handling to maintain consistency of
the lowering information.

This fixes PR32089.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296645 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PDB] Re-add BinaryStreamTest.
Zachary Turner [Wed, 1 Mar 2017 17:22:36 +0000 (17:22 +0000)]
[PDB] Re-add BinaryStreamTest.

This re-adds all the binary stream tests.  This was reverted due
to some misaligned reads.  For now the offending test is
disabled while I investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296643 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[GVNHoist] Don't hoist unsafe scalars at -Oz (PR31729)
Hans Wennborg [Wed, 1 Mar 2017 17:15:08 +0000 (17:15 +0000)]
[GVNHoist] Don't hoist unsafe scalars at -Oz (PR31729)

Based on Aditya Kumar's patch:

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296642 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove unittests/DebugInfo/PDB/BinaryStreamTest.cpp (from r296555)
Vedant Kumar [Wed, 1 Mar 2017 17:10:03 +0000 (17:10 +0000)]
Remove unittests/DebugInfo/PDB/BinaryStreamTest.cpp (from r296555)

It breaks the ToT UBSan bots:

/Users/vk/Desktop/llvm/include/llvm/DebugInfo/MSF/BinaryStreamArray.h:246:12: runtime error: reference binding to misaligned address 0x7f925540939a for type 'const int', which requires 4 byte alignment
0x7f925540939a: note: pointer points here
 05 00  00 00 01 00 00 00 02 00  00 00 03 00 00 00 00 00  00 00 00 00 00 00 00 00  70 98 50 06 01 00
              ^
0  DebugInfoPDBTests                   0x0000000106263cbd llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 45
1  DebugInfoPDBTests                   0x00000001062628ff llvm::sys::RunSignalHandlers() + 159
2  DebugInfoPDBTests                   0x0000000106264593 SignalHandler(int) + 179
3  libsystem_platform.dylib            0x0000000107bb3fba _sigtramp + 26
4  libsystem_pthread.dylib             0x0000000107bd82c8 _pthread_keys + 9720
5  libsystem_c.dylib                   0x0000000107947f83 abort + 127
6  libclang_rt.ubsan_osx_dynamic.dylib 0x0000000106bb5fc2 __sanitizer::Abort() + 66
7  DebugInfoPDBTests                   0x000000010613f880 llvm::FixedStreamArrayIterator<int>::operator+=(long) + 0
8  DebugInfoPDBTests                   0x000000010613f615 llvm::FixedStreamArrayIterator<int>::operator*() const + 37
9  DebugInfoPDBTests                   0x000000010613f3cb std::__1::enable_if<__is_forward_iterator<llvm::FixedStreamArrayIterator<int> >::value, void>::type std::__1::vector<int, std::__1::allocator<int> >::__construct_at_end<llvm::FixedStreamArrayIterator<int> >(llvm::FixedStreamArrayIterator<int>, llvm::FixedStreamArrayIterator<int>, unsigned long) + 251
10 DebugInfoPDBTests                   0x000000010613f292 std::__1::vector<int, std::__1::allocator<int> >::vector<llvm::FixedStreamArrayIterator<int> >(llvm::FixedStreamArrayIterator<int>, std::__1::enable_if<(__is_forward_iterator<llvm::FixedStreamArrayIterator<int> >::value) && (is_constructible<int, std::__1::iterator_traits<llvm::FixedStreamArrayIterator<int> >::reference>::value), llvm::FixedStreamArrayIterator<int> >::type) + 226
11 DebugInfoPDBTests                   0x000000010613ddb7 std::__1::vector<int, std::__1::allocator<int> >::vector<llvm::FixedStreamArrayIterator<int> >(llvm::FixedStreamArrayIterator<int>, std::__1::enable_if<(__is_forward_iterator<llvm::FixedStreamArrayIterator<int> >::value) && (is_constructible<int, std::__1::iterator_traits<llvm::FixedStreamArrayIterator<int> >::reference>::value), llvm::FixedStreamArrayIterator<int> >::type) + 87
12 DebugInfoPDBTests                   0x000000010613d4af (anonymous namespace)::BinaryStreamTest_StreamReaderIntegerArray_Test::TestBody() + 1279
13 DebugInfoPDBTests                   0x00000001062780f3 testing::Test::Run() + 179
14 DebugInfoPDBTests                   0x0000000106279594 testing::TestInfo::Run() + 308
15 DebugInfoPDBTests                   0x000000010627a6a3 testing::TestCase::Run() + 307
16 DebugInfoPDBTests                   0x00000001062849d4 testing::internal::UnitTestImpl::RunAllTests() + 756
17 DebugInfoPDBTests                   0x0000000106284558 testing::UnitTest::Run() + 152
18 DebugInfoPDBTests                   0x0000000106266fa5 main + 117
19 libdyld.dylib                       0x00000001078506a5 start + 1
zsh: abort      ./unittests/DebugInfo/PDB/DebugInfoPDBTests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296641 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PDB] Remove use of std error codes.
Zachary Turner [Wed, 1 Mar 2017 17:02:41 +0000 (17:02 +0000)]
[PDB] Remove use of std error codes.

I already created a BinaryStreamError class for this purpose,
so update the code to use that on the remaining occurrences
of errc values.

This should also address the issue which led to r296583.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296640 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format r296631
Diana Picus [Wed, 1 Mar 2017 15:54:21 +0000 (15:54 +0000)]
clang-format r296631

Apparently I forgot to run it after fixing up some things...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296634 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] GlobalISel: Lower call params that need extensions
Diana Picus [Wed, 1 Mar 2017 15:35:14 +0000 (15:35 +0000)]
[ARM] GlobalISel: Lower call params that need extensions

Lower i1, i8 and i16 call parameters by extending them before storing them on
the stack. Also make sure we encode the correct, extended size in the
corresponding memory operand, and that we compute the correct stack size in the
end.

The latter is a bit more complicated because we used to compute the stack size
in the getStackAddress method, based on the Size and Offset of the parameters.
However, if the last parameter is sign extended, we'd be using the wrong,
non-extended size, and we'd end up with a smaller stack than we need to hold the
extended value. Instead of hacking this up based on the value of Size in
getStackAddress, we move our stack size handling logic to assignArg, where we
have access to the CCState which knows everything we could possibly want to know
about the stack. This way we don't need to duplicate any knowledge or resort to
any ugly hacks.

On this same occasion, update the IRTranslator test to check the sizes of the
stores everywhere, not just for sign extended paramteres.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296631 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] auto-generate checks; NFC
Sanjay Patel [Wed, 1 Mar 2017 14:46:59 +0000 (14:46 +0000)]
[x86] auto-generate checks; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296629 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] regenerate checks; NFC
Sanjay Patel [Wed, 1 Mar 2017 14:41:57 +0000 (14:41 +0000)]
[x86] regenerate checks; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296628 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DeadStoreElimination] Check function modref behavior before considering memory clobbered
Igor Laevsky [Wed, 1 Mar 2017 14:38:29 +0000 (14:38 +0000)]
[DeadStoreElimination] Check function modref behavior before considering memory clobbered

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296625 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[mips] Drop unneeded REQUIRES line in test. NFCI
Simon Dardis [Wed, 1 Mar 2017 14:31:09 +0000 (14:31 +0000)]
[mips] Drop unneeded REQUIRES line in test. NFCI

rL296111 provides the proper fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296622 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PPC] add tests for select-of-constants with binop; NFC
Sanjay Patel [Wed, 1 Mar 2017 14:26:49 +0000 (14:26 +0000)]
[PPC] add tests for select-of-constants with binop; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296621 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[BasicAA] Take attributes into account when requesting modref info for a call site
Igor Laevsky [Wed, 1 Mar 2017 13:19:51 +0000 (13:19 +0000)]
[BasicAA] Take attributes into account when requesting modref info for a call site

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296617 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SLP] Preserve IR flags when vectorizing horizontal reductions.
Alexey Bataev [Wed, 1 Mar 2017 12:43:39 +0000 (12:43 +0000)]
[SLP] Preserve IR flags when vectorizing horizontal reductions.

Summary:
The SLP vectorizer should propagate IR-level optimization hints/flags
(nsw, nuw, exact, fast-math) when converting scalar horizontal
reductions instructions into vectors, just like for other vectorized
instructions.
It doe not include IR propagation for extra arguments, we need to handle
original scalar operations for extra args to propagate correct flags.

Reviewers: mkuper, mzolotukhin, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296614 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SLP] Preserve IR flags for extra args.
Alexey Bataev [Wed, 1 Mar 2017 12:22:33 +0000 (12:22 +0000)]
[SLP] Preserve IR flags for extra args.

Summary:
We should preserve IR flags for extra args. These IR flags should be
taken from original scalar operations, not from the reduction
operations.

Reviewers: mkuper, mzolotukhin, hfinkel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296613 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Fix bash-ism in test
Oliver Stannard [Wed, 1 Mar 2017 11:11:06 +0000 (11:11 +0000)]
[ARM] Fix bash-ism in test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296610 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Fix parsing of special register masks
Oliver Stannard [Wed, 1 Mar 2017 10:51:04 +0000 (10:51 +0000)]
[ARM] Fix parsing of special register masks

This parsing code was incorrectly checking for invalid characters, so an
invalid instruction like:
  msr spsr_w, r0
would be emitted as:
  msr spsr_cxsf, r0

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296607 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SLP] Fix for PR32038: extra add of PHI node when it is not required.
Alexey Bataev [Wed, 1 Mar 2017 10:50:44 +0000 (10:50 +0000)]
[SLP] Fix for PR32038: extra add of PHI node when it is not required.

Summary:
If horizontal reduction tree starts from the binary operation that is
used in PHI node, but this PHI is not used in horizontal reduction, we
may end up with extra addition of this PHI node after vectorization.
Here is an example:
```
%phi = phi i32 [ %tmp, %end], ...
...
%tmp = add i32 %tmp1, %tmp2
end:
```
after vectorization we always have something like:

```
%phi = phi i32 [ %tmp, %end], ...
...
%red = extractelement <8 x 32> %vec.red, 0
%tmp = add i32 %red, %phi
end:
```
even if `%phi` is not used in reduction tree. Patch considers these PHI
nodes as extra arguments and considers them in the final result iff they
really used in reduction.

Reviewers: mkuper, hfinkel, mzolotukhin

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296606 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Fix creating vreg def after use.
Ayman Musa [Wed, 1 Mar 2017 10:20:48 +0000 (10:20 +0000)]
[X86] Fix creating vreg def after use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296601 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoProcess tilde in llvm::sys::path::native
Serge Pavlov [Wed, 1 Mar 2017 09:38:15 +0000 (09:38 +0000)]
Process tilde in llvm::sys::path::native

Windows does not treat `~` as a reference to home directory, so the call
to `llvm::sys::path::native` on, say, `~/somedir` produces `~\somedir`,
which has different meaning than the original path. With this change
tilde is expanded on Windows to user profile directory. Such behavior
keeps original meaning of the path and is consistent with the algorithm
of `llvm::sys::path::home_directory`.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296590 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove sometimes faulty rewrite of memcpy in instcombine.
Mikael Holmen [Wed, 1 Mar 2017 06:45:20 +0000 (06:45 +0000)]
Remove sometimes faulty rewrite of memcpy in instcombine.

Summary:
Solves PR 31990.

The bad rewrite could replace a memcpy of one word with
 store i4 -1
while it should actually be
 store i8 -1

Hopefully opt and llc has improved enough so the original optimization
done by the code isn't needed anymore.

One already existing testcase is affected. It originally tested that
the memcpy was replaced with
 load double
but since we now remove that rewrite it will be
 load i64
instead.

Patch suggestion by Eli Friedman.

Reviewers: eli.friedman, majnemer, efriedma

Reviewed By: efriedma

Subscribers: efriedma, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296585 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago(Rewroking r296581) PDB/BinaryStreamTest.cpp: Appease mingw to avoid std::errc::no_bu...
NAKAMURA Takumi [Wed, 1 Mar 2017 05:11:41 +0000 (05:11 +0000)]
(Rewroking r296581) PDB/BinaryStreamTest.cpp: Appease mingw to avoid std::errc::no_buffer_space.

Unfortunately, mingw's libstdc++ doesn't provide winsock2 errors.
That said, we should avoid raising OS-oriented error code in our code.

For now, I suggest to define custom error from std::error_category.
See also; https://reviews.llvm.org/D20592

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296583 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r296581, "PDB/BinaryStreamTest.cpp: Appease mingw to avoid std::errc::no_buffe...
NAKAMURA Takumi [Wed, 1 Mar 2017 05:11:37 +0000 (05:11 +0000)]
Revert r296581, "PDB/BinaryStreamTest.cpp: Appease mingw to avoid std::errc::no_buffer_space."

Wrong commit -- I have unstaged changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296582 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPDB/BinaryStreamTest.cpp: Appease mingw to avoid std::errc::no_buffer_space.
NAKAMURA Takumi [Wed, 1 Mar 2017 05:06:31 +0000 (05:06 +0000)]
PDB/BinaryStreamTest.cpp: Appease mingw to avoid std::errc::no_buffer_space.

Unfortunately, mingw's libstdc++ doesn't provide winsock2 errors.
That said, we should avoid raising OS-oriented error code in our code.

For now, I suggest to define custom error from std::error_category.
See also; https://reviews.llvm.org/D20592

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296581 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LV] These remark should have been missed remarks
Adam Nemet [Wed, 1 Mar 2017 04:31:15 +0000 (04:31 +0000)]
[LV] These remark should have been missed remarks

The practice in LV is that we emit analysis remarks and then finally report
either a missed or applied remark on the final decision whether vectorization
is taking place.  On this code path, we were closing with an analysis remark.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296578 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SLP] Fixes the bug due to absence of in order uses of scalars which needs to be...
Mohammad Shahid [Wed, 1 Mar 2017 03:51:54 +0000 (03:51 +0000)]
[SLP] Fixes the bug due to absence of in order uses of scalars which needs to be available
for VectorizeTree() API.This API uses it for proper mask computation to be used in shufflevector IR.
The fix is to compute the mask for out of order memory accesses while building the vectorizable tree
instead of actual vectorization of vectorizable tree.

Reviewers: mkuper

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

Change-Id: Id1e287f073fa4959713ba545fa4254db5da8b40d

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296575 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Re-do update for branch-relaxation test
Matt Arsenault [Wed, 1 Mar 2017 03:36:04 +0000 (03:36 +0000)]
AMDGPU: Re-do update for branch-relaxation test

Modify the test so that it is still testing something
closer to what it was intended to originally.

I think the original intent was to test the situation where
there was a branch on execz and then unconditional branch
required relaxing.With the change in r296539,
there was no longer and execz branch.

Change the test so that there is now an execz branch inserted.
There is no longer an unconditional branch after the execz branch,
so this might need to be tricked in some other way to keep that
there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296574 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format GenericDomTreeConstruction.h, since the current formatting makes it...
Daniel Berlin [Wed, 1 Mar 2017 02:50:46 +0000 (02:50 +0000)]
clang-format GenericDomTreeConstruction.h, since the current formatting makes it look like their is a bug in the loop indentation, and there is not

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296569 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoOnly run the overloaded-intrinsic-name.ll test once, with FileCheck.
Daniel Berlin [Wed, 1 Mar 2017 01:56:41 +0000 (01:56 +0000)]
Only run the overloaded-intrinsic-name.ll test once, with FileCheck.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296564 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoKeep attributes, calling convention, etc, when remangling intrinsic
Daniel Berlin [Wed, 1 Mar 2017 01:49:13 +0000 (01:49 +0000)]
Keep attributes, calling convention, etc, when remangling intrinsic

Summary: Fix issue reported where intrinsic calling convention is dropped after r295253.

Reviewers: sanjoy

Subscribers: materi, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296563 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMove constexpr arrays out of class definition.
Zachary Turner [Wed, 1 Mar 2017 01:17:31 +0000 (01:17 +0000)]
Move constexpr arrays out of class definition.

GCC Linker doesn't seem to like this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296560 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DebugInfo] Fix some Include What You Use warnings; other minor fixes (NFC).
Eugene Zelenko [Wed, 1 Mar 2017 01:14:23 +0000 (01:14 +0000)]
[DebugInfo] Fix some Include What You Use warnings; other minor fixes (NFC).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296559 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix signed / unsigned comparison warning.
Zachary Turner [Wed, 1 Mar 2017 01:07:10 +0000 (01:07 +0000)]
Fix signed / unsigned comparison warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296557 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PDB] Add an additional test for BinaryStreamRef.
Zachary Turner [Wed, 1 Mar 2017 01:04:16 +0000 (01:04 +0000)]
[PDB] Add an additional test for BinaryStreamRef.

A bug was uncovered where if you have a StreamRef whose ViewOffset
is > 0, then when you call readLongestContiguousChunk it will
succeed even when it shouldn't, and it always return you a
buffer that was taken as if the ViewOffset was 0.

Fixed this bug and added a test for it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296556 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PDB] Add tests for BinaryStream.
Zachary Turner [Wed, 1 Mar 2017 01:03:53 +0000 (01:03 +0000)]
[PDB] Add tests for BinaryStream.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296555 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[opt-viewer] Suggest installing the faster parser (libYAML)
Adam Nemet [Wed, 1 Mar 2017 00:54:40 +0000 (00:54 +0000)]
[opt-viewer] Suggest installing the faster parser (libYAML)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296553 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeGen] Remove dead FastISel code after SDAG emitted a tailcall.
Ahmed Bougacha [Wed, 1 Mar 2017 00:43:42 +0000 (00:43 +0000)]
[CodeGen] Remove dead FastISel code after SDAG emitted a tailcall.

When SDAGISel (top-down) selects a tail-call, it skips the remainder
of the block.

If, before that, FastISel (bottom-up) selected some of the (no-op) next
few instructions, we can end up with dead instructions following the
terminator (selected by SDAGISel).

We need to erase them, as we know they aren't necessary (in addition to
being incorrect).

We already do this when FastISel falls back on the tail-call itself.
Also remove the FastISel-emitted code if we fallback on the
instructions between the tail-call and the return.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296552 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[GlobalISel] Replace all combined G_EXTRACT uses.
Ahmed Bougacha [Wed, 1 Mar 2017 00:43:39 +0000 (00:43 +0000)]
[GlobalISel] Replace all combined G_EXTRACT uses.

Iterating on the use-list we're modifying doesn't work: after the first
iteration, the use-list iterator will point to a MachineOperand
referencing the new register.  This caused us to skip the other uses to
replace.

Instead, use MRI.replaceRegWith(), which accounts for this behavior.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296551 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd missing module/license header. NFC.
Paul Robinson [Wed, 1 Mar 2017 00:14:42 +0000 (00:14 +0000)]
Add missing module/license header. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296550 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[opt-viewer] Handle column number 0
Adam Nemet [Tue, 28 Feb 2017 23:59:46 +0000 (23:59 +0000)]
[opt-viewer] Handle column number 0

The asm-printer now emits remarks with function location which have
unspecified (0) source column number.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296547 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "(HEAD, origin/master, origin/HEAD, master) [LV] These should missed remarks"
Adam Nemet [Tue, 28 Feb 2017 23:54:27 +0000 (23:54 +0000)]
Revert "(HEAD, origin/master, origin/HEAD, master) [LV] These should missed remarks"

This reverts commit r296544.

This got committed by accident.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296546 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LV] These should missed remarks
Adam Nemet [Tue, 28 Feb 2017 23:48:58 +0000 (23:48 +0000)]
[LV] These should missed remarks

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296544 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTeach the IR verifier to reject conflicting debug info for function arguments.
Adrian Prantl [Tue, 28 Feb 2017 23:48:42 +0000 (23:48 +0000)]
Teach the IR verifier to reject conflicting debug info for function arguments.

Conflicting debug info for function arguments causes hard-to-debug
assertions in the DWARF backend, so the Verifier should reject it.
For performance reasons this only checks function arguments from
non-inlined debug intrinsics for now.

rdar://problem/30520286

This reapplies r295749 after fixing PR32042.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296543 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DWARFv5] llvm-mc support for new unit header.
Paul Robinson [Tue, 28 Feb 2017 23:40:46 +0000 (23:40 +0000)]
[DWARFv5] llvm-mc support for new unit header.

This is for running the assembler with -g (to emit DWARF describing
the assembler source).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296541 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[WebAssembly] Convert the remaining unit tests to the new wasm-object-file target.
Dan Gohman [Tue, 28 Feb 2017 23:37:04 +0000 (23:37 +0000)]
[WebAssembly] Convert the remaining unit tests to the new wasm-object-file target.

To facilitate this, add a new hidden command-line option to disable
the explicit-locals pass. That causes llc to emit invalid code that doesn't
have all locals converted to get_local/set_local, however it simplifies
testwriting in many cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296540 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate AMDGPU test branch-relaxation.ll for changes after post-dom fixes
Daniel Berlin [Tue, 28 Feb 2017 23:35:24 +0000 (23:35 +0000)]
Update AMDGPU test branch-relaxation.ll for changes after post-dom fixes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296539 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Don't generate deprecated T1 STM.
Eli Friedman [Tue, 28 Feb 2017 23:32:55 +0000 (23:32 +0000)]
[ARM] Don't generate deprecated T1 STM.

This prevents generating stm r1!, {r0, r1} on Thumb1, where value
stored for r1 is UNKONWN.

Patch by Zhaoshi Zheng.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296538 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Generate extract instructions more aggressively
Krzysztof Parzyszek [Tue, 28 Feb 2017 23:27:33 +0000 (23:27 +0000)]
[Hexagon] Generate extract instructions more aggressively

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296537 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] remove usage of the old coverage instrumentation
Kostya Serebryany [Tue, 28 Feb 2017 23:23:48 +0000 (23:23 +0000)]
[libFuzzer] remove usage of the old coverage instrumentation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296536 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix PR 24415 (at least), by making our post-dominator tree behavior sane.
Daniel Berlin [Tue, 28 Feb 2017 22:57:50 +0000 (22:57 +0000)]
Fix PR 24415 (at least), by making our post-dominator tree behavior sane.

Summary:
Currently, our post-dom tree tries to ignore and remove the effects of
infinite loops.  It fails miserably at this, because it tries to do it
ahead of time, and thus can only detect self-loops, and any other type
of infinite loop, it pretends doesn't exist at all.

This can, in a bunch of cases, lead to wrong answers and a completely
empty post-dom tree.

Wrong answer:

```
declare void foo()
define internal void @f() {
entry:
  br i1 undef, label %bb35, label %bb3.i

bb3.i:
  call void @foo()
  br label %bb3.i

bb35.loopexit3:
  br label %bb35

bb35:
  ret void
}
```
We get:
```
Inorder PostDominator Tree:
  [1]  <<exit node>> {0,7}
    [2] %bb35 {1,6}
      [3] %bb35.loopexit3 {2,3}
      [3] %entry {4,5}
```

This is a trivial modification of the testcase for PR 6047
Note that we pretend bb3.i doesn't exist.
We also pretend that bb35 post-dominates entry.

While it's true that it does not exit in a theoretical sense, it's not
really helpful to try to ignore the effect and pretend that bb35
post-dominates entry.  Worse, we pretend the infinite loop does
nothing (it's usually considered a side-effect), and doesn't even
exist, even when it calls a function.  Sadly, this makes it impossible
to use when you are trying to move code safely.  All compilers also
create virtual or real single exit nodes (including us), and connect
infinite loops there (which this patch does).  In fact, others have
worked around our behavior here, to the point of building their own
post-dom trees:
https://zneak.github.io/fcd/2016/02/17/structuring.html and pointing
out the region infrastructure is near-useless for them with postdom in
this state :(

Completely empty post-dom tree:
```
define void @spam() #0 {
bb:
  br label %bb1

bb1:                                              ; preds = %bb1, %bb
  br label %bb1

bb2:                                              ; No predecessors!
  ret void
}
```
Printing analysis 'Post-Dominator Tree Construction' for function 'foo':
=============================--------------------------------
Inorder PostDominator Tree:
  [1]  <<exit node>> {0,1}

:(

(note that even if you ignore the effects of infinite loops, bb2
should be present as an exit node that post-dominates nothing).

This patch changes post-dom to properly handle infinite loops and does
root finding during calculation to prevent empty tress in such cases.

We match gcc's (and the canonical theoretical) behavior for infinite
loops (find the backedge, connect it to the exit block).

Testcases coming as soon as i finish running this on a ton of random graphs :)

Reviewers: chandlerc, davide

Subscribers: bryant, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296535 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agogold-plugin: Remove unused variable.
Peter Collingbourne [Tue, 28 Feb 2017 22:40:30 +0000 (22:40 +0000)]
gold-plugin: Remove unused variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296533 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Fix instruction selection for sign-extending i1 to i64
Krzysztof Parzyszek [Tue, 28 Feb 2017 22:37:01 +0000 (22:37 +0000)]
[Hexagon] Fix instruction selection for sign-extending i1 to i64

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296532 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[XRay][Docs] Update the XRay documentation
Dean Michael Berris [Tue, 28 Feb 2017 22:01:26 +0000 (22:01 +0000)]
[XRay][Docs] Update the XRay documentation

Summary:
Update the XRay docs to mention new subcomands to the llvm-xray tool,
and details on FDR mode logging. Also list down available libraries for
use part of the LLVM distribution.

Reviewers: rSerge, pelikan, echristo, timshen, sdardis, rengolin

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296528 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoActually add error handling to unpacking the dyld compact bind and
Kevin Enderby [Tue, 28 Feb 2017 21:47:07 +0000 (21:47 +0000)]
Actually add error handling to unpacking the dyld compact bind and
other tables.  Providing a helpful error message to what the error is and
where the error occurred based on which opcode it was associated with.

There have been handful of bug fixes dealing with bad bind info in
object files, r294021 and r249845, which only put a band aid on the
problem after a bad bind table was created after unpacking from
its compact info.  In these cases a bind table should have never been
created and an error should have simply been generated.

This change puts in place the plumbing to allow checking and returning
of an error when the compact info is unpacked.  This follows the model
of iterators that can fail that Lang Hanes designed when fixing the problem
for bad archives r275316 (or r275361).

This change uses one of the existing test cases that now causes an
error instead of printing <<bad library ordinal>> after a bad bind table
is created.  The error uses the offset into the opcode table as shown with
the macOS dyldinfo(1) tool to indicate where the error is and which
opcode and which parameter is in error.

For example the exiting test case has this lazy binding opcode table:

% dyldinfo -opcodes test/tools/llvm-objdump/Inputs/bad-ordinal.macho-x86_64

lazy binding opcodes:
0x0000 BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB(0x02, 0x00000010)
0x0002 BIND_OPCODE_SET_DYLIB_ORDINAL_IMM(2)

In the test case the binary only has one library so setting the library
ordinal to the value of 2 in the BIND_OPCODE_SET_DYLIB_ORDINAL_IMM
opcode at 0x0002 above is an error.  This now produces this error message:

% llvm-objdump -lazy-bind bad-ordinal.macho-x86_64

llvm-objdump: 'bad-ordinal.macho-x86_64': truncated or malformed object (for BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB bad library ordinal: 2 (max 1) for opcode at: 0x2)

This change provides the plumbing for the error handling and one example
of an error message.  Other error checks and test cases will be added in follow
on commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296527 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMark some libFuzzer tests as XFAIL'd on Darwin
Mehdi Amini [Tue, 28 Feb 2017 21:45:59 +0000 (21:45 +0000)]
Mark some libFuzzer tests as XFAIL'd on Darwin

We're bringing up a bot on Green Dragon right now:

http://green.lab.llvm.org/green/view/Experimental/job/libFuzzer

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296526 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Fix types for VOP_I16_I16_I16
Matt Arsenault [Tue, 28 Feb 2017 21:31:45 +0000 (21:31 +0000)]
AMDGPU: Fix types for VOP_I16_I16_I16

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296523 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Add definition for v_swap_b32
Matt Arsenault [Tue, 28 Feb 2017 21:09:04 +0000 (21:09 +0000)]
AMDGPU: Add definition for v_swap_b32

This is somewhat tricky because there are two
pairs of tied operands, and it isn't allowed to be
VOP3 encoded.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296519 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Add definition for v_xad_u32
Matt Arsenault [Tue, 28 Feb 2017 20:27:30 +0000 (20:27 +0000)]
AMDGPU: Add definition for v_xad_u32

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296515 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DWARFv5] Emit new unit header format.
Paul Robinson [Tue, 28 Feb 2017 20:24:55 +0000 (20:24 +0000)]
[DWARFv5] Emit new unit header format.

Requesting DWARF v5 will now get you the new compile-unit and
type-unit headers.  llvm-dwarfdump will also recognize them.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296514 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Add ds_nop to assembler
Matt Arsenault [Tue, 28 Feb 2017 20:15:46 +0000 (20:15 +0000)]
AMDGPU: Add ds_nop to assembler

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296513 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Add definitions for ds_{read|write}_b{96|128}
Matt Arsenault [Tue, 28 Feb 2017 20:15:43 +0000 (20:15 +0000)]
AMDGPU: Add definitions for ds_{read|write}_b{96|128}

It's not clear to me if this is always better than
doing ds_write2_b64 This adds the constraint of
a 128-bit register input instead of a pair of
64-bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296512 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU] Add second pass of the scheduler
Stanislav Mekhanoshin [Tue, 28 Feb 2017 19:20:33 +0000 (19:20 +0000)]
[AMDGPU] Add second pass of the scheduler

If during scheduling we have identified that we cannot keep optimistic
occupancy increase critical register pressure limit and try scheduling
of the whole function again. In this case blocks with smaller pressure
will have a chance for better scheduling.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296506 91177308-0d34-0410-b5e6-96231b3b80d8