]> granicus.if.org Git - llvm/log
llvm
7 years ago[InstSimplify] add tests to show we can do better at folding poison; NFC
Sanjay Patel [Sat, 7 Oct 2017 15:39:06 +0000 (15:39 +0000)]
[InstSimplify] add tests to show we can do better at folding poison; NFC

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

7 years ago[TableGen] Avoid repeated find calls in CodeGenDAGPatterns getters. NFCI.
Simon Pilgrim [Sat, 7 Oct 2017 14:34:24 +0000 (14:34 +0000)]
[TableGen] Avoid repeated find calls in CodeGenDAGPatterns getters. NFCI.

The assertion tests were using count() instead of testing the find result, resulting in double the number of searches in debug/assert builds.

Instead, call find once (like the release builds do) and assert the result against end().

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

7 years ago[X86][SSE] Improve shuffling combining with horizontal operations
Simon Pilgrim [Sat, 7 Oct 2017 12:42:23 +0000 (12:42 +0000)]
[X86][SSE] Improve shuffling combining with horizontal operations

Recognise cases when we can merge the shuffles with their horizontal (HADD/HSUB/PACK) instruction inputs.

Replaces an older implementation which performed some of this during lowering, expanding an existing target shuffle combine stage instead.

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

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

7 years ago[TableGen] Avoid unnecessary std::string creations
Simon Pilgrim [Sat, 7 Oct 2017 12:08:43 +0000 (12:08 +0000)]
[TableGen] Avoid unnecessary std::string creations

Avoid unnecessary std::string creations in the TreePredicateFn getters and in CodeGenDAGPatterns::getSDNodeNamed

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

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

7 years ago[X86] Update an outdated comment about SjLj
Martin Storsjo [Sat, 7 Oct 2017 06:00:32 +0000 (06:00 +0000)]
[X86] Update an outdated comment about SjLj

The SjLj intrinsics in the X86 backend are intended for use with
SjLj exception handling as well, since SVN r271244.

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

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

7 years ago[X86] Correct result type for the flag result of RDSEED and RDRAND nodes. Correct...
Craig Topper [Sat, 7 Oct 2017 05:11:59 +0000 (05:11 +0000)]
[X86] Correct result type for the flag result of RDSEED and RDRAND nodes. Correct the CC type for the CMOV used with RDSEED/RDRAND.

The flag result was MVT::Glue, but should be MVT::i32. The CC type was MVT::i8, but should be MVT::i32.

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

7 years ago[MachineOutliner] Disable outlining from LinkOnceODRs by default
Jessica Paquette [Sat, 7 Oct 2017 00:16:34 +0000 (00:16 +0000)]
[MachineOutliner] Disable outlining from LinkOnceODRs by default

Say you have two identical linkonceodr functions, one in M1 and one in M2.
Say that the outliner outlines A,B,C from one function, and D,E,F from another
function (where letters are instructions). Now those functions are not
identical, and cannot be deduped. Locally to M1 and M2, these outlining
choices would be good-- to the whole program, however, this might not be true!

To mitigate this, this commit makes it so that the outliner sees linkonceodr
functions as unsafe to outline from. It also adds a flag,
-enable-linkonceodr-outlining, which allows the user to specify that they
want to outline from such functions when they know what they're doing.

Changing this handles most code size regressions in the test suite caused by
competing with linker dedupe. It also doesn't have a huge impact on the code
size improvements from the outliner. There are 6 tests that regress > 5% from
outlining WITH linkonceodrs to outlining WITHOUT linkonceodrs. Overall, most
tests either improve or are not impacted.

Not outlined vs outlined without linkonceodrs:
https://hastebin.com/raw/qeguxavuda

Not outlined vs outlined with linkonceodrs:
https://hastebin.com/raw/edepoqoqic

Outlined with linkonceodrs vs outlined without linkonceodrs:
https://hastebin.com/raw/awiqifiheb

Numbers generated using compare.py with -m size.__text. Tests run for AArch64
with -Oz -mllvm -enable-machine-outliner -mno-red-zone.

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

7 years ago[InstCombine] use correct type when propagating constant condition in simplifyDivRemO...
Sanjay Patel [Fri, 6 Oct 2017 23:43:06 +0000 (23:43 +0000)]
[InstCombine] use correct type when propagating constant condition in simplifyDivRemOfSelectWithZeroOp (PR34856)

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

7 years ago[llvm-rc] Fix some endianness errors.
Zachary Turner [Fri, 6 Oct 2017 23:21:43 +0000 (23:21 +0000)]
[llvm-rc] Fix some endianness errors.

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

7 years ago[InstCombine] rename SimplifyDivRemOfSelect to be clearer, add comments, simplify...
Sanjay Patel [Fri, 6 Oct 2017 23:20:16 +0000 (23:20 +0000)]
[InstCombine] rename SimplifyDivRemOfSelect to be clearer, add comments, simplify code; NFCI

There's at least one bug here - this code can fail with vector types (PR34856).
It's also being called for FREM; I'm still trying to understand how that is valid.

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

7 years ago[AVX512] Fix TERNLOG when folding broadcast
Cameron McInally [Fri, 6 Oct 2017 22:31:29 +0000 (22:31 +0000)]
[AVX512] Fix TERNLOG when folding broadcast

Patch to fix ternlog instructions with a folded
broadcast. The broadcast decorator, e.g. {1toX}, was missing.

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

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

7 years ago[dwarfdump] Verify that unit type matches root DIE
Jonas Devlieghere [Fri, 6 Oct 2017 22:27:31 +0000 (22:27 +0000)]
[dwarfdump] Verify that unit type matches root DIE

This patch adds two new verifiers:

  - It checks that the root DIE of a CU is actually a valid unit DIE.
    (based on its tag)
  - For DWARF5 which contains a unit type int he CU header, it checks that
    this matches the type of the unit DIE.

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

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

7 years ago[llvm-rc] Implement escape sequences in .rc files.
Zachary Turner [Fri, 6 Oct 2017 22:05:15 +0000 (22:05 +0000)]
[llvm-rc] Implement escape sequences in .rc files.

This allows the escape sequences (\a, \n, \r, \t, \\, \x[0-9a-f]*,
\[0-7]*, "") to appear in .rc scripts. These are parsed and output in
the same way as it's done in original MS implementation.

The way these sequences are processed depends on the type of the
resource it resides in, and on whether the user declared the string to
be "wide" or "narrow".

I tried to maintain the maximum compatibility with the original tool
(and fail in some erroneous situations that are accepted by .rc).
However, there are some (extremely rare) cases where Microsoft tool
outputs nonsense. I found it infeasible to detect such casses.

Patch by Marek Sokolowski

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

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

7 years ago[llvm-rc] Serialize user-defined resources to .res files.
Zachary Turner [Fri, 6 Oct 2017 21:52:15 +0000 (21:52 +0000)]
[llvm-rc] Serialize user-defined resources to .res files.

This allows rc to serialize user-defined resources, as
documented at:

msdn.microsoft.com/en-us/library/windows/desktop/aa381054.aspx

Escape sequences are yet unavailable, and are to be added in one of
child patches.

Patch by: Marek Sokolowski

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

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

7 years ago[llvm-rc] Serialize STRINGTABLE statements to .res file.
Zachary Turner [Fri, 6 Oct 2017 21:30:55 +0000 (21:30 +0000)]
[llvm-rc] Serialize STRINGTABLE statements to .res file.

This allows llvm-rc to serialize STRINGTABLE resources.

These are output in an unusual way: we locate them at the end of the
file, and strings are merged into bundles of max 16 strings, depending
on their IDs, language, and characteristics.

Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381050.aspx

Patch by: Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D38420

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

7 years ago[llvm-rc] Serialize VERSIONINFO resources to .res files.
Zachary Turner [Fri, 6 Oct 2017 21:26:06 +0000 (21:26 +0000)]
[llvm-rc] Serialize VERSIONINFO resources to .res files.

This is now able to dump VERSIONINFO resources.

Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa381058.aspx

Differential Revision: https://reviews.llvm.org/D38410
Patch by: Marek Sokolowski

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

7 years ago[llvm-rc] Serialize CURSOR and ICON resources to .res
Zachary Turner [Fri, 6 Oct 2017 21:25:44 +0000 (21:25 +0000)]
[llvm-rc] Serialize CURSOR and ICON resources to .res

This is part 6 of llvm-rc serialization.

This adds ability to output cursors and icons as resources.

Unfortunately, we can't just copy .cur or .ico files to output - as each
file might contain multiple images, each of them needs to be unpacked
and stored as a separate resource. This forces us to parse cursor and
icon contents. (Fortunately, these formats are pretty similar and can be
processed by mostly common code).

As test files are binary, here is a short explanation of .cur and .ico
files stored:

cursor.cur, cursor-8.cur, cursor-32.cur are sample correct cursor files,
differing in their bit depth.

icon-old.ico, icon-new.ico are sample correct icon files;

icon-png.ico is a sample correct icon file in PNG format (instead of
usual BMP);

cursor-eof.cur is an incorrect cursor file - this is cursor.cur with
some of its final bytes removed.

cursor-bad-offset.cur is an incorrect cursor file - image header states
that image data begins at offset 0xFFFFFFFF.

Sample correct cursors and icons were created by Nico Weber.

Patch by Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D37878

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

7 years agoRevert "Roll forward r314928"
Reid Kleckner [Fri, 6 Oct 2017 21:17:51 +0000 (21:17 +0000)]
Revert "Roll forward r314928"

This appears to be miscompiling Clang, as shown on two Windows bootstrap
bots:
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/7611
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/6870

Nothing else is in the blame list. Both emit errors on this valid code
in the Windows ucrt headers:

C:\...\ucrt\malloc.h:95:32: error: invalid operands to binary expression ('char *' and 'int')
            _Ptr = (char*)_Ptr + _ALLOCA_S_MARKER_SIZE;
                   ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~

I am attempting to reproduce this now.

This reverts r315044

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

7 years ago[llvm-rc] Add optional serialization support for DIALOG(EX) resources.
Zachary Turner [Fri, 6 Oct 2017 20:51:20 +0000 (20:51 +0000)]
[llvm-rc] Add optional serialization support for DIALOG(EX) resources.

This is part 5 of llvm-rc serialization support.

This allows DIALOG and DIALOGEX to serialize if dialog-specific optional
statements are provided. These are (as of now): CAPTION, FONT, and
STYLE.

Notably, FONT statement can take more than two arguments when describing
DIALOGEX resources (as in
msdn.microsoft.com/en-us/library/windows/desktop/aa381013.aspx). I made
some changes to the parser to reflect this fact.

Patch by Marek Sokolowski
Differential Revision: https://reviews.llvm.org/D37864

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

7 years agoUnify spelling.
Adrian Prantl [Fri, 6 Oct 2017 20:24:35 +0000 (20:24 +0000)]
Unify spelling.

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

7 years agollvm-dwarfdump: Add an option to collect debug info quality metrics.
Adrian Prantl [Fri, 6 Oct 2017 20:24:34 +0000 (20:24 +0000)]
llvm-dwarfdump: Add an option to collect debug info quality metrics.

At the last LLVM dev meeting we had a debug info for optimized code
BoF session. In that session I presented some graphs that showed how
the quality of the debug info produced by LLVM changed over the last
couple of years. This is a cleaned up version of the patch I used to
collect the this data. It is implemented as an extension of
llvm-dwarfdump, adding a new --statistics option. The intended
use-case is to automatically run this on the debug info produced by,
e.g., our bots, to identify eyebrow-raising changes or regressions
introduced by new transformations that we could act on.

In the current form, two kinds of data are being collected:

- The number of variables that have a debug location versus the number
  of variables in total (this takes into account inlined instances of
  the same function, so if a variable is completely missing form only
  one instance it will be found).

- The PC range covered by variable location descriptions versus the PC
  range of all variables' containing lexical scopes.

The output format is versioned and extensible, so I'm looking forward
to both bug fixes and ideas for other data that would be interesting
to track.

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

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

7 years ago[GlobalISel] Fix legalizer trying to process a deleted instruction.
Amara Emerson [Fri, 6 Oct 2017 19:24:15 +0000 (19:24 +0000)]
[GlobalISel] Fix legalizer trying to process a deleted instruction.

In some cases an instruction is deleted from the block during combining,
however it can still exist in the legalizer worklist.

This change modifies the combiner routines to add the given MI to the
dead instruction list rather than trying to remove it from the block
themselves. The responsibility is then on the caller to delete the instruction
from the block and any worklists.

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

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

7 years ago[PEI] Remove required properties and use 'if' instead of std::function
Reid Kleckner [Fri, 6 Oct 2017 18:21:19 +0000 (18:21 +0000)]
[PEI] Remove required properties and use 'if' instead of std::function

Summary:
After r303360, we initialize UsesCalleeSaves in runOnMachineFunction,
which runs after getRequiredProperties. UsesCalleeSaves was initialized
to 'false', so getRequiredProperties would always return an empty set.
We don't have a TargetMachine available early anymore after r303360.
Just removing the requirement of NoVRegs seems to make things work, so
let's do that.

Reviewers: thegameg, dschuff, MatzeB

Subscribers: hiraditya, llvm-commits

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

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

7 years agoRevert "[dsymutil] Emit valid debug locations when no symbol flags are set"
Francis Ricci [Fri, 6 Oct 2017 18:19:52 +0000 (18:19 +0000)]
Revert "[dsymutil] Emit valid debug locations when no symbol flags are set"

This reverts commit r315082, which fails on non-darwin buildbots.

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

7 years agoBitcode: add an auto-upgrade for LTO section name
Saleem Abdulrasool [Fri, 6 Oct 2017 18:06:59 +0000 (18:06 +0000)]
Bitcode: add an auto-upgrade for LTO section name

The bitcode reader looks specifically for `__DATA, __objc_catlist` as a
section name.  However, SVN r304661 removed the spaces (the two names
are functionally equivalent but do not compare equally
lexicographically).  This causes compatibility issues.  Add an
auto-upgrade path for removing the spaces as well as use the new name in
the LTO plugin.

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

7 years ago[lit] Improve tool substitution in lit.
Zachary Turner [Fri, 6 Oct 2017 17:54:46 +0000 (17:54 +0000)]
[lit] Improve tool substitution in lit.

This addresses two sources of inconsistency in test configuration
files.

1. Substitution boundaries.  Previously you would specify a
   substitution, such as 'lli', and then additionally a set
   of characters that should fail to match before and after
   the tool.  This was used, for example, so that matches that
   are parts of full paths would not be replaced.  But not all
   tools did this, and those that did would often re-invent
   the set of characters themselves, leading to inconsistency.
   Now, every tool substitution defaults to using a sane set
   of reasonable defaults and you have to explicitly opt out
   of it.  This actually fixed a few latent bugs that were
   never being surfaced, but only on accident.

2. There was no standard way for the system to decide how to
   locate a tool.  Sometimes you have an explicit path, sometimes
   we would search for it and build up a path ourselves, and
   sometimes we would build up a full command line.  Furthermore,
   there was no standardized way to handle missing tools.  Do we
   warn, fail, ignore, etc?  All of this is now encapsulated in
   the ToolSubst class.  You either specify an exact command to
   run, or an instance of FindTool('<tool-name>') and everything
   else just works.  Furthermore, you can specify an action to
   take if the tool cannot be resolved.

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

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

7 years agoRun pyformat on lit code.
Zachary Turner [Fri, 6 Oct 2017 17:54:27 +0000 (17:54 +0000)]
Run pyformat on lit code.

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

7 years ago[ARM] GlobalISel: Make tests less strict
Diana Picus [Fri, 6 Oct 2017 17:47:27 +0000 (17:47 +0000)]
[ARM] GlobalISel: Make tests less strict

These are intended as integration tests, so they shouldn't be too
specific about what they're checking.

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

7 years ago[dsymutil] Emit valid debug locations when no symbol flags are set
Francis Ricci [Fri, 6 Oct 2017 17:43:37 +0000 (17:43 +0000)]
[dsymutil] Emit valid debug locations when no symbol flags are set

Summary:
swiftc emits symbols without flags set, which led dsymutil to ignore
them when searching for global symbols, causing dwarf location data
to be omitted. Xcode's dsymutil handles this case correctly, and emits
valid location data. Add this functionality to llvm-dsymutil by
allowing parsing of symbols with no flags set.

Reviewers: aprantl, friss, JDevlieghere

Subscribers: llvm-commits

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

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

7 years ago[AMDGPU] New 64 bit div/rem expansion
Stanislav Mekhanoshin [Fri, 6 Oct 2017 17:24:45 +0000 (17:24 +0000)]
[AMDGPU] New 64 bit div/rem expansion

Old expansion was 20 VGPRs, 78 SGPRs and ~380 instructions.
This expansion is 11 VGPRs, 12 SGPRs and ~120 instructions.

Passes OpenCL conformance test_integer_ops quick_[u]long_math

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

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

7 years ago[MC] Use unique_ptr to manage WinFrameInfos, NFC
Reid Kleckner [Fri, 6 Oct 2017 17:21:49 +0000 (17:21 +0000)]
[MC] Use unique_ptr to manage WinFrameInfos, NFC

The FrameInfo cannot be stored directly in the vector because chained
frames may refer to parent frames, so we need pointers that are stable
across a vector resize.

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

7 years agoSupport: Rewrite Windows implementation of sys::fs::rename to be more POSIXy.
Peter Collingbourne [Fri, 6 Oct 2017 17:14:36 +0000 (17:14 +0000)]
Support: Rewrite Windows implementation of sys::fs::rename to be more POSIXy.

The current implementation of rename uses ReplaceFile if the
destination file already exists. According to the documentation for
ReplaceFile, the source file is opened without a sharing mode. This
means that there is a short interval of time between when ReplaceFile
renames the file and when it closes the file during which the
destination file cannot be opened.

This behaviour is not POSIX compliant because rename is supposed
to be atomic. It was also causing intermittent link failures when
linking with a ThinLTO cache; the ThinLTO cache implementation expects
all cache files to be openable.

This patch addresses that problem by re-implementing rename
using CreateFile and SetFileInformationByHandle. It is roughly a
reimplementation of ReplaceFile with a better sharing policy as well
as support for renaming in the case where the destination file does
not exist.

This implementation is still not fully POSIX. Specifically in the case
where the destination file is open at the point when rename is called,
there will be a short interval of time during which the destination
file will not exist. It isn't clear whether it is possible to avoid
this using the Windows API.

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

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

7 years agoDirectly return promoted direct call instead of rely on stripPointerCast.
Dehao Chen [Fri, 6 Oct 2017 17:04:55 +0000 (17:04 +0000)]
Directly return promoted direct call instead of rely on stripPointerCast.

Summary: stripPointerCast is not reliably returning the value that's being type-casted. Instead it may look further at function attributes to further propagate the value. Instead of relying on stripPOintercast, the more reliable solution is to directly use the pointer to the promoted direct call.

Reviewers: tejohnson, davidxl

Reviewed By: tejohnson

Subscribers: llvm-commits, sanjoy

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

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

7 years agoGuard xar RAII behind HAVE_LIBXAR
Francis Ricci [Fri, 6 Oct 2017 15:54:20 +0000 (15:54 +0000)]
Guard xar RAII behind HAVE_LIBXAR

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

7 years ago[ARM] GlobalISel: Select shifts
Diana Picus [Fri, 6 Oct 2017 15:39:16 +0000 (15:39 +0000)]
[ARM] GlobalISel: Select shifts

Unfortunately TableGen doesn't handle this yet:
Unable to deduce gMIR opcode to handle Src (which is a leaf).

Just add some temporary hand-written code to generate the proper MOVsr.

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

7 years agoStrip trailing whitespace
Simon Pilgrim [Fri, 6 Oct 2017 15:33:55 +0000 (15:33 +0000)]
Strip trailing whitespace

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

7 years ago[llvm-objdump] Add RAII for xar apis
Francis Ricci [Fri, 6 Oct 2017 15:33:28 +0000 (15:33 +0000)]
[llvm-objdump] Add RAII for xar apis

Summary:
xar_open and xar_iter_new require manual calls to close/free functions
to deallocate resources. This makes it easy to introduce memory leaks,
so add RAII struct wrappers for these resources.

Reviewers: enderby, rafael, compnerd, lhames, dblaikie

Subscribers: llvm-commits

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

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

7 years ago[TableGen] Simplify SubtargetEmitter
Javed Absar [Fri, 6 Oct 2017 15:25:04 +0000 (15:25 +0000)]
[TableGen] Simplify SubtargetEmitter

Remove unnecessary duplicate if-condition.

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

7 years ago[ARM] GlobalISel: Map shift operands to GPRs
Diana Picus [Fri, 6 Oct 2017 14:52:43 +0000 (14:52 +0000)]
[ARM] GlobalISel: Map shift operands to GPRs

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

7 years ago[llvm-dsymutil] Add support for __swift_ast MachO DWARF section
Francis Ricci [Fri, 6 Oct 2017 14:49:20 +0000 (14:49 +0000)]
[llvm-dsymutil] Add support for __swift_ast MachO DWARF section

Summary:
Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging,
and which contains a byte-for-byte dump of the swiftmodule file.
Add this feature to llvm-dsymutil.

Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of
`__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil
(Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the
__swift_ast section).

Reviewers: aprantl, friss

Subscribers: llvm-commits, JDevlieghere

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

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

7 years ago[ARM] GlobalISel: Mark shifts as legal for s32
Diana Picus [Fri, 6 Oct 2017 14:30:05 +0000 (14:30 +0000)]
[ARM] GlobalISel: Mark shifts as legal for s32

The new legalize combiner introduces shifts all over the place, so we
should support them sooner rather than later.

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

7 years ago[SystemZ] Enable machine scheduler.
Jonas Paulsson [Fri, 6 Oct 2017 13:59:28 +0000 (13:59 +0000)]
[SystemZ]  Enable machine scheduler.

The machine scheduler (before register allocation) is enabled by default for
SystemZ.

The SelectionDAG scheduling preference now becomes source order scheduling
(was regpressure).

Review: Ulrich Weigand
https://reviews.llvm.org/D37977

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

7 years ago[MergeICmp][NFC] Make test tuple-four-int8.ll more readable.
Clement Courbet [Fri, 6 Oct 2017 13:45:16 +0000 (13:45 +0000)]
[MergeICmp][NFC] Make test tuple-four-int8.ll more readable.

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

7 years ago[X86][SSE] Add SKX cpu tests to SSE/AVX scheduling tests (D38443)
Simon Pilgrim [Fri, 6 Oct 2017 13:40:29 +0000 (13:40 +0000)]
[X86][SSE] Add SKX cpu tests to SSE/AVX scheduling tests (D38443)

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

7 years agoRevert "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp...
Clement Courbet [Fri, 6 Oct 2017 13:02:24 +0000 (13:02 +0000)]
Revert "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion."

Still a few stability issues on windows.

This reverts commit 67e3db9bc121ba244e20337aabc7cf341a62b545.

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

7 years agoRe-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp...
Clement Courbet [Fri, 6 Oct 2017 12:12:35 +0000 (12:12 +0000)]
Re-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion."

(fixed unit tests by making comparisons stable)

This reverts commit 1b2d359ce256fd6737da4e93833346a0bd6d7583.

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

7 years ago[TableGen] : CodeGenInsrtuction modify to range loop. NFC.
Javed Absar [Fri, 6 Oct 2017 09:32:45 +0000 (09:32 +0000)]
[TableGen] : CodeGenInsrtuction modify to range loop. NFC.

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

7 years agoRoll forward r314928
Xinliang David Li [Fri, 6 Oct 2017 05:15:25 +0000 (05:15 +0000)]
Roll forward r314928

Fixed ThinLTO bootstrap failure : track new
bitcast per incomingVal. Added new tests.

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

7 years ago[PM] Retire disable unit-at-a-time switch.
Davide Italiano [Fri, 6 Oct 2017 04:39:40 +0000 (04:39 +0000)]
[PM] Retire disable unit-at-a-time switch.

This is a vestige from the GCC-3 days, which disables IPO passes
when set. I don't think anybody actually uses it as there are
several IPO passes which still run with this flag set and
nobody complained/noticed. This reduces the delta between
current and new pass manager and allows us to easily review
the difference when we decide to flip the switch (or audit
which passes should run, FWIW).

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

7 years ago[CodeExtractor] Fix multiple bugs under certain shape of extracted region
Jakub Kuderski [Fri, 6 Oct 2017 03:37:06 +0000 (03:37 +0000)]
[CodeExtractor] Fix multiple bugs under certain shape of extracted region

Summary:
If the extracted region has multiple exported data flows toward the same BB which is not included in the region, correct resotre instructions and PHI nodes won't be generated inside the exitStub. The solution is simply put the restore instructions right after the definition of output values instead of putting in exitStub.
Unittest for this bug is included.

Author: myhsu

Reviewers: chandlerc, davide, lattner, silvas, davidxl, wmi, kuhar

Subscribers: dberlin, kuhar, mgorny, llvm-commits

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

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

7 years agoNewGVN: Factor out duplicate parts of OpIsSafeForPHIOfOps
Daniel Berlin [Fri, 6 Oct 2017 01:33:06 +0000 (01:33 +0000)]
NewGVN: Factor out duplicate parts of OpIsSafeForPHIOfOps

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

7 years agoRevert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"
Francis Ricci [Thu, 5 Oct 2017 23:09:17 +0000 (23:09 +0000)]
Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"

Breaks aarch64 builders

This reverts commit r315014.

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

7 years ago[MBP] Remove an invalid assert.
Xin Tong [Thu, 5 Oct 2017 23:00:04 +0000 (23:00 +0000)]
[MBP] Remove an invalid assert.

The patch that this assert comes with is fixing a bug in MBP. The assert is
invalid however.

Thanks to @sergey.k.okunev for finding this

Currently this fails SPECCPU2006 LTO. I will add a test case when I do more
investigation and have one.

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

7 years agoModuleUtils: Stop using comdat members to generate unique module ids.
Peter Collingbourne [Thu, 5 Oct 2017 21:54:53 +0000 (21:54 +0000)]
ModuleUtils: Stop using comdat members to generate unique module ids.

It is possible for two modules to define the same set of external
symbols without causing a duplicate symbol error at link time,
as long as each of the symbols is a comdat member. So we cannot
use them as part of a unique id for the module.

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

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

7 years ago[X86] Extract CATCHRET handling from emitEpilogue, NFC
Reid Kleckner [Thu, 5 Oct 2017 21:37:39 +0000 (21:37 +0000)]
[X86] Extract CATCHRET handling from emitEpilogue, NFC

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

7 years ago[WebAssembly] Add the rest of the atomic loads
Derek Schuff [Thu, 5 Oct 2017 21:18:42 +0000 (21:18 +0000)]
[WebAssembly] Add the rest of the atomic loads

Add extending loads and constant offset patterns
A bit more refactoring of the tablegen to make the patterns fairly nice and
uniform between the regular and atomic loads.

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

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

7 years ago[InstCombine] improve folds for icmp gt/lt (shr X, C1), C2
Sanjay Patel [Thu, 5 Oct 2017 21:11:49 +0000 (21:11 +0000)]
[InstCombine] improve folds for icmp gt/lt (shr X, C1), C2

We can always eliminate the shift in: icmp gt/lt (shr X, C1), C2 --> icmp gt/lt X, C'
This patch was supposed to just be an efficiency improvement because we were doing this 3-step process to fold:

IC: Visiting:   %c = icmp ugt i4 %s, 1
IC: ADD:   %s = lshr i4 %x, 1
IC: ADD:   %1 = udiv i4 %x, 2
IC: Old =   %c = icmp ugt i4 %1, 1
    New =   <badref> = icmp uge i4 %x, 4
IC: ADD:   %c = icmp uge i4 %x, 4
IC: ERASE   %2 = icmp ugt i4 %1, 1
IC: Visiting:   %c = icmp uge i4 %x, 4
IC: Old =   %c = icmp uge i4 %x, 4
    New =   <badref> = icmp ugt i4 %x, 3
IC: ADD:   %c = icmp ugt i4 %x, 3
IC: ERASE   %2 = icmp uge i4 %x, 4
IC: Visiting:   %c = icmp ugt i4 %x, 3
IC: DCE:   %1 = udiv i4 %x, 2
IC: ERASE   %1 = udiv i4 %x, 2
IC: DCE:   %s = lshr i4 %x, 1
IC: ERASE   %s = lshr i4 %x, 1
IC: Visiting:   ret i1 %c

When we could go directly to canonical icmp form:

IC: Visiting:   %c = icmp ugt i4 %s, 1
IC: Old =   %c = icmp ugt i4 %s, 1
    New =   <badref> = icmp ugt i4 %x, 3
IC: ADD:   %c = icmp ugt i4 %x, 3
IC: ERASE   %1 = icmp ugt i4 %s, 1
IC: ADD:   %s = lshr i4 %x, 1
IC: DCE:   %s = lshr i4 %x, 1
IC: ERASE   %s = lshr i4 %x, 1
IC: Visiting:   %c = icmp ugt i4 %x, 3

...but then I noticed that the folds were incomplete too:
https://godbolt.org/g/aB2hLE

Here are attempts to prove the logic with Alive:
https://rise4fun.com/Alive/92o

Name: lshr_ult
Pre: ((C2 << C1) u>> C1) == C2
%sh = lshr i8 %x, C1
%r = icmp ult i8 %sh, C2
  =>
%r = icmp ult i8 %x, (C2 << C1)

Name: ashr_slt
Pre: ((C2 << C1) >> C1) == C2
%sh = ashr i8 %x, C1
%r = icmp slt i8 %sh, C2
  =>
%r = icmp slt i8 %x, (C2 << C1)

Name: lshr_ugt
Pre: (((C2+1) << C1) u>> C1) == (C2+1)
%sh = lshr i8 %x, C1
%r = icmp ugt i8 %sh, C2
  =>
%r = icmp ugt i8 %x, ((C2+1) << C1) - 1

Name: ashr_sgt
Pre: (C2 != 127) && ((C2+1) << C1 != -128) && (((C2+1) << C1) >> C1) == (C2+1)
%sh = ashr i8 %x, C1
%r = icmp sgt i8 %sh, C2
  =>
%r = icmp sgt i8 %x, ((C2+1) << C1) - 1

Name: ashr_exact_sgt
Pre: ((C2 << C1) >> C1) == C2
%sh = ashr exact i8 %x, C1
%r = icmp sgt i8 %sh, C2
  =>
%r = icmp sgt i8 %x, (C2 << C1)

Name: ashr_exact_slt
Pre: ((C2 << C1) >> C1) == C2
%sh = ashr exact i8 %x, C1
%r = icmp slt i8 %sh, C2
  =>
%r = icmp slt i8 %x, (C2 << C1)

Name: lshr_exact_ugt
Pre: ((C2 << C1) u>> C1) == C2
%sh = lshr exact i8 %x, C1
%r = icmp ugt i8 %sh, C2
  =>
%r = icmp ugt i8 %x, (C2 << C1)

Name: lshr_exact_ult
Pre: ((C2 << C1) u>> C1) == C2
%sh = lshr exact i8 %x, C1
%r = icmp ult i8 %sh, C2
  =>
%r = icmp ult i8 %x, (C2 << C1)

We did something similar for 'shl' in D28406.

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

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

7 years ago[Hexagon] Make PS_fi and PS_fia extendable (they both expand to A2_addi)
Krzysztof Parzyszek [Thu, 5 Oct 2017 20:20:06 +0000 (20:20 +0000)]
[Hexagon] Make PS_fi and PS_fia extendable (they both expand to A2_addi)

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

7 years ago[dsymutil] Fix typo in swift-ast.test
Francis Ricci [Thu, 5 Oct 2017 20:16:16 +0000 (20:16 +0000)]
[dsymutil] Fix typo in swift-ast.test

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

7 years agoAnnotate VP prof on indirect call if it is ICPed in the profiled binary.
Dehao Chen [Thu, 5 Oct 2017 20:15:29 +0000 (20:15 +0000)]
Annotate VP prof on indirect call if it is ICPed in the profiled binary.

Summary: In SamplePGO, when an indirect call is promoted in the profiled binary, before profile annotation, it will be promoted and inlined. For the original indirect call, the current implementation will not mark VP profile on it. This is an issue when profile becomes stale. This patch annotates VP prof on indirect calls during annotation.

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: sanjoy, llvm-commits

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

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

7 years ago[llvm-dsymutil] Add support for __swift_ast MachO DWARF section
Francis Ricci [Thu, 5 Oct 2017 20:03:01 +0000 (20:03 +0000)]
[llvm-dsymutil] Add support for __swift_ast MachO DWARF section

Summary:
Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging,
and which contains a byte-for-byte dump of the swiftmodule file.
Add this feature to llvm-dsymutil.

Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of
`__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil
(Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the
__swift_ast section).

Reviewers: aprantl, friss

Subscribers: llvm-commits, JDevlieghere

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

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

7 years ago[Hexagon] Give uniform names to functions changing addressing modes, NFC
Krzysztof Parzyszek [Thu, 5 Oct 2017 20:01:38 +0000 (20:01 +0000)]
[Hexagon] Give uniform names to functions changing addressing modes, NFC

The new format is changeAddrMode_xx_yy, where xx is the current mode,
and yy is the new one.

Old name:               New name:
getBaseWithImmOffset    changeAddrMode_abs_io
getAbsoluteForm         changeAddrMode_io_abs
getBaseWithRegOffset    changeAddrMode_io_rr
xformRegToImmOffset     changeAddrMode_rr_io
getBaseWithLongOffset   changeAddrMode_rr_ur
getRegShlForm           changeAddrMode_ur_rr

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

7 years agoAdded phdr upper bound checks to ElfObject.
Rafael Espindola [Thu, 5 Oct 2017 20:01:32 +0000 (20:01 +0000)]
Added phdr upper bound checks to ElfObject.

Ensure the program_headers call will fail correctly if the program
headers are larger than the underlying buffer.

Patch by Parker Thompson!

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

7 years agoRevert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"
Francis Ricci [Thu, 5 Oct 2017 19:47:13 +0000 (19:47 +0000)]
Revert "[llvm-dsymutil] Add support for __swift_ast MachO DWARF section"

This reverts commit r315004, because of a failing test on non-apple platforms

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

7 years ago[dsymutil] Fix unused variable warning
Francis Ricci [Thu, 5 Oct 2017 19:35:55 +0000 (19:35 +0000)]
[dsymutil] Fix unused variable warning

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

7 years ago[llvm-dsymutil] Add support for __swift_ast MachO DWARF section
Francis Ricci [Thu, 5 Oct 2017 19:17:28 +0000 (19:17 +0000)]
[llvm-dsymutil] Add support for __swift_ast MachO DWARF section

Summary:
Xcode's dsymutil emits a __swift_ast DWARF section, which is required for debugging,
and which contains a byte-for-byte dump of the swiftmodule file.
Add this feature to llvm-dsymutil.

Tested with `gobjdump --dwarf=info -s`, by verifying that the contents of
`__DWARF.__swift_ast` match between Xcode's dsymutil and llvm-dsymutil
(Xcode's dwarfdump and llvm-dwarfdump don't currently recognize the
__swift_ast section).

Reviewers: aprantl, friss

Subscribers: llvm-commits, JDevlieghere

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

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

7 years ago[NewPassManager] Run global dead code elimination after the inliner.
Davide Italiano [Thu, 5 Oct 2017 18:36:01 +0000 (18:36 +0000)]
[NewPassManager] Run global dead code elimination after the inliner.

This is the same exact change we did for the current pass manager
in rL314997, but the new pass manager pipeline already happened
to run GlobalOpt after the inliner, so we just insert a run of
GDCE here.

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

7 years ago[ARM/AARCH64] Make test MachineBranchProb.ll more robust and re-enable for ARM/AArch64
Balaram Makam [Thu, 5 Oct 2017 18:33:34 +0000 (18:33 +0000)]
[ARM/AARCH64] Make test MachineBranchProb.ll more robust and re-enable for ARM/AArch64

Summary: Make test robust enough to not fail due to CFG changes and re-enable for ARM/AArch64.

Reviewers: rovka, fhahn

Reviewed By: fhahn

Subscribers: fhahn, aemerson, rengolin, mcrosier, llvm-commits, kristof.beyls

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

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

7 years ago[X86] Simplify X86 epilogue frame size calculation, NFC
Reid Kleckner [Thu, 5 Oct 2017 18:27:08 +0000 (18:27 +0000)]
[X86] Simplify X86 epilogue frame size calculation, NFC

Sink the insertion of "pop ebp" out of the frame size calculation
branches. They all check for HasFP.

Our handling of CLEANUPRET and CATCHRET was equivalent, both are
funclets and use the same frame size. We can eliminate the CLEANUPRET
case.

Hoist the hasFP(MF) query into a local bool.

Rename TargetMBB to CatchRetTarget to be more descriptive.

Eliminate the Optional<unsigned> RetOpcode local, now that it has one
use.

It's only a net savings of 10 lines, but hopefully it's *slightly* more
readable.

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

7 years ago[PassManager] Improve the interaction between -O2 and ThinLTO.
Davide Italiano [Thu, 5 Oct 2017 18:23:25 +0000 (18:23 +0000)]
[PassManager] Improve the interaction between -O2 and ThinLTO.

Run GDCE slightly later so that we don't have to repeat it
twice when preparing for Thin. Thanks to Mehdi for the suggestion.

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

7 years ago[PassManager] Run global optimizations after the inliner.
Davide Italiano [Thu, 5 Oct 2017 18:06:37 +0000 (18:06 +0000)]
[PassManager] Run global optimizations after the inliner.

The inliner performs some kind of dead code elimination as it goes,
but there are cases that are not really caught by it. We might
at some point consider teaching the inliner about them, but it
is OK for now to run GlobalOpt + GlobalDCE in tandem as their
benefits generally outweight the cost, making the whole pipeline
faster.

This fixes PR34652.

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

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

7 years ago[SparsePropagation] Move member definitions to header (NFC)
Matthew Simpson [Thu, 5 Oct 2017 18:03:30 +0000 (18:03 +0000)]
[SparsePropagation] Move member definitions to header (NFC)

AbstractLatticeFunction and SparseSolver are class templates parameterized by a
lattice value, so we need to move these member functions over to the header.

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

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

7 years ago[mips] implement .set dspr2 directive
Petar Jovanovic [Thu, 5 Oct 2017 17:40:32 +0000 (17:40 +0000)]
[mips] implement .set dspr2 directive

Implement .set dspr2 directive with appropriate feature bits. This
directive is a counterpart of -mattr=dspr2 command line option with the
exception that it does not influence elf header flags.

Patch by Milos Stojanovic.

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

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

7 years agoAMDGPU: Set v2i32 any_extend to expand
Matt Arsenault [Thu, 5 Oct 2017 17:38:30 +0000 (17:38 +0000)]
AMDGPU: Set v2i32 any_extend to expand

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

7 years ago[RDF] Simplify construction of maximal registers
Krzysztof Parzyszek [Thu, 5 Oct 2017 17:12:49 +0000 (17:12 +0000)]
[RDF] Simplify construction of maximal registers

The old algoritm was not correct, although it worked most of the time.
Avoid the complex reachability analysis and simply calculate the maximal
registers out of the set of all referenced registers.

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

7 years ago[ProfileData] Fix data racing in merging indexed profiles
Rong Xu [Thu, 5 Oct 2017 17:05:20 +0000 (17:05 +0000)]
[ProfileData] Fix data racing in merging indexed profiles

There is data racing to the static variable RecordIndex in index profile reader
when merging in multiple threads. Make it a member variable in
IndexedInstrProfReader to fix this.

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

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

7 years ago[X86] Fix chains update when lowering BUILD_VECTOR to a vector load
Artur Pilipenko [Thu, 5 Oct 2017 16:28:21 +0000 (16:28 +0000)]
[X86] Fix chains update when lowering BUILD_VECTOR to a vector load

The code which lowers BUILD_VECTOR of consecutive loads into a single vector
load doesn't update chains properly. As a result the vector load can be
reordered with the store to the same location.

The current code in EltsFromConsecutiveLoads only updates the chain following
the first load. The fix is to update the chains following all the loads
comprising the vector.

This is a fix for PR10114.

Reviewed By: niravd

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

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

7 years agoAMDGPU: Add and set AMDGPU-specific e_flags
Konstantin Zhuravlyov [Thu, 5 Oct 2017 16:19:18 +0000 (16:19 +0000)]
AMDGPU: Add and set AMDGPU-specific e_flags

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

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

7 years ago[LV] Fix PR34743 - handle casts that sink after interleaved loads
Ayal Zaks [Thu, 5 Oct 2017 15:45:14 +0000 (15:45 +0000)]
[LV] Fix PR34743 - handle casts that sink after interleaved loads

When ignoring a load that participates in an interleaved group, make sure to
move a cast that needs to sink after it.

Testcase derived from reproducer of PR34743.

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

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

7 years agoRevert "Re-land "[MergeICmps] Disable mergeicmps if the target does not want to handl...
Clement Courbet [Thu, 5 Oct 2017 14:42:06 +0000 (14:42 +0000)]
Revert "Re-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion."""

broken test on windows

This reverts commit c91479518344fd1fc071c5bd5848f6eb83e53dca.

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

7 years agorevert r314698 - [InstCombine] remove one-use restriction for icmp (shr exact X,...
Sanjay Patel [Thu, 5 Oct 2017 14:26:15 +0000 (14:26 +0000)]
revert r314698 - [InstCombine] remove one-use restriction for icmp (shr exact X, C1), C2 --> icmp X, (C2<<C1)

There is a bot failure that appears to be related to this change:
http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-selfhost-neon/builds/2117

...so reverting to confirm that and attempting to keep the bot green while investigating.

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

7 years ago[TablgeGen] : Tidy up CodeGenSchedule. NFC.
Javed Absar [Thu, 5 Oct 2017 13:27:43 +0000 (13:27 +0000)]
[TablgeGen] : Tidy up CodeGenSchedule. NFC.

Reviewed by: @MatzeB
Differential Revision: https://reviews.llvm.org/D38534

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

7 years ago[LV] Fix PR34711 - widen instruction ranges when sinking casts
Ayal Zaks [Thu, 5 Oct 2017 12:41:49 +0000 (12:41 +0000)]
[LV] Fix PR34711 - widen instruction ranges when sinking casts

Instead of trying to keep LastWidenRecipe updated after creating each recipe,
have tryToWiden() retrieve the last recipe of the current VPBasicBlock and check
if it's a VPWidenRecipe when attempting to extend its range. This ensures that
such extensions, optimized to maintain the original instruction order, do so
only when the instructions are to maintain their relative order. The latter does
not always hold, e.g., when a cast needs to sink to unravel first order
recurrence (r306884).

Testcase derived from reproducer of PR34711.

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

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

7 years agoRe-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp...
Clement Courbet [Thu, 5 Oct 2017 12:39:57 +0000 (12:39 +0000)]
Re-land "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion.""

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

7 years ago[mips] Place certain 64 bit FPU instructions in their own decoder namespace
Simon Dardis [Thu, 5 Oct 2017 10:27:37 +0000 (10:27 +0000)]
[mips] Place certain 64 bit FPU instructions in their own decoder namespace

Previously, instructions that were defined to use the FGR64 register class
were associated with the Mips64 table which was incorrect.

Reviewers: nitesh.jain, atanasyan

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

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

7 years ago[DebugInfo] Insert DEBUG_VALUEs after each register redefinition
Karl-Johan Karlsson [Thu, 5 Oct 2017 08:37:31 +0000 (08:37 +0000)]
[DebugInfo] Insert DEBUG_VALUEs after each register redefinition

Summary:
When reinserting debug values after register allocation, make sure to
insert debug values after each redefinition of debug value register in
the slot index range. The reason for this is that DwarfDebug will end
the range of a debug variable when the physical reg is defined. For
instructions with e.g. tied operands this result in prematurely ended
debug range.

This resolves pr34545

Patch by Karl-Johan Karlsson and Bjorn Pettersson

Reviewers: rnk, aprantl

Reviewed By: rnk

Subscribers: bjope, llvm-commits

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

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

7 years ago[MC] - llvm-mc hangs on non-english characters.
George Rimar [Thu, 5 Oct 2017 08:15:55 +0000 (08:15 +0000)]
[MC] - llvm-mc hangs on non-english characters.

Currently llvm-mc just hangs inside infinite loop
while trying to parse file which has ".section .с" inside,
where section name is non-english character.
Patch fixes the issue.

In this patch I also moved content of non-english-characters.s
to test/MC/AsmParser/Inputs folder  so that non-english-characters.s
becomes a single testcase for all invalid inputs containing non-english
symbols. That is convinent because llvm-mc otherwise tries
to parse and tokenize the whole testcase file with tools invocations and
it is harder to isolate the issue.

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

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

7 years agoRevert "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp...
Clement Courbet [Thu, 5 Oct 2017 08:03:39 +0000 (08:03 +0000)]
Revert "[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion."

Breaks
clang-stage1-cmake-RA-incremental/llvm/test/Transforms/MergeICmps/X86/tuple-four-int8.ll

This reverts commit 3038c459d67f8898ffa295d54a013b280690abfa.

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

7 years ago[InstCombine] Fix a vector splat handling bug in transformZExtICmp.
Craig Topper [Thu, 5 Oct 2017 07:59:11 +0000 (07:59 +0000)]
[InstCombine] Fix a vector splat handling bug in transformZExtICmp.

We were using an i1 type and then zero extending to a vector. Instead just create the 0/1 directly as a ConstantInt with the correct type. No need to ask ConstantExpr to zero extend for us.

This bug is a bit tricky to hit because it requires us to visit a zext of an icmp that would normally be simplified to true/false, but that icmp hasnt' been visited yet. In the test case this zext and icmp were created by visiting a udiv and due to worklist ordering we got to the zext first.

Fixes PR34841.

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

7 years ago[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion.
Clement Courbet [Thu, 5 Oct 2017 07:49:09 +0000 (07:49 +0000)]
[MergeICmps] Disable mergeicmps if the target does not want to handle memcmp expansion.

Summary: This is to avoid e.g. merging two cheap icmps if the target is not going to expand to something nice later.

Reviewers: dberlin, spatel

Subscribers: davide, nemanjai

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

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

7 years agoMinor refactoring regarding Cast::isNoopCast(), NFC
Mikael Holmen [Thu, 5 Oct 2017 07:07:09 +0000 (07:07 +0000)]
Minor refactoring regarding Cast::isNoopCast(), NFC

Summary:
FastISel::hasTrivialKill() was the only user of the "IntPtrTy" version of
Cast::isNoopCast(). According to review comments in D37894 we could instead
use the "DataLayout" version of the method, and thus get rid of the
"IntPtrTy" versions of isNoopCast() completely.

With the above done, the remaining isNoopCast() could then be simplified
a bit more.

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: wdng, llvm-commits

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

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

7 years ago[XRay][tools] Support arg1 logging entries in the basic logging mode
Dean Michael Berris [Thu, 5 Oct 2017 05:18:17 +0000 (05:18 +0000)]
[XRay][tools] Support arg1 logging entries in the basic logging mode

Summary:
The arg1 logging handler changed in compiler-rt to start writing a
different type for entries encountered when logging the first argument
of XRay-instrumented functions. This change allows the trace loader to
support reading these record types as well as prepare for when the
basic (naive) mode implementation starts writing down the argument
payloads.

Without this change, binaries with arg1 logging support enabled start
writing unreadable logs for any of the XRay tracing tools.

Reviewers: pelikan

Subscribers: llvm-commits

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

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

7 years agoEnabling new pass manager in LTO (and thinLTO) link step.
Sean Fertile [Thu, 5 Oct 2017 01:48:42 +0000 (01:48 +0000)]
Enabling new pass manager in LTO (and thinLTO) link step.

Adds the option 'new-pass-manager' to the gold pluggin to enable using the
new pass manager during the lto/thinlto link step.

Patch by Graham Yiu.

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

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

7 years agoRevert r314928 to investigate thinLTO bootstrap failure
Xinliang David Li [Thu, 5 Oct 2017 01:40:13 +0000 (01:40 +0000)]
Revert r314928 to investigate thinLTO bootstrap failure

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

7 years ago[X86] Fix some Clang-tidy modernize-use-using and Include What You Use warnings;...
Eugene Zelenko [Thu, 5 Oct 2017 00:33:50 +0000 (00:33 +0000)]
[X86] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

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

7 years agoAMDGPU: Add comment about clamps
Matt Arsenault [Thu, 5 Oct 2017 00:13:20 +0000 (00:13 +0000)]
AMDGPU: Add comment about clamps

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

7 years agoAMDGPU: Do not fold clamp instructions when sources are different
Matt Arsenault [Thu, 5 Oct 2017 00:13:17 +0000 (00:13 +0000)]
AMDGPU: Do not fold clamp instructions when sources are different

Patch by hakzsam (Samuel Pitoiset)

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

7 years ago[InstCombine] Improve support for ashr in foldICmpAndShift
Craig Topper [Wed, 4 Oct 2017 23:06:13 +0000 (23:06 +0000)]
[InstCombine] Improve support for ashr in foldICmpAndShift

We can support ashr similar to lshr, if we know that none of the shifted in bits are used. In that case SimplifyDemandedBits would normally convert it to lshr. But that conversion doesn't happen if the shift has additional users.

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

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

7 years agoAMDGPU: Fix not accounting for instruction size in bundles
Matt Arsenault [Wed, 4 Oct 2017 22:59:12 +0000 (22:59 +0000)]
AMDGPU: Fix not accounting for instruction size in bundles

These were counted as 0. Fixes branch limit exceeded errors
in some large programs.

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

7 years agoAMDGPU: Correctly set EI_OSABI based on the os
Konstantin Zhuravlyov [Wed, 4 Oct 2017 22:44:13 +0000 (22:44 +0000)]
AMDGPU: Correctly set EI_OSABI based on the os

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

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