OSDN Git Service

android-x86/external-llvm.git
7 years agoRevert "[lit] Clean output directories before running tests."
Zachary Turner [Fri, 30 Jun 2017 16:05:03 +0000 (16:05 +0000)]
Revert "[lit] Clean output directories before running tests."

This reverts commit da6318a92fba793e4f2447ec478b001392d57d43.

This is causing failures on some build bots due to what appears
to be some kind of lit ordering dependency.

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

7 years ago[lit] Clean output directories before running tests.
Zachary Turner [Fri, 30 Jun 2017 16:01:30 +0000 (16:01 +0000)]
[lit] Clean output directories before running tests.

Presently lit leaks files in the tests' output directories.
Specifically, if a test creates output files, lit makes no
effort to remove them prior to the next test run.  This is
problematic because it leads to false positives whenever a
test passes because stale  files were present.  In general
it is a source of flakiness that should be removed.

This patch addresses this by building the list of all test
directories that are part of the current run set, and then
deleting those directories and recreating them anew.  This
gives each test a clean baseline to start from.

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

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

7 years ago[MIPS] Handle PIC load address macro instructions in N64.
Simon Dardis [Fri, 30 Jun 2017 15:44:27 +0000 (15:44 +0000)]
[MIPS] Handle PIC load address macro instructions in N64.

In particular, use CALL16 (similar to O32) for address loads into T9 for certain
cases.  Otherwise use a %got_disp relocation to load the address of a symbol.
Small offsets (small enough to fit in a 16-bit signed immediate) can be used and
are added to the symbol address after it is loaded from the GOT.  Larger offsets
are currently unsupported and result in an error from the assembler.

Reviewers: sdardis

Reviewed By: sdardis

Patch by: John Baldwin

Subscribers: llvm-commits, seanbruno, arichardson, emaste, dim

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

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

7 years ago[SLP] A test for limiting vectorization of instructions, NFC.
Alexey Bataev [Fri, 30 Jun 2017 14:37:32 +0000 (14:37 +0000)]
[SLP] A test for limiting vectorization of instructions, NFC.

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

7 years ago[LTO] Remove values from non-prevailing comdats
Teresa Johnson [Fri, 30 Jun 2017 14:03:24 +0000 (14:03 +0000)]
[LTO] Remove values from non-prevailing comdats

Summary:
When linking a regular LTO module, if it has any non-prevailing values
(dropped to available_externally) in comdats, we need to do more than
just remove those values from their comdat. We also remove all values
from that comdat, so as to avoid leaving an incomplete comdat.

This is necessary in case we are compiling in mixed regular and ThinLTO
mode, since the resulting regularLTO native object is always linked into
the final binary first. We need to prevent the linker from selecting an
incomplete comdat that was not the prevailing copy.

Fixes PR32980.

Reviewers: pcc, rafael

Subscribers: mehdi_amini, david2050, llvm-commits, inglorion

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

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

7 years agoRemove unnecessary commented out argument. NFCI.
Simon Pilgrim [Fri, 30 Jun 2017 13:26:17 +0000 (13:26 +0000)]
Remove unnecessary commented out argument. NFCI.

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

7 years ago[SystemZ] Add missing high-word facility instructions
Ulrich Weigand [Fri, 30 Jun 2017 12:56:29 +0000 (12:56 +0000)]
[SystemZ] Add missing high-word facility instructions

There are a few instructions provided by the high-word facility (z196)
that we cannot easily exploit for code generation.  This patch at least
adds those missing instructions for the assembler and disassembler.

This means that now all nonprivileged instructions up to z13 are
supported by the LLVM assembler / disassembler.

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

7 years agoRevert "[DAG] Rewrite areNonVolatileConsecutiveLoads to use BaseIndexOffset"
Nirav Dave [Fri, 30 Jun 2017 12:56:02 +0000 (12:56 +0000)]
Revert "[DAG] Rewrite areNonVolatileConsecutiveLoads to use BaseIndexOffset"

This reverts commit r306819 which appears be exposing underlying
issues in a stage1 ppc64be build

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

7 years ago[DAG] Rewrite areNonVolatileConsecutiveLoads to use BaseIndexOffset
Nirav Dave [Fri, 30 Jun 2017 12:23:41 +0000 (12:23 +0000)]
[DAG] Rewrite areNonVolatileConsecutiveLoads to use BaseIndexOffset

As discussed in D34087, rewrite areNonVolatileConsecutiveLoads using
generic checks. Also, propagate missing local handling from there to
BaseIndexOffset checks.

Tests of note:

  * test/CodeGen/X86/build-vector* - Improved.
  * test/CodeGen/BPF/undef.ll - Improved store alignment allows an
    additional store merge

  * test/CodeGen/X86/clear_upper_vector_element_bits.ll - This is a
    case we already do not handle well. Here, the DAG is improved, but
    scheduling causes a code size degradation.

Reviewers: RKSimon, craig.topper, spatel, andreadb, filcab

Subscribers: nemanjai, llvm-commits

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

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

7 years agoCREDITS.TXT: Update myself.
NAKAMURA Takumi [Fri, 30 Jun 2017 11:59:53 +0000 (11:59 +0000)]
CREDITS.TXT: Update myself.

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

7 years ago[X86] Updated 32-bit memcmp tests to run with/without SSE2
Simon Pilgrim [Fri, 30 Jun 2017 11:23:59 +0000 (11:23 +0000)]
[X86] Updated 32-bit memcmp tests to run with/without SSE2

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

7 years agoRevert of r306525: "Canonicalize clamp of float types to minmax"
Nikolai Bozhenov [Fri, 30 Jun 2017 10:39:09 +0000 (10:39 +0000)]
Revert of r306525: "Canonicalize clamp of float types to minmax"

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

7 years ago[YAML] - Teach yaml2obj/obj2yaml to work with numeric relocation values.
George Rimar [Fri, 30 Jun 2017 10:31:03 +0000 (10:31 +0000)]
[YAML] - Teach yaml2obj/obj2yaml to work with numeric relocation values.

That may be useful if we want to produce or parse object containing
broken relocation values using yaml2obj/obj2yaml.

Previously that was impossible because only enum values were parsed
correctly, this patch allows to put any numeric value as a
relocation type.

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

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

7 years ago[DWARF] - Simplify HandleExpectedError implementation in DWARFDebugInfoTest
George Rimar [Fri, 30 Jun 2017 10:09:01 +0000 (10:09 +0000)]
[DWARF] - Simplify HandleExpectedError implementation in DWARFDebugInfoTest

Current implementation looks a bit confusing. It looks like it should
report/print something on error, but it does not do that.
It silently drops a error message when creating triple, though
this behavior is fine generally.

For example if LLVM configured with -DLLVM_TARGETS_TO_BUILD=ARM and
our host is windows, it is expected that we will be unable to
create "i386-pc-windows-msvc" target.

Patch introduces isConfigurationSupported() function that checks
if current configuration is supported for each test and returns early if not.

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

7 years agoFixed misplaced table border in the docs.
Ilya Biryukov [Fri, 30 Jun 2017 09:47:17 +0000 (09:47 +0000)]
Fixed misplaced table border in the docs.

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

7 years agoAdded Dockerfiles to build clang from sources.
Ilya Biryukov [Fri, 30 Jun 2017 09:46:45 +0000 (09:46 +0000)]
Added Dockerfiles to build clang from sources.

Reviewers: klimek, chandlerc, mehdi_amini

Reviewed By: klimek, mehdi_amini

Subscribers: mehdi_amini, jlebar, llvm-commits

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

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

7 years agofix trivial typos, NFC
Hiroshi Inoue [Fri, 30 Jun 2017 09:11:50 +0000 (09:11 +0000)]
fix trivial typos, NFC

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

7 years ago[GlobalISel] Make multi-step legalization work.
Kristof Beyls [Fri, 30 Jun 2017 08:26:20 +0000 (08:26 +0000)]
[GlobalISel] Make multi-step legalization work.

In r301116, a custom lowering needed to be introduced to be able to
legalize 8 and 16-bit divisions on ARM targets without a division
instruction, since 2-step legalization (WidenScalar from 8 bit to 32
bit, then Libcall the 32-bit division) doesn't work.

This fixes this and makes this kind of multi-step legalization, where
first the size of the type needs to be changed and then some action is
needed that doesn't require changing the size of the type,
straighforward to specify.

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

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

7 years ago[LV] Optimize for size when vectorizing loops with tiny trip count
Ayal Zaks [Fri, 30 Jun 2017 08:02:35 +0000 (08:02 +0000)]
[LV] Optimize for size when vectorizing loops with tiny trip count

It may be detrimental to vectorize loops with very small trip count, as various
costs of the vectorized loop body as well as enclosing overheads including
runtime tests and scalar iterations may outweigh the gains of vectorizing. The
current cost model measures the cost of the vectorized loop body only, expecting
it will amortize other costs, and loops with known or expected very small trip
counts are not vectorized at all. This patch allows loops with very small trip
counts to be vectorized, but under OptForSize constraints, which ensure the cost
of the loop body is dominant, having no runtime guards nor scalar iterations.

Patch inspired by D32451.

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

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

7 years ago[InstCombine] Add test cases to demonstrate failure to fold (a | b) ^ (~a | ~b) ...
Craig Topper [Fri, 30 Jun 2017 07:37:42 +0000 (07:37 +0000)]
[InstCombine] Add test cases to demonstrate failure to fold (a | b) ^ (~a | ~b) --> ~(a ^ b) and its commuted variants.

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

7 years ago[InstCombine] In foldXorToXor, move the commutable matcher from the LHS match to...
Craig Topper [Fri, 30 Jun 2017 07:37:41 +0000 (07:37 +0000)]
[InstCombine] In foldXorToXor, move the commutable matcher from the LHS match to the RHS match. No meaningful change intended.

There are two conditions ORed here with similar checks and each contain two matches that must be true for the if to succeed. With the commutable match on the first half of the OR then both ifs basically have the same first part and only the second part distinguishs. With this change we move the commutable match to second half and make the first half unique.

This caused some tests to change because we now produce a commuted result, but this shouldn't matter in practice.

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

7 years agofix trivial typo; NFC
Hiroshi Inoue [Fri, 30 Jun 2017 07:17:53 +0000 (07:17 +0000)]
fix trivial typo; NFC

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

7 years agoRemove the BBVectorize pass.
Chandler Carruth [Fri, 30 Jun 2017 07:09:08 +0000 (07:09 +0000)]
Remove the BBVectorize pass.

It served us well, helped kick-start much of the vectorization efforts
in LLVM, etc. Its time has come and past. Back in 2014:
http://lists.llvm.org/pipermail/llvm-dev/2014-November/079091.html

Time to actually let go and move forward. =]

I've updated the release notes both about the removal and the
deprecation of the corresponding C API.

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

7 years ago[llvm-readobj] Improve printouts for COFF ARM64 binaries
Martin Storsjo [Fri, 30 Jun 2017 07:02:13 +0000 (07:02 +0000)]
[llvm-readobj] Improve printouts for COFF ARM64 binaries

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

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

7 years ago[llvm-readobj] Include the PE magic value in printouts
Martin Storsjo [Fri, 30 Jun 2017 07:02:04 +0000 (07:02 +0000)]
[llvm-readobj] Include the PE magic value in printouts

This is useful for a testcase in lld.

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

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

7 years agoRevert "r306541 - Add zero-length check to memcpy/memset load store loop expansion"
Daniel Jasper [Fri, 30 Jun 2017 06:37:33 +0000 (06:37 +0000)]
Revert "r306541 - Add zero-length check to memcpy/memset load store loop expansion"

Segfaults in non-optimized builds. I'll get a stack trace and a
reproducer to Teresa.

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

7 years agoRevert "r306473 - re-commit r306336: Enable vectorizer-maximize-bandwidth by default."
Daniel Jasper [Fri, 30 Jun 2017 06:32:21 +0000 (06:32 +0000)]
Revert "r306473 - re-commit r306336: Enable vectorizer-maximize-bandwidth by default."

This still breaks PPC tests we have. I'll forward reproduction
instructions to dehao.

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

7 years agoRewrite demangle memory handling.
Eric Christopher [Fri, 30 Jun 2017 05:38:56 +0000 (05:38 +0000)]
Rewrite demangle memory handling.
The return of itaniumDemangle is allocated with malloc rather than new[]
and so using unique_ptr isn't called for here. As a note for the future
we should rewrite it to do this.

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

7 years ago[SCEV] Use depth limit instead of local cache for SExt and ZExt
Max Kazantsev [Fri, 30 Jun 2017 05:04:09 +0000 (05:04 +0000)]
[SCEV] Use depth limit instead of local cache for SExt and ZExt

In rL300494 there was an attempt to deal with excessive compile time on
invocations of getSign/ZeroExtExpr using local caching. This approach only
helps if we request the same SCEV multiple times throughout recursion. But
in the bug PR33431 we see a case where we request different values all the time,
so caching does not help and the size of the cache grows enormously.

In this patch we remove the local cache for this methods and add the recursion
depth limit instead, as we do for arithmetics. This gives us a guarantee that the
invocation sequence is limited and reasonably short.

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

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

7 years agoTry to appease a buildbot.
Vedant Kumar [Fri, 30 Jun 2017 04:04:44 +0000 (04:04 +0000)]
Try to appease a buildbot.

The failure is:
C:\ps4-buildslave2\llvm-clang-x86_64-expensive-checks-win\llvm\unittests\ProfileData\CoverageMappingTest.cpp(244):
error C2668: 'llvm::make_unique': ambiguous call to overloaded function

http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/3489/

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

7 years agoReduce indenting and clean up comparisons around sign bit.
Eric Christopher [Fri, 30 Jun 2017 01:57:48 +0000 (01:57 +0000)]
Reduce indenting and clean up comparisons around sign bit.

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

7 years agoChange the type of Undecorated to unique_ptr<char[]> since we're looking at a null...
Eric Christopher [Fri, 30 Jun 2017 01:45:56 +0000 (01:45 +0000)]
Change the type of Undecorated to unique_ptr<char[]> since we're looking at a null terminated string and not a single character.

Fixes an error in tcmalloc sized delete checking.

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

7 years agoReduce the complexity of the signbit/branch test functions.
Eric Christopher [Fri, 30 Jun 2017 01:35:31 +0000 (01:35 +0000)]
Reduce the complexity of the signbit/branch test functions.

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

7 years ago[Dominators] Don't compute DFS InOut numbers eagerly.
Jakub Kuderski [Fri, 30 Jun 2017 01:28:21 +0000 (01:28 +0000)]
[Dominators] Don't compute DFS InOut numbers eagerly.

Summary:
DFS InOut numbers currently get eagerly computer upon DomTree construction. They are only needed to answer dome dominance queries and they get invalidated by updates and recalculations. Because of that, it is faster in practice to compute them lazily when they are actually needed.

Clang built without this patch takes 6m 45s to boostrap on my machine, and with the patch applied 6m 38s.

Reviewers: sanjoy, dberlin, chandlerc

Reviewed By: dberlin

Subscribers: davide, llvm-commits

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

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

7 years agoAdd a C API section to the release notes.
Eric Christopher [Fri, 30 Jun 2017 01:17:45 +0000 (01:17 +0000)]
Add a C API section to the release notes.

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

7 years ago[Coverage] Remove two overloads of CoverageMapping::load. NFC.
Vedant Kumar [Fri, 30 Jun 2017 00:45:26 +0000 (00:45 +0000)]
[Coverage] Remove two overloads of CoverageMapping::load. NFC.

These overloads are essentially dead, and pose a maintenance cost
without adding any benefit. This is coming up now because I'd like to
experiment with changing the way we store coverage mapping data, and
would rather not have to fix up the old overloads while doing so.

Testing: check-{llvm,profile}, build clang.

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

7 years ago[WebAssembly] Add support for exception handling instructions
Heejin Ahn [Fri, 30 Jun 2017 00:43:15 +0000 (00:43 +0000)]
[WebAssembly] Add support for exception handling instructions

Summary:
This adds backend support for throw, rethrow, try, and try_end instructions.
This needs the corresponding clang builtin support:
https://reviews.llvm.org/D34783
This follows the Wasm exception handling proposal in
https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md

Reviewers: sunfish, dschuff

Reviewed By: dschuff

Subscribers: jfb, sbc100, jgravelle-google

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

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

7 years ago[DWARF] Move a couple of member functions to the DWARFUnit baseclass. NFC.
Wolfgang Pieb [Fri, 30 Jun 2017 00:27:45 +0000 (00:27 +0000)]
[DWARF] Move a couple of member functions to the DWARFUnit baseclass. NFC.

Reviewer: dblaikie

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

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

7 years agoUnified logic for computing target ABI in backend and front end by moving this common...
Eric Christopher [Fri, 30 Jun 2017 00:03:54 +0000 (00:03 +0000)]
Unified logic for computing target ABI in backend and front end by moving this common code to Support/TargetParser.

Modeled Triple::GNU after front end code (aapcs abi) and  updated tests that expect apcs abi.

Based heavily on a patch by Ana Pazos!

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

7 years ago[GISel]: New Opcode G_FLOG/G_FLOG2
Aditya Nandakumar [Thu, 29 Jun 2017 23:43:44 +0000 (23:43 +0000)]
[GISel]: New Opcode G_FLOG/G_FLOG2

https://reviews.llvm.org/D34837

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

7 years agoHook the sample PGO machinery in the new PM
Dehao Chen [Thu, 29 Jun 2017 23:33:05 +0000 (23:33 +0000)]
Hook the sample PGO machinery in the new PM

Summary: This patch hooks up SampleProfileLoaderPass with the new PM.

Reviewers: chandlerc, davidxl, davide, tejohnson

Reviewed By: chandlerc, tejohnson

Subscribers: tejohnson, llvm-commits, sanjoy

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

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

7 years agoTo help readability of mightUseCTR pull out the inline asm handling support into...
Eric Christopher [Thu, 29 Jun 2017 23:28:47 +0000 (23:28 +0000)]
To help readability of mightUseCTR pull out the inline asm handling support into a function.

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

7 years agoMake the PPCCTRLoops pass depend on being able to access the TargetMachine and clean...
Eric Christopher [Thu, 29 Jun 2017 23:28:45 +0000 (23:28 +0000)]
Make the PPCCTRLoops pass depend on being able to access the TargetMachine and clean up accordingly.

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

7 years agoRemove redundant copy in recurrences
Taewook Oh [Thu, 29 Jun 2017 23:11:24 +0000 (23:11 +0000)]
Remove redundant copy in recurrences

Summary:
If there is a chain of instructions formulating a recurrence, commuting operands can help removing a redundant copy. In the following example code,

```
BB#1: ; Loop Header
  %vreg0<def> = COPY %vreg13<kill>; GR32:%vreg0,%vreg13
  ...

BB#6: ; Loop Latch
  %vreg2<def> = COPY %vreg15<kill>; GR32:%vreg2,%vreg15
  %vreg10<def,tied1> = ADD32rr %vreg1<kill,tied0>, %vreg0<kill>, %EFLAGS<imp-def,dead>; GR32:%vreg10,%vreg1,%vreg0
  %vreg3<def,tied1> = ADD32rr %vreg2<kill,tied0>, %vreg10<kill>, %EFLAGS<imp-def,dead>; GR32:%vreg3,%vreg2,%vreg10
  CMP32ri8 %vreg3, 10, %EFLAGS<imp-def>; GR32:%vreg3
  %vreg13<def> = COPY %vreg3<kill>; GR32:%vreg13,%vreg3
  JL_1 <BB#1>, %EFLAGS<imp-use,kill>
```

Existing two-address generation pass generates following code:

```
BB#1:
  %vreg0<def> = COPY %vreg13<kill>; GR32:%vreg0,%vreg13
  ...

BB#6:
    Predecessors according to CFG: BB#5 BB#4
  %vreg2<def> = COPY %vreg15<kill>; GR32:%vreg2,%vreg15
  %vreg10<def> = COPY %vreg1<kill>; GR32:%vreg10,%vreg1
  %vreg10<def,tied1> = ADD32rr %vreg10<tied0>, %vreg0<kill>, %EFLAGS<imp-def,dead>; GR32:%vreg10,%vreg0
  %vreg3<def> = COPY %vreg10<kill>; GR32:%vreg3,%vreg10
  %vreg3<def,tied1> = ADD32rr %vreg3<tied0>, %vreg2<kill>, %EFLAGS<imp-def,dead>; GR32:%vreg3,%vreg2
  CMP32ri8 %vreg3, 10, %EFLAGS<imp-def>; GR32:%vreg3
  %vreg13<def> = COPY %vreg3<kill>; GR32:%vreg13,%vreg3
  JL_1 <BB#1>, %EFLAGS<imp-use,kill>
  JMP_1 <BB#7>
```

This is suboptimal because the assembly code generated has a redundant copy at the end of #BB6 to feed %vreg13 to BB#1:

```
.LBB0_6:
  addl  %esi, %edi
  addl  %ebx, %edi
  cmpl  $10, %edi
  movl  %edi, %esi
  jl  .LBB0_1
```

This redundant copy can be elimiated by making instructions in the recurrence chain to compute the value "into" the register that actually holds the feedback value. In this example, this can be achieved by commuting %vreg0 and %vreg1 to compute %vreg10. With that change, code after two-address generation becomes

```
BB#1:
  %vreg0<def> = COPY %vreg13<kill>; GR32:%vreg0,%vreg13
  ...

BB#6: derived from LLVM BB %bb7
    Predecessors according to CFG: BB#5 BB#4
  %vreg2<def> = COPY %vreg15<kill>; GR32:%vreg2,%vreg15
  %vreg10<def> = COPY %vreg0<kill>; GR32:%vreg10,%vreg0
  %vreg10<def,tied1> = ADD32rr %vreg10<tied0>, %vreg1<kill>, %EFLAGS<imp-def,dead>; GR32:%vreg10,%vreg1
  %vreg3<def> = COPY %vreg10<kill>; GR32:%vreg3,%vreg10
  %vreg3<def,tied1> = ADD32rr %vreg3<tied0>, %vreg2<kill>, %EFLAGS<imp-def,dead>; GR32:%vreg3,%vreg2
  CMP32ri8 %vreg3, 10, %EFLAGS<imp-def>; GR32:%vreg3
  %vreg13<def> = COPY %vreg3<kill>; GR32:%vreg13,%vreg3
  JL_1 <BB#1>, %EFLAGS<imp-use,kill>
  JMP_1 <BB#7>
```

and the final assembly does not have redundant copy:

```
.LBB0_6:
  addl  %edi, %eax
  addl  %ebx, %eax
  cmpl  $10, %eax
  jl  .LBB0_1
```

Reviewers: qcolombet, MatzeB, wmi

Reviewed By: wmi

Subscribers: llvm-commits

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

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

7 years ago[ThinkLTO] Invoke build(Thin)?LTOPreLinkDefaultPipeline.
Tim Shen [Thu, 29 Jun 2017 23:08:38 +0000 (23:08 +0000)]
[ThinkLTO] Invoke build(Thin)?LTOPreLinkDefaultPipeline.

Previously it doesn't actually invoke the designated new PM builder
functions.

This patch moves NameAnonGlobalPass out from PassBuilder, as Chandler
points out that PassBuilder is used for non-O0 builds, and for
optimizations only.

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

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

7 years ago[CFLAA] Remove unneded function declaration. NFCI.
Davide Italiano [Thu, 29 Jun 2017 22:57:37 +0000 (22:57 +0000)]
[CFLAA] Remove unneded function declaration. NFCI.

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

7 years ago[SLPVectorizer] Moving Entry->NeedToGather check out of inner loop,
Dinar Temirbulatov [Thu, 29 Jun 2017 21:56:33 +0000 (21:56 +0000)]
[SLPVectorizer] Moving Entry->NeedToGather check out of inner loop,
                since it is invariant there. NFCI.

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

7 years agoRevert "[mips] Fix multiprecision arithmetic."
Simon Dardis [Thu, 29 Jun 2017 20:59:47 +0000 (20:59 +0000)]
Revert "[mips] Fix multiprecision arithmetic."

This reverts commit r305389. This broke chromium builds, so reverting
while I investigate further.

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

7 years ago[AArch64] Silence an unused variable warning in Release builds. NFC.
Chad Rosier [Thu, 29 Jun 2017 20:43:35 +0000 (20:43 +0000)]
[AArch64] Silence an unused variable warning in Release builds. NFC.

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

7 years ago[CodeGenPrepare] Don't create inttoptr for ni ptrs
Keno Fischer [Thu, 29 Jun 2017 20:28:59 +0000 (20:28 +0000)]
[CodeGenPrepare] Don't create inttoptr for ni ptrs

Summary:
Arguably non-integral pointers probably shouldn't show up here at all,
but since the backend doesn't complain and this takes valid (according
to the Verifier) IR and makes it invalid, make sure not to introduce
any inttoptr instructions if we're dealing with non-integral pointers.

Reviewed By: sanjoy
Differential Revision: https://reviews.llvm.org/D33110

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

7 years agoAttempt to fix Orc JIT test timeouts
Reid Kleckner [Thu, 29 Jun 2017 20:15:08 +0000 (20:15 +0000)]
Attempt to fix Orc JIT test timeouts

I think there are some destruction ordering issues here. The
ShouldDelete map seems to be getting destroyed before the shared_ptr
deleter lambda accesses it. In any case, this avoids inserting elements
into the map during shutdown.

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

7 years ago[DWARF] Added verification checks for the .apple_names section.
Spyridoula Gravani [Thu, 29 Jun 2017 20:13:05 +0000 (20:13 +0000)]
[DWARF] Added verification checks for the .apple_names section.
This patch verifies the number of atoms, the validity of the form for each atom, as well as the validity of the
hashdata. For hashdata, we're verifying that the hashdata offset is correct and that the offset in the .debug_info for
each DIE in the hashdata is also valid.

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

7 years agoRemove `inline` keyword from inline `classof` methods
Sam Clegg [Thu, 29 Jun 2017 19:35:17 +0000 (19:35 +0000)]
Remove `inline` keyword from inline `classof` methods

The style guide states that the explicit `inline`
should not be used with inline methods.  classof is
very common inline method with a fair amount on
inconsistency:

$ git grep classof ./include | grep inline | wc -l
230
$ git grep classof ./include | grep -v inline | wc -l
257

I chose to target this method rather the larger change
since this method is easily cargo-culted (I did it at
least once).  I considered doing the larger change and
removing all occurrences but that would be a much larger
change.

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

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

7 years ago[AliasSetTracker] Don't drop AA MD so eagerly
Keno Fischer [Thu, 29 Jun 2017 19:13:11 +0000 (19:13 +0000)]
[AliasSetTracker] Don't drop AA MD so eagerly

Summary:
When we have patterns like
loop:
    %la = load %ptr, !tbaa
    %lba = load %ptr, !tbaa !noalias

AliasSetTracker would previously think that the two types of annotation for
the pointer conflict, dropping both for the purpose of determining alias sets.
That is clearly way too conservative, as the tbaa is still valid whether or
not one of the memory accesses has additional AA metadata. We could go
one step further and attempt to properly merge the AA metadata,
but it's not clear that that would be worth it since that may introduce
additional MD nodes, which may be undesirable since this is merely an
Analysis.

Reviewers: hfinkel

Subscribers: llvm-commits

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

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

7 years ago[opt-viewer] Add progress indicators (PR33522)
Brian Gesiak [Thu, 29 Jun 2017 18:56:25 +0000 (18:56 +0000)]
[opt-viewer] Add progress indicators (PR33522)

Summary:
Provide feedback to users of opt-diff.py, opt-stats.py, and opt-viewer.py,
on how many YAML files have finished being processed, and how many HTML
files have been generated. This feedback is particularly helpful for
opt-viewer.py, which may take a long time to complete when given many
large YAML files as input.

The progress indicators use simple output such as the following:

```
Reading YAML files...
    9 of 1197
```

Test plan:
Run `utils/opt-viewer/opt-*.py` on a CentOS and macOS machine, using
Python 3.4 and Python 2.7 respectively, and ensure the output is
formatted well on both.

Reviewers: anemet, davidxl

Reviewed By: anemet

Subscribers: simon.f.whittaker, llvm-commits

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

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

7 years agoReverting r306695 while investigating failing test case.
Alexandre Isoard [Thu, 29 Jun 2017 18:48:56 +0000 (18:48 +0000)]
Reverting r306695 while investigating failing test case.

Failing test case:
    Transforms/LoopVectorize.iv_outside_user.ll

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

7 years ago[opt-viewer] Python 3 support in opt-viewer.py
Brian Gesiak [Thu, 29 Jun 2017 18:47:31 +0000 (18:47 +0000)]
[opt-viewer] Python 3 support in opt-viewer.py

Summary:
Minor changes that allow opt-stats.py to support both Python 2 and 3.
In addition to the same dictionary iterator changes that were necessary
in https://reviews.llvm.org/D34564, this diff also:

* Explcitly converts strings to bytes when reading from and writing to stdin
  and stdout.
* No longer uses dictionaries as a sort key for optimization remarks.
  Dictionary sort order in Python 2 is pretty esoteric anyway, so it's
  not clear that the additional sorting had a benefit for end users
  (for details, https://stackoverflow.com/a/3484456/679254 is a good
  resource on Python 2 dictionary sort order).

Reviewers: anemet, davidxl

Reviewed By: anemet

Subscribers: llvm-commits

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

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

7 years agollvm-nm: Add support for symbol demangling (-C/--demangle)
Sam Clegg [Thu, 29 Jun 2017 18:29:05 +0000 (18:29 +0000)]
llvm-nm: Add support for symbol demangling (-C/--demangle)

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

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

7 years ago[OrderedInst] Add const to constant parameter. NFCI
Xin Tong [Thu, 29 Jun 2017 18:04:31 +0000 (18:04 +0000)]
[OrderedInst] Add const to constant parameter. NFCI

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

7 years agofix trivial typo, NFC
Hiroshi Inoue [Thu, 29 Jun 2017 18:03:28 +0000 (18:03 +0000)]
fix trivial typo, NFC

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

7 years ago[Dominators] Rearrange access specifiers in DominatorTreeBase
Jakub Kuderski [Thu, 29 Jun 2017 17:53:35 +0000 (17:53 +0000)]
[Dominators] Rearrange access specifiers in DominatorTreeBase

Summary:
This patch makes DominatorTreeBase more readable by putting most important members on top of the class.

Before, the class looked like that: private -> protected (including data members) -> public -> protected.
The patch changes it to: protected (data members only) -> public -> protected -> public.

Reviewers: dberlin, sanjoy, chandlerc

Reviewed By: dberlin

Subscribers: llvm-commits

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

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

7 years ago[Dominators] Remove DominatorBase class
Jakub Kuderski [Thu, 29 Jun 2017 17:50:19 +0000 (17:50 +0000)]
[Dominators] Remove DominatorBase class

Summary:
DominatorBase class was only used by DominatorTreeBase. It didn't provide any useful abstractions, nor simplified anything, so I see no point keeping it.

This commit removes the DominatorBase class and moves its content into DominatorTreeBase.

This is the first patch in a series that tries to make all DomTrees have a single virtual root, which will allow to further simplify code (especially when it comes to incremental updates).

Reviewers: dberlin, sanjoy, chandlerc

Reviewed By: dberlin

Subscribers: llvm-commits

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

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

7 years agoRemove useless header. NFC
Xin Tong [Thu, 29 Jun 2017 17:48:12 +0000 (17:48 +0000)]
Remove useless header. NFC

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

7 years ago[Dominators] Add parent and sibling property verification (non-hacky)
Jakub Kuderski [Thu, 29 Jun 2017 17:45:51 +0000 (17:45 +0000)]
[Dominators] Add parent and sibling property verification (non-hacky)

Summary:
This patch adds an additional level of verification - it checks parent and sibling properties of a tree. By definition, every tree with these two properties is a dominator tree.

It is possible to run those check by running llvm with `-verify-dom-info=1`.

Bootstrapping clang and building the llvm test suite with this option enabled doesn't yield any errors.

Reviewers: dberlin, sanjoy, chandlerc

Reviewed By: dberlin

Subscribers: llvm-commits

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

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

7 years ago[ConstantHoisting] Avoid hoisting constants in GEPs that index into a struct type.
Leo Li [Thu, 29 Jun 2017 17:03:34 +0000 (17:03 +0000)]
[ConstantHoisting] Avoid hoisting constants in GEPs that index into a struct type.

Summary:
Indices for GEPs that index into a struct type should always be
constants. This added more checks in `collectConstantCandidates:` which make
sure constants for GEP pointer type are not hoisted.

This fixed Bug https://bugs.llvm.org/show_bug.cgi?id=33538

Reviewers: ributzka, rnk

Reviewed By: ributzka

Subscribers: efriedma, llvm-commits, srhines, javed.absar, pirama

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

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

7 years agoPredicateInfo: Use OrderedInstructions instead of our homemade
Daniel Berlin [Thu, 29 Jun 2017 17:01:14 +0000 (17:01 +0000)]
PredicateInfo: Use OrderedInstructions instead of our homemade
version.

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

7 years agoNewGVN: Remove useless test in addPhiOfOps.
Daniel Berlin [Thu, 29 Jun 2017 17:01:10 +0000 (17:01 +0000)]
NewGVN: Remove useless test in addPhiOfOps.

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

7 years agoRemove unneeded else from OrderedInstructions::dominates.
Daniel Berlin [Thu, 29 Jun 2017 17:01:03 +0000 (17:01 +0000)]
Remove unneeded else from OrderedInstructions::dominates.

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

7 years ago[DWARF] NFC: DWARFDataExtractor combines relocs with DataExtractor.
Paul Robinson [Thu, 29 Jun 2017 16:52:08 +0000 (16:52 +0000)]
[DWARF] NFC: DWARFDataExtractor combines relocs with DataExtractor.

Requires callers to directly associate relocations with a DataExtractor
used to read data from a DWARF section, which helps a callee not make
assumptions about which section it is reading.
This is the next step in reducing DWARFFormValue's dependence on DWARFUnit.

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

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

7 years agoScalarEvolution: Add URem support
Alexandre Isoard [Thu, 29 Jun 2017 16:29:04 +0000 (16:29 +0000)]
ScalarEvolution: Add URem support

In LLVM IR the following code:

    %r = urem <ty> %t, %b

is equivalent to:

    %q = udiv <ty> %t, %b
    %s = mul <ty> nuw %q, %b
    %r = sub <ty> nuw %t, %q ; (t / b) * b + (t % b) = t

As UDiv, Mul and Sub are already supported by SCEV, URem can be
implemented with minimal effort this way.

Note: While SRem and SDiv are also related this way, SCEV does not
provides SDiv yet.

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

7 years ago[opt-viewer] opt-viewer.py takes -o argument
Brian Gesiak [Thu, 29 Jun 2017 16:20:31 +0000 (16:20 +0000)]
[opt-viewer] opt-viewer.py takes -o argument

Summary:
Change how the output directory is specified when invoking
opt-viewer.py, from `opt-viewer.py yaml_file_one yaml_file_two output_dir` to
`opt-viewer.py -o output_dir yaml_file_one yaml_file_two`.

This makes it easier to pipe the results of another command into
opt-viewer.py. For example:

```
find . -name "*.yaml" -print | xargs /path/to/opt-viewer.py -o html
```

Reviewers: anemet, davidxl

Reviewed By: anemet

Subscribers: fhahn, llvm-commits

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

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

7 years ago[Hexagon] Keep all phi nodes when building DFG in addr-mode-opt
Krzysztof Parzyszek [Thu, 29 Jun 2017 15:55:59 +0000 (15:55 +0000)]
[Hexagon] Keep all phi nodes when building DFG in addr-mode-opt

The dead phis are needed for finding correct would-be reaching defs
in register propagation.

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

7 years ago[DAG] Fold FrameIndex offset into BaseIndexOffset analysis. NFCI.
Nirav Dave [Thu, 29 Jun 2017 15:48:11 +0000 (15:48 +0000)]
[DAG] Fold FrameIndex offset into BaseIndexOffset analysis. NFCI.

Relanding after restricting equalBaseIndex to not erroneuosly consider
a FrameIndices stemming from alloca from being comparable as its
offset is set post-selectionDAG.

Pull FrameIndex comparision reasoning from DAGCombiner::isAlias to
general BaseIndexOffset.

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

7 years ago[llvm-objdump] Handle invalid instruction gracefully on ARM
Eugene Leviant [Thu, 29 Jun 2017 15:38:47 +0000 (15:38 +0000)]
[llvm-objdump] Handle invalid instruction gracefully on ARM

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

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

7 years agobpf: remove unnecessary truncate operation
Yonghong Song [Thu, 29 Jun 2017 15:18:54 +0000 (15:18 +0000)]
bpf: remove unnecessary truncate operation

For networking-type bpf program, it often needs to access
packet data. A context data structure is provided to the bpf
programs with two fields:
        u32 data;
        u32 data_end;
User can access these two fields with ctx->data and ctx->data_end.
During program verification process, the kernel verifier modifies
the bpf program with loading of actual pointer value from kernel
data structure.
    r = ctx->data      ===> r = actual data start ptr
    r = ctx->data_end  ===> r = actual data end ptr

A typical program accessing ctx->data like
    char *data_ptr = (char *)(long)ctx->data
will result in a 32-bit load followed by a zero extension.
Such an operation is combined into a single LDW in DAG combiner
as bpf LDW does zero extension automatically.

In cases like the below (which can be a result of global value numbering
and partial redundancy elimination before insn selection):
B1:
   u32 a = load-32-bit &ctx->data
   u64 pa = zext a
   ...
B2:
   u32 b = load-32-bit &ctx->data
   u64 pb = zext b
   ...
B3:
   u32 m = PHI(a, b)
   u64 pm = zext m

In B3, "pm = zext m" cannot be removed, which although is legal
from compiler perspective, will generate incorrect code after
kernel verification.

This patch recognizes this pattern and traces through PHI node
to see whether the operand of "zext m" is defined with LDWs or not.
If it is, the "zext m" itself can be removed.

The patch also recognizes the pattern where the load and use of
the load value not in the same basic block, where truncate operation
may be removed as well.

The patch handles 1-byte, 2-byte and 4-byte truncation.

Two test cases are added to verify the transformation happens properly
for the above code pattern.

Signed-off-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@306685 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[NFC] Use stdin for some tests instead of positional argument.
Nikolai Bozhenov [Thu, 29 Jun 2017 14:51:54 +0000 (14:51 +0000)]
[NFC] Use stdin for some tests instead of positional argument.

Summary: Otherwise unexpected matches with the path to the tests might happen.

Reviewers: rengolin, spatel, efriedma, RKSimon

Reviewed By: spatel

Subscribers: n.bozhenov, javed.absar, llvm-commits

Patch by Andrei Elovikov <andrei.elovikov@intel.com>

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

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

7 years agoRestore original intent of memset instcombine test
Daniel Neilson [Thu, 29 Jun 2017 14:21:28 +0000 (14:21 +0000)]
Restore original intent of memset instcombine test

Summary:
The original intent of test/Transforms/InstCombine/memset.ll was to test for lowering of llvm.memset into stores when the size of the memset is 1, 2, 4, or 8. Sometime between then and now the test has stopped testing for that, but remained passing due to testing for the absence of llvm.memset calls rather than the presence of store instructions. Right now this test ends up with an empty function body because the alloca is eliminated as safe-to-remove, which results in the llvm.memset calls's being eliminated due to their pointer args being undef; so it is not testing for conversion of llvm.memset into store instructions at all.

This change alters the test to verify that store instructions are created, and moves the target of the memset to an arg of the proc to avoid it being eliminated as unused.

Reviewers: anna, efriedma

Reviewed By: efriedma

Subscribers: efriedma, llvm-commits

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

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

7 years agoExplicitly check for presence of correct results in instcombine memmove test
Daniel Neilson [Thu, 29 Jun 2017 14:17:50 +0000 (14:17 +0000)]
Explicitly check for presence of correct results in instcombine memmove test

Summary:
Rather than testing for expected results, test/Transforms/InstCombine/memmove.ll is testing for the absence of calls to llvm.memmove.

In the case of test3, the test has stopped testing for materialization of loads/stores, but remained passing due to testing for the absence of llvm.memset calls rather than the presence of load/store instructions. Right now this test ends up with an empty function body because the alloca is eliminated as safe-to-remove, which results in the llvm.memmove calls being eliminated due to a pointer arg being undef; so it is not testing for conversion of llvm.memmove into load/store instructions at all.

Reviewers: eli.friedman, anna, efriedma

Reviewed By: efriedma

Subscribers: efriedma, llvm-commits

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

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

7 years ago[PowerPC] fix potential verification error on __tls_get_addr
Hiroshi Inoue [Thu, 29 Jun 2017 14:13:38 +0000 (14:13 +0000)]
[PowerPC] fix potential verification error on __tls_get_addr

This patch fixes a verification error with -verify-machineinstrs while expanding __tls_get_addr by not creating ADJCALLSTACKUP and ADJCALLSTACKDOWN if there is another ADJCALLSTACKUP in this basic block since nesting ADJCALLSTACKUP/ADJCALLSTACKDOWN is not allowed.

Here, ADJCALLSTACKUP and ADJCALLSTACKDOWN are created as a fence for instruction scheduling to avoid _tls_get_addr is scheduled before mflr in the prologue (https://bugs.llvm.org//show_bug.cgi?id=25839). So if another ADJCALLSTACKUP exists before _tls_get_addr, we do not need to create a new ADJCALLSTACKUP.

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

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

7 years ago[DWARF] - Fix message reporting about broken relocation.
George Rimar [Thu, 29 Jun 2017 14:05:18 +0000 (14:05 +0000)]
[DWARF] - Fix message reporting about broken relocation.

Because of mistake introduced in r306517,
wrong variable ("name" instead of "Name") was used
in error message.
As a result it reported section name instead of
relocation name.

This file still needs cleanup to match LLVM coding style
and more tests I think.

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

7 years agoRevert "r306529 - [X86] Correct dwarf unwind information in function epilogue"
Daniel Jasper [Thu, 29 Jun 2017 13:58:24 +0000 (13:58 +0000)]
Revert "r306529 - [X86] Correct dwarf unwind information in function epilogue"

I am 99% sure that this breaks the PPC ASAN build bot:
http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux/builds/3112/steps/64-bit%20check-asan/logs/stdio

If it doesn't go back to green, we can recommit (and fix the original
commit message at the same time :) ).

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

7 years ago[TBAA] Remove metadata keyword from IR examples in comments (NFC).
Florian Hahn [Thu, 29 Jun 2017 13:55:23 +0000 (13:55 +0000)]
[TBAA] Remove metadata keyword from IR examples in comments (NFC).

The metadata keyword has been removed from the IR.

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

7 years ago[TargetTransformInfo, API] Add a list of operands to TTI::getUserCost
Evgeny Astigeevich [Thu, 29 Jun 2017 13:42:12 +0000 (13:42 +0000)]
[TargetTransformInfo, API] Add a list of operands to TTI::getUserCost

The changes are a result of discussion of https://reviews.llvm.org/D33685.
It solves the following problem:

1. We can inform getGEPCost about simplified indices to help it with
   calculating the cost. But getGEPCost does not take into account the
   context which GEPs are used in.
2. We have getUserCost which can take the context into account but we cannot
   inform about simplified indices.

With the changes getUserCost will have access to additional information
as getGEPCost has.

The one parameter getUserCost is also provided.

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

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

7 years agoRecommit "[Support] Add RetryAfterSignal helper function"
Pavel Labath [Thu, 29 Jun 2017 13:15:31 +0000 (13:15 +0000)]
Recommit "[Support] Add RetryAfterSignal helper function"

The difference from the previous version is the use of decltype, as the
implementation of std::result_of in libc++ did not work correctly for
variadic function like open(2).

Original summary:
This function retries an operation if it was interrupted by a signal
(failed with EINTR). It's inspired by the TEMP_FAILURE_RETRY macro in
glibc, but I've turned that into a template function. I've also added a
fail-value argument, to enable the function to be used with e.g.
fopen(3), which is documented to fail for any reason that open(2) can
fail (which includes EINTR).

The main user of this function will be lldb, but there were also a
couple of uses within llvm that I could simplify using this function.

Reviewers: zturner, silvas, joerg

Subscribers: mgorny, llvm-commits

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

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

7 years ago[GlobalISel][X86] Support vector type G_MERGE_VALUES selection.
Igor Breger [Thu, 29 Jun 2017 12:08:28 +0000 (12:08 +0000)]
[GlobalISel][X86] Support vector type G_MERGE_VALUES selection.

Summary:
Support vector type G_MERGE_VALUES selection. For now G_MERGE_VALUES marked as legal for any type, so nothing to do in legalizer.
Split from https://reviews.llvm.org/D33665

Reviewers: qcolombet, t.p.northover, zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, kristof.beyls, guyblank, llvm-commits

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

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

7 years ago[X86][SSE] Dropped -mcpu from palignr tests
Simon Pilgrim [Thu, 29 Jun 2017 11:13:39 +0000 (11:13 +0000)]
[X86][SSE] Dropped -mcpu from palignr tests

Use triple and attribute only for consistency

Add AVX tests as well

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

7 years ago[X86][SSE] Regenerate shuffle test with update_llc_test_checks.py
Simon Pilgrim [Thu, 29 Jun 2017 11:11:37 +0000 (11:11 +0000)]
[X86][SSE] Regenerate shuffle test with update_llc_test_checks.py

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

7 years ago[X86][SSE] Dropped -mcpu from vector shift tests
Simon Pilgrim [Thu, 29 Jun 2017 11:09:53 +0000 (11:09 +0000)]
[X86][SSE] Dropped -mcpu from vector shift tests

Use triple and attribute only for consistency

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

7 years ago[X86][SSE] Dropped -mcpu from zero insertion tests
Simon Pilgrim [Thu, 29 Jun 2017 11:08:11 +0000 (11:08 +0000)]
[X86][SSE] Dropped -mcpu from zero insertion tests

Use triple and attribute only for consistency

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

7 years ago[LLVM][X86][Goldmont] Adding new target-cpu: Goldmont
Michael Zuckerman [Thu, 29 Jun 2017 10:00:33 +0000 (10:00 +0000)]
[LLVM][X86][Goldmont] Adding new target-cpu: Goldmont

[LLVM SIDE]
Connecting the GoldMont processor to his feature.

Reviewers:
1. igorb
2. zvi
3. delena
4. RKSimon
5. craig.topper

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

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

7 years agoTest commit
NAKAMURA Takumi [Thu, 29 Jun 2017 09:46:01 +0000 (09:46 +0000)]
Test commit

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

7 years ago[SLPVectorizer] Introducing getTreeEntry() helper function [NFC]
Dinar Temirbulatov [Thu, 29 Jun 2017 08:46:18 +0000 (08:46 +0000)]
[SLPVectorizer] Introducing getTreeEntry() helper function [NFC]

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

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

7 years ago[ARM] Add tGPRwithpc register class and use it for TBB/THH
Florian Hahn [Thu, 29 Jun 2017 08:45:31 +0000 (08:45 +0000)]
[ARM] Add tGPRwithpc register class and use it for TBB/THH

Summary:
TBB and THH allow using a Thumb GPR or the PC as destination operand.
A few machine verifier failures where due to those instructions not
expecting PC as destination operand.

Add -verify-machineinstrs to test/CodeGen/ARM/jump-table-tbh.ll to add
test coverage even if expensive checks are disabled.

Reviewers: MatzeB, t.p.northover, jmolloy

Reviewed By: MatzeB

Subscribers: aemerson, javed.absar, kristof.beyls, llvm-commits

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

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

7 years ago[BinaryFormat] Identify AArch64 COFF files
Martin Storsjo [Thu, 29 Jun 2017 06:30:56 +0000 (06:30 +0000)]
[BinaryFormat] Identify AArch64 COFF files

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

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

7 years ago[X86] Adding shuffle tests demonstrating missed vcompress opportunities. NFC
Zvi Rackover [Thu, 29 Jun 2017 06:22:01 +0000 (06:22 +0000)]
[X86] Adding shuffle tests demonstrating missed vcompress opportunities. NFC

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

7 years ago[lit] Re-apply: Fix some convoluted logic around Unicode encoding, and de-duplicate...
David L. Jones [Thu, 29 Jun 2017 04:37:35 +0000 (04:37 +0000)]
[lit] Re-apply: Fix some convoluted logic around Unicode encoding, and de-duplicate across modules that used it.

(Take 2: this patch re-applies r306625, which was reverted in r306629. This
patch includes only trivial fixes.)

In Python2 and Python3, the various (non-)?Unicode string types are sort of
spaghetti. Python2 has unicode support tacked on via the 'unicode' type, which
is distinct from 'str' (which are bytes). Python3 takes the "unicode-everywhere"
approach, with 'str' representing a Unicode string.

Both have a 'bytes' type. In Python3, it is the only way to represent raw bytes.
However, in Python2, 'bytes' is an alias for 'str'. This leads to interesting
problems when an interface requires a precise type, but has to run under both
Python2 and Python3.

The previous logic appeared to be correct in all cases, but went through more
layers of indirection than necessary. This change does the necessary conversions
in one shot, with documentation about which paths might be taken in Python2 or
Python3.

Changes from r306625: some tests just print binary outputs, so in those cases,
fall back to str() in Python3. For googletests, add one missing call to
to_string().

(Tested by verifying the visible breakage with Python3. Verified that everything
works in py2 and py3.)

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

7 years agollvm-profdata: Indirect infrequently used fields to reduce memory usage
David Blaikie [Thu, 29 Jun 2017 02:51:58 +0000 (02:51 +0000)]
llvm-profdata: Indirect infrequently used fields to reduce memory usage

Examining a large profile example, it seems relatively few records have
non-empty IndirectCall and MemOP data, so indirecting these through a
unique_ptr (non-null only when they are non-empty) Reduces memory usage
on this particular example from 14GB to 10GB according to valgrind's
massif.

I suspect it'd still be worth moving InstrProfWriter to its own data
structure that had Counts and the indirected IndirectCall+MemOP, and did
not include the Name, Hash, or Error fields. This would reduce the size
of this dominant data structure by half of this new, lower amount.
(Name(2), Hash(1), Error(1) ~= Counts(vector, 3), ValueProfData
(unique_ptr, 1))
-> From code review feedback, might actually refactor InstrProfRecord
itself to have a sub-struct with all the counts, and use that from
InstrProfWriter, rather than InstrProfWriter owning its own data
structure for this.

Reviewers: davidxl

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

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

7 years agoRevert "[lit] Fix some convoluted logic around Unicode encoding, and de-duplicate...
David L. Jones [Thu, 29 Jun 2017 02:22:49 +0000 (02:22 +0000)]
Revert "[lit] Fix some convoluted logic around Unicode encoding, and de-duplicate across modules that used it."

This reverts r306625.

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

7 years agoFix spelling: uncode -> unicode.
David L. Jones [Thu, 29 Jun 2017 01:03:56 +0000 (01:03 +0000)]
Fix spelling: uncode -> unicode.

Remember kids: there is no 'I' in str or bytes, but there is ALWAYS an
'I' in unicode.

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

7 years ago[lit] Fix some convoluted logic around Unicode encoding, and de-duplicate across...
David L. Jones [Thu, 29 Jun 2017 01:03:55 +0000 (01:03 +0000)]
[lit] Fix some convoluted logic around Unicode encoding, and de-duplicate across modules that used it.

Summary:
In Python2 and Python3, the various (non-)?Unicode string types are sort of
spaghetti. Python2 has unicode support tacked on via the 'unicode' type, which
is distinct from 'str' (which are bytes). Python3 takes the "unicode-everywhere"
approach, with 'str' representing a Unicode string.

Both have a 'bytes' type. In Python3, it is the only way to represent raw bytes.
However, in Python2, 'bytes' is an alias for 'str'. This leads to interesting
problems when an interface requires a precise type, but has to run under both
Python2 and Python3.

The previous logic appeared to be correct in all cases, but went through more
layers of indirection than necessary. This change does the necessary conversions
in one shot, with documentation about which paths might be taken in Python2 or
Python3.

Reviewers: zturner, modocache

Subscribers: llvm-commits, sanjoy

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

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